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,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive-question contract, defined at tool altitude so tools can consume it
|
|
3
|
+
* from ToolRunContext without reaching up into permission/ (same pattern as
|
|
4
|
+
* BackgroundSpawner in background.ts). permission/'s Responder extends
|
|
5
|
+
* QuestionResponder, so a session responder threads down unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export interface QuestionOption {
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly description: string;
|
|
10
|
+
}
|
|
11
|
+
export interface QuestionItem {
|
|
12
|
+
readonly question: string;
|
|
13
|
+
readonly header: string;
|
|
14
|
+
readonly options: readonly QuestionOption[];
|
|
15
|
+
readonly multiSelect: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface QuestionRequest {
|
|
18
|
+
readonly turnId: string;
|
|
19
|
+
readonly toolCallId: string;
|
|
20
|
+
readonly questions: readonly QuestionItem[];
|
|
21
|
+
}
|
|
22
|
+
export type QuestionAnswerValue = string | readonly string[];
|
|
23
|
+
export type QuestionAnswers = Readonly<Record<string, QuestionAnswerValue>>;
|
|
24
|
+
export type QuestionAnswerMethod = "option" | "freeform" | "mixed" | (string & {});
|
|
25
|
+
export interface QuestionResponse {
|
|
26
|
+
readonly answers: QuestionAnswers;
|
|
27
|
+
readonly method?: QuestionAnswerMethod;
|
|
28
|
+
}
|
|
29
|
+
export type QuestionResult = QuestionResponse | QuestionAnswers | null;
|
|
30
|
+
/**
|
|
31
|
+
* The client channel for interactive questions. `requestQuestion` stays optional:
|
|
32
|
+
* a connected client that cannot render questions simply omits it, and tools fail
|
|
33
|
+
* soft with a "ask in text instead" result.
|
|
34
|
+
*/
|
|
35
|
+
export interface QuestionResponder {
|
|
36
|
+
requestQuestion?(request: QuestionRequest, options?: {
|
|
37
|
+
readonly signal?: AbortSignal;
|
|
38
|
+
}): Promise<QuestionResult>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=questions.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive-question contract, defined at tool altitude so tools can consume it
|
|
3
|
+
* from ToolRunContext without reaching up into permission/ (same pattern as
|
|
4
|
+
* BackgroundSpawner in background.ts). permission/'s Responder extends
|
|
5
|
+
* QuestionResponder, so a session responder threads down unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=questions.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Message } from "../../protocol/index.ts";
|
|
2
|
+
import type { Tool } from "../types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Project a complete execution registry to the tools currently available to
|
|
5
|
+
* the model. A load point is structural transcript state, not summary text:
|
|
6
|
+
*
|
|
7
|
+
* - `addedToolNames` activates newly searched tools.
|
|
8
|
+
* - a surviving assistant tool call keeps an already-used tool immediate.
|
|
9
|
+
* - full compaction unloads evidence removed with the compacted prefix.
|
|
10
|
+
* - micro compaction keeps these fields while replacing only result content.
|
|
11
|
+
*/
|
|
12
|
+
export declare function activeDeferredTools(tools: readonly Tool[], deferredToolNames: ReadonlySet<string>, messages: readonly Message[]): Tool[];
|
|
13
|
+
//# sourceMappingURL=activation.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project a complete execution registry to the tools currently available to
|
|
3
|
+
* the model. A load point is structural transcript state, not summary text:
|
|
4
|
+
*
|
|
5
|
+
* - `addedToolNames` activates newly searched tools.
|
|
6
|
+
* - a surviving assistant tool call keeps an already-used tool immediate.
|
|
7
|
+
* - full compaction unloads evidence removed with the compacted prefix.
|
|
8
|
+
* - micro compaction keeps these fields while replacing only result content.
|
|
9
|
+
*/
|
|
10
|
+
export function activeDeferredTools(tools, deferredToolNames, messages) {
|
|
11
|
+
if (deferredToolNames.size === 0)
|
|
12
|
+
return [...tools];
|
|
13
|
+
const activeDeferred = new Set();
|
|
14
|
+
for (const message of messages) {
|
|
15
|
+
if (message.role === "assistant") {
|
|
16
|
+
for (const part of message.content) {
|
|
17
|
+
if (part.type === "toolCall" && deferredToolNames.has(part.name)) {
|
|
18
|
+
activeDeferred.add(part.name);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else if (message.role === "toolResult") {
|
|
23
|
+
for (const name of message.addedToolNames ?? []) {
|
|
24
|
+
if (deferredToolNames.has(name))
|
|
25
|
+
activeDeferred.add(name);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return tools.filter((tool) => !deferredToolNames.has(tool.schema.name) || activeDeferred.has(tool.schema.name));
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=activation.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-agnostic tool-search core — the "one core" of deferred tool loading.
|
|
3
|
+
*
|
|
4
|
+
* When an agent has many tools (MCP / capability sprawl), most are marked
|
|
5
|
+
* *deferred*: kept in Operon's execution catalog but out of the model's active
|
|
6
|
+
* context. The model calls SearchTool to discover the few it needs; matches
|
|
7
|
+
* are recorded as `ToolResultMessage.addedToolNames`, and pi 0.81 handles the
|
|
8
|
+
* provider-specific transcript representation.
|
|
9
|
+
*
|
|
10
|
+
* This module holds only the pieces that don't depend on any provider: the
|
|
11
|
+
* keyword search, the query DSL,
|
|
12
|
+
* and query parsing. Transcript folding lives in the agent toolset.
|
|
13
|
+
*/
|
|
14
|
+
import type { ToolSchema } from "../../protocol/index.ts";
|
|
15
|
+
/** Provider-neutral name of the caller-supplied search tool. */
|
|
16
|
+
export declare const SEARCH_TOOL_NAME = "SearchTool";
|
|
17
|
+
/**
|
|
18
|
+
* Keyword search over deferred tool names + descriptions. Scoring uses name
|
|
19
|
+
* parts and the description only — `ToolSchema` carries no dedicated search
|
|
20
|
+
* hint field yet.
|
|
21
|
+
*
|
|
22
|
+
* Query forms:
|
|
23
|
+
* - `select:A,B,C` — direct multi-select by exact name (handled by the caller
|
|
24
|
+
* before this function; a bare exact name here also fast-paths).
|
|
25
|
+
* - `notebook jupyter` — keyword search.
|
|
26
|
+
* - `+slack send` — `+`-prefixed terms are required; the rest rank.
|
|
27
|
+
*/
|
|
28
|
+
export declare function searchDeferredTools(query: string, deferred: readonly ToolSchema[], maxResults?: number): string[];
|
|
29
|
+
/** Result of running the SearchTool query DSL against a deferred catalog. */
|
|
30
|
+
export interface SearchOutcome {
|
|
31
|
+
readonly matches: string[];
|
|
32
|
+
readonly queryType: "select" | "keyword";
|
|
33
|
+
}
|
|
34
|
+
/** Run the full query DSL (`select:` direct-select vs keyword search) against
|
|
35
|
+
* the deferred catalog. */
|
|
36
|
+
export declare function runSearchQuery(query: string, deferred: readonly ToolSchema[], maxResults?: number): SearchOutcome;
|
|
37
|
+
//# sourceMappingURL=deferral.d.ts.map
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/** Provider-neutral name of the caller-supplied search tool. */
|
|
2
|
+
export const SEARCH_TOOL_NAME = "SearchTool";
|
|
3
|
+
/** Split a tool name into searchable parts. Handles MCP tools
|
|
4
|
+
* (`mcp__server__action`) and CamelCase/underscore names. */
|
|
5
|
+
function parseToolName(name) {
|
|
6
|
+
if (name.startsWith("mcp__")) {
|
|
7
|
+
const withoutPrefix = name.replace(/^mcp__/, "").toLowerCase();
|
|
8
|
+
const parts = withoutPrefix.split("__").flatMap((p) => p.split("_"));
|
|
9
|
+
return {
|
|
10
|
+
parts: parts.filter(Boolean),
|
|
11
|
+
full: withoutPrefix.replace(/__/g, " ").replace(/_/g, " "),
|
|
12
|
+
isMcp: true,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const parts = name
|
|
16
|
+
.replace(/([a-z])([A-Z])/g, "$1 $2")
|
|
17
|
+
.replace(/_/g, " ")
|
|
18
|
+
.toLowerCase()
|
|
19
|
+
.split(/\s+/)
|
|
20
|
+
.filter(Boolean);
|
|
21
|
+
return { parts, full: parts.join(" "), isMcp: false };
|
|
22
|
+
}
|
|
23
|
+
function escapeRegExp(s) {
|
|
24
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
25
|
+
}
|
|
26
|
+
function compileTermPatterns(terms) {
|
|
27
|
+
const patterns = new Map();
|
|
28
|
+
for (const term of terms) {
|
|
29
|
+
if (!patterns.has(term))
|
|
30
|
+
patterns.set(term, new RegExp(`\\b${escapeRegExp(term)}\\b`));
|
|
31
|
+
}
|
|
32
|
+
return patterns;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Keyword search over deferred tool names + descriptions. Scoring uses name
|
|
36
|
+
* parts and the description only — `ToolSchema` carries no dedicated search
|
|
37
|
+
* hint field yet.
|
|
38
|
+
*
|
|
39
|
+
* Query forms:
|
|
40
|
+
* - `select:A,B,C` — direct multi-select by exact name (handled by the caller
|
|
41
|
+
* before this function; a bare exact name here also fast-paths).
|
|
42
|
+
* - `notebook jupyter` — keyword search.
|
|
43
|
+
* - `+slack send` — `+`-prefixed terms are required; the rest rank.
|
|
44
|
+
*/
|
|
45
|
+
export function searchDeferredTools(query, deferred, maxResults = 5) {
|
|
46
|
+
const queryLower = query.toLowerCase().trim();
|
|
47
|
+
// Fast path: exact name match (bare name instead of `select:` — seen from
|
|
48
|
+
// subagents / post-compaction). Selecting an already-loaded tool is harmless.
|
|
49
|
+
const exact = deferred.find((t) => t.name.toLowerCase() === queryLower);
|
|
50
|
+
if (exact)
|
|
51
|
+
return [exact.name];
|
|
52
|
+
// MCP prefix search (`mcp__server`).
|
|
53
|
+
if (queryLower.startsWith("mcp__") && queryLower.length > 5) {
|
|
54
|
+
const prefix = deferred
|
|
55
|
+
.filter((t) => t.name.toLowerCase().startsWith(queryLower))
|
|
56
|
+
.slice(0, maxResults)
|
|
57
|
+
.map((t) => t.name);
|
|
58
|
+
if (prefix.length > 0)
|
|
59
|
+
return prefix;
|
|
60
|
+
}
|
|
61
|
+
const queryTerms = queryLower.split(/\s+/).filter((t) => t.length > 0);
|
|
62
|
+
const requiredTerms = [];
|
|
63
|
+
const optionalTerms = [];
|
|
64
|
+
for (const term of queryTerms) {
|
|
65
|
+
if (term.startsWith("+") && term.length > 1)
|
|
66
|
+
requiredTerms.push(term.slice(1));
|
|
67
|
+
else
|
|
68
|
+
optionalTerms.push(term);
|
|
69
|
+
}
|
|
70
|
+
const scoringTerms = requiredTerms.length > 0 ? [...requiredTerms, ...optionalTerms] : queryTerms;
|
|
71
|
+
const patterns = compileTermPatterns(scoringTerms);
|
|
72
|
+
// Pre-filter to tools matching ALL required terms.
|
|
73
|
+
let candidates = deferred;
|
|
74
|
+
if (requiredTerms.length > 0) {
|
|
75
|
+
candidates = deferred.filter((tool) => {
|
|
76
|
+
const parsed = parseToolName(tool.name);
|
|
77
|
+
const desc = tool.description.toLowerCase();
|
|
78
|
+
return requiredTerms.every((term) => {
|
|
79
|
+
const pattern = patterns.get(term);
|
|
80
|
+
return (parsed.parts.includes(term) ||
|
|
81
|
+
parsed.parts.some((part) => part.includes(term)) ||
|
|
82
|
+
pattern.test(desc));
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const scored = candidates.map((tool) => {
|
|
87
|
+
const parsed = parseToolName(tool.name);
|
|
88
|
+
const desc = tool.description.toLowerCase();
|
|
89
|
+
let score = 0;
|
|
90
|
+
for (const term of scoringTerms) {
|
|
91
|
+
const pattern = patterns.get(term);
|
|
92
|
+
if (parsed.parts.includes(term))
|
|
93
|
+
score += parsed.isMcp ? 12 : 10;
|
|
94
|
+
else if (parsed.parts.some((part) => part.includes(term)))
|
|
95
|
+
score += parsed.isMcp ? 6 : 5;
|
|
96
|
+
if (parsed.full.includes(term) && score === 0)
|
|
97
|
+
score += 3;
|
|
98
|
+
if (pattern.test(desc))
|
|
99
|
+
score += 2;
|
|
100
|
+
}
|
|
101
|
+
return { name: tool.name, score };
|
|
102
|
+
});
|
|
103
|
+
return scored
|
|
104
|
+
.filter((item) => item.score > 0)
|
|
105
|
+
.sort((a, b) => b.score - a.score)
|
|
106
|
+
.slice(0, maxResults)
|
|
107
|
+
.map((item) => item.name);
|
|
108
|
+
}
|
|
109
|
+
/** Run the full query DSL (`select:` direct-select vs keyword search) against
|
|
110
|
+
* the deferred catalog. */
|
|
111
|
+
export function runSearchQuery(query, deferred, maxResults = 5) {
|
|
112
|
+
const selectMatch = query.match(/^select:(.+)$/i);
|
|
113
|
+
if (selectMatch) {
|
|
114
|
+
const requested = selectMatch[1]
|
|
115
|
+
.split(",")
|
|
116
|
+
.map((s) => s.trim())
|
|
117
|
+
.filter(Boolean);
|
|
118
|
+
const found = [];
|
|
119
|
+
for (const name of requested) {
|
|
120
|
+
const tool = deferred.find((t) => t.name === name) ?? deferred.find((t) => t.name.toLowerCase() === name.toLowerCase());
|
|
121
|
+
if (tool && !found.includes(tool.name))
|
|
122
|
+
found.push(tool.name);
|
|
123
|
+
}
|
|
124
|
+
return { matches: found, queryType: "select" };
|
|
125
|
+
}
|
|
126
|
+
return { matches: searchDeferredTools(query, deferred, maxResults), queryType: "keyword" };
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=deferral.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Tool } from "../types.ts";
|
|
2
|
+
import type { ToolSchema } from "../../protocol/index.ts";
|
|
3
|
+
/** Build the SearchTool over a snapshot of this turn's deferred catalog. The
|
|
4
|
+
* deferred names are listed in the description so the model knows what it can
|
|
5
|
+
* load. Names are sorted so the description stays byte-stable across turns
|
|
6
|
+
* (cacheable) while the deferred set is unchanged. (P1 moves this to
|
|
7
|
+
* diff-based `<available-deferred-tools>` announcements in history.) */
|
|
8
|
+
export declare function buildSearchTool(deferred: readonly ToolSchema[]): Tool;
|
|
9
|
+
//# sourceMappingURL=search-tool.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SearchTool builtin — the model-facing half of deferred tool loading.
|
|
3
|
+
*
|
|
4
|
+
* Built per turn over a snapshot of the deferred catalog (in `buildRunTools`),
|
|
5
|
+
* so it can search names/descriptions without needing the live tool registry
|
|
6
|
+
* at call time. Its result exposes matches through pi 0.81's
|
|
7
|
+
* `ToolResultMessage.addedToolNames`; pi materializes the provider-specific
|
|
8
|
+
* re-entry envelope.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { tool } from "../define.js";
|
|
12
|
+
import { ToolAccesses } from "../access.js";
|
|
13
|
+
import { SEARCH_TOOL_NAME, runSearchQuery } from "./deferral.js";
|
|
14
|
+
const SearchInput = z.object({
|
|
15
|
+
query: z
|
|
16
|
+
.string()
|
|
17
|
+
.describe('Query to find deferred tools. Use "select:<tool_name>" (comma-separated for multiple) for direct selection, or keywords to search. Prefix a term with "+" to require it.'),
|
|
18
|
+
max_results: z
|
|
19
|
+
.number()
|
|
20
|
+
.int()
|
|
21
|
+
.min(1)
|
|
22
|
+
.max(20)
|
|
23
|
+
.optional()
|
|
24
|
+
.describe("Maximum number of results to return (default 5)."),
|
|
25
|
+
});
|
|
26
|
+
const DESCRIPTION = `Fetches full schema definitions for deferred tools so they can be called.
|
|
27
|
+
|
|
28
|
+
Deferred tools appear by name in <available-deferred-tools> messages. Until fetched, only the name is known — there is no parameter schema, so the tool cannot be invoked. This tool matches your query against the deferred tool list and loads the matched tools' full definitions, after which they are callable exactly like the tools defined at the top of the prompt.
|
|
29
|
+
|
|
30
|
+
Query forms:
|
|
31
|
+
- "select:Read,Edit,Grep" — fetch these exact tools by name
|
|
32
|
+
- "notebook jupyter" — keyword search, up to max_results best matches
|
|
33
|
+
- "+slack send" — require "slack" in the name, rank by remaining terms`;
|
|
34
|
+
/** Build the SearchTool over a snapshot of this turn's deferred catalog. The
|
|
35
|
+
* deferred names are listed in the description so the model knows what it can
|
|
36
|
+
* load. Names are sorted so the description stays byte-stable across turns
|
|
37
|
+
* (cacheable) while the deferred set is unchanged. (P1 moves this to
|
|
38
|
+
* diff-based `<available-deferred-tools>` announcements in history.) */
|
|
39
|
+
export function buildSearchTool(deferred) {
|
|
40
|
+
const names = deferred.map((s) => s.name).sort((a, b) => a.localeCompare(b));
|
|
41
|
+
const description = `${DESCRIPTION}\n\n<available-deferred-tools>\n${names.join("\n")}\n</available-deferred-tools>`;
|
|
42
|
+
return tool({
|
|
43
|
+
name: SEARCH_TOOL_NAME,
|
|
44
|
+
description,
|
|
45
|
+
parameters: SearchInput,
|
|
46
|
+
approvalRule: SEARCH_TOOL_NAME,
|
|
47
|
+
accesses: ToolAccesses.none(),
|
|
48
|
+
execute: (args) => {
|
|
49
|
+
const { matches } = runSearchQuery(args.query, deferred, args.max_results ?? 5);
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: "text",
|
|
54
|
+
text: matches.length > 0 ? `Loaded tools: ${matches.join(", ")}` : "No matching deferred tools found.",
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
addedToolNames: matches,
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=search-tool.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const PROXY_ENV_VARS: readonly ["HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "NO_PROXY", "FTP_PROXY", "http_proxy", "https_proxy", "all_proxy", "no_proxy", "ftp_proxy"];
|
|
2
|
+
export interface NonInteractiveEnvOptions {
|
|
3
|
+
readonly shellPath: string;
|
|
4
|
+
readonly base?: NodeJS.ProcessEnv;
|
|
5
|
+
readonly extra?: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
export declare function nonInteractiveShellEnv(options: NonInteractiveEnvOptions): Record<string, string>;
|
|
8
|
+
export declare function proxyEnv(base?: NodeJS.ProcessEnv): Record<string, string>;
|
|
9
|
+
//# sourceMappingURL=shell-env.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const PROXY_ENV_VARS = [
|
|
2
|
+
"HTTP_PROXY",
|
|
3
|
+
"HTTPS_PROXY",
|
|
4
|
+
"ALL_PROXY",
|
|
5
|
+
"NO_PROXY",
|
|
6
|
+
"FTP_PROXY",
|
|
7
|
+
"http_proxy",
|
|
8
|
+
"https_proxy",
|
|
9
|
+
"all_proxy",
|
|
10
|
+
"no_proxy",
|
|
11
|
+
"ftp_proxy",
|
|
12
|
+
];
|
|
13
|
+
export function nonInteractiveShellEnv(options) {
|
|
14
|
+
const base = options.base ?? process.env;
|
|
15
|
+
const env = {
|
|
16
|
+
NO_COLOR: "1",
|
|
17
|
+
TERM: "dumb",
|
|
18
|
+
GIT_TERMINAL_PROMPT: base["GIT_TERMINAL_PROMPT"] ?? "0",
|
|
19
|
+
SHELL: options.shellPath,
|
|
20
|
+
};
|
|
21
|
+
if (options.extra)
|
|
22
|
+
Object.assign(env, options.extra);
|
|
23
|
+
return env;
|
|
24
|
+
}
|
|
25
|
+
export function proxyEnv(base = process.env) {
|
|
26
|
+
const out = {};
|
|
27
|
+
for (const name of PROXY_ENV_VARS) {
|
|
28
|
+
const value = base[name];
|
|
29
|
+
if (value !== undefined && value !== "")
|
|
30
|
+
out[name] = value;
|
|
31
|
+
}
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=shell-env.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advisory warnings for shell commands whose effects are hard or impossible to undo.
|
|
3
|
+
*
|
|
4
|
+
* PURELY INFORMATIONAL. Nothing here changes a permission decision — a matched pattern only
|
|
5
|
+
* adds a line to what the approver is shown. The reason to keep it out of the decision path is
|
|
6
|
+
* that these patterns are heuristics: `rm -rf ./build` matches the same rule as `rm -rf /`, and
|
|
7
|
+
* a heuristic that blocked would be wrong often enough to train people to click through.
|
|
8
|
+
*
|
|
9
|
+
* What it buys is the difference between reading `git push --force-with-lease origin main` and
|
|
10
|
+
* reading it with "may overwrite remote history" underneath. The command is right there either
|
|
11
|
+
* way; the warning is for the reader who is moving fast.
|
|
12
|
+
*
|
|
13
|
+
* Patterns stop at `;`, `&`, `|` and newlines where a following argument would matter, so a
|
|
14
|
+
* later command in the same line cannot supply the flag that triggers an earlier one's warning.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* A short "may …" clause for the approver, or undefined when nothing matched.
|
|
18
|
+
*
|
|
19
|
+
* Only the first match is reported. A command that trips three patterns is not three times as
|
|
20
|
+
* dangerous, and a wall of notes is read as noise — which is the failure mode this exists to
|
|
21
|
+
* avoid in the first place.
|
|
22
|
+
*/
|
|
23
|
+
export declare function destructiveWarning(command: string): string | undefined;
|
|
24
|
+
//# sourceMappingURL=bash-destructive.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advisory warnings for shell commands whose effects are hard or impossible to undo.
|
|
3
|
+
*
|
|
4
|
+
* PURELY INFORMATIONAL. Nothing here changes a permission decision — a matched pattern only
|
|
5
|
+
* adds a line to what the approver is shown. The reason to keep it out of the decision path is
|
|
6
|
+
* that these patterns are heuristics: `rm -rf ./build` matches the same rule as `rm -rf /`, and
|
|
7
|
+
* a heuristic that blocked would be wrong often enough to train people to click through.
|
|
8
|
+
*
|
|
9
|
+
* What it buys is the difference between reading `git push --force-with-lease origin main` and
|
|
10
|
+
* reading it with "may overwrite remote history" underneath. The command is right there either
|
|
11
|
+
* way; the warning is for the reader who is moving fast.
|
|
12
|
+
*
|
|
13
|
+
* Patterns stop at `;`, `&`, `|` and newlines where a following argument would matter, so a
|
|
14
|
+
* later command in the same line cannot supply the flag that triggers an earlier one's warning.
|
|
15
|
+
*/
|
|
16
|
+
/** Ordered: the first match wins, so more specific patterns come before broader ones. */
|
|
17
|
+
const DESTRUCTIVE_PATTERNS = [
|
|
18
|
+
// ── git: history and working-tree loss ──
|
|
19
|
+
{ pattern: /\bgit\s+reset\s+--hard\b/, warning: "may discard uncommitted changes" },
|
|
20
|
+
{
|
|
21
|
+
pattern: /\bgit\s+push\b[^;&|\n]*[ \t](--force\b|--force-with-lease\b|-f\b)/,
|
|
22
|
+
warning: "may overwrite remote history",
|
|
23
|
+
},
|
|
24
|
+
{ pattern: /\bgit\s+clean\b[^;&|\n]*[ \t]-[a-zA-Z]*[dfx]/, warning: "may permanently delete untracked files" },
|
|
25
|
+
{ pattern: /\bgit\s+checkout\s+(--\s+)?\.[ \t]*($|[;&|\n])/, warning: "may discard all working tree changes" },
|
|
26
|
+
{ pattern: /\bgit\s+restore\s+(--\s+)?\.[ \t]*($|[;&|\n])/, warning: "may discard all working tree changes" },
|
|
27
|
+
{ pattern: /\bgit\s+stash[ \t]+(drop|clear)\b/, warning: "may permanently remove stashed changes" },
|
|
28
|
+
{ pattern: /\bgit\s+branch\b[^;&|\n]*[ \t]-[a-zA-Z]*D\b/, warning: "may force-delete a branch" },
|
|
29
|
+
{ pattern: /\bgit\s+(commit|push|merge)\b[^;&|\n]*--no-verify\b/, warning: "may skip safety hooks" },
|
|
30
|
+
{ pattern: /\bgit\s+commit\b[^;&|\n]*--amend\b/, warning: "may rewrite the last commit" },
|
|
31
|
+
{ pattern: /\bgit\s+(rebase|filter-branch)\b/, warning: "may rewrite commit history" },
|
|
32
|
+
// ── filesystem ──
|
|
33
|
+
{ pattern: /(^|[;&|\n]\s*)rm\s+(-[a-zA-Z]*\s+)*-[a-zA-Z]*[rR][a-zA-Z]*f|(^|[;&|\n]\s*)rm\s+(-[a-zA-Z]*\s+)*-[a-zA-Z]*f[a-zA-Z]*[rR]/, warning: "may recursively force-remove files" },
|
|
34
|
+
{ pattern: /(^|[;&|\n]\s*)rm\s+(-[a-zA-Z]*\s+)*-[a-zA-Z]*[rR]/, warning: "may recursively remove files" },
|
|
35
|
+
{ pattern: /(^|[;&|\n]\s*)rm\s+(-[a-zA-Z]*\s+)*-[a-zA-Z]*f/, warning: "may force-remove files" },
|
|
36
|
+
{ pattern: /(^|[;&|\n]\s*)(chmod|chown)\s+(-[a-zA-Z]*\s+)*-[a-zA-Z]*R/, warning: "may recursively change permissions" },
|
|
37
|
+
{ pattern: /\bmkfs(\.\w+)?\b|\bdd\b[^;&|\n]*\bof=\/dev\//, warning: "may overwrite a raw device" },
|
|
38
|
+
// ── data stores ──
|
|
39
|
+
{ pattern: /\b(DROP|TRUNCATE)\s+(TABLE|DATABASE|SCHEMA)\b/i, warning: "may drop or truncate database objects" },
|
|
40
|
+
{ pattern: /\bDELETE\s+FROM\s+\w+[ \t]*(;|"|'|\n|$)/i, warning: "may delete all rows from a database table" },
|
|
41
|
+
{ pattern: /\bredis-cli\b[^;&|\n]*\bflush(all|db)\b/i, warning: "may erase the Redis keyspace" },
|
|
42
|
+
// ── infrastructure ──
|
|
43
|
+
{ pattern: /\bkubectl\s+delete\b/, warning: "may delete Kubernetes resources" },
|
|
44
|
+
{ pattern: /\bterraform\s+destroy\b/, warning: "may destroy Terraform infrastructure" },
|
|
45
|
+
{ pattern: /\bdocker\s+(system\s+prune|volume\s+rm)\b/, warning: "may delete Docker data" },
|
|
46
|
+
// ── publishing: not destructive locally, but not retractable either ──
|
|
47
|
+
{ pattern: /\bnpm\s+publish\b|\bpnpm\s+publish\b|\byarn\s+publish\b/, warning: "may publish a package publicly" },
|
|
48
|
+
];
|
|
49
|
+
/**
|
|
50
|
+
* A short "may …" clause for the approver, or undefined when nothing matched.
|
|
51
|
+
*
|
|
52
|
+
* Only the first match is reported. A command that trips three patterns is not three times as
|
|
53
|
+
* dangerous, and a wall of notes is read as noise — which is the failure mode this exists to
|
|
54
|
+
* avoid in the first place.
|
|
55
|
+
*/
|
|
56
|
+
export function destructiveWarning(command) {
|
|
57
|
+
for (const entry of DESTRUCTIVE_PATTERNS) {
|
|
58
|
+
if (entry.pattern.test(command))
|
|
59
|
+
return entry.warning;
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=bash-destructive.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface BashPathAccess {
|
|
2
|
+
readonly operation: "read" | "write";
|
|
3
|
+
/** Path exactly as written in the command — the caller resolves it against cwd. */
|
|
4
|
+
readonly path: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function extractBashPaths(command: string): BashPathAccess[];
|
|
7
|
+
//# sourceMappingURL=bash-paths.d.ts.map
|