@assemblyline-agents/runtime 1.0.0 → 3.0.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/LICENSE +1 -1
- package/dist/a2a-client.d.ts +22 -0
- package/dist/a2a-client.d.ts.map +1 -0
- package/dist/a2a-client.js +211 -0
- package/dist/a2a-client.js.map +1 -0
- package/dist/agent-capability-snapshot.d.ts +32 -0
- package/dist/agent-capability-snapshot.d.ts.map +1 -0
- package/dist/agent-capability-snapshot.js +77 -0
- package/dist/agent-capability-snapshot.js.map +1 -0
- package/dist/agent-event-handlers.d.ts +21 -0
- package/dist/agent-event-handlers.d.ts.map +1 -0
- package/dist/agent-event-handlers.js +64 -0
- package/dist/agent-event-handlers.js.map +1 -0
- package/dist/agent-hook-context.d.ts +8 -0
- package/dist/agent-hook-context.d.ts.map +1 -0
- package/dist/agent-hook-context.js +29 -0
- package/dist/agent-hook-context.js.map +1 -0
- package/dist/agent-hook-evaluation.d.ts +61 -0
- package/dist/agent-hook-evaluation.d.ts.map +1 -0
- package/dist/agent-hook-evaluation.js +197 -0
- package/dist/agent-hook-evaluation.js.map +1 -0
- package/dist/agent-hook-run-lifecycle.d.ts +44 -0
- package/dist/agent-hook-run-lifecycle.d.ts.map +1 -0
- package/dist/agent-hook-run-lifecycle.js +76 -0
- package/dist/agent-hook-run-lifecycle.js.map +1 -0
- package/dist/agent-state.d.ts +31 -0
- package/dist/agent-state.d.ts.map +1 -0
- package/dist/agent-state.js +80 -0
- package/dist/agent-state.js.map +1 -0
- package/dist/agent-surface.d.ts +32 -0
- package/dist/agent-surface.d.ts.map +1 -0
- package/dist/agent-surface.js +85 -0
- package/dist/agent-surface.js.map +1 -0
- package/dist/attachments.d.ts +5 -1
- package/dist/attachments.d.ts.map +1 -1
- package/dist/attachments.js +58 -32
- package/dist/attachments.js.map +1 -1
- package/dist/audience.d.ts +30 -0
- package/dist/audience.d.ts.map +1 -0
- package/dist/audience.js +68 -0
- package/dist/audience.js.map +1 -0
- package/dist/authored-hooks.d.ts +6 -0
- package/dist/authored-hooks.d.ts.map +1 -0
- package/dist/authored-hooks.js +17 -0
- package/dist/authored-hooks.js.map +1 -0
- package/dist/automation-event-match.d.ts +8 -0
- package/dist/automation-event-match.d.ts.map +1 -0
- package/dist/automation-event-match.js +25 -0
- package/dist/automation-event-match.js.map +1 -0
- package/dist/background-review-trigger.d.ts +9 -0
- package/dist/background-review-trigger.d.ts.map +1 -0
- package/dist/background-review-trigger.js +72 -0
- package/dist/background-review-trigger.js.map +1 -0
- package/dist/background-review-types.d.ts +60 -0
- package/dist/background-review-types.d.ts.map +1 -0
- package/dist/background-review-types.js +2 -0
- package/dist/background-review-types.js.map +1 -0
- package/dist/background-review-worker.d.ts +14 -0
- package/dist/background-review-worker.d.ts.map +1 -0
- package/dist/background-review-worker.js +61 -0
- package/dist/background-review-worker.js.map +1 -0
- package/dist/background-review.d.ts +5 -0
- package/dist/background-review.d.ts.map +1 -0
- package/dist/background-review.js +332 -0
- package/dist/background-review.js.map +1 -0
- package/dist/builtin-tool-executors.d.ts +50 -27
- package/dist/builtin-tool-executors.d.ts.map +1 -1
- package/dist/builtin-tool-executors.js +332 -124
- package/dist/builtin-tool-executors.js.map +1 -1
- package/dist/builtin-tools.d.ts +16 -9
- package/dist/builtin-tools.d.ts.map +1 -1
- package/dist/builtin-tools.js +308 -116
- package/dist/builtin-tools.js.map +1 -1
- package/dist/capability-catalog.d.ts +3 -2
- package/dist/capability-catalog.d.ts.map +1 -1
- package/dist/capability-catalog.js +12 -7
- package/dist/capability-catalog.js.map +1 -1
- package/dist/capability-inspection.d.ts +31 -0
- package/dist/capability-inspection.d.ts.map +1 -0
- package/dist/capability-inspection.js +58 -0
- package/dist/capability-inspection.js.map +1 -0
- package/dist/channel-http-util.d.ts.map +1 -1
- package/dist/channel-http-util.js +6 -5
- package/dist/channel-http-util.js.map +1 -1
- package/dist/channel-ingress.d.ts +16 -1
- package/dist/channel-ingress.d.ts.map +1 -1
- package/dist/channel-ingress.js +152 -14
- package/dist/channel-ingress.js.map +1 -1
- package/dist/channel.d.ts +73 -3
- package/dist/channel.d.ts.map +1 -1
- package/dist/checkpoints.d.ts +1 -1
- package/dist/checkpoints.d.ts.map +1 -1
- package/dist/checkpoints.js +6 -6
- package/dist/checkpoints.js.map +1 -1
- package/dist/child-process-env.d.ts +7 -0
- package/dist/child-process-env.d.ts.map +1 -0
- package/dist/child-process-env.js +41 -0
- package/dist/child-process-env.js.map +1 -0
- package/dist/computer-relay-protocol.d.ts.map +1 -1
- package/dist/computer-relay-protocol.js +4 -4
- package/dist/computer-relay-protocol.js.map +1 -1
- package/dist/concurrency.d.ts +1 -1
- package/dist/concurrency.js +1 -1
- package/dist/connection-auth-util.d.ts +1 -0
- package/dist/connection-auth-util.d.ts.map +1 -1
- package/dist/connection-auth-util.js +3 -1
- package/dist/connection-auth-util.js.map +1 -1
- package/dist/connection-clients.d.ts +11 -3
- package/dist/connection-clients.d.ts.map +1 -1
- package/dist/connection-clients.js +71 -8
- package/dist/connection-clients.js.map +1 -1
- package/dist/connection-event-store.d.ts +98 -0
- package/dist/connection-event-store.d.ts.map +1 -0
- package/dist/connection-event-store.js +162 -0
- package/dist/connection-event-store.js.map +1 -0
- package/dist/connection-events.d.ts +51 -0
- package/dist/connection-events.d.ts.map +1 -0
- package/dist/connection-events.js +343 -0
- package/dist/connection-events.js.map +1 -0
- package/dist/connection-stores.d.ts +6 -0
- package/dist/connection-stores.d.ts.map +1 -1
- package/dist/connection-stores.js +20 -1
- package/dist/connection-stores.js.map +1 -1
- package/dist/connection-util.d.ts +3 -2
- package/dist/connection-util.d.ts.map +1 -1
- package/dist/connection-util.js +18 -1
- package/dist/connection-util.js.map +1 -1
- package/dist/connections.d.ts +60 -5
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +390 -57
- package/dist/connections.js.map +1 -1
- package/dist/context-policy-util.d.ts.map +1 -1
- package/dist/context-policy-util.js +1 -3
- package/dist/context-policy-util.js.map +1 -1
- package/dist/conversation-context.d.ts +9 -4
- package/dist/conversation-context.d.ts.map +1 -1
- package/dist/conversation-context.js +65 -19
- package/dist/conversation-context.js.map +1 -1
- package/dist/conversation-transcript.d.ts +8 -5
- package/dist/conversation-transcript.d.ts.map +1 -1
- package/dist/conversation-transcript.js +24 -5
- package/dist/conversation-transcript.js.map +1 -1
- package/dist/conversation-turn-coalescing.d.ts +22 -0
- package/dist/conversation-turn-coalescing.d.ts.map +1 -0
- package/dist/conversation-turn-coalescing.js +121 -0
- package/dist/conversation-turn-coalescing.js.map +1 -0
- package/dist/conversation-turn-dispatch.d.ts +5 -2
- package/dist/conversation-turn-dispatch.d.ts.map +1 -1
- package/dist/conversation-turn-dispatch.js +59 -22
- package/dist/conversation-turn-dispatch.js.map +1 -1
- package/dist/default-outbound-route.d.ts +29 -0
- package/dist/default-outbound-route.d.ts.map +1 -0
- package/dist/default-outbound-route.js +105 -0
- package/dist/default-outbound-route.js.map +1 -0
- package/dist/delivery-artifacts.d.ts +2 -0
- package/dist/delivery-artifacts.d.ts.map +1 -0
- package/dist/delivery-artifacts.js +34 -0
- package/dist/delivery-artifacts.js.map +1 -0
- package/dist/delivery-files.d.ts +5 -0
- package/dist/delivery-files.d.ts.map +1 -0
- package/dist/delivery-files.js +33 -0
- package/dist/delivery-files.js.map +1 -0
- package/dist/delivery-queue.d.ts +21 -1
- package/dist/delivery-queue.d.ts.map +1 -1
- package/dist/delivery-queue.js +144 -1
- package/dist/delivery-queue.js.map +1 -1
- package/dist/delivery-send.d.ts +2 -2
- package/dist/delivery-send.d.ts.map +1 -1
- package/dist/delivery-send.js +256 -100
- package/dist/delivery-send.js.map +1 -1
- package/dist/durable-files.d.ts +37 -0
- package/dist/durable-files.d.ts.map +1 -0
- package/dist/durable-files.js +63 -0
- package/dist/durable-files.js.map +1 -0
- package/dist/harness-loop.d.ts +18 -9
- package/dist/harness-loop.d.ts.map +1 -1
- package/dist/harness-loop.js +245 -50
- package/dist/harness-loop.js.map +1 -1
- package/dist/heic-transcode-worker.d.ts +2 -0
- package/dist/heic-transcode-worker.d.ts.map +1 -0
- package/dist/heic-transcode-worker.js +59 -0
- package/dist/heic-transcode-worker.js.map +1 -0
- package/dist/heic-transcode.d.ts +18 -0
- package/dist/heic-transcode.d.ts.map +1 -0
- package/dist/heic-transcode.js +99 -0
- package/dist/heic-transcode.js.map +1 -0
- package/dist/human-input-routing.d.ts +22 -0
- package/dist/human-input-routing.d.ts.map +1 -0
- package/dist/human-input-routing.js +26 -0
- package/dist/human-input-routing.js.map +1 -0
- package/dist/in-memory-agent-state-store.d.ts +21 -0
- package/dist/in-memory-agent-state-store.d.ts.map +1 -0
- package/dist/in-memory-agent-state-store.js +97 -0
- package/dist/in-memory-agent-state-store.js.map +1 -0
- package/dist/in-memory-conversation-turn-store.d.ts +3 -1
- package/dist/in-memory-conversation-turn-store.d.ts.map +1 -1
- package/dist/in-memory-conversation-turn-store.js +41 -2
- package/dist/in-memory-conversation-turn-store.js.map +1 -1
- package/dist/in-memory-run-store.d.ts +8 -0
- package/dist/in-memory-run-store.d.ts.map +1 -1
- package/dist/in-memory-run-store.js +28 -5
- package/dist/in-memory-run-store.js.map +1 -1
- package/dist/in-memory-sandbox-session-store.d.ts +2 -1
- package/dist/in-memory-sandbox-session-store.d.ts.map +1 -1
- package/dist/in-memory-sandbox-session-store.js +65 -1
- package/dist/in-memory-sandbox-session-store.js.map +1 -1
- package/dist/in-memory-small-stores.d.ts +18 -1
- package/dist/in-memory-small-stores.d.ts.map +1 -1
- package/dist/in-memory-small-stores.js +107 -1
- package/dist/in-memory-small-stores.js.map +1 -1
- package/dist/in-memory-workspace-store.d.ts +40 -0
- package/dist/in-memory-workspace-store.d.ts.map +1 -0
- package/dist/in-memory-workspace-store.js +370 -0
- package/dist/in-memory-workspace-store.js.map +1 -0
- package/dist/index.d.ts +116 -45
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +637 -566
- package/dist/index.js.map +1 -1
- package/dist/json-util.d.ts +8 -0
- package/dist/json-util.d.ts.map +1 -1
- package/dist/json-util.js +8 -0
- package/dist/json-util.js.map +1 -1
- package/dist/learning-store.d.ts +111 -0
- package/dist/learning-store.d.ts.map +1 -0
- package/dist/learning-store.js +193 -0
- package/dist/learning-store.js.map +1 -0
- package/dist/local-sandbox.d.ts +3 -2
- package/dist/local-sandbox.d.ts.map +1 -1
- package/dist/local-sandbox.js +69 -25
- package/dist/local-sandbox.js.map +1 -1
- package/dist/mcp-client.d.ts.map +1 -1
- package/dist/mcp-client.js +3 -2
- package/dist/mcp-client.js.map +1 -1
- package/dist/media-processor.d.ts +42 -0
- package/dist/media-processor.d.ts.map +1 -0
- package/dist/media-processor.js +2 -0
- package/dist/media-processor.js.map +1 -0
- package/dist/model-media.d.ts +13 -1
- package/dist/model-media.d.ts.map +1 -1
- package/dist/model-media.js +81 -18
- package/dist/model-media.js.map +1 -1
- package/dist/model-visible-interrupts.d.ts +10 -0
- package/dist/model-visible-interrupts.d.ts.map +1 -0
- package/dist/model-visible-interrupts.js +41 -0
- package/dist/model-visible-interrupts.js.map +1 -0
- package/dist/operator-controls.d.ts.map +1 -1
- package/dist/operator-controls.js +16 -3
- package/dist/operator-controls.js.map +1 -1
- package/dist/outbound-http-policy.d.ts +7 -0
- package/dist/outbound-http-policy.d.ts.map +1 -0
- package/dist/outbound-http-policy.js +155 -0
- package/dist/outbound-http-policy.js.map +1 -0
- package/dist/principals.d.ts +18 -0
- package/dist/principals.d.ts.map +1 -0
- package/dist/principals.js +90 -0
- package/dist/principals.js.map +1 -0
- package/dist/public-api.d.ts +21 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +19 -0
- package/dist/public-api.js.map +1 -0
- package/dist/replay-resume.d.ts +15 -3
- package/dist/replay-resume.d.ts.map +1 -1
- package/dist/replay-resume.js +256 -24
- package/dist/replay-resume.js.map +1 -1
- package/dist/resource-projection-util.d.ts +1 -1
- package/dist/resource-projection-util.d.ts.map +1 -1
- package/dist/resource-projection-util.js +21 -10
- package/dist/resource-projection-util.js.map +1 -1
- package/dist/resource-projection.d.ts +8 -1
- package/dist/resource-projection.d.ts.map +1 -1
- package/dist/resource-projection.js +230 -26
- package/dist/resource-projection.js.map +1 -1
- package/dist/run-heartbeat.d.ts +12 -2
- package/dist/run-heartbeat.d.ts.map +1 -1
- package/dist/run-heartbeat.js +31 -4
- package/dist/run-heartbeat.js.map +1 -1
- package/dist/run-outcome.d.ts +9 -5
- package/dist/run-outcome.d.ts.map +1 -1
- package/dist/run-outcome.js +16 -5
- package/dist/run-outcome.js.map +1 -1
- package/dist/run-recovery.d.ts +31 -2
- package/dist/run-recovery.d.ts.map +1 -1
- package/dist/run-recovery.js +211 -32
- package/dist/run-recovery.js.map +1 -1
- package/dist/run-replay.d.ts +35 -0
- package/dist/run-replay.d.ts.map +1 -0
- package/dist/run-replay.js +193 -0
- package/dist/run-replay.js.map +1 -0
- package/dist/run-result.d.ts +4 -0
- package/dist/run-result.d.ts.map +1 -0
- package/dist/run-result.js +18 -0
- package/dist/run-result.js.map +1 -0
- package/dist/run-timeline-query.d.ts +38 -0
- package/dist/run-timeline-query.d.ts.map +1 -0
- package/dist/run-timeline-query.js +99 -0
- package/dist/run-timeline-query.js.map +1 -0
- package/dist/runs-query.d.ts.map +1 -1
- package/dist/runs-query.js +12 -4
- package/dist/runs-query.js.map +1 -1
- package/dist/runtime-bundle.d.ts.map +1 -1
- package/dist/runtime-bundle.js +2 -0
- package/dist/runtime-bundle.js.map +1 -1
- package/dist/runtime-learning.d.ts +88 -0
- package/dist/runtime-learning.d.ts.map +1 -0
- package/dist/runtime-learning.js +260 -0
- package/dist/runtime-learning.js.map +1 -0
- package/dist/runtime-types.d.ts +79 -10
- package/dist/runtime-types.d.ts.map +1 -1
- package/dist/sandbox-fs.d.ts +9 -5
- package/dist/sandbox-fs.d.ts.map +1 -1
- package/dist/sandbox-fs.js +50 -33
- package/dist/sandbox-fs.js.map +1 -1
- package/dist/sandbox-handle.d.ts +25 -0
- package/dist/sandbox-handle.d.ts.map +1 -0
- package/dist/sandbox-handle.js +120 -0
- package/dist/sandbox-handle.js.map +1 -0
- package/dist/sandbox-session-identity.d.ts +14 -0
- package/dist/sandbox-session-identity.d.ts.map +1 -0
- package/dist/sandbox-session-identity.js +33 -0
- package/dist/sandbox-session-identity.js.map +1 -0
- package/dist/sandbox-session-key.d.ts.map +1 -1
- package/dist/sandbox-session-key.js +14 -10
- package/dist/sandbox-session-key.js.map +1 -1
- package/dist/sandbox-session-lifecycle.d.ts +12 -0
- package/dist/sandbox-session-lifecycle.d.ts.map +1 -0
- package/dist/sandbox-session-lifecycle.js +261 -0
- package/dist/sandbox-session-lifecycle.js.map +1 -0
- package/dist/sandbox-snapshot-policy.js +3 -3
- package/dist/sandbox-snapshot-policy.js.map +1 -1
- package/dist/sandbox-state-sync.d.ts +22 -0
- package/dist/sandbox-state-sync.d.ts.map +1 -0
- package/dist/sandbox-state-sync.js +147 -0
- package/dist/sandbox-state-sync.js.map +1 -0
- package/dist/sandbox-sync-worker.d.ts +11 -2
- package/dist/sandbox-sync-worker.d.ts.map +1 -1
- package/dist/sandbox-sync-worker.js +143 -31
- package/dist/sandbox-sync-worker.js.map +1 -1
- package/dist/schedule-execution.d.ts.map +1 -1
- package/dist/schedule-execution.js +187 -57
- package/dist/schedule-execution.js.map +1 -1
- package/dist/sdk-api-client.d.ts +17 -0
- package/dist/sdk-api-client.d.ts.map +1 -0
- package/dist/sdk-api-client.js +55 -0
- package/dist/sdk-api-client.js.map +1 -0
- package/dist/security.js +2 -2
- package/dist/security.js.map +1 -1
- package/dist/self-improvement.d.ts +34 -6
- package/dist/self-improvement.d.ts.map +1 -1
- package/dist/self-improvement.js +140 -34
- package/dist/self-improvement.js.map +1 -1
- package/dist/skill-bundles.d.ts +55 -0
- package/dist/skill-bundles.d.ts.map +1 -0
- package/dist/skill-bundles.js +134 -0
- package/dist/skill-bundles.js.map +1 -0
- package/dist/source-loader.d.ts +8 -0
- package/dist/source-loader.d.ts.map +1 -1
- package/dist/source-loader.js +41 -10
- package/dist/source-loader.js.map +1 -1
- package/dist/state-store-helpers.d.ts +2 -0
- package/dist/state-store-helpers.d.ts.map +1 -1
- package/dist/state-store-helpers.js +11 -1
- package/dist/state-store-helpers.js.map +1 -1
- package/dist/state-stores.d.ts +2 -0
- package/dist/state-stores.d.ts.map +1 -1
- package/dist/state-stores.js +40 -7
- package/dist/state-stores.js.map +1 -1
- package/dist/state.d.ts +344 -5
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +44 -2
- package/dist/state.js.map +1 -1
- package/dist/storage.d.ts +59 -2
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +183 -6
- package/dist/storage.js.map +1 -1
- package/dist/subagent-execution.d.ts +7 -6
- package/dist/subagent-execution.d.ts.map +1 -1
- package/dist/subagent-execution.js +58 -19
- package/dist/subagent-execution.js.map +1 -1
- package/dist/target-instructions.d.ts +14 -0
- package/dist/target-instructions.d.ts.map +1 -0
- package/dist/target-instructions.js +18 -0
- package/dist/target-instructions.js.map +1 -0
- package/dist/tool-apis.d.ts.map +1 -1
- package/dist/tool-apis.js +55 -10
- package/dist/tool-apis.js.map +1 -1
- package/dist/tool-execution.d.ts +26 -13
- package/dist/tool-execution.d.ts.map +1 -1
- package/dist/tool-execution.js +368 -239
- package/dist/tool-execution.js.map +1 -1
- package/dist/turn-media.d.ts +29 -0
- package/dist/turn-media.d.ts.map +1 -0
- package/dist/turn-media.js +233 -0
- package/dist/turn-media.js.map +1 -0
- package/dist/usage-reconciliation.d.ts +1 -1
- package/dist/usage-reconciliation.js +1 -1
- package/dist/workspace-id.d.ts +10 -0
- package/dist/workspace-id.d.ts.map +1 -0
- package/dist/workspace-id.js +55 -0
- package/dist/workspace-id.js.map +1 -0
- package/dist/workspace-manifest.d.ts +24 -0
- package/dist/workspace-manifest.d.ts.map +1 -0
- package/dist/workspace-manifest.js +111 -0
- package/dist/workspace-manifest.js.map +1 -0
- package/dist/workspace-operation-limiter.d.ts +16 -0
- package/dist/workspace-operation-limiter.d.ts.map +1 -0
- package/dist/workspace-operation-limiter.js +31 -0
- package/dist/workspace-operation-limiter.js.map +1 -0
- package/dist/workspace-operations.d.ts +145 -0
- package/dist/workspace-operations.d.ts.map +1 -0
- package/dist/workspace-operations.js +420 -0
- package/dist/workspace-operations.js.map +1 -0
- package/dist/workspace-runtime.d.ts +110 -0
- package/dist/workspace-runtime.d.ts.map +1 -0
- package/dist/workspace-runtime.js +240 -0
- package/dist/workspace-runtime.js.map +1 -0
- package/dist/workspace-search.d.ts +55 -0
- package/dist/workspace-search.d.ts.map +1 -0
- package/dist/workspace-search.js +262 -0
- package/dist/workspace-search.js.map +1 -0
- package/dist/workspace-service.d.ts +173 -0
- package/dist/workspace-service.d.ts.map +1 -0
- package/dist/workspace-service.js +619 -0
- package/dist/workspace-service.js.map +1 -0
- package/dist/workspace.d.ts +7 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +7 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +7 -4
- package/dist/agent-harness.d.ts +0 -108
- package/dist/agent-harness.d.ts.map +0 -1
- package/dist/agent-harness.js +0 -2
- package/dist/agent-harness.js.map +0 -1
- package/dist/attachments-legacy.d.ts +0 -17
- package/dist/attachments-legacy.d.ts.map +0 -1
- package/dist/attachments-legacy.js +0 -273
- package/dist/attachments-legacy.js.map +0 -1
- package/dist/code-mode.d.ts +0 -20
- package/dist/code-mode.d.ts.map +0 -1
- package/dist/code-mode.js +0 -658
- package/dist/code-mode.js.map +0 -1
- package/dist/hook-dispatch.d.ts +0 -19
- package/dist/hook-dispatch.d.ts.map +0 -1
- package/dist/hook-dispatch.js +0 -37
- package/dist/hook-dispatch.js.map +0 -1
- package/dist/pi-agent-harness.d.ts +0 -40
- package/dist/pi-agent-harness.d.ts.map +0 -1
- package/dist/pi-agent-harness.js +0 -222
- package/dist/pi-agent-harness.js.map +0 -1
- package/dist/pi-harness.d.ts +0 -42
- package/dist/pi-harness.d.ts.map +0 -1
- package/dist/pi-harness.js +0 -142
- package/dist/pi-harness.js.map +0 -1
- package/dist/run-resolver.d.ts +0 -35
- package/dist/run-resolver.d.ts.map +0 -1
- package/dist/run-resolver.js +0 -84
- package/dist/run-resolver.js.map +0 -1
- package/dist/usage-budget.d.ts +0 -29
- package/dist/usage-budget.d.ts.map +0 -1
- package/dist/usage-budget.js +0 -145
- package/dist/usage-budget.js.map +0 -1
|
@@ -4,8 +4,12 @@ import { dueTimeForSchedule, dynamicScheduleMessage, stringValue, timestamp } fr
|
|
|
4
4
|
import { buildDefaultContextBundle } from "./sandbox-fs.js";
|
|
5
5
|
import { isJsonObject, safeJson } from "./json-util.js";
|
|
6
6
|
import { failRun } from "./run-outcome.js";
|
|
7
|
+
import { loadDefaultOutboundRoute } from "./default-outbound-route.js";
|
|
7
8
|
import { isRuntimeSettingsStore } from "./state.js";
|
|
8
9
|
import { memoryBodyText, memoryDocumentSummary, positiveLimit } from "./storage.js";
|
|
10
|
+
import { defaultUserPrincipal, initiatorFromRun, principalFromRun } from "./principals.js";
|
|
11
|
+
import { audienceFromMetadata, audienceFromRun, normalizeAgentAudience } from "./audience.js";
|
|
12
|
+
import { matchingEventAutomations } from "./automation-event-match.js";
|
|
9
13
|
export async function registerManifestSchedulesImpl(host) {
|
|
10
14
|
const records = [];
|
|
11
15
|
for (const schedule of manifestScheduleRegistrations(host)) {
|
|
@@ -37,12 +41,27 @@ export async function runDueSchedulesImpl(host, options = {}) {
|
|
|
37
41
|
continue;
|
|
38
42
|
const dueAtIso = dueAt.toISOString();
|
|
39
43
|
const idempotencyKey = `${schedule.idempotencyKey}:${dueAtIso}`;
|
|
44
|
+
let job;
|
|
45
|
+
try {
|
|
46
|
+
job = await manifestScheduleExecution(host, schedule, dueAtIso, idempotencyKey);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
50
|
+
await host.state.recordScheduleRun({
|
|
51
|
+
scheduleId: schedule.schedule,
|
|
52
|
+
runAt: dueAtIso,
|
|
53
|
+
idempotencyKey,
|
|
54
|
+
status: "failed"
|
|
55
|
+
});
|
|
56
|
+
results.push({ schedule: schedule.schedule, dueAt: dueAtIso, idempotencyKey, status: "failed", error: message });
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
40
59
|
// Message schedules run through the bounded semaphore; claim capacity
|
|
41
60
|
// BEFORE reserving the idempotency key so a saturated runtime skips the
|
|
42
61
|
// tick without burning the key (the next sweep retries). Triggered
|
|
43
62
|
// schedules use an existingRun and bypass admission (enter()).
|
|
44
63
|
let admission;
|
|
45
|
-
if (!schedule.trigger) {
|
|
64
|
+
if (!schedule.trigger && !schedule.lifecycle) {
|
|
46
65
|
const admitted = host.admitRunOrReject();
|
|
47
66
|
if (admitted instanceof RunCapacityError) {
|
|
48
67
|
results.push({ schedule: schedule.schedule, dueAt: dueAtIso, idempotencyKey, status: "skipped", error: "run capacity saturated" });
|
|
@@ -71,7 +90,6 @@ export async function runDueSchedulesImpl(host, options = {}) {
|
|
|
71
90
|
admission?.release();
|
|
72
91
|
throw error;
|
|
73
92
|
});
|
|
74
|
-
const job = manifestScheduleExecution(host, schedule, dueAtIso, idempotencyKey);
|
|
75
93
|
try {
|
|
76
94
|
results.push(await runScheduleExecution(host, job, admission));
|
|
77
95
|
}
|
|
@@ -100,13 +118,7 @@ export async function dispatchAutomationEventImpl(host, event) {
|
|
|
100
118
|
throw new Error("Automation event occurredAt must be a valid ISO timestamp.");
|
|
101
119
|
}
|
|
102
120
|
const results = [];
|
|
103
|
-
for (const automation of host.manifest
|
|
104
|
-
if (automation.trigger.type !== "event")
|
|
105
|
-
continue;
|
|
106
|
-
if (automation.trigger.source !== event.source || automation.trigger.event !== event.event)
|
|
107
|
-
continue;
|
|
108
|
-
if (automation.trigger.filter && !jsonSubsetMatches(automation.trigger.filter, event.payload))
|
|
109
|
-
continue;
|
|
121
|
+
for (const automation of matchingEventAutomations(host.manifest, event)) {
|
|
110
122
|
const idempotencyKey = `${automation.idempotencyKey}:${event.eventId}`;
|
|
111
123
|
let admission;
|
|
112
124
|
if (!automation.lifecycle) {
|
|
@@ -139,6 +151,19 @@ export async function dispatchAutomationEventImpl(host, event) {
|
|
|
139
151
|
}
|
|
140
152
|
const execution = eventAutomationExecution(host, automation, event, idempotencyKey);
|
|
141
153
|
try {
|
|
154
|
+
// Schedule-run records use the same durable ledger for schedule and event
|
|
155
|
+
// automations. Postgres enforces that every ledger row has a registered
|
|
156
|
+
// parent, so register the event automation before its first dispatch.
|
|
157
|
+
await host.state.registerSchedule({
|
|
158
|
+
id: automation.automation,
|
|
159
|
+
name: `automation:${automation.automation}`,
|
|
160
|
+
cron: `@event ${automation.trigger.source}:${automation.trigger.event}`,
|
|
161
|
+
metadata: {
|
|
162
|
+
agentRevision: host.manifest.agentRevision,
|
|
163
|
+
trigger: safeJson(automation.trigger),
|
|
164
|
+
message: automation.message ?? null
|
|
165
|
+
}
|
|
166
|
+
});
|
|
142
167
|
const result = await runScheduleExecution(host, execution, admission);
|
|
143
168
|
results.push({
|
|
144
169
|
automation: automation.automation,
|
|
@@ -150,6 +175,10 @@ export async function dispatchAutomationEventImpl(host, event) {
|
|
|
150
175
|
});
|
|
151
176
|
}
|
|
152
177
|
catch (error) {
|
|
178
|
+
// No durable evidence of this event exists on a throw (a durable run —
|
|
179
|
+
// even a failed one — resolves): un-burn the reservation so a provider
|
|
180
|
+
// retry can redeliver instead of the event being lost forever.
|
|
181
|
+
await host.state.releaseIdempotencyKey?.(`automation:${automation.automation}:event`, idempotencyKey).catch(() => undefined);
|
|
153
182
|
results.push({
|
|
154
183
|
automation: automation.automation,
|
|
155
184
|
eventId: event.eventId,
|
|
@@ -164,13 +193,16 @@ export async function dispatchAutomationEventImpl(host, event) {
|
|
|
164
193
|
function eventAutomationExecution(host, automation, event, idempotencyKey) {
|
|
165
194
|
const eventAt = event.occurredAt ?? timestamp();
|
|
166
195
|
const compiled = host.manifest.automations?.find((candidate) => candidate.name === automation.automation);
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
...(
|
|
172
|
-
|
|
173
|
-
|
|
196
|
+
const principal = event.principal ?? defaultUserPrincipal(event.userId, event.source);
|
|
197
|
+
const initiator = event.initiator ?? principal;
|
|
198
|
+
const audience = normalizeAgentAudience(event.audience)
|
|
199
|
+
?? (host.manifest.agent.audienceIsolation !== true
|
|
200
|
+
? trustedScheduleAudience({ ...(principal ? { principal } : {}), ...(event.conversationId ? { conversationId: event.conversationId } : {}) })
|
|
201
|
+
: event.conversationId
|
|
202
|
+
? { private: false, conversationId: event.conversationId }
|
|
203
|
+
: principal
|
|
204
|
+
? { private: true, principal }
|
|
205
|
+
: { private: true });
|
|
174
206
|
return {
|
|
175
207
|
source: "manifest",
|
|
176
208
|
scheduleId: automation.automation,
|
|
@@ -179,7 +211,7 @@ function eventAutomationExecution(host, automation, event, idempotencyKey) {
|
|
|
179
211
|
idempotencyKey,
|
|
180
212
|
message: automation.message ?? `Handle ${event.event} from ${event.source}.`,
|
|
181
213
|
channel: "automation",
|
|
182
|
-
...(
|
|
214
|
+
...(automation.lifecycle ? { lifecycle: automation.lifecycle } : {}),
|
|
183
215
|
...(automation.target ? { target: automation.target } : {}),
|
|
184
216
|
automationEvent: event,
|
|
185
217
|
metadata: {
|
|
@@ -189,6 +221,9 @@ function eventAutomationExecution(host, automation, event, idempotencyKey) {
|
|
|
189
221
|
},
|
|
190
222
|
definition: safeJson(compiled ?? automation),
|
|
191
223
|
...(event.userId ? { userId: event.userId } : {}),
|
|
224
|
+
...(principal ? { principal } : {}),
|
|
225
|
+
...(initiator ? { initiator } : {}),
|
|
226
|
+
audience,
|
|
192
227
|
...(event.conversationId ? { conversationId: event.conversationId } : {}),
|
|
193
228
|
...(event.projectId ? { projectId: event.projectId } : {}),
|
|
194
229
|
...(event.delivery ? { delivery: event.delivery } : {}),
|
|
@@ -201,19 +236,12 @@ function eventAutomationExecution(host, automation, event, idempotencyKey) {
|
|
|
201
236
|
}
|
|
202
237
|
};
|
|
203
238
|
}
|
|
204
|
-
function
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return isJsonObject(actualValue) && jsonSubsetMatches(expectedValue, actualValue);
|
|
211
|
-
}
|
|
212
|
-
return JSON.stringify(expectedValue) === JSON.stringify(actualValue);
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
function manifestScheduleExecution(host, schedule, dueAtIso, idempotencyKey) {
|
|
216
|
-
return {
|
|
239
|
+
async function manifestScheduleExecution(host, schedule, dueAtIso, idempotencyKey) {
|
|
240
|
+
const compiled = compiledSchedule(host, schedule.schedule);
|
|
241
|
+
const compiledMetadata = compiled && "metadata" in compiled && isJsonObject(compiled.metadata)
|
|
242
|
+
? compiled.metadata
|
|
243
|
+
: {};
|
|
244
|
+
const execution = {
|
|
217
245
|
source: "manifest",
|
|
218
246
|
scheduleId: schedule.schedule,
|
|
219
247
|
resultSchedule: schedule.schedule,
|
|
@@ -222,17 +250,50 @@ function manifestScheduleExecution(host, schedule, dueAtIso, idempotencyKey) {
|
|
|
222
250
|
message: scheduleMessage(host, schedule.schedule),
|
|
223
251
|
channel: "schedule",
|
|
224
252
|
...(schedule.trigger ? { trigger: schedule.trigger } : {}),
|
|
253
|
+
...(schedule.lifecycle ? { lifecycle: schedule.lifecycle } : {}),
|
|
225
254
|
...(schedule.target ? { target: schedule.target } : {}),
|
|
226
255
|
metadata: {
|
|
256
|
+
...compiledMetadata,
|
|
227
257
|
schedule: schedule.schedule,
|
|
228
258
|
dueAt: dueAtIso,
|
|
229
259
|
idempotencyKey
|
|
230
260
|
},
|
|
231
|
-
definition: safeJson(
|
|
261
|
+
definition: safeJson(compiled ?? schedule)
|
|
232
262
|
};
|
|
263
|
+
const channel = host.manifest.agent.defaultOutboundChannel?.trim();
|
|
264
|
+
if (!channel)
|
|
265
|
+
return execution;
|
|
266
|
+
if (!isRuntimeSettingsStore(host.state)) {
|
|
267
|
+
throw new Error(`Default outbound channel "${channel}" requires durable runtime settings.`);
|
|
268
|
+
}
|
|
269
|
+
const saved = await loadDefaultOutboundRoute(host.state, host.skillScope(), channel);
|
|
270
|
+
if (!saved) {
|
|
271
|
+
throw new Error(`Default outbound channel "${channel}" has no saved route. Send the agent a message on that channel first.`);
|
|
272
|
+
}
|
|
273
|
+
execution.channel = channel;
|
|
274
|
+
if (saved.userId)
|
|
275
|
+
execution.userId = saved.userId;
|
|
276
|
+
if (saved.principal)
|
|
277
|
+
execution.principal = saved.principal;
|
|
278
|
+
if (saved.initiator)
|
|
279
|
+
execution.initiator = saved.initiator;
|
|
280
|
+
execution.audience = saved.audience;
|
|
281
|
+
if (saved.conversationId)
|
|
282
|
+
execution.conversationId = saved.conversationId;
|
|
283
|
+
if (saved.projectId)
|
|
284
|
+
execution.projectId = saved.projectId;
|
|
285
|
+
if (saved.workspaceId)
|
|
286
|
+
execution.workspaceId = saved.workspaceId;
|
|
287
|
+
if (saved.tenantId)
|
|
288
|
+
execution.tenantId = saved.tenantId;
|
|
289
|
+
if (saved.delivery)
|
|
290
|
+
execution.delivery = saved.delivery;
|
|
291
|
+
return execution;
|
|
233
292
|
}
|
|
234
293
|
async function runScheduleExecution(host, schedule, admission) {
|
|
235
|
-
return schedule.trigger
|
|
294
|
+
return schedule.trigger || schedule.lifecycle
|
|
295
|
+
? runTriggeredSchedule(host, schedule)
|
|
296
|
+
: runMessageSchedule(host, schedule, admission);
|
|
236
297
|
}
|
|
237
298
|
async function runMessageSchedule(host, schedule, admission) {
|
|
238
299
|
const overrides = admission ? { admission } : {};
|
|
@@ -255,6 +316,7 @@ async function runMessageSchedule(host, schedule, admission) {
|
|
|
255
316
|
};
|
|
256
317
|
}
|
|
257
318
|
function scheduleRunOptions(host, schedule, message, metadata, overrides = {}) {
|
|
319
|
+
const audience = resolvedScheduleAudience(host, schedule);
|
|
258
320
|
const options = {
|
|
259
321
|
message,
|
|
260
322
|
channel: schedule.channel,
|
|
@@ -264,10 +326,19 @@ function scheduleRunOptions(host, schedule, message, metadata, overrides = {}) {
|
|
|
264
326
|
};
|
|
265
327
|
if (schedule.userId)
|
|
266
328
|
options.userId = schedule.userId;
|
|
329
|
+
if (schedule.principal)
|
|
330
|
+
options.principal = schedule.principal;
|
|
331
|
+
if (schedule.initiator)
|
|
332
|
+
options.initiator = schedule.initiator;
|
|
333
|
+
options.audience = audience;
|
|
267
334
|
if (schedule.conversationId)
|
|
268
335
|
options.conversationId = schedule.conversationId;
|
|
269
336
|
if (schedule.projectId)
|
|
270
337
|
options.projectId = schedule.projectId;
|
|
338
|
+
if (schedule.workspaceId)
|
|
339
|
+
options.workspaceId = schedule.workspaceId;
|
|
340
|
+
if (schedule.tenantId)
|
|
341
|
+
options.tenantId = schedule.tenantId;
|
|
271
342
|
if (schedule.delivery)
|
|
272
343
|
options.delivery = schedule.delivery;
|
|
273
344
|
if (schedule.conversationId) {
|
|
@@ -277,6 +348,9 @@ function scheduleRunOptions(host, schedule, message, metadata, overrides = {}) {
|
|
|
277
348
|
conversationId: schedule.conversationId,
|
|
278
349
|
message,
|
|
279
350
|
...(schedule.userId ? { userId: schedule.userId } : {}),
|
|
351
|
+
...(schedule.principal ? { principal: schedule.principal } : {}),
|
|
352
|
+
...(schedule.initiator ? { initiator: schedule.initiator } : {}),
|
|
353
|
+
audience,
|
|
280
354
|
...(schedule.delivery ? { delivery: schedule.delivery } : {}),
|
|
281
355
|
...(schedule.turnMetadata ? { metadata: schedule.turnMetadata } : {})
|
|
282
356
|
};
|
|
@@ -285,11 +359,9 @@ function scheduleRunOptions(host, schedule, message, metadata, overrides = {}) {
|
|
|
285
359
|
}
|
|
286
360
|
async function runTriggeredSchedule(host, schedule) {
|
|
287
361
|
const trigger = schedule.trigger;
|
|
288
|
-
|
|
289
|
-
throw new Error(`Schedule ${schedule.resultSchedule} has no trigger definition.`);
|
|
290
|
-
const handler = automationHandlers(host).find((candidate) => candidate.name === trigger.handler);
|
|
362
|
+
const handler = resolveAutomationLifecycle(host, schedule);
|
|
291
363
|
if (!handler)
|
|
292
|
-
throw new Error(`
|
|
364
|
+
throw new Error(`Automation ${schedule.resultSchedule} has no lifecycle definition.`);
|
|
293
365
|
const invocation = {
|
|
294
366
|
kind: schedule.automationEvent ? "event" : "schedule",
|
|
295
367
|
source: schedule.source,
|
|
@@ -299,19 +371,25 @@ async function runTriggeredSchedule(host, schedule) {
|
|
|
299
371
|
handler: handler.name,
|
|
300
372
|
idempotencyKey: schedule.idempotencyKey
|
|
301
373
|
};
|
|
302
|
-
if (trigger
|
|
374
|
+
if (trigger?.metadata)
|
|
303
375
|
invocation.metadata = trigger.metadata;
|
|
376
|
+
const audience = resolvedScheduleAudience(host, schedule);
|
|
304
377
|
let run = await host.state.createRun({
|
|
305
378
|
agentRevision: host.manifest.agentRevision,
|
|
306
379
|
status: "created",
|
|
307
380
|
input: {
|
|
308
381
|
message: schedule.message,
|
|
309
|
-
model: host.manifest.agent.model,
|
|
310
382
|
channel: schedule.channel,
|
|
311
383
|
eventId: schedule.idempotencyKey,
|
|
312
384
|
conversationId: schedule.conversationId ?? null,
|
|
385
|
+
autoConversation: !schedule.conversationId,
|
|
313
386
|
userId: schedule.userId ?? null,
|
|
387
|
+
principal: schedule.principal ? safeJson(schedule.principal) : null,
|
|
388
|
+
initiator: schedule.initiator ? safeJson(schedule.initiator) : null,
|
|
389
|
+
audience: safeJson(audience),
|
|
314
390
|
projectId: schedule.projectId ?? null,
|
|
391
|
+
workspaceId: schedule.workspaceId ?? null,
|
|
392
|
+
tenantId: schedule.tenantId ?? null,
|
|
315
393
|
delivery: schedule.delivery ?? null,
|
|
316
394
|
metadata: {
|
|
317
395
|
...schedule.metadata,
|
|
@@ -343,7 +421,7 @@ async function runTriggeredSchedule(host, schedule) {
|
|
|
343
421
|
prepareContext = triggerPrepareContext(run.id, prepareResult);
|
|
344
422
|
await host.state.appendEvent(run.id, "trigger.prepare_completed", {
|
|
345
423
|
handler: handler.name,
|
|
346
|
-
target: safeJson(prepareResult.target ?? trigger.target ?? null),
|
|
424
|
+
target: safeJson(prepareResult.target ?? trigger?.target ?? schedule.target ?? null),
|
|
347
425
|
promptContext: safeJson(prepareResult.promptContext ?? {})
|
|
348
426
|
});
|
|
349
427
|
await host.emitSpan("ai.assembly-line.trigger.prepare", prepareStartedAt, host.runSpanAttributes(run, {
|
|
@@ -379,7 +457,7 @@ async function runTriggeredSchedule(host, schedule) {
|
|
|
379
457
|
});
|
|
380
458
|
return { schedule: schedule.resultSchedule, dueAt: schedule.dueAtIso, idempotencyKey: schedule.idempotencyKey, status: "failed", runId: run.id, error: message };
|
|
381
459
|
}
|
|
382
|
-
const target = prepareResult.target ?? trigger
|
|
460
|
+
const target = prepareResult.target ?? trigger?.target ?? schedule.target;
|
|
383
461
|
const promptContext = {
|
|
384
462
|
triggerKind: invocation.kind,
|
|
385
463
|
triggerSource: invocation.source ?? "manifest",
|
|
@@ -511,6 +589,25 @@ async function runTriggeredSchedule(host, schedule) {
|
|
|
511
589
|
...(finalizeResult.error ? { error: finalizeResult.error } : {})
|
|
512
590
|
};
|
|
513
591
|
}
|
|
592
|
+
function resolvedScheduleAudience(host, schedule) {
|
|
593
|
+
if (schedule.audience)
|
|
594
|
+
return schedule.audience;
|
|
595
|
+
if (host.manifest.agent.audienceIsolation !== true)
|
|
596
|
+
return trustedScheduleAudience(schedule);
|
|
597
|
+
if (schedule.conversationId)
|
|
598
|
+
return { private: false, conversationId: schedule.conversationId };
|
|
599
|
+
if (schedule.principal)
|
|
600
|
+
return { private: true, principal: schedule.principal };
|
|
601
|
+
return { private: true };
|
|
602
|
+
}
|
|
603
|
+
/** Without audienceIsolation, schedule fallbacks are trusted like every other run. */
|
|
604
|
+
function trustedScheduleAudience(schedule) {
|
|
605
|
+
return {
|
|
606
|
+
private: true,
|
|
607
|
+
...(schedule.principal ? { principal: schedule.principal } : {}),
|
|
608
|
+
...(schedule.conversationId ? { conversationId: schedule.conversationId } : {})
|
|
609
|
+
};
|
|
610
|
+
}
|
|
514
611
|
async function loadTriggerHandler(host, handler) {
|
|
515
612
|
const module = await host.sourceLoader.load(handler.source);
|
|
516
613
|
const candidates = [module.default, module[handler.name], ...Object.values(module)];
|
|
@@ -525,7 +622,7 @@ export function normalizeScheduleTriggerDefinitionImpl(host, value) {
|
|
|
525
622
|
const handler = stringValue(value.handler);
|
|
526
623
|
if (!handler)
|
|
527
624
|
throw new Error("Schedule trigger requires handler.");
|
|
528
|
-
if (!
|
|
625
|
+
if (!automationLifecycleSources(host).some((candidate) => candidate.name === handler)) {
|
|
529
626
|
throw new Error(`Unknown trigger handler: ${handler}`);
|
|
530
627
|
}
|
|
531
628
|
const trigger = { handler };
|
|
@@ -550,13 +647,13 @@ function normalizeTriggerTarget(value) {
|
|
|
550
647
|
return { type, name, ...(isJsonObject(value.metadata) ? { metadata: value.metadata } : {}) };
|
|
551
648
|
}
|
|
552
649
|
if (type === "agent") {
|
|
650
|
+
if (value.model !== undefined) {
|
|
651
|
+
throw new Error("Automation targets cannot select a model; use useModel() in agent.ts setup().");
|
|
652
|
+
}
|
|
553
653
|
const name = stringValue(value.name);
|
|
554
|
-
const model = stringValue(value.model);
|
|
555
654
|
const target = { type };
|
|
556
655
|
if (name)
|
|
557
656
|
target.name = name;
|
|
558
|
-
if (model)
|
|
559
|
-
target.model = model;
|
|
560
657
|
if (isJsonObject(value.metadata))
|
|
561
658
|
target.metadata = value.metadata;
|
|
562
659
|
return target;
|
|
@@ -577,6 +674,9 @@ function createTriggerHandlerContext(host, run, schedule, trigger, prepare) {
|
|
|
577
674
|
return {
|
|
578
675
|
runId: run.id,
|
|
579
676
|
agentRevision: host.manifest.agentRevision,
|
|
677
|
+
...(principalFromRun(run) ? { principal: principalFromRun(run) } : {}),
|
|
678
|
+
...(initiatorFromRun(run) ? { initiator: initiatorFromRun(run) } : {}),
|
|
679
|
+
audience: audienceFromRun(run),
|
|
580
680
|
trigger,
|
|
581
681
|
state: createTriggerStateApi(host, run),
|
|
582
682
|
memory: host.createMemoryToolApi(run),
|
|
@@ -721,7 +821,7 @@ async function collectTriggerResources(host, run, input = {}) {
|
|
|
721
821
|
}
|
|
722
822
|
}
|
|
723
823
|
if (requested.has("skills")) {
|
|
724
|
-
const skills = (await host.skillStore.list(host.skillScope())).filter((skill) => !skill.pending).slice(0, limit);
|
|
824
|
+
const skills = (await host.skillStore.list(host.skillScope())).filter((skill) => !skill.pending && !skill.archived).slice(0, limit);
|
|
725
825
|
resources.push(...skills.map((skill) => ({
|
|
726
826
|
kind: "skill",
|
|
727
827
|
name: skill.name,
|
|
@@ -759,7 +859,7 @@ async function runDueDynamicSchedules(host, now) {
|
|
|
759
859
|
const idempotencyKey = `dynamic:${job.id}:${dueAtIso}`;
|
|
760
860
|
const leaseToken = job.leaseToken ?? "";
|
|
761
861
|
try {
|
|
762
|
-
//
|
|
862
|
+
// assembly_line_schedule_runs rows reference assembly_line_schedules; dynamic jobs
|
|
763
863
|
// live in the schedule store, so upsert a parent row before recording runs.
|
|
764
864
|
await host.state.registerSchedule({
|
|
765
865
|
id: `dynamic:${job.id}`,
|
|
@@ -832,6 +932,16 @@ function dynamicScheduleExecution(host, job, dueAtIso, idempotencyKey) {
|
|
|
832
932
|
const conversationId = job.conversationId ?? targetConversation;
|
|
833
933
|
const projectId = job.projectId ?? targetProject;
|
|
834
934
|
const delivery = isJsonObject(job.target) ? job.target : undefined;
|
|
935
|
+
const principal = job.principal ?? defaultUserPrincipal(job.userId, job.channel);
|
|
936
|
+
const initiator = job.initiator ?? principal;
|
|
937
|
+
const audience = audienceFromMetadata(job.metadata)
|
|
938
|
+
?? (host.manifest.agent.audienceIsolation !== true
|
|
939
|
+
? trustedScheduleAudience({ ...(principal ? { principal } : {}), ...(conversationId ? { conversationId } : {}) })
|
|
940
|
+
: principal
|
|
941
|
+
? { private: true, principal }
|
|
942
|
+
: conversationId
|
|
943
|
+
? { private: false, conversationId }
|
|
944
|
+
: { private: true });
|
|
835
945
|
const message = dynamicScheduleMessage(job);
|
|
836
946
|
const trigger = job.trigger ? normalizeScheduleTriggerDefinitionImpl(host, job.trigger) : undefined;
|
|
837
947
|
const metadata = {
|
|
@@ -860,6 +970,9 @@ function dynamicScheduleExecution(host, job, dueAtIso, idempotencyKey) {
|
|
|
860
970
|
metadata,
|
|
861
971
|
definition: safeJson(definition),
|
|
862
972
|
...(job.userId ? { userId: job.userId } : {}),
|
|
973
|
+
...(principal ? { principal } : {}),
|
|
974
|
+
...(initiator ? { initiator } : {}),
|
|
975
|
+
audience,
|
|
863
976
|
...(conversationId ? { conversationId } : {}),
|
|
864
977
|
...(projectId ? { projectId } : {}),
|
|
865
978
|
...(delivery ? { delivery } : {})
|
|
@@ -915,10 +1028,32 @@ function scheduleMessage(host, name) {
|
|
|
915
1028
|
const compiled = compiledSchedule(host, name);
|
|
916
1029
|
return registration?.message ?? compiled?.message ?? compiled?.description ?? `Run schedule ${name}.`;
|
|
917
1030
|
}
|
|
918
|
-
function
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
1031
|
+
function resolveAutomationLifecycle(host, schedule) {
|
|
1032
|
+
const lifecycle = schedule.lifecycle;
|
|
1033
|
+
if (lifecycle?.kind === "inline") {
|
|
1034
|
+
const compiled = host.manifest.automationLifecycles?.find((candidate) => candidate.automation === schedule.resultSchedule) ?? host.manifest.automations?.find((candidate) => candidate.name === schedule.resultSchedule);
|
|
1035
|
+
return compiled ? { name: schedule.resultSchedule, source: compiled.source } : undefined;
|
|
1036
|
+
}
|
|
1037
|
+
const handlerName = lifecycle?.handler ?? schedule.trigger?.handler;
|
|
1038
|
+
return handlerName
|
|
1039
|
+
? automationLifecycleSources(host).find((candidate) => candidate.name === handlerName)
|
|
1040
|
+
: undefined;
|
|
1041
|
+
}
|
|
1042
|
+
function automationLifecycleSources(host) {
|
|
1043
|
+
const inline = (host.manifest.automationLifecycles ?? []).map((lifecycle) => ({
|
|
1044
|
+
name: lifecycle.automation,
|
|
1045
|
+
source: lifecycle.source
|
|
1046
|
+
}));
|
|
1047
|
+
const legacy = [
|
|
1048
|
+
...(host.manifest.automationHandlers ?? []),
|
|
1049
|
+
...(host.manifest.triggerHandlers ?? [])
|
|
1050
|
+
];
|
|
1051
|
+
const sources = new Map();
|
|
1052
|
+
for (const candidate of [...inline, ...legacy]) {
|
|
1053
|
+
if (!sources.has(candidate.name))
|
|
1054
|
+
sources.set(candidate.name, candidate);
|
|
1055
|
+
}
|
|
1056
|
+
return [...sources.values()];
|
|
922
1057
|
}
|
|
923
1058
|
function manifestScheduleRegistrations(host) {
|
|
924
1059
|
if (Array.isArray(host.manifest.automationRegistrations)) {
|
|
@@ -936,13 +1071,8 @@ function manifestScheduleRegistrations(host) {
|
|
|
936
1071
|
registration.message = automation.message;
|
|
937
1072
|
if (automation.target)
|
|
938
1073
|
registration.target = automation.target;
|
|
939
|
-
if (automation.lifecycle)
|
|
940
|
-
registration.
|
|
941
|
-
handler: automation.lifecycle.handler,
|
|
942
|
-
...(automation.target ? { target: automation.target } : {}),
|
|
943
|
-
...(automation.metadata ? { metadata: automation.metadata } : {})
|
|
944
|
-
};
|
|
945
|
-
}
|
|
1074
|
+
if (automation.lifecycle)
|
|
1075
|
+
registration.lifecycle = automation.lifecycle;
|
|
946
1076
|
return [registration];
|
|
947
1077
|
});
|
|
948
1078
|
}
|