OpenSite/Reference/Features/Extension platform: Difference between revisions
BathAfrica (talk | contribs) Reorganize OpenSite reference with shared scope and related workflows |
BathAfrica (talk | contribs) Link adjacent OpenSite reference pages in reading order |
||
| Line 74: | Line 74: | ||
[[Category:OpenSite documentation]] | [[Category:OpenSite documentation]] | ||
<div class="os-page-nav">{{Docnav|OpenSite/ | <div class="os-page-nav">{{Docnav|OpenSite/Reference/Features/Document files|OpenSite/Reference/Features/Message catalog|OpenSite/Guides|All guides}}</div> | ||
Latest revision as of 14:15, 29 October 2026
Register extension object types, groups, templates, services and cooperative jobs through the shared application platform.
- Stable identifier
extensions.platform
Status reported by source
Implemented in the reviewed development source. Historical test evidence is recorded by the repository; no test rerun or product release is claimed by this publication.
Units
Service quantities use the units engine. Activity text is a catalog key. The service does not translate it.
Behavior
A provider registers a namespaced type, a template, and a service through PluginServices or the Python register_extension_* functions. A template creates an independent instance. A group holds members and does not add a calculation dependency. A protected service or job checks the authorization policy already installed on the application. pump_job advances one step of the oldest running job, then the oldest queued job, on the owner thread.
Errors
duplicate_id, dependency_cycle, command_unavailable, authorization errors, gui_unavailable for a headless GUI request, cancelled, and stale_document. These depend on the operation. Plugin objects are now preserved by document persistence; the old blanket save refusal is obsolete.
Limitations
No independent worker-thread or solver capability is implied by the cooperative job queue. Cancellation waits for a checkpoint and cannot forcibly stop native code. Provider id, type id, schema version and payload are preserved on save. This is not a sandbox for trusted in-process code.
Available hosts
C++ ExtensionCatalog and JobService. Python execute, update_extension_template, add_service_requirement, invoke_service, submit_extension_job, job_progress, and request_gui.
Licensing and access
OpenSite code. The sample provider does not add a third-party solver or a scientific package.
Verification evidence
Repository evidence references (not rerun for this publication): docs/verification/Phase-7A-Acceptance.md.
The runnable script is examples/python/extension_platform.py. Run it with the development host after the native sample has been built into a child of --plugins:
opensite-python --development-host --runtime <prefix>\runtime --plugins <plugins> examples\python\extension_platform.py
Each line:
import opensiteloads the headless module.load_plugin("sample.native")loads that discovered provider and registerssample_native.item, the starter template, andmeasure.- The two
parse_quantitylines anddocument.create_sectioncreate an ordinary section so the script has a document handle. extension.instantiatecopies the template. The template length is 2 m, and the provider evaluator stores 4 m indoubled.extension.create_groupandextension.add_memberput that instance in a group. Membership is not a calculation dependency.- The two
printlines report the doubled length and that the group lists the new object. invoke_servicecallssample_native.measureversion 1. The capability isdocument.edit. The development policy allows it.stepreports one completed step out of two and the catalog keyjobs.sample.extension.watchrecords activity keys.submit_extension_jobqueues the job. The firstpump_jobruns one step.cancel_jobrecords the request. The secondpump_jobstops at the checkpoint and does not publish a document result.document.savekeeps the plugin object and printssave=accepted.request_guiraisesgui_unavailable.update_extension_templatereplaces the starter copy. The instance created earlier keeps 2 m. The nextextension.instantiatecopies 9 m.extension.relatelinks those two instances.extension.remove_membertakes the first instance out of the group and leaves the instance in the document.register_extension_serviceandadd_service_requirementattachsample_script.readytosample_native.measure. The requirement is checked on the next invoke.- The note type is registered in the script.
document.set_string,document.set_integer,document.set_real,document.set_boolean, anddocument.set_labeledit it.text,integer,real,boolean, andlive_textread it back. No transaction is open, so the live read matches the published text. duplicatereturns two fields namedvalue.invoke_serviceraisesduplicate_idand returns no fields.infinitereturns a non-finite real.invoke_serviceraisesnon_finite_value.
Expected terminal output:
doubled=4.0 member=True service=4.0 job=cancelled activity=jobs.sample.extension save=accepted gui=gui_unavailable kept=2.0 later=9.0 related=True removed=True requirement=ok label=Beam count=3 factor=1.5 flag=True live=Beam duplicate=duplicate_id nonfinite=non_finite_value
Try this workflow
Build a native plugin — a worked lesson with expected results.
Documentation basis
Source-reviewed against development commit 77c3fee13944bcc4b5d487c77eb1f82fbe4c6ea7, branch feature/phase-13c-properties-python-expressions. This review inspected the implementation and repository evidence; it did not run the Windows application or repeat CTest.
src/application/extension.cppsrc/document/persistence.cppexamples/python/extension_platform.py