@namzu/sdk 69.4.0 → 71.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +161 -0
- package/dist/authorization/bare-repository.d.ts +21 -0
- package/dist/authorization/bare-repository.d.ts.map +1 -0
- package/dist/authorization/bare-repository.js +62 -0
- package/dist/authorization/bare-repository.js.map +1 -0
- package/dist/authorization/command-line.d.ts.map +1 -1
- package/dist/authorization/command-line.js +10 -3
- package/dist/authorization/command-line.js.map +1 -1
- package/dist/authorization/gate.d.ts +7 -0
- package/dist/authorization/gate.d.ts.map +1 -1
- package/dist/authorization/gate.js +4 -0
- package/dist/authorization/gate.js.map +1 -1
- package/dist/authorization/protected-paths.d.ts +24 -6
- package/dist/authorization/protected-paths.d.ts.map +1 -1
- package/dist/authorization/protected-paths.js +83 -10
- package/dist/authorization/protected-paths.js.map +1 -1
- package/dist/authorization/readonly-commands.d.ts +17 -5
- package/dist/authorization/readonly-commands.d.ts.map +1 -1
- package/dist/authorization/readonly-commands.js +77 -6
- package/dist/authorization/readonly-commands.js.map +1 -1
- package/dist/authorization/readonly-flags.d.ts.map +1 -1
- package/dist/authorization/readonly-flags.js +98 -0
- package/dist/authorization/readonly-flags.js.map +1 -1
- package/dist/authorization/shell-lexer.d.ts +15 -0
- package/dist/authorization/shell-lexer.d.ts.map +1 -1
- package/dist/authorization/shell-lexer.js +370 -2
- package/dist/authorization/shell-lexer.js.map +1 -1
- package/dist/authorization/shell-paths.d.ts.map +1 -1
- package/dist/authorization/shell-paths.js +276 -0
- package/dist/authorization/shell-paths.js.map +1 -1
- package/dist/authorization/shell-session-state.d.ts +47 -0
- package/dist/authorization/shell-session-state.d.ts.map +1 -0
- package/dist/authorization/shell-session-state.js +70 -0
- package/dist/authorization/shell-session-state.js.map +1 -0
- package/dist/authorization/shell-session.d.ts +9 -0
- package/dist/authorization/shell-session.d.ts.map +1 -0
- package/dist/authorization/shell-session.js +19 -0
- package/dist/authorization/shell-session.js.map +1 -0
- package/dist/authorization/skill-grant.d.ts.map +1 -1
- package/dist/authorization/skill-grant.js +1 -0
- package/dist/authorization/skill-grant.js.map +1 -1
- package/dist/compaction/extractor.d.ts.map +1 -1
- package/dist/compaction/extractor.js +2 -0
- package/dist/compaction/extractor.js.map +1 -1
- package/dist/compaction/hooks.d.ts +16 -0
- package/dist/compaction/hooks.d.ts.map +1 -1
- package/dist/compaction/hooks.js +26 -1
- package/dist/compaction/hooks.js.map +1 -1
- package/dist/compaction/manual.d.ts.map +1 -1
- package/dist/compaction/manual.js +6 -1
- package/dist/compaction/manual.js.map +1 -1
- package/dist/compaction/restore.d.ts.map +1 -1
- package/dist/compaction/restore.js +3 -2
- package/dist/compaction/restore.js.map +1 -1
- package/dist/config/runtime.d.ts +2 -0
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/runtime.js +7 -0
- package/dist/config/runtime.js.map +1 -1
- package/dist/connector/mcp/client.d.ts +7 -0
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +54 -4
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/connector/web/guarded-fetch.d.ts +30 -0
- package/dist/connector/web/guarded-fetch.d.ts.map +1 -1
- package/dist/connector/web/guarded-fetch.js +85 -0
- package/dist/connector/web/guarded-fetch.js.map +1 -1
- package/dist/connector/web/index.d.ts +1 -1
- package/dist/connector/web/index.d.ts.map +1 -1
- package/dist/connector/web/index.js +1 -1
- package/dist/connector/web/index.js.map +1 -1
- package/dist/connector/web/types.d.ts +8 -0
- package/dist/connector/web/types.d.ts.map +1 -1
- package/dist/constants/compaction/index.d.ts.map +1 -1
- package/dist/constants/compaction/index.js +1 -1
- package/dist/constants/compaction/index.js.map +1 -1
- package/dist/execution/code-runtime/worker-program.d.ts +1 -1
- package/dist/execution/code-runtime/worker-program.d.ts.map +1 -1
- package/dist/execution/code-runtime/worker-program.js +9 -5
- package/dist/execution/code-runtime/worker-program.js.map +1 -1
- package/dist/execution/local.d.ts.map +1 -1
- package/dist/execution/local.js +6 -1
- package/dist/execution/local.js.map +1 -1
- package/dist/peers/index.d.ts +2 -2
- package/dist/peers/index.d.ts.map +1 -1
- package/dist/peers/index.js +1 -1
- package/dist/peers/index.js.map +1 -1
- package/dist/peers/record.d.ts +74 -0
- package/dist/peers/record.d.ts.map +1 -1
- package/dist/peers/record.js +41 -1
- package/dist/peers/record.js.map +1 -1
- package/dist/peers/registry.d.ts.map +1 -1
- package/dist/peers/registry.js +20 -3
- package/dist/peers/registry.js.map +1 -1
- package/dist/plugin/bin-path.d.ts +41 -0
- package/dist/plugin/bin-path.d.ts.map +1 -0
- package/dist/plugin/bin-path.js +146 -0
- package/dist/plugin/bin-path.js.map +1 -0
- package/dist/plugin/common-layout/read.js +3 -3
- package/dist/plugin/common-layout/read.js.map +1 -1
- package/dist/plugin/common-layout-names.d.ts.map +1 -1
- package/dist/plugin/common-layout-names.js +0 -1
- package/dist/plugin/common-layout-names.js.map +1 -1
- package/dist/plugin/hook-module/capabilities.d.ts +12 -0
- package/dist/plugin/hook-module/capabilities.d.ts.map +1 -1
- package/dist/plugin/hook-module/capabilities.js +82 -10
- package/dist/plugin/hook-module/capabilities.js.map +1 -1
- package/dist/plugin/hook-module/consent.d.ts +11 -0
- package/dist/plugin/hook-module/consent.d.ts.map +1 -1
- package/dist/plugin/hook-module/consent.js +31 -0
- package/dist/plugin/hook-module/consent.js.map +1 -1
- package/dist/plugin/hook-module/host.d.ts.map +1 -1
- package/dist/plugin/hook-module/host.js +69 -23
- package/dist/plugin/hook-module/host.js.map +1 -1
- package/dist/plugin/hook-module/index.d.ts +1 -1
- package/dist/plugin/hook-module/index.d.ts.map +1 -1
- package/dist/plugin/hook-module/index.js +1 -1
- package/dist/plugin/hook-module/index.js.map +1 -1
- package/dist/plugin/hook-module/scan.d.ts +16 -0
- package/dist/plugin/hook-module/scan.d.ts.map +1 -1
- package/dist/plugin/hook-module/scan.js +68 -3
- package/dist/plugin/hook-module/scan.js.map +1 -1
- package/dist/plugin/hook-module/worker-source.d.ts +5 -4
- package/dist/plugin/hook-module/worker-source.d.ts.map +1 -1
- package/dist/plugin/hook-module/worker-source.js +254 -28
- package/dist/plugin/hook-module/worker-source.js.map +1 -1
- package/dist/plugin/lifecycle.d.ts +21 -0
- package/dist/plugin/lifecycle.d.ts.map +1 -1
- package/dist/plugin/lifecycle.js +64 -0
- package/dist/plugin/lifecycle.js.map +1 -1
- package/dist/plugin/shell-hook-tool-names.d.ts.map +1 -1
- package/dist/plugin/shell-hook-tool-names.js +1 -0
- package/dist/plugin/shell-hook-tool-names.js.map +1 -1
- package/dist/plugin/shell-hook.d.ts +1 -1
- package/dist/plugin/shell-hook.d.ts.map +1 -1
- package/dist/plugin/shell-hook.js +22 -4
- package/dist/plugin/shell-hook.js.map +1 -1
- package/dist/public-runtime.d.ts +11 -9
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +11 -8
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +7 -3
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +7 -3
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +2 -2
- package/dist/public-types.d.ts.map +1 -1
- package/dist/runtime/jobs/monitor-stream.d.ts +9 -1
- package/dist/runtime/jobs/monitor-stream.d.ts.map +1 -1
- package/dist/runtime/jobs/monitor-stream.js +13 -4
- package/dist/runtime/jobs/monitor-stream.js.map +1 -1
- package/dist/runtime/jobs/registry.d.ts +4 -0
- package/dist/runtime/jobs/registry.d.ts.map +1 -1
- package/dist/runtime/jobs/registry.js +12 -2
- package/dist/runtime/jobs/registry.js.map +1 -1
- package/dist/runtime/query/auto-review/git-status.d.ts.map +1 -1
- package/dist/runtime/query/auto-review/git-status.js +3 -2
- package/dist/runtime/query/auto-review/git-status.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +16 -6
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +135 -15
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +2 -2
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/outstanding-work.d.ts.map +1 -1
- package/dist/runtime/query/iteration/outstanding-work.js +14 -4
- package/dist/runtime/query/iteration/outstanding-work.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +11 -1
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts +2 -0
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +19 -8
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/path-escalation.d.ts +6 -0
- package/dist/runtime/query/path-escalation.d.ts.map +1 -1
- package/dist/runtime/query/path-escalation.js +58 -4
- package/dist/runtime/query/path-escalation.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts +21 -3
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +39 -21
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/runtime/query/steering.d.ts +11 -2
- package/dist/runtime/query/steering.d.ts.map +1 -1
- package/dist/runtime/query/steering.js +18 -4
- package/dist/runtime/query/steering.js.map +1 -1
- package/dist/sandbox/provider/local.d.ts.map +1 -1
- package/dist/sandbox/provider/local.js +3 -1
- package/dist/sandbox/provider/local.js.map +1 -1
- package/dist/schedules/describe.d.ts.map +1 -1
- package/dist/schedules/describe.js +2 -0
- package/dist/schedules/describe.js.map +1 -1
- package/dist/schedules/evaluate.d.ts +4 -0
- package/dist/schedules/evaluate.d.ts.map +1 -1
- package/dist/schedules/evaluate.js +26 -1
- package/dist/schedules/evaluate.js.map +1 -1
- package/dist/schedules/index.d.ts +3 -1
- package/dist/schedules/index.d.ts.map +1 -1
- package/dist/schedules/index.js +2 -1
- package/dist/schedules/index.js.map +1 -1
- package/dist/schedules/next-fire.d.ts.map +1 -1
- package/dist/schedules/next-fire.js +10 -0
- package/dist/schedules/next-fire.js.map +1 -1
- package/dist/schedules/spec.d.ts +9 -0
- package/dist/schedules/spec.d.ts.map +1 -1
- package/dist/schedules/spec.js +33 -0
- package/dist/schedules/spec.js.map +1 -1
- package/dist/schedules/types.d.ts +32 -4
- package/dist/schedules/types.d.ts.map +1 -1
- package/dist/schedules/types.js +3 -2
- package/dist/schedules/types.js.map +1 -1
- package/dist/schedules/watch.d.ts +23 -0
- package/dist/schedules/watch.d.ts.map +1 -0
- package/dist/schedules/watch.js +46 -0
- package/dist/schedules/watch.js.map +1 -0
- package/dist/session/workspace/git-worktree.d.ts.map +1 -1
- package/dist/session/workspace/git-worktree.js +2 -1
- package/dist/session/workspace/git-worktree.js.map +1 -1
- package/dist/skills/arguments.d.ts +58 -0
- package/dist/skills/arguments.d.ts.map +1 -0
- package/dist/skills/arguments.js +208 -0
- package/dist/skills/arguments.js.map +1 -0
- package/dist/skills/index.d.ts +3 -1
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +1 -0
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/inline-shell-host.d.ts +6 -0
- package/dist/skills/inline-shell-host.d.ts.map +1 -1
- package/dist/skills/inline-shell-host.js +8 -0
- package/dist/skills/inline-shell-host.js.map +1 -1
- package/dist/skills/inline-shell.d.ts +26 -1
- package/dist/skills/inline-shell.d.ts.map +1 -1
- package/dist/skills/inline-shell.js +1308 -22
- package/dist/skills/inline-shell.js.map +1 -1
- package/dist/tools/builtins/bash-cwd.d.ts.map +1 -1
- package/dist/tools/builtins/bash-cwd.js +2 -0
- package/dist/tools/builtins/bash-cwd.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +79 -11
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/exit-semantics.d.ts +6 -0
- package/dist/tools/builtins/exit-semantics.d.ts.map +1 -1
- package/dist/tools/builtins/exit-semantics.js +10 -0
- package/dist/tools/builtins/exit-semantics.js.map +1 -1
- package/dist/tools/builtins/glob.d.ts.map +1 -1
- package/dist/tools/builtins/glob.js +68 -13
- package/dist/tools/builtins/glob.js.map +1 -1
- package/dist/tools/builtins/grep.d.ts.map +1 -1
- package/dist/tools/builtins/grep.js +37 -12
- package/dist/tools/builtins/grep.js.map +1 -1
- package/dist/tools/builtins/index.d.ts +11 -0
- package/dist/tools/builtins/index.d.ts.map +1 -1
- package/dist/tools/builtins/index.js +14 -0
- package/dist/tools/builtins/index.js.map +1 -1
- package/dist/tools/builtins/job.js +1 -1
- package/dist/tools/builtins/job.js.map +1 -1
- package/dist/tools/builtins/monitor.d.ts +1 -1
- package/dist/tools/builtins/monitor.d.ts.map +1 -1
- package/dist/tools/builtins/monitor.js +4 -2
- package/dist/tools/builtins/monitor.js.map +1 -1
- package/dist/tools/builtins/notebook-cells.d.ts +31 -0
- package/dist/tools/builtins/notebook-cells.d.ts.map +1 -0
- package/dist/tools/builtins/notebook-cells.js +160 -0
- package/dist/tools/builtins/notebook-cells.js.map +1 -0
- package/dist/tools/builtins/notebook-edit.d.ts +8 -0
- package/dist/tools/builtins/notebook-edit.d.ts.map +1 -0
- package/dist/tools/builtins/notebook-edit.js +249 -0
- package/dist/tools/builtins/notebook-edit.js.map +1 -0
- package/dist/tools/builtins/notebook-guard.d.ts.map +1 -1
- package/dist/tools/builtins/notebook-guard.js +2 -1
- package/dist/tools/builtins/notebook-guard.js.map +1 -1
- package/dist/tools/builtins/push-notification.d.ts +49 -0
- package/dist/tools/builtins/push-notification.d.ts.map +1 -0
- package/dist/tools/builtins/push-notification.js +107 -0
- package/dist/tools/builtins/push-notification.js.map +1 -0
- package/dist/tools/builtins/read-file.d.ts.map +1 -1
- package/dist/tools/builtins/read-file.js +8 -3
- package/dist/tools/builtins/read-file.js.map +1 -1
- package/dist/tools/builtins/read-media.d.ts.map +1 -1
- package/dist/tools/builtins/read-media.js +2 -1
- package/dist/tools/builtins/read-media.js.map +1 -1
- package/dist/tools/builtins/read-render.d.ts.map +1 -1
- package/dist/tools/builtins/read-render.js +5 -3
- package/dist/tools/builtins/read-render.js.map +1 -1
- package/dist/tools/builtins/search-support.d.ts +6 -4
- package/dist/tools/builtins/search-support.d.ts.map +1 -1
- package/dist/tools/builtins/search-support.js +15 -3
- package/dist/tools/builtins/search-support.js.map +1 -1
- package/dist/tools/builtins/skill.d.ts.map +1 -1
- package/dist/tools/builtins/skill.js +30 -8
- package/dist/tools/builtins/skill.js.map +1 -1
- package/dist/tools/builtins/sleep-guard.d.ts +20 -0
- package/dist/tools/builtins/sleep-guard.d.ts.map +1 -1
- package/dist/tools/builtins/sleep-guard.js +125 -1
- package/dist/tools/builtins/sleep-guard.js.map +1 -1
- package/dist/tools/builtins/wait-for-job.js +1 -1
- package/dist/tools/builtins/wait-for-job.js.map +1 -1
- package/dist/tools/builtins/web.d.ts +2 -0
- package/dist/tools/builtins/web.d.ts.map +1 -1
- package/dist/tools/builtins/web.js +97 -3
- package/dist/tools/builtins/web.js.map +1 -1
- package/dist/tools/command-shell.d.ts +50 -0
- package/dist/tools/command-shell.d.ts.map +1 -1
- package/dist/tools/command-shell.js +145 -0
- package/dist/tools/command-shell.js.map +1 -1
- package/dist/tools/env-scrub.d.ts +2 -0
- package/dist/tools/env-scrub.d.ts.map +1 -1
- package/dist/tools/env-scrub.js +15 -1
- package/dist/tools/env-scrub.js.map +1 -1
- package/dist/tools/git-config-env.d.ts +55 -0
- package/dist/tools/git-config-env.d.ts.map +1 -0
- package/dist/tools/git-config-env.js +130 -0
- package/dist/tools/git-config-env.js.map +1 -0
- package/dist/tools/schedules/schedule-tool.d.ts +7 -0
- package/dist/tools/schedules/schedule-tool.d.ts.map +1 -1
- package/dist/tools/schedules/schedule-tool.js +72 -3
- package/dist/tools/schedules/schedule-tool.js.map +1 -1
- package/dist/tools/schedules/types.d.ts +38 -2
- package/dist/tools/schedules/types.d.ts.map +1 -1
- package/dist/types/connector/mcp.d.ts +24 -0
- package/dist/types/connector/mcp.d.ts.map +1 -1
- package/dist/types/message/index.d.ts +21 -1
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +37 -2
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/permission/index.d.ts +11 -2
- package/dist/types/permission/index.d.ts.map +1 -1
- package/dist/types/permission/index.js +12 -2
- package/dist/types/permission/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +10 -2
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/tool/index.d.ts +13 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/utils/plain-terminal-text.d.ts +21 -0
- package/dist/utils/plain-terminal-text.d.ts.map +1 -0
- package/dist/utils/plain-terminal-text.js +156 -0
- package/dist/utils/plain-terminal-text.js.map +1 -0
- package/package.json +1 -1
- package/src/authorization/bare-repository.ts +70 -0
- package/src/authorization/command-line.ts +18 -4
- package/src/authorization/gate.ts +11 -0
- package/src/authorization/protected-paths.ts +89 -10
- package/src/authorization/readonly-commands.ts +75 -6
- package/src/authorization/readonly-flags.ts +103 -0
- package/src/authorization/shell-lexer.ts +367 -2
- package/src/authorization/shell-paths.ts +386 -0
- package/src/authorization/shell-session-state.ts +97 -0
- package/src/authorization/shell-session.ts +23 -0
- package/src/authorization/skill-grant.ts +1 -0
- package/src/compaction/extractor.ts +1 -0
- package/src/compaction/hooks.ts +43 -1
- package/src/compaction/manual.ts +6 -0
- package/src/compaction/restore.ts +3 -2
- package/src/config/runtime.ts +7 -0
- package/src/connector/mcp/client.ts +61 -4
- package/src/connector/web/guarded-fetch.ts +92 -0
- package/src/connector/web/index.ts +6 -1
- package/src/connector/web/types.ts +8 -0
- package/src/constants/compaction/index.ts +1 -1
- package/src/execution/code-runtime/worker-program.ts +9 -5
- package/src/execution/local.ts +6 -1
- package/src/peers/index.ts +8 -2
- package/src/peers/record.ts +45 -1
- package/src/peers/registry.ts +21 -5
- package/src/plugin/bin-path.ts +149 -0
- package/src/plugin/common-layout/read.ts +3 -3
- package/src/plugin/common-layout-names.ts +0 -1
- package/src/plugin/hook-module/capabilities.ts +94 -10
- package/src/plugin/hook-module/consent.ts +36 -0
- package/src/plugin/hook-module/host.ts +72 -21
- package/src/plugin/hook-module/index.ts +2 -0
- package/src/plugin/hook-module/scan.ts +76 -4
- package/src/plugin/hook-module/worker-source.ts +255 -28
- package/src/plugin/lifecycle.ts +67 -0
- package/src/plugin/shell-hook-tool-names.ts +1 -0
- package/src/plugin/shell-hook.ts +23 -4
- package/src/public-runtime.ts +27 -0
- package/src/public-tools.ts +36 -2
- package/src/public-types.ts +3 -1
- package/src/runtime/jobs/monitor-stream.ts +18 -4
- package/src/runtime/jobs/registry.ts +22 -2
- package/src/runtime/query/auto-review/git-status.ts +3 -2
- package/src/runtime/query/executor.ts +153 -12
- package/src/runtime/query/index.ts +5 -2
- package/src/runtime/query/iteration/outstanding-work.ts +22 -4
- package/src/runtime/query/iteration/phases/compaction.ts +14 -1
- package/src/runtime/query/iteration/phases/tool-review.ts +24 -7
- package/src/runtime/query/path-escalation.ts +52 -4
- package/src/runtime/query/review-policy.ts +47 -15
- package/src/runtime/query/steering.ts +32 -4
- package/src/sandbox/provider/local.ts +3 -1
- package/src/schedules/describe.ts +2 -0
- package/src/schedules/evaluate.ts +29 -1
- package/src/schedules/index.ts +9 -1
- package/src/schedules/next-fire.ts +9 -0
- package/src/schedules/spec.ts +42 -0
- package/src/schedules/types.ts +33 -3
- package/src/schedules/watch.ts +71 -0
- package/src/session/workspace/git-worktree.ts +3 -1
- package/src/skills/arguments.ts +250 -0
- package/src/skills/index.ts +10 -0
- package/src/skills/inline-shell-host.ts +16 -0
- package/src/skills/inline-shell.ts +1358 -22
- package/src/tools/builtins/bash-cwd.ts +2 -0
- package/src/tools/builtins/bash.ts +93 -13
- package/src/tools/builtins/exit-semantics.ts +10 -0
- package/src/tools/builtins/glob.ts +79 -15
- package/src/tools/builtins/grep.ts +37 -10
- package/src/tools/builtins/index.ts +15 -0
- package/src/tools/builtins/job.ts +1 -1
- package/src/tools/builtins/monitor.ts +4 -2
- package/src/tools/builtins/notebook-cells.ts +196 -0
- package/src/tools/builtins/notebook-edit.ts +280 -0
- package/src/tools/builtins/notebook-guard.ts +2 -1
- package/src/tools/builtins/push-notification.ts +138 -0
- package/src/tools/builtins/read-file.ts +9 -3
- package/src/tools/builtins/read-media.ts +2 -1
- package/src/tools/builtins/read-render.ts +5 -3
- package/src/tools/builtins/search-support.ts +17 -3
- package/src/tools/builtins/skill.ts +29 -7
- package/src/tools/builtins/sleep-guard.ts +128 -1
- package/src/tools/builtins/wait-for-job.ts +1 -1
- package/src/tools/builtins/web.ts +100 -3
- package/src/tools/command-shell.ts +166 -0
- package/src/tools/env-scrub.ts +13 -1
- package/src/tools/git-config-env.ts +143 -0
- package/src/tools/schedules/schedule-tool.ts +79 -3
- package/src/tools/schedules/types.ts +47 -9
- package/src/types/connector/mcp.ts +25 -0
- package/src/types/message/index.ts +53 -1
- package/src/types/permission/index.ts +20 -3
- package/src/types/plugin/index.ts +10 -2
- package/src/types/tool/index.ts +13 -0
- package/src/utils/plain-terminal-text.ts +142 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { isAbsolute, join, resolve } from 'node:path';
|
|
3
3
|
import { unknownProgramInLine } from '../../authorization/program.js';
|
|
4
|
+
import { withShellSession } from '../../authorization/shell-session-state.js';
|
|
4
5
|
import { compileSkillGrant } from '../../authorization/skill-grant.js';
|
|
5
6
|
import { extractFromToolCall, extractFromToolResult } from '../../compaction/extractor.js';
|
|
6
7
|
import { recordRestorable } from '../../compaction/restore.js';
|
|
@@ -38,7 +39,8 @@ import { formatFailedToolOutput, hookNote, isUnregistered, prepareDirectCall, ru
|
|
|
38
39
|
import { describeVisibleFileEvidence, visibleFileEvidence, } from './file-evidence-context.js';
|
|
39
40
|
import { seedObservationLedger } from './file-evidence-seed.js';
|
|
40
41
|
import { DEFAULT_TOOL_RESULT_GUARDRAILS } from './guardrail-presets.js';
|
|
41
|
-
import { declaredWriteEscalation, shellEscalations } from './path-escalation.js';
|
|
42
|
+
import { declaredWriteEscalation, protectedRoots, shellEscalations } from './path-escalation.js';
|
|
43
|
+
import { CLASSIFY_NESTED_REFUSAL, allowedCallTooWide } from './review-policy.js';
|
|
42
44
|
import { savedPresentation } from './saved-presentation.js';
|
|
43
45
|
import { ToolCallBudget, assertMaxToolCalls } from './tool-call-budget.js';
|
|
44
46
|
import { DEFAULT_MAX_TOOL_OUTPUT_CHARS, DEFAULT_MAX_TOOL_OUTPUT_CHARS_PER_MESSAGE, applyToolOutputBudget, describeDroppedContent, fitResultsToMessageBudget, measureContentBytes, } from './tool-output-budget.js';
|
|
@@ -290,6 +292,8 @@ export function denialOutcome(reason, declined) {
|
|
|
290
292
|
export function deniedToolOutput(toolName, reason) {
|
|
291
293
|
return `Error: Tool "${toolName}" was not executed. ${reason}`;
|
|
292
294
|
}
|
|
295
|
+
/** Added directories already warned about in this process. */
|
|
296
|
+
const warnedProtectedDirectories = new Set();
|
|
293
297
|
export class ToolExecutor {
|
|
294
298
|
/** The recovery routes this turn actually has, so a pointer never names a missing tool. */
|
|
295
299
|
recoveryRoutes() {
|
|
@@ -339,6 +343,21 @@ export class ToolExecutor {
|
|
|
339
343
|
this.emitEvent = emitEvent;
|
|
340
344
|
this.log = log;
|
|
341
345
|
this.probes = probes;
|
|
346
|
+
this.warnProtectedAddedDirectories();
|
|
347
|
+
}
|
|
348
|
+
/** Tell the operator once per folder that an added directory is itself protected. */
|
|
349
|
+
warnProtectedAddedDirectories() {
|
|
350
|
+
const added = this.config.additionalDirectories;
|
|
351
|
+
if (added === undefined || added.length === 0)
|
|
352
|
+
return;
|
|
353
|
+
for (const directory of protectedRoots(added)) {
|
|
354
|
+
if (warnedProtectedDirectories.has(directory))
|
|
355
|
+
continue;
|
|
356
|
+
warnedProtectedDirectories.add(directory);
|
|
357
|
+
this.log.warn('An added directory is a protected folder, so writes in it are asked about', {
|
|
358
|
+
'namzu.runtime.added_directory': directory,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
342
361
|
}
|
|
343
362
|
setWorkingStateManager(manager) {
|
|
344
363
|
this.workingStateManager = manager;
|
|
@@ -715,12 +734,43 @@ export class ToolExecutor {
|
|
|
715
734
|
},
|
|
716
735
|
};
|
|
717
736
|
}
|
|
737
|
+
/**
|
|
738
|
+
* The host folder this session's next shell command starts in, for the
|
|
739
|
+
* read-only decision on a git line. Undefined inside a sandbox, whose files
|
|
740
|
+
* are not this host's.
|
|
741
|
+
*/
|
|
742
|
+
shellDirectory() {
|
|
743
|
+
if (this.sandboxed)
|
|
744
|
+
return undefined;
|
|
745
|
+
try {
|
|
746
|
+
return effectiveBashWorkingDirectory(this.config.sessionId, this.config.workingDirectory, {
|
|
747
|
+
sandboxed: false,
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
catch {
|
|
751
|
+
return undefined;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
718
754
|
resolvePermissionMode() {
|
|
719
755
|
const configured = this.config.permissionMode;
|
|
720
756
|
return typeof configured === 'function' ? configured() : configured;
|
|
721
757
|
}
|
|
722
|
-
|
|
758
|
+
// Every line a call reads, to decide on it or to run it, is read with what
|
|
759
|
+
// earlier lines of this session declared: see `shell-session-state.ts`.
|
|
723
760
|
evaluatePreparedAuthorization(toolName, input) {
|
|
761
|
+
return withShellSession(this.config.sessionId, () => this.evaluatePreparedAuthorizationIn(toolName, input), this.shellDirectory());
|
|
762
|
+
}
|
|
763
|
+
prepareBatchForReview(...args) {
|
|
764
|
+
return withShellSession(this.config.sessionId, () => this.prepareBatchForReviewIn(...args), this.shellDirectory());
|
|
765
|
+
}
|
|
766
|
+
reprepareBatchForReview(...args) {
|
|
767
|
+
return withShellSession(this.config.sessionId, () => this.reprepareBatchForReviewIn(...args), this.shellDirectory());
|
|
768
|
+
}
|
|
769
|
+
executeBatch(...args) {
|
|
770
|
+
return withShellSession(this.config.sessionId, () => this.executeBatchIn(...args), this.shellDirectory());
|
|
771
|
+
}
|
|
772
|
+
/** Evaluate the turn's operator policy against one already-prepared value. */
|
|
773
|
+
evaluatePreparedAuthorizationIn(toolName, input) {
|
|
724
774
|
return this.config.authorizationGate?.evaluate({
|
|
725
775
|
toolName,
|
|
726
776
|
toolInput: input,
|
|
@@ -755,7 +805,7 @@ export class ToolExecutor {
|
|
|
755
805
|
* The returned projection is what policy and a human review; execution later
|
|
756
806
|
* consumes the registry-owned preparations rather than parsing again.
|
|
757
807
|
*/
|
|
758
|
-
async
|
|
808
|
+
async prepareBatchForReviewIn(response, hostModifiedCallIds) {
|
|
759
809
|
assertUniqueToolCallIds(response.message.toolCalls ?? []);
|
|
760
810
|
if ((response.message.toolCalls ?? []).length > 0)
|
|
761
811
|
await this.awaitSandbox();
|
|
@@ -1028,7 +1078,7 @@ export class ToolExecutor {
|
|
|
1028
1078
|
return unknownProgramInLine(value, dialect);
|
|
1029
1079
|
}
|
|
1030
1080
|
/** Re-prepare only calls whose raw input a reviewer actually changed. */
|
|
1031
|
-
async
|
|
1081
|
+
async reprepareBatchForReviewIn(response, previous, changedCallIds) {
|
|
1032
1082
|
assertUniqueToolCallIds(response.message.toolCalls ?? []);
|
|
1033
1083
|
if (!this.preparedBatches.has(previous)) {
|
|
1034
1084
|
throw new Error('Prepared tool batch is not owned by this executor.');
|
|
@@ -1085,7 +1135,7 @@ export class ToolExecutor {
|
|
|
1085
1135
|
this.preparedBatches.add(batch);
|
|
1086
1136
|
return batch;
|
|
1087
1137
|
}
|
|
1088
|
-
async
|
|
1138
|
+
async executeBatchIn(response, denials, prior, preparedBatch, declines, review, detach) {
|
|
1089
1139
|
const toolCalls = response.message.toolCalls;
|
|
1090
1140
|
if (!toolCalls) {
|
|
1091
1141
|
return { messages: [], results: [], observations: [] };
|
|
@@ -1670,13 +1720,32 @@ export class ToolExecutor {
|
|
|
1670
1720
|
// The mode the turn is decided under answers a nested call as it answers the same
|
|
1671
1721
|
// call made directly: the tool that made this one reads, so the policy never saw it.
|
|
1672
1722
|
// Asked only when there is a mode to answer to: with none, the call is decided as before.
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1723
|
+
// Asked again right before the call starts (below), because a hook or the person can
|
|
1724
|
+
// change the mode while the earlier steps wait.
|
|
1725
|
+
const askMode = () => {
|
|
1726
|
+
const mode = this.config.reviewMode?.();
|
|
1727
|
+
return mode === undefined
|
|
1728
|
+
? undefined
|
|
1729
|
+
: nestedCallModeRefusal(mode, {
|
|
1730
|
+
readOnly: isTrustedReadOnly(nestedTool, preparedInput, this.toolSource(name)),
|
|
1731
|
+
allowedByRule: gateResult?.decision === 'allow' && gateResult.matchedRule !== null,
|
|
1732
|
+
ruleTooWide: gateResult?.decision === 'allow' &&
|
|
1733
|
+
allowedCallTooWide({
|
|
1734
|
+
name,
|
|
1735
|
+
tool: nestedTool,
|
|
1736
|
+
input: preparedInput,
|
|
1737
|
+
allowRule: gateResult.matchedRule,
|
|
1738
|
+
}),
|
|
1739
|
+
});
|
|
1740
|
+
};
|
|
1741
|
+
const modeRefusal = askMode();
|
|
1742
|
+
// A model loaded the text that made this call, and auto mode would have sent the call
|
|
1743
|
+
// to its reviewer: it is not run and not a failure. The model is asked to make the call
|
|
1744
|
+
// itself (see `ToolDispatchOptions.handOff`), where the reviewer does see it. A rule's
|
|
1745
|
+
// deny still fails the load, and so does every other mode's refusal.
|
|
1746
|
+
const handedOff = options?.handOff === true &&
|
|
1747
|
+
modeRefusal === CLASSIFY_NESTED_REFUSAL &&
|
|
1748
|
+
gateResult?.decision !== 'deny';
|
|
1680
1749
|
const runGranted = modeRefusal === undefined &&
|
|
1681
1750
|
gateResult?.decision === 'review' &&
|
|
1682
1751
|
gateResult.matchedRule === null &&
|
|
@@ -1685,7 +1754,19 @@ export class ToolExecutor {
|
|
|
1685
1754
|
needsApproval ||
|
|
1686
1755
|
modeRefusal !== undefined ||
|
|
1687
1756
|
(gateResult && gateResult.decision !== 'allow' && !runGranted)) {
|
|
1688
|
-
|
|
1757
|
+
// A hand-off still asks the caller's last word first: a guard that refuses the
|
|
1758
|
+
// command at load must not lose to the model's own call, which the classifier
|
|
1759
|
+
// decides without that guard. A refusal is the answer, and nothing is handed off.
|
|
1760
|
+
if (handedOff && options?.beforeRun) {
|
|
1761
|
+
const refusal = await options.beforeRun({ name, input: preparedInput, toolUseId: nestedId });
|
|
1762
|
+
signal.throwIfAborted();
|
|
1763
|
+
if (refusal !== undefined) {
|
|
1764
|
+
await progress.close();
|
|
1765
|
+
return { success: false, output: '', error: refusal };
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
const reason = modeRefusal !== undefined &&
|
|
1769
|
+
!(modeRefusal === CLASSIFY_NESTED_REFUSAL && gateResult?.decision === 'deny')
|
|
1689
1770
|
? `Blocked: ${modeRefusal}.`
|
|
1690
1771
|
: nestedEscalation
|
|
1691
1772
|
? 'Blocked: this nested call reaches a protected path, removal floor, outside-root boundary or another safety escalation. Call it directly so it can be reviewed.'
|
|
@@ -1693,7 +1774,9 @@ export class ToolExecutor {
|
|
|
1693
1774
|
? `Blocked: "${name}" requires the person's approval for every call, and an approval cannot be requested from inside another tool. Call it directly.`
|
|
1694
1775
|
: gateResult?.decision === 'deny'
|
|
1695
1776
|
? `Blocked by the authorization gate: ${gateResult.reason}`
|
|
1696
|
-
:
|
|
1777
|
+
: gateResult?.matchedRule === null
|
|
1778
|
+
? `Blocked by the authorization gate: this nested call requires an explicit allow rule because an operator review cannot be opened from inside another tool. ${gateResult.reason}`
|
|
1779
|
+
: `Blocked by the authorization gate: a rule or safety check asked for this call, an operator review cannot be opened from inside another tool, and no allow rule lifts that: call it directly so a person can review it. ${gateResult?.reason}`;
|
|
1697
1780
|
const output = deniedToolOutput(name, reason);
|
|
1698
1781
|
// Same fail-closed durability rule as a direct gate denial: if the
|
|
1699
1782
|
// configured session log cannot record the refusal, do not quietly carry
|
|
@@ -1726,7 +1809,12 @@ export class ToolExecutor {
|
|
|
1726
1809
|
outputLength: output.length,
|
|
1727
1810
|
...(via ? { via } : {}),
|
|
1728
1811
|
});
|
|
1729
|
-
return {
|
|
1812
|
+
return {
|
|
1813
|
+
success: false,
|
|
1814
|
+
output: '',
|
|
1815
|
+
error: reason,
|
|
1816
|
+
...(handedOff ? { data: { handedOff: true } } : {}),
|
|
1817
|
+
};
|
|
1730
1818
|
}
|
|
1731
1819
|
// A review approved the PARENT's escalation, as the parent's input
|
|
1732
1820
|
// showed it. A nested call is a different call nobody reviewed, so it
|
|
@@ -1800,6 +1888,32 @@ export class ToolExecutor {
|
|
|
1800
1888
|
});
|
|
1801
1889
|
return { success: false, output: '', error: message };
|
|
1802
1890
|
}
|
|
1891
|
+
// The mode is read once more, after the hooks and the veto had their time: a switch
|
|
1892
|
+
// to a stricter one in that window must still stop this call before it starts.
|
|
1893
|
+
const lateRefusal = askMode();
|
|
1894
|
+
if (lateRefusal !== undefined) {
|
|
1895
|
+
const message = `Blocked: ${lateRefusal}.`;
|
|
1896
|
+
if (this.config.recordAudit) {
|
|
1897
|
+
await this.config.recordAudit({
|
|
1898
|
+
what: { action: 'tool_call', tool: name },
|
|
1899
|
+
outcome: 'refused',
|
|
1900
|
+
reason: message,
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
await progress.close();
|
|
1904
|
+
await this.emitEvent({
|
|
1905
|
+
type: 'tool_completed',
|
|
1906
|
+
turnId: this.config.turnId,
|
|
1907
|
+
toolUseId: nestedId,
|
|
1908
|
+
toolName: name,
|
|
1909
|
+
result: deniedToolOutput(name, message),
|
|
1910
|
+
isError: true,
|
|
1911
|
+
durationMs: Date.now() - startedAt,
|
|
1912
|
+
outputLength: message.length,
|
|
1913
|
+
...(via ? { via } : {}),
|
|
1914
|
+
});
|
|
1915
|
+
return { success: false, output: '', error: message };
|
|
1916
|
+
}
|
|
1803
1917
|
let result;
|
|
1804
1918
|
try {
|
|
1805
1919
|
// Use the same deadline layer as a model-issued call. Calling the
|
|
@@ -1920,6 +2034,9 @@ export class ToolExecutor {
|
|
|
1920
2034
|
: {}),
|
|
1921
2035
|
abortSignal: this.config.abortSignal,
|
|
1922
2036
|
env: this.config.env,
|
|
2037
|
+
...(this.config.pluginManager && !this.config.sandbox
|
|
2038
|
+
? { pluginBinDirs: () => this.config.pluginManager?.enabledBinDirs() ?? [] }
|
|
2039
|
+
: {}),
|
|
1923
2040
|
log: (level, message) => this.log[level](message),
|
|
1924
2041
|
permissionContext: {
|
|
1925
2042
|
mode: this.batchMode ?? this.resolvePermissionMode(),
|
|
@@ -1994,6 +2111,9 @@ export class ToolExecutor {
|
|
|
1994
2111
|
: {}),
|
|
1995
2112
|
workingDirectory: this.config.workingDirectory,
|
|
1996
2113
|
env: this.config.env,
|
|
2114
|
+
...(this.config.pluginManager && !this.config.sandbox
|
|
2115
|
+
? { pathDirs: () => this.config.pluginManager?.enabledBinDirs() ?? [] }
|
|
2116
|
+
: {}),
|
|
1997
2117
|
...(this.config.sandbox?.spawnDetached
|
|
1998
2118
|
? {
|
|
1999
2119
|
spawn: (job) => this.config.sandbox.spawnDetached?.(sandboxShellSpawn(job.command).file, sandboxShellSpawn(job.command).args, {
|