OpenSite/Reference/Features/Extension platform: Difference between revisions

From BathAfrica Documentation
Jump to navigation Jump to search
Use BathAfrica sidebar contents without duplicate inline contents box
Reorganize OpenSite reference with shared scope and related workflows
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{OpenSite scope}}
{{BathAfrica Feature
{{BathAfrica Feature
|review=Development documentation for OpenSite 0.0.1, source snapshot 77c3fee (Phase 13C). Reviewed against implementation on 29 October 2026. Tests and the Windows desktop were not rerun for this publication; this is not a released-product support claim.
|id=extensions.platform
|id=extensions.platform
|summary=Register extension object types, groups, templates, services and cooperative jobs through the shared application platform.
|summary=Register extension object types, groups, templates, services and cooperative jobs through the shared application platform.
Line 60: Line 60:
  nonfinite=non_finite_value
  nonfinite=non_finite_value


== Try this workflow ==
[[OpenSite/Guides/Build a native plugin|Build a native plugin]] — a worked lesson with expected results.


== Documentation basis ==
== Documentation basis ==
Line 70: Line 73:
[[OpenSite|OpenSite overview]] · [[OpenSite/Reference|Reference]] · [[OpenSite/Guides|Guides]]
[[OpenSite|OpenSite overview]] · [[OpenSite/Reference|Reference]] · [[OpenSite/Guides|Guides]]
[[Category:OpenSite documentation]]
[[Category:OpenSite documentation]]
<div class="os-page-nav">{{Docnav|OpenSite/Getting started|OpenSite/Guides|OpenSite/Guides|All guides}}</div>

Revision as of 13:59, 29 October 2026

OpenSite 0.0.1 · DevelopmentSource scope and availability


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:

  1. import opensite loads the headless module.
  2. load_plugin("sample.native") loads that discovered provider and registers sample_native.item, the starter template, and measure.
  3. The two parse_quantity lines and document.create_section create an ordinary section so the script has a document handle.
  4. extension.instantiate copies the template. The template length is 2 m, and the provider evaluator stores 4 m in doubled.
  5. extension.create_group and extension.add_member put that instance in a group. Membership is not a calculation dependency.
  6. The two print lines report the doubled length and that the group lists the new object.
  7. invoke_service calls sample_native.measure version 1. The capability is document.edit. The development policy allows it.
  8. step reports one completed step out of two and the catalog key jobs.sample.extension.
  9. watch records activity keys. submit_extension_job queues the job. The first pump_job runs one step. cancel_job records the request. The second pump_job stops at the checkpoint and does not publish a document result.
  10. document.save keeps the plugin object and prints save=accepted.
  11. request_gui raises gui_unavailable.
  12. update_extension_template replaces the starter copy. The instance created earlier keeps 2 m. The next extension.instantiate copies 9 m.
  13. extension.relate links those two instances. extension.remove_member takes the first instance out of the group and leaves the instance in the document.
  14. register_extension_service and add_service_requirement attach sample_script.ready to sample_native.measure. The requirement is checked on the next invoke.
  15. The note type is registered in the script. document.set_string, document.set_integer, document.set_real, document.set_boolean, and document.set_label edit it. text, integer, real, boolean, and live_text read it back. No transaction is open, so the live read matches the published text.
  16. duplicate returns two fields named value. invoke_service raises duplicate_id and returns no fields.
  17. infinite returns a non-finite real. invoke_service raises non_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.cpp
  • src/document/persistence.cpp
  • examples/python/extension_platform.py

OpenSite overview · Reference · Guides