operon-agents-core 0.1.0-alpha.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 +55 -0
- package/README.md +7 -0
- package/dist/agent/agent.d.ts +65 -0
- package/dist/agent/agent.js +39 -0
- package/dist/agent/compose-hooks.d.ts +13 -0
- package/dist/agent/compose-hooks.js +197 -0
- package/dist/agent/concurrency.d.ts +22 -0
- package/dist/agent/concurrency.js +70 -0
- package/dist/agent/context-report.d.ts +60 -0
- package/dist/agent/context-report.js +45 -0
- package/dist/agent/graph.d.ts +48 -0
- package/dist/agent/graph.js +129 -0
- package/dist/agent/guardrail.d.ts +105 -0
- package/dist/agent/guardrail.js +314 -0
- package/dist/agent/handoff-executor.d.ts +21 -0
- package/dist/agent/handoff-executor.js +95 -0
- package/dist/agent/handoff.d.ts +42 -0
- package/dist/agent/handoff.js +70 -0
- package/dist/agent/index.d.ts +25 -0
- package/dist/agent/index.js +19 -0
- package/dist/agent/instruction-context.d.ts +33 -0
- package/dist/agent/instruction-context.js +100 -0
- package/dist/agent/pause.d.ts +12 -0
- package/dist/agent/pause.js +82 -0
- package/dist/agent/profile-builtins.d.ts +8 -0
- package/dist/agent/profile-builtins.js +130 -0
- package/dist/agent/profiles.d.ts +94 -0
- package/dist/agent/profiles.js +264 -0
- package/dist/agent/recovery.d.ts +10 -0
- package/dist/agent/recovery.js +151 -0
- package/dist/agent/run-support.d.ts +79 -0
- package/dist/agent/run-support.js +211 -0
- package/dist/agent/runner.d.ts +246 -0
- package/dist/agent/runner.js +786 -0
- package/dist/agent/session.d.ts +363 -0
- package/dist/agent/session.js +937 -0
- package/dist/agent/subagent-tools.d.ts +18 -0
- package/dist/agent/subagent-tools.js +650 -0
- package/dist/agent/subagent.d.ts +56 -0
- package/dist/agent/subagent.js +50 -0
- package/dist/agent/toolset.d.ts +24 -0
- package/dist/agent/toolset.js +112 -0
- package/dist/agent/workflow/index.d.ts +9 -0
- package/dist/agent/workflow/index.js +8 -0
- package/dist/agent/workflow/journal.d.ts +180 -0
- package/dist/agent/workflow/journal.js +224 -0
- package/dist/agent/workflow/manager.d.ts +27 -0
- package/dist/agent/workflow/manager.js +33 -0
- package/dist/agent/workflow/parse.d.ts +17 -0
- package/dist/agent/workflow/parse.js +174 -0
- package/dist/agent/workflow/prompt.d.ts +8 -0
- package/dist/agent/workflow/prompt.js +84 -0
- package/dist/agent/workflow/runtime.d.ts +64 -0
- package/dist/agent/workflow/runtime.js +380 -0
- package/dist/agent/workflow/sandbox.d.ts +35 -0
- package/dist/agent/workflow/sandbox.js +90 -0
- package/dist/agent/workflow/snapshot.d.ts +36 -0
- package/dist/agent/workflow/snapshot.js +9 -0
- package/dist/agent/workflow/structured.d.ts +35 -0
- package/dist/agent/workflow/structured.js +79 -0
- package/dist/agent/workflow/tool.d.ts +14 -0
- package/dist/agent/workflow/tool.js +569 -0
- package/dist/agent/workflow/types.d.ts +100 -0
- package/dist/agent/workflow/types.js +17 -0
- package/dist/agent/worktree.d.ts +38 -0
- package/dist/agent/worktree.js +56 -0
- package/dist/capabilities/assembler.d.ts +39 -0
- package/dist/capabilities/assembler.js +171 -0
- package/dist/capabilities/background/agent-task.d.ts +51 -0
- package/dist/capabilities/background/agent-task.js +101 -0
- package/dist/capabilities/background/command-task.d.ts +43 -0
- package/dist/capabilities/background/command-task.js +86 -0
- package/dist/capabilities/background/index.d.ts +20 -0
- package/dist/capabilities/background/index.js +57 -0
- package/dist/capabilities/background/manager.d.ts +194 -0
- package/dist/capabilities/background/manager.js +1131 -0
- package/dist/capabilities/background/persist-disk.d.ts +17 -0
- package/dist/capabilities/background/persist-disk.js +66 -0
- package/dist/capabilities/background/persist.d.ts +61 -0
- package/dist/capabilities/background/persist.js +117 -0
- package/dist/capabilities/background/question-task.d.ts +32 -0
- package/dist/capabilities/background/question-task.js +56 -0
- package/dist/capabilities/background/registrar.d.ts +12 -0
- package/dist/capabilities/background/registrar.js +9 -0
- package/dist/capabilities/background/swappable-sink.d.ts +20 -0
- package/dist/capabilities/background/swappable-sink.js +20 -0
- package/dist/capabilities/background/task.d.ts +114 -0
- package/dist/capabilities/background/task.js +20 -0
- package/dist/capabilities/background/tools.d.ts +6 -0
- package/dist/capabilities/background/tools.js +190 -0
- package/dist/capabilities/background/workflow-task.d.ts +48 -0
- package/dist/capabilities/background/workflow-task.js +91 -0
- package/dist/capabilities/capability-state.d.ts +13 -0
- package/dist/capabilities/capability-state.js +37 -0
- package/dist/capabilities/capability.d.ts +145 -0
- package/dist/capabilities/capability.js +2 -0
- package/dist/capabilities/compaction/full.d.ts +27 -0
- package/dist/capabilities/compaction/full.js +155 -0
- package/dist/capabilities/compaction/index.d.ts +17 -0
- package/dist/capabilities/compaction/index.js +145 -0
- package/dist/capabilities/compaction/instruction.d.ts +2 -0
- package/dist/capabilities/compaction/instruction.js +31 -0
- package/dist/capabilities/compaction/micro.d.ts +17 -0
- package/dist/capabilities/compaction/micro.js +57 -0
- package/dist/capabilities/compaction/service.d.ts +28 -0
- package/dist/capabilities/compaction/service.js +52 -0
- package/dist/capabilities/compaction/strategy.d.ts +43 -0
- package/dist/capabilities/compaction/strategy.js +116 -0
- package/dist/capabilities/compaction/tokens.d.ts +5 -0
- package/dist/capabilities/compaction/tokens.js +28 -0
- package/dist/capabilities/goal/goal-store.d.ts +69 -0
- package/dist/capabilities/goal/goal-store.js +172 -0
- package/dist/capabilities/goal/index.d.ts +6 -0
- package/dist/capabilities/goal/index.js +31 -0
- package/dist/capabilities/goal/injector.d.ts +9 -0
- package/dist/capabilities/goal/injector.js +79 -0
- package/dist/capabilities/goal/tools.d.ts +6 -0
- package/dist/capabilities/goal/tools.js +86 -0
- package/dist/capabilities/index.d.ts +25 -0
- package/dist/capabilities/index.js +22 -0
- package/dist/capabilities/injection.d.ts +44 -0
- package/dist/capabilities/injection.js +112 -0
- package/dist/capabilities/plan/index.d.ts +6 -0
- package/dist/capabilities/plan/index.js +25 -0
- package/dist/capabilities/plan/injector.d.ts +13 -0
- package/dist/capabilities/plan/injector.js +83 -0
- package/dist/capabilities/plan/plan-mode.d.ts +38 -0
- package/dist/capabilities/plan/plan-mode.js +113 -0
- package/dist/capabilities/plan/policies.d.ts +6 -0
- package/dist/capabilities/plan/policies.js +89 -0
- package/dist/capabilities/plan/tools.d.ts +15 -0
- package/dist/capabilities/plan/tools.js +87 -0
- package/dist/capabilities/skills/flow-provider.d.ts +6 -0
- package/dist/capabilities/skills/flow-provider.js +50 -0
- package/dist/capabilities/skills/index.d.ts +43 -0
- package/dist/capabilities/skills/index.js +48 -0
- package/dist/capabilities/skills/injector.d.ts +11 -0
- package/dist/capabilities/skills/injector.js +27 -0
- package/dist/capabilities/skills/parser.d.ts +36 -0
- package/dist/capabilities/skills/parser.js +334 -0
- package/dist/capabilities/skills/registry.d.ts +33 -0
- package/dist/capabilities/skills/registry.js +118 -0
- package/dist/capabilities/skills/scanner.d.ts +26 -0
- package/dist/capabilities/skills/scanner.js +154 -0
- package/dist/capabilities/skills/service.d.ts +39 -0
- package/dist/capabilities/skills/service.js +68 -0
- package/dist/capabilities/skills/skill-tool.d.ts +13 -0
- package/dist/capabilities/skills/skill-tool.js +72 -0
- package/dist/capabilities/skills/types.d.ts +62 -0
- package/dist/capabilities/skills/types.js +26 -0
- package/dist/capabilities/task/index.d.ts +23 -0
- package/dist/capabilities/task/index.js +38 -0
- package/dist/capabilities/task/injector.d.ts +9 -0
- package/dist/capabilities/task/injector.js +62 -0
- package/dist/capabilities/task/persist-disk.d.ts +19 -0
- package/dist/capabilities/task/persist-disk.js +84 -0
- package/dist/capabilities/task/persist.d.ts +52 -0
- package/dist/capabilities/task/persist.js +84 -0
- package/dist/capabilities/task/task-store.d.ts +44 -0
- package/dist/capabilities/task/task-store.js +106 -0
- package/dist/capabilities/task/tools.d.ts +12 -0
- package/dist/capabilities/task/tools.js +164 -0
- package/dist/capabilities/todo/index.d.ts +8 -0
- package/dist/capabilities/todo/index.js +21 -0
- package/dist/capabilities/todo/injector.d.ts +9 -0
- package/dist/capabilities/todo/injector.js +68 -0
- package/dist/capabilities/todo/todo-store.d.ts +19 -0
- package/dist/capabilities/todo/todo-store.js +36 -0
- package/dist/capabilities/todo/tools.d.ts +6 -0
- package/dist/capabilities/todo/tools.js +70 -0
- package/dist/capabilities/tool-provider.d.ts +12 -0
- package/dist/capabilities/tool-provider.js +20 -0
- package/dist/capabilities/user-hooks/engine.d.ts +22 -0
- package/dist/capabilities/user-hooks/engine.js +105 -0
- package/dist/capabilities/user-hooks/index.d.ts +13 -0
- package/dist/capabilities/user-hooks/index.js +126 -0
- package/dist/capabilities/user-hooks/types.d.ts +26 -0
- package/dist/capabilities/user-hooks/types.js +19 -0
- package/dist/capabilities/workflow/index.d.ts +16 -0
- package/dist/capabilities/workflow/index.js +15 -0
- package/dist/commands/index.d.ts +31 -0
- package/dist/commands/index.js +318 -0
- package/dist/config/config-store.d.ts +29 -0
- package/dist/config/config-store.js +103 -0
- package/dist/config/file-source.d.ts +40 -0
- package/dist/config/file-source.js +78 -0
- package/dist/config/flags.d.ts +13 -0
- package/dist/config/flags.js +25 -0
- package/dist/config/index.d.ts +17 -0
- package/dist/config/index.js +10 -0
- package/dist/config/merge.d.ts +5 -0
- package/dist/config/merge.js +57 -0
- package/dist/config/model-catalog.d.ts +17 -0
- package/dist/config/model-catalog.js +37 -0
- package/dist/config/paths.d.ts +31 -0
- package/dist/config/paths.js +28 -0
- package/dist/config/provider-manager.d.ts +57 -0
- package/dist/config/provider-manager.js +344 -0
- package/dist/config/resolver.d.ts +40 -0
- package/dist/config/resolver.js +52 -0
- package/dist/config/schema.d.ts +389 -0
- package/dist/config/schema.js +132 -0
- package/dist/events/events.d.ts +348 -0
- package/dist/events/events.js +146 -0
- package/dist/events/index.d.ts +10 -0
- package/dist/events/index.js +5 -0
- package/dist/events/projection.d.ts +207 -0
- package/dist/events/projection.js +438 -0
- package/dist/events/publisher.d.ts +48 -0
- package/dist/events/publisher.js +404 -0
- package/dist/events/redacting-sink.d.ts +11 -0
- package/dist/events/redacting-sink.js +31 -0
- package/dist/home.d.ts +16 -0
- package/dist/home.js +20 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +22 -0
- package/dist/internal.d.ts +33 -0
- package/dist/internal.js +29 -0
- package/dist/llm/auth.d.ts +22 -0
- package/dist/llm/auth.js +112 -0
- package/dist/llm/capability.d.ts +13 -0
- package/dist/llm/capability.js +45 -0
- package/dist/llm/define-model.d.ts +110 -0
- package/dist/llm/define-model.js +252 -0
- package/dist/llm/errors.d.ts +33 -0
- package/dist/llm/errors.js +154 -0
- package/dist/llm/index.d.ts +14 -0
- package/dist/llm/index.js +8 -0
- package/dist/llm/model.d.ts +43 -0
- package/dist/llm/model.js +9 -0
- package/dist/llm/retry.d.ts +35 -0
- package/dist/llm/retry.js +160 -0
- package/dist/llm/runtime.d.ts +25 -0
- package/dist/llm/runtime.js +38 -0
- package/dist/logging/diagnostics.d.ts +21 -0
- package/dist/logging/diagnostics.js +46 -0
- package/dist/logging/index.d.ts +11 -0
- package/dist/logging/index.js +7 -0
- package/dist/logging/logger.d.ts +25 -0
- package/dist/logging/logger.js +54 -0
- package/dist/logging/paths.d.ts +11 -0
- package/dist/logging/paths.js +20 -0
- package/dist/logging/policy.d.ts +5 -0
- package/dist/logging/policy.js +19 -0
- package/dist/logging/redact.d.ts +10 -0
- package/dist/logging/redact.js +95 -0
- package/dist/logging/sinks.d.ts +67 -0
- package/dist/logging/sinks.js +117 -0
- package/dist/loop/context.d.ts +69 -0
- package/dist/loop/context.js +129 -0
- package/dist/loop/errors.d.ts +8 -0
- package/dist/loop/errors.js +27 -0
- package/dist/loop/events.d.ts +14 -0
- package/dist/loop/events.js +2 -0
- package/dist/loop/index.d.ts +10 -0
- package/dist/loop/index.js +7 -0
- package/dist/loop/interruption.d.ts +118 -0
- package/dist/loop/interruption.js +191 -0
- package/dist/loop/run-turn.d.ts +54 -0
- package/dist/loop/run-turn.js +203 -0
- package/dist/loop/scheduler.d.ts +18 -0
- package/dist/loop/scheduler.js +71 -0
- package/dist/loop/steer.d.ts +122 -0
- package/dist/loop/steer.js +209 -0
- package/dist/loop/tool-call.d.ts +41 -0
- package/dist/loop/tool-call.js +326 -0
- package/dist/loop/turn-step.d.ts +57 -0
- package/dist/loop/turn-step.js +298 -0
- package/dist/loop/types.d.ts +217 -0
- package/dist/loop/types.js +2 -0
- package/dist/loop/usage.d.ts +6 -0
- package/dist/loop/usage.js +44 -0
- package/dist/mcp/auth-tool.d.ts +12 -0
- package/dist/mcp/auth-tool.js +92 -0
- package/dist/mcp/capability.d.ts +7 -0
- package/dist/mcp/capability.js +91 -0
- package/dist/mcp/config-loader.d.ts +28 -0
- package/dist/mcp/config-loader.js +115 -0
- package/dist/mcp/filter.d.ts +18 -0
- package/dist/mcp/filter.js +35 -0
- package/dist/mcp/index.d.ts +23 -0
- package/dist/mcp/index.js +13 -0
- package/dist/mcp/manager.d.ts +51 -0
- package/dist/mcp/manager.js +412 -0
- package/dist/mcp/mock-transport.d.ts +40 -0
- package/dist/mcp/mock-transport.js +68 -0
- package/dist/mcp/oauth/callback-server.d.ts +14 -0
- package/dist/mcp/oauth/callback-server.js +122 -0
- package/dist/mcp/oauth/index.d.ts +9 -0
- package/dist/mcp/oauth/index.js +5 -0
- package/dist/mcp/oauth/provider.d.ts +39 -0
- package/dist/mcp/oauth/provider.js +121 -0
- package/dist/mcp/oauth/service.d.ts +34 -0
- package/dist/mcp/oauth/service.js +130 -0
- package/dist/mcp/oauth/store.d.ts +40 -0
- package/dist/mcp/oauth/store.js +134 -0
- package/dist/mcp/output.d.ts +12 -0
- package/dist/mcp/output.js +110 -0
- package/dist/mcp/provider.d.ts +7 -0
- package/dist/mcp/provider.js +56 -0
- package/dist/mcp/sdk-transport.d.ts +25 -0
- package/dist/mcp/sdk-transport.js +228 -0
- package/dist/mcp/server.d.ts +77 -0
- package/dist/mcp/server.js +120 -0
- package/dist/mcp/tool-naming.d.ts +4 -0
- package/dist/mcp/tool-naming.js +26 -0
- package/dist/mcp/types.d.ts +75 -0
- package/dist/mcp/types.js +2 -0
- package/dist/net/index.d.ts +3 -0
- package/dist/net/index.js +2 -0
- package/dist/net/proxy.d.ts +16 -0
- package/dist/net/proxy.js +42 -0
- package/dist/permission/auto-approver/index.d.ts +3 -0
- package/dist/permission/auto-approver/index.js +3 -0
- package/dist/permission/auto-approver/llm-auto-approver.d.ts +53 -0
- package/dist/permission/auto-approver/llm-auto-approver.js +122 -0
- package/dist/permission/auto-approver/prompts-data.d.ts +9 -0
- package/dist/permission/auto-approver/prompts-data.js +155 -0
- package/dist/permission/auto-approver/prompts.d.ts +18 -0
- package/dist/permission/auto-approver/prompts.js +40 -0
- package/dist/permission/auto-approver/transcript.d.ts +22 -0
- package/dist/permission/auto-approver/transcript.js +75 -0
- package/dist/permission/auto-approver/xml.d.ts +5 -0
- package/dist/permission/auto-approver/xml.js +25 -0
- package/dist/permission/index.d.ts +7 -0
- package/dist/permission/index.js +5 -0
- package/dist/permission/manager.d.ts +74 -0
- package/dist/permission/manager.js +162 -0
- package/dist/permission/matches-rule.d.ts +27 -0
- package/dist/permission/matches-rule.js +54 -0
- package/dist/permission/policies.d.ts +14 -0
- package/dist/permission/policies.js +233 -0
- package/dist/permission/types.d.ts +84 -0
- package/dist/permission/types.js +2 -0
- package/dist/plugins/archive.d.ts +3 -0
- package/dist/plugins/archive.js +58 -0
- package/dist/plugins/github-resolver.d.ts +13 -0
- package/dist/plugins/github-resolver.js +20 -0
- package/dist/plugins/hooks.d.ts +28 -0
- package/dist/plugins/hooks.js +296 -0
- package/dist/plugins/index.d.ts +23 -0
- package/dist/plugins/index.js +23 -0
- package/dist/plugins/injector.d.ts +11 -0
- package/dist/plugins/injector.js +32 -0
- package/dist/plugins/manager.d.ts +37 -0
- package/dist/plugins/manager.js +330 -0
- package/dist/plugins/manifest.d.ts +9 -0
- package/dist/plugins/manifest.js +234 -0
- package/dist/plugins/marketplace.d.ts +85 -0
- package/dist/plugins/marketplace.js +205 -0
- package/dist/plugins/source.d.ts +23 -0
- package/dist/plugins/source.js +87 -0
- package/dist/plugins/store.d.ts +20 -0
- package/dist/plugins/store.js +30 -0
- package/dist/plugins/types.d.ts +118 -0
- package/dist/plugins/types.js +5 -0
- package/dist/protocol/index.d.ts +4 -0
- package/dist/protocol/index.js +2 -0
- package/dist/protocol/tool-schema.d.ts +6 -0
- package/dist/protocol/tool-schema.js +2 -0
- package/dist/store/blob-store.d.ts +45 -0
- package/dist/store/blob-store.js +120 -0
- package/dist/store/catalog-store.d.ts +32 -0
- package/dist/store/catalog-store.js +73 -0
- package/dist/store/disk-store.d.ts +58 -0
- package/dist/store/disk-store.js +369 -0
- package/dist/store/index.d.ts +23 -0
- package/dist/store/index.js +15 -0
- package/dist/store/lock.d.ts +86 -0
- package/dist/store/lock.js +104 -0
- package/dist/store/log-store.d.ts +89 -0
- package/dist/store/log-store.js +296 -0
- package/dist/store/migrate.d.ts +26 -0
- package/dist/store/migrate.js +32 -0
- package/dist/store/origin.d.ts +89 -0
- package/dist/store/origin.js +16 -0
- package/dist/store/pg.d.ts +90 -0
- package/dist/store/pg.js +344 -0
- package/dist/store/redacting-store.d.ts +21 -0
- package/dist/store/redacting-store.js +46 -0
- package/dist/store/redis.d.ts +89 -0
- package/dist/store/redis.js +370 -0
- package/dist/store/repository.d.ts +150 -0
- package/dist/store/repository.js +508 -0
- package/dist/store/session-catalog.d.ts +32 -0
- package/dist/store/session-catalog.js +117 -0
- package/dist/store/storage.d.ts +27 -0
- package/dist/store/storage.js +54 -0
- package/dist/store/store.d.ts +262 -0
- package/dist/store/store.js +129 -0
- package/dist/store/workdir-key.d.ts +4 -0
- package/dist/store/workdir-key.js +28 -0
- package/dist/tool/access.d.ts +37 -0
- package/dist/tool/access.js +79 -0
- package/dist/tool/ask.d.ts +22 -0
- package/dist/tool/ask.js +38 -0
- package/dist/tool/background.d.ts +109 -0
- package/dist/tool/background.js +39 -0
- package/dist/tool/builtin/ask-user-question.d.ts +2 -0
- package/dist/tool/builtin/ask-user-question.js +175 -0
- package/dist/tool/builtin/bash.d.ts +2 -0
- package/dist/tool/builtin/bash.js +407 -0
- package/dist/tool/builtin/edit.d.ts +2 -0
- package/dist/tool/builtin/edit.js +202 -0
- package/dist/tool/builtin/glob.d.ts +3 -0
- package/dist/tool/builtin/glob.js +260 -0
- package/dist/tool/builtin/grep.d.ts +2 -0
- package/dist/tool/builtin/grep.js +574 -0
- package/dist/tool/builtin/line-endings.d.ts +10 -0
- package/dist/tool/builtin/line-endings.js +41 -0
- package/dist/tool/builtin/read.d.ts +28 -0
- package/dist/tool/builtin/read.js +498 -0
- package/dist/tool/builtin/write.d.ts +2 -0
- package/dist/tool/builtin/write.js +179 -0
- package/dist/tool/define.d.ts +46 -0
- package/dist/tool/define.js +45 -0
- package/dist/tool/file-freshness.d.ts +81 -0
- package/dist/tool/file-freshness.js +67 -0
- package/dist/tool/filesystem-tools.d.ts +16 -0
- package/dist/tool/filesystem-tools.js +19 -0
- package/dist/tool/git-context.d.ts +20 -0
- package/dist/tool/git-context.js +114 -0
- package/dist/tool/index.d.ts +37 -0
- package/dist/tool/index.js +34 -0
- package/dist/tool/machine-base.d.ts +138 -0
- package/dist/tool/machine-base.js +388 -0
- package/dist/tool/machine-local.d.ts +35 -0
- package/dist/tool/machine-local.js +316 -0
- package/dist/tool/machine-null.d.ts +36 -0
- package/dist/tool/machine-null.js +64 -0
- package/dist/tool/machine-ssh.d.ts +86 -0
- package/dist/tool/machine-ssh.js +576 -0
- package/dist/tool/machine.d.ts +333 -0
- package/dist/tool/machine.js +15 -0
- package/dist/tool/policies/path-access.d.ts +48 -0
- package/dist/tool/policies/path-access.js +186 -0
- package/dist/tool/policies/sensitive.d.ts +3 -0
- package/dist/tool/policies/sensitive.js +60 -0
- package/dist/tool/questions.d.ts +40 -0
- package/dist/tool/questions.js +8 -0
- package/dist/tool/search/activation.d.ts +13 -0
- package/dist/tool/search/activation.js +31 -0
- package/dist/tool/search/deferral.d.ts +37 -0
- package/dist/tool/search/deferral.js +128 -0
- package/dist/tool/search/search-tool.d.ts +9 -0
- package/dist/tool/search/search-tool.js +62 -0
- package/dist/tool/shell-env.d.ts +9 -0
- package/dist/tool/shell-env.js +34 -0
- package/dist/tool/support/bash-destructive.d.ts +24 -0
- package/dist/tool/support/bash-destructive.js +63 -0
- package/dist/tool/support/bash-paths.d.ts +7 -0
- package/dist/tool/support/bash-paths.js +247 -0
- package/dist/tool/support/bash-read-only.d.ts +8 -0
- package/dist/tool/support/bash-read-only.js +165 -0
- package/dist/tool/support/bash-rule-match.d.ts +20 -0
- package/dist/tool/support/bash-rule-match.js +191 -0
- package/dist/tool/support/file-type.d.ts +10 -0
- package/dist/tool/support/file-type.js +149 -0
- package/dist/tool/support/git-worktree.d.ts +10 -0
- package/dist/tool/support/git-worktree.js +63 -0
- package/dist/tool/support/image-compress.d.ts +69 -0
- package/dist/tool/support/image-compress.js +265 -0
- package/dist/tool/support/machine-ops.d.ts +34 -0
- package/dist/tool/support/machine-ops.js +34 -0
- package/dist/tool/support/path-glob-match.d.ts +12 -0
- package/dist/tool/support/path-glob-match.js +84 -0
- package/dist/tool/support/result-builder.d.ts +27 -0
- package/dist/tool/support/result-builder.js +108 -0
- package/dist/tool/support/rg-locator.d.ts +20 -0
- package/dist/tool/support/rg-locator.js +42 -0
- package/dist/tool/support/ripgrep-run.d.ts +65 -0
- package/dist/tool/support/ripgrep-run.js +40 -0
- package/dist/tool/support/rule-match.d.ts +6 -0
- package/dist/tool/support/rule-match.js +23 -0
- package/dist/tool/support/tool-path.d.ts +8 -0
- package/dist/tool/support/tool-path.js +28 -0
- package/dist/tool/support/workspace.d.ts +5 -0
- package/dist/tool/support/workspace.js +2 -0
- package/dist/tool/types.d.ts +131 -0
- package/dist/tool/types.js +2 -0
- package/dist/tool/web/fetch-url.d.ts +4 -0
- package/dist/tool/web/fetch-url.js +61 -0
- package/dist/tool/web/index.d.ts +11 -0
- package/dist/tool/web/index.js +7 -0
- package/dist/tool/web/providers/direct-fetch.d.ts +33 -0
- package/dist/tool/web/providers/direct-fetch.js +198 -0
- package/dist/tool/web/providers/firecrawl.d.ts +16 -0
- package/dist/tool/web/providers/firecrawl.js +59 -0
- package/dist/tool/web/providers/tavily.d.ts +14 -0
- package/dist/tool/web/providers/tavily.js +43 -0
- package/dist/tool/web/types.d.ts +41 -0
- package/dist/tool/web/types.js +7 -0
- package/dist/tool/web/web-search.d.ts +4 -0
- package/dist/tool/web/web-search.js +68 -0
- package/dist/tool/workspace-spec.d.ts +74 -0
- package/dist/tool/workspace-spec.js +177 -0
- package/dist/tracing/bridge.d.ts +7 -0
- package/dist/tracing/bridge.js +171 -0
- package/dist/tracing/index.d.ts +9 -0
- package/dist/tracing/index.js +5 -0
- package/dist/tracing/otel.d.ts +38 -0
- package/dist/tracing/otel.js +221 -0
- package/dist/tracing/processor.d.ts +47 -0
- package/dist/tracing/processor.js +94 -0
- package/dist/tracing/spans.d.ts +94 -0
- package/dist/tracing/spans.js +56 -0
- package/dist/ui/ai-sdk.d.ts +114 -0
- package/dist/ui/ai-sdk.js +175 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +2 -0
- package/package.json +101 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { errorMessage } from "../../loop/errors.js";
|
|
2
|
+
/**
|
|
3
|
+
* A shell command running as a background task.
|
|
4
|
+
*
|
|
5
|
+
* Driven by a {@link CommandStarter}, NOT by a process handle. The distinction is the whole
|
|
6
|
+
* point: a background task needs to stream output, be stopped, and report how it ended —
|
|
7
|
+
* all three of which are `run`'s intent fields, and all three of which every backend can
|
|
8
|
+
* deliver natively. Requiring a live process handle instead would demand a capability that
|
|
9
|
+
* sandbox transports cannot provide honestly, which is what used to force a fake handle
|
|
10
|
+
* whose `kill()` did nothing.
|
|
11
|
+
*
|
|
12
|
+
* No `forceStop`: SIGTERM → grace → SIGKILL escalation belongs to the Machine layer, which
|
|
13
|
+
* is where killing is real. Aborting the signal is the whole stop protocol.
|
|
14
|
+
*/
|
|
15
|
+
export class CommandBackgroundTask {
|
|
16
|
+
kind = "process";
|
|
17
|
+
idPrefix = "bash";
|
|
18
|
+
command;
|
|
19
|
+
description;
|
|
20
|
+
/**
|
|
21
|
+
* Where this command's output actually lives. A FACT, not a behaviour: the task states the
|
|
22
|
+
* location and nothing else, and whoever wants to look owns every decision about how much
|
|
23
|
+
* to read. BackgroundManager rejects process tasks without this file.
|
|
24
|
+
*/
|
|
25
|
+
outputLocation;
|
|
26
|
+
start_;
|
|
27
|
+
parentAddress;
|
|
28
|
+
toolCallId;
|
|
29
|
+
exitCodeValue = null;
|
|
30
|
+
constructor(start, command, description, options = {}) {
|
|
31
|
+
this.start_ = start;
|
|
32
|
+
this.command = command;
|
|
33
|
+
this.description = description;
|
|
34
|
+
this.parentAddress = options.parentAddress;
|
|
35
|
+
this.toolCallId = options.toolCallId;
|
|
36
|
+
const { logPath, machine } = options;
|
|
37
|
+
if (logPath !== undefined && machine !== undefined)
|
|
38
|
+
this.outputLocation = { kind: "file", machine, path: logPath };
|
|
39
|
+
}
|
|
40
|
+
/** Latest known exit status; null until the command settles, or when it reported none. */
|
|
41
|
+
get exitCode() {
|
|
42
|
+
return this.exitCodeValue;
|
|
43
|
+
}
|
|
44
|
+
async start(sink) {
|
|
45
|
+
// The sink's signal is the manager's stop switch; forward it to the command. Its own
|
|
46
|
+
// controller keeps the two decoupled, so a future internal stop reason stays possible.
|
|
47
|
+
const controller = new AbortController();
|
|
48
|
+
const requestStop = () => controller.abort();
|
|
49
|
+
if (sink.signal.aborted)
|
|
50
|
+
requestStop();
|
|
51
|
+
else
|
|
52
|
+
sink.signal.addEventListener("abort", requestStop, { once: true });
|
|
53
|
+
// The command's output was redirected ON THE MACHINE before this starts. That file IS the
|
|
54
|
+
// output; readers open a window on it only when somebody asks. No pipe tap or in-memory
|
|
55
|
+
// mirror exists on the background path.
|
|
56
|
+
try {
|
|
57
|
+
// `run` resolves only after both streams are fully drained, so — unlike the raw-pipe
|
|
58
|
+
// shape this replaced — there is no trailing output to race a drain timer against.
|
|
59
|
+
const result = await this.start_({
|
|
60
|
+
signal: controller.signal,
|
|
61
|
+
});
|
|
62
|
+
this.exitCodeValue = result.exitCode ?? null;
|
|
63
|
+
await sink.settle({
|
|
64
|
+
status: sink.signal.aborted ? "killed" : result.exitCode === 0 ? "completed" : "failed",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
await sink.settle({
|
|
69
|
+
status: sink.signal.aborted ? "killed" : "failed",
|
|
70
|
+
stopReason: sink.signal.aborted ? undefined : errorMessage(error),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
sink.signal.removeEventListener("abort", requestStop);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
toInfo(base) {
|
|
78
|
+
return {
|
|
79
|
+
...base,
|
|
80
|
+
kind: "process",
|
|
81
|
+
command: this.command,
|
|
82
|
+
exitCode: this.exitCodeValue,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=command-task.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Capability } from "../capability.ts";
|
|
2
|
+
import { BackgroundManager } from "./manager.ts";
|
|
3
|
+
export { BackgroundManager } from "./manager.ts";
|
|
4
|
+
export type { BackgroundManagerOptions, BackgroundManagerRuntime, BackgroundTaskOutputDelta, BackgroundTaskOutputSnapshot, } from "./manager.ts";
|
|
5
|
+
export { CommandBackgroundTask } from "./command-task.ts";
|
|
6
|
+
export type { CommandBackgroundTaskInfo } from "./command-task.ts";
|
|
7
|
+
export { AgentBackgroundTask } from "./agent-task.ts";
|
|
8
|
+
export type { AgentBackgroundTaskInfo, AgentBackgroundTaskOptions } from "./agent-task.ts";
|
|
9
|
+
export { QuestionBackgroundTask } from "./question-task.ts";
|
|
10
|
+
export type { QuestionBackgroundTaskInfo, QuestionBackgroundTaskOptions } from "./question-task.ts";
|
|
11
|
+
export { WorkflowBackgroundTask } from "./workflow-task.ts";
|
|
12
|
+
export type { WorkflowBackgroundTaskInfo, WorkflowBackgroundTaskOptions } from "./workflow-task.ts";
|
|
13
|
+
export { StoreBackgroundTaskPersistence, isPersistedTaskTerminal, isValidPersistedTask } from "./persist.ts";
|
|
14
|
+
export type { BackgroundTaskPersistence, PersistedTask } from "./persist.ts";
|
|
15
|
+
export { DiskBackgroundTaskPersistence } from "./persist-disk.ts";
|
|
16
|
+
export { backgroundListTool, backgroundOutputTool, backgroundStopTool } from "./tools.ts";
|
|
17
|
+
export { TERMINAL_STATUSES, isBackgroundTaskTerminal, } from "./task.ts";
|
|
18
|
+
export type { BackgroundTask, BackgroundTaskInfo, BackgroundTaskInfoBase, BackgroundTaskSink, BackgroundTaskSettlement, BackgroundTaskSettlementStatus, BackgroundTaskStatus, TaskOutputRef, TaskOutputLocation, } from "./task.ts";
|
|
19
|
+
export declare function backgroundCapability(manager?: BackgroundManager): Capability;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { BackgroundManager } from "./manager.js";
|
|
2
|
+
import { StoreBackgroundTaskPersistence } from "./persist.js";
|
|
3
|
+
import { DiskBackgroundTaskPersistence } from "./persist-disk.js";
|
|
4
|
+
import { backgroundListTool, backgroundOutputTool, backgroundStopTool } from "./tools.js";
|
|
5
|
+
export { BackgroundManager } from "./manager.js";
|
|
6
|
+
export { CommandBackgroundTask } from "./command-task.js";
|
|
7
|
+
export { AgentBackgroundTask } from "./agent-task.js";
|
|
8
|
+
export { QuestionBackgroundTask } from "./question-task.js";
|
|
9
|
+
export { WorkflowBackgroundTask } from "./workflow-task.js";
|
|
10
|
+
export { StoreBackgroundTaskPersistence, isPersistedTaskTerminal, isValidPersistedTask } from "./persist.js";
|
|
11
|
+
export { DiskBackgroundTaskPersistence } from "./persist-disk.js";
|
|
12
|
+
export { backgroundListTool, backgroundOutputTool, backgroundStopTool } from "./tools.js";
|
|
13
|
+
export { TERMINAL_STATUSES, isBackgroundTaskTerminal, } from "./task.js";
|
|
14
|
+
export function backgroundCapability(manager = new BackgroundManager()) {
|
|
15
|
+
return {
|
|
16
|
+
name: "background",
|
|
17
|
+
// Enumeration stays a host API (`session.listBackgroundTasks()`). The model already owns
|
|
18
|
+
// every task id it successfully spawned, while cold recovery injects ids whose ack was lost;
|
|
19
|
+
// exposing an unbounded list invites unrelated historical tasks into the reasoning path.
|
|
20
|
+
tools: [backgroundOutputTool(manager), backgroundStopTool(manager)],
|
|
21
|
+
service: manager,
|
|
22
|
+
openSession: async (ctx) => {
|
|
23
|
+
// Each task's status is now durably recorded in a dedicated per-task store (disk
|
|
24
|
+
// sessions get the `<sessionDir>/tasks/<id>/` layout; other backends use KV state),
|
|
25
|
+
// so a task orphaned by a dead process can be reconciled to `lost` on reopen. Loading
|
|
26
|
+
// + reconcile happen in the store-cutover step; here we attach the persistence so live
|
|
27
|
+
// spawns start recording. Without a durable store the manager stays purely in memory.
|
|
28
|
+
manager.attach({
|
|
29
|
+
steer: ctx.steer,
|
|
30
|
+
events: ctx.events,
|
|
31
|
+
sessionId: ctx.sessionId,
|
|
32
|
+
persistence: makeTaskPersistence(ctx.store),
|
|
33
|
+
// Shard-backed output (a sub-agent's conversation) is read back from here rather than
|
|
34
|
+
// copied into the task, so the manager needs the log itself, not just the task store.
|
|
35
|
+
...(ctx.store !== undefined ? { store: ctx.store } : {}),
|
|
36
|
+
});
|
|
37
|
+
// Load prior-process task records so reconcile (triggered on first run via
|
|
38
|
+
// session.reconcileSubagents) can reclassify any that were left non-terminal.
|
|
39
|
+
await manager.loadFromDisk();
|
|
40
|
+
},
|
|
41
|
+
// Only releases the event subscription taken in `openSession`. Running tasks are
|
|
42
|
+
// deliberately NOT stopped here: closing a session releases resources, it does not cancel
|
|
43
|
+
// work, and `attach` is last-writer-wins anyway.
|
|
44
|
+
closeSession: () => {
|
|
45
|
+
manager.detachRuntime();
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Disk sessions co-locate the task store under their home dir; every other
|
|
50
|
+
* backend persists task status through KV state. No store → no persistence (in-memory only). */
|
|
51
|
+
function makeTaskPersistence(store) {
|
|
52
|
+
if (store === undefined)
|
|
53
|
+
return undefined;
|
|
54
|
+
const dir = store.storageDir?.();
|
|
55
|
+
return dir !== undefined ? new DiskBackgroundTaskPersistence(dir) : new StoreBackgroundTaskPersistence(store);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type { EventSink } from "../../events/index.ts";
|
|
2
|
+
import type { SteerBus } from "../../loop/steer.ts";
|
|
3
|
+
import { type SessionStore } from "../../store/index.ts";
|
|
4
|
+
import type { AttachedOutcome, AttachedRunOptions, BackgroundSpawner, CommandStarter, ProcessSpawnOptions, QuestionSpawnOptions } from "../../tool/background.ts";
|
|
5
|
+
import type { ToolResult } from "../../tool/types.ts";
|
|
6
|
+
import { type BackgroundTaskPersistence } from "./persist.ts";
|
|
7
|
+
import { isBackgroundTaskTerminal, type BackgroundTask, type BackgroundTaskInfo, type BackgroundTaskOutputDelta, type BackgroundTaskOutputSnapshot } from "./task.ts";
|
|
8
|
+
export type { BackgroundTaskOutputDelta, BackgroundTaskOutputSnapshot } from "./task.ts";
|
|
9
|
+
export interface BackgroundManagerOptions {
|
|
10
|
+
readonly maxRunningTasks?: number;
|
|
11
|
+
readonly now?: () => number;
|
|
12
|
+
}
|
|
13
|
+
export interface BackgroundManagerRuntime {
|
|
14
|
+
readonly steer?: SteerBus;
|
|
15
|
+
readonly events?: EventSink;
|
|
16
|
+
readonly sessionId?: string;
|
|
17
|
+
readonly address?: string;
|
|
18
|
+
/** Durable per-task status store. Absent → the manager runs purely in memory (no reconcile
|
|
19
|
+
* across process restarts), matching a session with no durable store. */
|
|
20
|
+
readonly persistence?: BackgroundTaskPersistence;
|
|
21
|
+
/** The session's append log, for reading shard-backed output (a sub-agent's conversation).
|
|
22
|
+
* Absent → shard locations cannot be served and say so, which is the honest answer for a
|
|
23
|
+
* storeless session: nothing was persisted to read back. */
|
|
24
|
+
readonly store?: SessionStore;
|
|
25
|
+
}
|
|
26
|
+
export declare class BackgroundManager implements BackgroundSpawner {
|
|
27
|
+
private readonly tasks;
|
|
28
|
+
private readonly detachControllers;
|
|
29
|
+
private readonly ghosts;
|
|
30
|
+
private readonly redelivered;
|
|
31
|
+
private readonly maxRunningTasks?;
|
|
32
|
+
private readonly now;
|
|
33
|
+
private steer?;
|
|
34
|
+
private events?;
|
|
35
|
+
private sessionId;
|
|
36
|
+
private address;
|
|
37
|
+
private persistence?;
|
|
38
|
+
private store?;
|
|
39
|
+
private unsubscribeConsumption?;
|
|
40
|
+
/** Serialize the whole task store, including the KV backend's shared task index. */
|
|
41
|
+
private persistenceChain;
|
|
42
|
+
constructor(options?: BackgroundManagerOptions);
|
|
43
|
+
attach(runtime: BackgroundManagerRuntime): void;
|
|
44
|
+
/** Undo `attach`'s subscription. (Not `detach` — that one moves a tool call to the
|
|
45
|
+
* background and is part of the spawner surface.) */
|
|
46
|
+
detachRuntime(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Load persisted task records for this session (called on reopen, before `reconcile`).
|
|
49
|
+
* Records whose id is already a live task in this process are skipped — live always wins.
|
|
50
|
+
*/
|
|
51
|
+
loadFromDisk(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Reclassify orphaned tasks — a non-terminal ghost means the process that spawned it exited
|
|
54
|
+
* without writing a terminal status, so it is dead → `lost`. Writes the terminal status back
|
|
55
|
+
* (idempotent: `lost` is itself terminal, so a later reopen skips it) and emits a terminated
|
|
56
|
+
* event. Call after `loadFromDisk` on session reopen. Returns the reclassified records.
|
|
57
|
+
*/
|
|
58
|
+
reconcile(): Promise<readonly BackgroundTaskInfo[]>;
|
|
59
|
+
spawnCommand(start: CommandStarter, command: string, description: string, options?: ProcessSpawnOptions): string;
|
|
60
|
+
spawnQuestion(run: (signal: AbortSignal) => Promise<ToolResult>, description: string, options: QuestionSpawnOptions): {
|
|
61
|
+
readonly taskId: string;
|
|
62
|
+
readonly status: string;
|
|
63
|
+
};
|
|
64
|
+
registerDetachable(toolCallId: string): AbortSignal;
|
|
65
|
+
unregisterDetachable(toolCallId: string): void;
|
|
66
|
+
detach(toolCallId: string): boolean;
|
|
67
|
+
runCommandAttached(start: CommandStarter, command: string, description: string, options: AttachedRunOptions): Promise<AttachedOutcome>;
|
|
68
|
+
/**
|
|
69
|
+
* Drive a task attached to the foreground, racing its settlement against a detach trigger.
|
|
70
|
+
* Owns the ONE controller both phases use: while attached it is bridged from
|
|
71
|
+
* `foregroundSignal` (abort → kill) and an optional foreground timeout; on detach the bridge
|
|
72
|
+
* is dropped (so the turn ending can't kill the now-background process) and the SAME
|
|
73
|
+
* controller is handed to the manager so BackgroundStop still works.
|
|
74
|
+
*/
|
|
75
|
+
private runAttached;
|
|
76
|
+
/**
|
|
77
|
+
* Adopt an already-running task (started by `runAttached`) into the managed set, reusing its
|
|
78
|
+
* existing abort controller and swapping the sink downstream to this manager. Does NOT call
|
|
79
|
+
* `task.start` (already running) and intentionally bypasses the running-task cap: detaching
|
|
80
|
+
* promotes work that is already executing, it does not start new work.
|
|
81
|
+
*/
|
|
82
|
+
private adoptRunning;
|
|
83
|
+
registerTask(task: BackgroundTask): string;
|
|
84
|
+
/** The durable projection of a task. The output's address comes from the task itself and is
|
|
85
|
+
* never reconstructed from an id. */
|
|
86
|
+
private toPersisted;
|
|
87
|
+
/** Queue a snapshot behind every earlier write. This prevents a slow `running` write from
|
|
88
|
+
* landing after a terminal snapshot, and prevents concurrent KV index updates losing ids. */
|
|
89
|
+
private enqueuePersist;
|
|
90
|
+
/** Capture the next monotonic revision before placing it on the persistence queue. */
|
|
91
|
+
private persistLive;
|
|
92
|
+
private assertCanRegister;
|
|
93
|
+
/** Background status is metadata, never a result store. Every non-question task must point
|
|
94
|
+
* at exactly one authoritative durable output location before it can enter the registry. */
|
|
95
|
+
private assertDurableOutput;
|
|
96
|
+
private activeTaskCount;
|
|
97
|
+
getTask(taskId: string): BackgroundTaskInfo | undefined;
|
|
98
|
+
/** Find the task spawned by one assistant tool call. `toolCallId` is provider-scoped, so the
|
|
99
|
+
* parent conversation address is part of the identity. Used internally by cold recovery;
|
|
100
|
+
* model-facing reads continue to use the stable task id via BackgroundOutput. */
|
|
101
|
+
findByOrigin(parentAddress: string, toolCallId: string): BackgroundTaskInfo | undefined;
|
|
102
|
+
list(activeOnly?: boolean, limit?: number): BackgroundTaskInfo[];
|
|
103
|
+
/**
|
|
104
|
+
* A bounded WINDOW onto a task's output, plus the truth about how much it is a window of.
|
|
105
|
+
* Never the whole thing: `sizeBytes` says how much exists, `truncated` admits the
|
|
106
|
+
* rest was dropped, and the location says where the complete record lives.
|
|
107
|
+
*
|
|
108
|
+
* Dispatch is on WHERE the output lives, not on what kind of task produced it — a file gets
|
|
109
|
+
* a byte window and a shard gets its durable record reduced to a useful preview. A question
|
|
110
|
+
* has no output location — its answer rides on the task record itself — so it is served
|
|
111
|
+
* from there: the settle notification truncates a long answer and points here for the rest.
|
|
112
|
+
*/
|
|
113
|
+
readOutput(taskId: string, maxBytes?: number): Promise<BackgroundTaskOutputSnapshot>;
|
|
114
|
+
/**
|
|
115
|
+
* A sub-agent's output, read back from its own conversation shard.
|
|
116
|
+
*
|
|
117
|
+
* The shard is the record — the same one the projection folds for a UI — so this reads it
|
|
118
|
+
* rather than keeping a copy. It works on a RUNNING agent too: its messages are appended as
|
|
119
|
+
* the run proceeds, so the latest answer is whatever it has said so far, not a blank until
|
|
120
|
+
* the run settles.
|
|
121
|
+
*/
|
|
122
|
+
private conversationSnapshot;
|
|
123
|
+
/**
|
|
124
|
+
* A workflow run, rendered from its journal.
|
|
125
|
+
*
|
|
126
|
+
* The journal is the run's whole story in append order — inputs, each agent starting and
|
|
127
|
+
* returning, the script's own `log()` lines, failures, and the outcome — so this reads it
|
|
128
|
+
* rather than keeping a parallel copy of the progress stream. It answers for a RUNNING run
|
|
129
|
+
* too: entries land as each step completes, so "where is it up to" is just the story so far.
|
|
130
|
+
*/
|
|
131
|
+
private workflowRunSnapshot;
|
|
132
|
+
/** A task with no live entry: its location, if any, outlived the process that ran it. */
|
|
133
|
+
private ghostOutputSnapshot;
|
|
134
|
+
/**
|
|
135
|
+
* Everything appended since `cursor`, for a viewer that is following along — the shape
|
|
136
|
+
* a live panel needs, and the one that keeps a tick costing what was WRITTEN rather than
|
|
137
|
+
* what the task has produced in total.
|
|
138
|
+
*
|
|
139
|
+
* Only file-backed tasks can serve it: their output has a stable byte offset because the
|
|
140
|
+
* file keeps everything. Anything else is not followable and the caller falls back to a
|
|
141
|
+
* snapshot — for a shard-backed agent the better live view is the SessionProjection, which
|
|
142
|
+
* folds the same records the UI already subscribes to.
|
|
143
|
+
*/
|
|
144
|
+
readOutputDelta(taskId: string, cursor: number, maxBytes?: number): Promise<BackgroundTaskOutputDelta>;
|
|
145
|
+
suppressTerminalNotification(taskId: string): Promise<void>;
|
|
146
|
+
stop(taskId: string, reason?: string): Promise<BackgroundTaskInfo | undefined>;
|
|
147
|
+
stopAll(reason?: string): Promise<readonly BackgroundTaskInfo[]>;
|
|
148
|
+
wait(taskId: string, timeoutMs?: number): Promise<BackgroundTaskInfo | undefined>;
|
|
149
|
+
private settleTask;
|
|
150
|
+
private resolveWaiters;
|
|
151
|
+
private fireTerminalEffects;
|
|
152
|
+
private steerTerminal;
|
|
153
|
+
/**
|
|
154
|
+
* A finished question's answer.
|
|
155
|
+
*
|
|
156
|
+
* The ONE kind whose settle must carry its output. Every other kind's substance survives
|
|
157
|
+
* the notification: a command's bytes are in its log file, a subagent's final message is in
|
|
158
|
+
* its shard, a workflow's agent results are in its journal. A question's answer is the user
|
|
159
|
+
* SPEAKING — unreproducible, and held nowhere but this process's memory. Leaving it out of
|
|
160
|
+
* the settle would drop what the user said out of the conversation record entirely.
|
|
161
|
+
*
|
|
162
|
+
* Read straight off the task's own record — no buffer involved, so this stays synchronous
|
|
163
|
+
* and `steerTerminal` never has to await (awaiting would reopen the suppression race that
|
|
164
|
+
* going sync closed).
|
|
165
|
+
*/
|
|
166
|
+
private answeredQuestionOutput;
|
|
167
|
+
/**
|
|
168
|
+
* Open the ledger entry: a notification is owed from here until its `message.appended`
|
|
169
|
+
* confirms it. Deliberately written AFTER the enqueue, not before — the write is the slow
|
|
170
|
+
* part, and a crash between the two only costs a duplicate settle on reopen, whereas
|
|
171
|
+
* enqueueing after a failed write would cost a silent loss.
|
|
172
|
+
*/
|
|
173
|
+
private stampNotificationQueued;
|
|
174
|
+
/** Close it: the settle is in the recipient's conversation and will never need resending. */
|
|
175
|
+
private stampNotified;
|
|
176
|
+
private isTerminalNotificationSuppressed;
|
|
177
|
+
/** Steer a lost notification for a task reconciled on reopen, so the model learns its
|
|
178
|
+
* background work died with the previous process (the journaled tag is the settle record). */
|
|
179
|
+
private steerLost;
|
|
180
|
+
/**
|
|
181
|
+
* Resend a settle whose notification was queued but never confirmed — i.e. the process died
|
|
182
|
+
* in the window between the enqueue and the recipient consuming it.
|
|
183
|
+
*
|
|
184
|
+
* Output survival is stated by `outputRef`, not inferred from task kind. Files, conversation
|
|
185
|
+
* shards, and workflow journals all outlive this manager; an answered question is recovered
|
|
186
|
+
* from the task record itself.
|
|
187
|
+
*/
|
|
188
|
+
private steerUnconfirmed;
|
|
189
|
+
private emitStarted;
|
|
190
|
+
private emitTerminated;
|
|
191
|
+
private toInfo;
|
|
192
|
+
}
|
|
193
|
+
export { isBackgroundTaskTerminal };
|
|
194
|
+
//# sourceMappingURL=manager.d.ts.map
|