@sayknow-cli/coding-agent 0.7.10 → 0.7.12
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 +18 -0
- package/dist/types/async/result-formatting.d.ts +2 -0
- package/dist/types/capability/fs.d.ts +22 -3
- package/dist/types/capability/mcp.d.ts +2 -0
- package/dist/types/cli/append-system-prompt.d.ts +6 -0
- package/dist/types/cli/update-cli.d.ts +3 -0
- package/dist/types/commands/contribution-prep.d.ts +0 -3
- package/dist/types/commands/migrate.d.ts +1 -1
- package/dist/types/commands/sdk.d.ts +9 -0
- package/dist/types/commit/changelog/index.d.ts +1 -0
- package/dist/types/config/settings-schema.d.ts +14 -0
- package/dist/types/config/settings.d.ts +7 -1
- package/dist/types/coordinator-mcp/session-reaper.d.ts +5 -0
- package/dist/types/cursor-delete-path.d.ts +1 -0
- package/dist/types/cursor-mcp-name.d.ts +8 -0
- package/dist/types/dap/config.d.ts +8 -4
- package/dist/types/dap/session.d.ts +11 -2
- package/dist/types/debug/report-bundle-parent.d.ts +2 -0
- package/dist/types/debug/system-info.d.ts +6 -1
- package/dist/types/discovery/helpers.d.ts +11 -3
- package/dist/types/discovery/mcp-json.d.ts +1 -0
- package/dist/types/edit/file-read-cache.d.ts +4 -0
- package/dist/types/edit/modes/patch.d.ts +14 -0
- package/dist/types/edit/modes/replace.d.ts +8 -0
- package/dist/types/eval/py/runtime.d.ts +9 -0
- package/dist/types/exa/mcp-client.d.ts +11 -6
- package/dist/types/exec/bash-executor.d.ts +18 -1
- package/dist/types/export/html/css-color.d.ts +2 -0
- package/dist/types/export/html/html-export-destination.d.ts +2 -0
- package/dist/types/export/html/template.generated.d.ts +1 -1
- package/dist/types/extensibility/custom-tools/loader.d.ts +3 -2
- package/dist/types/extensibility/custom-tools/types.d.ts +3 -1
- package/dist/types/extensibility/plugins/marketplace/cache.d.ts +2 -0
- package/dist/types/extensibility/plugins/plugin-link-path.d.ts +2 -0
- package/dist/types/goals/runtime.d.ts +6 -0
- package/dist/types/harness-control-plane/receipt-spool.d.ts +4 -0
- package/dist/types/hindsight/content.d.ts +5 -6
- package/dist/types/internal-urls/skill-path.d.ts +1 -0
- package/dist/types/internal-urls/types.d.ts +2 -0
- package/dist/types/lsp/clients/swiftlint-client.d.ts +0 -4
- package/dist/types/lsp/config.d.ts +8 -5
- package/dist/types/lsp/workspace-path.d.ts +1 -0
- package/dist/types/migrate/adapters/codex.d.ts +2 -1
- package/dist/types/migrate/adapters/index.d.ts +10 -1
- package/dist/types/migrate/executor.d.ts +3 -1
- package/dist/types/migrate/types.d.ts +15 -3
- package/dist/types/modes/components/custom-editor.d.ts +6 -0
- package/dist/types/modes/components/extensions/state-manager.d.ts +4 -3
- package/dist/types/modes/components/model-selector.d.ts +46 -0
- package/dist/types/modes/controllers/input-controller.d.ts +9 -0
- package/dist/types/modes/interactive-mode.d.ts +1 -0
- package/dist/types/modes/utils/macos-option-forwarding.d.ts +17 -0
- package/dist/types/runtime-mcp/content-limits.d.ts +4 -0
- package/dist/types/runtime-mcp/manager.d.ts +9 -1
- package/dist/types/runtime-mcp/mcp-redirect.d.ts +9 -0
- package/dist/types/runtime-mcp/oauth-public-url.d.ts +1 -0
- package/dist/types/runtime-mcp/plugin-mcp-name-filter.d.ts +22 -0
- package/dist/types/runtime-mcp/plugin-network-boundary.d.ts +1 -0
- package/dist/types/runtime-mcp/project-host-values.d.ts +33 -0
- package/dist/types/runtime-mcp/smithery-registry.d.ts +24 -0
- package/dist/types/runtime-mcp/tool-bridge.d.ts +4 -0
- package/dist/types/runtime-mcp/types.d.ts +6 -0
- package/dist/types/sdk/broker/ensure.d.ts +2 -0
- package/dist/types/sdk/broker/lifecycle-ledger.d.ts +5 -1
- package/dist/types/sdk/broker/runtime.d.ts +1 -1
- package/dist/types/sdk/bus/chat-daemon-control.d.ts +3 -1
- package/dist/types/sdk/bus/telegram-daemon-contract.d.ts +3 -1
- package/dist/types/sdk/bus/telegram-daemon.d.ts +1 -0
- package/dist/types/sdk/host/events.d.ts +4 -0
- package/dist/types/session/agent-session.d.ts +20 -1
- package/dist/types/session/messages.d.ts +5 -1
- package/dist/types/session/session-manager.d.ts +13 -0
- package/dist/types/session/session-storage.d.ts +8 -0
- package/dist/types/session/streaming-output.d.ts +11 -0
- package/dist/types/session-import/redact.d.ts +1 -1
- package/dist/types/skc-runtime/managed-owner-admission.d.ts +3 -0
- package/dist/types/skc-runtime/psmux-detect.d.ts +5 -4
- package/dist/types/skc-runtime/ralplan-runtime.d.ts +5 -0
- package/dist/types/skc-runtime/sidecar-bootstrap-env.d.ts +6 -0
- package/dist/types/skc-runtime/state-writer.d.ts +4 -1
- package/dist/types/skc-runtime/tmux-sessions.d.ts +24 -0
- package/dist/types/skc-runtime/ultragoal-runtime.d.ts +4 -0
- package/dist/types/skill-state/workflow-mutation-guard.d.ts +20 -1
- package/dist/types/slash-commands/helpers/mcp.d.ts +5 -0
- package/dist/types/ssh/ssh-executor.d.ts +3 -1
- package/dist/types/system-prompt.d.ts +5 -2
- package/dist/types/task/executor.d.ts +17 -3
- package/dist/types/task/isolation-dir.d.ts +26 -0
- package/dist/types/task/role-body.d.ts +11 -0
- package/dist/types/task/token-log-mode.test.d.ts +1 -0
- package/dist/types/tools/ask.d.ts +77 -254
- package/dist/types/tools/ast-edit-write-path.d.ts +23 -0
- package/dist/types/tools/atomic-file-write.d.ts +74 -0
- package/dist/types/tools/auto-generated-guard.d.ts +5 -2
- package/dist/types/tools/bash-allowed-prefixes.d.ts +16 -0
- package/dist/types/tools/bash-interactive.d.ts +2 -0
- package/dist/types/tools/bash-skill-urls.d.ts +5 -1
- package/dist/types/tools/bash.d.ts +1 -0
- package/dist/types/tools/browser/cdp-url.d.ts +2 -0
- package/dist/types/tools/browser/tab-worker.d.ts +2 -0
- package/dist/types/tools/debug.d.ts +2 -2
- package/dist/types/tools/explicit-artifact.d.ts +8 -0
- package/dist/types/tools/fetch.d.ts +7 -4
- package/dist/types/tools/github-side-effect.d.ts +22 -0
- package/dist/types/tools/index.d.ts +3 -0
- package/dist/types/tools/monitor-mutation.d.ts +9 -0
- package/dist/types/tools/recipe/index.d.ts +2 -0
- package/dist/types/tools/recipe/recipe-guard.d.ts +7 -0
- package/dist/types/tools/restricted-cwd.d.ts +1 -0
- package/dist/types/tools/reverse-engineer.d.ts +81 -0
- package/dist/types/tools/search-tool-bm25.d.ts +2 -0
- package/dist/types/tools/tmux-self-injection-guard.d.ts +17 -0
- package/dist/types/tools/untrusted-content.d.ts +12 -0
- package/dist/types/utils/file-mentions.d.ts +5 -0
- package/dist/types/utils/open.d.ts +0 -1
- package/dist/types/utils/shell-snapshot.d.ts +2 -0
- package/dist/types/utils/title-generator.d.ts +12 -2
- package/dist/types/utils/tools-checksum.d.ts +7 -0
- package/dist/types/utils/xml-escape.d.ts +2 -0
- package/dist/types/web/scrapers/types.d.ts +8 -1
- package/dist/types/web/search/providers/codex.d.ts +6 -7
- package/dist/types/web/search/providers/insane.d.ts +7 -1
- package/dist/types/web/search/providers/kimi.d.ts +2 -0
- package/dist/types/web/search/providers/searxng.d.ts +7 -0
- package/dist/types/web/search/providers/xai.d.ts +2 -0
- package/package.json +7 -7
- package/scripts/generate-sdk-operation-inventory.ts +4 -0
- package/src/async/job-manager.ts +23 -9
- package/src/async/result-formatting.ts +40 -0
- package/src/capability/fs.ts +78 -11
- package/src/capability/mcp.ts +2 -0
- package/src/cli/append-system-prompt.ts +12 -0
- package/src/cli/auth-broker-cli.ts +22 -12
- package/src/cli/config-cli.ts +8 -18
- package/src/cli/migrate-cli.ts +7 -5
- package/src/cli/ssh-cli.ts +6 -3
- package/src/cli/stats-cli.ts +9 -4
- package/src/cli/update-cli.ts +42 -0
- package/src/cli/web-search-cli.ts +9 -3
- package/src/cli.ts +5 -9
- package/src/commands/commit.ts +2 -2
- package/src/commands/contribution-prep.ts +1 -3
- package/src/commands/harness.ts +25 -15
- package/src/commands/launch.ts +1 -1
- package/src/commands/migrate.ts +3 -3
- package/src/commands/sdk.ts +115 -14
- package/src/commands/ultragoal.ts +14 -8
- package/src/commit/agentic/agent.ts +6 -6
- package/src/commit/analysis/conventional.ts +14 -5
- package/src/commit/changelog/index.ts +39 -1
- package/src/commit/message.ts +10 -3
- package/src/config/config-file.ts +106 -3
- package/src/config/keybindings.ts +154 -7
- package/src/config/mcp-schema.json +4 -0
- package/src/config/model-registry.ts +10 -2
- package/src/config/settings-schema.ts +18 -0
- package/src/config/settings.ts +32 -4
- package/src/coordinator-mcp/policy.ts +14 -4
- package/src/coordinator-mcp/server.ts +44 -4
- package/src/coordinator-mcp/session-reaper.ts +9 -1
- package/src/cursor-delete-path.ts +10 -0
- package/src/cursor-mcp-name.ts +15 -0
- package/src/cursor.ts +13 -2
- package/src/dap/client.ts +9 -2
- package/src/dap/config.ts +33 -13
- package/src/dap/defaults.json +1 -1
- package/src/dap/session.ts +161 -36
- package/src/debug/crash-diagnostics.ts +89 -6
- package/src/debug/report-bundle-parent.ts +22 -0
- package/src/debug/report-bundle.ts +100 -3
- package/src/debug/system-info.ts +21 -4
- package/src/defaults/skc/extensions/grok-cli-vendor/src/shared/base-url.ts +21 -7
- package/src/defaults/skc/skills/deep-interview/SKILL.md +1 -1
- package/src/discovery/agents-md.ts +3 -2
- package/src/discovery/agents.ts +3 -2
- package/src/discovery/builtin.ts +21 -11
- package/src/discovery/claude.ts +5 -4
- package/src/discovery/cline.ts +2 -2
- package/src/discovery/codex.ts +6 -5
- package/src/discovery/cursor.ts +11 -2
- package/src/discovery/gemini.ts +4 -3
- package/src/discovery/github.ts +2 -2
- package/src/discovery/helpers.ts +51 -11
- package/src/discovery/mcp-json.ts +28 -12
- package/src/discovery/opencode.ts +2 -1
- package/src/discovery/ssh.ts +11 -6
- package/src/discovery/substitute-plugin-root.ts +3 -1
- package/src/discovery/vscode.ts +3 -3
- package/src/edit/apply-patch/index.ts +12 -1
- package/src/edit/file-read-cache.ts +24 -6
- package/src/edit/index.ts +90 -20
- package/src/edit/modes/patch.ts +215 -9
- package/src/edit/modes/replace.ts +141 -0
- package/src/eval/js/context-manager.ts +29 -3
- package/src/eval/js/worker-entry.ts +51 -18
- package/src/eval/py/runner.py +144 -5
- package/src/eval/py/runtime.ts +44 -4
- package/src/eval/py/tool-bridge.ts +4 -0
- package/src/exa/mcp-client.ts +53 -11
- package/src/exec/bash-executor.ts +87 -4
- package/src/exec/non-interactive-env.ts +0 -1
- package/src/export/html/css-color.ts +9 -0
- package/src/export/html/html-export-destination.ts +16 -0
- package/src/export/html/index.ts +102 -8
- package/src/export/html/template.generated.ts +1 -1
- package/src/extensibility/custom-tools/loader.ts +13 -3
- package/src/extensibility/custom-tools/types.ts +3 -1
- package/src/extensibility/custom-tools/wrapper.ts +3 -1
- package/src/extensibility/plugins/manager.ts +3 -2
- package/src/extensibility/plugins/marketplace/cache.ts +15 -0
- package/src/extensibility/plugins/marketplace/fetcher.ts +2 -2
- package/src/extensibility/plugins/marketplace/manager.ts +5 -3
- package/src/extensibility/plugins/plugin-link-path.ts +12 -0
- package/src/extensibility/skc-plugins/mcp-policy.ts +2 -1
- package/src/goals/runtime.ts +30 -8
- package/src/harness-control-plane/finalize.ts +10 -0
- package/src/harness-control-plane/operate.ts +12 -4
- package/src/harness-control-plane/owner.ts +8 -1
- package/src/harness-control-plane/receipt-spool.ts +105 -28
- package/src/harness-control-plane/storage.ts +124 -6
- package/src/hashline/execute.ts +3 -3
- package/src/hashline/recovery.ts +85 -2
- package/src/hindsight/config.ts +9 -3
- package/src/hindsight/content.ts +116 -16
- package/src/hindsight/mental-models.ts +22 -10
- package/src/hindsight/state.ts +7 -4
- package/src/hooks/native-skill-hook.ts +17 -12
- package/src/i18n/messages/de.settings.ts +3 -0
- package/src/i18n/messages/es.settings.ts +3 -0
- package/src/i18n/messages/fr.settings.ts +3 -0
- package/src/i18n/messages/ja.settings.ts +3 -0
- package/src/i18n/messages/ko.settings.ts +3 -0
- package/src/i18n/messages/zh.settings.ts +3 -0
- package/src/internal-urls/artifact-protocol.ts +3 -1
- package/src/internal-urls/docs-index.generated.ts +10 -10
- package/src/internal-urls/local-protocol.ts +167 -8
- package/src/internal-urls/skill-path.ts +18 -0
- package/src/internal-urls/skill-protocol.ts +2 -0
- package/src/internal-urls/types.ts +2 -0
- package/src/lsp/client.ts +2 -1
- package/src/lsp/clients/biome-client.ts +2 -0
- package/src/lsp/clients/swiftlint-client.ts +2 -0
- package/src/lsp/config.ts +18 -62
- package/src/lsp/edits.ts +6 -0
- package/src/lsp/index.ts +29 -0
- package/src/lsp/workspace-path.ts +75 -0
- package/src/main.ts +33 -11
- package/src/memories/index.ts +141 -9
- package/src/migrate/action-planner.ts +57 -0
- package/src/migrate/adapters/claude-code.ts +23 -4
- package/src/migrate/adapters/codex.ts +22 -4
- package/src/migrate/adapters/index.ts +22 -4
- package/src/migrate/adapters/opencode.ts +6 -1
- package/src/migrate/executor.ts +84 -7
- package/src/migrate/report.ts +19 -2
- package/src/migrate/types.ts +14 -4
- package/src/modes/DESIGN.md +5 -0
- package/src/modes/acp/acp-agent.ts +35 -2
- package/src/modes/acp/permission-mode.ts +18 -1
- package/src/modes/components/custom-editor.ts +14 -0
- package/src/modes/components/extensions/extension-dashboard.ts +2 -2
- package/src/modes/components/extensions/inspector-panel.ts +9 -5
- package/src/modes/components/extensions/state-manager.ts +15 -5
- package/src/modes/components/model-selector.ts +144 -94
- package/src/modes/components/welcome.ts +3 -2
- package/src/modes/controllers/command-controller.ts +300 -9
- package/src/modes/controllers/event-controller.ts +1 -1
- package/src/modes/controllers/extension-ui-controller.ts +32 -19
- package/src/modes/controllers/input-controller.ts +62 -26
- package/src/modes/controllers/plan-mode-controller.ts +17 -7
- package/src/modes/controllers/runtime-mcp-command-controller.ts +25 -20
- package/src/modes/controllers/ssh-command-controller.ts +3 -1
- package/src/modes/interactive-mode.ts +10 -0
- package/src/modes/utils/macos-option-forwarding.ts +80 -0
- package/src/prompts/system/irc-incoming.md +3 -1
- package/src/prompts/system/project-prompt.md +19 -0
- package/src/prompts/system/system-prompt.md +3 -0
- package/src/prompts/tools/ask.md +2 -0
- package/src/prompts/tools/debug.md +1 -1
- package/src/prompts/tools/monitor.md +7 -5
- package/src/prompts/tools/reverse-engineer.md +29 -0
- package/src/runtime-credential-selector.ts +2 -2
- package/src/runtime-mcp/config-writer.ts +10 -6
- package/src/runtime-mcp/config.ts +1 -0
- package/src/runtime-mcp/content-limits.ts +7 -0
- package/src/runtime-mcp/json-rpc.ts +2 -1
- package/src/runtime-mcp/manager.ts +57 -9
- package/src/runtime-mcp/mcp-redirect.ts +73 -0
- package/src/runtime-mcp/oauth-flow.ts +43 -5
- package/src/runtime-mcp/oauth-public-url.ts +8 -0
- package/src/runtime-mcp/plugin-mcp-name-filter.ts +62 -0
- package/src/runtime-mcp/plugin-network-boundary.ts +4 -0
- package/src/runtime-mcp/project-host-values.ts +50 -0
- package/src/runtime-mcp/render.ts +16 -1
- package/src/runtime-mcp/smithery-registry.ts +22 -3
- package/src/runtime-mcp/tool-bridge.ts +194 -21
- package/src/runtime-mcp/transports/http.ts +4 -3
- package/src/runtime-mcp/transports/stdio.ts +2 -1
- package/src/runtime-mcp/types.ts +6 -0
- package/src/sdk/broker/broker.ts +11 -2
- package/src/sdk/broker/ensure.ts +131 -10
- package/src/sdk/broker/lifecycle-ledger.ts +18 -3
- package/src/sdk/broker/lifecycle.ts +21 -19
- package/src/sdk/broker/runtime.ts +1 -1
- package/src/sdk/bus/chat-daemon-cli.ts +38 -1
- package/src/sdk/bus/chat-daemon-control.ts +5 -3
- package/src/sdk/bus/index.ts +5 -3
- package/src/sdk/bus/lifecycle-control-runtime.ts +9 -2
- package/src/sdk/bus/session-control.ts +2 -0
- package/src/sdk/bus/slack-daemon.ts +8 -1
- package/src/sdk/bus/slack-live-provider.ts +3 -1
- package/src/sdk/bus/telegram-daemon-contract.ts +3 -1
- package/src/sdk/bus/telegram-daemon-control.ts +17 -12
- package/src/sdk/bus/telegram-daemon.ts +41 -1
- package/src/sdk/host/events.ts +67 -4
- package/src/sdk/mcp/server.ts +16 -3
- package/src/sdk/protocol/operation-inventory.generated.json +22 -0
- package/src/sdk/session.ts +18 -25
- package/src/secrets/obfuscator.ts +92 -12
- package/src/session/agent-session.ts +395 -79
- package/src/session/artifacts.ts +3 -1
- package/src/session/history-storage.ts +172 -8
- package/src/session/internal/managed-session-scope.ts +130 -52
- package/src/session/messages.ts +47 -6
- package/src/session/session-manager.ts +170 -10
- package/src/session/session-storage.ts +31 -1
- package/src/session/streaming-output.ts +263 -4
- package/src/session-import/redact.ts +76 -3
- package/src/setup/hermes-setup.ts +4 -1
- package/src/skc-runtime/gc-runtime.ts +26 -4
- package/src/skc-runtime/launch-tmux.ts +21 -11
- package/src/skc-runtime/launch-worktree.ts +42 -3
- package/src/skc-runtime/managed-owner-admission.ts +46 -2
- package/src/skc-runtime/psmux-detect.ts +29 -5
- package/src/skc-runtime/ralplan-runtime.ts +14 -1
- package/src/skc-runtime/session-resolution.ts +38 -6
- package/src/skc-runtime/sidecar-bootstrap-env.ts +19 -0
- package/src/skc-runtime/state-writer.ts +134 -16
- package/src/skc-runtime/tmux-sessions.ts +85 -4
- package/src/skc-runtime/ultragoal-change-set.ts +18 -2
- package/src/skc-runtime/ultragoal-guard.ts +9 -1
- package/src/skc-runtime/ultragoal-runtime.ts +26 -9
- package/src/skill-state/active-state.ts +13 -0
- package/src/skill-state/workflow-mutation-guard.ts +3297 -180
- package/src/slash-commands/builtin-registry.ts +14 -8
- package/src/slash-commands/helpers/mcp.ts +20 -7
- package/src/ssh/ssh-executor.ts +3 -1
- package/src/stt/recorder.ts +26 -9
- package/src/system-prompt.ts +65 -16
- package/src/task/commands.ts +3 -1
- package/src/task/executor.ts +52 -7
- package/src/task/index.ts +28 -0
- package/src/task/isolation-dir.ts +143 -0
- package/src/task/role-body.ts +84 -0
- package/src/task/token-log-mode.test.ts +162 -0
- package/src/task/token-log.ts +91 -2
- package/src/task/worktree.ts +16 -7
- package/src/tools/archive-reader.ts +653 -31
- package/src/tools/ask.ts +86 -14
- package/src/tools/ast-edit-write-path.ts +133 -0
- package/src/tools/ast-edit.ts +27 -1
- package/src/tools/ast-grep.ts +7 -2
- package/src/tools/atomic-file-write.ts +625 -0
- package/src/tools/auto-generated-guard.ts +28 -8
- package/src/tools/bash-allowed-prefixes.ts +225 -6
- package/src/tools/bash-interactive.ts +12 -0
- package/src/tools/bash-skill-urls.ts +113 -7
- package/src/tools/bash.ts +152 -20
- package/src/tools/browser/cdp-url.ts +18 -0
- package/src/tools/browser/tab-worker.ts +49 -14
- package/src/tools/browser.ts +25 -8
- package/src/tools/cron.ts +10 -1
- package/src/tools/debug.ts +16 -8
- package/src/tools/eval.ts +71 -34
- package/src/tools/explicit-artifact.ts +89 -0
- package/src/tools/fetch.ts +26 -17
- package/src/tools/gh.ts +40 -12
- package/src/tools/github-side-effect.ts +112 -0
- package/src/tools/image-gen.ts +24 -10
- package/src/tools/index.ts +6 -0
- package/src/tools/monitor-mutation.ts +27 -0
- package/src/tools/monitor.ts +28 -1
- package/src/tools/output-meta.ts +74 -5
- package/src/tools/read.ts +24 -36
- package/src/tools/recipe/index.ts +12 -0
- package/src/tools/recipe/recipe-guard.ts +19 -0
- package/src/tools/recipe/runner.ts +23 -12
- package/src/tools/render-utils.ts +2 -2
- package/src/tools/restricted-cwd.ts +10 -0
- package/src/tools/reverse-engineer.ts +497 -0
- package/src/tools/search-tool-bm25.ts +14 -3
- package/src/tools/search.ts +3 -2
- package/src/tools/ssh.ts +235 -8
- package/src/tools/subagent-render.ts +43 -7
- package/src/tools/subagent.ts +7 -3
- package/src/tools/tmux-self-injection-guard.ts +3538 -0
- package/src/tools/todo-write.ts +41 -3
- package/src/tools/untrusted-content.ts +23 -0
- package/src/tools/vim.ts +2 -2
- package/src/tools/write.ts +37 -4
- package/src/tui/tree-list.ts +15 -1
- package/src/utils/commit-message-generator.ts +9 -2
- package/src/utils/external-editor.ts +21 -7
- package/src/utils/file-mentions.ts +75 -7
- package/src/utils/git.ts +38 -7
- package/src/utils/open.ts +73 -4
- package/src/utils/shell-snapshot.ts +9 -1
- package/src/utils/title-generator.ts +61 -16
- package/src/utils/tools-checksum.ts +34 -0
- package/src/utils/tools-manager.ts +24 -6
- package/src/utils/xml-escape.ts +14 -0
- package/src/web/insane/url-guard.ts +2 -1
- package/src/web/scrapers/types.ts +8 -0
- package/src/web/scrapers/youtube.ts +3 -2
- package/src/web/search/index.ts +4 -3
- package/src/web/search/providers/anthropic.ts +4 -4
- package/src/web/search/providers/codex.ts +31 -34
- package/src/web/search/providers/insane.ts +145 -28
- package/src/web/search/providers/kimi.ts +15 -5
- package/src/web/search/providers/searxng.ts +47 -4
- package/src/web/search/providers/xai.ts +7 -2
- package/dist/types/cli/shell-cli.d.ts +0 -8
- package/dist/types/commands/shell.d.ts +0 -21
- package/src/cli/shell-cli.ts +0 -176
- package/src/commands/shell.ts +0 -29
package/src/capability/fs.ts
CHANGED
|
@@ -4,38 +4,104 @@ import * as path from "node:path";
|
|
|
4
4
|
const contentCache = new Map<string, string | null>();
|
|
5
5
|
const dirCache = new Map<string, fs.Dirent[]>();
|
|
6
6
|
|
|
7
|
+
/** Authority a discovery read runs under. */
|
|
8
|
+
export type ReadScope = "project" | "user";
|
|
9
|
+
|
|
10
|
+
export interface ReadFileOptions {
|
|
11
|
+
readonly scope?: ReadScope;
|
|
12
|
+
/** Skip the shared lexical cache for this operation. */
|
|
13
|
+
readonly bypassCache?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Physical root a target lexically inside it must stay inside after
|
|
16
|
+
* realpath, so a repository symlink cannot be read as its external target.
|
|
17
|
+
*/
|
|
18
|
+
readonly containmentRoot?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
7
21
|
function resolvePath(filePath: string): string {
|
|
8
22
|
return path.resolve(filePath);
|
|
9
23
|
}
|
|
10
24
|
|
|
11
|
-
|
|
25
|
+
function isWithinOrEqual(root: string, candidate: string): boolean {
|
|
26
|
+
const relative = path.relative(root, candidate);
|
|
27
|
+
return relative === "" || (!relative.startsWith(`..${path.sep}`) && relative !== ".." && !path.isAbsolute(relative));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A lexical path outside the boundary keeps the historical read. A path inside
|
|
32
|
+
* the boundary must still be inside after realpath; otherwise it is unreadable.
|
|
33
|
+
*/
|
|
34
|
+
async function containedReadPath(abs: string, options?: ReadFileOptions): Promise<string | null> {
|
|
35
|
+
const root = options?.containmentRoot;
|
|
36
|
+
if (!root) return abs;
|
|
37
|
+
const boundary = path.resolve(root);
|
|
38
|
+
if (!isWithinOrEqual(boundary, abs)) return abs;
|
|
39
|
+
try {
|
|
40
|
+
const [boundaryReal, targetReal] = await Promise.all([fs.promises.realpath(boundary), fs.promises.realpath(abs)]);
|
|
41
|
+
return isWithinOrEqual(boundaryReal, targetReal) ? targetReal : null;
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The real target a contained read refused: the path is lexically inside the
|
|
49
|
+
* containment root but resolves outside it. Null when the read was not refused
|
|
50
|
+
* for containment (no root, outside lexically, inside after realpath, missing).
|
|
51
|
+
*/
|
|
52
|
+
export async function containmentRefusalTarget(filePath: string, options?: ReadFileOptions): Promise<string | null> {
|
|
53
|
+
const root = options?.containmentRoot;
|
|
54
|
+
if (!root) return null;
|
|
55
|
+
const abs = resolvePath(filePath);
|
|
56
|
+
const boundary = path.resolve(root);
|
|
57
|
+
if (!isWithinOrEqual(boundary, abs)) return null;
|
|
58
|
+
try {
|
|
59
|
+
const [boundaryReal, targetReal] = await Promise.all([fs.promises.realpath(boundary), fs.promises.realpath(abs)]);
|
|
60
|
+
return isWithinOrEqual(boundaryReal, targetReal) ? null : targetReal;
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export async function readFile(filePath: string, options?: ReadFileOptions): Promise<string | null> {
|
|
12
67
|
const abs = resolvePath(filePath);
|
|
13
|
-
|
|
68
|
+
// A contained read must not share the lexical cache with a different boundary.
|
|
69
|
+
const useCache = !options?.bypassCache && !options?.containmentRoot;
|
|
70
|
+
if (useCache && contentCache.has(abs)) {
|
|
14
71
|
return contentCache.get(abs) ?? null;
|
|
15
72
|
}
|
|
16
73
|
|
|
74
|
+
const readable = await containedReadPath(abs, options);
|
|
75
|
+
if (readable === null) {
|
|
76
|
+
if (useCache) contentCache.set(abs, null);
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
17
79
|
try {
|
|
18
|
-
const content = await Bun.file(
|
|
19
|
-
contentCache.set(abs, content);
|
|
80
|
+
const content = await Bun.file(readable).text();
|
|
81
|
+
if (useCache) contentCache.set(abs, content);
|
|
20
82
|
return content;
|
|
21
83
|
} catch {
|
|
22
|
-
contentCache.set(abs, null);
|
|
84
|
+
if (useCache) contentCache.set(abs, null);
|
|
23
85
|
return null;
|
|
24
86
|
}
|
|
25
87
|
}
|
|
26
88
|
|
|
27
|
-
export async function readDirEntries(
|
|
89
|
+
export async function readDirEntries(
|
|
90
|
+
dirPath: string,
|
|
91
|
+
options?: Pick<ReadFileOptions, "bypassCache">,
|
|
92
|
+
): Promise<fs.Dirent[]> {
|
|
28
93
|
const abs = resolvePath(dirPath);
|
|
29
|
-
|
|
94
|
+
const useCache = !options?.bypassCache;
|
|
95
|
+
if (useCache && dirCache.has(abs)) {
|
|
30
96
|
return dirCache.get(abs) ?? [];
|
|
31
97
|
}
|
|
32
98
|
|
|
33
99
|
try {
|
|
34
100
|
const entries = await fs.promises.readdir(abs, { withFileTypes: true });
|
|
35
|
-
dirCache.set(abs, entries);
|
|
101
|
+
if (useCache) dirCache.set(abs, entries);
|
|
36
102
|
return entries;
|
|
37
103
|
} catch {
|
|
38
|
-
dirCache.set(abs, []);
|
|
104
|
+
if (useCache) dirCache.set(abs, []);
|
|
39
105
|
return [];
|
|
40
106
|
}
|
|
41
107
|
}
|
|
@@ -69,12 +135,13 @@ export async function walkUp(
|
|
|
69
135
|
/**
|
|
70
136
|
* Walk up from startDir looking for a `.git` entry (file or directory).
|
|
71
137
|
* Returns the directory containing `.git` (the repo root), or null if not in a git repo.
|
|
72
|
-
*
|
|
138
|
+
* Reads bypass the directory cache: the repository root is the project read
|
|
139
|
+
* boundary, so a `.git` created after an earlier discovery must narrow it.
|
|
73
140
|
*/
|
|
74
141
|
export async function findRepoRoot(startDir: string): Promise<string | null> {
|
|
75
142
|
let current = resolvePath(startDir);
|
|
76
143
|
while (true) {
|
|
77
|
-
const entries = await readDirEntries(current);
|
|
144
|
+
const entries = await readDirEntries(current, { bypassCache: true });
|
|
78
145
|
if (entries.some(e => e.name === ".git")) {
|
|
79
146
|
return current;
|
|
80
147
|
}
|
package/src/capability/mcp.ts
CHANGED
|
@@ -33,6 +33,8 @@ export interface MCPServer {
|
|
|
33
33
|
url?: string;
|
|
34
34
|
/** HTTP headers (for HTTP transport) */
|
|
35
35
|
headers?: Record<string, string>;
|
|
36
|
+
/** Persisted public-network requirement for an HTTP MCP endpoint. */
|
|
37
|
+
publicNetwork?: boolean;
|
|
36
38
|
/** Authentication configuration */
|
|
37
39
|
auth?: {
|
|
38
40
|
type: "oauth" | "apikey";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface AppendSystemPromptCandidate {
|
|
2
|
+
level: "user" | "project";
|
|
3
|
+
path: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/** First user file. A repository copy is untrusted project text and is never selected. */
|
|
7
|
+
export function selectAppendSystemPromptFile(candidates: readonly AppendSystemPromptCandidate[]): string | undefined {
|
|
8
|
+
for (const candidate of candidates) {
|
|
9
|
+
if (candidate.level === "user") return candidate.path;
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
AuthStorage,
|
|
24
24
|
type CredentialDisabledEvent,
|
|
25
25
|
DEFAULT_AUTH_BROKER_BIND,
|
|
26
|
+
formatOAuthIdentityLabel,
|
|
26
27
|
getEnvApiKey,
|
|
27
28
|
getOAuthProviders,
|
|
28
29
|
listProvidersWithEnvKey,
|
|
@@ -397,7 +398,7 @@ async function runImport(flags: AuthBrokerCommandArgs["flags"]): Promise<void> {
|
|
|
397
398
|
if (!target) {
|
|
398
399
|
throw new Error("Usage: skc auth-broker import <file|dir> [--provider=<id>] [--include-disabled] [--dry-run]");
|
|
399
400
|
}
|
|
400
|
-
const resolvedTarget = path.resolve(target.startsWith("~") ? target.replace(/^~/, os.homedir()) : target);
|
|
401
|
+
const resolvedTarget = path.resolve(target.startsWith("~") ? target.replace(/^~/, () => os.homedir()) : target);
|
|
401
402
|
const { entries, skipped } = await loadImportPlan(resolvedTarget, flags.provider, flags.includeDisabled === true);
|
|
402
403
|
|
|
403
404
|
if (flags.json) {
|
|
@@ -490,19 +491,21 @@ interface MigrateSkip {
|
|
|
490
491
|
|
|
491
492
|
function credentialIdentity(provider: string, credential: AuthCredential): string {
|
|
492
493
|
if (credential.type === "api_key") return "(api key)";
|
|
493
|
-
return credential
|
|
494
|
+
return formatOAuthIdentityLabel(credential) ?? `<${provider} oauth>`;
|
|
494
495
|
}
|
|
495
496
|
|
|
496
497
|
/**
|
|
497
498
|
* Build the set of "identities already on the broker" so re-runs are idempotent.
|
|
498
|
-
* For OAuth, identity = email|accountId|projectId
|
|
499
|
-
*
|
|
500
|
-
*
|
|
499
|
+
* For OAuth, identity = email|accountId|projectId, scoped to the organization
|
|
500
|
+
* when the credential carries one (one account can sign in to several
|
|
501
|
+
* organizations). For api_key, we collapse to a single marker per provider
|
|
502
|
+
* (broker has no concept of "multiple api keys per provider with different
|
|
503
|
+
* identities"; upsert would coalesce them).
|
|
501
504
|
*/
|
|
502
505
|
function indexBrokerSnapshot(snapshot: {
|
|
503
506
|
credentials: Array<{
|
|
504
507
|
provider: string;
|
|
505
|
-
credential: { type: string; email?: string; accountId?: string; projectId?: string };
|
|
508
|
+
credential: { type: string; email?: string; accountId?: string; projectId?: string; organizationId?: string };
|
|
506
509
|
}>;
|
|
507
510
|
}): Map<string, Set<string>> {
|
|
508
511
|
const out = new Map<string, Set<string>>();
|
|
@@ -511,22 +514,29 @@ function indexBrokerSnapshot(snapshot: {
|
|
|
511
514
|
if (entry.credential.type === "api_key") {
|
|
512
515
|
ids.add("@api_key");
|
|
513
516
|
} else {
|
|
514
|
-
|
|
515
|
-
if (entry.credential.
|
|
516
|
-
if (entry.credential.
|
|
517
|
+
const org = organizationSuffix(entry.credential.organizationId);
|
|
518
|
+
if (entry.credential.email) ids.add(`email:${entry.credential.email}${org}`);
|
|
519
|
+
if (entry.credential.accountId) ids.add(`accountId:${entry.credential.accountId}${org}`);
|
|
520
|
+
if (entry.credential.projectId) ids.add(`projectId:${entry.credential.projectId}${org}`);
|
|
517
521
|
}
|
|
518
522
|
out.set(entry.provider, ids);
|
|
519
523
|
}
|
|
520
524
|
return out;
|
|
521
525
|
}
|
|
522
526
|
|
|
527
|
+
function organizationSuffix(organizationId: string | undefined): string {
|
|
528
|
+
const trimmed = organizationId?.trim();
|
|
529
|
+
return trimmed ? `|org:${trimmed}` : "";
|
|
530
|
+
}
|
|
531
|
+
|
|
523
532
|
function brokerAlreadyHas(existing: Map<string, Set<string>>, provider: string, credential: AuthCredential): boolean {
|
|
524
533
|
const ids = existing.get(provider);
|
|
525
534
|
if (!ids) return false;
|
|
526
535
|
if (credential.type === "api_key") return ids.has("@api_key");
|
|
527
|
-
|
|
528
|
-
if (credential.
|
|
529
|
-
if (credential.
|
|
536
|
+
const org = organizationSuffix(credential.organizationId);
|
|
537
|
+
if (credential.email && ids.has(`email:${credential.email}${org}`)) return true;
|
|
538
|
+
if (credential.accountId && ids.has(`accountId:${credential.accountId}${org}`)) return true;
|
|
539
|
+
if (credential.projectId && ids.has(`projectId:${credential.projectId}${org}`)) return true;
|
|
530
540
|
return false;
|
|
531
541
|
}
|
|
532
542
|
|
package/src/cli/config-cli.ts
CHANGED
|
@@ -53,29 +53,19 @@ type CliSettingDef = {
|
|
|
53
53
|
const ALL_SETTING_PATHS = Object.keys(SETTINGS_SCHEMA) as SettingPath[];
|
|
54
54
|
const REDACTED_SECRET_VALUE = "<redacted>";
|
|
55
55
|
const SECRET_SETTING_WORDS = new Set(["token", "secret", "password", "passwd", "pwd", "credential", "credentials"]);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"session",
|
|
63
|
-
"client",
|
|
64
|
-
"broker",
|
|
65
|
-
"bot",
|
|
66
|
-
"basic",
|
|
67
|
-
];
|
|
68
|
-
const SECRET_SETTING_COMPOUND_SUFFIXES = ["token", "secret", "password", "credential"];
|
|
56
|
+
/**
|
|
57
|
+
* camelCase segments (`appToken`, `basicPassword`) do not split on `-`/`_`, so any segment whose
|
|
58
|
+
* normalized form ends in a secret word is secret. Plural budget names (`maxTokens`) and words that
|
|
59
|
+
* merely contain one (`showTokenUsage`) stay visible.
|
|
60
|
+
*/
|
|
61
|
+
const SECRET_SETTING_SUFFIX = /(?:token|secret|password|passwd|pwd|credentials?)$/;
|
|
69
62
|
|
|
70
63
|
function isSecretSettingSegment(segment: string): boolean {
|
|
71
64
|
const normalized = segment.toLowerCase();
|
|
72
|
-
if (
|
|
65
|
+
if (SECRET_SETTING_SUFFIX.test(normalized)) return true;
|
|
73
66
|
if (/api[-_]?key/i.test(segment)) return true;
|
|
74
67
|
const words = normalized.split(/[-_]/).filter(Boolean);
|
|
75
|
-
|
|
76
|
-
return SECRET_SETTING_COMPOUND_PREFIXES.some(prefix =>
|
|
77
|
-
SECRET_SETTING_COMPOUND_SUFFIXES.some(suffix => normalized === `${prefix}${suffix}`),
|
|
78
|
-
);
|
|
68
|
+
return words.some(word => SECRET_SETTING_WORDS.has(word));
|
|
79
69
|
}
|
|
80
70
|
|
|
81
71
|
function isSecretSettingPath(path: string): boolean {
|
package/src/cli/migrate-cli.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `skc migrate` — import MCP servers and
|
|
2
|
+
* `skc migrate` — import MCP servers, skills, and instruction files from other coding agents.
|
|
3
3
|
*/
|
|
4
4
|
import * as os from "node:os";
|
|
5
5
|
import * as path from "node:path";
|
|
@@ -53,8 +53,10 @@ export function resolveSources(from: string[]): MigrateSource[] {
|
|
|
53
53
|
|
|
54
54
|
function resolveDestinations(project: boolean, cwd: string): MigrateDestinations {
|
|
55
55
|
const scope = project ? "project" : "user";
|
|
56
|
-
const
|
|
57
|
-
|
|
56
|
+
const agentDir = project ? getProjectAgentDir(cwd) : getAgentDir();
|
|
57
|
+
const skillsDir = path.join(agentDir, "skills");
|
|
58
|
+
const instructionsPath = path.join(agentDir, "AGENTS.md");
|
|
59
|
+
return { mcpConfigPath: getMCPConfigPath(scope, cwd), skillsDir, instructionsPath };
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
/** Run the migration and return the report (does not set process.exitCode). */
|
|
@@ -66,11 +68,11 @@ export async function runMigrate(args: MigrateCommandArgs): Promise<MigrateRepor
|
|
|
66
68
|
|
|
67
69
|
const results: AdapterResult[] = [];
|
|
68
70
|
for (const source of sources) {
|
|
69
|
-
results.push(await getAdapter(source).collect({ homeDir }));
|
|
71
|
+
results.push(await getAdapter(source).collect({ homeDir, cwd, scope: args.project ? "project" : "user" }));
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
const { actions, warnings } = await planMigration({ results, destinations, force: args.force });
|
|
73
|
-
const finalActions = args.dryRun ? actions : await executeActions(actions);
|
|
75
|
+
const finalActions = args.dryRun ? actions : await executeActions(actions, { project: args.project });
|
|
74
76
|
|
|
75
77
|
return buildReport({
|
|
76
78
|
actions: finalActions,
|
package/src/cli/ssh-cli.ts
CHANGED
|
@@ -74,9 +74,12 @@ async function handleAdd(cmd: SSHCommandArgs): Promise<void> {
|
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
// Validate port if provided
|
|
77
|
+
// Validate port if provided. `Number.parseInt` accepts trailing garbage
|
|
78
|
+
// (parseInt("22oops") === 22, parseInt("2222.5") === 2222), so require
|
|
79
|
+
// the whole token to be digits before parsing.
|
|
80
|
+
let port: number | undefined;
|
|
78
81
|
if (cmd.flags.port !== undefined) {
|
|
79
|
-
|
|
82
|
+
port = /^\d+$/.test(cmd.flags.port) ? Number.parseInt(cmd.flags.port, 10) : Number.NaN;
|
|
80
83
|
if (Number.isNaN(port) || port < 1 || port > 65535) {
|
|
81
84
|
process.stdout.write(chalk.red("Error: Port must be an integer between 1 and 65535\n"));
|
|
82
85
|
process.exitCode = 1;
|
|
@@ -86,7 +89,7 @@ async function handleAdd(cmd: SSHCommandArgs): Promise<void> {
|
|
|
86
89
|
|
|
87
90
|
const hostConfig: SSHHostConfig = { host };
|
|
88
91
|
if (cmd.flags.user) hostConfig.username = cmd.flags.user;
|
|
89
|
-
if (
|
|
92
|
+
if (port !== undefined) hostConfig.port = port;
|
|
90
93
|
if (cmd.flags.key) hostConfig.keyPath = cmd.flags.key;
|
|
91
94
|
if (cmd.flags.desc) hostConfig.description = cmd.flags.desc;
|
|
92
95
|
if (cmd.flags.compat) hostConfig.compat = true;
|
package/src/cli/stats-cli.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Handles `skc stats` subcommand for viewing AI usage statistics.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { APP_NAME, formatDuration, formatNumber, formatPercent } from "@sayknow-cli/utils";
|
|
7
|
+
import { APP_NAME, formatDuration, formatNumber, formatPercent, sanitizeDisplayLine } from "@sayknow-cli/utils";
|
|
8
8
|
import chalk from "chalk";
|
|
9
9
|
import { openPath } from "../utils/open";
|
|
10
10
|
|
|
@@ -131,7 +131,10 @@ export async function runStatsCommand(cmd: StatsCommandArgs): Promise<void> {
|
|
|
131
131
|
const { processed, files } = await syncAllSessions({ onProgress: progress.onProgress });
|
|
132
132
|
progress.finish();
|
|
133
133
|
const total = await getTotalMessageCount();
|
|
134
|
-
|
|
134
|
+
const synced = `Synced ${processed} new entries from ${files} files (${total} total)\n`;
|
|
135
|
+
// `--json` stdout must be exactly the JSON document so it can be piped into a parser.
|
|
136
|
+
if (cmd.json) process.stderr.write(`${synced}\n`);
|
|
137
|
+
else console.log(synced);
|
|
135
138
|
|
|
136
139
|
if (cmd.json) {
|
|
137
140
|
const stats = await getDashboardStats();
|
|
@@ -191,7 +194,7 @@ async function printStatsSummary(): Promise<void> {
|
|
|
191
194
|
console.log(chalk.bold("\nBy Model:"));
|
|
192
195
|
for (const m of byModel.slice(0, 10)) {
|
|
193
196
|
console.log(
|
|
194
|
-
` ${m.model}: ${formatNumber(m.totalRequests)} reqs, ${formatCost(m.totalCost)}, ${formatPercent(m.cacheRate)} cache`,
|
|
197
|
+
` ${sanitizeDisplayLine(m.model)}: ${formatNumber(m.totalRequests)} reqs, ${formatCost(m.totalCost)}, ${formatPercent(m.cacheRate)} cache`,
|
|
195
198
|
);
|
|
196
199
|
}
|
|
197
200
|
}
|
|
@@ -199,7 +202,9 @@ async function printStatsSummary(): Promise<void> {
|
|
|
199
202
|
if (byFolder.length > 0) {
|
|
200
203
|
console.log(chalk.bold("\nBy Folder:"));
|
|
201
204
|
for (const f of byFolder.slice(0, 10)) {
|
|
202
|
-
console.log(
|
|
205
|
+
console.log(
|
|
206
|
+
` ${sanitizeDisplayLine(f.folder)}: ${formatNumber(f.totalRequests)} reqs, ${formatCost(f.totalCost)}`,
|
|
207
|
+
);
|
|
203
208
|
}
|
|
204
209
|
}
|
|
205
210
|
|
package/src/cli/update-cli.ts
CHANGED
|
@@ -166,6 +166,40 @@ function resolveNpmManagedTarget(
|
|
|
166
166
|
return undefined;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Detect a project-local package install: `<...>/node_modules/.bin/<name>` with
|
|
171
|
+
* or without an executable extension.
|
|
172
|
+
*
|
|
173
|
+
* On Windows a dependency-installed CLI is a real `.exe` copied into
|
|
174
|
+
* `node_modules/.bin`, so the `.cmd`/`.ps1` shim rules never match it and
|
|
175
|
+
* `skc update` used to treat it as a standalone binary and try to replace it.
|
|
176
|
+
* That file belongs to the package manager and to the project's dependency
|
|
177
|
+
* tree: replacing it breaks the lockfile contract and, on Windows, fails on the
|
|
178
|
+
* file's ACL. The caller must redirect to the package manager instead of
|
|
179
|
+
* downloading a replacement.
|
|
180
|
+
*/
|
|
181
|
+
function resolveProjectLocalPackageInstall(
|
|
182
|
+
ompPath: string,
|
|
183
|
+
platform: PathPlatform = process.platform,
|
|
184
|
+
): { packageRoot: string } | undefined {
|
|
185
|
+
const pathApi = pathApiForPlatform(platform);
|
|
186
|
+
const resolved = pathApi.normalize(ompPath);
|
|
187
|
+
const binDir = pathApi.dirname(resolved);
|
|
188
|
+
if (pathApi.basename(binDir).toLowerCase() !== ".bin") return undefined;
|
|
189
|
+
if (pathApi.basename(pathApi.dirname(binDir)).toLowerCase() !== "node_modules") return undefined;
|
|
190
|
+
const extension = pathApi.extname(resolved).toLowerCase();
|
|
191
|
+
const basename = extension ? pathApi.basename(resolved, extension) : pathApi.basename(resolved);
|
|
192
|
+
if (basename.toLowerCase() !== APP_NAME.toLowerCase()) return undefined;
|
|
193
|
+
return { packageRoot: pathApi.dirname(binDir) };
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export function resolveProjectLocalPackageInstallForTest(
|
|
197
|
+
ompPath: string,
|
|
198
|
+
platform: PathPlatform,
|
|
199
|
+
): { packageRoot: string } | undefined {
|
|
200
|
+
return resolveProjectLocalPackageInstall(ompPath, platform);
|
|
201
|
+
}
|
|
202
|
+
|
|
169
203
|
function resolveUpdateMethod(ompPath: string, bunBinDir: string | undefined): "bun" | "npm" | "binary" {
|
|
170
204
|
if (resolveNpmManagedTarget(ompPath)) return "npm";
|
|
171
205
|
if (!bunBinDir) return "binary";
|
|
@@ -187,6 +221,14 @@ async function resolveUpdateTarget(): Promise<UpdateTarget> {
|
|
|
187
221
|
const bunBinDir = await getBunGlobalBinDir();
|
|
188
222
|
const ompPath = resolveSkcPath();
|
|
189
223
|
|
|
224
|
+
if (ompPath && resolveProjectLocalPackageInstall(ompPath)) {
|
|
225
|
+
throw new Error(
|
|
226
|
+
formatUnsupportedTargetMessage(
|
|
227
|
+
`${APP_NAME} at ${ompPath} is installed by a package manager in this project's node_modules; update the dependency instead of replacing that file`,
|
|
228
|
+
),
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
190
232
|
if (ompPath) {
|
|
191
233
|
const npmTarget = resolveNpmManagedTarget(ompPath);
|
|
192
234
|
if (npmTarget) return { method: "npm", packageName: npmTarget.packageName };
|
|
@@ -95,7 +95,10 @@ export function parseSearchArgs(args: string[]): SearchCommandArgs | undefined {
|
|
|
95
95
|
result.recency = value() as SearchCommandArgs["recency"];
|
|
96
96
|
consumeSeparateValue();
|
|
97
97
|
} else if (arg === "--limit" || arg === "-l") {
|
|
98
|
-
|
|
98
|
+
const raw = value();
|
|
99
|
+
// `Number.parseInt` accepts trailing garbage ("5x" -> 5); leave
|
|
100
|
+
// anything that is not plain digits as NaN so it is rejected below.
|
|
101
|
+
result.limit = /^\d+$/.test(raw) ? Number.parseInt(raw, 10) : Number.NaN;
|
|
99
102
|
consumeSeparateValue();
|
|
100
103
|
} else if (arg === "--xai-mode") {
|
|
101
104
|
result.xaiSearchMode = value() as SearchCommandArgs["xaiSearchMode"];
|
|
@@ -164,8 +167,11 @@ export async function runSearchCommand(cmd: SearchCommandArgs): Promise<void> {
|
|
|
164
167
|
process.exit(1);
|
|
165
168
|
}
|
|
166
169
|
|
|
167
|
-
|
|
168
|
-
|
|
170
|
+
// `Flags.integer` accepts `0` and negative values; providers forward them
|
|
171
|
+
// as `num_results` and several slice sources with them (`slice(0, -3)`
|
|
172
|
+
// silently drops the last three results).
|
|
173
|
+
if (cmd.limit !== undefined && (!Number.isSafeInteger(cmd.limit) || cmd.limit < 1)) {
|
|
174
|
+
process.stderr.write(`${chalk.red("Error: --limit must be a positive integer")}\n`);
|
|
169
175
|
process.exit(1);
|
|
170
176
|
}
|
|
171
177
|
|
package/src/cli.ts
CHANGED
|
@@ -82,14 +82,10 @@ async function showHelp(config: CliConfig): Promise<void> {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
async function installRuntimeGlobals(): Promise<void> {
|
|
85
|
-
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
// `protocol: "http2"` per request, with transparent HTTP/1.1 fallback on
|
|
90
|
-
// `HTTP2Unsupported`. See @sayknow-cli/ai/utils/h2-fetch for details.
|
|
91
|
-
installH2Fetch();
|
|
92
|
-
|
|
85
|
+
// fetch() deliberately stays on HTTP/1.1. Bun's HTTP/2 client (per-request
|
|
86
|
+
// `protocol: "http2"`) wedges a pooled connection while uploading large
|
|
87
|
+
// request bodies (~300KB): every later request on it waits forever for
|
|
88
|
+
// response headers. Do not re-enable HTTP/2 without re-running that probe.
|
|
93
89
|
const { warnIfMacOSNoFileLimitTooLow } = await import("./cli/nofile-limit");
|
|
94
90
|
warnIfMacOSNoFileLimitTooLow();
|
|
95
91
|
|
|
@@ -265,7 +261,7 @@ export class RootHelpCommand extends Command {
|
|
|
265
261
|
"api-key": Flags.string({ description: "API key (defaults to env vars)" }),
|
|
266
262
|
credential: Flags.string({
|
|
267
263
|
description:
|
|
268
|
-
"Stored credential selector: email:<addr>, id:<n>, account:<id>, project:<id>, or provider/email:<addr>",
|
|
264
|
+
"Stored credential selector: email:<addr>, id:<n>, account:<id>, project:<id>, org:<organization id or name>, or provider/email:<addr>",
|
|
269
265
|
}),
|
|
270
266
|
"system-prompt": Flags.string({ description: "System prompt (default: coding assistant prompt)" }),
|
|
271
267
|
"append-system-prompt": Flags.string({ description: "Append text or file contents to the system prompt" }),
|
package/src/commands/commit.ts
CHANGED
|
@@ -32,8 +32,8 @@ export default class Commit extends Command {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
await initTheme();
|
|
35
|
-
// The agentic commit flow opens
|
|
36
|
-
// provider
|
|
35
|
+
// The agentic commit flow opens keep-alive sockets to the model
|
|
36
|
+
// provider and spins up an AgentSession with
|
|
37
37
|
// background async-job + extension machinery. `session.dispose()` releases
|
|
38
38
|
// what it can, but Bun's fetch keeps idle connections warm and a few
|
|
39
39
|
// timers (Settings autosave, OAuth refresh) stay armed long enough to
|
|
@@ -9,12 +9,11 @@ export default class ContributionPrep extends Command {
|
|
|
9
9
|
static strict = false;
|
|
10
10
|
|
|
11
11
|
static flags = {
|
|
12
|
-
"no-spawn": Flags.boolean({ description: "Only write artifacts; do not spawn a fresh SKC worker" }),
|
|
13
12
|
"source-session-id": Flags.string({ description: "Source session id to record in the manifest" }),
|
|
14
13
|
"artifact-root": Flags.string({ description: "Directory where contribute-pr artifacts are written" }),
|
|
15
14
|
};
|
|
16
15
|
|
|
17
|
-
static examples = ["skc contribute-pr"
|
|
16
|
+
static examples = ["skc contribute-pr"];
|
|
18
17
|
|
|
19
18
|
async run(): Promise<void> {
|
|
20
19
|
const { flags } = await this.parse(ContributionPrep);
|
|
@@ -27,7 +26,6 @@ export default class ContributionPrep extends Command {
|
|
|
27
26
|
messages: [],
|
|
28
27
|
},
|
|
29
28
|
{
|
|
30
|
-
spawnWorker: !flags["no-spawn"],
|
|
31
29
|
artifactRoot: flags["artifact-root"],
|
|
32
30
|
},
|
|
33
31
|
);
|
package/src/commands/harness.ts
CHANGED
|
@@ -26,7 +26,11 @@ import {
|
|
|
26
26
|
} from "../harness-control-plane/lifecycle-reconciliation";
|
|
27
27
|
import { type ResolvedOwner, RuntimeOwner, resolveOwner, resolveOwnerLive } from "../harness-control-plane/owner";
|
|
28
28
|
import { preserveDirtyWorktree } from "../harness-control-plane/preserve";
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
RECEIPT_SPOOL_DIR_ENV,
|
|
31
|
+
resolveReceiptSpoolDir,
|
|
32
|
+
trustedReceiptSpoolDir,
|
|
33
|
+
} from "../harness-control-plane/receipt-spool";
|
|
30
34
|
import { buildReceipt, requiresVanishBeforeAction, type VanishEvidence } from "../harness-control-plane/receipts";
|
|
31
35
|
import { createSdkSessionTransport, spawnNormalHarnessSession } from "../harness-control-plane/sdk-transport";
|
|
32
36
|
import { classifyLeaseStatus, readLease } from "../harness-control-plane/session-lease";
|
|
@@ -1004,8 +1008,9 @@ export default class Harness extends Command {
|
|
|
1004
1008
|
`${SKC_TMUX_OWNER_STATE_DIR_ENV}=${shellQuote(ownerStateDir)}`,
|
|
1005
1009
|
`${SKC_TMUX_OWNER_SERVER_KEY_ENV}=${shellQuote(socketKey)}`,
|
|
1006
1010
|
];
|
|
1007
|
-
|
|
1008
|
-
|
|
1011
|
+
const trustedSpoolDir = resolveReceiptSpoolDir();
|
|
1012
|
+
if (trustedSpoolDir) envAssignments.push(`${RECEIPT_SPOOL_DIR_ENV}=${shellQuote(trustedSpoolDir)}`);
|
|
1013
|
+
else envAssignments.unshift(`-u ${RECEIPT_SPOOL_DIR_ENV}`);
|
|
1009
1014
|
if (process.env.SKC_HARNESS_TEST_NODE_MODULES)
|
|
1010
1015
|
envAssignments.push(`SKC_HARNESS_TEST_NODE_MODULES=${shellQuote(process.env.SKC_HARNESS_TEST_NODE_MODULES)}`);
|
|
1011
1016
|
if (process.env.SKC_SDK_DISABLE)
|
|
@@ -1203,19 +1208,20 @@ export default class Harness extends Command {
|
|
|
1203
1208
|
}
|
|
1204
1209
|
const fallbackReason = tmux.reason;
|
|
1205
1210
|
const cmd = this.#buildOwnerCommand(sessionId);
|
|
1211
|
+
const trustedSpoolDir = resolveReceiptSpoolDir();
|
|
1212
|
+
const childEnv: NodeJS.ProcessEnv = {
|
|
1213
|
+
...process.env,
|
|
1214
|
+
SKC_HARNESS_STATE_ROOT: root,
|
|
1215
|
+
...(process.env.SKC_HARNESS_TEST_NODE_MODULES
|
|
1216
|
+
? { SKC_HARNESS_TEST_NODE_MODULES: process.env.SKC_HARNESS_TEST_NODE_MODULES }
|
|
1217
|
+
: {}),
|
|
1218
|
+
...(process.env.SKC_SDK_DISABLE ? { SKC_SDK_DISABLE: process.env.SKC_SDK_DISABLE } : {}),
|
|
1219
|
+
};
|
|
1220
|
+
if (trustedSpoolDir) childEnv[RECEIPT_SPOOL_DIR_ENV] = trustedSpoolDir;
|
|
1221
|
+
else delete childEnv[RECEIPT_SPOOL_DIR_ENV];
|
|
1206
1222
|
const child = Bun.spawn(cmd, {
|
|
1207
1223
|
cwd,
|
|
1208
|
-
env:
|
|
1209
|
-
...process.env,
|
|
1210
|
-
SKC_HARNESS_STATE_ROOT: root,
|
|
1211
|
-
...(process.env[RECEIPT_SPOOL_DIR_ENV]
|
|
1212
|
-
? { [RECEIPT_SPOOL_DIR_ENV]: process.env[RECEIPT_SPOOL_DIR_ENV] }
|
|
1213
|
-
: {}),
|
|
1214
|
-
...(process.env.SKC_HARNESS_TEST_NODE_MODULES
|
|
1215
|
-
? { SKC_HARNESS_TEST_NODE_MODULES: process.env.SKC_HARNESS_TEST_NODE_MODULES }
|
|
1216
|
-
: {}),
|
|
1217
|
-
...(process.env.SKC_SDK_DISABLE ? { SKC_SDK_DISABLE: process.env.SKC_SDK_DISABLE } : {}),
|
|
1218
|
-
},
|
|
1224
|
+
env: childEnv,
|
|
1219
1225
|
stdout: "ignore",
|
|
1220
1226
|
stderr: "ignore",
|
|
1221
1227
|
stdin: "ignore",
|
|
@@ -1374,7 +1380,11 @@ export default class Harness extends Command {
|
|
|
1374
1380
|
if (!owner.live || !owner.socketPath) return false;
|
|
1375
1381
|
const priorSpoolDir = input[RECEIPT_SPOOL_DIR_ENV];
|
|
1376
1382
|
try {
|
|
1377
|
-
|
|
1383
|
+
const fromEnv = resolveReceiptSpoolDir();
|
|
1384
|
+
const fromInput = trustedReceiptSpoolDir(typeof priorSpoolDir === "string" ? priorSpoolDir : undefined);
|
|
1385
|
+
const trustedSpoolDir = fromEnv ?? fromInput;
|
|
1386
|
+
if (trustedSpoolDir) input[RECEIPT_SPOOL_DIR_ENV] = trustedSpoolDir;
|
|
1387
|
+
else delete input[RECEIPT_SPOOL_DIR_ENV];
|
|
1378
1388
|
const res = (await callEndpoint(owner.socketPath, { verb, input })) as { ok?: boolean };
|
|
1379
1389
|
writeJson(res);
|
|
1380
1390
|
if (res?.ok === false) process.exitCode = 1;
|
package/src/commands/launch.ts
CHANGED
|
@@ -97,7 +97,7 @@ export default class Index extends Command {
|
|
|
97
97
|
}),
|
|
98
98
|
credential: Flags.string({
|
|
99
99
|
description:
|
|
100
|
-
"Stored credential selector: email:<addr>, id:<n>, account:<id>, project:<id>, or provider/email:<addr>",
|
|
100
|
+
"Stored credential selector: email:<addr>, id:<n>, account:<id>, project:<id>, org:<organization id or name>, or provider/email:<addr>",
|
|
101
101
|
}),
|
|
102
102
|
"system-prompt": Flags.string({
|
|
103
103
|
description: "System prompt (default: coding assistant prompt)",
|
package/src/commands/migrate.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Import MCP servers and
|
|
2
|
+
* Import MCP servers, skills, and instructions from other coding agents into SKC.
|
|
3
3
|
*/
|
|
4
4
|
import { Command, Flags } from "@sayknow-cli/utils/cli";
|
|
5
5
|
import { type MigrateCommandArgs, runMigrateCommand } from "../cli/migrate-cli";
|
|
6
6
|
|
|
7
7
|
export default class Migrate extends Command {
|
|
8
|
-
static description = "Import MCP servers and skills
|
|
8
|
+
static description = "Import MCP servers and skills, plus Claude Code/Codex instructions";
|
|
9
9
|
|
|
10
10
|
static examples = [
|
|
11
11
|
"skc migrate --from claude-code",
|
|
@@ -25,7 +25,7 @@ export default class Migrate extends Command {
|
|
|
25
25
|
default: false,
|
|
26
26
|
}),
|
|
27
27
|
force: Flags.boolean({
|
|
28
|
-
description: "Overwrite existing skills
|
|
28
|
+
description: "Overwrite existing skills, MCP servers, or instruction files instead of skipping them",
|
|
29
29
|
default: false,
|
|
30
30
|
}),
|
|
31
31
|
"dry-run": Flags.boolean({ description: "Preview the migration without writing anything", default: false }),
|