@abot-ai/runtime 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/src/capabilities/tool-types.d.ts +1 -1
- package/dist/src/model-gateway/providers/ollama/generation-options.d.ts +1 -3
- package/dist/src/model-gateway/providers/ollama/generation-options.js +1 -5
- package/dist/src/model-gateway/providers/ollama/payload.js +0 -8
- package/dist/src/model-gateway/server/request-body.js +1 -0
- package/dist/src/plugin-sdk/index.d.ts +2 -0
- package/dist/src/plugin-sdk/index.js +2 -0
- package/dist/src/plugin-sdk/tool-availability-brief.d.ts +9 -0
- package/dist/src/plugin-sdk/tool-availability-brief.js +48 -0
- package/dist/src/plugin-sdk/tool-availability-overview.d.ts +9 -0
- package/dist/src/plugin-sdk/tool-availability-overview.js +62 -0
- package/dist/src/runtime/adapters/registered-tool-payload-plan.d.ts +0 -9
- package/dist/src/runtime/adapters/registered-tool-payload-plan.js +0 -67
- package/dist/src/runtime/adapters/registered-tool-payload-related-artifacts.d.ts +13 -0
- package/dist/src/runtime/adapters/registered-tool-payload-related-artifacts.js +84 -0
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/catalog.js +4 -0
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/execution.js +3 -0
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-lifecycle.d.ts +1 -0
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-lifecycle.js +11 -1
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-stages.d.ts +1 -0
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-stages.js +9 -1
- package/dist/src/runtime/capabilities/request-bound-tool-registry.js +1 -24
- package/dist/src/runtime/capabilities/tool-availability.d.ts +6 -0
- package/dist/src/runtime/capabilities/tool-availability.js +28 -0
- package/dist/src/runtime/context/capability-brief.d.ts +25 -0
- package/dist/src/runtime/context/capability-brief.js +106 -0
- package/dist/src/runtime/context/request-tool-results-message-binding.d.ts +6 -0
- package/dist/src/runtime/context/request-tool-results-message-binding.js +30 -0
- package/dist/src/runtime/context/request-tool-results-scope.d.ts +3 -0
- package/dist/src/runtime/context/request-tool-results-scope.js +8 -0
- package/dist/src/runtime/context/request-tool-results.d.ts +8 -4
- package/dist/src/runtime/context/request-tool-results.js +49 -38
- package/dist/src/runtime/orchestration/role-calls/candidate-validation.js +8 -1
- package/dist/src/runtime/orchestration/role-calls/child-return.d.ts +4 -0
- package/dist/src/runtime/orchestration/role-calls/child-return.js +25 -5
- package/dist/src/runtime/orchestration/role-calls/command-decoder.js +8 -3
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/child-transitions.d.ts +1 -1
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/child-transitions.js +17 -2
- package/dist/src/runtime/orchestration/role-calls/command-dispatch.d.ts +1 -1
- package/dist/src/runtime/orchestration/role-calls/command-dispatch.js +2 -2
- package/dist/src/runtime/orchestration/role-calls/contracts.d.ts +5 -2
- package/dist/src/runtime/orchestration/role-calls/contracts.js +4 -4
- package/dist/src/runtime/orchestration/role-calls/dependency-results.d.ts +1 -1
- package/dist/src/runtime/orchestration/role-calls/dependency-results.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/index.d.ts +5 -1
- package/dist/src/runtime/orchestration/role-calls/index.js +5 -1
- package/dist/src/runtime/orchestration/role-calls/ledger.d.ts +3 -1
- package/dist/src/runtime/orchestration/role-calls/ledger.js +9 -2
- package/dist/src/runtime/orchestration/role-calls/reducer.d.ts +1 -1
- package/dist/src/runtime/orchestration/role-calls/reducer.js +2 -2
- package/dist/src/runtime/orchestration/role-calls/result-receipt.d.ts +49 -0
- package/dist/src/runtime/orchestration/role-calls/result-receipt.js +188 -0
- package/dist/src/runtime/orchestration/role-calls/return-result-receipt.d.ts +19 -0
- package/dist/src/runtime/orchestration/role-calls/return-result-receipt.js +52 -0
- package/dist/src/runtime/orchestration/role-calls/transactions.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/work-result-lineage.d.ts +34 -0
- package/dist/src/runtime/orchestration/role-calls/work-result-lineage.js +185 -0
- package/dist/src/runtime/orchestration/role-calls/work-result-receipt.d.ts +36 -0
- package/dist/src/runtime/orchestration/role-calls/work-result-receipt.js +187 -0
- package/dist/src/runtime/orchestration/role-executors/activation/result-normalization.js +6 -3
- package/dist/src/runtime/orchestration/role-executors/child-invocation/transaction.js +1 -0
- package/dist/src/runtime/orchestration/role-executors/contracts.d.ts +2 -1
- package/dist/src/runtime/orchestration/worker-capabilities/assignment-provenance.d.ts +36 -0
- package/dist/src/runtime/orchestration/worker-capabilities/assignment-provenance.js +171 -0
- package/dist/src/runtime/orchestration/worker-capabilities/contracts.d.ts +32 -1
- package/dist/src/runtime/orchestration/worker-capabilities/execution/invocation-preparation.d.ts +2 -1
- package/dist/src/runtime/orchestration/worker-capabilities/execution/invocation-preparation.js +3 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution.js +42 -19
- package/dist/src/runtime/orchestration/worker-capabilities/index.d.ts +2 -0
- package/dist/src/runtime/orchestration/worker-capabilities/index.js +2 -0
- package/dist/src/runtime/orchestration/worker-capabilities/payload-assignment-validation.d.ts +3 -0
- package/dist/src/runtime/orchestration/worker-capabilities/payload-assignment-validation.js +30 -0
- package/dist/src/runtime/orchestration/worker-capabilities/payload-author.js +8 -19
- package/dist/src/runtime/orchestration/worker-capabilities/payload-contracts.d.ts +5 -1
- package/dist/src/runtime/orchestration/worker-capabilities/payload-instructions.js +1 -1
- package/dist/src/runtime/orchestration/worker-capabilities/payload-source-provenance.d.ts +14 -0
- package/dist/src/runtime/orchestration/worker-capabilities/payload-source-provenance.js +132 -0
- package/dist/src/runtime/request/capability-brief.d.ts +5 -0
- package/dist/src/runtime/request/capability-brief.js +24 -0
- package/dist/src/runtime/request/execution-scope.d.ts +2 -1
- package/dist/src/runtime/request/role-executor-composition.js +1 -1
- package/dist/src/runtime/request/worker-capability-composition.d.ts +2 -1
- package/dist/src/runtime/request/worker-capability-composition.js +6 -1
- package/dist/src/runtime/request/worker-capability-payload.js +11 -8
- package/dist/src/runtime/steps/execution-agent/prompt.js +4 -3
- package/dist/src/runtime/steps/planner-decision/capability-catalog-context.d.ts +14 -0
- package/dist/src/runtime/steps/planner-decision/capability-catalog-context.js +87 -0
- package/dist/src/runtime/steps/planner-decision/contracts.d.ts +3 -5
- package/dist/src/runtime/steps/planner-decision/contracts.js +3 -3
- package/dist/src/runtime/steps/planner-decision/format.d.ts +3 -2
- package/dist/src/runtime/steps/planner-decision/format.js +73 -76
- package/dist/src/runtime/steps/planner-decision/input.d.ts +4 -3
- package/dist/src/runtime/steps/planner-decision/input.js +10 -7
- package/dist/src/runtime/steps/planner-decision/parser.d.ts +3 -2
- package/dist/src/runtime/steps/planner-decision/parser.js +10 -19
- package/dist/src/runtime/steps/planner-decision/plan-parser.js +18 -12
- package/dist/src/runtime/steps/planner-decision/prompt.js +33 -28
- package/dist/src/runtime/steps/planner-decision/resume.d.ts +1 -1
- package/dist/src/runtime/steps/planner-decision/resume.js +38 -1
- package/dist/src/runtime/steps/planner-decision/run.d.ts +3 -2
- package/dist/src/runtime/steps/reviewer-decision/audit-coverage.d.ts +10 -0
- package/dist/src/runtime/steps/reviewer-decision/audit-coverage.js +186 -0
- package/dist/src/runtime/steps/reviewer-decision/contracts.d.ts +3 -8
- package/dist/src/runtime/steps/reviewer-decision/contracts.js +12 -6
- package/dist/src/runtime/steps/reviewer-decision/delegated-context.d.ts +24 -0
- package/dist/src/runtime/steps/reviewer-decision/delegated-context.js +70 -0
- package/dist/src/runtime/steps/reviewer-decision/diagnostics.js +1 -1
- package/dist/src/runtime/steps/reviewer-decision/format.js +37 -24
- package/dist/src/runtime/steps/reviewer-decision/input.js +1 -1
- package/dist/src/runtime/steps/reviewer-decision/model-context.d.ts +4 -3
- package/dist/src/runtime/steps/reviewer-decision/model-context.js +92 -10
- package/dist/src/runtime/steps/reviewer-decision/parser.js +19 -1
- package/dist/src/runtime/steps/reviewer-decision/projection.js +42 -68
- package/dist/src/runtime/steps/reviewer-decision/prompt.js +10 -5
- package/dist/src/runtime/steps/reviewer-decision/run.js +12 -3
- package/dist/src/runtime/steps/reviewer-decision/verification-coverage.d.ts +14 -0
- package/dist/src/runtime/steps/reviewer-decision/verification-coverage.js +52 -0
- package/dist/src/runtime/steps/supervisor-decision/capability-brief.d.ts +14 -0
- package/dist/src/runtime/steps/supervisor-decision/capability-brief.js +38 -0
- package/dist/src/runtime/steps/supervisor-decision/contracts.d.ts +7 -3
- package/dist/src/runtime/steps/supervisor-decision/diagnostics.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/diagnostics.js +8 -2
- package/dist/src/runtime/steps/supervisor-decision/format.js +32 -20
- package/dist/src/runtime/steps/supervisor-decision/input.d.ts +4 -1
- package/dist/src/runtime/steps/supervisor-decision/input.js +19 -1
- package/dist/src/runtime/steps/supervisor-decision/parser.js +62 -59
- package/dist/src/runtime/steps/supervisor-decision/prompt.js +6 -7
- package/dist/src/runtime/steps/supervisor-decision/resume.js +47 -1
- package/dist/src/runtime/steps/supervisor-decision/run.js +10 -0
- package/dist/src/runtime/steps/supervisor-decision/working-directory.js +2 -1
- package/dist/src/runtime/steps/worker-decision/contracts.d.ts +2 -1
- package/dist/src/runtime/steps/worker-decision/input/canonical-state.js +8 -1
- package/dist/src/runtime/steps/worker-decision/input/diagnostic-projection.js +2 -2
- package/dist/src/runtime/steps/worker-decision/input/prompt-context.d.ts +1 -0
- package/dist/src/runtime/steps/worker-decision/input/prompt-context.js +4 -1
- package/dist/src/runtime/steps/worker-decision/input/reference-context.js +34 -14
- package/dist/src/runtime/steps/worker-decision/input/types.d.ts +2 -1
- package/dist/src/runtime/steps/worker-decision/input.d.ts +1 -0
- package/dist/src/runtime/steps/worker-decision/input.js +1 -0
- package/dist/src/runtime/steps/worker-decision/payload-dependency-results.d.ts +8 -0
- package/dist/src/runtime/steps/worker-decision/payload-dependency-results.js +19 -0
- package/dist/src/runtime/steps/worker-decision/prompt.js +8 -8
- package/dist/src/runtime/steps/worker-decision/result-author.js +18 -11
- package/dist/src/runtime/steps/worker-decision/run.js +2 -2
- package/dist/src/web-ui/app/ARCHITECTURE.md +19 -6
- package/dist/src/web-ui/app/app.js +6 -7
- package/dist/src/web-ui/app/components/composer-context-window.d.ts +25 -0
- package/dist/src/web-ui/app/components/composer-context-window.js +155 -0
- package/dist/src/web-ui/app/components/composer-plan.d.ts +9 -0
- package/dist/src/web-ui/app/components/composer-plan.js +128 -0
- package/dist/src/web-ui/app/components/conversation-activity.d.ts +5 -6
- package/dist/src/web-ui/app/components/conversation-activity.js +64 -157
- package/dist/src/web-ui/app/components/conversation-role-cards.d.ts +23 -0
- package/dist/src/web-ui/app/components/conversation-role-cards.js +181 -0
- package/dist/src/web-ui/app/components/conversation-sidebar-layout.js +12 -0
- package/dist/src/web-ui/app/components/conversation-sources.d.ts +7 -0
- package/dist/src/web-ui/app/components/conversation-sources.js +182 -0
- package/dist/src/web-ui/app/components/conversation-view.js +34 -6
- package/dist/src/web-ui/app/components/model-selector.js +4 -1
- package/dist/src/web-ui/app/components/operations-section.js +46 -0
- package/dist/src/web-ui/app/components/workspace-shell.js +86 -78
- package/dist/src/web-ui/app/controllers/realtime-event-controller.d.ts +1 -0
- package/dist/src/web-ui/app/controllers/realtime-event-controller.js +55 -90
- package/dist/src/web-ui/app/controllers/runtime-selection-controller.js +2 -0
- package/dist/src/web-ui/app/controllers/session-controller.js +17 -12
- package/dist/src/web-ui/app/index.html +209 -210
- package/dist/src/web-ui/app/lib/composer-plan-model.d.ts +32 -0
- package/dist/src/web-ui/app/lib/composer-plan-model.js +108 -0
- package/dist/src/web-ui/app/lib/conversation-role-model.d.ts +19 -0
- package/dist/src/web-ui/app/lib/conversation-role-model.js +193 -0
- package/dist/src/web-ui/app/lib/event-presentation.js +30 -9
- package/dist/src/web-ui/app/lib/source-url-policy.d.ts +2 -0
- package/dist/src/web-ui/app/lib/source-url-policy.js +31 -0
- package/dist/src/web-ui/app/lib/task-progress.d.ts +53 -0
- package/dist/src/web-ui/app/lib/task-progress.js +233 -0
- package/dist/src/web-ui/app/lib/tool-invocation-count.d.ts +5 -0
- package/dist/src/web-ui/app/lib/tool-invocation-count.js +21 -0
- package/dist/src/web-ui/app/lib/web-source-event.d.ts +8 -0
- package/dist/src/web-ui/app/lib/web-source-event.js +21 -0
- package/dist/src/web-ui/app/lib/web-sources.d.ts +36 -0
- package/dist/src/web-ui/app/lib/web-sources.js +177 -0
- package/dist/src/web-ui/app/styles/00-tokens-base.css +15 -3
- package/dist/src/web-ui/app/styles/10-shell-sessions.css +24 -34
- package/dist/src/web-ui/app/styles/12-conversation-sidebar.css +93 -0
- package/dist/src/web-ui/app/styles/20-chat-composer.css +55 -472
- package/dist/src/web-ui/app/styles/21-composer-controls.css +368 -0
- package/dist/src/web-ui/app/styles/22-composer-context-window.css +90 -0
- package/dist/src/web-ui/app/styles/23-composer-plan.css +171 -0
- package/dist/src/web-ui/app/styles/24-conversation-role-cards.css +205 -0
- package/dist/src/web-ui/app/styles/25-conversation-sources.css +141 -0
- package/dist/src/web-ui/app/styles/30-inspector-config.css +21 -209
- package/dist/src/web-ui/app/styles/35-memory-onboarding.css +8 -8
- package/dist/src/web-ui/app/styles/36-memory-management.css +13 -13
- package/dist/src/web-ui/app/styles/37-config-operations.css +197 -0
- package/dist/src/web-ui/app/styles/40-config-workspace.css +36 -36
- package/dist/src/web-ui/app/styles/90-responsive.css +14 -77
- package/dist/src/web-ui/app/styles/foundation.css +2 -2
- package/dist/src/web-ui/app/styles.css +7 -0
- package/dist/src/web-ui/app/ui-behavior.d.ts +1 -1
- package/dist/src/web-ui/app/ui-behavior.js +1 -1
- package/docs/configuration.md +15 -8
- package/docs/installation.md +7 -4
- package/docs/known-limitations.md +21 -0
- package/docs/plugins.md +28 -13
- package/docs/runtime-invariant-coverage.md +18 -17
- package/docs/runtime-prompt-policy-contracts.md +27 -17
- package/package.json +4 -3
- package/plugins/capability-brief/source/index.ts +5 -48
- package/plugins/capability-brief/src/index.cjs +46 -33
- package/plugins/system-probe/plugin.json +1 -0
- package/plugins/web/README.md +125 -0
- package/plugins/web/plugin.json +1 -1
- package/plugins/web/skills/web_fetch_skill/SKILL.md +2 -2
- package/plugins/web/skills/web_search_skill/SKILL.md +8 -4
- package/plugins/web/source/errors.ts +5 -1
- package/plugins/web/source/fetch-presentation.ts +61 -0
- package/plugins/web/source/fetch-service.ts +2 -31
- package/plugins/web/source/light/config.ts +196 -0
- package/plugins/web/source/light/crawl/origin-gate.ts +134 -0
- package/plugins/web/source/light/crawl/robots-cache.ts +71 -0
- package/plugins/web/source/light/crawl/robots-parser.ts +132 -0
- package/plugins/web/source/light/crawl/robots-policy.ts +154 -0
- package/plugins/web/source/light/crawl/session-budget.ts +141 -0
- package/plugins/web/source/light/crawl/transport.ts +216 -0
- package/plugins/web/source/light/discovery/candidate-values.ts +63 -0
- package/plugins/web/source/light/discovery/feed-document.ts +127 -0
- package/plugins/web/source/light/discovery/html-links.ts +80 -0
- package/plugins/web/source/light/discovery/html-robots-directives.ts +29 -0
- package/plugins/web/source/light/discovery/markup-tree.ts +145 -0
- package/plugins/web/source/light/discovery/origin-dates.ts +71 -0
- package/plugins/web/source/light/discovery/sitemap-document.ts +63 -0
- package/plugins/web/source/light/documents/cache-policy.ts +28 -0
- package/plugins/web/source/light/documents/document-cache.ts +99 -0
- package/plugins/web/source/light/documents/document-charset.ts +89 -0
- package/plugins/web/source/light/documents/document-contract.ts +20 -0
- package/plugins/web/source/light/documents/document-reader.ts +75 -0
- package/plugins/web/source/light/documents/extract-document.ts +124 -0
- package/plugins/web/source/light/documents/http-cache-freshness.ts +68 -0
- package/plugins/web/source/light/documents/response-decoding.ts +120 -0
- package/plugins/web/source/light/ranking/document-ranking.ts +114 -0
- package/plugins/web/source/light/ranking/query-normalization.ts +69 -0
- package/plugins/web/source/light/search-collection.ts +136 -0
- package/plugins/web/source/light/search-frontier.ts +246 -0
- package/plugins/web/source/light/search-metadata.ts +84 -0
- package/plugins/web/source/light/search-service.ts +154 -0
- package/plugins/web/source/light/search-unavailable.ts +33 -0
- package/plugins/web/source/light/sources/catalog.ts +312 -0
- package/plugins/web/source/light/sources/source-definition.ts +9 -0
- package/plugins/web/source/light/sources/source-selection.ts +35 -0
- package/plugins/web/source/plugin.ts +70 -56
- package/plugins/web/source/public-http.ts +10 -1
- package/plugins/web/source/search-presentation.ts +63 -63
- package/plugins/web/source/search-service-selector.ts +31 -0
- package/plugins/web/source/search-service.ts +6 -0
- package/plugins/web/source/search-source-presentation.ts +76 -0
- package/plugins/web/source/search-types.ts +4 -0
- package/plugins/web/source/source-output-receipts.ts +267 -0
- package/plugins/web/source/source-receipt-budget.ts +51 -0
- package/plugins/web/source/source-receipt-contract.ts +18 -0
- package/plugins/web/src/index.cjs +3214 -288
- package/src/runtime/README.md +30 -9
- package/dist/src/model-gateway/structured-output/budget.d.ts +0 -7
- package/dist/src/model-gateway/structured-output/budget.js +0 -20
- package/dist/src/model-gateway/structured-output/schema-character-estimator.d.ts +0 -1
- package/dist/src/model-gateway/structured-output/schema-character-estimator.js +0 -211
- package/dist/src/model-gateway/structured-output-budget.d.ts +0 -1
- package/dist/src/model-gateway/structured-output-budget.js +0 -1
package/src/runtime/README.md
CHANGED
|
@@ -112,10 +112,14 @@ isolation boundaries.
|
|
|
112
112
|
directly and consumes their mechanically linked continuation before choosing
|
|
113
113
|
its next action. It does not create a second root or state machine.
|
|
114
114
|
- **Delegated Planner contract** coordinates one bounded delegated objective.
|
|
115
|
-
It
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
It declares every currently known execution outcome before its first child
|
|
116
|
+
dispatch. Each Worker invocation binds exactly one independently completable
|
|
117
|
+
production item; after consuming that bound result, a later activation may
|
|
118
|
+
select the next pending production item. Planner invokes only Worker and
|
|
119
|
+
represents the completed sub-process to Supervisor, which separately owns
|
|
120
|
+
Reviewer delegation and audit decisions. For a Worker child, Planner selects
|
|
121
|
+
only the smallest complete set of offered catalog groups; the Worker still
|
|
122
|
+
owns capability and control selection.
|
|
119
123
|
- **Planner Graph advisory contract** may propose or decline one bounded
|
|
120
124
|
dependency graph for the Execution Agent. It is a terminal passive child
|
|
121
125
|
result: it cannot execute graph nodes, write canonical plan state, or commit
|
|
@@ -125,8 +129,9 @@ isolation boundaries.
|
|
|
125
129
|
observation or effect is required. Its structured decision selects the
|
|
126
130
|
action; substantive completion text is authored separately as raw text.
|
|
127
131
|
- **Reviewer** independently assesses bounded supplied work in the delegated
|
|
128
|
-
policy and returns a
|
|
129
|
-
|
|
132
|
+
policy and returns a human-readable summary plus a bounded, revision-bound
|
|
133
|
+
`reviewer_verdict_v1` receipt to its exact caller. The receipt is passive
|
|
134
|
+
canonical evidence; it does not choose remediation or finalization.
|
|
130
135
|
- **Auditor** receives typed criteria and whole canonical evidence entries in
|
|
131
136
|
the direct policy. It returns a passive pass/gaps advisory; omitted evidence
|
|
132
137
|
makes pass unavailable and the root still owns the next action.
|
|
@@ -135,6 +140,14 @@ A Planner Graph or Auditor structured-output validation failure settles as a
|
|
|
135
140
|
failed passive child result and returns to the root; it does not write plan
|
|
136
141
|
state, authorize execution, or commit request failure by itself.
|
|
137
142
|
|
|
143
|
+
Under `supervisor-worker-v1`, every terminal Planner or Worker result receives a
|
|
144
|
+
runtime-owned `work_result_v1` receipt. Supervisor and Planner continuations
|
|
145
|
+
receive that compact receipt together with a verified `work_result_lineage_v1`
|
|
146
|
+
projection; an explicitly dependent Worker receives only the compact receipt.
|
|
147
|
+
These structures prove canonical provenance, not semantic correctness, and do
|
|
148
|
+
not grant response, remediation, or capability authority. Model-supplied work
|
|
149
|
+
receipts are rejected. `execution-agent-v1` does not issue them.
|
|
150
|
+
|
|
138
151
|
Role choice belongs to the active role model. Runtime code validates the strict
|
|
139
152
|
action envelope, exact caller, role availability, current ledger head, and
|
|
140
153
|
global bounds; it does not infer work type from prompt text, paths, tool names,
|
|
@@ -142,14 +155,19 @@ or model prose.
|
|
|
142
155
|
|
|
143
156
|
## Canonical State
|
|
144
157
|
|
|
145
|
-
`orchestration/role-calls/` is the sole writer of the request-local call tree
|
|
158
|
+
`orchestration/role-calls/` ledger v17 is the sole writer of the request-local call tree
|
|
146
159
|
and role results. Each call frame records its caller, role, bounded objective,
|
|
147
160
|
depth, status, result reference, and any canonical capability catalog-group
|
|
148
161
|
scope. An authorized root, Planner, or Worker may also record one normalized
|
|
149
162
|
working directory; the role-call reducer is the sole writer of that immutable
|
|
150
163
|
scope. A Planner's Worker children inherit it mechanically and cannot replace
|
|
151
164
|
it.
|
|
152
|
-
A result returns only to that exact caller.
|
|
165
|
+
A result returns only to that exact caller. The ledger mechanically binds each
|
|
166
|
+
Supervisor-policy Planner or Worker result to its producer, caller, admitted
|
|
167
|
+
revision, and a lineage fingerprint. Full lineage is derived on demand from the
|
|
168
|
+
same ledger and verified against that fingerprint; it is not a second state
|
|
169
|
+
store and the compact receipt does not copy dependency, execution, or plan-item
|
|
170
|
+
lists.
|
|
153
171
|
|
|
154
172
|
The same reducer enforces one mechanical per-call activation ceiling for every
|
|
155
173
|
root and delegated call. The ceiling is derived from the existing request-wide
|
|
@@ -170,7 +188,10 @@ policy authority. The delegated Worker keeps its established assignment
|
|
|
170
188
|
capsule; a direct root payload binds the exact request source, ordered steering,
|
|
171
189
|
and immutable controls. Capability `intent` is bounded client-facing
|
|
172
190
|
presentation metadata and is never projected as payload authority or execution
|
|
173
|
-
evidence.
|
|
191
|
+
evidence. Before Worker payload or result authoring, dependency results are
|
|
192
|
+
narrowed to their existing result fields and optional `semanticCheckpoints`;
|
|
193
|
+
work receipts and derived lineage do not cross either raw authoring boundary.
|
|
194
|
+
There is no second payload or adapter pipeline for
|
|
174
195
|
`execution-agent-v1`.
|
|
175
196
|
|
|
176
197
|
When direct capability controls refinement exhausts structured-output
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ModelGatewayFormat, ModelTokenEstimationConfig } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Estimates the generation allowance for the largest bounded JSON shape using
|
|
4
|
-
* the selected profile's token estimator. Undefined means at least one output
|
|
5
|
-
* shape has no finite schema bound, so the provider must use physical capacity.
|
|
6
|
-
*/
|
|
7
|
-
export declare function estimateStrictStructuredOutputTokenCeiling(format: ModelGatewayFormat | undefined, tokenEstimation?: ModelTokenEstimationConfig): number | undefined;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { estimateAsciiCharacterTokens } from "../../runtime/context/token-estimator.js";
|
|
2
|
-
import { isModelGatewayJsonSchemaFormat } from "./format-contract.js";
|
|
3
|
-
import { estimateStrictSchemaCharacters } from "./schema-character-estimator.js";
|
|
4
|
-
const JSON_TERMINATION_TOKEN_RESERVE = 1;
|
|
5
|
-
/**
|
|
6
|
-
* Estimates the generation allowance for the largest bounded JSON shape using
|
|
7
|
-
* the selected profile's token estimator. Undefined means at least one output
|
|
8
|
-
* shape has no finite schema bound, so the provider must use physical capacity.
|
|
9
|
-
*/
|
|
10
|
-
export function estimateStrictStructuredOutputTokenCeiling(format, tokenEstimation) {
|
|
11
|
-
if (!isModelGatewayJsonSchemaFormat(format) || format.strict !== true) {
|
|
12
|
-
return undefined;
|
|
13
|
-
}
|
|
14
|
-
const maximumCharacters = estimateStrictSchemaCharacters(format.schema);
|
|
15
|
-
if (maximumCharacters === undefined) {
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
return Math.max(1, estimateAsciiCharacterTokens(maximumCharacters, tokenEstimation) +
|
|
19
|
-
JSON_TERMINATION_TOKEN_RESERVE);
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function estimateStrictSchemaCharacters(schema: Readonly<Record<string, unknown>>): number | undefined;
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
const MAX_SCHEMA_DEPTH = 32;
|
|
2
|
-
const MAX_SCHEMA_VISITS = 50_000;
|
|
3
|
-
const MAX_SERIALIZED_NUMBER_CHARACTERS = Math.max(JSON.stringify(Number.MAX_VALUE).length, JSON.stringify(-Number.MAX_VALUE).length, JSON.stringify(Number.MIN_VALUE).length, JSON.stringify(-Number.MIN_VALUE).length);
|
|
4
|
-
export function estimateStrictSchemaCharacters(schema) {
|
|
5
|
-
return estimateSchemaNodeCharacters(schema, 0, {
|
|
6
|
-
visits: 0,
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
function estimateSchemaNodeCharacters(schema, depth, state) {
|
|
10
|
-
state.visits += 1;
|
|
11
|
-
if (depth > MAX_SCHEMA_DEPTH || state.visits > MAX_SCHEMA_VISITS) {
|
|
12
|
-
return undefined;
|
|
13
|
-
}
|
|
14
|
-
const bounds = [];
|
|
15
|
-
const constantBound = estimateExactJsonCharacters(schema.const);
|
|
16
|
-
if (Object.hasOwn(schema, "const") && constantBound !== undefined) {
|
|
17
|
-
bounds.push(constantBound);
|
|
18
|
-
}
|
|
19
|
-
const enumBound = estimateEnumCharacters(schema.enum);
|
|
20
|
-
if (enumBound !== undefined) {
|
|
21
|
-
bounds.push(enumBound);
|
|
22
|
-
}
|
|
23
|
-
const typeBound = estimateDeclaredTypeCharacters(schema, depth, state);
|
|
24
|
-
if (typeBound !== undefined) {
|
|
25
|
-
bounds.push(typeBound);
|
|
26
|
-
}
|
|
27
|
-
for (const union of [schema.anyOf, schema.oneOf]) {
|
|
28
|
-
const unionBound = estimateUnionCharacters(union, depth, state);
|
|
29
|
-
if (unionBound !== undefined) {
|
|
30
|
-
bounds.push(unionBound);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const intersectionBound = estimateIntersectionCharacters(schema.allOf, depth, state);
|
|
34
|
-
if (intersectionBound !== undefined) {
|
|
35
|
-
bounds.push(intersectionBound);
|
|
36
|
-
}
|
|
37
|
-
return bounds.length > 0 ? minimum(bounds) : undefined;
|
|
38
|
-
}
|
|
39
|
-
function estimateDeclaredTypeCharacters(schema, depth, state) {
|
|
40
|
-
const types = readDeclaredTypes(schema);
|
|
41
|
-
if (types.length === 0) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
const bounds = types.map((type) => estimateTypeCharacters(type, schema, depth, state));
|
|
45
|
-
return bounds.every((bound) => bound !== undefined)
|
|
46
|
-
? maximum(bounds)
|
|
47
|
-
: undefined;
|
|
48
|
-
}
|
|
49
|
-
function readDeclaredTypes(schema) {
|
|
50
|
-
if (Array.isArray(schema.type)) {
|
|
51
|
-
return schema.type.filter((value) => typeof value === "string");
|
|
52
|
-
}
|
|
53
|
-
if (typeof schema.type === "string") {
|
|
54
|
-
return [schema.type];
|
|
55
|
-
}
|
|
56
|
-
return inferStructuralType(schema);
|
|
57
|
-
}
|
|
58
|
-
function inferStructuralType(schema) {
|
|
59
|
-
if (Object.hasOwn(schema, "properties"))
|
|
60
|
-
return ["object"];
|
|
61
|
-
if (Object.hasOwn(schema, "items"))
|
|
62
|
-
return ["array"];
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
|
-
function estimateTypeCharacters(type, schema, depth, state) {
|
|
66
|
-
switch (type) {
|
|
67
|
-
case "null":
|
|
68
|
-
return 4;
|
|
69
|
-
case "boolean":
|
|
70
|
-
return 5;
|
|
71
|
-
case "number":
|
|
72
|
-
case "integer":
|
|
73
|
-
return MAX_SERIALIZED_NUMBER_CHARACTERS;
|
|
74
|
-
case "string": {
|
|
75
|
-
const maxLength = readNonNegativeInteger(schema.maxLength);
|
|
76
|
-
return maxLength === undefined ? undefined : safeAdd(maxLength, 2);
|
|
77
|
-
}
|
|
78
|
-
case "array":
|
|
79
|
-
return estimateArrayCharacters(schema, depth, state);
|
|
80
|
-
case "object":
|
|
81
|
-
return estimateObjectCharacters(schema, depth, state);
|
|
82
|
-
default:
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
function estimateArrayCharacters(schema, depth, state) {
|
|
87
|
-
const maxItems = readNonNegativeInteger(schema.maxItems);
|
|
88
|
-
if (maxItems === undefined)
|
|
89
|
-
return undefined;
|
|
90
|
-
if (maxItems === 0)
|
|
91
|
-
return 2;
|
|
92
|
-
if (isPlainRecord(schema.items)) {
|
|
93
|
-
const itemCharacters = estimateSchemaNodeCharacters(schema.items, depth + 1, state);
|
|
94
|
-
return itemCharacters === undefined
|
|
95
|
-
? undefined
|
|
96
|
-
: safeAdd(2, safeAdd(maxItems - 1, safeMultiply(maxItems, itemCharacters)));
|
|
97
|
-
}
|
|
98
|
-
if (!Array.isArray(schema.items))
|
|
99
|
-
return undefined;
|
|
100
|
-
if (!schema.items.every(isPlainRecord))
|
|
101
|
-
return undefined;
|
|
102
|
-
const itemSchemas = schema.items;
|
|
103
|
-
const effectiveMaxItems = schema.additionalItems === false
|
|
104
|
-
? Math.min(maxItems, itemSchemas.length)
|
|
105
|
-
: maxItems;
|
|
106
|
-
const fixedItemCount = Math.min(effectiveMaxItems, itemSchemas.length);
|
|
107
|
-
let characters = safeAdd(2, Math.max(0, effectiveMaxItems - 1));
|
|
108
|
-
for (let index = 0; index < fixedItemCount; index += 1) {
|
|
109
|
-
const itemCharacters = estimateSchemaNodeCharacters(itemSchemas[index], depth + 1, state);
|
|
110
|
-
if (itemCharacters === undefined)
|
|
111
|
-
return undefined;
|
|
112
|
-
characters = safeAdd(characters, itemCharacters);
|
|
113
|
-
}
|
|
114
|
-
if (effectiveMaxItems <= itemSchemas.length)
|
|
115
|
-
return characters;
|
|
116
|
-
if (!isPlainRecord(schema.additionalItems))
|
|
117
|
-
return undefined;
|
|
118
|
-
const additionalCharacters = estimateSchemaNodeCharacters(schema.additionalItems, depth + 1, state);
|
|
119
|
-
return additionalCharacters === undefined
|
|
120
|
-
? undefined
|
|
121
|
-
: safeAdd(characters, safeMultiply(effectiveMaxItems - itemSchemas.length, additionalCharacters));
|
|
122
|
-
}
|
|
123
|
-
function estimateObjectCharacters(schema, depth, state) {
|
|
124
|
-
const hasPatternProperties = isPlainRecord(schema.patternProperties) &&
|
|
125
|
-
Object.keys(schema.patternProperties).length > 0;
|
|
126
|
-
const allowsUnboundedProperties = schema.additionalProperties !== false;
|
|
127
|
-
if (allowsUnboundedProperties || hasPatternProperties) {
|
|
128
|
-
return undefined;
|
|
129
|
-
}
|
|
130
|
-
if (schema.properties !== undefined && !isPlainRecord(schema.properties)) {
|
|
131
|
-
return undefined;
|
|
132
|
-
}
|
|
133
|
-
const properties = isPlainRecord(schema.properties)
|
|
134
|
-
? Object.entries(schema.properties)
|
|
135
|
-
: [];
|
|
136
|
-
let characters = safeAdd(2, Math.max(0, properties.length - 1));
|
|
137
|
-
for (const [property, propertySchema] of properties) {
|
|
138
|
-
if (!isPlainRecord(propertySchema))
|
|
139
|
-
return undefined;
|
|
140
|
-
const valueCharacters = estimateSchemaNodeCharacters(propertySchema, depth + 1, state);
|
|
141
|
-
if (valueCharacters === undefined)
|
|
142
|
-
return undefined;
|
|
143
|
-
characters = safeAdd(characters, safeAdd(JSON.stringify(property).length + 1, valueCharacters));
|
|
144
|
-
}
|
|
145
|
-
return characters;
|
|
146
|
-
}
|
|
147
|
-
function estimateUnionCharacters(value, depth, state) {
|
|
148
|
-
if (!Array.isArray(value) || value.length === 0)
|
|
149
|
-
return undefined;
|
|
150
|
-
const branches = value.filter(isPlainRecord);
|
|
151
|
-
if (branches.length !== value.length)
|
|
152
|
-
return undefined;
|
|
153
|
-
const bounds = branches.map((branch) => estimateSchemaNodeCharacters(branch, depth + 1, state));
|
|
154
|
-
return bounds.every((bound) => bound !== undefined)
|
|
155
|
-
? maximum(bounds)
|
|
156
|
-
: undefined;
|
|
157
|
-
}
|
|
158
|
-
function estimateIntersectionCharacters(value, depth, state) {
|
|
159
|
-
if (!Array.isArray(value) || value.length === 0)
|
|
160
|
-
return undefined;
|
|
161
|
-
const bounds = value
|
|
162
|
-
.filter(isPlainRecord)
|
|
163
|
-
.map((branch) => estimateSchemaNodeCharacters(branch, depth + 1, state))
|
|
164
|
-
.filter((bound) => bound !== undefined);
|
|
165
|
-
return bounds.length > 0 ? minimum(bounds) : undefined;
|
|
166
|
-
}
|
|
167
|
-
function estimateEnumCharacters(value) {
|
|
168
|
-
if (!Array.isArray(value) || value.length === 0)
|
|
169
|
-
return undefined;
|
|
170
|
-
const bounds = value.map(estimateExactJsonCharacters);
|
|
171
|
-
return bounds.every((bound) => bound !== undefined)
|
|
172
|
-
? maximum(bounds)
|
|
173
|
-
: undefined;
|
|
174
|
-
}
|
|
175
|
-
function estimateExactJsonCharacters(value) {
|
|
176
|
-
try {
|
|
177
|
-
const serialized = JSON.stringify(value);
|
|
178
|
-
return typeof serialized === "string" ? serialized.length : undefined;
|
|
179
|
-
}
|
|
180
|
-
catch {
|
|
181
|
-
return undefined;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
function readNonNegativeInteger(value) {
|
|
185
|
-
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0
|
|
186
|
-
? value
|
|
187
|
-
: undefined;
|
|
188
|
-
}
|
|
189
|
-
function isPlainRecord(value) {
|
|
190
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
const prototype = Object.getPrototypeOf(value);
|
|
194
|
-
return prototype === Object.prototype || prototype === null;
|
|
195
|
-
}
|
|
196
|
-
function safeAdd(left, right) {
|
|
197
|
-
return Math.min(Number.MAX_SAFE_INTEGER, left + right);
|
|
198
|
-
}
|
|
199
|
-
function safeMultiply(left, right) {
|
|
200
|
-
if (left === 0 || right === 0)
|
|
201
|
-
return 0;
|
|
202
|
-
return left > Number.MAX_SAFE_INTEGER / right
|
|
203
|
-
? Number.MAX_SAFE_INTEGER
|
|
204
|
-
: left * right;
|
|
205
|
-
}
|
|
206
|
-
function minimum(values) {
|
|
207
|
-
return values.reduce((result, value) => Math.min(result, value));
|
|
208
|
-
}
|
|
209
|
-
function maximum(values) {
|
|
210
|
-
return values.reduce((result, value) => Math.max(result, value));
|
|
211
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./structured-output/budget.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./structured-output/budget.js";
|