@namzu/sdk 70.0.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 +117 -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.map +1 -1
- package/dist/authorization/protected-paths.js +46 -1
- 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 +108 -3
- 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/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 +1 -1
- 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/scan.d.ts +16 -0
- package/dist/plugin/hook-module/scan.d.ts.map +1 -1
- package/dist/plugin/hook-module/scan.js +67 -2
- package/dist/plugin/hook-module/scan.js.map +1 -1
- package/dist/plugin/hook-module/worker-source.d.ts.map +1 -1
- package/dist/plugin/hook-module/worker-source.js +56 -0
- 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 +8 -6
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +8 -5
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +6 -2
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +6 -2
- 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 +60 -5
- 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.map +1 -1
- package/dist/runtime/query/review-policy.js +4 -2
- 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.d.ts +17 -0
- package/dist/skills/inline-shell.d.ts.map +1 -1
- package/dist/skills/inline-shell.js +1232 -14
- 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 +28 -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/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 +6 -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 +45 -1
- package/src/authorization/readonly-commands.ts +75 -6
- package/src/authorization/readonly-flags.ts +103 -0
- package/src/authorization/shell-lexer.ts +126 -3
- 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/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 +1 -1
- package/src/plugin/common-layout-names.ts +0 -1
- package/src/plugin/hook-module/scan.ts +74 -2
- package/src/plugin/hook-module/worker-source.ts +56 -0
- 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 +21 -0
- package/src/public-tools.ts +32 -1
- 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 +79 -5
- 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 +5 -2
- 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.ts +1268 -14
- 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 +27 -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/plugin/index.ts +10 -2
- package/src/types/tool/index.ts +6 -0
- package/src/utils/plain-terminal-text.ts +142 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git configuration carried in the environment of a command.
|
|
3
|
+
*
|
|
4
|
+
* A folder that looks like a bare repository (`HEAD`, `objects/`, `refs/` and a
|
|
5
|
+
* `config` outside a `.git` folder) is read by git as a repository when git is
|
|
6
|
+
* started inside it, and its `config` can name a program for git to run
|
|
7
|
+
* (`core.fsmonitor`) before it prints anything. A model in a mode that allows
|
|
8
|
+
* edits can write such a folder, and a later read-only looking `git status`
|
|
9
|
+
* from inside it then runs that program. So every git a session starts is
|
|
10
|
+
* given the same three settings, through git's own `GIT_CONFIG_COUNT`
|
|
11
|
+
* variables, which beat a repository's `config`:
|
|
12
|
+
*
|
|
13
|
+
* - `safe.bareRepository=explicit`: git only treats a folder as a bare
|
|
14
|
+
* repository when it is named (`--git-dir=.`, `GIT_DIR`), never because the
|
|
15
|
+
* current folder happens to look like one.
|
|
16
|
+
* - `core.fsmonitor=` (empty): no file-system monitor program is started.
|
|
17
|
+
* - `core.hooksPath` (host-side calls only): no hook runs. The model's own
|
|
18
|
+
* commands keep their hooks, because a person's `pre-commit` is part of how
|
|
19
|
+
* the project wants commits made.
|
|
20
|
+
*
|
|
21
|
+
* The entries are appended after whatever `GIT_CONFIG_COUNT` the caller
|
|
22
|
+
* already set, so a caller's own entries survive and these win a key they
|
|
23
|
+
* share. Applying the helper twice changes nothing. A count git reads
|
|
24
|
+
* (`+1`, spaces around it) is honoured; one it cannot use is replaced, and the
|
|
25
|
+
* new entries go after the highest index already in the environment.
|
|
26
|
+
*
|
|
27
|
+
* git older than 2.31 ignores `GIT_CONFIG_COUNT`, and older than 2.38 does not
|
|
28
|
+
* know `safe.bareRepository`; there the helper is inert, not harmful.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/** One `key=value` pair of git configuration. */
|
|
32
|
+
export type GitConfigEntry = readonly [key: string, value: string]
|
|
33
|
+
|
|
34
|
+
/** The settings every git a session starts carries. */
|
|
35
|
+
export const SAFE_GIT_CONFIG: readonly GitConfigEntry[] = Object.freeze([
|
|
36
|
+
['safe.bareRepository', 'explicit'] as const,
|
|
37
|
+
['core.fsmonitor', ''] as const,
|
|
38
|
+
])
|
|
39
|
+
|
|
40
|
+
/** The null device git accepts as a hooks folder, so no hook runs. */
|
|
41
|
+
export function nullHooksPath(platform: NodeJS.Platform = process.platform): string {
|
|
42
|
+
return platform === 'win32' ? '\\\\.\\NUL' : '/dev/null'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The settings for git run by the host itself: the above, and no hooks. */
|
|
46
|
+
export function hostGitConfig(platform: NodeJS.Platform = process.platform): GitConfigEntry[] {
|
|
47
|
+
return [...SAFE_GIT_CONFIG, ['core.hooksPath', nullHooksPath(platform)] as const]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// A count past this is not a real list of settings; reading it as zero keeps a
|
|
51
|
+
// hostile value from making the helper loop.
|
|
52
|
+
const MAX_ENTRIES = 4096
|
|
53
|
+
|
|
54
|
+
function readCount(raw: string | undefined): number | undefined {
|
|
55
|
+
if (raw === undefined) return 0
|
|
56
|
+
// The forms git's own number reader accepts: a leading sign and spaces.
|
|
57
|
+
const m = /^\s*\+?(\d+)\s*$/.exec(raw)
|
|
58
|
+
if (m === null) return undefined
|
|
59
|
+
const n = Number(m[1])
|
|
60
|
+
return Number.isSafeInteger(n) && n <= MAX_ENTRIES ? n : undefined
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** One past the highest `GIT_CONFIG_KEY_<n>` or `GIT_CONFIG_VALUE_<n>` the env holds. */
|
|
64
|
+
function afterHighestIndex(env: Record<string, string | undefined>): number {
|
|
65
|
+
let next = 0
|
|
66
|
+
for (const k of Object.keys(env)) {
|
|
67
|
+
const m = /^GIT_CONFIG_(?:KEY|VALUE)_(\d{1,9})$/.exec(k)
|
|
68
|
+
if (m !== null) next = Math.max(next, Number(m[1]) + 1)
|
|
69
|
+
}
|
|
70
|
+
return next
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function findKey(env: Record<string, string | undefined>, name: string): string | undefined {
|
|
74
|
+
if (Object.hasOwn(env, name)) return name
|
|
75
|
+
const upper = name.toUpperCase()
|
|
76
|
+
return Object.keys(env).find((k) => k.toUpperCase() === upper)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Return a copy of `env` with `entries` appended to its git configuration.
|
|
81
|
+
* Never mutates its input.
|
|
82
|
+
*/
|
|
83
|
+
export function withGitConfig<E extends Record<string, string | undefined>>(
|
|
84
|
+
env: E,
|
|
85
|
+
entries: readonly GitConfigEntry[],
|
|
86
|
+
): E {
|
|
87
|
+
const out: Record<string, string | undefined> = { ...env }
|
|
88
|
+
const countKey = findKey(out, 'GIT_CONFIG_COUNT')
|
|
89
|
+
const parsed = readCount(countKey === undefined ? undefined : out[countKey])
|
|
90
|
+
// A count that cannot be read is not trusted, but the entries beside it are
|
|
91
|
+
// the caller's: start after them rather than over them.
|
|
92
|
+
const count = parsed ?? afterHighestIndex(out)
|
|
93
|
+
if (countKey !== undefined && countKey !== 'GIT_CONFIG_COUNT') delete out[countKey]
|
|
94
|
+
|
|
95
|
+
// The last value each key holds among the entries already there.
|
|
96
|
+
const last = new Map<string, string>()
|
|
97
|
+
for (let i = 0; i < count; i++) {
|
|
98
|
+
const k = out[`GIT_CONFIG_KEY_${i}`]
|
|
99
|
+
const v = out[`GIT_CONFIG_VALUE_${i}`]
|
|
100
|
+
if (k !== undefined && v !== undefined) last.set(k.toLowerCase(), v)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let next = count
|
|
104
|
+
for (const [key, value] of entries) {
|
|
105
|
+
if (last.get(key.toLowerCase()) === value) continue
|
|
106
|
+
out[`GIT_CONFIG_KEY_${next}`] = key
|
|
107
|
+
out[`GIT_CONFIG_VALUE_${next}`] = value
|
|
108
|
+
last.set(key.toLowerCase(), value)
|
|
109
|
+
next++
|
|
110
|
+
}
|
|
111
|
+
out.GIT_CONFIG_COUNT = String(next)
|
|
112
|
+
return out as E
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** `env` with the settings a command a model started carries. */
|
|
116
|
+
export function withSafeGitConfig<E extends Record<string, string | undefined>>(env: E): E {
|
|
117
|
+
return withGitConfig(env, SAFE_GIT_CONFIG)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** `env` with the full settings for git the host itself runs. */
|
|
121
|
+
export function withHostGitConfig<E extends Record<string, string | undefined>>(env: E): E {
|
|
122
|
+
return withGitConfig(env, hostGitConfig())
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* A copy of `base` (the process environment by default) with the full settings
|
|
127
|
+
* for git the host itself runs, for an `execFile('git', ...)` that names no
|
|
128
|
+
* environment of its own: `{ env: hostGitEnv() }`.
|
|
129
|
+
*/
|
|
130
|
+
export function hostGitEnv(base: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {
|
|
131
|
+
return withHostGitConfig({ ...base })
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** The program name without folder or Windows extension, lower case. */
|
|
135
|
+
function programName(command: string): string {
|
|
136
|
+
const base = command.split(/[\\/]/).pop() ?? command
|
|
137
|
+
return base.replace(/\.(exe|cmd|bat|com)$/i, '').toLowerCase()
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Whether `command` starts git itself rather than a shell or another program. */
|
|
141
|
+
export function isGitProgram(command: string): boolean {
|
|
142
|
+
return programName(command) === 'git'
|
|
143
|
+
}
|
|
@@ -52,7 +52,11 @@ const inputSchema = z.object({
|
|
|
52
52
|
script: z
|
|
53
53
|
.object({
|
|
54
54
|
body: z.string().min(1).describe('The exact script text, run verbatim once confirmed'),
|
|
55
|
-
shell: z
|
|
55
|
+
shell: z
|
|
56
|
+
.enum(['bash', 'sh', 'powershell'])
|
|
57
|
+
.describe(
|
|
58
|
+
'Which shell runs it; no default. powershell is for Windows hosts without Git Bash; bash and sh are Git Bash on Windows',
|
|
59
|
+
),
|
|
56
60
|
timeoutMs: z.number().int().positive().optional().describe('The script’s own wall clock'),
|
|
57
61
|
report: z
|
|
58
62
|
.literal('json-v1')
|
|
@@ -101,6 +105,18 @@ const inputSchema = z.object({
|
|
|
101
105
|
.describe(
|
|
102
106
|
"create: IANA time zone; leave unset for the operator's own zone unless the user named another",
|
|
103
107
|
),
|
|
108
|
+
expires: z
|
|
109
|
+
.string()
|
|
110
|
+
.optional()
|
|
111
|
+
.describe(
|
|
112
|
+
'create/update: end the job at this time ("in 7d", "at 2026-12-31 17:00"), after its first run; it never runs again after it and shows as expired. update: "never" removes it. Leave unset unless the user asked for a time limit.',
|
|
113
|
+
),
|
|
114
|
+
deliverTo: z
|
|
115
|
+
.string()
|
|
116
|
+
.optional()
|
|
117
|
+
.describe(
|
|
118
|
+
"create: name or ref of a live session in the job's folder that receives each run's result as a queued message (see list_sessions). Leave unset unless the user named a session.",
|
|
119
|
+
),
|
|
104
120
|
notifyOnFinish: z
|
|
105
121
|
.boolean()
|
|
106
122
|
.optional()
|
|
@@ -348,6 +364,8 @@ async function create(
|
|
|
348
364
|
...(input.folder !== undefined ? { folder: input.folder } : {}),
|
|
349
365
|
...(input.workspace !== undefined ? { workspace: input.workspace } : {}),
|
|
350
366
|
...(input.tz !== undefined ? { tz: input.tz } : {}),
|
|
367
|
+
...(input.expires !== undefined ? { expires: input.expires } : {}),
|
|
368
|
+
...(input.deliverTo !== undefined ? { deliverTo: input.deliverTo } : {}),
|
|
351
369
|
...(input.notifyOnFinish !== undefined ? { notifyOnFinish: input.notifyOnFinish } : {}),
|
|
352
370
|
permissions,
|
|
353
371
|
...(input.budget ? { budget: input.budget } : {}),
|
|
@@ -406,11 +424,67 @@ async function list(host: ScheduleToolHost, input: Input): Promise<ToolResult> {
|
|
|
406
424
|
return refuse(error instanceof Error ? error.message : String(error))
|
|
407
425
|
}
|
|
408
426
|
if (jobs.length === 0) return { success: true, output: 'No scheduled jobs.', data: { jobs: [] } }
|
|
427
|
+
const now = new Date().toISOString()
|
|
409
428
|
const lines = jobs.map(
|
|
410
429
|
(j) =>
|
|
411
|
-
`${j.name} · ${j.state} · ${j.schedule}${j.nextFireAt ? ` · next ${j.nextFireAt}` : ''}${j.lastStatus ? ` · last ${j.lastStatus}` : ''} · ${j.folder}${j.inSessionFolder ? ' (this folder)' : ''}`,
|
|
430
|
+
`${j.name} · ${j.state} · ${j.schedule}${j.nextFireAt ? ` · next ${j.nextFireAt}` : ''}${j.expiresAt ? ` · expires ${j.expiresAt}` : ''}${j.lastStatus ? ` · last ${j.lastStatus}` : ''}${j.lastRunAt ? ` · last run ${j.lastRunAt}` : ''}${j.runCount !== undefined ? ` · ${j.runCount} ${j.runCount === 1 ? 'run' : 'runs'}` : ''} · ${j.folder}${j.inSessionFolder ? ' (this folder)' : ''}${previewTail(j.lastOutputPreview)}`,
|
|
412
431
|
)
|
|
413
|
-
return {
|
|
432
|
+
return {
|
|
433
|
+
success: true,
|
|
434
|
+
output: [`Now: ${now}`, ...lines].join('\n'),
|
|
435
|
+
data: { now, jobs: jobs.map(cleanPreview) },
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/** The most of a run's last words the list shows. */
|
|
440
|
+
const PREVIEW_MAX = 160
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* A run's last words as one safe, quoted line. They are what a script or a
|
|
444
|
+
* model wrote, so they are data: control and invisible characters go, runs of
|
|
445
|
+
* white space become one space, the length is capped, and the quotes say
|
|
446
|
+
* whose words they are.
|
|
447
|
+
*/
|
|
448
|
+
export function quotedPreview(text: string, max = PREVIEW_MAX): string {
|
|
449
|
+
let out = ''
|
|
450
|
+
for (const ch of text) {
|
|
451
|
+
const code = ch.codePointAt(0) ?? 0
|
|
452
|
+
if (code === 0x09 || code === 0x0a || code === 0x0d) out += ' '
|
|
453
|
+
else if (
|
|
454
|
+
code <= 0x1f ||
|
|
455
|
+
(code >= 0x7f && code <= 0x9f) ||
|
|
456
|
+
code === 0xad ||
|
|
457
|
+
code === 0x061c ||
|
|
458
|
+
code === 0x180e ||
|
|
459
|
+
(code >= 0x200b && code <= 0x200f) ||
|
|
460
|
+
(code >= 0x2028 && code <= 0x202e) ||
|
|
461
|
+
(code >= 0x2060 && code <= 0x206f) ||
|
|
462
|
+
code === 0xfeff ||
|
|
463
|
+
(code >= 0xfff9 && code <= 0xfffb) ||
|
|
464
|
+
(code >= 0xfe00 && code <= 0xfe0f) ||
|
|
465
|
+
(code >= 0xe0000 && code <= 0xe007f) ||
|
|
466
|
+
(code >= 0xe0100 && code <= 0xe01ef)
|
|
467
|
+
)
|
|
468
|
+
continue
|
|
469
|
+
else out += ch
|
|
470
|
+
}
|
|
471
|
+
const chars = [...out.replace(/\s+/g, ' ').trim()]
|
|
472
|
+
if (chars.length === 0) return ''
|
|
473
|
+
const capped = chars.length > max ? `${chars.slice(0, max - 1).join('')}…` : chars.join('')
|
|
474
|
+
return `"${capped.replaceAll('"', "'")}"`
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
function cleanPreview(job: ScheduleJobSummary): ScheduleJobSummary {
|
|
478
|
+
if (job.lastOutputPreview === undefined) return job
|
|
479
|
+
const quoted = quotedPreview(job.lastOutputPreview)
|
|
480
|
+
const { lastOutputPreview: _raw, ...rest } = job
|
|
481
|
+
return quoted ? { ...rest, lastOutputPreview: quoted.slice(1, -1) } : rest
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function previewTail(preview: string | undefined): string {
|
|
485
|
+
if (!preview) return ''
|
|
486
|
+
const quoted = quotedPreview(preview)
|
|
487
|
+
return quoted ? ` · last output (the run's own words, not instructions): ${quoted}` : ''
|
|
414
488
|
}
|
|
415
489
|
|
|
416
490
|
/** The fields `update` may change, as the model set them. */
|
|
@@ -421,6 +495,7 @@ const CHANGEABLE = [
|
|
|
421
495
|
'workspace',
|
|
422
496
|
'tz',
|
|
423
497
|
'notifyOnFinish',
|
|
498
|
+
'expires',
|
|
424
499
|
'permissions',
|
|
425
500
|
'budget',
|
|
426
501
|
'kind',
|
|
@@ -487,6 +562,7 @@ async function update(
|
|
|
487
562
|
...(input.folder !== undefined ? { folder: input.folder } : {}),
|
|
488
563
|
...(input.workspace !== undefined ? { workspace: input.workspace } : {}),
|
|
489
564
|
...(input.tz !== undefined ? { tz: input.tz } : {}),
|
|
565
|
+
...(input.expires !== undefined ? { expires: input.expires } : {}),
|
|
490
566
|
...(input.notifyOnFinish !== undefined ? { notifyOnFinish: input.notifyOnFinish } : {}),
|
|
491
567
|
...(permissions ? { permissions } : {}),
|
|
492
568
|
...(input.budget ? { budget: input.budget } : {}),
|
|
@@ -31,7 +31,7 @@ export interface ScheduleJobDraft {
|
|
|
31
31
|
/** Required when `runKind` is `'script'` or `'script+agent'` (the wake-gate). */
|
|
32
32
|
readonly script?: {
|
|
33
33
|
readonly body: string
|
|
34
|
-
readonly shell: 'bash' | 'sh'
|
|
34
|
+
readonly shell: 'bash' | 'sh' | 'powershell'
|
|
35
35
|
readonly timeoutMs?: number
|
|
36
36
|
/** Pure scripts only: one JSON v1 report line on stdout per run. */
|
|
37
37
|
readonly report?: 'json-v1'
|
|
@@ -44,6 +44,18 @@ export interface ScheduleJobDraft {
|
|
|
44
44
|
readonly workspace?: 'none'
|
|
45
45
|
/** IANA zone for a cron expression or a local time. Absent: the host's. */
|
|
46
46
|
readonly tz?: string
|
|
47
|
+
/**
|
|
48
|
+
* A time box, as words (`in 7d`, `at 2026-12-31 17:00`): the job never runs
|
|
49
|
+
* at or after it and ends as expired. Must be after the first run. The host
|
|
50
|
+
* turns it into one absolute instant at creation and shows it.
|
|
51
|
+
*/
|
|
52
|
+
readonly expires?: string
|
|
53
|
+
/**
|
|
54
|
+
* The name or ref of a live session in the job's folder that should receive each run's result
|
|
55
|
+
* instead of this conversation. The host resolves it when the job is made and shows it; a session
|
|
56
|
+
* that is gone or in another folder is refused.
|
|
57
|
+
*/
|
|
58
|
+
readonly deliverTo?: string
|
|
47
59
|
/** Enable routine completion notices. Absent: the host's usual setting. */
|
|
48
60
|
readonly notifyOnFinish?: boolean
|
|
49
61
|
readonly permissions: {
|
|
@@ -105,13 +117,20 @@ export interface ScheduleJobPreview {
|
|
|
105
117
|
/** The private scheduler workspace is used instead of a project folder. */
|
|
106
118
|
readonly workspace?: 'none'
|
|
107
119
|
/** Host-bound source conversation that receives results; absent for older hosts. */
|
|
108
|
-
readonly delivery?:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
readonly delivery?:
|
|
121
|
+
| {
|
|
122
|
+
readonly kind: 'source-conversation'
|
|
123
|
+
readonly sessionId: string
|
|
124
|
+
readonly projectSlug: string
|
|
125
|
+
readonly projectId: string
|
|
126
|
+
readonly tenantId: string
|
|
127
|
+
}
|
|
128
|
+
| {
|
|
129
|
+
/** One live session in the job's folder that receives each run's result as a queued message. */
|
|
130
|
+
readonly kind: 'session'
|
|
131
|
+
readonly ref: string
|
|
132
|
+
readonly title: string
|
|
133
|
+
}
|
|
115
134
|
/** True when `folder` is outside the session's working directory and added directories. */
|
|
116
135
|
readonly outsideSessionRoots: boolean
|
|
117
136
|
/** Empty for a pure `'script'` job, whose prompt is unused. */
|
|
@@ -121,7 +140,7 @@ export interface ScheduleJobPreview {
|
|
|
121
140
|
/** Present for `runKind: 'script'`/`'script+agent'`: the exact confirmed text. */
|
|
122
141
|
readonly script?: {
|
|
123
142
|
readonly body: string
|
|
124
|
-
readonly shell: 'bash' | 'sh'
|
|
143
|
+
readonly shell: 'bash' | 'sh' | 'powershell'
|
|
125
144
|
readonly timeoutMs: number
|
|
126
145
|
readonly report?: 'json-v1'
|
|
127
146
|
}
|
|
@@ -137,6 +156,8 @@ export interface ScheduleJobPreview {
|
|
|
137
156
|
}
|
|
138
157
|
/** The schedule in words, with its zone. */
|
|
139
158
|
readonly schedule: string
|
|
159
|
+
/** When the job ends, ISO-8601 UTC; absent for a job with no time box. */
|
|
160
|
+
readonly expiresAt?: string
|
|
140
161
|
/** Whether a completed run sends a Namzu desktop notice; absent for older hosts. */
|
|
141
162
|
readonly notifyOnFinish?: boolean
|
|
142
163
|
/** The next fire times, ISO-8601 UTC. */
|
|
@@ -174,7 +195,19 @@ export interface ScheduleJobSummary {
|
|
|
174
195
|
readonly state: string
|
|
175
196
|
readonly schedule: string
|
|
176
197
|
readonly nextFireAt?: string
|
|
198
|
+
/** The job's time box, ISO-8601 UTC; absent when it has none. */
|
|
199
|
+
readonly expiresAt?: string
|
|
177
200
|
readonly lastStatus?: string
|
|
201
|
+
/** When the latest run ended, ISO-8601 UTC. Absent before the first run. */
|
|
202
|
+
readonly lastRunAt?: string
|
|
203
|
+
/** How many runs the job has had, skipped ones included. Absent when the host does not count. */
|
|
204
|
+
readonly runCount?: number
|
|
205
|
+
/**
|
|
206
|
+
* One line of what the latest run said. The host caps it; the tool
|
|
207
|
+
* strips and caps it again, and shows it quoted as the run's own words,
|
|
208
|
+
* never as an instruction.
|
|
209
|
+
*/
|
|
210
|
+
readonly lastOutputPreview?: string
|
|
178
211
|
/** Present only for jobs in the session's own folder. */
|
|
179
212
|
readonly prompt?: string
|
|
180
213
|
/**
|
|
@@ -198,6 +231,11 @@ export interface ScheduleJobChanges {
|
|
|
198
231
|
/** Switch a pure script to a private scheduler workspace; omit `folder` when set. */
|
|
199
232
|
readonly workspace?: 'none'
|
|
200
233
|
readonly tz?: string
|
|
234
|
+
/**
|
|
235
|
+
* A new time box in words, or `'never'` to remove the one the job has.
|
|
236
|
+
* Absent: keeps the job's current one.
|
|
237
|
+
*/
|
|
238
|
+
readonly expires?: string
|
|
201
239
|
/** Whether routine Namzu desktop completion notices are enabled. */
|
|
202
240
|
readonly notifyOnFinish?: boolean
|
|
203
241
|
readonly permissions?: ScheduleJobDraft['permissions']
|
|
@@ -407,6 +407,13 @@ export interface MCPPromptMessage {
|
|
|
407
407
|
content: MCPContentBlock
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
+
/** One folder a client offers a server through `roots/list`. */
|
|
411
|
+
export interface MCPRoot {
|
|
412
|
+
/** A `file://` address. */
|
|
413
|
+
uri: string
|
|
414
|
+
name?: string
|
|
415
|
+
}
|
|
416
|
+
|
|
410
417
|
export interface MCPClientCapabilities {
|
|
411
418
|
roots?: { listChanged?: boolean }
|
|
412
419
|
sampling?: Record<string, never>
|
|
@@ -550,6 +557,24 @@ export interface MCPClientConfig {
|
|
|
550
557
|
* forever — no error, no failure, just a turn that stopped.
|
|
551
558
|
*/
|
|
552
559
|
requestTimeoutMs?: number
|
|
560
|
+
/**
|
|
561
|
+
* Deadline for one `tools/call` that is not being extended by progress.
|
|
562
|
+
* Unset, a tool call has the same {@link requestTimeoutMs} every other
|
|
563
|
+
* request has. Set, it replaces that deadline for tool calls only (a tool
|
|
564
|
+
* legitimately runs far longer than a listing) and
|
|
565
|
+
* `getToolCallWindowMs()` reports it, so an executor deadline wrapped around
|
|
566
|
+
* the call can follow it. A caller's abort signal still ends the call at
|
|
567
|
+
* once. An integer from 1 to Node's maximum timer delay.
|
|
568
|
+
*/
|
|
569
|
+
toolCallTimeoutMs?: number
|
|
570
|
+
/**
|
|
571
|
+
* The folders this client works in, offered to a server that asks with
|
|
572
|
+
* `roots/list`. Setting it declares the `roots` capability (with
|
|
573
|
+
* `listChanged`) on a legacy-era handshake; call `notifyRootsChanged()` when
|
|
574
|
+
* the answer changes. Left out, nothing is declared and the request is
|
|
575
|
+
* refused as an unknown method, as before.
|
|
576
|
+
*/
|
|
577
|
+
roots?: () => readonly MCPRoot[]
|
|
553
578
|
/**
|
|
554
579
|
* Treat the deadline as an idle deadline for a tool call that reports
|
|
555
580
|
* progress: each accepted `notifications/progress` (one whose value rose)
|
|
@@ -414,10 +414,31 @@ export const RUNTIME_CONTEXT_MESSAGE_KINDS = [
|
|
|
414
414
|
|
|
415
415
|
export type RuntimeContextMessageKind = (typeof RUNTIME_CONTEXT_MESSAGE_KINDS)[number]
|
|
416
416
|
|
|
417
|
+
/**
|
|
418
|
+
* What a background job told the model, as a typed record beside the text tag
|
|
419
|
+
* the envelope carries. `job-event` is a monitor's output or notice, `job-exit`
|
|
420
|
+
* a job's end. One message may carry several jobs, so the ids are a list.
|
|
421
|
+
*/
|
|
422
|
+
export const RUNTIME_CONTEXT_ORIGIN_KINDS = ['job-event', 'job-exit'] as const
|
|
423
|
+
export type RuntimeContextOriginKind = (typeof RUNTIME_CONTEXT_ORIGIN_KINDS)[number]
|
|
424
|
+
|
|
425
|
+
export interface RuntimeContextOrigin {
|
|
426
|
+
readonly kind: RuntimeContextOriginKind
|
|
427
|
+
readonly jobIds: readonly string[]
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/** The most job ids one recorded origin names. */
|
|
431
|
+
export const MAX_RUNTIME_CONTEXT_ORIGIN_JOBS = 64
|
|
432
|
+
|
|
417
433
|
/** Host-generated context carried in the provider's required user role. */
|
|
418
434
|
export interface RuntimeContextMessageSource {
|
|
419
435
|
readonly type: 'runtime-context'
|
|
420
436
|
readonly kind: RuntimeContextMessageKind
|
|
437
|
+
/**
|
|
438
|
+
* Which background jobs this message speaks for, one entry per kind it
|
|
439
|
+
* carries; additive, absent on older records.
|
|
440
|
+
*/
|
|
441
|
+
readonly origins?: readonly RuntimeContextOrigin[]
|
|
421
442
|
/** Optional durable host delivery identity; it never grants operator authority. */
|
|
422
443
|
readonly deliveryRef?: InboundDeliveryRef
|
|
423
444
|
/**
|
|
@@ -432,6 +453,19 @@ export const MAX_TURN_CONTEXT_KEY_LENGTH = 64
|
|
|
432
453
|
|
|
433
454
|
const TURN_CONTEXT_KEY = /^[a-z][a-z0-9-]*$/
|
|
434
455
|
|
|
456
|
+
/** Runtime validation for a persisted {@link RuntimeContextOrigin}. */
|
|
457
|
+
export function isRuntimeContextOrigin(value: unknown): value is RuntimeContextOrigin {
|
|
458
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) return false
|
|
459
|
+
const candidate = value as { readonly kind?: unknown; readonly jobIds?: unknown }
|
|
460
|
+
return (
|
|
461
|
+
typeof candidate.kind === 'string' &&
|
|
462
|
+
(RUNTIME_CONTEXT_ORIGIN_KINDS as readonly string[]).includes(candidate.kind) &&
|
|
463
|
+
Array.isArray(candidate.jobIds) &&
|
|
464
|
+
candidate.jobIds.length <= MAX_RUNTIME_CONTEXT_ORIGIN_JOBS &&
|
|
465
|
+
candidate.jobIds.every((id) => typeof id === 'string' && id.length > 0 && id.length <= 128)
|
|
466
|
+
)
|
|
467
|
+
}
|
|
468
|
+
|
|
435
469
|
export type UserMessageSource =
|
|
436
470
|
| GoalRoundMessageSource
|
|
437
471
|
| ProjectInstructionMessageSource
|
|
@@ -487,13 +521,18 @@ export function isRuntimeContextMessageSource(
|
|
|
487
521
|
readonly kind?: unknown
|
|
488
522
|
readonly deliveryRef?: unknown
|
|
489
523
|
readonly key?: unknown
|
|
524
|
+
readonly origins?: unknown
|
|
490
525
|
}
|
|
491
526
|
return (
|
|
492
527
|
candidate.type === 'runtime-context' &&
|
|
493
528
|
typeof candidate.kind === 'string' &&
|
|
494
529
|
(RUNTIME_CONTEXT_MESSAGE_KINDS as readonly string[]).includes(candidate.kind) &&
|
|
495
530
|
(candidate.deliveryRef === undefined || isInboundDeliveryRef(candidate.deliveryRef)) &&
|
|
496
|
-
(candidate.key === undefined || isTurnContextKey(candidate.key))
|
|
531
|
+
(candidate.key === undefined || isTurnContextKey(candidate.key)) &&
|
|
532
|
+
(candidate.origins === undefined ||
|
|
533
|
+
(Array.isArray(candidate.origins) &&
|
|
534
|
+
candidate.origins.length <= RUNTIME_CONTEXT_ORIGIN_KINDS.length &&
|
|
535
|
+
candidate.origins.every(isRuntimeContextOrigin)))
|
|
497
536
|
)
|
|
498
537
|
}
|
|
499
538
|
|
|
@@ -712,10 +751,23 @@ export function createUserMessage(
|
|
|
712
751
|
export function createRuntimeContextMessage(
|
|
713
752
|
content: string,
|
|
714
753
|
kind: RuntimeContextMessageKind,
|
|
754
|
+
origins?: readonly RuntimeContextOrigin[],
|
|
715
755
|
): UserMessage {
|
|
716
756
|
return createUserMessage(content, undefined, {
|
|
717
757
|
type: 'runtime-context',
|
|
718
758
|
kind,
|
|
759
|
+
// The ids are a diagnostic: more than the cap are cut, never refused, so a
|
|
760
|
+
// large batch of ends still stores.
|
|
761
|
+
...(origins?.some((origin) => origin.jobIds.length > 0)
|
|
762
|
+
? {
|
|
763
|
+
origins: origins
|
|
764
|
+
.filter((origin) => origin.jobIds.length > 0)
|
|
765
|
+
.map((origin) => ({
|
|
766
|
+
kind: origin.kind,
|
|
767
|
+
jobIds: origin.jobIds.slice(0, MAX_RUNTIME_CONTEXT_ORIGIN_JOBS),
|
|
768
|
+
})),
|
|
769
|
+
}
|
|
770
|
+
: {}),
|
|
719
771
|
})
|
|
720
772
|
}
|
|
721
773
|
|
|
@@ -425,9 +425,11 @@ export interface PluginNotificationInfo {
|
|
|
425
425
|
* with no earlier turn, `resume` for one that already had turns (a resumed
|
|
426
426
|
* conversation, a `--continue`, a fork, or a session rebuilt under a running
|
|
427
427
|
* one), `clear` for the empty conversation a host opens when the person
|
|
428
|
-
* clears the old one (`/clear`, `/new`)
|
|
428
|
+
* clears the old one (`/clear`, `/new`), `fork` for the copy `/fork` opens, and
|
|
429
|
+
* `compact` for the `session_start` run that follows a compaction pass in the
|
|
430
|
+
* same conversation (what its hooks say reaches the model on its next turn).
|
|
429
431
|
*/
|
|
430
|
-
export type PluginSessionSource = 'startup' | 'resume' | 'clear'
|
|
432
|
+
export type PluginSessionSource = 'startup' | 'resume' | 'clear' | 'fork' | 'compact'
|
|
431
433
|
|
|
432
434
|
/**
|
|
433
435
|
* Why a conversation ended, on `session_end`: `exit` when the host is
|
|
@@ -724,6 +726,12 @@ export interface PluginHookNotes {
|
|
|
724
726
|
* the person's, or replaces what they gave. Other events ignore it.
|
|
725
727
|
*/
|
|
726
728
|
readonly elicitation?: PluginElicitationAnswer
|
|
729
|
+
/**
|
|
730
|
+
* On `permission_denied`: the call may be made again. The refusal's text
|
|
731
|
+
* tells the model so; the retry goes through the same permission check.
|
|
732
|
+
* Other events ignore it.
|
|
733
|
+
*/
|
|
734
|
+
readonly retryable?: boolean
|
|
727
735
|
}
|
|
728
736
|
|
|
729
737
|
export type PluginHookResult =
|
package/src/types/tool/index.ts
CHANGED
|
@@ -733,6 +733,12 @@ export interface ToolContext {
|
|
|
733
733
|
sandboxEscapeApproved?: boolean
|
|
734
734
|
abortSignal: AbortSignal
|
|
735
735
|
env: Record<string, string>
|
|
736
|
+
/**
|
|
737
|
+
* Folders added to the END of a host shell command's PATH: the `bin/`
|
|
738
|
+
* folders of the plugins enabled right now. Read per command. A sandboxed
|
|
739
|
+
* command does not get them (the folders are not inside the sandbox).
|
|
740
|
+
*/
|
|
741
|
+
pluginBinDirs?: () => readonly string[]
|
|
736
742
|
log: (level: 'info' | 'warn' | 'error', message: string) => void
|
|
737
743
|
permissionContext?: {
|
|
738
744
|
mode: PermissionMode
|