@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,166 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 71.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- f6e125a: The built-in `read` tool's `offset` now counts lines from 1, the way `grep` reports line numbers and the way `readRange` already counted. It used to count from 0, so `offset: 100` started at line 101; now it starts at line 100. A missing `offset` and `offset: 0` both still mean the first line, and `offset: 1` now means the same.
|
|
8
|
+
|
|
9
|
+
What breaks: any caller, saved prompt or script that passes a 0-based `offset` to `read` now starts one line earlier than before (and sees one line repeated when it pages). To keep the old window, add 1 to the offset. The notices the tool prints for the next page (`offset: 2001`, `offset=N limit=N`) name the next unseen line in the new numbering, and the tool description says so.
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- b4d9ffb: A session inside a workspaces host now lists its own agents, workflows, teammates and background shell tasks in the live record it already writes, so the host can show them under the session. Nothing is drawn from it yet and nothing you run changes.
|
|
14
|
+
|
|
15
|
+
`@namzu/sdk` adds the optional `agents` field to `PeerRecord` (at most 40 rows of id, parent, kind, state, a name, one line of detail and a time; no prompt, transcript or output) and exports `PEER_AGENTS_MAX` and the `PeerAgentNode` type. A record without the field reads as no agents, and an older reader drops it. The CLI writes it only inside a workspaces host, at most once a second and only when the list changed, and loads the code for it there alone. A record file that is a link, owned by another user or over 256 KiB is no longer read by `readPeerRecord` and `readPeerRecords`, and an `agents` list that does not fit its bounds is dropped on its own instead of hiding the whole record.
|
|
16
|
+
|
|
17
|
+
- 866823c: Breaking default for `@namzu/cli`: the left arrow on an empty message box, `namzu agents` and `namzu workspaces` now open a new agents screen, where they used to open the sidebar-and-panes screen (`tui.workspacesScreen` now defaults to `agents`; it was the sidebar). To keep the old screen, set `tui.workspacesScreen` to `sidebar`.
|
|
18
|
+
|
|
19
|
+
New agents screen, and the left arrow now opens it. Pressing `←` on an empty message box used to open the workspaces screen (a sidebar beside tiled panes); it now opens a list of every workspace with its sessions, and under each session the workflows, agents, teammates and background shell tasks it is running, each with what it is doing, whether it needs you and how long ago it changed. `namzu agents` opens the same screen, and `namzu workspaces` still works and opens it too. Up and down move over the rows, Enter opens a session full screen (`←` on its empty message box comes back, Esc returns to the session you came from), typing filters the rows, Enter in the box starts a new session in the focused workspace with what you typed as its first message, `?` shows the keys, and the footer reads `← for agents`. The tiled panes are still there: `ctrl+b p` shows them from the list and `ctrl+b a` comes back.
|
|
20
|
+
|
|
21
|
+
To keep the earlier screen behind the left arrow and both commands, set `tui.workspacesScreen` to `sidebar` (Settings > Terminal, Agents screen) before you upgrade. That value is on its way out and is removed in the next major release. If something you do depends on the sidebar being the first thing `←` shows, set it now.
|
|
22
|
+
|
|
23
|
+
`@namzu/sdk` adds the optional `detail` field to `PeerRecord`: one line (at most 160 characters) of what the session is on, the question it waits on or else the last line of its latest reply, written inside a workspaces host, or in a plain terminal after its first left arrow; a reader drops a `detail` that is too long or not a string and keeps the session. A plain sub-agent whose tool call waits on you now shows as needing approval, with the tool and its target, and the mark rises to its session.
|
|
24
|
+
|
|
25
|
+
- 861c1f9: Automatic compaction can now be turned off, and its trigger sized as a percent of the window. Nothing changes unless you opt in: compaction stays on by default.
|
|
26
|
+
|
|
27
|
+
- `compaction.autoCompact: false` (or `NAMZU_DISABLE_AUTO_COMPACT=1`) stops the compaction the context size starts. `/compact` still works, and a prompt the provider refuses as too large is still shortened once and retried; if that frees too little the turn fails with the provider's own message.
|
|
28
|
+
- `compaction.autoCompactPercent` (1 to 100, or `NAMZU_AUTOCOMPACT_PCT`) summarises at that share of the model window.
|
|
29
|
+
- `/autocompact [on|off|auto|<tokens>]` changes the switch or the window for the running conversation without writing the config file.
|
|
30
|
+
- Both keys are rows in Settings. In the SDK, `CompactionConfig.autoCompact` is a new optional field: `false` skips the threshold-triggered pass and keeps the forced overflow pass.
|
|
31
|
+
|
|
32
|
+
- 861c1f9: `session_start` hooks now run after every compaction pass (source `compact`) and when `/fork` opens a copy (source `fork`). A fork used to report `resume` when the copy had earlier turns and now reports `fork`, so a hook whose matcher must keep running on `/fork` needs `fork` added (for example `startup|resume|fork`). A hook with no matcher now also runs after each compaction and in a fork, so add `matcher: "startup"` if it must not repeat its work. What a hook says after a compaction (bounded to 8000 characters) joins the model's next turn in the terminal app (other entry points run the hooks but do not yet deliver the text). The text is kept per session, so a sub-agent's compaction never reaches its parent. This changes a default: a `session_start` hook with no matcher used to run only at start and resume, and now also runs after each compaction and in a fork; add `matcher: "startup"` (or `startup|resume`) to keep the old behaviour. `PluginSessionSource` gains `fork` and `compact`.
|
|
33
|
+
|
|
34
|
+
A `permission_denied` hook can answer `hookSpecificOutput.retry: true` (in process, `retryable: true` on a `continue`); the refusal the model reads then says it may retry the call. The refusal itself stands and a retry goes through the same permission check.
|
|
35
|
+
|
|
36
|
+
- 861c1f9: Breaking default: the CLI's MCP tool-call deadline changes from 30 seconds (120 for the turn) to 100,000,000 ms; a run with nobody at it (exec, scheduled, sub-agent) gets 3,600,000 ms. To keep the old bound, set `NAMZU_MCP_TOOL_TIMEOUT=30000` or `requestTimeoutMs: 30000` on the server. MCP tool calls are no longer cut at 120 seconds, and a few MCP limits are now settable. In the CLI a tool call from an MCP server may run for up to about 28 hours (100,000,000 ms) by default instead of being cut by the 30-second request deadline and the 120-second tool deadline. Stop still ends a stuck call at once. To keep a shorter bound, set `NAMZU_MCP_TOOL_TIMEOUT` (milliseconds) or `requestTimeoutMs` on the server; the latter now also moves the turn's tool deadline, so a value above 120 seconds is honoured. New settings: `NAMZU_MCP_TIMEOUT` (default connect deadline for servers without `connectTimeoutMs`) and `NAMZU_MAX_MCP_OUTPUT_CHARS` (the 30,000-character result cap). Sessions now declare the MCP `roots` capability, answer `roots/list` with the working directory and added folders, and send `roots/list_changed` after `/add dir`.
|
|
37
|
+
|
|
38
|
+
SDK: `MCPClientConfig` gains `toolCallTimeoutMs` (a tool-call-only deadline, reported by `getToolCallWindowMs()`) and `roots` (with `MCPClient.notifyRootsChanged()`). Both are off unless set, so an SDK host sees no change.
|
|
39
|
+
|
|
40
|
+
- a091417: An enabled plugin's `bin/` folder is now added to the end of the PATH of the shell tool and of background jobs, so its programs run by their bare names; turning the plugin off removes it from the next command. It goes after the existing PATH, so a program already installed is never replaced by a plugin program of the same name. A command the read-only list names but that a plugin's `bin/` also supplies is no longer approved without asking, whether or not it is installed (on a machine without `rg` or `tree`, the plugin's file is what would run). A `bin/` that is a link leaving the plugin folder, or that holds one, is left off and logged. Sandboxed commands do not get the folder. New SDK surface: `ToolContext.pluginBinDirs`, `PluginLifecycleManager.enabledBinDirs()`. The plugin consent now also lists links under `bin/`, and the "bin/ is not used" note is gone. If you relied on a plugin's `bin/` not being on PATH, a command with the same name as one of its programs still resolves to your own program first; only names you did not have now resolve to the plugin. A plugin you already enabled that ships a `bin/` folder is put on the PATH after you upgrade, without a new consent (its install listed those files); turn the plugin off with `namzu plugin disable` if you do not want its programs to resolve.
|
|
41
|
+
- 861c1f9: Command output no longer shows terminal escape codes in Desktop or to an AG-UI client. Since the kernel started passing a command's output on as it was printed, Desktop's live tool row and the adapter's `TOOL_CALL_RESULT` (and `fromNamzuMessages` for stored results) carried colour, cursor and link codes as text, and a progress bar as every one of its redraws. Both now show plain text with a bar at its last frame. `@namzu/sdk` adds the export `plainTerminalText(text)` they use; a host of your own that shows output can call it too. Only the results of `bash`, `job`, `wait_for_job` and `run_code` are read as terminal output; any other tool's result is sent as it is. `@namzu/ag-ui` now needs `@namzu/sdk` 70.1.0 or later (its peer range is `>=70.1.0`), because it imports this export: with an older SDK the adapter fails to load, so update both together. A bash progress line cut to its last 160 characters no longer starts inside an escape sequence.
|
|
42
|
+
- 9d3fe18: New `push_notification` tool: the model can send one short line as a terminal notification when a long task has finished or it needs a decision and you have walked away. `@namzu/sdk` exports `createPushNotificationTool({ notify })` (the host supplies delivery; the tool cleans the line to 200 characters and allows one a minute). In `@namzu/cli` the interactive terminal offers it, but it stays off until `tui.notifications` lists the new `agent-message` event (`namzu config set tui.notifications turn-settled,agent-message`); `true` does not include it, so nothing changes for existing settings. It is not sent while you are typing (a key in the last minute), and `exec`, `-p`, drain and scheduled runs do not offer it. `tui.notifications` now accepts `"agent-message"`; a config that lists it is refused by older versions.
|
|
43
|
+
- 5fc3a4f: A schedule job can have a time box. `namzu schedule add` and `edit` take `--expires <time>` (`in 30d`, `at 2026-12-31 17:00`, an ISO instant; `--expires never` on `edit` removes it), and the `schedule` tool takes `expires` on `create` and `update`. The time is written once as an absolute instant, must be after the job's first run, is shown on the confirmation and is part of the confirmation digest, so changing it needs a new confirmation. No run starts at or after it, and the scheduler ends the job as `expired` and does not catch up past it. `schedule list --json` and `show` carry `expiresAt`. A job saved with an expiry is written at format version 3, so an older namzu holds it for confirmation rather than ignoring the limit.
|
|
44
|
+
|
|
45
|
+
SDK: `evaluateJob` reads a new optional `expiresAt` on its job and may return the new `job-expired` skip reason (the union may grow; keep a `default:` branch when you switch over it), `parseScheduleExpiry` is exported, and the schedule tool's `ScheduleJobDraft`, `ScheduleJobChanges`, `ScheduleJobPreview` and `ScheduleJobSummary` gain an optional expiry field. A `ScheduleToolHost` that ignores them keeps working, but then a model's `expires` is dropped; pass `draft.expires` and `changes.expires` through to `parseScheduleExpiry` to honour it.
|
|
46
|
+
|
|
47
|
+
- 49ea26b: Schedule script jobs run on native Windows. `namzu schedule add --kind script` takes `--shell bash|sh|powershell`; without it the job records `bash`, or `powershell` on Windows when Git Bash is not found. On native Windows `bash` and `sh` are Git for Windows' own (`NAMZU_BASH_SHELL`, which the `bash` tool already reads, may name the full path of a `bash.exe` or `sh.exe`; any other program there is refused), and `powershell` is `pwsh`, else Windows PowerShell, passed as one encoded argument and limited to 8,000 characters. The shell is shown on the confirmation and bound by its digest, and the check and the run use it and no other: a job recorded with a shell the machine lacks stops with a reason and never runs under another shell. The shell checker cannot read PowerShell, so a PowerShell script is matched as text against the scheduled-run floor and the `deny` rules (with the call operator, directory, case and `.exe`/`.cmd` suffix removed, and quoted text and comments set aside so ordinary scripts with variables pass), and a script that hides the program it runs (a call through a variable, `Invoke-Expression`, `Start-Process`, a nested shell command string) or recursively deletes a drive root or home is refused; the confirmation says to read it yourself. Before this, a script job was refused on native Windows. Nothing changes for an existing `bash` or `sh` job on Linux, macOS or WSL, except that omitting `--shell` is no longer an error.
|
|
48
|
+
|
|
49
|
+
SDK: `script.shell` on the `schedule` tool's `create` and on `ScheduleJobPreview` gains `'powershell'` (code that switches over it needs a default branch), and `findScriptShell`, `installedScriptShell`, `defaultScriptShellName`, `hostDefaultScriptShellName`, `powershellArgs` and `windowsShellOverrideProblem` are exported. An older namzu holds a `powershell` job instead of running it.
|
|
50
|
+
|
|
51
|
+
- 49ea26b: A schedule job can hand each run's result to one live session. `namzu schedule add` and `edit` take `--deliver-to <session>` (the name, ref or id `namzu peers list` shows), and the `schedule` tool takes `deliverTo` on `create`. The session must be open in the job's own folder when the job is made; a session in another folder, none, or more than one match is refused. The result is queued in that session's inbox as a command-line sender's message, quoted as the run's output and never as an instruction, so it does not interrupt a turn. Each run is sent at most once, and a session that has closed, moved folder or stopped accepting messages is not waited for: the scheduler records `delivery-refused` in the job's history and the job runs again. The confirmation shows the target and the confirmation digest covers it, so naming another session needs a new confirmation. A job has one delivery, so `--deliver-to` replaces a source conversation binding; `--delivery none` removes either. A job saved with a session target is format version 3, so an older namzu holds it for confirmation.
|
|
52
|
+
A script job that reports a change stays pending when its session cannot take the result, so the checkpoint does not move past a change nobody received; run `namzu schedule edit <job> --delivery none` and confirm to release it (editing without `--deliver-to` keeps the binding and the hold). A message the session holds for its person is recorded as `delivery-held`. The scheduler also finds a terminal that registered under `XDG_RUNTIME_DIR` when the scheduler itself started without it (`/run/user/<uid>` is tried as well).
|
|
53
|
+
|
|
54
|
+
SDK: `ScheduleJobDraft` gains an optional `deliverTo`, and `ScheduleJobPreview.delivery` becomes a union with a `{ kind: 'session', ref, title }` variant (narrow on `kind` where you read it). A `ScheduleToolHost` that ignores `deliverTo` keeps working, but then a model's `deliverTo` is dropped; resolve it to one live session in the job's folder and show it in the preview to honour it.
|
|
55
|
+
|
|
56
|
+
- 49ea26b: A schedule job can wake on a change of one tool-server resource instead of at a time. `namzu schedule add` and `edit` take `--watch <server>` and `--watch-resource <uri>` (the server must be configured for the job's folder and list the resource), with `--watch-min-interval` (default 5 minutes, whole minutes) for the least time between two runs and `--watch-max-events` (default 60) for the most changed updates accepted in an hour. The scheduler subscribes to that one resource and calls none of the server's tools; it reads the content on each notification and runs only when it differs from the last content it accepted, so a restart neither replays a delivered update nor misses one that happened while it was stopped. Updates inside the gap collapse into the next run, a resource is read at most once every five seconds, and a job updated faster than its hourly limit is paused as `paused (too many updates)` with the reason. The run's system note quotes the content, cut at 4,000 characters, as one JSON string labelled as the server's data and never as your instruction; the job's own permissions, the scheduled-run floor and budget still apply. The confirmation shows the server and what it runs and the digest covers the server, the resource, both limits and a digest of the server's definition, so a settings file that points the same name at another program holds the watch until you confirm again. A server that asks for approval before use cannot be watched. The `schedule` tool cannot create or retarget a watch. A watch job is format version 3, so an older namzu holds it instead of running it as a timed job.
|
|
57
|
+
|
|
58
|
+
SDK: `ScheduleSpec` gains a `{ kind: 'watch', server, uri, minIntervalMs, maxEventsPerHour }` member (`ScheduleWatchSpec`), and `parseWatchSpec` is exported with `SCHEDULE_WATCH_*` constants. A watch spec has no times: `nextFireTime` and `previousFireTime` return `null`, `countOccurrences` counts none and `describeSchedule` words it, so code that switches over `ScheduleSpec.kind` needs a `default:` branch (the union may grow). The schedule unions are documented as growing in minor releases (`public-types.ts`); the same sentence is now in `ScheduleSpec`'s own header. A caller that cannot handle a watch (a host with no tool servers) should skip the job, not fail on it.
|
|
59
|
+
|
|
60
|
+
Editing a watch job to another resource or server starts it clean: the baseline, an update waiting out the gap and the hour's count are kept per source, so the old resource's content is never run under the new resource's name. Resuming a paused watch drops the updates that waited while it was paused.
|
|
61
|
+
|
|
62
|
+
- 866823c: New `setDeliberateEnvKeys(names)` export. A host that writes variables into the process environment on purpose (the CLI's settings `env` block) calls it so the shell tool's removal of inherited credential-shaped variables leaves those names in. Nothing changes for a host that never calls it.
|
|
63
|
+
- 9d85c30: The bash tool now runs a set of read-only GitHub CLI commands without asking: `gh pr view|list|diff|checks|status`, `gh issue view|list|status`, `gh repo view`, `gh run list|view`, `gh release list|view`, `gh workflow list|view`, `gh label list`, `gh auth status` and `gh search repos|issues|prs|commits|code`, each only with the flags its table names (`--json`, `--repo owner/name`, `--limit`, `--state` and the like). Everything else about `gh` still asks, as before: `gh api`, `--web`, `--jq`/`--template`, `--output`, `--hostname`, a flag before the subcommand, `GH_*` assignments, aliases, extensions, and any repository argument that names a host, a URL, `user@host` or a `~` path, and a `cd` next to `gh` asks, as next to `git`. Nothing to change on your side; a rule that denies `gh` still wins.
|
|
64
|
+
- a6b9e66: A folder written to look like a bare git repository (`HEAD`, `objects/`, `refs/` and a `config`) can no longer make git run a program. Before, a model that was allowed to write files could write one, then run `cd` and `git status` as two read-only looking calls and git would run the program the folder's `config` names (`core.fsmonitor`); git that Namzu starts itself, such as the workspace change check, ran it with no model call at all.
|
|
65
|
+
|
|
66
|
+
What changes for you: a `git` or `gh` line is no longer approved as read-only when the folder it starts in, or one above it, looks like a bare repository, so you are asked. Every command the model starts (`bash`, background jobs, `monitor`, and commands in the local sandbox) now carries `safe.bareRepository=explicit` and an empty `core.fsmonitor` through `GIT_CONFIG_COUNT`, appended after any entries you already set. Your own commit hooks still run for a commit the model makes. Git that Namzu starts itself also turns hooks off for that call. If you rely on running git from inside a real bare repository (`cd repo.git && git log`), name the repository now: `git --git-dir=. log`. A normal checkout, a subfolder, a linked worktree and a submodule are unchanged. git older than 2.38 ignores these settings.
|
|
67
|
+
|
|
68
|
+
For hosts: new exports `withSafeGitConfig`, `withHostGitConfig`, `withGitConfig`, `hostGitEnv`, `hostGitConfig`, `SAFE_GIT_CONFIG` and `isGitProgram` for code that starts git itself, a third argument to `isReadOnlyCommandLine` (`{ directory }`), and a `directory` argument on `withShellSession`.
|
|
69
|
+
|
|
70
|
+
Also: the remaining places Namzu starts git itself (the remember-this-rule ignore check, the project-state move, the Desktop commit and header reads, project compare, and a plugin hook's own git commands, and the history lookup behind the example text in an empty prompt, which ran at start-up with no model call) now carry the same settings; a `GIT_CONFIG_COUNT` such as `+1` no longer makes the helper overwrite your own `GIT_CONFIG_*` entries; and edits through the Windows spellings of `.git` (`.git.`, `GIT~1`, `.git::$INDEX_ALLOCATION`) now ask like `.git` does. A subfolder of a real checkout that itself looks like a bare repository also refuses git from inside it; use `git -C <checkout root>`.
|
|
71
|
+
|
|
72
|
+
- a650622: `glob` now lists matches newest modification first and applies its 500-path cap after sorting, so a capped result keeps the newest files instead of whichever the directory walk met first; the notice says how many files matched. `grep` in `content` and `count` modes now returns files in path order, so a later page (`offset`) continues the same list on every run (`files_with_matches` stays newest first). New `NAMZU_SEARCH_TIMEOUT_SECONDS` (default 12) sets the time budget of both tools (1 to 600; larger values fall back to 12). A host `glob` collects at most 10,000 matches before sorting; past that the notice says "at least". If you relied on walk order from `glob`, sort the paths yourself; nothing else needs to change.
|
|
73
|
+
- 262b865: The shell permission check now remembers, for the whole session, which variables an earlier `bash` call gave the integer attribute (`declare -i`, `typeset -i`, `local -i`, also `-n`, in any flag cluster). Bash evaluates every value stored into such a variable as arithmetic, so `x='a[$(cmd)]'` in a later call runs `cmd`. Such a later line (`x=…`, `x+=…`, `read x`, `printf -v x`, `mapfile x`, `for x in …`, `export x=…`, `${x:=…}`) is now read as opaque and asks instead of being allowed by a pattern rule or a read-only reading. When the names cannot be known (`declare -i "$v"`, an `eval` that may declare, any `source` or `.`) the session is marked, and until it restarts any later stored value that holds a subscript or an expansion asks. Lines with plain values, such as `x=5` or `x+=1`, are unaffected. Nothing to change in your own code; a call that now asks can be approved as before. Hosts that read lines themselves can pass the session's names through the new `attributes` option of `lexShellCommandLine`; `ShellLexResult` gains `integerNames` and `integerNamesUnknown`. A bare name stored into a variable that has the attribute (`x=y`, `x+=y`, `x=y+1`, `for x in y`) also asks, because bash evaluates the value of `y` again. `AuthorizationGate.evaluate` takes an optional `sessionId` and reads the line with that session's names in every rule, so an allow rule no longer passes a line the session's earlier calls turned into a command run.
|
|
74
|
+
- 2dc890e: The message the kernel records when a background job ends, or a monitor speaks, now names the jobs it is about in a typed `origins` list on its `runtime-context` source (`job-exit` for the end of a job, `job-event` for a monitor's output, notices and end), beside the existing text tag; older records have none and nothing about the text changes. New exports: `RuntimeContextOrigin`, `isRuntimeContextOrigin`, `RUNTIME_CONTEXT_ORIGIN_KINDS` and `formatJobExitNotice`; `createRuntimeContextMessage` takes the origins as an optional third argument and `SteeringChannel` gets an optional `keys()`. A job's exit notice also says how long it ran and where its saved output is. A `bash` call that only starts a background command is marked `launched`, so the turn that started it no longer ends with the line that a command may have changed files.
|
|
75
|
+
- 864d2da: New built-in tool `notebook_edit` changes one cell of a Jupyter notebook (`notebook_path`, `cell_id`, `new_source`, `cell_type`, `edit_mode` of replace, insert or delete) and keeps the rest of the notebook as it was. It is not in `getBuiltinTools()` (its schema would ride every request): `getNotebookTools()` returns it, and it is exported as `NotebookEditTool`. The CLI offers it in every session and loads it on demand through `search_tools`, or with the rest when `toolLoading` is `eager`; a host that builds its own tool set from `getBuiltinTools()` adds `getNotebookTools()` to offer it. It counts as an edit tool: `accept-edits` approves it, a permission rule written under `edit` (for example `edit: { "private/**": "deny" }`) covers its `notebook_path`, and a hook matcher can name it `NotebookEdit`.
|
|
76
|
+
|
|
77
|
+
Also changed: reading a notebook with `read` now counts as reading it, so `edit`, `write` and `notebook_edit` see it as read and notice when it changed afterwards; a notebook saved with a byte-order mark is now read and accepted by the notebook check instead of being reported as invalid JSON.
|
|
78
|
+
|
|
79
|
+
A hook matcher written as a regular expression such as `(Edit|Write)` or `.*Edit.*` also fires for `notebook_edit` now, since the tool is written `NotebookEdit`; anchor it (`^(Edit|Write)$`) to keep the old reach.
|
|
80
|
+
|
|
81
|
+
`notebook_edit` is checkpointed like `edit` and `write` (a rewind restores the notebook), a hook `if` such as `Edit(private/**)` narrows it by its `notebook_path`, and hooks see that path in `NAMZU_TOOL_PATH`; its input has `notebook_path` only, not `file_path`. A notebook that cannot be written back exactly (an indent over ten characters, an integer beyond 2^53) is refused and left untouched, and after a compaction the notebook text a read showed is dropped once the cell is edited. Number spellings such as `1.0` may be written as `1`.
|
|
82
|
+
|
|
83
|
+
- 5fc3a4f: The `schedule` tool's `list` result now starts with `Now: <time>` (and `data.now`), and each job reports when its last run ended, how many runs it has had, and a one-line preview of what the last run said (capped at 160 characters, control and escape characters removed, quoted as the run's own words and not an instruction). `ScheduleJobSummary` gains the optional `lastRunAt`, `runCount` and `lastOutputPreview`; a host that does not set them keeps working, and the first output line of `list` is now the `Now:` line, so a caller that parsed the output text line by line should skip it or read `data.jobs`. The CLI fills the fields from the job's existing run history. The preview is filled only for a job in the session's folder, and tag characters and variation selectors are removed from it.
|
|
84
|
+
- a3a2626: `web_search` takes optional `allowed_domains` and `blocked_domains` lists. Results are filtered by URL host (a domain also covers its subdomains; `www.` and case are ignored), the tool asks the backend for extra results so `limit` is still met, and a call that sets both lists is refused (`Cannot specify both allowed_domains and blocked_domains in the same request`), so send one or the other. `WebSearchRequest` gains optional `allowedDomains` and `blockedDomains` so a search backend can filter natively; a backend that ignores them keeps working. `web_search` now also trims a backend's reply to `limit`.
|
|
85
|
+
- affe54e: A command file or skill given arguments it has no `$ARGUMENTS` for no longer refuses them: the text is appended as a last line, `ARGUMENTS: <text>`, after a blank line (nothing is appended when no text was typed). This turns a refusal into a feature, so a script that relied on the error to detect a template without a placeholder will now get a normal run; add `$ARGUMENTS` where the text belongs to keep it out of the end of the prompt.
|
|
86
|
+
|
|
87
|
+
New placeholders: `$0`, `$1`, ... and `$ARGUMENTS[0]`, ... take one word each, read as a shell line (`"two words"` is one word; an unclosed quote or a text over 10,000 characters is split on spaces), a numbered placeholder with no word is left as written, and `\$ARGUMENTS` or `\$1` writes the placeholder text. A prompt that already contained `\$` before `ARGUMENTS` or a digit now loses the backslash. Named arguments declared in frontmatter (`$name`) are not supported; such a placeholder stays as written. Inside a shell command a numbered word stays one quoted argument, and the appended line is plain text escaped like any value, so it cannot start or hide a command.
|
|
88
|
+
|
|
89
|
+
The `skill` tool now fills placeholders in a skill body even when the host gives no `shell` (as plain text: nothing runs there, so nothing is escaped or refused), leaves the body exactly as written when the call carries no `args`, and shows the `Arguments:` line only when no placeholder took them. A skill preloaded into an agent gets `$ARGUMENTS` as empty even without shell commands. `@namzu/sdk` exports `fillArguments`, `splitSkillArguments` and `takesSkillArguments`, `fillArguments` takes an `escape: false` option for hosts that run no command, and `substituteEscaped` accepts a `reader` option.
|
|
90
|
+
|
|
91
|
+
- 2dc890e: The model is now told to wait for an event instead of a timer. A background command ends with an exit notice, so the model ends its turn or keeps working and does not poll; a step that waits for a person (a command that prints a sign-in URL) is run in the background with no timeout and is not cut short. `wait_for_job` is described as the way to get a result needed inside the current step. A chain of short sleeps, or a `timeout` under ten minutes wrapped round a sign-in or an until-loop (in any sub-command, also after `env` or `VAR=value`, also for a background launch), is refused with a pointer to a background until-loop or `monitor`; in a background launch the result says to drop the wrapper. A one-turn run (`exec`, a scheduled fire, a drain) is told in its environment block to wait inside the turn with `wait_for_job`, because nothing there starts a new turn when a job exits.
|
|
92
|
+
|
|
93
|
+
In the terminal app `monitor` is listed in the first request instead of behind `search_tools`, which adds 3,137 bytes (its description and schema) to each request's tools block; other hosts keep it deferred, and a run that is one turn and closes (a scheduled fire, a drain) says in its environment block that no monitor is offered. Nothing is renamed or removed; a caller that checked the refusal text of a long sleep sees new wording.
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- 4356391: A monitor that expires with no events delivered, after its command wrote to stderr, now says so in its expiry notice and names the `job read` call that shows the output. stderr is still never an event; before, the model got only "no events delivered" and could not tell a failed command from a quiet one. `expiryNotice` takes an optional third argument (`{ stderrJobId }`); callers that omit it get the same text as before. Nothing to change on your side.
|
|
98
|
+
- 75883a2: Three permission rules now decide what they say. A `deny` written as the list entry `Agent` (or `agent`, or in the table under either spelling) used to match nothing, so sub-agents were never refused; it now refuses them, as do `--disallowed-tools Agent` and the other flags. `Agent(explore)` matches the sub-agent type of the call instead of any call whose prompt or label contains the word. `WebFetch(domain:example.com)` compares the parsed host of the address: before, an allow also admitted `https://other.test/?r=https://example.com/` and any call whose `prompt` field named the host, and a bare `http://example.com` was not matched; now only the host (any scheme, port, path or query) is allowed, `domain:*.example.com` covers its subdomains and not the bare domain, and a deny or ask for the host also catches an address spelled `EXAMPLE.COM.`. A `WebFetch(...)` pattern that is not a `domain:` entry now tests the address, not the whole call. `@namzu/sdk`: `web_fetch` declares `urlArgument: 'url'`, so a rule on its address tests it whole.
|
|
99
|
+
|
|
100
|
+
What to check: an allow you wrote for a host that relied on the old over-broad match (a URL on another host, or a subdomain without `*.`) now asks again; add the host or `domain:*.host` if you meant it. A deny for `Agent` that did nothing before now takes effect, so delegation is refused where you wrote it.
|
|
101
|
+
|
|
102
|
+
Also: an `Agent(name)` deny or ask now also fires on an Agent call that leaves the sub-agent type out, and an `Agent(name)` allow never applies to such a call. An `Agent(name)` allow compares the type exactly as written; a deny or ask ignores case. A `WebFetch` allow that is not a plain host (`domain:example.com:8443`, or a `*` that is not a whole leading label) allows nothing and is reported as a diagnostic, so the call asks; write `domain:example.com` or `domain:*.example.com`. Two spellings of one tool in the same table (`agent` and `Agent`, `WebFetch` and `web_fetch`) are now one entry and the stricter effect stands, whatever order they were written in. Narrowing an over-broad allow is the intended fail-safe.
|
|
103
|
+
|
|
104
|
+
- a6b9e66: Adding a folder that is itself protected, such as the Namzu home, a `.git` folder, a project `.namzu` or `.vscode` (with `--add-dir`, `additionalDirectories` or `/add dir`), or starting in one, no longer lets the model write inside it without a question: writes and shell redirections below it are asked about in every mode, the way they are anywhere else. A session logs one notice for each such folder. A sub-agent's managed worktree is still written freely, apart from its own `.git` and `.namzu`.
|
|
105
|
+
|
|
106
|
+
Writes into credential folders (`.ssh`, `.aws`, `.azure`, `.gnupg`, `.kube`, `.docker`, `.config/gh`, `.config/glab-cli`, `.config/gcloud`) are now asked about in every mode too, at any depth. If you keep a folder with one of those names in a project and write to it often, expect the question.
|
|
107
|
+
|
|
108
|
+
A shell line that downloads, copies or unpacks into a protected path is now asked about too: `curl -o`, `wget`, `dd of=`, `install`, `rsync`, `tar -C` or extract, `unzip -d` and `git clone`/`git init` were not read as writes before, so a git hook or a file in the Namzu home could be planted without a question. A working directory or added folder that sits inside a sub-agent's managed worktree is excused like the worktree itself, and a look-alike `.namzu/projects/<slug>/worktrees/<name>` folder in a repository is no longer excused: only the real Namzu home is.
|
|
109
|
+
|
|
110
|
+
`git clone` and `git init` with an option that takes a value (`--depth 1`, `-b main`, `-c a=b`) now have their real destination read, so a clone into the Namzu home or a `.git` folder is asked about; `rsync --exclude .git` and similar filters are no longer asked about. `ln`, `zip`, `patch`, `truncate`, `perl -i`, `sort -o`, `openssl -out`, `ssh-keygen -f`, `find -fprint`, a `git config` of a hook or command key, `git archive -o` and `git worktree add` into a protected path are asked about too, and so are `tar` update, append and delete and `unzip -d<folder>`.
|
|
111
|
+
|
|
112
|
+
- a6b9e66: A plugin hooks module that uses `<!--` or a line-start `-->` to hide code from the scan is now refused. The runtime reads those as comments and the scan did not, so the consent summary could show less than the module did. Ordinary uses are unaffected: the markers inside strings, templates, regexes and comments, and `while (n --> 0)`, still load. The hooks worker also freezes the prototypes its own errors inherit from, so nothing set on them survives into later hook calls. If a module of yours is refused for this, remove the HTML-style comment.
|
|
113
|
+
- 2dc890e: A context message that names more than 64 background jobs (many commands ending while the session was idle) is now stored with the first 64 ids instead of failing its session-log record; the ids are a note on the record and never decided whether it could be kept.
|
|
114
|
+
- a6b9e66: A skill or command template that puts an argument where the shell reads a word again is now refused instead of loaded. That covers an open subscript (`a['$ARGUMENTS']=1`, `arr=([$ARGUMENTS]=1)`), `trap`, `eval`, `let`, `source` and `.`, a `[[` test that compares numbers or uses `-v`, `((` arithmetic (also after `&&`, `;` or a closing parenthesis), a shell or `$SHELL` handed the argument as its `-c` string or reading it from a pipe, here-string or `<(...)`, `printf -v`, `read` names, `[ -v`, a first word that is not a plain name, a variable that is later used in arithmetic or as a prompt, and commands that take variable names (`declare`, `unset`, `export` where the argument is a name). A redirection or `command -p` before the first word no longer hides it. Before, quoting an argument there did not stop the shell from running a `$(...)` inside it. If a skill of yours does this on purpose, pass the argument through a plain command (`echo`, `git`) or an environment variable instead. Ordinary templates, including `[[ -n $ARGUMENTS ]]`, `export NAME=$ARGUMENTS`, `cat <<< $ARGUMENTS` and `bash -c '...' _ $ARGUMENTS`, load as before; so do `git log $ARGUMENTS`, `[ -f $ARGUMENTS ]` and `echo '$ARGUMENTS'`.
|
|
115
|
+
|
|
116
|
+
The check follows the shell's own reading of the command: an apostrophe in a `#` comment or `$'...'` string no longer hides what follows, a quote inside a `$(...)` inside double quotes is its own, `-c` is found behind options and `--`, a program started through any wrapper (`/bin/env`, `taskset`, `unshare`, `bwrap`, `coproc`, `find -exec`, and `sudo`, `xargs`, `timeout` and the like with their own options) is seen, a glob in the command word is refused like an expansion, and a value stored in a variable, `set --`, an array, a `read` or `for` word, a pipe or a file is refused when the same command reads variables as text, names, subscripts, offsets or scripts. `RANDOM`, `SRANDOM`, `OPTIND`, `compgen -C`, `expand_aliases` and a `case` inside `$(...)` are refused too. A whole-number argument is now accepted anywhere, including inside `$(( ))`, `(( ))` and `[[ -lt ]]`, and a value after a closed `$(( ))`, inside `<( )` in `mapfile`, as the data of `printf -v`, or after an earlier here-document loads as before. A command that defines a shell function (`name() { ... }`, `function name { ... }`) refuses any argument, because a function can hand it on to one of those places; put the function in a script file the skill ships instead. An argument that stands where the program goes (`env $ARGUMENTS`, `sudo $ARGUMENTS`, a bare `$ARGUMENTS`) is refused too, since quoting it still lets it pick the program.
|
|
117
|
+
|
|
118
|
+
- a6b9e66: A workflow or code-runtime script that loops on `await` with nothing slow in it (`for (;;) { await Promise.resolve() }`) is now always stopped by the total CPU limit. The limit used to add up whole milliseconds per slice, so very short slices counted as zero and the loop could run on without end; slices are now timed to the microsecond. No setting changes, and scripts that stay inside their limits behave as before.
|
|
119
|
+
|
|
120
|
+
## 70.0.0
|
|
121
|
+
|
|
122
|
+
### Major Changes
|
|
123
|
+
|
|
124
|
+
- bb87533: Plugin source policy now holds where it used to be bypassed, and plugin downloads refuse the inside of the machine.
|
|
125
|
+
|
|
126
|
+
What changes for you if you use `plugins.blockedMarketplaces`: `*` now blocks every source (it blocked nothing before), a bare host such as `example.com` also covers its subdomains, `*.example.com` is accepted, and a folder or file on this computer can be blocked by path (`*`, `/work/market`, `file:/work/market`). Every address that belongs to a GitHub repository (`codeload.github.com`, `raw.githubusercontent.com`, `api.github.com/repos/...`, `ssh.github.com`, pages and archives under `github.com/owner/repo/...`) reads as that repository. The list is checked on every redirect hop of a download, on installs from a marketplace (a local entry of a blocked marketplace is no longer installable), and against what is already installed: a plugin whose marketplace source is blocked now is not loaded and `plugin enable` refuses it. If a block list you rely on now blocks more than you meant (for example `*` or a bare host), narrow the entry.
|
|
127
|
+
|
|
128
|
+
New managed-file-only settings, dropped from user, project and local files: `plugins.allowedMarketplaces` (the only marketplace sources that may be added, refreshed or installed from; an empty list admits nothing) and `plugins.disableLaunchSources` (`--plugin-dir` and `--mcp-config` exit 64; a `--settings` layer that adds `mcpServers` is refused too; `--strict-mcp-config` alone stays allowed). Unset, nothing changes.
|
|
129
|
+
|
|
130
|
+
Plugin downloads (catalogs and archives) now refuse an address that is, or resolves to, a loopback, private, link-local or cloud metadata address, on the first request and on every redirect; a catalog that points at an internal https server will be refused (exit 77). Git hosts are resolved too: an address (https, ssh or scp form) whose host is `localhost`, an IP literal inside the machine, or a name that resolves to one or cannot be resolved is refused (exit 77), so an internal Git server by name is no longer reachable. Behind a proxy (`HTTPS_PROXY` or `HTTP_PROXY` holding an http or https address, the host not on `NO_PROXY`; `ALL_PROXY` no longer counts) a name this computer cannot resolve is allowed for downloads and https Git, since the proxy resolves it; literal addresses are always refused. The check reads the name once, so it does not stop DNS rebinding. Git no longer reads system or global Git configuration and runs no credential helper (an https repository that needed your credential helper will now be reported as needing sign-in; ssh keys still work), clones from inside the staging folder, and never follows an HTTP redirect (a repository that moved fails until its catalog entry names the new address). The Git configuration switch-off needs Git 2.32 or later. Zip entries with Windows-unsafe names (in plugin, skill and extension archives alike: a skill or extension zip that holds such a name no longer unpacks) (`CON`, `NUL`, `COM1`, a part ending in a dot or space, a colon, composed/decomposed duplicates) are refused on every platform, and an archive is written to disk as it downloads and unpacked one file at a time instead of being held in memory twice.
|
|
131
|
+
|
|
132
|
+
A folder or file install (`plugin install <path>`, and the Desktop host's folder install) is now judged by both lists as a local source, and a plugin installed that way is judged again at load by the path its install manifest records. A git address with a backslash or control character, or whose host differs between the URL parser and Git, is refused.
|
|
133
|
+
|
|
134
|
+
Host names written in Unicode in a block or allow entry now match their punycode form.
|
|
135
|
+
|
|
136
|
+
`@namzu/sdk`: this is a major because the hooks module's `$.http.fetch` is https only (plain http only to loopback in a test option), checks every redirect hop against private addresses after DNS resolution, and drops `Metadata`-style and `Host` request headers. A hook module that used plain `http://` addresses, an internal https host or a `Metadata` or `Host` header must change the address or stop sending the header. New exports `privateAddressProblem` and `proxyConfigured` for callers that do their own fetching.
|
|
137
|
+
|
|
138
|
+
With `plugins.blockedMarketplaces` or `plugins.allowedMarketplaces` set, an installed plugin whose marketplace is not recorded on this computer, or whose record cannot be read, is no longer loaded: it reports that its source cannot be checked. Re-add the marketplace (`plugin marketplace add`) to load it again. A plugin installed from a folder or file is still judged by its own recorded path. With no list set nothing changes.
|
|
139
|
+
|
|
140
|
+
`@namzu/sdk`: a redirect to another origin in the hooks module's `$.http.fetch` now keeps only `Accept`, `Accept-Language`, `Content-Type` and `User-Agent`; any other header, such as a custom `X-Api-Key`, stays on the first origin.
|
|
141
|
+
|
|
142
|
+
### Minor Changes
|
|
143
|
+
|
|
144
|
+
- 89f3ca7: Commands that a skill holds (`!` lines) now answer to the same checks as the model's own `bash` call. In auto mode a command that changes something no longer runs just because the skill's `allowed-tools` covers it, or because a rule allows the whole shell tool: only a command that reads, or one a rule allows by a pattern that names it, runs, and anything else is not run while the skill loads. When the model loaded the skill, that command's place in the text becomes a note asking the model to run it itself, exactly as written, with the `bash` tool (a numbered list when there are several), so the auto-mode reviewer sees the model's own call and the load goes on; a command a rule denies still fails the load. A typed `/name` or headless load has no model to ask, so it fails with a line that says the command is in the skill's file and to run it as a direct call. If you relied on a skill's commands running unreviewed in auto mode, add a narrow `Bash(<command>)` allow rule for them or run them yourself. A typed `/name` skill now judges and runs its commands in the folder the session's shell was left in by an earlier `cd`, not the session's starting folder, so a command that writes `hooks/x` after `cd .git` is refused as the protected path it is. The permission mode is read again right before a command starts, so a switch to plan or strict mode during a hook or sandbox start still stops it. The refusal for a command a rule or the dangerous-command floor sent to review no longer says an allow rule would lift it.
|
|
145
|
+
|
|
146
|
+
`@namzu/sdk` adds `ToolDispatchOptions.handOff` (a call auto mode would review comes back unrun with `data.handedOff` instead of failing), `CLASSIFY_NESTED_REFUSAL`, and `allowedCallTooWide` and `pinBashWorkingDirectory` to its exports, and `nestedCallModeRefusal` takes an optional `ruleTooWide`. A host that runs skill commands itself should pass it, and use the shell's carried folder (`effectiveBashWorkingDirectory`) for its check and its run.
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- 95189f0: Three places that took a yes too easily now ask or refuse. The CLI is a major release because `namzu mcp approve` with no names no longer approves anything off a terminal: a script that ran it bare must pass `--yes` or name the servers. Nothing else is removed and no setting changes; a person who relied on the old behaviour says yes once.
|
|
151
|
+
|
|
152
|
+
A write by the model to a folder a later session loads instructions from is now asked about in every mode, accept-edits included: `.namzu/skills`, `.namzu/agents`, `.namzu/commands`, `.agents/skills` at any level, the project's `skills/` folder, and any file named `SKILL.md`. A skill's hooks run shell commands and its allowed tools are pre-approved, so a skill written without a question was a way to run commands later. To author a skill, approve the write when asked, or use the skill save flow, which has its own confirmation.
|
|
153
|
+
|
|
154
|
+
`namzu mcp approve` with no name now lists every server it would approve, with the environment variables each project server's headers would send, and asks at a terminal. Off a terminal, or with `--format json`, it approves nothing and exits with a usage error unless you name the servers or pass `--yes`. A script that ran `namzu mcp approve` bare should pass `--yes`. Each line also shows a command server's arguments and the environment variables it would receive. `namzu mcp approve` now refuses outright, with or without `--yes` or names, when a running session started it (its marker, or a process above it carrying the marker), and the session's command-line floor refuses a shell command that runs `namzu mcp approve` or `namzu acp --desktop` in every permission mode. These are guards against a model's shell doing it by accident or by an obvious route, not a sandbox: a process that detaches from the session and clears its environment, or a script the command line does not hold, is not seen, so keep a session's shell sandboxed from writing `.mcp.json` if you need a hard boundary. Run the approval in your own terminal.
|
|
155
|
+
|
|
156
|
+
`namzu acp --desktop` answers plugin-install, marketplace, MCP-approval and settings consents from whatever is written to its input, so it now refuses to start in a process a running session started, such as a model's shell. What is checked is the session marker, on the process or on a process above it. The desktop app is unaffected.
|
|
157
|
+
|
|
158
|
+
`namzu plugin install`, `plugin update` and `plugin marketplace add` now refuse `--yes` and `--accept-surface` (exit 64) when a session started the process, with the same wording as `mcp approve`; run them in your own terminal. A preview still works. The `namzu acp --desktop` refusal now says to start it from the app or your own terminal. A person's tmux or screen server first started from inside a session keeps the marker for its later panes, so those panes are refused too; start the server again from a fresh terminal. Nothing a process says about itself (a tmux global entry, TMUX, PATH) clears the marker, because a session can set all of them.
|
|
159
|
+
|
|
160
|
+
- 7026889: Plugin hooks modules and `pre_tool_use` hooks now refuse where they used to let a call through. A hooks module that fails to load (its `register()` throws, or it does not finish loading) used to answer every event with "continue", so a guard that never loaded waved tool calls through; a `PreToolUse` call is now refused with the reason, a skill's shell command is skipped, and a permission request is left to the person. The same holds for a module the scan refuses (a name it does not allow, say): the scan may not have seen which events it hooks, so all three guarding events are answered as a failed guard, not passed, and every tool call of that plugin is refused until the module is fixed or the plugin turned off. A hooks module the CLI cannot start (two modules named, or a data folder overlapping the plugin) is now said as a warning. The host answers a module's `$` calls only for the calls its own scan declared. The trust screen, `namzu plugin validate` and the Desktop plugin view now say a module that hooks `PreToolUse`, `PermissionRequest` or `PreSkillShellCommand` "can approve, deny or change tool calls without asking you", and describe the worker as running "with your permissions" instead of "isolated". The exported `hookModuleConsentLines` and the saved `HookGrant.runs` text are reworded. A module with a top-level `let x;` no longer stops the plugin runtime from starting. Nothing to change on your side; a plugin that relied on a failed module letting calls through now sees the refusal. A hooks module's context now has no `Error.captureStackTrace`, a fixed `Error.prepareStackTrace` and `stackTraceLimit`, none of `WebAssembly`, `WeakRef`, `FinalizationRegistry`, `Atomics`, `SharedArrayBuffer` or `queueMicrotask`, frozen intrinsics, and a failed call on `$` now throws a frozen object with no prototype (`name`, `message`, `stack`, `toString`) instead of an `Error`, so a module that tests `error instanceof Error` on a `$` failure reads `error.message` instead. Every refusal message of a module says to update or fix the plugin, start a new session, or run `namzu plugin disable <name>`. A module can no longer extend built-in prototypes (`Array.prototype.last = ...` throws), and `new Error(...).stack` is an empty string; define helpers as plain functions instead. A failed hook now says "Fix the hook, or turn the plugin off with `namzu plugin disable <name>`" because the module stays loaded.
|
|
161
|
+
- f67678d: A host that sets `screenConsent` and has no prompt to ask now has the first look at the screen refused in `auto` mode too, with the same plain reason it already gave in the other modes. Before, `auto` skipped the consent and a run with nobody to ask could drive the screen unreviewed. A host that passes a prompt is unchanged: `auto` still never asks. To decide the call ahead of time, allow it with a rule.
|
|
162
|
+
- 639ff56: Three shell checks now ask or refuse where they used to let a line through. `let` and `declare -i` (also `typeset -i`, `local -i`, clustered flags such as `-ia`) with an argument that is not a plain number or `NAME=number` are read as opaque, because bash evaluates `a[$(cmd)]` in such an argument and runs `cmd`: a deny rule or escalation check could not see it before, and the line now asks. In a skill or command template, a `$ARGUMENTS`-style value placed right after a bare `$` inside a command (for example `echo $$ARGUMENTS`) is refused, since the quote after the `$` was read by bash as an ANSI-C string and a trailing backslash could end it early. The same holds for a name with a subscript given to `declare`, `typeset`, `local`, `printf -v` or `read`, the operand of `-v` in `test` and `[`, an unknown option after `command` or `builtin` in front of these, and a line that declares a name `-i` or `-n` and assigns a value holding `[`. A skill load is also refused unless the commands in the filled-in text are exactly the template's commands in the same order, where it only compared their number. If a template now fails to load, move the value out of the position after `$` (quote it in the template, or put a space before it); if a plain `let`/`declare -i` now asks, it held something other than digits. A prose value holding both an apostrophe and a stray backtick can now refuse a template that also contains a command. A line that declares a name `-i` or `-n` and then fills it with `read`, `mapfile`, `readarray`, `getopts`, `printf -v`, a loop variable or an expanding assignment, and a name held in a variable given to `declare`, `printf -v`, `read` or `[ -v`, now ask too; `printf -v` reads every `-v` option, not only the first. `unset` with a name that holds a subscript or expands (`unset 'a[$(cmd)]'`, `unset -v "$name"`) now asks too, since bash evaluates the subscript; `unset FOO` and `unset -f fn` stay plain. A line that runs `eval` with a word holding both a `[` and an expansion, or whose command word itself expands while a later word does, now asks too, since either can reach `unset` or `declare -i`.
|
|
163
|
+
|
|
3
164
|
## 69.4.0
|
|
4
165
|
|
|
5
166
|
### Minor Changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a folder looks like a bare git repository that is not one.
|
|
3
|
+
*
|
|
4
|
+
* Git started in a folder that holds `HEAD`, `objects/` and `refs/` outside a
|
|
5
|
+
* `.git` folder reads it as a repository and obeys its `config`, which can name
|
|
6
|
+
* a program to run. A model that may write files can plant such a folder, so a
|
|
7
|
+
* `git` line that looks harmless is not harmless when the folder it starts in,
|
|
8
|
+
* or one above it, looks like that. The read-only decision asks the person when
|
|
9
|
+
* this is true (see `readonly-commands.ts`).
|
|
10
|
+
*/
|
|
11
|
+
/** The sentence a person reads when a git line is asked about for this reason. */
|
|
12
|
+
export declare const BARE_INDICATORS_REASON = "Git command in a folder that looks like a bare repository (HEAD, objects and refs outside a .git folder). Git may read it as a repository and run the configuration and programs it names. To work with a real bare repository, name it: git --git-dir=<folder> <command>.";
|
|
13
|
+
/** The sentence for a `cd` and a `git` command in one line. */
|
|
14
|
+
export declare const CD_AND_GIT_REASON = "A line that changes folder and runs git needs approval: the folder it enters may hold a repository that was planted there.";
|
|
15
|
+
/**
|
|
16
|
+
* The folder, from `cwd` up to the root, that looks like a bare repository
|
|
17
|
+
* outside a `.git` folder, or `undefined` when none does. A folder that cannot
|
|
18
|
+
* be read counts as not looking like one: there is nothing git could read.
|
|
19
|
+
*/
|
|
20
|
+
export declare function bareRepositoryIndicator(cwd: string): string | undefined;
|
|
21
|
+
//# sourceMappingURL=bare-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bare-repository.d.ts","sourceRoot":"","sources":["../../src/authorization/bare-repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,+QAC0O,CAAA;AAE7Q,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB,+HAC+F,CAAA;AAmC7H;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASvE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a folder looks like a bare git repository that is not one.
|
|
3
|
+
*
|
|
4
|
+
* Git started in a folder that holds `HEAD`, `objects/` and `refs/` outside a
|
|
5
|
+
* `.git` folder reads it as a repository and obeys its `config`, which can name
|
|
6
|
+
* a program to run. A model that may write files can plant such a folder, so a
|
|
7
|
+
* `git` line that looks harmless is not harmless when the folder it starts in,
|
|
8
|
+
* or one above it, looks like that. The read-only decision asks the person when
|
|
9
|
+
* this is true (see `readonly-commands.ts`).
|
|
10
|
+
*/
|
|
11
|
+
import { statSync } from 'node:fs';
|
|
12
|
+
import { dirname, sep } from 'node:path';
|
|
13
|
+
/** The sentence a person reads when a git line is asked about for this reason. */
|
|
14
|
+
export const BARE_INDICATORS_REASON = 'Git command in a folder that looks like a bare repository (HEAD, objects and refs outside a .git folder). Git may read it as a repository and run the configuration and programs it names. To work with a real bare repository, name it: git --git-dir=<folder> <command>.';
|
|
15
|
+
/** The sentence for a `cd` and a `git` command in one line. */
|
|
16
|
+
export const CD_AND_GIT_REASON = 'A line that changes folder and runs git needs approval: the folder it enters may hold a repository that was planted there.';
|
|
17
|
+
// A path longer than this many folders is not a real checkout; stop looking.
|
|
18
|
+
const MAX_DEPTH = 64;
|
|
19
|
+
function isDirectory(path) {
|
|
20
|
+
try {
|
|
21
|
+
return statSync(path).isDirectory();
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function isFile(path) {
|
|
28
|
+
try {
|
|
29
|
+
return statSync(path).isFile();
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Whether `folder` itself has the three marks of a bare repository. */
|
|
36
|
+
function hasBareMarks(folder) {
|
|
37
|
+
return (isFile(`${folder}${sep}HEAD`) &&
|
|
38
|
+
isDirectory(`${folder}${sep}objects`) &&
|
|
39
|
+
isDirectory(`${folder}${sep}refs`));
|
|
40
|
+
}
|
|
41
|
+
/** Whether `folder` is, or lies inside, a `.git` folder. */
|
|
42
|
+
function insideDotGit(folder) {
|
|
43
|
+
return folder.split(/[\\/]/).includes('.git');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The folder, from `cwd` up to the root, that looks like a bare repository
|
|
47
|
+
* outside a `.git` folder, or `undefined` when none does. A folder that cannot
|
|
48
|
+
* be read counts as not looking like one: there is nothing git could read.
|
|
49
|
+
*/
|
|
50
|
+
export function bareRepositoryIndicator(cwd) {
|
|
51
|
+
let folder = cwd;
|
|
52
|
+
for (let depth = 0; depth < MAX_DEPTH; depth++) {
|
|
53
|
+
if (!insideDotGit(folder) && hasBareMarks(folder))
|
|
54
|
+
return folder;
|
|
55
|
+
const parent = dirname(folder);
|
|
56
|
+
if (parent === folder)
|
|
57
|
+
return undefined;
|
|
58
|
+
folder = parent;
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=bare-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bare-repository.js","sourceRoot":"","sources":["../../src/authorization/bare-repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAExC,kFAAkF;AAClF,MAAM,CAAC,MAAM,sBAAsB,GAClC,4QAA4Q,CAAA;AAE7Q,+DAA+D;AAC/D,MAAM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A;QACvC,MAAM,GAAG,MAAM,CAAA;IAChB,CAAC;IACD,OAAO,SAAS,CAAA;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-line.d.ts","sourceRoot":"","sources":["../../src/authorization/command-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AAEH,OAAO,EACN,KAAK,YAAY,EAKjB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"command-line.d.ts","sourceRoot":"","sources":["../../src/authorization/command-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AAEH,OAAO,EACN,KAAK,YAAY,EAKjB,MAAM,kBAAkB,CAAA;AAGzB,kFAAkF;AAClF,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACxB;AAED,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,aAAmC,CAAA;AASlE;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAqB,GAC5B,wBAAwB,CAmC1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAqB,GAC5B,SAAS,MAAM,EAAE,CAenB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,YAAqB,GAAG,OAAO,CAKjG"}
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
* The failure mode is a prompt, never a silent grant.
|
|
77
77
|
*/
|
|
78
78
|
import { basename, lexShellCommandLine, } from './shell-lexer.js';
|
|
79
|
+
import { currentShellAttributes } from './shell-session-state.js';
|
|
79
80
|
/** Commands whose argument is code assembled at runtime. Shared with `program.ts`. */
|
|
80
81
|
export const RUNTIME_EVALUATORS = new Set(['eval', 'source', '.']);
|
|
81
82
|
/**
|
|
@@ -197,11 +198,17 @@ function writes(redirection) {
|
|
|
197
198
|
*/
|
|
198
199
|
let cached;
|
|
199
200
|
function lex(command, dialect) {
|
|
200
|
-
|
|
201
|
+
// The session's attributes are part of the reading: another session, or
|
|
202
|
+
// the same one after it declared a name, reads the same text differently.
|
|
203
|
+
const attributes = currentShellAttributes();
|
|
204
|
+
if (cached !== undefined &&
|
|
205
|
+
cached.command === command &&
|
|
206
|
+
cached.dialect === dialect &&
|
|
207
|
+
cached.attributes === attributes) {
|
|
201
208
|
return cached.result;
|
|
202
209
|
}
|
|
203
|
-
const result = lexShellCommandLine(command, { dialect });
|
|
204
|
-
cached = { command, dialect, result };
|
|
210
|
+
const result = lexShellCommandLine(command, { dialect, ...(attributes ? { attributes } : {}) });
|
|
211
|
+
cached = { command, dialect, attributes, result };
|
|
205
212
|
return result;
|
|
206
213
|
}
|
|
207
214
|
//# sourceMappingURL=command-line.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-line.js","sourceRoot":"","sources":["../../src/authorization/command-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AAEH,OAAO,EAIN,QAAQ,EACR,mBAAmB,GACnB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"command-line.js","sourceRoot":"","sources":["../../src/authorization/command-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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E,0EAA0E;IAC1E,MAAM,UAAU,GAAG,sBAAsB,EAAE,CAAA;IAC3C,IACC,MAAM,KAAK,SAAS;QACpB,MAAM,CAAC,OAAO,KAAK,OAAO;QAC1B,MAAM,CAAC,OAAO,KAAK,OAAO;QAC1B,MAAM,CAAC,UAAU,KAAK,UAAU,EAC/B,CAAC;QACF,OAAO,MAAM,CAAC,MAAM,CAAA;IACrB,CAAC;IACD,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IAC/F,MAAM,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;IACjD,OAAO,MAAM,CAAA;AACd,CAAC"}
|
|
@@ -20,6 +20,12 @@ export interface ToolCallContext {
|
|
|
20
20
|
* omitted, it is read the same as a host-defined tool.
|
|
21
21
|
*/
|
|
22
22
|
readonly toolSource?: ToolSourceRef;
|
|
23
|
+
/**
|
|
24
|
+
* The shell session the call runs in. The gate reads a command line with
|
|
25
|
+
* the integer names earlier lines of that session declared (see
|
|
26
|
+
* `shell-session-state.ts`), in every rule, predicates included.
|
|
27
|
+
*/
|
|
28
|
+
readonly sessionId?: string;
|
|
23
29
|
}
|
|
24
30
|
/**
|
|
25
31
|
* What the rule actually said, in words a model can act on.
|
|
@@ -49,6 +55,7 @@ export declare class AuthorizationGate {
|
|
|
49
55
|
private readonly enabled;
|
|
50
56
|
constructor(config: AuthorizationGateConfig, log: Logger);
|
|
51
57
|
evaluate(ctx: ToolCallContext): GateEvaluationResult;
|
|
58
|
+
private evaluateIn;
|
|
52
59
|
}
|
|
53
60
|
/**
|
|
54
61
|
* How wide an `allow` rule is, for the review modes that must not let a broad
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/auth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AC,EAAE,0BAA0B,GAAG,MAAM,CAuE/F;AAED,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAC3C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqB;IACtD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IACnD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,MAAM,EAAE,uBAAuB,EAAE,GAAG,EAAE,MAAM;IAoHxD,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,oBAAoB;IAIpD,OAAO,CAAC,UAAU;CAqElB;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAkB7F"}
|
|
@@ -4,6 +4,7 @@ import { AuthorizationGateConfigSchema } from '../types/authorization/index.js';
|
|
|
4
4
|
import { SCOPE_ATTRIBUTE } from '../utils/log/types.js';
|
|
5
5
|
import { describeDangerousFinding } from './dangerous-commands.js';
|
|
6
6
|
import { dangerousFindingFor, evaluateRule } from './rules.js';
|
|
7
|
+
import { withShellSession } from './shell-session-state.js';
|
|
7
8
|
/**
|
|
8
9
|
* What the rule actually said, in words a model can act on.
|
|
9
10
|
*
|
|
@@ -209,6 +210,9 @@ export class AuthorizationGate {
|
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
212
|
evaluate(ctx) {
|
|
213
|
+
return withShellSession(ctx.sessionId, () => this.evaluateIn(ctx));
|
|
214
|
+
}
|
|
215
|
+
evaluateIn(ctx) {
|
|
212
216
|
if (!this.enabled) {
|
|
213
217
|
return {
|
|
214
218
|
decision: 'review',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../../src/authorization/gate.ts"],"names":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AA;IACd,CAAC;CACD;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,IAA8B;IAC5D,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAA;IACnC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,eAAe,CAAC;QACrB,KAAK,mBAAmB,CAAC;QACzB,KAAK,eAAe;YACnB,OAAO,MAAM,CAAA;QACd,KAAK,WAAW;YACf,OAAO,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;QACtD,KAAK,kBAAkB,CAAC;QACxB,KAAK,gBAAgB;YACpB,IAAI,IAAI,CAAC,QAAQ,KAAK,OAAO;gBAAE,OAAO,SAAS,CAAA;YAC/C,OAAO,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;QAC5D,KAAK,WAAW;YACf,OAAO,SAAS,CAAA;QACjB;YACC,OAAO,SAAS,CAAA;IAClB,CAAC;AACF,CAAC;AAED,yFAAyF;AACzF,SAAS,iBAAiB,CAAC,OAAe;IACzC,OAAO,+CAA+C,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;AAC5E,CAAC"}
|
|
@@ -27,11 +27,22 @@ export declare const PROTECTED_NESTED_DIRECTORIES: readonly (readonly string[])[
|
|
|
27
27
|
/** File names; a path whose last segment is one of these is protected. */
|
|
28
28
|
export declare const PROTECTED_FILE_NAMES: readonly string[];
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
|
|
30
|
+
* Names that are protected as the first segment of a path below a working
|
|
31
|
+
* root: the legacy project skills folder is `<root>/skills`, which a nested
|
|
32
|
+
* `src/skills` is not. Only a spelling relative to the root can say which, so a
|
|
33
|
+
* caller that has an absolute path passes the part below its root.
|
|
34
|
+
*/
|
|
35
|
+
export declare const PROTECTED_ROOT_DIRECTORIES: readonly string[];
|
|
36
|
+
/**
|
|
37
|
+
* Folders under the project directory that hold what is authored on purpose
|
|
38
|
+
* (skills, agent definitions, commands). They are excused from the protection
|
|
39
|
+
* of `.namzu` only for a remote session: one whose working folder is a
|
|
40
|
+
* checkout the operator is not sitting at, where authoring through the model is
|
|
41
|
+
* the way the folder gets written. In a local session they are protected like
|
|
42
|
+
* the rest of `.namzu`, because a skill written there is loaded by a later
|
|
43
|
+
* session, which attaches its hooks and honours the tools it allows. Only the
|
|
44
|
+
* first project directory in a path can be excused: a second one deeper down,
|
|
45
|
+
* or any other protected name below, still protects the path.
|
|
35
46
|
*
|
|
36
47
|
* `worktrees` is not one of them. The checkouts of delegated work live in the
|
|
37
48
|
* Namzu home (`projects/<slug>/worktrees/`), whose writes are judged by their
|
|
@@ -39,10 +50,17 @@ export declare const PROTECTED_FILE_NAMES: readonly string[];
|
|
|
39
50
|
* left there, and writing into it is asked about like the rest of `.namzu`.
|
|
40
51
|
*/
|
|
41
52
|
export declare const PROJECT_DIRECTORY_AUTHORED_FOLDERS: readonly string[];
|
|
53
|
+
export interface ProtectedPathOptions {
|
|
54
|
+
/**
|
|
55
|
+
* The session is a remote one, so the authored folders under `.namzu` are
|
|
56
|
+
* not asked about. False (the default) for every local session.
|
|
57
|
+
*/
|
|
58
|
+
readonly remoteSession?: boolean;
|
|
59
|
+
}
|
|
42
60
|
/**
|
|
43
61
|
* Whether a write to `path` is one of the protected kinds. Pure: it reads the
|
|
44
62
|
* spelling it is given, so a caller that wants a symlink's target covered
|
|
45
63
|
* passes the canonical path as well.
|
|
46
64
|
*/
|
|
47
|
-
export declare function isProtectedPath(path: string): boolean;
|
|
65
|
+
export declare function isProtectedPath(path: string, options?: ProtectedPathOptions): boolean;
|
|
48
66
|
//# sourceMappingURL=protected-paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protected-paths.d.ts","sourceRoot":"","sources":["../../src/authorization/protected-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"protected-paths.d.ts","sourceRoot":"","sources":["../../src/authorization/protected-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAkBlD,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,4BAA4B,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAStE,CAAA;AAED,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EA4CjD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAAe,CAAA;AAEvE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kCAAkC,EAAE,SAAS,MAAM,EAI/D,CAAA;AAiDD,MAAM,WAAW,oBAAoB;IACpC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAChC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CA0BzF"}
|