@abot-ai/runtime 1.8.1 → 1.9.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/dist/scripts/runtime-setup-files.js +46 -2
- package/dist/src/model-gateway/client/chat.js +9 -5
- package/dist/src/model-gateway/client/invocation-error.d.ts +9 -0
- package/dist/src/model-gateway/client/invocation-error.js +30 -0
- package/dist/src/model-gateway/client/stream-consumer.js +9 -2
- package/dist/src/model-gateway/client/stream-parser.js +2 -1
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/approval.d.ts +5 -1
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/approval.js +15 -1
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/prepared-execution.js +7 -5
- package/dist/src/runtime/adapters/registered-tool-normal-invocations/execution/prepared-snapshot.js +9 -2
- package/dist/src/runtime/automations/service.d.ts +1 -1
- package/dist/src/runtime/capabilities/automation-builder/tool-module.js +4 -4
- package/dist/src/runtime/capabilities/automations/draft-index.d.ts +1 -1
- package/dist/src/runtime/capabilities/automations/tool-module.js +4 -4
- package/dist/src/runtime/capabilities/core-tool-contracts.d.ts +29 -0
- package/dist/src/runtime/capabilities/core-tool-contracts.js +38 -0
- package/dist/src/runtime/capabilities/knowledge-skills/read-many.d.ts +4 -0
- package/dist/src/runtime/capabilities/knowledge-skills/read-many.js +21 -0
- package/dist/src/runtime/capabilities/knowledge-skills/read-targets.d.ts +13 -0
- package/dist/src/runtime/capabilities/knowledge-skills/read-targets.js +44 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-contract.d.ts +141 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-contract.js +58 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-module.d.ts +4 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-module.js +78 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-output.d.ts +12 -0
- package/dist/src/runtime/capabilities/knowledge-skills/tool-output.js +21 -0
- package/dist/src/runtime/capabilities/knowledge-skills/write-contract.d.ts +77 -0
- package/dist/src/runtime/capabilities/knowledge-skills/write-contract.js +28 -0
- package/dist/src/runtime/capabilities/knowledge-skills/write-operations.d.ts +3 -0
- package/dist/src/runtime/capabilities/knowledge-skills/write-operations.js +34 -0
- package/dist/src/runtime/capabilities/scheduling/tool-module.js +3 -3
- package/dist/src/runtime/composition.d.ts +5 -0
- package/dist/src/runtime/context/capability-result-compaction-source.d.ts +3 -1
- package/dist/src/runtime/context/capability-result-compaction-source.js +13 -1
- package/dist/src/runtime/context/core-skill-read-context.d.ts +16 -0
- package/dist/src/runtime/context/core-skill-read-context.js +76 -0
- package/dist/src/runtime/context/exact-evidence-match.d.ts +3 -0
- package/dist/src/runtime/context/exact-evidence-match.js +34 -0
- package/dist/src/runtime/context/model-step-compaction.js +20 -6
- package/dist/src/runtime/context/semantic-compaction/core-skill-read-source.d.ts +9 -0
- package/dist/src/runtime/context/semantic-compaction/core-skill-read-source.js +38 -0
- package/dist/src/runtime/context/semantic-compaction/generation-contracts.d.ts +2 -0
- package/dist/src/runtime/context/semantic-compaction/prompt.js +7 -7
- package/dist/src/runtime/context/semantic-compaction/run.js +10 -3
- package/dist/src/runtime/context/semantic-compaction/super-source-integrity.js +33 -3
- package/dist/src/runtime/context/session-artifact-paths.d.ts +2 -1
- package/dist/src/runtime/context/session-artifact-paths.js +2 -1
- package/dist/src/runtime/context/session-memory/model-step-controller.d.ts +2 -2
- package/dist/src/runtime/context/super-worker-compaction-failure.d.ts +1 -1
- package/dist/src/runtime/context/super-worker-compaction-failure.js +2 -1
- package/dist/src/runtime/context/super-worker-compaction-sidecar.d.ts +2 -1
- package/dist/src/runtime/context/super-worker-compaction-sidecar.js +9 -3
- package/dist/src/runtime/default-environment-adapters.d.ts +2 -1
- package/dist/src/runtime/default-environment-adapters.js +5 -1
- package/dist/src/runtime/knowledge-skills/available-skills-projection.d.ts +17 -0
- package/dist/src/runtime/knowledge-skills/available-skills-projection.js +66 -0
- package/dist/src/runtime/knowledge-skills/available-skills.d.ts +7 -0
- package/dist/src/runtime/knowledge-skills/available-skills.js +17 -0
- package/dist/src/runtime/knowledge-skills/builtins/abot-studio.d.ts +2 -0
- package/dist/src/runtime/knowledge-skills/builtins/abot-studio.js +27 -0
- package/dist/src/runtime/knowledge-skills/builtins/computer-use.d.ts +2 -0
- package/dist/src/runtime/knowledge-skills/builtins/computer-use.js +34 -0
- package/dist/src/runtime/knowledge-skills/builtins/skill-creator.d.ts +2 -0
- package/dist/src/runtime/knowledge-skills/builtins/skill-creator.js +29 -0
- package/dist/src/runtime/knowledge-skills/builtins/technical-work.d.ts +2 -0
- package/dist/src/runtime/knowledge-skills/builtins/technical-work.js +27 -0
- package/dist/src/runtime/knowledge-skills/catalog.d.ts +2 -0
- package/dist/src/runtime/knowledge-skills/catalog.js +12 -0
- package/dist/src/runtime/knowledge-skills/personal-contracts.d.ts +48 -0
- package/dist/src/runtime/knowledge-skills/personal-contracts.js +29 -0
- package/dist/src/runtime/knowledge-skills/personal-documents.d.ts +6 -0
- package/dist/src/runtime/knowledge-skills/personal-documents.js +56 -0
- package/dist/src/runtime/knowledge-skills/personal-management.d.ts +9 -0
- package/dist/src/runtime/knowledge-skills/personal-management.js +64 -0
- package/dist/src/runtime/knowledge-skills/personal-repository.d.ts +6 -0
- package/dist/src/runtime/knowledge-skills/personal-repository.js +76 -0
- package/dist/src/runtime/knowledge-skills/personal-store.d.ts +4 -0
- package/dist/src/runtime/knowledge-skills/personal-store.js +33 -0
- package/dist/src/runtime/knowledge-skills/read-evidence.d.ts +3 -0
- package/dist/src/runtime/knowledge-skills/read-evidence.js +13 -0
- package/dist/src/runtime/knowledge-skills/store.d.ts +19 -0
- package/dist/src/runtime/knowledge-skills/store.js +41 -0
- package/dist/src/runtime/local-application.d.ts +2 -1
- package/dist/src/runtime/local-host/app-service-dispatch.d.ts +1 -0
- package/dist/src/runtime/local-host/app-service-dispatch.js +5 -0
- package/dist/src/runtime/local-host/client-services.d.ts +3 -1
- package/dist/src/runtime/local-host/client-services.js +3 -2
- package/dist/src/runtime/long-term-memory/conversation-authoring/context.d.ts +1 -0
- package/dist/src/runtime/long-term-memory/conversation-authoring/context.js +1 -1
- package/dist/src/runtime/long-term-memory/conversation-authoring/plain-text-context.d.ts +5 -0
- package/dist/src/runtime/long-term-memory/conversation-authoring/plain-text-context.js +28 -0
- package/dist/src/runtime/long-term-memory/initial-context.d.ts +1 -0
- package/dist/src/runtime/model/context-compaction-admission.d.ts +1 -0
- package/dist/src/runtime/model/context-compaction-admission.js +35 -1
- package/dist/src/runtime/model/context-compaction-contracts.d.ts +9 -1
- package/dist/src/runtime/model/invoke-step.js +6 -2
- package/dist/src/runtime/model/provider-failure.d.ts +13 -0
- package/dist/src/runtime/model/provider-failure.js +37 -0
- package/dist/src/runtime/orchestration/role-calls/activation-budget.js +1 -0
- package/dist/src/runtime/orchestration/role-calls/candidate-validation.js +2 -0
- package/dist/src/runtime/orchestration/role-calls/checkpoint-state.js +2 -1
- package/dist/src/runtime/orchestration/role-calls/command-decoder.js +3 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/skill-read-transition.d.ts +4 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch/skill-read-transition.js +48 -0
- package/dist/src/runtime/orchestration/role-calls/command-dispatch.js +3 -0
- package/dist/src/runtime/orchestration/role-calls/contracts.d.ts +6 -3
- package/dist/src/runtime/orchestration/role-calls/contracts.js +3 -3
- package/dist/src/runtime/orchestration/role-calls/skill-read.d.ts +47 -0
- package/dist/src/runtime/orchestration/role-calls/skill-read.js +196 -0
- package/dist/src/runtime/orchestration/role-executors/activation/model-output-failure.d.ts +1 -1
- package/dist/src/runtime/orchestration/role-executors/activation/model-output-failure.js +4 -2
- package/dist/src/runtime/orchestration/worker-capabilities/binding/create-binding.js +4 -1
- package/dist/src/runtime/orchestration/worker-capabilities/contracts.d.ts +1 -1
- package/dist/src/runtime/orchestration/worker-capabilities/contracts.js +1 -1
- package/dist/src/runtime/orchestration/worker-capabilities/execution/approval-group.js +5 -3
- package/dist/src/runtime/orchestration/worker-capabilities/payload-compaction-transport.d.ts +2 -0
- package/dist/src/runtime/orchestration/worker-capabilities/payload-compaction-transport.js +7 -2
- package/dist/src/runtime/orchestration/worker-capabilities/supervisor-skill-authority.d.ts +19 -0
- package/dist/src/runtime/orchestration/worker-capabilities/supervisor-skill-authority.js +43 -0
- package/dist/src/runtime/plugins/loader.js +7 -6
- package/dist/src/runtime/request/approval-wait/preflight.js +1 -0
- package/dist/src/runtime/request/bound-runtime-handler.js +1 -0
- package/dist/src/runtime/request/contracts.d.ts +2 -0
- package/dist/src/runtime/request/execution-payload-compacted-evidence.d.ts +2 -2
- package/dist/src/runtime/request/execution-scope-surfaces.d.ts +2 -0
- package/dist/src/runtime/request/execution-scope-surfaces.js +7 -0
- package/dist/src/runtime/request/execution-scope.d.ts +6 -2
- package/dist/src/runtime/request/execution-scope.js +11 -0
- package/dist/src/runtime/request/payload-settled-evidence.d.ts +11 -0
- package/dist/src/runtime/request/payload-settled-evidence.js +29 -0
- package/dist/src/runtime/request/prepared-execution.js +2 -0
- package/dist/src/runtime/request/role-call-delegation-events.d.ts +19 -0
- package/dist/src/runtime/request/role-call-delegation-events.js +52 -0
- package/dist/src/runtime/request/role-call-return-events.d.ts +19 -0
- package/dist/src/runtime/request/role-call-return-events.js +63 -0
- package/dist/src/runtime/request/role-executor-composition.js +2 -2
- package/dist/src/runtime/request/root-capability-binding.d.ts +24 -0
- package/dist/src/runtime/request/root-capability-binding.js +57 -0
- package/dist/src/runtime/request/root-capability-catalog.d.ts +16 -0
- package/dist/src/runtime/request/root-capability-catalog.js +20 -0
- package/dist/src/runtime/request/root-contract.d.ts +11 -1
- package/dist/src/runtime/request/root-execution-kernel.js +35 -68
- package/dist/src/runtime/request/root-reference-action.d.ts +15 -0
- package/dist/src/runtime/request/root-reference-action.js +48 -0
- package/dist/src/runtime/request/root-skill-read.d.ts +13 -0
- package/dist/src/runtime/request/root-skill-read.js +102 -0
- package/dist/src/runtime/request/runner.js +10 -0
- package/dist/src/runtime/request/super-payload-context-failure.js +13 -4
- package/dist/src/runtime/request/supervisor-root-execution.js +48 -1
- package/dist/src/runtime/request/supervisor-skill-edit-target.d.ts +9 -0
- package/dist/src/runtime/request/supervisor-skill-edit-target.js +25 -0
- package/dist/src/runtime/request/supervisor-skill-payload-context.d.ts +21 -0
- package/dist/src/runtime/request/supervisor-skill-payload-context.js +91 -0
- package/dist/src/runtime/request/supervisor-skill-write-preparation.d.ts +25 -0
- package/dist/src/runtime/request/supervisor-skill-write-preparation.js +71 -0
- package/dist/src/runtime/request/worker-capability-composition.d.ts +4 -1
- package/dist/src/runtime/request/worker-capability-composition.js +4 -1
- package/dist/src/runtime/request/worker-capability-payload.d.ts +1 -1
- package/dist/src/runtime/request/worker-capability-payload.js +44 -37
- package/dist/src/runtime/runtime-environment.d.ts +2 -0
- package/dist/src/runtime/runtime-environment.js +12 -1
- package/dist/src/runtime/scheduler/contracts.d.ts +4 -0
- package/dist/src/runtime/scheduler/run-list-filter.d.ts +11 -0
- package/dist/src/runtime/scheduler/run-list-filter.js +56 -0
- package/dist/src/runtime/scheduler/run-list-query.d.ts +2 -2
- package/dist/src/runtime/scheduler/run-list-query.js +4 -1
- package/dist/src/runtime/steps/auditor-decision/contracts.d.ts +2 -0
- package/dist/src/runtime/steps/auditor-decision/evidence-representation.d.ts +2 -2
- package/dist/src/runtime/steps/auditor-decision/evidence-representation.js +2 -34
- package/dist/src/runtime/steps/auditor-decision/input.js +21 -3
- package/dist/src/runtime/steps/auditor-decision/projection.js +5 -0
- package/dist/src/runtime/steps/auditor-decision/prompt.d.ts +1 -1
- package/dist/src/runtime/steps/auditor-decision/prompt.js +14 -3
- package/dist/src/runtime/steps/capability-execution-guidance.d.ts +7 -0
- package/dist/src/runtime/steps/capability-execution-guidance.js +28 -0
- package/dist/src/runtime/steps/capability-execution-instructions.d.ts +0 -2
- package/dist/src/runtime/steps/capability-execution-instructions.js +0 -2
- package/dist/src/runtime/steps/execution-agent/capability-result-context.d.ts +5 -2
- package/dist/src/runtime/steps/execution-agent/capability-result-context.js +22 -3
- package/dist/src/runtime/steps/execution-agent/compaction.d.ts +3 -2
- package/dist/src/runtime/steps/execution-agent/compaction.js +9 -1
- package/dist/src/runtime/steps/execution-agent/direct-response-prompt.js +14 -14
- package/dist/src/runtime/steps/execution-agent/input.js +14 -2
- package/dist/src/runtime/steps/execution-agent/prompt.js +40 -38
- package/dist/src/runtime/steps/execution-agent/refinement-input.d.ts +1 -0
- package/dist/src/runtime/steps/execution-agent/refinement-prompt.js +4 -1
- package/dist/src/runtime/steps/execution-agent/response-prompt.js +1 -0
- package/dist/src/runtime/steps/execution-agent/response-run.js +1 -1
- package/dist/src/runtime/steps/execution-agent/run.js +1 -1
- package/dist/src/runtime/steps/execution-agent/state-context.js +1 -1
- package/dist/src/runtime/steps/knowledge-skill-instructions.d.ts +3 -0
- package/dist/src/runtime/steps/knowledge-skill-instructions.js +3 -0
- package/dist/src/runtime/steps/planner-decision/capability-brief.d.ts +2 -2
- package/dist/src/runtime/steps/planner-decision/capability-brief.js +5 -1
- package/dist/src/runtime/steps/planner-decision/input.d.ts +2 -2
- package/dist/src/runtime/steps/planner-decision/input.js +7 -1
- package/dist/src/runtime/steps/planner-decision/prompt.js +3 -0
- package/dist/src/runtime/steps/planner-graph/input.d.ts +2 -2
- package/dist/src/runtime/steps/planner-graph/input.js +9 -8
- package/dist/src/runtime/steps/planner-graph/prompt.js +2 -2
- package/dist/src/runtime/steps/planner-graph/run.d.ts +2 -2
- package/dist/src/runtime/steps/planner-graph/run.js +5 -5
- package/dist/src/runtime/steps/planner-graph/skill-guidance.d.ts +5 -0
- package/dist/src/runtime/steps/planner-graph/skill-guidance.js +62 -0
- package/dist/src/runtime/steps/reviewer-decision/final-evidence.d.ts +1 -0
- package/dist/src/runtime/steps/reviewer-decision/final-evidence.js +3 -1
- package/dist/src/runtime/steps/reviewer-decision/input.d.ts +3 -1
- package/dist/src/runtime/steps/reviewer-decision/input.js +2 -22
- package/dist/src/runtime/steps/reviewer-decision/model-context.d.ts +21 -0
- package/dist/src/runtime/steps/reviewer-decision/model-context.js +32 -1
- package/dist/src/runtime/steps/reviewer-decision/projection.js +4 -0
- package/dist/src/runtime/steps/reviewer-decision/prompt.d.ts +1 -1
- package/dist/src/runtime/steps/reviewer-decision/prompt.js +15 -4
- package/dist/src/runtime/steps/reviewer-decision/run.d.ts +2 -0
- package/dist/src/runtime/steps/reviewer-decision/run.js +6 -0
- package/dist/src/runtime/steps/skill-read-decision.d.ts +34 -0
- package/dist/src/runtime/steps/skill-read-decision.js +91 -0
- package/dist/src/runtime/steps/supervisor-decision/artifact-paths.d.ts +22 -0
- package/dist/src/runtime/steps/supervisor-decision/artifact-paths.js +132 -0
- package/dist/src/runtime/steps/supervisor-decision/capability-brief.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/capability-brief.js +9 -2
- package/dist/src/runtime/steps/supervisor-decision/contracts.d.ts +12 -3
- package/dist/src/runtime/steps/supervisor-decision/contracts.js +3 -0
- package/dist/src/runtime/steps/supervisor-decision/decision-phases.d.ts +37 -0
- package/dist/src/runtime/steps/supervisor-decision/decision-phases.js +124 -0
- package/dist/src/runtime/steps/supervisor-decision/diagnostics.d.ts +5 -1
- package/dist/src/runtime/steps/supervisor-decision/diagnostics.js +4 -0
- package/dist/src/runtime/steps/supervisor-decision/format.d.ts +1 -0
- package/dist/src/runtime/steps/supervisor-decision/format.js +2 -0
- package/dist/src/runtime/steps/supervisor-decision/input.d.ts +7 -1
- package/dist/src/runtime/steps/supervisor-decision/input.js +30 -11
- package/dist/src/runtime/steps/supervisor-decision/parser.d.ts +1 -0
- package/dist/src/runtime/steps/supervisor-decision/parser.js +11 -0
- package/dist/src/runtime/steps/supervisor-decision/preparation-input.d.ts +26 -0
- package/dist/src/runtime/steps/supervisor-decision/preparation-input.js +39 -0
- package/dist/src/runtime/steps/supervisor-decision/preparation.d.ts +17 -0
- package/dist/src/runtime/steps/supervisor-decision/preparation.js +65 -0
- package/dist/src/runtime/steps/supervisor-decision/presentation.d.ts +13 -0
- package/dist/src/runtime/steps/supervisor-decision/presentation.js +47 -0
- package/dist/src/runtime/steps/supervisor-decision/prompt.d.ts +4 -0
- package/dist/src/runtime/steps/supervisor-decision/prompt.js +96 -109
- package/dist/src/runtime/steps/supervisor-decision/response-recommendation.d.ts +2 -0
- package/dist/src/runtime/steps/supervisor-decision/response-recommendation.js +2 -0
- package/dist/src/runtime/steps/supervisor-decision/resume.d.ts +3 -0
- package/dist/src/runtime/steps/supervisor-decision/resume.js +20 -0
- package/dist/src/runtime/steps/supervisor-decision/run.d.ts +6 -0
- package/dist/src/runtime/steps/supervisor-decision/run.js +73 -159
- package/dist/src/runtime/steps/supervisor-decision/skill-selection-input.d.ts +21 -0
- package/dist/src/runtime/steps/supervisor-decision/skill-selection-input.js +29 -0
- package/dist/src/runtime/steps/supervisor-decision/skill-selection.d.ts +16 -0
- package/dist/src/runtime/steps/supervisor-decision/skill-selection.js +44 -0
- package/dist/src/runtime/steps/supervisor-response/input.d.ts +3 -0
- package/dist/src/runtime/steps/supervisor-response/input.js +5 -0
- package/dist/src/runtime/steps/supervisor-response/prompt.js +2 -0
- package/dist/src/runtime/steps/supervisor-response/response-recommendation.d.ts +3 -0
- package/dist/src/runtime/steps/supervisor-response/response-recommendation.js +24 -4
- package/dist/src/runtime/steps/supervisor-response/run.d.ts +5 -0
- package/dist/src/runtime/steps/supervisor-skill-authoring/contract.d.ts +43 -0
- package/dist/src/runtime/steps/supervisor-skill-authoring/contract.js +85 -0
- package/dist/src/runtime/steps/supervisor-skill-authoring/input.d.ts +35 -0
- package/dist/src/runtime/steps/supervisor-skill-authoring/input.js +87 -0
- package/dist/src/runtime/steps/supervisor-skill-authoring/run.d.ts +10 -0
- package/dist/src/runtime/steps/supervisor-skill-authoring/run.js +35 -0
- package/dist/src/runtime/steps/supervisor-skill-instructions.d.ts +4 -0
- package/dist/src/runtime/steps/supervisor-skill-instructions.js +4 -0
- package/dist/src/runtime/steps/worker-capability-scope-decision.js +14 -1
- package/dist/src/runtime/steps/worker-decision/contracts.d.ts +1 -0
- package/dist/src/runtime/steps/worker-decision/input/execution-guidance.d.ts +5 -0
- package/dist/src/runtime/steps/worker-decision/input/execution-guidance.js +31 -0
- package/dist/src/runtime/steps/worker-decision/input/prompt-context.js +2 -25
- package/dist/src/runtime/steps/worker-decision/input/reference-context.js +4 -0
- package/dist/src/runtime/steps/worker-decision/prompt.js +6 -2
- package/dist/src/runtime/steps/worker-decision/result-author.js +6 -0
- package/dist/src/web-ui/app/app-bootstrap.js +3 -0
- package/dist/src/web-ui/app/app.js +6 -1
- package/dist/src/web-ui/app/components/automations/run-history-controls.js +77 -0
- package/dist/src/web-ui/app/components/automations/run-history.js +55 -0
- package/dist/src/web-ui/app/components/automations/run.js +3 -8
- package/dist/src/web-ui/app/components/automations/workspace.js +11 -2
- package/dist/src/web-ui/app/components/conversation-role-cards.js +27 -0
- package/dist/src/web-ui/app/components/conversation-role-delegations.d.ts +12 -0
- package/dist/src/web-ui/app/components/conversation-role-delegations.js +24 -0
- package/dist/src/web-ui/app/components/conversation-role-history.d.ts +13 -0
- package/dist/src/web-ui/app/components/conversation-role-history.js +81 -0
- package/dist/src/web-ui/app/components/conversation-role-returns.d.ts +12 -0
- package/dist/src/web-ui/app/components/conversation-role-returns.js +23 -0
- package/dist/src/web-ui/app/components/onboarding-workspace-access.js +1 -1
- package/dist/src/web-ui/app/components/skills/workspace.js +119 -0
- package/dist/src/web-ui/app/components/workspace-shell.js +11 -1
- package/dist/src/web-ui/app/controllers/automation-read-projection.js +8 -4
- package/dist/src/web-ui/app/controllers/automation-run-actions.js +3 -1
- package/dist/src/web-ui/app/controllers/automation-run-history.js +159 -0
- package/dist/src/web-ui/app/controllers/automations-controller.js +27 -11
- package/dist/src/web-ui/app/controllers/environment-workspace-preparation.js +6 -2
- package/dist/src/web-ui/app/controllers/realtime-event-controller.js +22 -1
- package/dist/src/web-ui/app/controllers/runtime-selection-controller.js +7 -1
- package/dist/src/web-ui/app/controllers/skills-controller.js +237 -0
- package/dist/src/web-ui/app/lib/conversation-role-model.d.ts +5 -0
- package/dist/src/web-ui/app/lib/conversation-role-model.js +63 -5
- package/dist/src/web-ui/app/lib/event-presentation.js +34 -0
- package/dist/src/web-ui/app/lib/role-delegation-event.d.ts +18 -0
- package/dist/src/web-ui/app/lib/role-delegation-event.js +47 -0
- package/dist/src/web-ui/app/lib/role-return-event.d.ts +19 -0
- package/dist/src/web-ui/app/lib/role-return-event.js +36 -0
- package/dist/src/web-ui/app/lib/tool-activity-event.js +8 -6
- package/dist/src/web-ui/app/lib/tool-skill-activity-fields.js +50 -0
- package/dist/src/web-ui/app/lib/workspace-route.js +1 -0
- package/dist/src/web-ui/app/services/runtime-web-client/automations.d.ts +9 -1
- package/dist/src/web-ui/app/services/runtime-web-client/automations.js +10 -2
- package/dist/src/web-ui/app/services/runtime-web-client/skills.js +23 -0
- package/dist/src/web-ui/app/services/runtime-web-client.js +2 -0
- package/dist/src/web-ui/app/skills-feature.js +36 -0
- package/dist/src/web-ui/app/styles/24-conversation-role-cards.css +58 -0
- package/dist/src/web-ui/app/styles/40-skills.css +34 -0
- package/dist/src/web-ui/app/styles/50-automations.css +24 -3
- package/dist/src/web-ui/app/styles/95-home-widgets.css +2 -1
- package/dist/src/web-ui/app/styles.css +1 -0
- package/dist/src/web-ui/app/ui-behavior.d.ts +1 -1
- package/dist/src/web-ui/app/ui-behavior.js +1 -0
- package/dist/src/web-ui/client-state/store.js +3 -2
- package/dist/src/web-ui/client-state/transaction-order.d.ts +2 -0
- package/dist/src/web-ui/client-state/transaction-order.js +18 -0
- package/dist/src/web-ui/local-runtime/api-router.d.ts +1 -0
- package/dist/src/web-ui/local-runtime/api-router.js +7 -0
- package/dist/src/web-ui/local-runtime/automation-routes.js +2 -1
- package/dist/src/web-ui/local-runtime/automation-run-page.d.ts +5 -0
- package/dist/src/web-ui/local-runtime/automation-run-page.js +26 -0
- package/dist/src/web-ui/local-runtime/skill-management-routes.d.ts +18 -0
- package/dist/src/web-ui/local-runtime/skill-management-routes.js +118 -0
- package/docs/configuration.md +8 -0
- package/docs/runtime-public-contracts.md +37 -0
- package/examples/request-runner.config.example.json +3 -0
- package/package.json +1 -1
- package/plugins/web/skills/web_fetch_skill/SKILL.md +1 -2
- package/plugins/web/skills/web_search_skill/SKILL.md +3 -7
- package/src/runtime/README.md +96 -1
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
const PAGE_SIZE = 50;
|
|
2
|
+
const emptyFilters = () => ({ status: "", from: "", to: "" });
|
|
3
|
+
|
|
4
|
+
function localDay(value) {
|
|
5
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return null;
|
|
6
|
+
const [year, month, day] = value.split("-").map(Number);
|
|
7
|
+
const date = new Date(0);
|
|
8
|
+
date.setFullYear(year, month - 1, day);
|
|
9
|
+
date.setHours(0, 0, 0, 0);
|
|
10
|
+
if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day)
|
|
11
|
+
return null;
|
|
12
|
+
return date;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function historyQuery(filters) {
|
|
16
|
+
const query = { limit: PAGE_SIZE };
|
|
17
|
+
if (filters.status) query.status = filters.status;
|
|
18
|
+
const from = filters.from ? localDay(filters.from) : null;
|
|
19
|
+
const to = filters.to ? localDay(filters.to) : null;
|
|
20
|
+
if (filters.from && !from) throw new Error("Choose a valid start date.");
|
|
21
|
+
if (filters.to && !to) throw new Error("Choose a valid end date.");
|
|
22
|
+
if (to) to.setDate(to.getDate() + 1);
|
|
23
|
+
if (from && to && from >= to) throw new Error("The end date must be on or after the start date.");
|
|
24
|
+
if (from) query.from = from.toISOString();
|
|
25
|
+
if (to) query.to = to.toISOString();
|
|
26
|
+
return query;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function automationRunPage(response) {
|
|
30
|
+
return {
|
|
31
|
+
runs: Array.isArray(response?.runs) ? response.runs : [],
|
|
32
|
+
runsNextCursor: typeof response?.nextCursor === "string" ? response.nextCursor : null,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function appendRunPage(runs, page) {
|
|
37
|
+
const entries = new Map(runs.map((run) => [run.id, run]));
|
|
38
|
+
for (const run of page) entries.set(run.id, run);
|
|
39
|
+
return [...entries.values()];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** History belongs to an automation/environment, independently of its selected report. */
|
|
43
|
+
export function createAutomationRunHistory({ state, client, getEnvironmentId, publish, errorLabel }) {
|
|
44
|
+
let revision = 0;
|
|
45
|
+
let loaded = false;
|
|
46
|
+
let pages = 0;
|
|
47
|
+
let failedRead = null;
|
|
48
|
+
let pendingFilters = null;
|
|
49
|
+
|
|
50
|
+
function resetScope() {
|
|
51
|
+
revision += 1;
|
|
52
|
+
loaded = false;
|
|
53
|
+
pages = 0;
|
|
54
|
+
failedRead = null;
|
|
55
|
+
pendingFilters = null;
|
|
56
|
+
Object.assign(state, { runs: [], runsNextCursor: null, runsLoading: false,
|
|
57
|
+
runsError: "", runsFilterError: "", runsFilters: emptyFilters() });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function captureScope() {
|
|
61
|
+
const environmentId = getEnvironmentId(), automationId = state.selectedAutomationId;
|
|
62
|
+
const capturedRevision = revision;
|
|
63
|
+
return { environmentId, automationId, isCurrent: () => capturedRevision === revision &&
|
|
64
|
+
environmentId === getEnvironmentId() && automationId === state.selectedAutomationId };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function canRefreshFirstPage(refresh) {
|
|
68
|
+
if (state.runsLoading) return false;
|
|
69
|
+
if (failedRead) return false;
|
|
70
|
+
if (!loaded) return true;
|
|
71
|
+
return refresh && pages < 2;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function captureRead({ refresh = false } = {}) {
|
|
75
|
+
const scope = captureScope();
|
|
76
|
+
const query = scope.automationId && canRefreshFirstPage(refresh) ? historyQuery(state.runsFilters) : null;
|
|
77
|
+
return { query, isCurrent: scope.isCurrent, accept(projection) {
|
|
78
|
+
if (!query || !scope.isCurrent()) return;
|
|
79
|
+
state.runs = projection.runs;
|
|
80
|
+
state.runsNextCursor = projection.runsNextCursor;
|
|
81
|
+
loaded = true;
|
|
82
|
+
pages = 1;
|
|
83
|
+
} };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function readPage(filters, query, kind, isCurrent = () => true) {
|
|
87
|
+
revision += 1;
|
|
88
|
+
const scope = captureScope();
|
|
89
|
+
const canApplyHistoryRead = () => scope.isCurrent() && isCurrent();
|
|
90
|
+
failedRead = null;
|
|
91
|
+
pendingFilters = filters;
|
|
92
|
+
state.runsLoading = true;
|
|
93
|
+
state.runsError = "";
|
|
94
|
+
state.runsFilterError = "";
|
|
95
|
+
publish();
|
|
96
|
+
try {
|
|
97
|
+
const response = await client.listAutomationRuns(scope.automationId, scope.environmentId, query);
|
|
98
|
+
if (!canApplyHistoryRead()) return false;
|
|
99
|
+
const page = automationRunPage(response);
|
|
100
|
+
state.runs = kind === "more" ? appendRunPage(state.runs, page.runs) : page.runs;
|
|
101
|
+
state.runsNextCursor = page.runsNextCursor;
|
|
102
|
+
state.runsFilters = filters;
|
|
103
|
+
loaded = true;
|
|
104
|
+
pages = kind === "more" ? pages + 1 : 1;
|
|
105
|
+
return true;
|
|
106
|
+
} catch (error) {
|
|
107
|
+
if (!canApplyHistoryRead()) return false;
|
|
108
|
+
if (kind === "filter") {
|
|
109
|
+
state.runsFilterError = errorLabel(error);
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
state.runsError = errorLabel(error);
|
|
113
|
+
failedRead = { filters, query, kind };
|
|
114
|
+
return false;
|
|
115
|
+
} finally {
|
|
116
|
+
if (scope.isCurrent()) {
|
|
117
|
+
pendingFilters = null;
|
|
118
|
+
state.runsLoading = false;
|
|
119
|
+
publish();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function setRunFilters(input) {
|
|
125
|
+
if (!state.selectedAutomationId) return false;
|
|
126
|
+
const filters = { status: input?.status || "", from: input?.from || "", to: input?.to || "" };
|
|
127
|
+
let query;
|
|
128
|
+
try { query = historyQuery(filters); }
|
|
129
|
+
catch (error) {
|
|
130
|
+
state.runsFilterError = errorLabel(error);
|
|
131
|
+
publish();
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
return readPage(filters, query, "filter");
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function loadMoreRuns() {
|
|
138
|
+
if (!state.selectedAutomationId || !state.runsNextCursor || state.runsLoading) return false;
|
|
139
|
+
return readPage(state.runsFilters,
|
|
140
|
+
{ ...historyQuery(state.runsFilters), cursor: state.runsNextCursor }, "more");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function resetRunHistory({ isCurrent = () => true, supersede = false } = {}) {
|
|
144
|
+
if (!state.selectedAutomationId || !isCurrent()) return false;
|
|
145
|
+
if (state.runsLoading && !supersede) return false;
|
|
146
|
+
const filters = pendingFilters || state.runsFilters;
|
|
147
|
+
return readPage(filters, historyQuery(filters), "reset", isCurrent);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function retryRunHistory() {
|
|
151
|
+
if (!failedRead || state.runsLoading) return false;
|
|
152
|
+
const { filters, query, kind } = failedRead;
|
|
153
|
+
return readPage(filters, query, kind);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
resetScope();
|
|
157
|
+
return { resetScope, captureRead, revision: () => revision,
|
|
158
|
+
setRunFilters, loadMoreRuns, resetRunHistory, retryRunHistory };
|
|
159
|
+
}
|
|
@@ -6,6 +6,7 @@ import { createAutomationDraftActions } from "./automation-draft-actions.js";
|
|
|
6
6
|
import { createAutomationRunActions } from "./automation-run-actions.js";
|
|
7
7
|
import { createAutomationViewCapture } from "./automation-view-scope.js";
|
|
8
8
|
import { createAutomationManagementActions } from "./automation-management-actions.js";
|
|
9
|
+
import { createAutomationRunHistory } from "./automation-run-history.js";
|
|
9
10
|
import {
|
|
10
11
|
automationProjectionChanged, readAutomationBackgroundProjection,
|
|
11
12
|
readAutomationList, readAutomationSelection, validationResult,
|
|
@@ -31,7 +32,7 @@ export function createAutomationsController({
|
|
|
31
32
|
isEditingDirty = () => false,
|
|
32
33
|
}) {
|
|
33
34
|
const state = {
|
|
34
|
-
automations: [], selectedAutomationId: "", selectedRunId: "", selectedNodeId: "",
|
|
35
|
+
automations: [], selectedAutomationId: "", selectedRunId: "", selectedNodeId: "", lastViewedRunId: "",
|
|
35
36
|
draft: null, publishedDefinition: null, grant: null, validation: null, validationVisible: false,
|
|
36
37
|
catalog: null, templateCatalog: null, templateCatalogError: "", runs: [], run: null,
|
|
37
38
|
loading: false, mutation: "", error: "", feedback: "",
|
|
@@ -50,6 +51,8 @@ export function createAutomationsController({
|
|
|
50
51
|
const snapshot = () => ({ ...state, draftUndo: draftActions?.undoState() || null,
|
|
51
52
|
runStartPending: runActions?.isStartingRun() || false });
|
|
52
53
|
const publish = () => render(snapshot());
|
|
54
|
+
const runHistory = createAutomationRunHistory({ state, client, getEnvironmentId, publish, errorLabel });
|
|
55
|
+
const { setRunFilters, loadMoreRuns, resetRunHistory, retryRunHistory } = runHistory;
|
|
53
56
|
const currentEnvironment = (environmentId) => environmentId === getEnvironmentId();
|
|
54
57
|
const captureView = createAutomationViewCapture({ state, getEnvironmentId,
|
|
55
58
|
getNavigationRevision: () => navigationRevision, getNavigationRequestRevision: () => navigationRequestRevision,
|
|
@@ -61,7 +64,8 @@ export function createAutomationsController({
|
|
|
61
64
|
currentEnvironment, captureView });
|
|
62
65
|
const { mutateDraft, saveDefinition, saveNode, undoDraftMove, restorePublishedDraft } = draftActions;
|
|
63
66
|
runActions = createAutomationRunActions({ client, mutation, publish,
|
|
64
|
-
loadSelected, openRun, captureView
|
|
67
|
+
loadSelected, openRun, captureView,
|
|
68
|
+
refreshRunHistory: (isCurrent) => runHistory.resetRunHistory({ isCurrent, supersede: true }) });
|
|
65
69
|
const { startRun, stopRun, rerun } = runActions;
|
|
66
70
|
const { create, deleteDraft, publishDefinition, setActive, changeArchiveState, setPermission } =
|
|
67
71
|
createAutomationManagementActions({ state, client, mutation, captureView,
|
|
@@ -86,14 +90,16 @@ export function createAutomationsController({
|
|
|
86
90
|
state.stepEvidenceLoading = false;
|
|
87
91
|
state.stepEvidenceError = "";
|
|
88
92
|
if (automationChanged) {
|
|
93
|
+
state.lastViewedRunId = "";
|
|
89
94
|
state.draft = null;
|
|
90
95
|
state.publishedDefinition = null;
|
|
91
96
|
state.grant = null;
|
|
92
97
|
state.validation = null;
|
|
93
98
|
state.validationVisible = false;
|
|
94
99
|
state.catalog = null;
|
|
95
|
-
|
|
100
|
+
runHistory.resetScope();
|
|
96
101
|
}
|
|
102
|
+
if (runId) state.lastViewedRunId = runId;
|
|
97
103
|
navigationRevision += 1;
|
|
98
104
|
onNavigationChange();
|
|
99
105
|
}
|
|
@@ -123,19 +129,23 @@ export function createAutomationsController({
|
|
|
123
129
|
}
|
|
124
130
|
}
|
|
125
131
|
|
|
126
|
-
async function loadSelected(automationId, runId = "", isCurrent = () => true) {
|
|
132
|
+
async function loadSelected(automationId, runId = "", isCurrent = () => true, refreshRuns = false) {
|
|
127
133
|
if (!isCurrent()) return false;
|
|
128
134
|
const environmentId = getEnvironmentId();
|
|
129
135
|
const revision = ++readRevision;
|
|
136
|
+
const historyRead = runHistory.captureRead({ refresh: refreshRuns });
|
|
130
137
|
state.loading = true;
|
|
131
138
|
state.error = "";
|
|
132
139
|
publish();
|
|
133
140
|
try {
|
|
134
|
-
const projection = await readAutomationSelection(client, automationId, runId, environmentId
|
|
141
|
+
const projection = await readAutomationSelection(client, automationId, runId, environmentId,
|
|
142
|
+
{ runsQuery: historyRead.query });
|
|
135
143
|
if (!isCurrent()) return false;
|
|
136
144
|
if (revision !== readRevision || !currentEnvironment(environmentId)) return false;
|
|
137
145
|
if (state.selectedAutomationId !== automationId) return false;
|
|
138
|
-
|
|
146
|
+
const { runs, runsNextCursor, ...selection } = projection;
|
|
147
|
+
Object.assign(state, selection);
|
|
148
|
+
historyRead.accept({ runs, runsNextCursor });
|
|
139
149
|
const selectedNodeId = selectedAutomationRunStepId(state.run, state.selectedNodeId);
|
|
140
150
|
const initialStepSelected = selectedNodeId !== state.selectedNodeId;
|
|
141
151
|
state.selectedNodeId = selectedNodeId;
|
|
@@ -181,7 +191,7 @@ export function createAutomationsController({
|
|
|
181
191
|
const loadedList = await loadList(isCurrent);
|
|
182
192
|
if (!loadedList || !isCurrent()) return false;
|
|
183
193
|
if (!selected) return true;
|
|
184
|
-
const selectedLoaded = await loadSelected(selected, runId, isCurrent);
|
|
194
|
+
const selectedLoaded = await loadSelected(selected, runId, isCurrent, true);
|
|
185
195
|
if (!selectedLoaded || !isCurrent()) return false;
|
|
186
196
|
if (selectedLoaded && runId && state.selectedNodeId)
|
|
187
197
|
await loadStepEvidence(runId, state.selectedNodeId, stepEvidenceFull, isCurrent);
|
|
@@ -193,24 +203,29 @@ export function createAutomationsController({
|
|
|
193
203
|
state.mutation || isEditingDirty()) return false;
|
|
194
204
|
if (!currentEnvironment(identity.environmentId) || identity.readRevision !== readRevision ||
|
|
195
205
|
identity.navigationRevision !== navigationRevision || identity.mutationRevision !== mutationRevision ||
|
|
196
|
-
identity.evidenceRevision !== evidenceReadRevision
|
|
206
|
+
identity.evidenceRevision !== evidenceReadRevision ||
|
|
207
|
+
identity.historyRevision !== runHistory.revision()) return false;
|
|
197
208
|
return state.selectedAutomationId === identity.automationId &&
|
|
198
209
|
state.selectedRunId === identity.runId && state.selectedNodeId === identity.nodeId;
|
|
199
210
|
}
|
|
200
211
|
|
|
201
212
|
async function backgroundRefresh() {
|
|
213
|
+
const historyRead = runHistory.captureRead({ refresh: true });
|
|
202
214
|
const identity = {
|
|
203
215
|
environmentId: getEnvironmentId(), automationId: state.selectedAutomationId,
|
|
204
216
|
runId: state.selectedRunId, nodeId: state.selectedNodeId,
|
|
205
217
|
readRevision, navigationRevision, mutationRevision,
|
|
206
218
|
evidenceRevision: evidenceReadRevision, full: stepEvidenceFull,
|
|
219
|
+
runsQuery: historyRead.query, historyRevision: runHistory.revision(),
|
|
207
220
|
};
|
|
208
221
|
if (!backgroundIdentityMatches(identity)) return false;
|
|
209
222
|
try {
|
|
210
223
|
const projection = await readAutomationBackgroundProjection(client, identity);
|
|
211
224
|
if (!backgroundIdentityMatches(identity)) return false;
|
|
212
225
|
if (!automationProjectionChanged(state, projection)) return true;
|
|
213
|
-
|
|
226
|
+
const { runs, runsNextCursor, ...selection } = projection;
|
|
227
|
+
Object.assign(state, selection);
|
|
228
|
+
historyRead.accept({ runs, runsNextCursor });
|
|
214
229
|
publish();
|
|
215
230
|
return true;
|
|
216
231
|
} catch {
|
|
@@ -339,9 +354,10 @@ export function createAutomationsController({
|
|
|
339
354
|
draftActions.clearUndo();
|
|
340
355
|
readRevision += 1;
|
|
341
356
|
loaded = false;
|
|
357
|
+
runHistory.resetScope();
|
|
342
358
|
stepEvidenceFull = false;
|
|
343
359
|
Object.assign(state, {
|
|
344
|
-
automations: [], selectedAutomationId: "", selectedRunId: "", selectedNodeId: "",
|
|
360
|
+
automations: [], selectedAutomationId: "", selectedRunId: "", selectedNodeId: "", lastViewedRunId: "",
|
|
345
361
|
draft: null, publishedDefinition: null, grant: null, validation: null, validationVisible: false,
|
|
346
362
|
catalog: null, templateCatalog: null, templateCatalogError: "", runs: [], run: null,
|
|
347
363
|
loading: false, error: "", feedback: "",
|
|
@@ -369,7 +385,7 @@ export function createAutomationsController({
|
|
|
369
385
|
createTemplate: (templateId) => create(templateId), deleteDraft, mutateDraft, saveDefinition,
|
|
370
386
|
saveNode, saveAgent, validate, publishDefinition, setActive, undoDraftMove, restorePublishedDraft,
|
|
371
387
|
archive: () => changeArchiveState(true), restore: () => changeArchiveState(false),
|
|
372
|
-
setPermission, openRun,
|
|
388
|
+
setPermission, openRun, setRunFilters, loadMoreRuns, resetRunHistory, retryRunHistory,
|
|
373
389
|
startRun, stopRun, rerun, environmentChanged, setWorkspaceActive, handleRealtime,
|
|
374
390
|
showFullStepOutput() {
|
|
375
391
|
if (!state.selectedRunId || !state.selectedNodeId) return false;
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { environmentChangeWasDeclined } from "./environment-transition.js";
|
|
2
2
|
|
|
3
|
-
/** Discard
|
|
4
|
-
export function prepareEnvironmentWorkspaceChanges(schedules, configuration) {
|
|
3
|
+
/** Discard workspace drafts only after every preparation remains current. */
|
|
4
|
+
export function prepareEnvironmentWorkspaceChanges(schedules, configuration, skills) {
|
|
5
5
|
const schedule = schedules.prepareEnvironmentChange();
|
|
6
6
|
if (environmentChangeWasDeclined(schedule)) return null;
|
|
7
7
|
const config = configuration.prepareDiscardChanges("change environment");
|
|
8
8
|
if (environmentChangeWasDeclined(config)) return null;
|
|
9
|
+
const skill = skills ? skills.prepareEnvironmentChange() : true;
|
|
10
|
+
if (environmentChangeWasDeclined(skill)) return null;
|
|
9
11
|
const commit = () => {
|
|
12
|
+
if (typeof skill === "function") skill();
|
|
10
13
|
if (typeof schedule === "function") schedule();
|
|
11
14
|
if (typeof config === "function") config();
|
|
12
15
|
};
|
|
13
16
|
commit.canCommit = () => {
|
|
17
|
+
if (skill?.canCommit?.() === false) return false;
|
|
14
18
|
if (schedule?.canCommit?.() === false) return false;
|
|
15
19
|
return config?.canCommit?.() !== false;
|
|
16
20
|
};
|
|
@@ -16,6 +16,14 @@ import { normalizeRealtimeMessage } from "../lib/realtime-message.js";
|
|
|
16
16
|
import { reduceTaskProgress } from "../lib/task-progress.js";
|
|
17
17
|
import { projectWebSourceEvent } from "../lib/web-source-event.js";
|
|
18
18
|
import { projectToolActivityEvent } from "../lib/tool-activity-event.js";
|
|
19
|
+
import {
|
|
20
|
+
hasRecordedRoleDelegation,
|
|
21
|
+
projectRoleDelegationEvent,
|
|
22
|
+
} from "../lib/role-delegation-event.js";
|
|
23
|
+
import {
|
|
24
|
+
hasRecordedRoleReturn,
|
|
25
|
+
projectRoleReturnEvent,
|
|
26
|
+
} from "../lib/role-return-event.js";
|
|
19
27
|
import {
|
|
20
28
|
contextEvidenceScope,
|
|
21
29
|
contextEvidenceOrder,
|
|
@@ -47,10 +55,14 @@ function canMergeUnsequencedActivity(
|
|
|
47
55
|
eventSequence,
|
|
48
56
|
webSources,
|
|
49
57
|
toolActivity,
|
|
58
|
+
roleDelegation,
|
|
59
|
+
roleReturn,
|
|
50
60
|
) {
|
|
51
61
|
if (eventSequence !== undefined) return false;
|
|
52
62
|
if (webSources || previous?.webSources) return false;
|
|
53
63
|
if (toolActivity || previous?.toolActivity) return false;
|
|
64
|
+
if (roleDelegation || previous?.roleDelegation) return false;
|
|
65
|
+
if (roleReturn || previous?.roleReturn) return false;
|
|
54
66
|
if (!previous?.key || previous.key !== key) return false;
|
|
55
67
|
return !hasOriginalEventSequence(previous.eventSequence);
|
|
56
68
|
}
|
|
@@ -158,7 +170,12 @@ export function createRealtimeEventController({
|
|
|
158
170
|
renderContextWindow();
|
|
159
171
|
renderActivityStatus();
|
|
160
172
|
}
|
|
161
|
-
|
|
173
|
+
const roleDelegation = projectRoleDelegationEvent(message);
|
|
174
|
+
const roleReturn = projectRoleReturnEvent(message);
|
|
175
|
+
let alreadyRecorded = hasRecordedOriginalEvent(state.events, requestId, eventSequence);
|
|
176
|
+
if (roleDelegation) alreadyRecorded = hasRecordedRoleDelegation(state.events, roleDelegation);
|
|
177
|
+
if (roleReturn) alreadyRecorded = hasRecordedRoleReturn(state.events, roleReturn);
|
|
178
|
+
if (alreadyRecorded) {
|
|
162
179
|
trackSeq(message);
|
|
163
180
|
return;
|
|
164
181
|
}
|
|
@@ -188,6 +205,8 @@ export function createRealtimeEventController({
|
|
|
188
205
|
eventSequence,
|
|
189
206
|
webSources,
|
|
190
207
|
toolActivity,
|
|
208
|
+
roleDelegation,
|
|
209
|
+
roleReturn,
|
|
191
210
|
)
|
|
192
211
|
) {
|
|
193
212
|
lastEvent.count = (lastEvent.count || 1) + 1;
|
|
@@ -224,6 +243,8 @@ export function createRealtimeEventController({
|
|
|
224
243
|
),
|
|
225
244
|
...(webSources ? { webSources } : {}),
|
|
226
245
|
...(toolActivity ? { toolActivity } : {}),
|
|
246
|
+
...(roleDelegation ? { roleDelegation } : {}),
|
|
247
|
+
...(roleReturn ? { roleReturn } : {}),
|
|
227
248
|
payload: {
|
|
228
249
|
plan: message.plan,
|
|
229
250
|
item: message.item,
|
|
@@ -157,7 +157,13 @@ export function createRuntimeSelectionController({
|
|
|
157
157
|
renderAgentMode();
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
function hasModelCatalogFromAnotherEnvironment() {
|
|
161
|
+
if (modelCatalogEnvironmentId === null) return false;
|
|
162
|
+
return modelCatalogEnvironmentId !== selectedEnvironmentId();
|
|
163
|
+
}
|
|
164
|
+
|
|
160
165
|
function rememberModelSelection() {
|
|
166
|
+
if (hasModelCatalogFromAnotherEnvironment()) return;
|
|
161
167
|
const profileId = textOf(dom.modelSelect.value);
|
|
162
168
|
if (!profileId) return;
|
|
163
169
|
state.lastModelByEnvironment[selectedEnvironmentId()] = profileId;
|
|
@@ -176,7 +182,7 @@ export function createRuntimeSelectionController({
|
|
|
176
182
|
|
|
177
183
|
const { renderAgentMode, loadAgentMode, setAgentMode } = createReasoningModeController({
|
|
178
184
|
state, dom, client, selectedEnvironmentId,
|
|
179
|
-
selectedModelProfile: () =>
|
|
185
|
+
selectedModelProfile: () => hasModelCatalogFromAnotherEnvironment() ? null : selectedModelProfile(),
|
|
180
186
|
reloadModels: onReasoningConfigurationApplied || loadModels, recordControlEvent,
|
|
181
187
|
});
|
|
182
188
|
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/** Owns personal Skill drafts and environment-bound reads/mutations. */
|
|
2
|
+
export function createSkillsController({ client, getEnvironmentId, render,
|
|
3
|
+
confirmDiscard = (message) => window.confirm(message) }) {
|
|
4
|
+
const state = { items: [], skill: null, draft: "", archived: false, creating: false, name: "", description: "",
|
|
5
|
+
loading: false, reading: false, mutation: "", error: "", message: "" };
|
|
6
|
+
let epoch = 0;
|
|
7
|
+
let listRead = 0;
|
|
8
|
+
let detailRead = 0;
|
|
9
|
+
let draftRevision = 0;
|
|
10
|
+
let active = false;
|
|
11
|
+
const snapshot = () => ({ ...state, items: [...state.items], dirty: isDirty() });
|
|
12
|
+
const publish = () => render(snapshot());
|
|
13
|
+
function isDirty() {
|
|
14
|
+
if (state.creating) return Boolean(state.name || state.description || state.draft);
|
|
15
|
+
return Boolean(state.skill && state.draft !== state.skill.content);
|
|
16
|
+
}
|
|
17
|
+
const capture = () => ({ epoch, environmentId: getEnvironmentId() });
|
|
18
|
+
function isCurrent(scope) {
|
|
19
|
+
if (scope.epoch !== epoch) return false;
|
|
20
|
+
return scope.environmentId === getEnvironmentId();
|
|
21
|
+
}
|
|
22
|
+
function clearEditor() {
|
|
23
|
+
detailRead += 1;
|
|
24
|
+
draftRevision += 1;
|
|
25
|
+
state.skill = null;
|
|
26
|
+
state.creating = false;
|
|
27
|
+
state.name = "";
|
|
28
|
+
state.description = "";
|
|
29
|
+
state.draft = "";
|
|
30
|
+
state.reading = false;
|
|
31
|
+
}
|
|
32
|
+
function canEdit() {
|
|
33
|
+
if (state.mutation || state.reading) return false;
|
|
34
|
+
if (state.creating) return true;
|
|
35
|
+
if (!state.skill || state.skill.archived) return false;
|
|
36
|
+
return state.skill.source === "personal";
|
|
37
|
+
}
|
|
38
|
+
function prepareLeave() {
|
|
39
|
+
if (state.mutation) return false;
|
|
40
|
+
if (!isDirty()) return true;
|
|
41
|
+
if (!confirmDiscard("Discard unsaved Skill changes?")) return false;
|
|
42
|
+
const revision = draftRevision;
|
|
43
|
+
const scope = capture();
|
|
44
|
+
const commit = () => {
|
|
45
|
+
if (!commit.canCommit()) return;
|
|
46
|
+
if (state.creating) clearEditor();
|
|
47
|
+
else { state.draft = state.skill.content; draftRevision += 1; }
|
|
48
|
+
publish();
|
|
49
|
+
};
|
|
50
|
+
commit.canCommit = () => isCurrent(scope) && revision === draftRevision;
|
|
51
|
+
return commit;
|
|
52
|
+
}
|
|
53
|
+
function acceptLeave() {
|
|
54
|
+
const prepared = prepareLeave();
|
|
55
|
+
if (prepared === false) return false;
|
|
56
|
+
if (typeof prepared === "function") prepared();
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
async function refresh() {
|
|
60
|
+
if (!client.supportsSkills()) return;
|
|
61
|
+
const scope = capture();
|
|
62
|
+
const read = ++listRead;
|
|
63
|
+
state.loading = true;
|
|
64
|
+
publish();
|
|
65
|
+
try {
|
|
66
|
+
const result = await client.listPersonalSkills(scope.environmentId);
|
|
67
|
+
if (!isCurrent(scope) || read !== listRead) return;
|
|
68
|
+
state.items = result.items.filter((item) => item.source === "personal");
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (!isCurrent(scope) || read !== listRead) return;
|
|
71
|
+
state.error = error.message || String(error);
|
|
72
|
+
} finally {
|
|
73
|
+
if (isCurrent(scope) && read === listRead) { state.loading = false; publish(); }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function select(skillId) {
|
|
77
|
+
if (state.skill?.skillId === skillId) return true;
|
|
78
|
+
if (!acceptLeave()) return false;
|
|
79
|
+
if (!state.items.some((item) => item.skillId === skillId)) return false;
|
|
80
|
+
return loadSkill(skillId);
|
|
81
|
+
}
|
|
82
|
+
async function loadSkill(skillId) {
|
|
83
|
+
const scope = capture();
|
|
84
|
+
clearEditor();
|
|
85
|
+
const read = detailRead;
|
|
86
|
+
state.error = "";
|
|
87
|
+
state.message = "";
|
|
88
|
+
state.reading = true;
|
|
89
|
+
publish();
|
|
90
|
+
try {
|
|
91
|
+
const { skill } = await client.readPersonalSkill(skillId, scope.environmentId);
|
|
92
|
+
if (!isCurrent(scope) || read !== detailRead) return false;
|
|
93
|
+
if (skill.source !== "personal" || skill.skillId !== skillId) throw new Error("This personal Skill is unavailable.");
|
|
94
|
+
state.skill = skill;
|
|
95
|
+
state.draft = skill.content;
|
|
96
|
+
draftRevision += 1;
|
|
97
|
+
return true;
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (isCurrent(scope) && read === detailRead) state.error = error.message || String(error);
|
|
100
|
+
return false;
|
|
101
|
+
} finally {
|
|
102
|
+
if (isCurrent(scope) && read === detailRead) { state.reading = false; publish(); }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function setDraft(content) {
|
|
106
|
+
if (!canEdit()) return;
|
|
107
|
+
state.draft = content;
|
|
108
|
+
draftRevision += 1;
|
|
109
|
+
state.message = "";
|
|
110
|
+
publish();
|
|
111
|
+
}
|
|
112
|
+
function beginCreate() {
|
|
113
|
+
if (!acceptLeave()) return false;
|
|
114
|
+
clearEditor();
|
|
115
|
+
Object.assign(state, { creating: true, archived: false, error: "", message: "" });
|
|
116
|
+
publish();
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
function setCreationField(field, value) {
|
|
120
|
+
if (!state.creating || !canEdit()) return;
|
|
121
|
+
if (field !== "name" && field !== "description") return;
|
|
122
|
+
state[field] = value;
|
|
123
|
+
draftRevision += 1;
|
|
124
|
+
state.message = "";
|
|
125
|
+
publish();
|
|
126
|
+
}
|
|
127
|
+
function cancelCreate() {
|
|
128
|
+
if (!state.creating || !acceptLeave()) return false;
|
|
129
|
+
clearEditor();
|
|
130
|
+
state.error = "";
|
|
131
|
+
publish();
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
function creationValidationMessage() {
|
|
135
|
+
if (!state.name.trim() || state.name.length > 160) return "Enter a name of up to 160 characters.";
|
|
136
|
+
if (!state.description.trim() || state.description.length > 512) return "Enter a description of up to 512 characters.";
|
|
137
|
+
if (!state.draft.trim()) return "Enter the Skill content.";
|
|
138
|
+
if (new TextEncoder().encode(state.draft).length > 65_536) return "Skill content must be no larger than 64 KiB.";
|
|
139
|
+
return "";
|
|
140
|
+
}
|
|
141
|
+
async function create() {
|
|
142
|
+
if (!state.creating || !canEdit()) return false;
|
|
143
|
+
state.error = creationValidationMessage();
|
|
144
|
+
if (state.error) { publish(); return false; }
|
|
145
|
+
const scope = capture();
|
|
146
|
+
const input = { name: state.name, description: state.description, content: state.draft };
|
|
147
|
+
state.mutation = "create";
|
|
148
|
+
state.message = "";
|
|
149
|
+
publish();
|
|
150
|
+
try {
|
|
151
|
+
const { skill } = await client.createPersonalSkill(input, scope.environmentId);
|
|
152
|
+
if (!isCurrent(scope)) return false;
|
|
153
|
+
clearEditor();
|
|
154
|
+
Object.assign(state, { skill, draft: skill.content, archived: false, message: "Skill created." });
|
|
155
|
+
state.items = [...state.items.filter((item) => item.skillId !== skill.skillId), skill];
|
|
156
|
+
await refresh();
|
|
157
|
+
return true;
|
|
158
|
+
} catch (error) {
|
|
159
|
+
if (!isCurrent(scope)) return false;
|
|
160
|
+
state.error = error.message || String(error);
|
|
161
|
+
return false;
|
|
162
|
+
} finally {
|
|
163
|
+
if (isCurrent(scope)) { state.mutation = ""; publish(); }
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function setArchived(archived) {
|
|
167
|
+
if (state.archived === archived) return true;
|
|
168
|
+
if (!acceptLeave()) return false;
|
|
169
|
+
state.archived = archived;
|
|
170
|
+
state.error = "";
|
|
171
|
+
state.message = "";
|
|
172
|
+
clearEditor();
|
|
173
|
+
publish();
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
async function reloadSelected() {
|
|
177
|
+
if (!state.skill || !acceptLeave()) return false;
|
|
178
|
+
return loadSkill(state.skill.skillId);
|
|
179
|
+
}
|
|
180
|
+
async function mutate(action) {
|
|
181
|
+
const skill = state.skill;
|
|
182
|
+
if (!skill || skill.source !== "personal" || state.mutation || state.reading) return false;
|
|
183
|
+
if (action === "save" && (!canEdit() || !isDirty() || !state.draft.trim())) return false;
|
|
184
|
+
if (action === "archive" && skill.archived) return false;
|
|
185
|
+
if (action === "restore" && !skill.archived) return false;
|
|
186
|
+
const scope = capture();
|
|
187
|
+
const content = state.draft;
|
|
188
|
+
state.mutation = action;
|
|
189
|
+
state.error = "";
|
|
190
|
+
state.message = "";
|
|
191
|
+
publish();
|
|
192
|
+
try {
|
|
193
|
+
const mutations = {
|
|
194
|
+
save: () => client.updatePersonalSkill(skill.skillId, content, skill.revision, scope.environmentId),
|
|
195
|
+
archive: () => client.archivePersonalSkill(skill.skillId, skill.revision, scope.environmentId),
|
|
196
|
+
restore: () => client.restorePersonalSkill(skill.skillId, skill.revision, scope.environmentId),
|
|
197
|
+
};
|
|
198
|
+
const result = await mutations[action]();
|
|
199
|
+
if (!isCurrent(scope)) return false;
|
|
200
|
+
if (action === "save") {
|
|
201
|
+
state.skill = result.skill;
|
|
202
|
+
state.draft = result.skill.content;
|
|
203
|
+
draftRevision += 1;
|
|
204
|
+
} else {
|
|
205
|
+
clearEditor();
|
|
206
|
+
}
|
|
207
|
+
state.message = { save: "Skill saved.", archive: "Skill archived.", restore: "Skill restored." }[action];
|
|
208
|
+
await refresh();
|
|
209
|
+
return true;
|
|
210
|
+
} catch (error) {
|
|
211
|
+
if (!isCurrent(scope)) return false;
|
|
212
|
+
state.error = error.code === "knowledge_skill_revision_conflict"
|
|
213
|
+
? "This Skill changed elsewhere. Your draft is kept. Copy it before reloading the latest version."
|
|
214
|
+
: error.message || String(error);
|
|
215
|
+
return false;
|
|
216
|
+
} finally {
|
|
217
|
+
if (isCurrent(scope)) { state.mutation = ""; publish(); }
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function environmentChanged() {
|
|
221
|
+
epoch += 1;
|
|
222
|
+
listRead += 1;
|
|
223
|
+
clearEditor();
|
|
224
|
+
Object.assign(state, { items: [], archived: false, loading: false, mutation: "", error: "", message: "" });
|
|
225
|
+
publish();
|
|
226
|
+
if (active) void refresh();
|
|
227
|
+
}
|
|
228
|
+
function setActive(value) {
|
|
229
|
+
const entering = value && !active;
|
|
230
|
+
active = value;
|
|
231
|
+
if (entering) void refresh();
|
|
232
|
+
}
|
|
233
|
+
return { snapshot, refresh, select, setDraft, setArchived, reloadSelected, prepareLeave,
|
|
234
|
+
isDirty, environmentChanged, setActive, beginCreate, setCreationField, cancelCreate,
|
|
235
|
+
save: () => state.creating ? create() : mutate("save"),
|
|
236
|
+
archive: () => mutate("archive"), restore: () => mutate("restore") };
|
|
237
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ConversationToolAction } from "./tool-activity-model.js";
|
|
2
|
+
import type { RoleDelegation } from "./role-delegation-event.js";
|
|
3
|
+
import type { RoleReturn } from "./role-return-event.js";
|
|
2
4
|
|
|
3
5
|
export type ConversationRole =
|
|
4
6
|
| "supervisor"
|
|
@@ -17,6 +19,9 @@ export interface ConversationRoleCard {
|
|
|
17
19
|
summary: string;
|
|
18
20
|
facts: string[];
|
|
19
21
|
toolActions?: ConversationToolAction[];
|
|
22
|
+
skillActivities?: { summary: string; tone: string }[];
|
|
23
|
+
delegations?: RoleDelegation[];
|
|
24
|
+
returns?: RoleReturn[];
|
|
20
25
|
active: boolean;
|
|
21
26
|
tone: "active" | "failed" | "recorded";
|
|
22
27
|
}
|