@abot-ai/runtime 1.0.0 → 1.1.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 +17 -3
- package/dist/scripts/add-runtime-model.js +4 -0
- package/dist/scripts/configure-long-term-memory.d.ts +6 -0
- package/dist/scripts/configure-long-term-memory.js +139 -0
- package/dist/scripts/init-runtime.js +11 -1
- package/dist/scripts/runtime-setup-files.d.ts +1 -0
- package/dist/scripts/runtime-setup-files.js +4 -0
- package/dist/src/capabilities/normal-invocation/contracts.d.ts +1 -0
- package/dist/src/capabilities/normal-invocation/validator.d.ts +5 -0
- package/dist/src/capabilities/normal-invocation/validator.js +35 -2
- package/dist/src/capabilities/tool-definition-validator/definition-fields.d.ts +7 -0
- package/dist/src/capabilities/tool-definition-validator/definition-fields.js +156 -0
- package/dist/src/capabilities/tool-definition-validator/definition-parser.d.ts +2 -0
- package/dist/src/capabilities/tool-definition-validator/definition-parser.js +76 -0
- package/dist/src/capabilities/tool-definition-validator/definition-shape.d.ts +7 -0
- package/dist/src/capabilities/tool-definition-validator/definition-shape.js +34 -0
- package/dist/src/capabilities/tool-definition-validator/event-presentation.d.ts +2 -0
- package/dist/src/capabilities/tool-definition-validator/event-presentation.js +97 -0
- package/dist/src/capabilities/tool-definition-validator/module-registry.d.ts +3 -0
- package/dist/src/capabilities/tool-definition-validator/module-registry.js +99 -0
- package/dist/src/capabilities/tool-definition-validator/payload-channel-spec.d.ts +2 -0
- package/dist/src/capabilities/tool-definition-validator/payload-channel-spec.js +190 -0
- package/dist/src/capabilities/tool-definition-validator/payload-channel-stage.d.ts +11 -0
- package/dist/src/capabilities/tool-definition-validator/payload-channel-stage.js +155 -0
- package/dist/src/capabilities/tool-definition-validator/payload-stage-conditions.d.ts +24 -0
- package/dist/src/capabilities/tool-definition-validator/payload-stage-conditions.js +193 -0
- package/dist/src/capabilities/tool-definition-validator.d.ts +2 -4
- package/dist/src/capabilities/tool-definition-validator.js +2 -776
- package/dist/src/cli/abot.js +11 -2
- package/dist/src/model-gateway/client/embeddings.d.ts +3 -0
- package/dist/src/model-gateway/client/embeddings.js +48 -0
- package/dist/src/model-gateway/client.d.ts +3 -1
- package/dist/src/model-gateway/client.js +5 -0
- package/dist/src/model-gateway/embeddings/constants.d.ts +1 -0
- package/dist/src/model-gateway/embeddings/constants.js +1 -0
- package/dist/src/model-gateway/embeddings/discovery.d.ts +10 -0
- package/dist/src/model-gateway/embeddings/discovery.js +39 -0
- package/dist/src/model-gateway/embeddings/execution.d.ts +16 -0
- package/dist/src/model-gateway/embeddings/execution.js +64 -0
- package/dist/src/model-gateway/embeddings/fingerprint.d.ts +3 -0
- package/dist/src/model-gateway/embeddings/fingerprint.js +36 -0
- package/dist/src/model-gateway/embeddings/profile.d.ts +11 -0
- package/dist/src/model-gateway/embeddings/profile.js +37 -0
- package/dist/src/model-gateway/embeddings/server-handler.d.ts +3 -0
- package/dist/src/model-gateway/embeddings/server-handler.js +89 -0
- package/dist/src/model-gateway/embeddings/validation.d.ts +7 -0
- package/dist/src/model-gateway/embeddings/validation.js +69 -0
- package/dist/src/model-gateway/index.d.ts +5 -3
- package/dist/src/model-gateway/index.js +3 -1
- package/dist/src/model-gateway/providers/contracts.d.ts +27 -1
- package/dist/src/model-gateway/providers/ollama/adapter.js +4 -0
- package/dist/src/model-gateway/providers/ollama/base-url.d.ts +1 -0
- package/dist/src/model-gateway/providers/ollama/base-url.js +4 -0
- package/dist/src/model-gateway/providers/ollama/embedding-models.d.ts +2 -0
- package/dist/src/model-gateway/providers/ollama/embedding-models.js +31 -0
- package/dist/src/model-gateway/providers/ollama/embeddings.d.ts +2 -0
- package/dist/src/model-gateway/providers/ollama/embeddings.js +43 -0
- package/dist/src/model-gateway/providers/ollama/request-diagnostics.js +2 -1
- package/dist/src/model-gateway/providers/openai/adapter.js +2 -0
- package/dist/src/model-gateway/providers/openai/embeddings.d.ts +2 -0
- package/dist/src/model-gateway/providers/openai/embeddings.js +87 -0
- package/dist/src/model-gateway/providers/openai/payload.js +5 -8
- package/dist/src/model-gateway/server/contracts.d.ts +5 -3
- package/dist/src/model-gateway/server/create-server.js +9 -0
- package/dist/src/model-gateway/server/errors.js +34 -0
- package/dist/src/model-gateway/server/index.d.ts +2 -0
- package/dist/src/model-gateway/server/index.js +2 -0
- package/dist/src/model-gateway/server/provider-fetch.d.ts +5 -3
- package/dist/src/model-gateway/server/provider-fetch.js +3 -1
- package/dist/src/model-gateway/server/request-body.d.ts +1 -1
- package/dist/src/model-gateway/types.d.ts +39 -0
- package/dist/src/plugin-contract/manifest.d.ts +1 -0
- package/dist/src/runtime/adapters/index.d.ts +4 -0
- package/dist/src/runtime/adapters/index.js +4 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/acquisition.d.ts +2 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/acquisition.js +77 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/cleanup.d.ts +4 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/cleanup.js +52 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/contracts.d.ts +31 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/contracts.js +17 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/install.d.ts +1 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/install.js +36 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/owner-record.d.ts +2 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/owner-record.js +114 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/snapshot.d.ts +2 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock/snapshot.js +103 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock.d.ts +2 -0
- package/dist/src/runtime/adapters/long-term-memory/file-lock.js +10 -0
- package/dist/src/runtime/adapters/long-term-memory/file-repository.d.ts +2 -0
- package/dist/src/runtime/adapters/long-term-memory/file-repository.js +57 -0
- package/dist/src/runtime/adapters/long-term-memory/in-memory-repository.d.ts +2 -0
- package/dist/src/runtime/adapters/long-term-memory/in-memory-repository.js +21 -0
- package/dist/src/runtime/adapters/long-term-memory/onboarding-config-repository.d.ts +5 -0
- package/dist/src/runtime/adapters/long-term-memory/onboarding-config-repository.js +60 -0
- package/dist/src/runtime/adapters/long-term-memory/onboarding-service.d.ts +8 -0
- package/dist/src/runtime/adapters/long-term-memory/onboarding-service.js +34 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/run.d.ts +7 -1
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/run.js +54 -25
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/executor.js +18 -4
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/payload/lifecycle.d.ts +6 -1
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/payload/lifecycle.js +25 -12
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/action-fingerprint.d.ts +22 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/action-fingerprint.js +65 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/shared/contracts.d.ts +44 -0
- package/dist/src/runtime/adapters/registered-tool-normal-invocations.d.ts +1 -1
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/catalog.js +14 -4
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/execution.js +218 -87
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/failure-outcome-fingerprint.d.ts +7 -0
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/failure-outcome-fingerprint.js +84 -0
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-lifecycle.d.ts +5 -4
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-lifecycle.js +7 -1
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-observability.d.ts +35 -0
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-observability.js +32 -0
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-rejection.d.ts +3 -3
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-rejection.js +13 -8
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-stages.d.ts +5 -4
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/payload-stages.js +4 -2
- package/dist/src/runtime/adapters/registered-tool-worker-capabilities/result-observer.js +12 -4
- package/dist/src/runtime/composition.d.ts +3 -0
- package/dist/src/runtime/composition.js +5 -2
- package/dist/src/runtime/config/builders.js +34 -1
- package/dist/src/runtime/config/effective-model-config-validation.js +9 -0
- package/dist/src/runtime/config/embedding-profiles.d.ts +5 -0
- package/dist/src/runtime/config/embedding-profiles.js +66 -0
- package/dist/src/runtime/config/fields.js +22 -0
- package/dist/src/runtime/config/long-term-memory.d.ts +9 -0
- package/dist/src/runtime/config/long-term-memory.js +71 -0
- package/dist/src/runtime/config/runner/config-normalization.d.ts +16 -0
- package/dist/src/runtime/config/runner/config-normalization.js +109 -0
- package/dist/src/runtime/config/runner/loader.d.ts +1 -1
- package/dist/src/runtime/config/runner/loader.js +2 -69
- package/dist/src/runtime/config/runner/model-policy.js +3 -0
- package/dist/src/runtime/config/runner/schema-version.d.ts +14 -0
- package/dist/src/runtime/config/runner/schema-version.js +35 -0
- package/dist/src/runtime/config/runner/versioned-config.d.ts +2 -0
- package/dist/src/runtime/config/runner/versioned-config.js +51 -0
- package/dist/src/runtime/config/schema.js +36 -0
- package/dist/src/runtime/config/types.d.ts +1 -0
- package/dist/src/runtime/config/validation/environment-config-validation.d.ts +1 -0
- package/dist/src/runtime/config/validation/environment-config-validation.js +41 -0
- package/dist/src/runtime/config/validation/model-invocation-config-validation.d.ts +2 -0
- package/dist/src/runtime/config/validation/model-invocation-config-validation.js +64 -0
- package/dist/src/runtime/config/validation/model-invocation-override-validation.d.ts +2 -0
- package/dist/src/runtime/config/validation/model-invocation-override-validation.js +72 -0
- package/dist/src/runtime/config/validation/model-profile-validation.d.ts +4 -0
- package/dist/src/runtime/config/validation/model-profile-validation.js +87 -0
- package/dist/src/runtime/config/validation/model-registry-validation.d.ts +2 -0
- package/dist/src/runtime/config/validation/model-registry-validation.js +118 -0
- package/dist/src/runtime/config/validation/path-config-validation.d.ts +1 -0
- package/dist/src/runtime/config/validation/path-config-validation.js +7 -0
- package/dist/src/runtime/config/validation/runtime-config-field-validation.d.ts +12 -0
- package/dist/src/runtime/config/validation/runtime-config-field-validation.js +158 -0
- package/dist/src/runtime/config/validation/runtime-config-validation-contract.d.ts +9 -0
- package/dist/src/runtime/config/validation/runtime-config-validation-contract.js +13 -0
- package/dist/src/runtime/config/validation/runtime-root-section-validation.d.ts +6 -0
- package/dist/src/runtime/config/validation/runtime-root-section-validation.js +82 -0
- package/dist/src/runtime/config/validation/web-ui-config-validation.d.ts +3 -0
- package/dist/src/runtime/config/validation/web-ui-config-validation.js +26 -0
- package/dist/src/runtime/config/validation.d.ts +4 -15
- package/dist/src/runtime/config/validation.js +27 -499
- package/dist/src/runtime/config.js +3 -0
- package/dist/src/runtime/context/accepted-capability-action.d.ts +11 -0
- package/dist/src/runtime/context/accepted-capability-action.js +29 -0
- package/dist/src/runtime/context/model-step-compaction.js +6 -0
- package/dist/src/runtime/context/operation-supervision-evidence.d.ts +37 -0
- package/dist/src/runtime/context/operation-supervision-evidence.js +90 -0
- package/dist/src/runtime/context/request-tool-results.d.ts +3 -0
- package/dist/src/runtime/context/request-tool-results.js +11 -2
- package/dist/src/runtime/default-adapters.d.ts +3 -0
- package/dist/src/runtime/default-adapters.js +64 -3
- package/dist/src/runtime/index.d.ts +1 -0
- package/dist/src/runtime/index.js +1 -0
- package/dist/src/runtime/lifecycle/request-finalizer.d.ts +3 -0
- package/dist/src/runtime/lifecycle/request-finalizer.js +8 -0
- package/dist/src/runtime/long-term-memory/background-save-queue.d.ts +17 -0
- package/dist/src/runtime/long-term-memory/background-save-queue.js +66 -0
- package/dist/src/runtime/long-term-memory/candidate-persistence.d.ts +16 -0
- package/dist/src/runtime/long-term-memory/candidate-persistence.js +109 -0
- package/dist/src/runtime/long-term-memory/candidate-preparation.d.ts +8 -0
- package/dist/src/runtime/long-term-memory/candidate-preparation.js +36 -0
- package/dist/src/runtime/long-term-memory/candidate-processing.d.ts +9 -0
- package/dist/src/runtime/long-term-memory/candidate-processing.js +79 -0
- package/dist/src/runtime/long-term-memory/contracts.d.ts +108 -0
- package/dist/src/runtime/long-term-memory/contracts.js +1 -0
- package/dist/src/runtime/long-term-memory/diagnostics.d.ts +9 -0
- package/dist/src/runtime/long-term-memory/diagnostics.js +42 -0
- package/dist/src/runtime/long-term-memory/embedding-batches.d.ts +13 -0
- package/dist/src/runtime/long-term-memory/embedding-batches.js +87 -0
- package/dist/src/runtime/long-term-memory/events.d.ts +13 -0
- package/dist/src/runtime/long-term-memory/events.js +15 -0
- package/dist/src/runtime/long-term-memory/finalization.d.ts +8 -0
- package/dist/src/runtime/long-term-memory/finalization.js +24 -0
- package/dist/src/runtime/long-term-memory/index.d.ts +6 -0
- package/dist/src/runtime/long-term-memory/index.js +6 -0
- package/dist/src/runtime/long-term-memory/management/contracts.d.ts +54 -0
- package/dist/src/runtime/long-term-memory/management/contracts.js +1 -0
- package/dist/src/runtime/long-term-memory/management/errors.d.ts +10 -0
- package/dist/src/runtime/long-term-memory/management/errors.js +13 -0
- package/dist/src/runtime/long-term-memory/management/mutations.d.ts +17 -0
- package/dist/src/runtime/long-term-memory/management/mutations.js +178 -0
- package/dist/src/runtime/long-term-memory/management/queries.d.ts +8 -0
- package/dist/src/runtime/long-term-memory/management/queries.js +46 -0
- package/dist/src/runtime/long-term-memory/management/search.d.ts +7 -0
- package/dist/src/runtime/long-term-memory/management/search.js +18 -0
- package/dist/src/runtime/long-term-memory/management/service.d.ts +13 -0
- package/dist/src/runtime/long-term-memory/management/service.js +61 -0
- package/dist/src/runtime/long-term-memory/management/validation.d.ts +24 -0
- package/dist/src/runtime/long-term-memory/management/validation.js +77 -0
- package/dist/src/runtime/long-term-memory/onboarding/configuration.d.ts +14 -0
- package/dist/src/runtime/long-term-memory/onboarding/configuration.js +92 -0
- package/dist/src/runtime/long-term-memory/onboarding/contracts.d.ts +52 -0
- package/dist/src/runtime/long-term-memory/onboarding/contracts.js +1 -0
- package/dist/src/runtime/long-term-memory/onboarding/service.d.ts +21 -0
- package/dist/src/runtime/long-term-memory/onboarding/service.js +88 -0
- package/dist/src/runtime/long-term-memory/policies/normalization.d.ts +10 -0
- package/dist/src/runtime/long-term-memory/policies/normalization.js +45 -0
- package/dist/src/runtime/long-term-memory/policies/reconciliation.d.ts +20 -0
- package/dist/src/runtime/long-term-memory/policies/reconciliation.js +21 -0
- package/dist/src/runtime/long-term-memory/policies/scoring.d.ts +13 -0
- package/dist/src/runtime/long-term-memory/policies/scoring.js +55 -0
- package/dist/src/runtime/long-term-memory/policies/sensitive-data.d.ts +5 -0
- package/dist/src/runtime/long-term-memory/policies/sensitive-data.js +12 -0
- package/dist/src/runtime/long-term-memory/projection.d.ts +4 -0
- package/dist/src/runtime/long-term-memory/projection.js +39 -0
- package/dist/src/runtime/long-term-memory/ranked-search.d.ts +11 -0
- package/dist/src/runtime/long-term-memory/ranked-search.js +111 -0
- package/dist/src/runtime/long-term-memory/repository-state.d.ts +4 -0
- package/dist/src/runtime/long-term-memory/repository-state.js +131 -0
- package/dist/src/runtime/long-term-memory/response-context.d.ts +5 -0
- package/dist/src/runtime/long-term-memory/response-context.js +21 -0
- package/dist/src/runtime/long-term-memory/retrieval.d.ts +8 -0
- package/dist/src/runtime/long-term-memory/retrieval.js +73 -0
- package/dist/src/runtime/long-term-memory/service.d.ts +10 -0
- package/dist/src/runtime/long-term-memory/service.js +83 -0
- package/dist/src/runtime/orchestration/capability-adapters/index.d.ts +2 -0
- package/dist/src/runtime/orchestration/capability-adapters/index.js +2 -0
- package/dist/src/runtime/orchestration/final-response/authoring-contract.d.ts +10 -0
- package/dist/src/runtime/orchestration/final-response/authoring-contract.js +94 -0
- package/dist/src/runtime/orchestration/final-response/finalization.d.ts +1 -0
- package/dist/src/runtime/orchestration/final-response/finalization.js +1 -0
- package/dist/src/runtime/orchestration/final-response/format.d.ts +2 -0
- package/dist/src/runtime/orchestration/final-response/format.js +49 -0
- package/dist/src/runtime/orchestration/final-response/invoke.d.ts +16 -0
- package/dist/src/runtime/orchestration/final-response/invoke.js +24 -0
- package/dist/src/runtime/orchestration/role-calls/activation-budget.d.ts +14 -0
- package/dist/src/runtime/orchestration/role-calls/activation-budget.js +52 -0
- package/dist/src/runtime/orchestration/role-calls/candidate-validation.js +154 -0
- package/dist/src/runtime/orchestration/role-calls/capability-selection-reconsideration.js +1 -8
- package/dist/src/runtime/orchestration/role-calls/capability-selection-supervision-issuance.d.ts +17 -0
- package/dist/src/runtime/orchestration/role-calls/capability-selection-supervision-issuance.js +155 -0
- package/dist/src/runtime/orchestration/role-calls/capability-selection-supervision.d.ts +78 -0
- package/dist/src/runtime/orchestration/role-calls/capability-selection-supervision.js +339 -0
- package/dist/src/runtime/orchestration/role-calls/command-decoder.js +35 -10
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/active-capability-caller.d.ts +6 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/active-capability-caller.js +15 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/call-frame-state.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/call-frame-state.js +6 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/call-scope-transitions.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/call-scope-transitions.js +86 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-batch-transitions.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-batch-transitions.js +172 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-execution-state.d.ts +9 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-execution-state.js +28 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-execution-transitions.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-execution-transitions.js +117 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-invocation.d.ts +4 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-invocation.js +16 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-selection-transition.d.ts +2 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-selection-transition.js +114 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-settlement.d.ts +6 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/capability-settlement.js +54 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/child-transitions.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/child-transitions.js +206 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/operation-supervision-intervention.d.ts +13 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/operation-supervision-intervention.js +25 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/root-transitions.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/root-transitions.js +70 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch.d.ts +1 -1
- package/dist/src/runtime/orchestration/role-calls/command-dispatch.js +6 -580
- package/dist/src/runtime/orchestration/role-calls/contracts.d.ts +45 -5
- package/dist/src/runtime/orchestration/role-calls/contracts.js +2 -2
- package/dist/src/runtime/orchestration/role-calls/diagnostics.d.ts +4 -0
- package/dist/src/runtime/orchestration/role-calls/diagnostics.js +152 -1
- package/dist/src/runtime/orchestration/role-calls/index.d.ts +6 -0
- package/dist/src/runtime/orchestration/role-calls/index.js +6 -0
- package/dist/src/runtime/orchestration/role-calls/ledger.js +131 -7
- package/dist/src/runtime/orchestration/role-calls/operation-supervision-issuance.d.ts +11 -0
- package/dist/src/runtime/orchestration/role-calls/operation-supervision-issuance.js +66 -0
- package/dist/src/runtime/orchestration/role-calls/operation-supervision-projection.d.ts +16 -0
- package/dist/src/runtime/orchestration/role-calls/operation-supervision-projection.js +52 -0
- package/dist/src/runtime/orchestration/role-calls/operation-supervision-state-validation.d.ts +3 -0
- package/dist/src/runtime/orchestration/role-calls/operation-supervision-state-validation.js +151 -0
- package/dist/src/runtime/orchestration/role-calls/operation-supervision.d.ts +112 -0
- package/dist/src/runtime/orchestration/role-calls/operation-supervision.js +197 -0
- package/dist/src/runtime/orchestration/role-calls/reconsideration-cause.d.ts +26 -0
- package/dist/src/runtime/orchestration/role-calls/reconsideration-cause.js +127 -0
- package/dist/src/runtime/orchestration/role-calls/reducer-primitives.d.ts +1 -2
- package/dist/src/runtime/orchestration/role-calls/reducer-primitives.js +2 -12
- package/dist/src/runtime/orchestration/role-calls/reducer.js +19 -2
- package/dist/src/runtime/orchestration/role-calls/transactions.js +62 -5
- package/dist/src/runtime/orchestration/role-executors/activation/capability-continuation.d.ts +15 -0
- package/dist/src/runtime/orchestration/role-executors/activation/capability-continuation.js +73 -0
- package/dist/src/runtime/orchestration/role-executors/activation/loop.d.ts +0 -1
- package/dist/src/runtime/orchestration/role-executors/activation/loop.js +16 -54
- package/dist/src/runtime/orchestration/role-executors/activation/result-normalization.js +14 -0
- package/dist/src/runtime/orchestration/role-executors/activation/state-validation.d.ts +13 -1
- package/dist/src/runtime/orchestration/role-executors/activation/state-validation.js +137 -1
- package/dist/src/runtime/orchestration/role-executors/contracts.d.ts +7 -3
- package/dist/src/runtime/orchestration/role-executors/diagnostics.d.ts +2 -0
- package/dist/src/runtime/orchestration/role-executors/diagnostics.js +1 -6
- package/dist/src/runtime/orchestration/worker-capabilities/batch-selection.d.ts +10 -0
- package/dist/src/runtime/orchestration/worker-capabilities/batch-selection.js +8 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/adapter-catalog.d.ts +14 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/adapter-catalog.js +76 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/adapter-normalization.d.ts +10 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/adapter-normalization.js +160 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/binding-rejection.d.ts +2 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/binding-rejection.js +8 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/bound-capability-session.d.ts +24 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/bound-capability-session.js +100 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/call-authority.d.ts +29 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/call-authority.js +193 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/create-binding.d.ts +11 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/create-binding.js +109 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/dependency-results.d.ts +2 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/dependency-results.js +34 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/invocation-preparation.d.ts +21 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding/invocation-preparation.js +167 -0
- package/dist/src/runtime/orchestration/worker-capabilities/binding.d.ts +1 -13
- package/dist/src/runtime/orchestration/worker-capabilities/binding.js +1 -625
- package/dist/src/runtime/orchestration/worker-capabilities/contracts.d.ts +57 -14
- package/dist/src/runtime/orchestration/worker-capabilities/contracts.js +3 -1
- package/dist/src/runtime/orchestration/worker-capabilities/controls.d.ts +7 -0
- package/dist/src/runtime/orchestration/worker-capabilities/controls.js +50 -0
- package/dist/src/runtime/orchestration/worker-capabilities/error-fingerprint.d.ts +5 -0
- package/dist/src/runtime/orchestration/worker-capabilities/error-fingerprint.js +119 -0
- package/dist/src/runtime/orchestration/worker-capabilities/errors.d.ts +6 -0
- package/dist/src/runtime/orchestration/worker-capabilities/errors.js +11 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/adapter-exact-result.d.ts +7 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/adapter-exact-result.js +35 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/adapter-execution.d.ts +9 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/adapter-execution.js +28 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/adapter-result-normalization.d.ts +18 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/adapter-result-normalization.js +197 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/adapter-result-references.d.ts +2 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/adapter-result-references.js +44 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/context-projection.d.ts +12 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/context-projection.js +51 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/invocation-preparation.d.ts +25 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/invocation-preparation.js +111 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/ledger-transaction.d.ts +20 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution/ledger-transaction.js +142 -0
- package/dist/src/runtime/orchestration/worker-capabilities/execution.d.ts +10 -14
- package/dist/src/runtime/orchestration/worker-capabilities/execution.js +84 -357
- package/dist/src/runtime/orchestration/worker-capabilities/index.d.ts +3 -0
- package/dist/src/runtime/orchestration/worker-capabilities/index.js +3 -0
- package/dist/src/runtime/orchestration/worker-capabilities/outcome-fingerprint.d.ts +8 -0
- package/dist/src/runtime/orchestration/worker-capabilities/outcome-fingerprint.js +21 -0
- package/dist/src/runtime/orchestration/worker-capabilities/payload-author.js +31 -9
- package/dist/src/runtime/orchestration/worker-capabilities/payload-contracts.d.ts +15 -6
- package/dist/src/runtime/orchestration/worker-capabilities/payload-contracts.js +2 -0
- package/dist/src/runtime/orchestration/worker-capabilities/payload-instructions.js +4 -4
- package/dist/src/runtime/orchestration/worker-capabilities/preparation-fingerprint.d.ts +23 -0
- package/dist/src/runtime/orchestration/worker-capabilities/preparation-fingerprint.js +109 -0
- package/dist/src/runtime/plugins/manifest-projection.js +3 -0
- package/dist/src/runtime/plugins/manifest-validator.js +20 -0
- package/dist/src/runtime/ports.d.ts +10 -1
- package/dist/src/runtime/request/contracts.d.ts +7 -0
- package/dist/src/runtime/request/dependencies.d.ts +1 -0
- package/dist/src/runtime/request/dependencies.js +10 -1
- package/dist/src/runtime/request/execution-agent-root-execution.js +5 -4
- package/dist/src/runtime/request/execution-facets.d.ts +2 -1
- package/dist/src/runtime/request/execution-facets.js +6 -0
- package/dist/src/runtime/request/execution-scope-surfaces.js +6 -0
- package/dist/src/runtime/request/execution-scope.d.ts +3 -2
- package/dist/src/runtime/request/handler.js +4 -1
- package/dist/src/runtime/request/result.d.ts +2 -0
- package/dist/src/runtime/request/root-contract.d.ts +4 -2
- package/dist/src/runtime/request/root-execution-kernel.js +100 -31
- package/dist/src/runtime/request/supervisor-root-execution.js +4 -2
- package/dist/src/runtime/request/worker-capability-payload-prompts.js +1 -1
- package/dist/src/runtime/steps/execution-agent/capability-invocation-contract.d.ts +24 -0
- package/dist/src/runtime/steps/execution-agent/capability-invocation-contract.js +52 -0
- package/dist/src/runtime/steps/execution-agent/contracts.d.ts +5 -2
- package/dist/src/runtime/steps/execution-agent/format.js +19 -6
- package/dist/src/runtime/steps/execution-agent/input.js +8 -12
- package/dist/src/runtime/steps/execution-agent/parser.js +25 -19
- package/dist/src/runtime/steps/execution-agent/prompt.js +3 -2
- package/dist/src/runtime/steps/execution-agent/reconsideration-context.d.ts +3 -0
- package/dist/src/runtime/steps/execution-agent/reconsideration-context.js +76 -0
- package/dist/src/runtime/steps/execution-agent/refinement-prompt.js +4 -4
- package/dist/src/runtime/steps/execution-agent/refinement-reconsideration.d.ts +3 -0
- package/dist/src/runtime/steps/execution-agent/refinement-reconsideration.js +25 -0
- package/dist/src/runtime/steps/execution-agent/refinement.d.ts +4 -7
- package/dist/src/runtime/steps/execution-agent/refinement.js +24 -35
- package/dist/src/runtime/steps/execution-agent/response-input.d.ts +2 -0
- package/dist/src/runtime/steps/execution-agent/response-input.js +22 -6
- package/dist/src/runtime/steps/execution-agent/response-prompt.d.ts +1 -1
- package/dist/src/runtime/steps/execution-agent/response-prompt.js +8 -3
- package/dist/src/runtime/steps/execution-agent/response-run.d.ts +6 -0
- package/dist/src/runtime/steps/execution-agent/response-run.js +40 -10
- package/dist/src/runtime/steps/execution-agent/run.js +6 -6
- package/dist/src/runtime/steps/execution-agent/state-context.d.ts +4 -1
- package/dist/src/runtime/steps/execution-agent/state-context.js +40 -23
- package/dist/src/runtime/steps/supervisor-response/index.d.ts +1 -1
- package/dist/src/runtime/steps/supervisor-response/index.js +1 -1
- package/dist/src/runtime/steps/supervisor-response/input.d.ts +13 -5
- package/dist/src/runtime/steps/supervisor-response/input.js +27 -8
- package/dist/src/runtime/steps/supervisor-response/memory-authoring.d.ts +10 -0
- package/dist/src/runtime/steps/supervisor-response/memory-authoring.js +125 -0
- package/dist/src/runtime/steps/supervisor-response/prompt.d.ts +4 -0
- package/dist/src/runtime/steps/supervisor-response/prompt.js +19 -0
- package/dist/src/runtime/steps/supervisor-response/run.d.ts +8 -0
- package/dist/src/runtime/steps/supervisor-response/run.js +46 -17
- package/dist/src/runtime/steps/worker-decision/contracts.d.ts +8 -1
- package/dist/src/runtime/steps/worker-decision/contracts.js +3 -0
- package/dist/src/runtime/steps/worker-decision/format.d.ts +4 -0
- package/dist/src/runtime/steps/worker-decision/format.js +97 -22
- package/dist/src/runtime/steps/worker-decision/input/action-policy.d.ts +9 -0
- package/dist/src/runtime/steps/worker-decision/input/action-policy.js +15 -0
- package/dist/src/runtime/steps/worker-decision/input/canonical-state.d.ts +2 -2
- package/dist/src/runtime/steps/worker-decision/input/canonical-state.js +19 -7
- package/dist/src/runtime/steps/worker-decision/input/capability-selection.js +44 -3
- package/dist/src/runtime/steps/worker-decision/input/contract.d.ts +1 -0
- package/dist/src/runtime/steps/worker-decision/input/contract.js +12 -6
- package/dist/src/runtime/steps/worker-decision/input/diagnostic-projection.js +14 -5
- package/dist/src/runtime/steps/worker-decision/input/prompt-context.js +9 -6
- package/dist/src/runtime/steps/worker-decision/input/reference-context.js +21 -3
- package/dist/src/runtime/steps/worker-decision/input/session.js +2 -1
- package/dist/src/runtime/steps/worker-decision/input/types.d.ts +6 -1
- package/dist/src/runtime/steps/worker-decision/input.d.ts +2 -2
- package/dist/src/runtime/steps/worker-decision/input.js +1 -2
- package/dist/src/runtime/steps/worker-decision/parser/accepted-decision.d.ts +3 -0
- package/dist/src/runtime/steps/worker-decision/parser/accepted-decision.js +70 -0
- package/dist/src/runtime/steps/worker-decision/parser/action-validation.d.ts +4 -0
- package/dist/src/runtime/steps/worker-decision/parser/action-validation.js +55 -0
- package/dist/src/runtime/steps/worker-decision/parser/capability-batch-validation.d.ts +3 -0
- package/dist/src/runtime/steps/worker-decision/parser/capability-batch-validation.js +135 -0
- package/dist/src/runtime/steps/worker-decision/parser/capability-controls-validation.d.ts +6 -0
- package/dist/src/runtime/steps/worker-decision/parser/capability-controls-validation.js +132 -0
- package/dist/src/runtime/steps/worker-decision/parser/capability-invocation-validation.d.ts +4 -0
- package/dist/src/runtime/steps/worker-decision/parser/capability-invocation-validation.js +104 -0
- package/dist/src/runtime/steps/worker-decision/parser/decision-shape-validation.d.ts +4 -0
- package/dist/src/runtime/steps/worker-decision/parser/decision-shape-validation.js +28 -0
- package/dist/src/runtime/steps/worker-decision/parser/pending-capability-selection-validation.d.ts +4 -0
- package/dist/src/runtime/steps/worker-decision/parser/pending-capability-selection-validation.js +105 -0
- package/dist/src/runtime/steps/worker-decision/parser/validation-contract.d.ts +50 -0
- package/dist/src/runtime/steps/worker-decision/parser/validation-contract.js +19 -0
- package/dist/src/runtime/steps/worker-decision/parser.d.ts +5 -1
- package/dist/src/runtime/steps/worker-decision/parser.js +32 -426
- package/dist/src/runtime/steps/worker-decision/prompt.d.ts +3 -0
- package/dist/src/runtime/steps/worker-decision/prompt.js +57 -20
- package/dist/src/runtime/steps/worker-decision/result-author.js +11 -1
- package/dist/src/runtime/steps/worker-decision/run.js +97 -19
- package/dist/src/runtime/validation/strict-record.d.ts +2 -0
- package/dist/src/runtime/validation/strict-record.js +12 -0
- package/dist/src/shared/model-step-registry-data.json +9 -0
- package/dist/src/shared/model-step-registry.d.ts +9 -0
- package/dist/src/shared/model-step-registry.generated.d.ts +9 -0
- package/dist/src/shared/model-step-registry.generated.js +9 -0
- package/dist/src/web-ui/app/ARCHITECTURE.md +1 -1
- package/dist/src/web-ui/app/app.js +56 -11
- package/dist/src/web-ui/app/components/config-workspace/config-model.js +320 -0
- package/dist/src/web-ui/app/components/config-workspace/dashboard-rendering.js +155 -0
- package/dist/src/web-ui/app/components/config-workspace/field-rendering.js +278 -0
- package/dist/src/web-ui/app/components/config-workspace/model-rendering.js +251 -0
- package/dist/src/web-ui/app/components/config-workspace/step-rendering.js +145 -0
- package/dist/src/web-ui/app/components/config-workspace/workspace-events.js +271 -0
- package/dist/src/web-ui/app/components/config-workspace/workspace-mutations.js +195 -0
- package/dist/src/web-ui/app/components/config-workspace/workspace-persistence.js +247 -0
- package/dist/src/web-ui/app/components/config-workspace/workspace-view.js +299 -0
- package/dist/src/web-ui/app/components/config-workspace.js +179 -866
- package/dist/src/web-ui/app/components/conversation-activity.d.ts +7 -1
- package/dist/src/web-ui/app/components/long-term-memory/icons.js +16 -0
- package/dist/src/web-ui/app/components/long-term-memory/manager.js +192 -0
- package/dist/src/web-ui/app/components/long-term-memory/record-editor.d.ts +9 -0
- package/dist/src/web-ui/app/components/long-term-memory/record-editor.js +62 -0
- package/dist/src/web-ui/app/components/long-term-memory/record-list.d.ts +5 -0
- package/dist/src/web-ui/app/components/long-term-memory/record-list.js +97 -0
- package/dist/src/web-ui/app/components/long-term-memory/view-model.d.ts +29 -0
- package/dist/src/web-ui/app/components/long-term-memory/view-model.js +69 -0
- package/dist/src/web-ui/app/components/long-term-memory-setup.js +334 -0
- package/dist/src/web-ui/app/components/runtime-setup-guide.d.ts +39 -0
- package/dist/src/web-ui/app/components/tool-approval-card.d.ts +18 -0
- package/dist/src/web-ui/app/components/workspace-shell.js +48 -7
- package/dist/src/web-ui/app/controllers/app-event-bindings.js +43 -6
- package/dist/src/web-ui/app/controllers/composer-attachments-controller.d.ts +92 -0
- package/dist/src/web-ui/app/controllers/composer-queue-controller.d.ts +109 -0
- package/dist/src/web-ui/app/controllers/composer-submit-controller.d.ts +77 -0
- package/dist/src/web-ui/app/controllers/conversation-session-controller.d.ts +149 -0
- package/dist/src/web-ui/app/controllers/conversation-session-controller.js +43 -3
- package/dist/src/web-ui/app/controllers/long-term-memory/controller.d.ts +87 -0
- package/dist/src/web-ui/app/controllers/long-term-memory/controller.js +302 -0
- package/dist/src/web-ui/app/controllers/long-term-memory/policy.d.ts +14 -0
- package/dist/src/web-ui/app/controllers/long-term-memory/policy.js +61 -0
- package/dist/src/web-ui/app/controllers/long-term-memory/state.js +85 -0
- package/dist/src/web-ui/app/controllers/operations-controller.d.ts +25 -0
- package/dist/src/web-ui/app/controllers/realtime-event-controller.d.ts +57 -0
- package/dist/src/web-ui/app/controllers/runtime-onboarding-controller.d.ts +32 -0
- package/dist/src/web-ui/app/controllers/runtime-selection-controller.d.ts +177 -0
- package/dist/src/web-ui/app/controllers/runtime-selection-controller.js +78 -11
- package/dist/src/web-ui/app/controllers/tool-approval-controller.d.ts +28 -0
- package/dist/src/web-ui/app/index.html +13 -15
- package/dist/src/web-ui/app/services/runtime-web-client/memory.js +127 -0
- package/dist/src/web-ui/app/services/runtime-web-client.d.ts +84 -0
- package/dist/src/web-ui/app/services/runtime-web-client.js +27 -1
- package/dist/src/web-ui/app/styles/30-inspector-config.css +151 -1423
- package/dist/src/web-ui/app/styles/35-memory-onboarding.css +153 -0
- package/dist/src/web-ui/app/styles/36-memory-management.css +419 -0
- package/dist/src/web-ui/app/styles/40-config-workspace.css +992 -0
- package/dist/src/web-ui/app/styles/90-responsive.css +187 -26
- package/dist/src/web-ui/app/styles.css +3 -0
- package/dist/src/web-ui/config-dashboard-backend.js +9 -1
- package/dist/src/web-ui/local-runtime/api-router.d.ts +4 -2
- package/dist/src/web-ui/local-runtime/api-router.js +33 -0
- package/dist/src/web-ui/local-runtime/contracts.d.ts +5 -0
- package/dist/src/web-ui/local-runtime/memory-management-input.d.ts +12 -0
- package/dist/src/web-ui/local-runtime/memory-management-input.js +68 -0
- package/dist/src/web-ui/local-runtime/memory-management-response.d.ts +17 -0
- package/dist/src/web-ui/local-runtime/memory-management-response.js +47 -0
- package/dist/src/web-ui/local-runtime/memory-management-routes.d.ts +24 -0
- package/dist/src/web-ui/local-runtime/memory-management-routes.js +128 -0
- package/dist/src/web-ui/local-runtime/memory-onboarding-routes.d.ts +17 -0
- package/dist/src/web-ui/local-runtime/memory-onboarding-routes.js +81 -0
- package/dist/src/web-ui/local-runtime/request-abort.d.ts +7 -0
- package/dist/src/web-ui/local-runtime/request-abort.js +19 -0
- package/dist/src/web-ui/local-runtime-backend.js +10 -3
- package/dist/src/web-ui/server.d.ts +2 -0
- package/dist/src/web-ui/server.js +3 -0
- package/docs/configuration.md +128 -45
- package/docs/installation.md +21 -0
- package/docs/known-limitations.md +11 -0
- package/docs/long-term-memory.md +181 -0
- package/docs/publishing.md +52 -25
- package/docs/runtime-invariant-coverage.md +1 -1
- package/docs/runtime-library.md +16 -1
- package/docs/runtime-prompt-policy-contracts.md +12 -2
- package/docs/troubleshooting.md +21 -0
- package/examples/models/default.config.json +1 -0
- package/examples/request-runner.config.example.json +16 -22
- package/examples/runtime.config.example.json +4 -0
- package/methodologies/memory-informed-response.md +15 -0
- package/methodologies/response-ux.md +17 -0
- package/package.json +8 -2
- package/plugins/exec/source/handlers.ts +65 -5
- package/plugins/exec/src/index.cjs +39 -3
- package/plugins/filesystem/plugin.json +1 -0
- package/runtime.config.schema.json +30 -0
- package/src/runtime/README.md +77 -38
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ hardcoded defaults.
|
|
|
12
12
|
|
|
13
13
|
- Configurable local and hosted model providers
|
|
14
14
|
- Persistent conversations, request events, and replay
|
|
15
|
+
- Optional passive long-term memory across sessions
|
|
15
16
|
- Planning, execution, and review workflows
|
|
16
17
|
- Manifest-based tools and plugins with explicit runtime boundaries
|
|
17
18
|
- Workspace, file, skill, and memory capabilities
|
|
@@ -32,6 +33,7 @@ The Web UI supports:
|
|
|
32
33
|
- streaming messages, current activity, tool progress, and failures
|
|
33
34
|
- steering an active request or queuing the next message
|
|
34
35
|
- editing runtime configuration
|
|
36
|
+
- configuring passive long-term memory with a consumer-selected embedding model
|
|
35
37
|
- inspecting runtime status, logs, and health
|
|
36
38
|
|
|
37
39
|
The UI is a client of the runtime; persisted sessions, events, and request state
|
|
@@ -81,6 +83,16 @@ OpenAI profiles created by `abot init` or `abot add-model` use the recommended
|
|
|
81
83
|
`execution-agent-v1` execution policy. Existing profiles are preserved unless
|
|
82
84
|
the user explicitly requests replacement.
|
|
83
85
|
|
|
86
|
+
Passive long-term memory is disabled by default. After configuring a provider,
|
|
87
|
+
choose and probe an embedding model from the Config workspace or CLI:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx abot memory enable --provider <provider-id> --model <embedding-model-id>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
See [Passive Long-Term Memory](docs/long-term-memory.md) for its privacy,
|
|
94
|
+
storage, retrieval, and management contracts.
|
|
95
|
+
|
|
84
96
|
## Quick Start From Source
|
|
85
97
|
|
|
86
98
|
From a checkout of this repository:
|
|
@@ -199,9 +211,10 @@ Step](docs/configuration.md#calibrating-a-model-by-step).
|
|
|
199
211
|
|
|
200
212
|
The distribution includes a curated public plugin catalog for development and
|
|
201
213
|
agent workflows: filesystem operations, command execution, document reading,
|
|
202
|
-
local search, memory, project inspection, JSON inspection,
|
|
203
|
-
Web access. Hosts can add plugins under their own runtime
|
|
204
|
-
IDs fail closed.
|
|
214
|
+
local search, explicit memory operations, project inspection, JSON inspection,
|
|
215
|
+
system probing, and Web access. Hosts can add plugins under their own runtime
|
|
216
|
+
root; duplicate plugin IDs fail closed. The explicit memory plugin is separate
|
|
217
|
+
from core-owned passive long-term memory.
|
|
205
218
|
|
|
206
219
|
The Web plugin exposes two distinct capabilities:
|
|
207
220
|
|
|
@@ -231,6 +244,7 @@ For a deeper view, see [Architecture](docs/architecture.md).
|
|
|
231
244
|
- [Running Locally](docs/running-locally.md)
|
|
232
245
|
- [Configuration](docs/configuration.md)
|
|
233
246
|
- [Runtime Library](docs/runtime-library.md)
|
|
247
|
+
- [Passive Long-Term Memory](docs/long-term-memory.md)
|
|
234
248
|
- [Plugins](docs/plugins.md)
|
|
235
249
|
- [Troubleshooting](docs/troubleshooting.md)
|
|
236
250
|
|
|
@@ -2,6 +2,7 @@ import { constants } from "node:fs";
|
|
|
2
2
|
import { access, mkdir } from "node:fs/promises";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
+
import { parseRequestRunnerConfig } from "../src/runtime/config/runner/versioned-config.js";
|
|
5
6
|
import { buildModelConfig, buildProviderConfig, isRecord, parseBaseUrl, parseProvider, readJsonObject, resolveRuntimePackageRoot, writeJsonObject, } from "./runtime-setup-files.js";
|
|
6
7
|
import { getAddModelUsage, getMissingInitializationInstruction, getRestartInstruction, } from "./runtime-setup-presentation.js";
|
|
7
8
|
const RUNTIME_CONFIG_FILE = "local/runtime.config.json";
|
|
@@ -207,6 +208,9 @@ export async function runAddRuntimeModel(argv = process.argv.slice(2), runOption
|
|
|
207
208
|
readJsonObject(runnerConfigPath),
|
|
208
209
|
readJsonObject(join(resolveRuntimePackageRoot(import.meta.dirname), MODEL_TEMPLATE_FILE)),
|
|
209
210
|
]);
|
|
211
|
+
if (options.setDefault) {
|
|
212
|
+
parseRequestRunnerConfig(runnerConfig, runnerConfigPath);
|
|
213
|
+
}
|
|
210
214
|
const merged = mergeRuntimeConfig(runtimeConfig, options);
|
|
211
215
|
const nextRunnerConfig = options.setDefault
|
|
212
216
|
? selectDefaultProfile(runnerConfig, options.profile)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ModelProviderAdapterRegistry } from "../src/model-gateway/index.js";
|
|
2
|
+
import type { RuntimeSetupCommandMode } from "./runtime-setup-presentation.js";
|
|
3
|
+
export declare function runConfigureLongTermMemory(argv?: string[], options?: Readonly<{
|
|
4
|
+
commandMode?: RuntimeSetupCommandMode;
|
|
5
|
+
providerAdapters?: ModelProviderAdapterRegistry;
|
|
6
|
+
}>): Promise<void>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { join, resolve } from "node:path";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { createLocalLongTermMemoryOnboardingService } from "../src/runtime/adapters/long-term-memory/onboarding-service.js";
|
|
4
|
+
import { resolveProviderAdapters } from "../src/model-gateway/server/index.js";
|
|
5
|
+
import { loadDotEnvFile } from "../src/shared/load-dotenv.js";
|
|
6
|
+
export async function runConfigureLongTermMemory(argv = process.argv.slice(2), options = {}) {
|
|
7
|
+
const commandMode = options.commandMode ?? "source";
|
|
8
|
+
const input = parseMemoryCommand(argv, commandMode);
|
|
9
|
+
loadDotEnvFile(join(input.rootDir, ".env"));
|
|
10
|
+
const providerAdapters = resolveProviderAdapters({
|
|
11
|
+
providerAdapters: options.providerAdapters,
|
|
12
|
+
});
|
|
13
|
+
const service = createLocalLongTermMemoryOnboardingService({
|
|
14
|
+
rootDir: input.rootDir,
|
|
15
|
+
providerAdapters,
|
|
16
|
+
...(process.env.LLM_RUNTIME_CONFIG_FILE
|
|
17
|
+
? { configPath: process.env.LLM_RUNTIME_CONFIG_FILE }
|
|
18
|
+
: {}),
|
|
19
|
+
});
|
|
20
|
+
if (input.command === "status") {
|
|
21
|
+
printJson(await service.status());
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (input.command === "models") {
|
|
25
|
+
printJson(await service.discover({
|
|
26
|
+
providerId: requireOption(input, "providerId"),
|
|
27
|
+
}));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (input.command === "disable") {
|
|
31
|
+
printJson(await service.disable());
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
printJson(await service.enable({
|
|
35
|
+
providerId: requireOption(input, "providerId"),
|
|
36
|
+
model: requireOption(input, "model"),
|
|
37
|
+
...(input.profileId ? { profileId: input.profileId } : {}),
|
|
38
|
+
emitClientEvents: input.emitClientEvents,
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
function parseMemoryCommand(argv, commandMode) {
|
|
42
|
+
const [commandValue, ...args] = argv;
|
|
43
|
+
if (commandValue === "--help" || commandValue === "-h") {
|
|
44
|
+
printHelp(commandMode);
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
const command = parseCommand(commandValue);
|
|
48
|
+
let rootDir = process.cwd();
|
|
49
|
+
let providerId;
|
|
50
|
+
let model;
|
|
51
|
+
let profileId;
|
|
52
|
+
let emitClientEvents = false;
|
|
53
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
54
|
+
const argument = args[index];
|
|
55
|
+
if (argument === "--emit-events") {
|
|
56
|
+
emitClientEvents = true;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const parsed = readNamedArgument(args, index);
|
|
60
|
+
index = parsed.nextIndex;
|
|
61
|
+
if (parsed.name === "root")
|
|
62
|
+
rootDir = resolve(parsed.value);
|
|
63
|
+
else if (parsed.name === "provider")
|
|
64
|
+
providerId = parsed.value;
|
|
65
|
+
else if (parsed.name === "model")
|
|
66
|
+
model = parsed.value;
|
|
67
|
+
else if (parsed.name === "profile")
|
|
68
|
+
profileId = parsed.value;
|
|
69
|
+
else
|
|
70
|
+
throw new Error(`unknown argument: --${parsed.name}`);
|
|
71
|
+
}
|
|
72
|
+
assertCommandArguments({ command, providerId, model });
|
|
73
|
+
return {
|
|
74
|
+
command,
|
|
75
|
+
rootDir,
|
|
76
|
+
emitClientEvents,
|
|
77
|
+
...(providerId ? { providerId } : {}),
|
|
78
|
+
...(model ? { model } : {}),
|
|
79
|
+
...(profileId ? { profileId } : {}),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function parseCommand(value) {
|
|
83
|
+
if (["status", "models", "enable", "disable"].includes(value ?? "")) {
|
|
84
|
+
return value;
|
|
85
|
+
}
|
|
86
|
+
throw new Error("memory command must be status, models, enable, or disable");
|
|
87
|
+
}
|
|
88
|
+
function readNamedArgument(args, index) {
|
|
89
|
+
const argument = args[index] ?? "";
|
|
90
|
+
if (!argument.startsWith("--")) {
|
|
91
|
+
throw new Error(`unknown argument: ${argument}`);
|
|
92
|
+
}
|
|
93
|
+
const separator = argument.indexOf("=");
|
|
94
|
+
const name = argument.slice(2, separator > 0 ? separator : undefined);
|
|
95
|
+
const inlineValue = separator > 0 ? argument.slice(separator + 1) : "";
|
|
96
|
+
const value = inlineValue || args[index + 1]?.trim() || "";
|
|
97
|
+
if (!value || value.startsWith("--")) {
|
|
98
|
+
throw new Error(`--${name} requires a value`);
|
|
99
|
+
}
|
|
100
|
+
return { name, value, nextIndex: inlineValue ? index : index + 1 };
|
|
101
|
+
}
|
|
102
|
+
function assertCommandArguments(input) {
|
|
103
|
+
const needsProvider = input.command === "models" || input.command === "enable";
|
|
104
|
+
if (needsProvider && !input.providerId) {
|
|
105
|
+
throw new Error("--provider is required");
|
|
106
|
+
}
|
|
107
|
+
if (input.command === "enable" && !input.model) {
|
|
108
|
+
throw new Error("--model is required");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function requireOption(input, key) {
|
|
112
|
+
const value = input[key];
|
|
113
|
+
if (!value) {
|
|
114
|
+
throw new Error(`memory ${key} is required`);
|
|
115
|
+
}
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
function printHelp(commandMode) {
|
|
119
|
+
const prefix = commandMode === "package" ? "abot memory" : "npm run memory --";
|
|
120
|
+
console.log([
|
|
121
|
+
`${prefix} status`,
|
|
122
|
+
`${prefix} models --provider <provider-id>`,
|
|
123
|
+
`${prefix} enable --provider <provider-id> --model <model-id> [--profile <profile-id>] [--emit-events]`,
|
|
124
|
+
`${prefix} disable`,
|
|
125
|
+
"",
|
|
126
|
+
"Enable performs a real embedding probe before changing runtime config.",
|
|
127
|
+
"The provider must already exist under models.providers.",
|
|
128
|
+
].join("\n"));
|
|
129
|
+
}
|
|
130
|
+
function printJson(value) {
|
|
131
|
+
console.log(JSON.stringify(value, null, 2));
|
|
132
|
+
}
|
|
133
|
+
const invokedPath = process.argv[1] ? pathToFileURL(process.argv[1]).href : "";
|
|
134
|
+
if (import.meta.url === invokedPath) {
|
|
135
|
+
runConfigureLongTermMemory().catch((error) => {
|
|
136
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
137
|
+
process.exit(1);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
@@ -2,7 +2,7 @@ import { constants } from "node:fs";
|
|
|
2
2
|
import { access, copyFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
import { buildModelConfig, buildProviderConfig, isRecord, parseBaseUrl, parseProvider, readJsonObject, resolveRuntimePackageRoot, writeJsonObject, } from "./runtime-setup-files.js";
|
|
5
|
+
import { buildModelConfig, buildProviderConfig, DEFAULT_ROOT_RESPONSE_METHODOLOGY_FILES, isRecord, parseBaseUrl, parseProvider, readJsonObject, resolveRuntimePackageRoot, writeJsonObject, } from "./runtime-setup-files.js";
|
|
6
6
|
import { getInitNextSteps, getInitUsage, } from "./runtime-setup-presentation.js";
|
|
7
7
|
const ENV_FILE = ".env";
|
|
8
8
|
const ENV_EXAMPLE_FILE = "examples/env.example";
|
|
@@ -111,6 +111,7 @@ function printHelp(commandMode) {
|
|
|
111
111
|
"- local/runtime.config.json",
|
|
112
112
|
"- local/request-runner.config.json",
|
|
113
113
|
"- local/models/default.config.json",
|
|
114
|
+
"- methodologies for root response authoring",
|
|
114
115
|
"- .runtime/compiled",
|
|
115
116
|
"- .runtime/shared/logs",
|
|
116
117
|
"- .runtime/prod and .runtime/dev",
|
|
@@ -220,6 +221,14 @@ export async function runInitRuntime(argv = process.argv.slice(2), runOptions =
|
|
|
220
221
|
targetPath: modelConfigPath,
|
|
221
222
|
force: options.force,
|
|
222
223
|
});
|
|
224
|
+
const methodologyStatuses = await Promise.all(DEFAULT_ROOT_RESPONSE_METHODOLOGY_FILES.map(async (relativePath) => ({
|
|
225
|
+
relativePath,
|
|
226
|
+
status: await writeIfMissing({
|
|
227
|
+
sourcePath: join(templateRoot, relativePath),
|
|
228
|
+
targetPath: join(options.rootDir, relativePath),
|
|
229
|
+
force: options.force,
|
|
230
|
+
}),
|
|
231
|
+
})));
|
|
223
232
|
if (configStatus !== "kept") {
|
|
224
233
|
await configureRuntimeProvider(configPath, options.provider, options.baseUrl);
|
|
225
234
|
}
|
|
@@ -240,6 +249,7 @@ export async function runInitRuntime(argv = process.argv.slice(2), runOptions =
|
|
|
240
249
|
`${LOCAL_CONFIG_FILE}: ${configStatus}`,
|
|
241
250
|
`${LOCAL_REQUEST_RUNNER_CONFIG_FILE}: ${requestRunnerConfigStatus}`,
|
|
242
251
|
`${LOCAL_MODEL_CONFIG_FILE}: ${modelConfigStatus}`,
|
|
252
|
+
...methodologyStatuses.map(({ relativePath, status }) => `${relativePath}: ${status}`),
|
|
243
253
|
"created runtime directories: .runtime/compiled, .runtime/shared/logs, .runtime/prod, .runtime/dev",
|
|
244
254
|
"",
|
|
245
255
|
...getInitNextSteps(commandMode),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type Provider = string;
|
|
2
2
|
export type JsonObject = Record<string, unknown>;
|
|
3
|
+
export declare const DEFAULT_ROOT_RESPONSE_METHODOLOGY_FILES: readonly string[];
|
|
3
4
|
export declare function resolveRuntimePackageRoot(startDir: string): string;
|
|
4
5
|
export declare function isRecord(value: unknown): value is JsonObject;
|
|
5
6
|
export declare function parseProvider(value: string): Provider;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
export const DEFAULT_ROOT_RESPONSE_METHODOLOGY_FILES = Object.freeze([
|
|
5
|
+
"methodologies/response-ux.md",
|
|
6
|
+
"methodologies/memory-informed-response.md",
|
|
7
|
+
]);
|
|
4
8
|
export function resolveRuntimePackageRoot(startDir) {
|
|
5
9
|
let current = resolve(startDir);
|
|
6
10
|
while (true) {
|
|
@@ -55,6 +55,7 @@ export type ToolNormalInvocationOperation = Readonly<{
|
|
|
55
55
|
operationId: string;
|
|
56
56
|
summary: string;
|
|
57
57
|
input: ToolNormalInvocationInput;
|
|
58
|
+
selectionControlIds?: readonly string[];
|
|
58
59
|
fixedParams?: Readonly<Record<string, ToolNormalInvocationFixedValue>>;
|
|
59
60
|
payload?: ToolNormalInvocationPayload;
|
|
60
61
|
effect: ToolNormalInvocationEffect;
|
|
@@ -4,6 +4,11 @@ type ToolNormalInvocationDefinition = Readonly<{
|
|
|
4
4
|
name: string;
|
|
5
5
|
params: Readonly<Record<string, string>>;
|
|
6
6
|
executionEffect?: "read_only" | "mutating" | "mixed";
|
|
7
|
+
payloadChannelSpec?: Readonly<{
|
|
8
|
+
stages?: readonly Readonly<{
|
|
9
|
+
outputParam: string;
|
|
10
|
+
}>[];
|
|
11
|
+
}>;
|
|
7
12
|
runtimePathBindings?: readonly Readonly<{
|
|
8
13
|
operationId: string;
|
|
9
14
|
param: string;
|
|
@@ -252,8 +252,8 @@ function parsePayload(toolName, path, raw) {
|
|
|
252
252
|
}
|
|
253
253
|
function parseOperation(toolName, path, raw) {
|
|
254
254
|
if (!isPlainObject(raw) ||
|
|
255
|
-
!hasExactKeys(raw, ["operationId", "summary", "input", "effect", "approval"], ["fixedParams", "payload"])) {
|
|
256
|
-
fail(toolName, path, "operation must contain operationId/summary/input/effect/approval and optional fixedParams/payload");
|
|
255
|
+
!hasExactKeys(raw, ["operationId", "summary", "input", "effect", "approval"], ["selectionControlIds", "fixedParams", "payload"])) {
|
|
256
|
+
fail(toolName, path, "operation must contain operationId/summary/input/effect/approval and optional selectionControlIds/fixedParams/payload");
|
|
257
257
|
}
|
|
258
258
|
if (raw.effect !== "read_only" &&
|
|
259
259
|
raw.effect !== "mutating" &&
|
|
@@ -264,6 +264,7 @@ function parseOperation(toolName, path, raw) {
|
|
|
264
264
|
fail(toolName, `${path}.approval`, "expected request_policy or always");
|
|
265
265
|
}
|
|
266
266
|
const input = parseInput(toolName, `${path}.input`, raw.input);
|
|
267
|
+
const selectionControlIds = parseSelectionControlIds(toolName, `${path}.selectionControlIds`, input, raw.selectionControlIds);
|
|
267
268
|
const fixedParams = parseFixedParams(toolName, `${path}.fixedParams`, raw.fixedParams);
|
|
268
269
|
const payload = parsePayload(toolName, `${path}.payload`, raw.payload);
|
|
269
270
|
const overlaps = new Set(Object.keys(input.properties));
|
|
@@ -280,12 +281,35 @@ function parseOperation(toolName, path, raw) {
|
|
|
280
281
|
operationId: identifier(toolName, `${path}.operationId`, raw.operationId),
|
|
281
282
|
summary: boundedText(toolName, `${path}.summary`, raw.summary, MAX_SUMMARY_LENGTH),
|
|
282
283
|
input,
|
|
284
|
+
...(selectionControlIds ? { selectionControlIds } : {}),
|
|
283
285
|
...(fixedParams ? { fixedParams } : {}),
|
|
284
286
|
...(payload ? { payload } : {}),
|
|
285
287
|
effect: raw.effect,
|
|
286
288
|
approval: raw.approval,
|
|
287
289
|
});
|
|
288
290
|
}
|
|
291
|
+
function parseSelectionControlIds(toolName, path, input, value) {
|
|
292
|
+
if (value === undefined)
|
|
293
|
+
return undefined;
|
|
294
|
+
if (!Array.isArray(value) ||
|
|
295
|
+
value.length === 0 ||
|
|
296
|
+
value.length > MAX_PROPERTIES) {
|
|
297
|
+
fail(toolName, path, `expected a non-empty array of at most ${MAX_PROPERTIES} control identifiers`);
|
|
298
|
+
}
|
|
299
|
+
const controlIds = value.map((controlId, index) => identifier(toolName, `${path}.${index}`, controlId));
|
|
300
|
+
if (new Set(controlIds).size !== controlIds.length) {
|
|
301
|
+
fail(toolName, path, "expected unique control identifiers");
|
|
302
|
+
}
|
|
303
|
+
for (const controlId of controlIds) {
|
|
304
|
+
if (!Object.hasOwn(input.properties, controlId)) {
|
|
305
|
+
fail(toolName, path, `unknown input control ${controlId}`);
|
|
306
|
+
}
|
|
307
|
+
if (!input.required.includes(controlId)) {
|
|
308
|
+
fail(toolName, path, `selection control ${controlId} must be required`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return Object.freeze(controlIds);
|
|
312
|
+
}
|
|
289
313
|
export function parseToolNormalInvocationContract(toolName, raw) {
|
|
290
314
|
if (raw === undefined)
|
|
291
315
|
return undefined;
|
|
@@ -362,6 +386,10 @@ export function parseToolNormalInvocationForDefinition(definition, raw) {
|
|
|
362
386
|
const contract = parseToolNormalInvocationContract(definition.name, raw);
|
|
363
387
|
if (!contract)
|
|
364
388
|
return undefined;
|
|
389
|
+
const stagedOutputParams = definition.payloadChannelSpec?.stages &&
|
|
390
|
+
definition.payloadChannelSpec.stages.length >= 2
|
|
391
|
+
? new Set(definition.payloadChannelSpec.stages.map(({ outputParam }) => outputParam))
|
|
392
|
+
: undefined;
|
|
365
393
|
for (const [bindingIndex, binding] of (definition.runtimePathBindings ?? []).entries()) {
|
|
366
394
|
const operation = contract.operations.find((candidate) => candidate.operationId === binding.operationId);
|
|
367
395
|
const input = operation?.input.properties[binding.param];
|
|
@@ -376,6 +404,11 @@ export function parseToolNormalInvocationForDefinition(definition, raw) {
|
|
|
376
404
|
}
|
|
377
405
|
for (const [operationIndex, operation] of contract.operations.entries()) {
|
|
378
406
|
const operationPath = `normalInvocation.operations.${operationIndex}`;
|
|
407
|
+
for (const selectionControlId of operation.selectionControlIds ?? []) {
|
|
408
|
+
if (stagedOutputParams?.has(selectionControlId)) {
|
|
409
|
+
fail(definition.name, `${operationPath}.selectionControlIds`, `selection control ${selectionControlId} must remain in the effective public input`);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
379
412
|
for (const [param, schema] of Object.entries(operation.input.properties)) {
|
|
380
413
|
validateDeclaredParam(definition, `${operationPath}.input.properties.${param}`, param, projectedTypeForSchema(schema));
|
|
381
414
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ToolCatalogGroup, ToolDefinition, ToolDevelopmentRole, ToolExecutionEffect } from "../tool-types.js";
|
|
2
|
+
export declare function isRoutingCapability(value: unknown): value is ToolDefinition["routingCapability"];
|
|
3
|
+
export declare function isDevelopmentRole(value: unknown): value is ToolDevelopmentRole;
|
|
4
|
+
export declare function isExecutionEffect(value: unknown): value is ToolExecutionEffect;
|
|
5
|
+
export declare function parseToolCatalogGroups(toolName: string, value: unknown): ToolCatalogGroup[];
|
|
6
|
+
export declare function parseParamsByCommand(toolName: string, raw: unknown): ToolDefinition["paramsByCommand"];
|
|
7
|
+
export declare function parseRuntimePathBindings(toolName: string, raw: unknown): ToolDefinition["runtimePathBindings"];
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { isToolCatalogGroupId } from "../tool-types.js";
|
|
2
|
+
import { isToolDefinitionRecordValue } from "./definition-shape.js";
|
|
3
|
+
const ROUTING_CAPABILITIES = [
|
|
4
|
+
"filesystem_inspection",
|
|
5
|
+
"filesystem_mutation",
|
|
6
|
+
"semantic_lookup",
|
|
7
|
+
"semantic_mutation",
|
|
8
|
+
"web_lookup",
|
|
9
|
+
];
|
|
10
|
+
const DEVELOPMENT_ROLES = [
|
|
11
|
+
"inspect",
|
|
12
|
+
"establish",
|
|
13
|
+
"mutate",
|
|
14
|
+
"verify",
|
|
15
|
+
"auxiliary",
|
|
16
|
+
];
|
|
17
|
+
const EXECUTION_EFFECTS = [
|
|
18
|
+
"read_only",
|
|
19
|
+
"mutating",
|
|
20
|
+
"mixed",
|
|
21
|
+
];
|
|
22
|
+
export function isRoutingCapability(value) {
|
|
23
|
+
if (typeof value !== "string")
|
|
24
|
+
return false;
|
|
25
|
+
return ROUTING_CAPABILITIES.includes(value);
|
|
26
|
+
}
|
|
27
|
+
export function isDevelopmentRole(value) {
|
|
28
|
+
if (typeof value !== "string")
|
|
29
|
+
return false;
|
|
30
|
+
return DEVELOPMENT_ROLES.includes(value);
|
|
31
|
+
}
|
|
32
|
+
export function isExecutionEffect(value) {
|
|
33
|
+
if (typeof value !== "string")
|
|
34
|
+
return false;
|
|
35
|
+
return EXECUTION_EFFECTS.includes(value);
|
|
36
|
+
}
|
|
37
|
+
export function parseToolCatalogGroups(toolName, value) {
|
|
38
|
+
if (value === undefined)
|
|
39
|
+
return ["other"];
|
|
40
|
+
if (!hasUniqueSupportedToolCatalogGroups(value)) {
|
|
41
|
+
throw new Error(`Invalid tool definition for ${toolName} (catalogGroups)`);
|
|
42
|
+
}
|
|
43
|
+
return [...value];
|
|
44
|
+
}
|
|
45
|
+
function hasUniqueSupportedToolCatalogGroups(value) {
|
|
46
|
+
if (!Array.isArray(value))
|
|
47
|
+
return false;
|
|
48
|
+
if (value.length === 0)
|
|
49
|
+
return false;
|
|
50
|
+
if (value.some((group) => !isToolCatalogGroupId(group)))
|
|
51
|
+
return false;
|
|
52
|
+
return new Set(value).size === value.length;
|
|
53
|
+
}
|
|
54
|
+
export function parseParamsByCommand(toolName, raw) {
|
|
55
|
+
if (raw === undefined)
|
|
56
|
+
return undefined;
|
|
57
|
+
if (!isToolDefinitionRecordValue(raw)) {
|
|
58
|
+
throw new Error(`Invalid tool definition for ${toolName} (paramsByCommand)`);
|
|
59
|
+
}
|
|
60
|
+
const discriminator = raw.discriminator;
|
|
61
|
+
const rawVariants = raw.variants;
|
|
62
|
+
if (typeof discriminator !== "string" || discriminator.trim().length === 0) {
|
|
63
|
+
throw new Error(`Invalid tool definition for ${toolName} (paramsByCommand.discriminator)`);
|
|
64
|
+
}
|
|
65
|
+
if (!isToolDefinitionRecordValue(rawVariants)) {
|
|
66
|
+
throw new Error(`Invalid tool definition for ${toolName} (paramsByCommand.variants)`);
|
|
67
|
+
}
|
|
68
|
+
const variants = {};
|
|
69
|
+
for (const [variantName, variantParams] of Object.entries(rawVariants)) {
|
|
70
|
+
variants[variantName] = parseCommandVariantParameters(toolName, variantName, variantParams);
|
|
71
|
+
}
|
|
72
|
+
return { discriminator, variants };
|
|
73
|
+
}
|
|
74
|
+
function parseCommandVariantParameters(toolName, variantName, raw) {
|
|
75
|
+
if (!isToolDefinitionRecordValue(raw)) {
|
|
76
|
+
throw new Error(`Invalid tool definition for ${toolName} (paramsByCommand.variants.${variantName})`);
|
|
77
|
+
}
|
|
78
|
+
const parsed = {};
|
|
79
|
+
for (const [paramName, paramType] of Object.entries(raw)) {
|
|
80
|
+
if (typeof paramType !== "string") {
|
|
81
|
+
throw new Error(`Invalid tool definition for ${toolName} (paramsByCommand.variants.${variantName}.${paramName})`);
|
|
82
|
+
}
|
|
83
|
+
parsed[paramName] = paramType;
|
|
84
|
+
}
|
|
85
|
+
return parsed;
|
|
86
|
+
}
|
|
87
|
+
export function parseRuntimePathBindings(toolName, raw) {
|
|
88
|
+
if (raw === undefined)
|
|
89
|
+
return undefined;
|
|
90
|
+
if (!Array.isArray(raw) || raw.length === 0 || raw.length > 32) {
|
|
91
|
+
throw new Error(`Invalid tool definition for ${toolName} (runtimePathBindings)`);
|
|
92
|
+
}
|
|
93
|
+
const identities = new Set();
|
|
94
|
+
return raw.map((value, index) => parseRuntimePathBinding(toolName, value, index, identities));
|
|
95
|
+
}
|
|
96
|
+
function parseRuntimePathBinding(toolName, value, index, identities) {
|
|
97
|
+
if (!isToolDefinitionRecordValue(value)) {
|
|
98
|
+
throw invalidRuntimePathBinding(toolName, index);
|
|
99
|
+
}
|
|
100
|
+
const keys = Object.keys(value);
|
|
101
|
+
if (keys.length !== 3 && keys.length !== 4) {
|
|
102
|
+
throw invalidRuntimePathBinding(toolName, index);
|
|
103
|
+
}
|
|
104
|
+
if (!Object.hasOwn(value, "operationId")) {
|
|
105
|
+
throw invalidRuntimePathBinding(toolName, index);
|
|
106
|
+
}
|
|
107
|
+
if (!Object.hasOwn(value, "param")) {
|
|
108
|
+
throw invalidRuntimePathBinding(toolName, index);
|
|
109
|
+
}
|
|
110
|
+
if (!Object.hasOwn(value, "base")) {
|
|
111
|
+
throw invalidRuntimePathBinding(toolName, index);
|
|
112
|
+
}
|
|
113
|
+
if (keys.some((key) => !isRuntimePathBindingKey(key))) {
|
|
114
|
+
throw invalidRuntimePathBinding(toolName, index);
|
|
115
|
+
}
|
|
116
|
+
if (typeof value.operationId !== "string") {
|
|
117
|
+
throw invalidRuntimePathBinding(toolName, index);
|
|
118
|
+
}
|
|
119
|
+
if (value.operationId.trim().length === 0) {
|
|
120
|
+
throw invalidRuntimePathBinding(toolName, index);
|
|
121
|
+
}
|
|
122
|
+
if (typeof value.param !== "string" || value.param.trim().length === 0) {
|
|
123
|
+
throw invalidRuntimePathBinding(toolName, index);
|
|
124
|
+
}
|
|
125
|
+
if (value.base !== "worker_working_directory") {
|
|
126
|
+
throw invalidRuntimePathBinding(toolName, index);
|
|
127
|
+
}
|
|
128
|
+
if (value.default !== undefined && value.default !== ".") {
|
|
129
|
+
throw invalidRuntimePathBinding(toolName, index);
|
|
130
|
+
}
|
|
131
|
+
const operationId = value.operationId.trim();
|
|
132
|
+
const param = value.param.trim();
|
|
133
|
+
const identity = `${operationId}\u0000${param}`;
|
|
134
|
+
if (identities.has(identity)) {
|
|
135
|
+
throw new Error(`Invalid tool definition for ${toolName} (runtimePathBindings duplicate ${operationId}.${param})`);
|
|
136
|
+
}
|
|
137
|
+
identities.add(identity);
|
|
138
|
+
return Object.freeze({
|
|
139
|
+
operationId,
|
|
140
|
+
param,
|
|
141
|
+
base: "worker_working_directory",
|
|
142
|
+
...(value.default === "." ? { default: "." } : {}),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function isRuntimePathBindingKey(key) {
|
|
146
|
+
if (key === "operationId")
|
|
147
|
+
return true;
|
|
148
|
+
if (key === "param")
|
|
149
|
+
return true;
|
|
150
|
+
if (key === "base")
|
|
151
|
+
return true;
|
|
152
|
+
return key === "default";
|
|
153
|
+
}
|
|
154
|
+
function invalidRuntimePathBinding(toolName, index) {
|
|
155
|
+
return new Error(`Invalid tool definition for ${toolName} (runtimePathBindings.${index})`);
|
|
156
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { isDevelopmentRole, isExecutionEffect, isRoutingCapability, parseParamsByCommand, parseRuntimePathBindings, parseToolCatalogGroups, } from "./definition-fields.js";
|
|
2
|
+
import { parseEventPresentation } from "./event-presentation.js";
|
|
3
|
+
import { parsePayloadChannelSpec } from "./payload-channel-spec.js";
|
|
4
|
+
import { isToolDefinitionRecordValue } from "./definition-shape.js";
|
|
5
|
+
export function parseToolDefinition(raw) {
|
|
6
|
+
if (!isToolDefinitionRecordValue(raw)) {
|
|
7
|
+
throw new Error("Invalid tool definition entry (not an object)");
|
|
8
|
+
}
|
|
9
|
+
const name = raw.name;
|
|
10
|
+
const description = raw.description;
|
|
11
|
+
const routingCapability = raw.routingCapability;
|
|
12
|
+
const controlsRefinement = raw.controlsRefinement;
|
|
13
|
+
const catalogGroups = raw.catalogGroups;
|
|
14
|
+
const executionEffect = raw.executionEffect;
|
|
15
|
+
const developmentRoles = raw.developmentRoles;
|
|
16
|
+
const eventPresentation = raw.eventPresentation;
|
|
17
|
+
const params = raw.params;
|
|
18
|
+
if (typeof name !== "string" || name.trim().length === 0) {
|
|
19
|
+
throw new Error("Invalid tool definition entry (name)");
|
|
20
|
+
}
|
|
21
|
+
if (description !== undefined && typeof description !== "string") {
|
|
22
|
+
throw new Error(`Invalid tool definition for ${name} (description)`);
|
|
23
|
+
}
|
|
24
|
+
if (!isRoutingCapability(routingCapability)) {
|
|
25
|
+
throw new Error(`Invalid tool definition for ${name} (routingCapability)`);
|
|
26
|
+
}
|
|
27
|
+
if (controlsRefinement !== undefined &&
|
|
28
|
+
controlsRefinement !== "mechanical_when_complete") {
|
|
29
|
+
throw new Error(`Invalid tool definition for ${name} (controlsRefinement)`);
|
|
30
|
+
}
|
|
31
|
+
if (executionEffect !== undefined && !isExecutionEffect(executionEffect)) {
|
|
32
|
+
throw new Error(`Invalid tool definition for ${name} (executionEffect)`);
|
|
33
|
+
}
|
|
34
|
+
if (!isToolDefinitionRecordValue(params)) {
|
|
35
|
+
throw new Error(`Invalid tool definition for ${name} (params)`);
|
|
36
|
+
}
|
|
37
|
+
if (!hasSupportedDevelopmentRoles(developmentRoles)) {
|
|
38
|
+
throw new Error(`Invalid tool definition for ${name} (developmentRoles)`);
|
|
39
|
+
}
|
|
40
|
+
for (const [paramName, paramType] of Object.entries(params)) {
|
|
41
|
+
if (typeof paramType !== "string") {
|
|
42
|
+
throw new Error(`Invalid tool definition for ${name} (param type for ${paramName})`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const paramsByCommand = parseParamsByCommand(name, raw.paramsByCommand);
|
|
46
|
+
const runtimePathBindings = parseRuntimePathBindings(name, raw.runtimePathBindings);
|
|
47
|
+
const payloadChannelSpec = parsePayloadChannelSpec(name, params, raw.payloadChannelSpec);
|
|
48
|
+
const parsedEventPresentation = parseEventPresentation(name, eventPresentation);
|
|
49
|
+
return {
|
|
50
|
+
name,
|
|
51
|
+
...(typeof description === "string" ? { description } : {}),
|
|
52
|
+
routingCapability,
|
|
53
|
+
...(controlsRefinement === "mechanical_when_complete"
|
|
54
|
+
? { controlsRefinement }
|
|
55
|
+
: {}),
|
|
56
|
+
catalogGroups: parseToolCatalogGroups(name, catalogGroups),
|
|
57
|
+
...(executionEffect ? { executionEffect } : {}),
|
|
58
|
+
...(Array.isArray(developmentRoles)
|
|
59
|
+
? { developmentRoles: [...developmentRoles] }
|
|
60
|
+
: {}),
|
|
61
|
+
...(parsedEventPresentation
|
|
62
|
+
? { eventPresentation: parsedEventPresentation }
|
|
63
|
+
: {}),
|
|
64
|
+
params: params,
|
|
65
|
+
...(paramsByCommand ? { paramsByCommand } : {}),
|
|
66
|
+
...(payloadChannelSpec ? { payloadChannelSpec } : {}),
|
|
67
|
+
...(runtimePathBindings ? { runtimePathBindings } : {}),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function hasSupportedDevelopmentRoles(value) {
|
|
71
|
+
if (value === undefined)
|
|
72
|
+
return true;
|
|
73
|
+
if (!Array.isArray(value))
|
|
74
|
+
return false;
|
|
75
|
+
return value.every(isDevelopmentRole);
|
|
76
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ToolPayloadChannelSpec } from "../tool-types.js";
|
|
2
|
+
export declare function isToolDefinitionRecordValue(value: unknown): value is Record<string, unknown>;
|
|
3
|
+
export declare function readToolDefinitionName(raw: unknown): string;
|
|
4
|
+
export declare function createInvalidToolDefinitionError(toolName: string, detail: string): Error;
|
|
5
|
+
export declare function isPayloadContextScope(value: unknown): value is "standard" | "target_only" | "target_with_artifacts";
|
|
6
|
+
export declare function isPayloadTargetContext(value: unknown): value is "bounded" | "full" | "full_numbered";
|
|
7
|
+
export declare function isPayloadResponseFormat(value: unknown): value is NonNullable<ToolPayloadChannelSpec["responseFormat"]>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function isToolDefinitionRecordValue(value) {
|
|
2
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
export function readToolDefinitionName(raw) {
|
|
5
|
+
if (!isToolDefinitionRecordValue(raw)) {
|
|
6
|
+
throw new Error("Invalid tool definition entry (not an object)");
|
|
7
|
+
}
|
|
8
|
+
if (typeof raw.name !== "string" || raw.name.trim().length === 0) {
|
|
9
|
+
throw new Error("Invalid tool definition entry (name)");
|
|
10
|
+
}
|
|
11
|
+
return raw.name;
|
|
12
|
+
}
|
|
13
|
+
export function createInvalidToolDefinitionError(toolName, detail) {
|
|
14
|
+
return new Error(`Invalid tool definition for ${toolName} (${detail})`);
|
|
15
|
+
}
|
|
16
|
+
export function isPayloadContextScope(value) {
|
|
17
|
+
if (value === "standard")
|
|
18
|
+
return true;
|
|
19
|
+
if (value === "target_only")
|
|
20
|
+
return true;
|
|
21
|
+
return value === "target_with_artifacts";
|
|
22
|
+
}
|
|
23
|
+
export function isPayloadTargetContext(value) {
|
|
24
|
+
if (value === "bounded")
|
|
25
|
+
return true;
|
|
26
|
+
if (value === "full")
|
|
27
|
+
return true;
|
|
28
|
+
return value === "full_numbered";
|
|
29
|
+
}
|
|
30
|
+
export function isPayloadResponseFormat(value) {
|
|
31
|
+
if (value === "json")
|
|
32
|
+
return true;
|
|
33
|
+
return isToolDefinitionRecordValue(value);
|
|
34
|
+
}
|