@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/README.md
CHANGED
|
@@ -219,9 +219,12 @@ from core-owned passive long-term memory.
|
|
|
219
219
|
The Web plugin exposes two distinct capabilities:
|
|
220
220
|
|
|
221
221
|
- `web_fetch` retrieves a specific public HTTP(S) page without a search API key.
|
|
222
|
-
- `web_search` uses
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
- `web_search` uses Brave Search when `BRAVE_SEARCH_API_KEY` is configured.
|
|
223
|
+
Without a key, it uses Light search: bounded discovery and ranking within a
|
|
224
|
+
catalog of public Hebrew and English sources, without an external search
|
|
225
|
+
engine. Light has limited coverage; an empty result does not mean the
|
|
226
|
+
information is absent from the web. A configured Brave key that fails does
|
|
227
|
+
not trigger an automatic switch to Light.
|
|
225
228
|
|
|
226
229
|
Some plugins have platform-specific requirements. See [Plugins](docs/plugins.md)
|
|
227
230
|
for their contracts, limits, and configuration.
|
|
@@ -115,7 +115,7 @@ export type ToolRequestAttachment = Readonly<{
|
|
|
115
115
|
name?: string;
|
|
116
116
|
size?: number;
|
|
117
117
|
}>;
|
|
118
|
-
/** Minimal config-filtered tool fact
|
|
118
|
+
/** Minimal config-filtered tool fact; consumers project it for their own context. */
|
|
119
119
|
export type ToolAvailabilityEntry = Readonly<{
|
|
120
120
|
toolName: string;
|
|
121
121
|
operationId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResolvedModelInvocation } from "../../types.js";
|
|
2
2
|
export declare function readOptionalPositiveIntEnv(name: string): number | undefined;
|
|
3
3
|
export declare function buildOllamaOptions(params: {
|
|
4
4
|
baseOptions: Record<string, unknown>;
|
|
@@ -13,8 +13,6 @@ export declare function buildOllamaOptions(params: {
|
|
|
13
13
|
export declare function deriveOllamaNumPredict(params: {
|
|
14
14
|
payload: Readonly<Record<string, unknown>>;
|
|
15
15
|
invocation: ResolvedModelInvocation;
|
|
16
|
-
effectiveFormat?: ModelGatewayFormat;
|
|
17
|
-
useStructuredOutputCeiling: boolean;
|
|
18
16
|
outputTokenLimit?: number;
|
|
19
17
|
}): number;
|
|
20
18
|
export declare function resolveOllamaKeepAlive(invocation: ResolvedModelInvocation): string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { estimateStrictStructuredOutputTokenCeiling } from "../../structured-output/budget.js";
|
|
2
1
|
import { estimateProviderEnvelopeInputTokens } from "../envelope-budget.js";
|
|
3
2
|
const DEFAULT_OLLAMA_KEEP_ALIVE = "3m";
|
|
4
3
|
export function readOptionalPositiveIntEnv(name) {
|
|
@@ -38,10 +37,7 @@ export function buildOllamaOptions(params) {
|
|
|
38
37
|
export function deriveOllamaNumPredict(params) {
|
|
39
38
|
const estimatedInputTokens = estimateProviderEnvelopeInputTokens(params.payload, params.invocation.profile.context.tokenEstimation);
|
|
40
39
|
const physicalRemainingTokens = Math.max(1, params.invocation.profile.contextWindowTokens - estimatedInputTokens);
|
|
41
|
-
|
|
42
|
-
? estimateStrictStructuredOutputTokenCeiling(params.effectiveFormat, params.invocation.profile.context.tokenEstimation)
|
|
43
|
-
: undefined;
|
|
44
|
-
return Math.max(1, Math.min(physicalRemainingTokens, structuredOutputCeiling ?? physicalRemainingTokens, params.outputTokenLimit ?? physicalRemainingTokens));
|
|
40
|
+
return Math.max(1, Math.min(physicalRemainingTokens, params.outputTokenLimit ?? physicalRemainingTokens));
|
|
45
41
|
}
|
|
46
42
|
export function resolveOllamaKeepAlive(invocation) {
|
|
47
43
|
const configured = invocation.profile.providerConfig?.keepAlive?.trim();
|
|
@@ -28,10 +28,6 @@ function applyGenerationOptions(params) {
|
|
|
28
28
|
derivedNumPredict: deriveOllamaNumPredict({
|
|
29
29
|
payload: params.payload,
|
|
30
30
|
invocation: params.invocation,
|
|
31
|
-
...(params.effectiveFormat
|
|
32
|
-
? { effectiveFormat: params.effectiveFormat }
|
|
33
|
-
: {}),
|
|
34
|
-
useStructuredOutputCeiling: params.useStructuredOutputCeiling,
|
|
35
31
|
...(params.outputTokenLimit !== undefined
|
|
36
32
|
? { outputTokenLimit: params.outputTokenLimit }
|
|
37
33
|
: {}),
|
|
@@ -71,8 +67,6 @@ export function buildOllamaPayload(requestBody, payloadOptions = {}) {
|
|
|
71
67
|
applyGenerationOptions({
|
|
72
68
|
payload,
|
|
73
69
|
invocation,
|
|
74
|
-
...(effectiveFormat ? { effectiveFormat } : {}),
|
|
75
|
-
useStructuredOutputCeiling: !invocation.profile.supportsThinking || invocation.think === "none",
|
|
76
70
|
...(outputTokenLimit !== undefined ? { outputTokenLimit } : {}),
|
|
77
71
|
});
|
|
78
72
|
return payload;
|
|
@@ -103,8 +97,6 @@ export function buildOllamaRawPayload(requestBody, payloadOptions = {}) {
|
|
|
103
97
|
applyGenerationOptions({
|
|
104
98
|
payload,
|
|
105
99
|
invocation,
|
|
106
|
-
...(effectiveFormat ? { effectiveFormat } : {}),
|
|
107
|
-
useStructuredOutputCeiling: false,
|
|
108
100
|
...(outputTokenLimit !== undefined ? { outputTokenLimit } : {}),
|
|
109
101
|
});
|
|
110
102
|
return payload;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolAvailabilityEntry } from "../plugin-contract/entrypoint.js";
|
|
2
|
+
import { type BoundedCollectionMetadata, type BoundedTextMetadata } from "./bounds.js";
|
|
3
|
+
export type ToolAvailabilityBrief = Readonly<{
|
|
4
|
+
text: string;
|
|
5
|
+
collection: BoundedCollectionMetadata;
|
|
6
|
+
output: BoundedTextMetadata;
|
|
7
|
+
}>;
|
|
8
|
+
/** Formats the existing bounded, on-demand tool brief without executing tools. */
|
|
9
|
+
export declare function buildToolAvailabilityBrief(entries: readonly ToolAvailabilityEntry[]): ToolAvailabilityBrief;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { boundCollection, boundText, } from "./bounds.js";
|
|
2
|
+
const TOOL_COUNT_MAX = 64;
|
|
3
|
+
const OUTPUT_CHARACTER_MAX = 16_000;
|
|
4
|
+
/** Formats the existing bounded, on-demand tool brief without executing tools. */
|
|
5
|
+
export function buildToolAvailabilityBrief(entries) {
|
|
6
|
+
const orderedTools = [...entries].sort(compareAvailableTools);
|
|
7
|
+
const boundedTools = boundCollection(orderedTools, {
|
|
8
|
+
maxItems: TOOL_COUNT_MAX,
|
|
9
|
+
});
|
|
10
|
+
const rawOutput = [
|
|
11
|
+
`Available tool operations: ${entries.length}`,
|
|
12
|
+
...boundedTools.items.map(formatAvailableTool),
|
|
13
|
+
...(boundedTools.metadata.truncated
|
|
14
|
+
? [
|
|
15
|
+
`[${boundedTools.metadata.omittedItems} additional tool operations omitted]`,
|
|
16
|
+
]
|
|
17
|
+
: []),
|
|
18
|
+
].join("\n");
|
|
19
|
+
const boundedOutput = boundText(rawOutput, {
|
|
20
|
+
maxChars: OUTPUT_CHARACTER_MAX,
|
|
21
|
+
marker: "\n[available tool brief truncated]",
|
|
22
|
+
});
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
text: boundedOutput.text,
|
|
25
|
+
collection: boundedTools.metadata,
|
|
26
|
+
output: boundedOutput.metadata,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function formatAvailableTool(tool) {
|
|
30
|
+
return [
|
|
31
|
+
`- ${tool.operationId}`,
|
|
32
|
+
`(tool=${tool.toolName}; effect=${tool.effect}; groups=${tool.catalogGroups.join(",")})`,
|
|
33
|
+
tool.summary,
|
|
34
|
+
].join(" ");
|
|
35
|
+
}
|
|
36
|
+
function compareAvailableTools(left, right) {
|
|
37
|
+
const byOperation = compareAscii(left.operationId, right.operationId);
|
|
38
|
+
if (byOperation !== 0)
|
|
39
|
+
return byOperation;
|
|
40
|
+
return compareAscii(left.toolName, right.toolName);
|
|
41
|
+
}
|
|
42
|
+
function compareAscii(left, right) {
|
|
43
|
+
if (left < right)
|
|
44
|
+
return -1;
|
|
45
|
+
if (left > right)
|
|
46
|
+
return 1;
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolAvailabilityEntry } from "../plugin-contract/entrypoint.js";
|
|
2
|
+
export type ToolAvailabilityOverviewLevel = "detailed" | "titles" | "groups";
|
|
3
|
+
export type ToolAvailabilityOverviewGroup = Readonly<{
|
|
4
|
+
groupId: string;
|
|
5
|
+
memberCount: number;
|
|
6
|
+
effects: readonly string[];
|
|
7
|
+
}>;
|
|
8
|
+
/** Complete informational candidates; callers own admission and context budget. */
|
|
9
|
+
export declare function buildToolAvailabilityOverview(entries: readonly ToolAvailabilityEntry[], groups: readonly ToolAvailabilityOverviewGroup[], level: ToolAvailabilityOverviewLevel): string;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Complete informational candidates; callers own admission and context budget. */
|
|
2
|
+
export function buildToolAvailabilityOverview(entries, groups, level) {
|
|
3
|
+
if (level === "detailed")
|
|
4
|
+
return describeAvailableTools(entries);
|
|
5
|
+
const orderedGroups = [...groups].sort((left, right) => compareAscii(left.groupId, right.groupId));
|
|
6
|
+
if (level === "titles")
|
|
7
|
+
return describeGroupTools(entries, orderedGroups);
|
|
8
|
+
return orderedGroups.map(describeGroupMetadata).join("\n");
|
|
9
|
+
}
|
|
10
|
+
function describeAvailableTools(entries) {
|
|
11
|
+
const tools = new Map();
|
|
12
|
+
for (const entry of entries) {
|
|
13
|
+
const tool = tools.get(entry.toolName) ?? {
|
|
14
|
+
operationIds: new Set(),
|
|
15
|
+
catalogGroups: new Set(),
|
|
16
|
+
};
|
|
17
|
+
tool.operationIds.add(entry.operationId);
|
|
18
|
+
for (const groupId of entry.catalogGroups)
|
|
19
|
+
tool.catalogGroups.add(groupId);
|
|
20
|
+
tools.set(entry.toolName, tool);
|
|
21
|
+
}
|
|
22
|
+
return [...tools.entries()]
|
|
23
|
+
.sort(([left], [right]) => compareAscii(left, right))
|
|
24
|
+
.map(([toolName, tool]) => `- ${formatOverviewIdentifier(toolName)} — ${sortedValues(tool.operationIds)} [${sortedValues(tool.catalogGroups)}]`)
|
|
25
|
+
.join("\n");
|
|
26
|
+
}
|
|
27
|
+
function describeGroupTools(entries, groups) {
|
|
28
|
+
return groups
|
|
29
|
+
.map((group) => {
|
|
30
|
+
const toolNames = new Set(entries
|
|
31
|
+
.filter((entry) => entry.catalogGroups.includes(group.groupId))
|
|
32
|
+
.map((entry) => entry.toolName));
|
|
33
|
+
return `- ${group.groupId}: ${sortedValues(toolNames)}`;
|
|
34
|
+
})
|
|
35
|
+
.join("\n");
|
|
36
|
+
}
|
|
37
|
+
function describeGroupMetadata(group) {
|
|
38
|
+
return `- ${group.groupId} (memberCount=${group.memberCount}; effects=${sortedValues(group.effects)})`;
|
|
39
|
+
}
|
|
40
|
+
function sortedValues(values) {
|
|
41
|
+
return [...values]
|
|
42
|
+
.sort(compareAscii)
|
|
43
|
+
.map(formatOverviewIdentifier)
|
|
44
|
+
.join(", ");
|
|
45
|
+
}
|
|
46
|
+
function formatOverviewIdentifier(value) {
|
|
47
|
+
if (isPlainOverviewIdentifier(value))
|
|
48
|
+
return value;
|
|
49
|
+
return JSON.stringify(value)
|
|
50
|
+
.replace(/\u2028/gu, "\\u2028")
|
|
51
|
+
.replace(/\u2029/gu, "\\u2029");
|
|
52
|
+
}
|
|
53
|
+
function isPlainOverviewIdentifier(value) {
|
|
54
|
+
return /^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(value);
|
|
55
|
+
}
|
|
56
|
+
function compareAscii(left, right) {
|
|
57
|
+
if (left < right)
|
|
58
|
+
return -1;
|
|
59
|
+
if (left > right)
|
|
60
|
+
return 1;
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { ToolDefinition, ToolExecutionSharedState, ToolNormalInvocationInput, ToolNormalInvocationOperation, ToolPayloadChannelSpec, ToolPayloadChannelStageSpec } from "../../capabilities/tool-types.js";
|
|
2
|
-
import { type WorkerCapabilityPayloadRelatedArtifactContext } from "../orchestration/worker-capabilities/payload-contracts.js";
|
|
3
|
-
import type { WorkerSettledCapabilityResult } from "../orchestration/worker-capabilities/contracts.js";
|
|
4
2
|
export type RegisteredToolPayloadStage = Readonly<{
|
|
5
3
|
outputParam: string;
|
|
6
4
|
instructions: string;
|
|
@@ -72,13 +70,6 @@ export declare function resolveRegisteredToolPayloadTargetContext(params: {
|
|
|
72
70
|
sharedState: ToolExecutionSharedState;
|
|
73
71
|
materializedParams?: Readonly<Record<string, string>>;
|
|
74
72
|
}): Promise<RegisteredToolPayloadTargetContext | undefined>;
|
|
75
|
-
export declare function resolveRegisteredToolPayloadRelatedArtifactContexts(params: {
|
|
76
|
-
contextScope?: ToolPayloadChannelSpec["contextScope"];
|
|
77
|
-
targetParam?: string;
|
|
78
|
-
controls: Readonly<Record<string, unknown>>;
|
|
79
|
-
sharedState: ToolExecutionSharedState;
|
|
80
|
-
settledCapabilityResults: readonly WorkerSettledCapabilityResult[];
|
|
81
|
-
}): Promise<readonly WorkerCapabilityPayloadRelatedArtifactContext[]>;
|
|
82
73
|
export declare function materializeRegisteredToolPayloadStageResponseFormat(params: {
|
|
83
74
|
stage: RegisteredToolPayloadStage;
|
|
84
75
|
targetContext?: RegisteredToolPayloadTargetContext;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { readFile, stat } from "node:fs/promises";
|
|
2
2
|
import { TOOL_PAYLOAD_STAGE_LITERAL_OUTPUT_MAX_BYTES } from "../../capabilities/tool-types.js";
|
|
3
3
|
import { resolveRuntimeTargetPath } from "../capabilities/runtime-target-path.js";
|
|
4
|
-
import { WORKER_CAPABILITY_RELATED_ARTIFACT_CONTEXT_MAX_CHARS, WORKER_CAPABILITY_RELATED_ARTIFACT_CONTEXT_MAX_COUNT, } from "../orchestration/worker-capabilities/payload-contracts.js";
|
|
5
4
|
export function deriveRegisteredToolPayloadContextPlan(definition, operation) {
|
|
6
5
|
const spec = definition.payloadChannelSpec;
|
|
7
6
|
if (!operation.payload ||
|
|
@@ -227,72 +226,6 @@ export async function resolveRegisteredToolPayloadTargetContext(params) {
|
|
|
227
226
|
content,
|
|
228
227
|
});
|
|
229
228
|
}
|
|
230
|
-
export async function resolveRegisteredToolPayloadRelatedArtifactContexts(params) {
|
|
231
|
-
if (params.contextScope !== "target_with_artifacts") {
|
|
232
|
-
return Object.freeze([]);
|
|
233
|
-
}
|
|
234
|
-
const currentTarget = resolveCurrentTarget(params);
|
|
235
|
-
const resolvedTargets = new Set();
|
|
236
|
-
const artifacts = [];
|
|
237
|
-
let totalCharacters = 0;
|
|
238
|
-
for (const result of params.settledCapabilityResults) {
|
|
239
|
-
if (result.outcome !== "succeeded")
|
|
240
|
-
continue;
|
|
241
|
-
for (const reference of result.references ?? []) {
|
|
242
|
-
let resolvedTarget;
|
|
243
|
-
try {
|
|
244
|
-
resolvedTarget = resolveRuntimeTargetPath(reference.target, params.sharedState);
|
|
245
|
-
}
|
|
246
|
-
catch {
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
if (resolvedTarget === currentTarget ||
|
|
250
|
-
resolvedTargets.has(resolvedTarget)) {
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
resolvedTargets.add(resolvedTarget);
|
|
254
|
-
try {
|
|
255
|
-
const targetStat = await stat(resolvedTarget);
|
|
256
|
-
if (!targetStat.isFile())
|
|
257
|
-
continue;
|
|
258
|
-
const content = await readFile(resolvedTarget, "utf8");
|
|
259
|
-
if (content.length + totalCharacters >
|
|
260
|
-
WORKER_CAPABILITY_RELATED_ARTIFACT_CONTEXT_MAX_CHARS) {
|
|
261
|
-
continue;
|
|
262
|
-
}
|
|
263
|
-
artifacts.push(Object.freeze({
|
|
264
|
-
sourceExecutionId: result.executionId,
|
|
265
|
-
targetPath: reference.target,
|
|
266
|
-
presentation: "full",
|
|
267
|
-
content,
|
|
268
|
-
}));
|
|
269
|
-
totalCharacters += content.length;
|
|
270
|
-
if (artifacts.length >=
|
|
271
|
-
WORKER_CAPABILITY_RELATED_ARTIFACT_CONTEXT_MAX_COUNT) {
|
|
272
|
-
return Object.freeze(artifacts);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
catch {
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
return Object.freeze(artifacts);
|
|
281
|
-
}
|
|
282
|
-
function resolveCurrentTarget(params) {
|
|
283
|
-
const rawTarget = params.targetParam
|
|
284
|
-
? params.controls[params.targetParam]
|
|
285
|
-
: undefined;
|
|
286
|
-
if (typeof rawTarget !== "string" || rawTarget.trim().length === 0) {
|
|
287
|
-
return undefined;
|
|
288
|
-
}
|
|
289
|
-
try {
|
|
290
|
-
return resolveRuntimeTargetPath(rawTarget.trim(), params.sharedState);
|
|
291
|
-
}
|
|
292
|
-
catch {
|
|
293
|
-
return undefined;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
229
|
function resolveBoundedTargetContext(params) {
|
|
297
230
|
const stageIndex = params.plan.stages.indexOf(params.stage);
|
|
298
231
|
const priorStages = params.plan.stages
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ToolExecutionSharedState, ToolPayloadChannelSpec } from "../../capabilities/tool-types.js";
|
|
2
|
+
import type { WorkerCapabilityPayloadSourceProvenance, WorkerSettledCapabilityResult } from "../orchestration/worker-capabilities/contracts.js";
|
|
3
|
+
import { type WorkerCapabilityPayloadRelatedArtifactContext } from "../orchestration/worker-capabilities/payload-contracts.js";
|
|
4
|
+
import type { RoleCallFrame } from "../orchestration/role-calls/contracts.js";
|
|
5
|
+
export declare function resolveRegisteredToolPayloadRelatedArtifactContexts(params: {
|
|
6
|
+
contextScope?: ToolPayloadChannelSpec["contextScope"];
|
|
7
|
+
targetParam?: string;
|
|
8
|
+
controls: Readonly<Record<string, unknown>>;
|
|
9
|
+
sharedState: ToolExecutionSharedState;
|
|
10
|
+
call: RoleCallFrame;
|
|
11
|
+
assignmentProvenance?: WorkerCapabilityPayloadSourceProvenance;
|
|
12
|
+
settledCapabilityResults: readonly WorkerSettledCapabilityResult[];
|
|
13
|
+
}): Promise<readonly WorkerCapabilityPayloadRelatedArtifactContext[]>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { readFile, stat } from "node:fs/promises";
|
|
2
|
+
import { resolveRuntimeTargetPath } from "../capabilities/runtime-target-path.js";
|
|
3
|
+
import { projectWorkerCapabilityDependencyArtifactReceipts, } from "../orchestration/worker-capabilities/assignment-provenance.js";
|
|
4
|
+
import { projectWorkerPayloadPlannerItemProvenance } from "../orchestration/worker-capabilities/payload-source-provenance.js";
|
|
5
|
+
import { WORKER_CAPABILITY_RELATED_ARTIFACT_CONTEXT_MAX_CHARS, WORKER_CAPABILITY_RELATED_ARTIFACT_CONTEXT_MAX_COUNT, } from "../orchestration/worker-capabilities/payload-contracts.js";
|
|
6
|
+
export async function resolveRegisteredToolPayloadRelatedArtifactContexts(params) {
|
|
7
|
+
if (params.contextScope !== "target_with_artifacts") {
|
|
8
|
+
return Object.freeze([]);
|
|
9
|
+
}
|
|
10
|
+
const dependencyReceipts = projectWorkerCapabilityDependencyArtifactReceipts(projectWorkerPayloadPlannerItemProvenance(params.assignmentProvenance, params.call), params.call);
|
|
11
|
+
const receipts = [
|
|
12
|
+
...projectSameCallArtifactReceipts(params.settledCapabilityResults),
|
|
13
|
+
...dependencyReceipts,
|
|
14
|
+
];
|
|
15
|
+
return loadRelatedArtifactContexts(params, receipts);
|
|
16
|
+
}
|
|
17
|
+
function projectSameCallArtifactReceipts(results) {
|
|
18
|
+
return results.flatMap((result) => {
|
|
19
|
+
if (result.outcome !== "succeeded")
|
|
20
|
+
return [];
|
|
21
|
+
return (result.references ?? []).map((reference) => Object.freeze({
|
|
22
|
+
sourceExecutionId: result.executionId,
|
|
23
|
+
targetPath: reference.target,
|
|
24
|
+
}));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async function loadRelatedArtifactContexts(params, receipts) {
|
|
28
|
+
const currentTarget = resolveCurrentTarget(params);
|
|
29
|
+
const resolvedTargets = new Set();
|
|
30
|
+
const artifacts = [];
|
|
31
|
+
let totalCharacters = 0;
|
|
32
|
+
for (const receipt of receipts) {
|
|
33
|
+
let resolvedTarget;
|
|
34
|
+
try {
|
|
35
|
+
resolvedTarget = resolveRuntimeTargetPath(receipt.targetPath, params.sharedState);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (resolvedTarget === currentTarget ||
|
|
41
|
+
resolvedTargets.has(resolvedTarget)) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
resolvedTargets.add(resolvedTarget);
|
|
45
|
+
try {
|
|
46
|
+
const targetStat = await stat(resolvedTarget);
|
|
47
|
+
if (!targetStat.isFile())
|
|
48
|
+
continue;
|
|
49
|
+
const content = await readFile(resolvedTarget, "utf8");
|
|
50
|
+
if (content.length + totalCharacters >
|
|
51
|
+
WORKER_CAPABILITY_RELATED_ARTIFACT_CONTEXT_MAX_CHARS) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
artifacts.push(Object.freeze({
|
|
55
|
+
sourceExecutionId: receipt.sourceExecutionId,
|
|
56
|
+
targetPath: receipt.targetPath,
|
|
57
|
+
presentation: "full",
|
|
58
|
+
content,
|
|
59
|
+
}));
|
|
60
|
+
totalCharacters += content.length;
|
|
61
|
+
if (artifacts.length >= WORKER_CAPABILITY_RELATED_ARTIFACT_CONTEXT_MAX_COUNT) {
|
|
62
|
+
return Object.freeze(artifacts);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return Object.freeze(artifacts);
|
|
70
|
+
}
|
|
71
|
+
function resolveCurrentTarget(params) {
|
|
72
|
+
const rawTarget = params.targetParam
|
|
73
|
+
? params.controls[params.targetParam]
|
|
74
|
+
: undefined;
|
|
75
|
+
if (typeof rawTarget !== "string" || rawTarget.trim().length === 0) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
return resolveRuntimeTargetPath(rawTarget.trim(), params.sharedState);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -112,6 +112,10 @@ function projectWorkerDescriptor(definition, operation, stagedPayloadPlan) {
|
|
|
112
112
|
? { requiresPayloadAuthoringObjective: true }
|
|
113
113
|
: {}),
|
|
114
114
|
catalogGroups,
|
|
115
|
+
routingCapability: definition.routingCapability,
|
|
116
|
+
...(definition.developmentRoles
|
|
117
|
+
? { developmentRoles: Object.freeze([...definition.developmentRoles]) }
|
|
118
|
+
: {}),
|
|
115
119
|
});
|
|
116
120
|
}
|
|
117
121
|
function projectRuntimePathControlIds(definition, operation, controls) {
|
|
@@ -113,6 +113,9 @@ async function prepareRegisteredToolWorkerCapability(params, input, payloadObser
|
|
|
113
113
|
sharedState: params.sharedState,
|
|
114
114
|
...(params.payloadAuthor ? { payloadAuthor: params.payloadAuthor } : {}),
|
|
115
115
|
call: input.call,
|
|
116
|
+
...(input.assignmentProvenance
|
|
117
|
+
? { assignmentProvenance: input.assignmentProvenance }
|
|
118
|
+
: {}),
|
|
116
119
|
// The payload contract still names this correlation executionId. During
|
|
117
120
|
// prepare it is deliberately non-canonical and never enters the ledger.
|
|
118
121
|
executionId: input.preparationId,
|
package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-lifecycle.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare function prepareOperationPayload(params: Readonly<{
|
|
|
9
9
|
sharedState: ToolExecutionSharedState;
|
|
10
10
|
payloadAuthor?: WorkerCapabilityPayloadAuthor;
|
|
11
11
|
call: Parameters<WorkerCapabilityPayloadAuthor["author"]>[0]["call"];
|
|
12
|
+
assignmentProvenance?: Parameters<WorkerCapabilityPayloadAuthor["author"]>[0]["assignmentProvenance"];
|
|
12
13
|
executionId: string;
|
|
13
14
|
descriptor: Parameters<WorkerCapabilityPayloadAuthor["author"]>[0]["descriptor"];
|
|
14
15
|
intent: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveRegisteredToolPayloadRelatedArtifactContexts } from "../registered-tool-payload-
|
|
1
|
+
import { resolveRegisteredToolPayloadRelatedArtifactContexts } from "../registered-tool-payload-related-artifacts.js";
|
|
2
2
|
import { normalizePayloadAuthoringResult } from "./payload-authoring-result.js";
|
|
3
3
|
import { executionFreshnessRejection, payloadRejection, rejectPayloadLifecycle, STEERING_SUPERSEDED_BEFORE_EXTERNAL_EXECUTION, STEERING_SUPERSEDED_SUMMARY, } from "./payload-rejection.js";
|
|
4
4
|
import { prepareStagedOperationPayload } from "./payload-stages.js";
|
|
@@ -11,6 +11,9 @@ export async function prepareOperationPayload(params) {
|
|
|
11
11
|
sharedState: params.sharedState,
|
|
12
12
|
...(params.payloadAuthor ? { payloadAuthor: params.payloadAuthor } : {}),
|
|
13
13
|
call: params.call,
|
|
14
|
+
...(params.assignmentProvenance
|
|
15
|
+
? { assignmentProvenance: params.assignmentProvenance }
|
|
16
|
+
: {}),
|
|
14
17
|
executionId: params.executionId,
|
|
15
18
|
descriptor: params.descriptor,
|
|
16
19
|
intent: params.intent,
|
|
@@ -55,10 +58,17 @@ export async function prepareOperationPayload(params) {
|
|
|
55
58
|
targetParam: params.projection.payloadContextPlan?.targetParam,
|
|
56
59
|
controls: params.controls,
|
|
57
60
|
sharedState: params.sharedState,
|
|
61
|
+
call: params.call,
|
|
62
|
+
...(params.assignmentProvenance
|
|
63
|
+
? { assignmentProvenance: params.assignmentProvenance }
|
|
64
|
+
: {}),
|
|
58
65
|
settledCapabilityResults: params.settledCapabilityResults,
|
|
59
66
|
});
|
|
60
67
|
rawAuthored = await params.payloadAuthor.author({
|
|
61
68
|
call: params.call,
|
|
69
|
+
...(params.assignmentProvenance
|
|
70
|
+
? { assignmentProvenance: params.assignmentProvenance }
|
|
71
|
+
: {}),
|
|
62
72
|
executionId: params.executionId,
|
|
63
73
|
descriptor: params.descriptor,
|
|
64
74
|
...(params.authoringObjective
|
|
@@ -11,6 +11,7 @@ export type StagedOperationPayloadParams = Readonly<{
|
|
|
11
11
|
sharedState: ToolExecutionSharedState;
|
|
12
12
|
payloadAuthor?: WorkerCapabilityPayloadAuthor;
|
|
13
13
|
call: Parameters<WorkerCapabilityPayloadAuthor["author"]>[0]["call"];
|
|
14
|
+
assignmentProvenance?: Parameters<WorkerCapabilityPayloadAuthor["author"]>[0]["assignmentProvenance"];
|
|
14
15
|
executionId: string;
|
|
15
16
|
descriptor: Parameters<WorkerCapabilityPayloadAuthor["author"]>[0]["descriptor"];
|
|
16
17
|
intent: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolveRegisteredToolPayloadRelatedArtifactContexts } from "../registered-tool-payload-related-artifacts.js";
|
|
2
|
+
import { materializeRegisteredToolPayloadStageResponseFormat, resolveRegisteredToolPayloadStageLiteralOutput, resolveRegisteredToolPayloadStageMinBytes, resolveRegisteredToolPayloadTargetContext, validateRegisteredToolPayloadStageTargetLineBounds, } from "../registered-tool-payload-plan.js";
|
|
2
3
|
import { normalizePayloadAuthoringResult } from "./payload-authoring-result.js";
|
|
3
4
|
import { executionFreshnessRejection, payloadRejection, rejectPayloadLifecycle, STEERING_SUPERSEDED_BEFORE_EXTERNAL_EXECUTION, STEERING_SUPERSEDED_SUMMARY, } from "./payload-rejection.js";
|
|
4
5
|
export async function prepareStagedOperationPayload(params) {
|
|
@@ -172,10 +173,17 @@ class PayloadStageRunner {
|
|
|
172
173
|
targetParam: this.params.plan.targetParam,
|
|
173
174
|
controls: this.params.controls,
|
|
174
175
|
sharedState: this.params.sharedState,
|
|
176
|
+
call: this.params.call,
|
|
177
|
+
...(this.params.assignmentProvenance
|
|
178
|
+
? { assignmentProvenance: this.params.assignmentProvenance }
|
|
179
|
+
: {}),
|
|
175
180
|
settledCapabilityResults: this.params.settledCapabilityResults,
|
|
176
181
|
});
|
|
177
182
|
rawAuthored = await payloadAuthor.author({
|
|
178
183
|
call: this.params.call,
|
|
184
|
+
...(this.params.assignmentProvenance
|
|
185
|
+
? { assignmentProvenance: this.params.assignmentProvenance }
|
|
186
|
+
: {}),
|
|
179
187
|
executionId: this.params.executionId,
|
|
180
188
|
descriptor: this.params.descriptor,
|
|
181
189
|
...(this.params.authoringObjective
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { projectAvailableTools } from "./tool-availability.js";
|
|
1
2
|
/**
|
|
2
3
|
* Adds trusted request services to an already config-filtered Tool Registry.
|
|
3
4
|
* Tools remain opaque to the request flow.
|
|
@@ -54,27 +55,3 @@ export function bindRequestToolRegistry(params) {
|
|
|
54
55
|
}),
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
|
-
function projectAvailableTools(registrations) {
|
|
58
|
-
if (registrations === undefined)
|
|
59
|
-
return undefined;
|
|
60
|
-
const entries = registrations.flatMap((registration) => registration.contract.operations.map((operation) => Object.freeze({
|
|
61
|
-
toolName: registration.toolName,
|
|
62
|
-
operationId: operation.operationId,
|
|
63
|
-
summary: operation.summary,
|
|
64
|
-
catalogGroups: Object.freeze([
|
|
65
|
-
...(registration.definition.catalogGroups ?? ["other"]),
|
|
66
|
-
]),
|
|
67
|
-
effect: operation.effect,
|
|
68
|
-
})));
|
|
69
|
-
entries.sort(compareAvailableTools);
|
|
70
|
-
return Object.freeze(entries);
|
|
71
|
-
}
|
|
72
|
-
function compareAvailableTools(left, right) {
|
|
73
|
-
const byOperation = compareAscii(left.operationId, right.operationId);
|
|
74
|
-
return byOperation !== 0
|
|
75
|
-
? byOperation
|
|
76
|
-
: compareAscii(left.toolName, right.toolName);
|
|
77
|
-
}
|
|
78
|
-
function compareAscii(left, right) {
|
|
79
|
-
return left < right ? -1 : left > right ? 1 : 0;
|
|
80
|
-
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RegisteredToolNormalInvocation, ToolAvailabilityEntry } from "../../capabilities/tool-types.js";
|
|
2
|
+
/** Passive request-effective tool facts, independent of execution services. */
|
|
3
|
+
export interface ToolAvailabilitySource {
|
|
4
|
+
getAvailableTools(): readonly ToolAvailabilityEntry[] | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function projectAvailableTools(registrations: readonly RegisteredToolNormalInvocation[] | undefined): readonly ToolAvailabilityEntry[] | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function projectAvailableTools(registrations) {
|
|
2
|
+
if (registrations === undefined)
|
|
3
|
+
return undefined;
|
|
4
|
+
const entries = registrations.flatMap((registration) => registration.contract.operations.map((operation) => Object.freeze({
|
|
5
|
+
toolName: registration.toolName,
|
|
6
|
+
operationId: operation.operationId,
|
|
7
|
+
summary: operation.summary,
|
|
8
|
+
catalogGroups: Object.freeze([
|
|
9
|
+
...(registration.definition.catalogGroups ?? ["other"]),
|
|
10
|
+
]),
|
|
11
|
+
effect: operation.effect,
|
|
12
|
+
})));
|
|
13
|
+
entries.sort(compareAvailableTools);
|
|
14
|
+
return Object.freeze(entries);
|
|
15
|
+
}
|
|
16
|
+
function compareAvailableTools(left, right) {
|
|
17
|
+
const byOperation = compareAscii(left.operationId, right.operationId);
|
|
18
|
+
return byOperation !== 0
|
|
19
|
+
? byOperation
|
|
20
|
+
: compareAscii(left.toolName, right.toolName);
|
|
21
|
+
}
|
|
22
|
+
function compareAscii(left, right) {
|
|
23
|
+
if (left < right)
|
|
24
|
+
return -1;
|
|
25
|
+
if (left > right)
|
|
26
|
+
return 1;
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ChatMessage } from "../../model-gateway/types.js";
|
|
2
|
+
import type { ToolAvailabilityEntry } from "../../capabilities/tool-types.js";
|
|
3
|
+
import { type ToolAvailabilityOverviewGroup, type ToolAvailabilityOverviewLevel } from "../../plugin-sdk/tool-availability-overview.js";
|
|
4
|
+
import type { projectRequestContext } from "./request-context.js";
|
|
5
|
+
export declare const CAPABILITY_BRIEF_KIND = "runtime_capability_brief_v1";
|
|
6
|
+
export declare const CAPABILITY_BRIEF_MAX_TOKENS = 512;
|
|
7
|
+
export type CapabilityBriefLevel = ToolAvailabilityOverviewLevel | "none";
|
|
8
|
+
export type CapabilityBriefProjection = Readonly<{
|
|
9
|
+
level: CapabilityBriefLevel;
|
|
10
|
+
message?: ChatMessage;
|
|
11
|
+
estimatedTokens: number;
|
|
12
|
+
budgetTokens: number;
|
|
13
|
+
reason: "complete_catalog" | "empty_catalog" | "insufficient_budget";
|
|
14
|
+
}>;
|
|
15
|
+
type ContextInput = Parameters<typeof projectRequestContext>[0];
|
|
16
|
+
/** Optional availability metadata admitted against the full context estimate. */
|
|
17
|
+
export declare function projectCapabilityBrief(params: Readonly<{
|
|
18
|
+
entries?: readonly ToolAvailabilityEntry[];
|
|
19
|
+
groups: readonly ToolAvailabilityOverviewGroup[];
|
|
20
|
+
context: ContextInput;
|
|
21
|
+
additionalBudgetMessages?: readonly ChatMessage[];
|
|
22
|
+
}>): CapabilityBriefProjection;
|
|
23
|
+
/** Consumers explicitly remove this optional reference at narrower phases. */
|
|
24
|
+
export declare function isCapabilityBriefMessage(message: ChatMessage): boolean;
|
|
25
|
+
export {};
|