@greppleai/grip 0.1.5 → 0.1.7
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 +35 -0
- package/README.md +1 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/embedded-assets.d.ts.map +1 -1
- package/dist/bun/embedded-assets.js.map +1 -1
- package/dist/bun/register-bedrock.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.js.map +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/initial-message.d.ts +1 -1
- package/dist/cli/initial-message.d.ts.map +1 -1
- package/dist/cli/initial-message.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +38 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +289 -154
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -10
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +19 -23
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +9 -2
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/compression-detection-ledger.d.ts.map +1 -1
- package/dist/core/compaction/compression-detection-ledger.js.map +1 -1
- package/dist/core/compaction/compression-detector.d.ts +1 -0
- package/dist/core/compaction/compression-detector.d.ts.map +1 -1
- package/dist/core/compaction/compression-detector.js +10 -21
- package/dist/core/compaction/compression-detector.js.map +1 -1
- package/dist/core/compaction/compression-economics.d.ts.map +1 -1
- package/dist/core/compaction/compression-economics.js.map +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +40 -30
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +21 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +15 -16
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/grip-agent.d.ts.map +1 -1
- package/dist/core/grip-agent.js +7 -21
- package/dist/core/grip-agent.js.map +1 -1
- package/dist/core/grip-manifest.d.ts.map +1 -1
- package/dist/core/grip-manifest.js.map +1 -1
- package/dist/core/hooks/aggregate.d.ts.map +1 -1
- package/dist/core/hooks/aggregate.js.map +1 -1
- package/dist/core/hooks/config.d.ts.map +1 -1
- package/dist/core/hooks/config.js.map +1 -1
- package/dist/core/hooks/executor.d.ts.map +1 -1
- package/dist/core/hooks/executor.js.map +1 -1
- package/dist/core/hooks/index.d.ts.map +1 -1
- package/dist/core/hooks/index.js.map +1 -1
- package/dist/core/hooks/matcher.d.ts.map +1 -1
- package/dist/core/hooks/matcher.js.map +1 -1
- package/dist/core/hooks/trust-store.d.ts.map +1 -1
- package/dist/core/hooks/trust-store.js +0 -3
- package/dist/core/hooks/trust-store.js.map +1 -1
- package/dist/core/hooks/types.d.ts.map +1 -1
- package/dist/core/hooks/types.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/instruction-resource-loader.d.ts +1 -0
- package/dist/core/instruction-resource-loader.d.ts.map +1 -1
- package/dist/core/instruction-resource-loader.js +2 -4
- package/dist/core/instruction-resource-loader.js.map +1 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +0 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/lsp/abort.d.ts.map +1 -1
- package/dist/core/lsp/abort.js.map +1 -1
- package/dist/core/lsp/client.d.ts.map +1 -1
- package/dist/core/lsp/client.js +8 -22
- package/dist/core/lsp/client.js.map +1 -1
- package/dist/core/lsp/config-loader.d.ts.map +1 -1
- package/dist/core/lsp/config-loader.js.map +1 -1
- package/dist/core/lsp/config.d.ts.map +1 -1
- package/dist/core/lsp/config.js.map +1 -1
- package/dist/core/lsp/diagnostics.d.ts.map +1 -1
- package/dist/core/lsp/diagnostics.js.map +1 -1
- package/dist/core/lsp/file-sync.d.ts.map +1 -1
- package/dist/core/lsp/file-sync.js +7 -9
- package/dist/core/lsp/file-sync.js.map +1 -1
- package/dist/core/lsp/integration.d.ts.map +1 -1
- package/dist/core/lsp/integration.js.map +1 -1
- package/dist/core/lsp/language-map.d.ts.map +1 -1
- package/dist/core/lsp/language-map.js +2 -7
- package/dist/core/lsp/language-map.js.map +1 -1
- package/dist/core/lsp/manager.d.ts.map +1 -1
- package/dist/core/lsp/manager.js +18 -29
- package/dist/core/lsp/manager.js.map +1 -1
- package/dist/core/lsp/navigation.d.ts.map +1 -1
- package/dist/core/lsp/navigation.js.map +1 -1
- package/dist/core/lsp/portable-path.d.ts.map +1 -1
- package/dist/core/lsp/portable-path.js.map +1 -1
- package/dist/core/lsp/refactor.d.ts.map +1 -1
- package/dist/core/lsp/refactor.js.map +1 -1
- package/dist/core/lsp/transport.d.ts.map +1 -1
- package/dist/core/lsp/transport.js.map +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +30 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +5 -7
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +0 -6
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/contract.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/contract.js +4 -2
- package/dist/core/remote-workspace-protocol/contract.js.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-client.js +1 -5
- package/dist/core/remote-workspace-protocol/guest-shared-client.js.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js +5 -10
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.js +2 -9
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.js.map +1 -1
- package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/lima-owner-directory.js.map +1 -1
- package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/lima-owner-lock.js.map +1 -1
- package/dist/core/remote-workspace-protocol/session.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/session.js +27 -65
- package/dist/core/remote-workspace-protocol/session.js.map +1 -1
- package/dist/core/remote-workspace-protocol/shared-transport.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/shared-transport.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +0 -48
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/rules.d.ts.map +1 -1
- package/dist/core/rules.js.map +1 -1
- package/dist/core/sandbox/command.d.ts.map +1 -1
- package/dist/core/sandbox/command.js.map +1 -1
- package/dist/core/sandbox/config.d.ts.map +1 -1
- package/dist/core/sandbox/config.js.map +1 -1
- package/dist/core/sandbox/lima-guest-binary.d.ts.map +1 -1
- package/dist/core/sandbox/lima-guest-binary.js.map +1 -1
- package/dist/core/sandbox/lima.d.ts +2 -0
- package/dist/core/sandbox/lima.d.ts.map +1 -1
- package/dist/core/sandbox/lima.js +3 -9
- package/dist/core/sandbox/lima.js.map +1 -1
- package/dist/core/sandbox/shared-lima-roots.d.ts.map +1 -1
- package/dist/core/sandbox/shared-lima-roots.js.map +1 -1
- package/dist/core/sandbox/update-shared-guest-binary.d.ts.map +1 -1
- package/dist/core/sandbox/update-shared-guest-binary.js.map +1 -1
- package/dist/core/session/constants.d.ts.map +1 -1
- package/dist/core/session/context-metadata.d.ts.map +1 -1
- package/dist/core/session/context-metadata.js.map +1 -1
- package/dist/core/session/context.d.ts.map +1 -1
- package/dist/core/session/context.js.map +1 -1
- package/dist/core/session/ids.d.ts.map +1 -1
- package/dist/core/session/ids.js.map +1 -1
- package/dist/core/session/in-memory-session-manager.d.ts.map +1 -1
- package/dist/core/session/in-memory-session-manager.js +0 -1
- package/dist/core/session/in-memory-session-manager.js.map +1 -1
- package/dist/core/session/in-memory-session.d.ts.map +1 -1
- package/dist/core/session/in-memory-session.js.map +1 -1
- package/dist/core/session/jsonl-errors.d.ts.map +1 -1
- package/dist/core/session/jsonl-errors.js +0 -11
- package/dist/core/session/jsonl-errors.js.map +1 -1
- package/dist/core/session/jsonl-helpers.d.ts.map +1 -1
- package/dist/core/session/jsonl-helpers.js.map +1 -1
- package/dist/core/session/local-session-manager.d.ts.map +1 -1
- package/dist/core/session/local-session-manager.js +4 -6
- package/dist/core/session/local-session-manager.js.map +1 -1
- package/dist/core/session/local-session.d.ts.map +1 -1
- package/dist/core/session/local-session.js.map +1 -1
- package/dist/core/session/migrations.d.ts.map +1 -1
- package/dist/core/session/migrations.js.map +1 -1
- package/dist/core/session/remote-session-client.d.ts.map +1 -1
- package/dist/core/session/remote-session-client.js +0 -6
- package/dist/core/session/remote-session-client.js.map +1 -1
- package/dist/core/session/remote-session-manager.d.ts.map +1 -1
- package/dist/core/session/remote-session-manager.js +0 -3
- package/dist/core/session/remote-session-manager.js.map +1 -1
- package/dist/core/session/remote-session.d.ts.map +1 -1
- package/dist/core/session/remote-session.js +0 -1
- package/dist/core/session/remote-session.js.map +1 -1
- package/dist/core/session/session-manager.d.ts.map +1 -1
- package/dist/core/session/session.d.ts.map +1 -1
- package/dist/core/session/session.js +1 -5
- package/dist/core/session/session.js.map +1 -1
- package/dist/core/session/stores/in-memory-session-store.d.ts.map +1 -1
- package/dist/core/session/stores/in-memory-session-store.js +7 -6
- package/dist/core/session/stores/in-memory-session-store.js.map +1 -1
- package/dist/core/session/stores/jsonl-session-store.d.ts.map +1 -1
- package/dist/core/session/stores/jsonl-session-store.js +6 -14
- package/dist/core/session/stores/jsonl-session-store.js.map +1 -1
- package/dist/core/session/stores/remote-session-store.d.ts.map +1 -1
- package/dist/core/session/stores/remote-session-store.js +3 -8
- package/dist/core/session/stores/remote-session-store.js.map +1 -1
- package/dist/core/session/stores/session-store.d.ts.map +1 -1
- package/dist/core/session/types.d.ts.map +1 -1
- package/dist/core/session/usage-ledger.d.ts.map +1 -1
- package/dist/core/session/usage-ledger.js.map +1 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +0 -1
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +9 -17
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +3 -2
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/system-prompt.d.ts +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +3 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/telemetry.d.ts.map +1 -1
- package/dist/core/telemetry.js.map +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.d.ts +1 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +34 -28
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/compress-context.d.ts.map +1 -1
- package/dist/core/tools/compress-context.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/hash-store.d.ts.map +1 -1
- package/dist/core/tools/hash-store.js.map +1 -1
- package/dist/core/tools/hashline/apply.d.ts.map +1 -1
- package/dist/core/tools/hashline/apply.js.map +1 -1
- package/dist/core/tools/hashline/hash.d.ts.map +1 -1
- package/dist/core/tools/hashline/hash.js.map +1 -1
- package/dist/core/tools/hashline/parse.d.ts.map +1 -1
- package/dist/core/tools/hashline/parse.js.map +1 -1
- package/dist/core/tools/hashline/resolve.d.ts.map +1 -1
- package/dist/core/tools/hashline/resolve.js.map +1 -1
- package/dist/core/tools/hashline-utils.d.ts.map +1 -1
- package/dist/core/tools/hashline-utils.js.map +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/operations.d.ts +11 -0
- package/dist/core/tools/operations.d.ts.map +1 -1
- package/dist/core/tools/operations.js +54 -28
- package/dist/core/tools/operations.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +12 -18
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/replace-diff.d.ts.map +1 -1
- package/dist/core/tools/replace-diff.js.map +1 -1
- package/dist/core/tools/replace-normalize.d.ts.map +1 -1
- package/dist/core/tools/replace-normalize.js.map +1 -1
- package/dist/core/tools/replace-render.d.ts +1 -1
- package/dist/core/tools/replace-render.d.ts.map +1 -1
- package/dist/core/tools/replace-render.js.map +1 -1
- package/dist/core/tools/runtime.d.ts.map +1 -1
- package/dist/core/tools/runtime.js.map +1 -1
- package/dist/core/tools/session-history.d.ts.map +1 -1
- package/dist/core/tools/session-history.js.map +1 -1
- package/dist/core/tools/subagent-agents.d.ts.map +1 -1
- package/dist/core/tools/subagent-agents.js.map +1 -1
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/websearch.d.ts.map +1 -1
- package/dist/core/tools/websearch.js.map +1 -1
- package/dist/core/tools/workspace-tool-host.d.ts +1 -0
- package/dist/core/tools/workspace-tool-host.d.ts.map +1 -1
- package/dist/core/tools/workspace-tool-host.js +36 -22
- package/dist/core/tools/workspace-tool-host.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +0 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/workspace-identity.d.ts.map +1 -1
- package/dist/daemon/activity-budget.d.ts.map +1 -1
- package/dist/daemon/activity-budget.js +2 -3
- package/dist/daemon/activity-budget.js.map +1 -1
- package/dist/daemon/command.d.ts.map +1 -1
- package/dist/daemon/command.js.map +1 -1
- package/dist/daemon/config.d.ts +2 -0
- package/dist/daemon/config.d.ts.map +1 -1
- package/dist/daemon/config.js +4 -0
- package/dist/daemon/config.js.map +1 -1
- package/dist/daemon/help.d.ts.map +1 -1
- package/dist/daemon/help.js +4 -3
- package/dist/daemon/help.js.map +1 -1
- package/dist/daemon/lsp-config.d.ts.map +1 -1
- package/dist/daemon/lsp-config.js.map +1 -1
- package/dist/daemon/outbound-budget.d.ts.map +1 -1
- package/dist/daemon/outbound-budget.js +2 -4
- package/dist/daemon/outbound-budget.js.map +1 -1
- package/dist/daemon/security.d.ts.map +1 -1
- package/dist/daemon/security.js.map +1 -1
- package/dist/daemon/server.d.ts.map +1 -1
- package/dist/daemon/server.js.map +1 -1
- package/dist/daemon/shared-connection.d.ts.map +1 -1
- package/dist/daemon/shared-connection.js +10 -15
- package/dist/daemon/shared-connection.js.map +1 -1
- package/dist/daemon/shared-revision.d.ts.map +1 -1
- package/dist/daemon/shared-revision.js +2 -1
- package/dist/daemon/shared-revision.js.map +1 -1
- package/dist/daemon/shared-roots.d.ts.map +1 -1
- package/dist/daemon/shared-roots.js +0 -1
- package/dist/daemon/shared-roots.js.map +1 -1
- package/dist/daemon/workspace-runtime.d.ts +2 -0
- package/dist/daemon/workspace-runtime.d.ts.map +1 -1
- package/dist/daemon/workspace-runtime.js +43 -15
- package/dist/daemon/workspace-runtime.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +8 -3
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +3 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +4 -9
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +0 -3
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +1 -3
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +1 -3
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +6 -16
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +0 -5
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +1 -8
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -6
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +0 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +1 -7
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +2 -8
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +1 -9
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +8 -4
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/hook-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/hook-execution.js +2 -5
- package/dist/modes/interactive/components/hook-execution.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +3 -9
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/message-card.d.ts.map +1 -1
- package/dist/modes/interactive/components/message-card.js +0 -1
- package/dist/modes/interactive/components/message-card.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +13 -28
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +3 -12
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +9 -13
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +33 -58
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +0 -4
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +0 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +1 -3
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +0 -2
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +0 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +9 -24
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +18 -34
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +3 -6
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +0 -4
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +13 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +162 -136
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +0 -7
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +10 -11
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +33 -2
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/binary-self-update.d.ts +25 -0
- package/dist/utils/binary-self-update.d.ts.map +1 -0
- package/dist/utils/binary-self-update.js +159 -0
- package/dist/utils/binary-self-update.js.map +1 -0
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/deprecation.d.ts.map +1 -1
- package/dist/utils/deprecation.js.map +1 -1
- package/dist/utils/directory-completions.d.ts +8 -0
- package/dist/utils/directory-completions.d.ts.map +1 -1
- package/dist/utils/directory-completions.js +42 -1
- package/dist/utils/directory-completions.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/fs-watch.js.map +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/grip-user-agent.d.ts.map +1 -1
- package/dist/utils/grip-user-agent.js.map +1 -1
- package/dist/utils/html.d.ts.map +1 -1
- package/dist/utils/html.js.map +1 -1
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-process.d.ts.map +1 -1
- package/dist/utils/image-process.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/image-resize-worker.d.ts.map +1 -1
- package/dist/utils/image-resize-worker.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js +10 -5
- package/dist/utils/photon.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/utils/sleep.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +1 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/docs/extensions.md +31 -1
- package/docs/sandbox.md +6 -0
- package/docs/sessions.md +1 -1
- package/docs/skills.md +4 -4
- package/docs/usage.md +2 -1
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +602 -834
- package/package.json +20 -21
|
@@ -15,12 +15,15 @@
|
|
|
15
15
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
16
16
|
import { randomUUID } from "node:crypto";
|
|
17
17
|
import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
18
|
+
import { readFile as fsReadFile } from "node:fs/promises";
|
|
18
19
|
import { homedir } from "node:os";
|
|
19
20
|
import { basename, dirname, posix, sep, win32 } from "node:path";
|
|
20
21
|
import { clampThinkingLevel, cleanupSessionResources, getSupportedThinkingLevels, isContextOverflow, isRetryableAssistantError, modelsAreEqual, resetApiProviders, streamSimple, validateToolArguments, } from "@greppleai/grip-ai";
|
|
21
22
|
import { Text } from "@greppleai/grip-tui";
|
|
22
23
|
import { Type } from "typebox";
|
|
24
|
+
import { keyText } from "../modes/interactive/components/keybinding-hints.js";
|
|
23
25
|
import { theme } from "../modes/interactive/theme/theme.js";
|
|
26
|
+
import { getSandboxDirectoryCompletions } from "../utils/directory-completions.js";
|
|
24
27
|
import { stripFrontmatter } from "../utils/frontmatter.js";
|
|
25
28
|
import { canonicalizePath, resolvePath } from "../utils/paths.js";
|
|
26
29
|
import { sleep } from "../utils/sleep.js";
|
|
@@ -32,6 +35,7 @@ import { appendCompressionDetectionEvent, readCompressionDetectionLedger, } from
|
|
|
32
35
|
import { CompressionDetector, } from "./compaction/compression-detector.js";
|
|
33
36
|
import { COMPRESSION_ECONOMICS_ENTRY_TYPE, COMPRESSION_SAVINGS_SNAPSHOT_TYPE, createCompressionSavingsSnapshot, estimateCompressionEconomics, } from "./compaction/compression-economics.js";
|
|
34
37
|
import { DEFAULT_THINKING_LEVEL } from "./defaults.js";
|
|
38
|
+
import { execCommand } from "./exec.js";
|
|
35
39
|
import { exportSessionToHtml } from "./export-html/index.js";
|
|
36
40
|
import { createToolHtmlRenderer } from "./export-html/tool-renderer.js";
|
|
37
41
|
import { ExtensionRunner, emitSessionShutdownEvent, } from "./extensions/runner.js";
|
|
@@ -55,6 +59,7 @@ import { buildSystemPrompt } from "./system-prompt.js";
|
|
|
55
59
|
import { createLocalBashOperations } from "./tools/bash.js";
|
|
56
60
|
import { createCompressContextToolDefinition, getCompressibleEntries, getSuggestedCompressionRangeError, isValidSuggestedCompressionRange, } from "./tools/compress-context.js";
|
|
57
61
|
import { DeferredRemoteToolOperations, LocalToolOperations, } from "./tools/operations.js";
|
|
62
|
+
import { getTextOutput } from "./tools/render-utils.js";
|
|
58
63
|
import { createSessionEntryGetToolDefinition, createSessionSearchToolDefinition } from "./tools/session-history.js";
|
|
59
64
|
import { createCreateSubagentToolDefinition, createSubagentRunsToolDefinition, createSubagentToolDefinition, formatSubagentModelCatalog, } from "./tools/subagent.js";
|
|
60
65
|
import { createToolDefinitionFromAgentTool } from "./tools/tool-definition-wrapper.js";
|
|
@@ -63,7 +68,7 @@ import { WORKSPACE_TOOL_NAMES, WorkspaceToolHost } from "./tools/workspace-tool-
|
|
|
63
68
|
// ============================================================================
|
|
64
69
|
// Skill Block Parsing
|
|
65
70
|
// ============================================================================
|
|
66
|
-
const CORE_DEFAULT_TOOL_NAMES = ["read", "bash", "edit", "write", "websearch"];
|
|
71
|
+
const CORE_DEFAULT_TOOL_NAMES = ["read", "bash", "edit", "write", "websearch", "load_skill"];
|
|
67
72
|
const SESSION_HISTORY_TOOL_NAMES = ["session_search", "session_entry_get"];
|
|
68
73
|
export const SUBAGENT_TOOL_NAMES = ["subagent", "subagent_runs", "create_subagent"];
|
|
69
74
|
export const DEFAULT_ACTIVE_TOOL_NAMES = [...CORE_DEFAULT_TOOL_NAMES, ...SESSION_HISTORY_TOOL_NAMES];
|
|
@@ -383,127 +388,111 @@ function extractJsonCandidates(text) {
|
|
|
383
388
|
// ============================================================================
|
|
384
389
|
// AgentSession Class
|
|
385
390
|
// ============================================================================
|
|
391
|
+
function isWithinSandboxMount(directory, root, flavor) {
|
|
392
|
+
const paths = flavor === "windows" ? win32 : posix;
|
|
393
|
+
const relativePath = paths.relative(root, directory);
|
|
394
|
+
return relativePath !== ".." && !relativePath.startsWith(`..${paths.sep}`) && !paths.isAbsolute(relativePath);
|
|
395
|
+
}
|
|
396
|
+
function hasValidHostProcessApproval(options) {
|
|
397
|
+
return (typeof options?.question === "string" &&
|
|
398
|
+
!!options.question.trim() &&
|
|
399
|
+
(options.explanation === undefined || (typeof options.explanation === "string" && !!options.explanation.trim())));
|
|
400
|
+
}
|
|
386
401
|
export class AgentSession {
|
|
387
|
-
agent;
|
|
388
|
-
session;
|
|
389
|
-
settingsManager;
|
|
390
|
-
_scopedModels;
|
|
391
|
-
// Event subscription state
|
|
392
|
-
_unsubscribeAgent;
|
|
393
|
-
_eventListeners = [];
|
|
394
|
-
_disposePromise;
|
|
395
|
-
_shutdownPreparationPromise;
|
|
396
|
-
_disposed = false;
|
|
397
|
-
/** Tracks pending steering messages for UI display. Removed when delivered. */
|
|
398
|
-
_steeringMessages = [];
|
|
399
|
-
/** Tracks pending follow-up messages for UI display. Removed when delivered. */
|
|
400
|
-
_followUpMessages = [];
|
|
401
|
-
/** Messages queued to be included with the next user prompt as context ("asides"). */
|
|
402
|
-
_pendingNextTurnMessages = [];
|
|
403
|
-
// Compaction state
|
|
404
|
-
_compactionInFlight;
|
|
405
|
-
_compactionAbortController = undefined;
|
|
406
|
-
_autoCompactionAbortController = undefined;
|
|
407
|
-
_extensionCompactionQueue = [];
|
|
408
|
-
_extensionCompactionTimer = undefined;
|
|
409
|
-
_extensionCompactionActivity;
|
|
410
|
-
_extensionCompactionRunning = false;
|
|
411
|
-
_overflowRecoveryAttempted = false;
|
|
412
|
-
// Branch summarization state
|
|
413
|
-
_branchSummaryAbortController = undefined;
|
|
414
|
-
// Retry state
|
|
415
|
-
_retryAbortController = undefined;
|
|
416
|
-
_retryAttempt = 0;
|
|
417
|
-
// Bash execution state
|
|
418
|
-
_bashAbortControllers = new Set();
|
|
419
|
-
_pendingBashMessages = [];
|
|
420
|
-
// Extension system
|
|
421
|
-
_extensionRunner;
|
|
422
|
-
_extensionLspOwnership = new WeakMap();
|
|
423
|
-
_turnIndex = 0;
|
|
424
|
-
_resourceLoader;
|
|
425
|
-
_customTools;
|
|
426
|
-
_baseToolDefinitions = new Map();
|
|
427
|
-
_workspaceToolHost;
|
|
428
|
-
_retiredWorkspaceToolHosts = [];
|
|
429
|
-
_cwd;
|
|
430
|
-
_extensionRunnerRef;
|
|
431
|
-
_initialActiveToolNames;
|
|
432
|
-
_enableLspTools;
|
|
433
|
-
_allowedToolNames;
|
|
434
|
-
_excludedToolNames;
|
|
435
|
-
_baseToolsOverride;
|
|
436
|
-
_toolOperations;
|
|
437
|
-
_runtimeToolOperations;
|
|
438
|
-
_subagentRunner;
|
|
439
|
-
_subagentRunRegistry;
|
|
440
|
-
_subagentConfigRegistry;
|
|
441
|
-
_trustProjectAgents;
|
|
442
|
-
_localResourceToolOperations;
|
|
443
|
-
_sandboxToolOperations;
|
|
444
|
-
_preSandboxToolOperations;
|
|
445
|
-
_lspRuntimeState;
|
|
446
|
-
_lspConfiguration;
|
|
447
|
-
_lspConnectionFactories;
|
|
448
|
-
_resolveLspConfiguration;
|
|
449
|
-
_onLspConfigurationDiagnostics;
|
|
450
|
-
_runtimeLifecycleQueue = Promise.resolve();
|
|
451
|
-
_sandboxTransitionQueue = Promise.resolve();
|
|
452
|
-
_runtimeLifecycleContext = new AsyncLocalStorage();
|
|
453
|
-
_activities = new Set();
|
|
454
|
-
_activityGeneration = 0;
|
|
455
|
-
_activeCycle = false;
|
|
456
|
-
_settlementScheduled = false;
|
|
457
|
-
_settlementRunning = false;
|
|
458
|
-
_idleWaiters = new Set();
|
|
459
|
-
_barrierOwnerContext = new AsyncLocalStorage();
|
|
460
|
-
_sessionStartEvent;
|
|
461
|
-
_extensionUIContext;
|
|
462
|
-
_extensionCommandContextActions;
|
|
463
|
-
_extensionAbortHandler;
|
|
464
|
-
_extensionShutdownHandler;
|
|
465
|
-
_extensionErrorListener;
|
|
466
|
-
_extensionErrorUnsubscriber;
|
|
467
|
-
_loadedHooks;
|
|
468
|
-
_resolveHooks;
|
|
469
|
-
_hooksEnabled = true;
|
|
470
|
-
_onHookDiagnostic;
|
|
471
|
-
_hookExecutionListeners = new Set();
|
|
472
|
-
_hookExecutionActivityListeners = new Set();
|
|
473
|
-
_hookRunOptions;
|
|
474
|
-
_hookAbortController = new AbortController();
|
|
475
|
-
_hookSessionStartPromise;
|
|
476
|
-
_hookSessionStartTerminationReason;
|
|
477
|
-
_pendingHookSessionStartContext;
|
|
478
|
-
_hookSessionEnded = false;
|
|
479
|
-
_activePromptId;
|
|
480
|
-
_stopHookContinuations = 0;
|
|
481
|
-
_stopHookProgress;
|
|
482
|
-
_queuedPromptIds = new Map();
|
|
483
|
-
_toolStartedAt = new Map();
|
|
484
|
-
_preToolHookContext = new Map();
|
|
485
|
-
_compressionDetector;
|
|
486
|
-
_contextCompressionEnabledOverride;
|
|
487
|
-
_compressionDetectionEnabled = process.env.GRIP_CONTEXT_COMPRESSION_DETECTION === "1";
|
|
488
|
-
_agentRunEnding = false;
|
|
489
|
-
_waitingForDetectorAtRequest = false;
|
|
490
|
-
_pendingContextCompression;
|
|
491
|
-
_stateCompressionApplied = false;
|
|
492
|
-
// Model registry for API key resolution
|
|
493
|
-
_modelRegistry;
|
|
494
|
-
// Tool registry for extension getTools/setTools
|
|
495
|
-
_toolRegistry = new Map();
|
|
496
|
-
_toolDefinitions = new Map();
|
|
497
|
-
_sessionTools = new Map();
|
|
498
|
-
_sessionSkills = new Map();
|
|
499
|
-
_sessionRules = new Map();
|
|
500
|
-
_toolPromptSnippets = new Map();
|
|
501
|
-
_toolPromptGuidelines = new Map();
|
|
502
|
-
// Base system prompt (without extension appends) - used to apply fresh appends each turn
|
|
503
|
-
_baseSystemPrompt = "";
|
|
504
|
-
_baseSystemPromptOptions;
|
|
505
|
-
_systemPromptOverride;
|
|
506
402
|
constructor(config) {
|
|
403
|
+
this._eventListeners = [];
|
|
404
|
+
this._disposed = false;
|
|
405
|
+
/** Tracks pending steering messages for UI display. Removed when delivered. */
|
|
406
|
+
this._steeringMessages = [];
|
|
407
|
+
/** Tracks pending follow-up messages for UI display. Removed when delivered. */
|
|
408
|
+
this._followUpMessages = [];
|
|
409
|
+
/** Messages queued to be included with the next user prompt as context ("asides"). */
|
|
410
|
+
this._pendingNextTurnMessages = [];
|
|
411
|
+
this._compactionAbortController = undefined;
|
|
412
|
+
this._autoCompactionAbortController = undefined;
|
|
413
|
+
this._extensionCompactionQueue = [];
|
|
414
|
+
this._extensionCompactionTimer = undefined;
|
|
415
|
+
this._extensionCompactionRunning = false;
|
|
416
|
+
this._overflowRecoveryAttempted = false;
|
|
417
|
+
// Branch summarization state
|
|
418
|
+
this._branchSummaryAbortController = undefined;
|
|
419
|
+
// Retry state
|
|
420
|
+
this._retryAbortController = undefined;
|
|
421
|
+
this._retryAttempt = 0;
|
|
422
|
+
// Bash execution state
|
|
423
|
+
this._bashAbortControllers = new Set();
|
|
424
|
+
this._pendingBashMessages = [];
|
|
425
|
+
this._extensionLspOwnership = new WeakMap();
|
|
426
|
+
this._turnIndex = 0;
|
|
427
|
+
this._baseToolDefinitions = new Map();
|
|
428
|
+
this._retiredWorkspaceToolHosts = [];
|
|
429
|
+
this._runtimeLifecycleQueue = Promise.resolve();
|
|
430
|
+
this._sandboxTransitionQueue = Promise.resolve();
|
|
431
|
+
this._runtimeLifecycleContext = new AsyncLocalStorage();
|
|
432
|
+
this._activities = new Set();
|
|
433
|
+
this._activityGeneration = 0;
|
|
434
|
+
this._activeCycle = false;
|
|
435
|
+
this._hostCommandApprovalQueue = Promise.resolve();
|
|
436
|
+
this._settlementScheduled = false;
|
|
437
|
+
this._settlementRunning = false;
|
|
438
|
+
this._idleWaiters = new Set();
|
|
439
|
+
this._barrierOwnerContext = new AsyncLocalStorage();
|
|
440
|
+
this._hooksEnabled = true;
|
|
441
|
+
this._hookExecutionListeners = new Set();
|
|
442
|
+
this._hookExecutionActivityListeners = new Set();
|
|
443
|
+
this._hookAbortController = new AbortController();
|
|
444
|
+
this._hookSessionEnded = false;
|
|
445
|
+
this._stopHookContinuations = 0;
|
|
446
|
+
this._queuedPromptIds = new Map();
|
|
447
|
+
this._toolStartedAt = new Map();
|
|
448
|
+
this._preToolHookContext = new Map();
|
|
449
|
+
this._compressionDetectionEnabled = process.env.GRIP_CONTEXT_COMPRESSION_DETECTION === "1";
|
|
450
|
+
this._agentRunEnding = false;
|
|
451
|
+
this._waitingForDetectorAtRequest = false;
|
|
452
|
+
this._stateCompressionApplied = false;
|
|
453
|
+
// Tool registry for extension getTools/setTools
|
|
454
|
+
this._toolRegistry = new Map();
|
|
455
|
+
this._toolDefinitions = new Map();
|
|
456
|
+
this._sessionTools = new Map();
|
|
457
|
+
this._sessionSkills = new Map();
|
|
458
|
+
this._sessionRules = new Map();
|
|
459
|
+
this._toolPromptSnippets = new Map();
|
|
460
|
+
this._toolPromptGuidelines = new Map();
|
|
461
|
+
// Base system prompt (without extension appends) - used to apply fresh appends each turn
|
|
462
|
+
this._baseSystemPrompt = "";
|
|
463
|
+
// Track last assistant message for auto-compaction check
|
|
464
|
+
this._lastAssistantMessage = undefined;
|
|
465
|
+
/** Internal handler for agent events - shared by subscribe and reconnect */
|
|
466
|
+
this._handleAgentEvent = async (event) => {
|
|
467
|
+
if (event.type === "agent_start")
|
|
468
|
+
this._agentRunEnding = false;
|
|
469
|
+
// afterToolCall can be skipped when a prepared call is aborted. Never retain per-run tool state.
|
|
470
|
+
if (event.type === "agent_end") {
|
|
471
|
+
this._agentRunEnding = true;
|
|
472
|
+
this._toolStartedAt.clear();
|
|
473
|
+
this._preToolHookContext.clear();
|
|
474
|
+
this._pendingContextCompression = undefined;
|
|
475
|
+
}
|
|
476
|
+
this._consumeStartedQueuedMessage(event);
|
|
477
|
+
// Extensions observe the event before public session listeners.
|
|
478
|
+
await this._runAsyncBarrierCallback(`extension ${event.type} handler`, () => this._emitExtensionEvent(event));
|
|
479
|
+
this._emit(event.type === "agent_end" ? { ...event, willRetry: this._willRetryAfterAgentEnd(event) } : event);
|
|
480
|
+
if (event.type === "agent_end") {
|
|
481
|
+
const entries = this.session.getEntries();
|
|
482
|
+
const ledger = readUsageLedger(entries);
|
|
483
|
+
const lastEntry = entries.at(-1);
|
|
484
|
+
if (ledger.checkpointId && !(lastEntry?.type === "custom" && lastEntry.customType === USAGE_LEDGER_ENTRY_TYPE))
|
|
485
|
+
this.session.appendCustomEntry(USAGE_LEDGER_ENTRY_TYPE, ledger);
|
|
486
|
+
this._scheduleExtensionCompactions();
|
|
487
|
+
if (!this._disposed && this.compressionDetectionEnabled)
|
|
488
|
+
this._compressionDetector.check(this.getContextUsage()?.percent, this.agent.state.messages, this._buildCurrentAgentContext().systemPrompt, getCompressibleEntries(this.session, ""));
|
|
489
|
+
}
|
|
490
|
+
if (event.type === "message_end") {
|
|
491
|
+
this._persistCompletedMessage(event.message);
|
|
492
|
+
this._applyPendingContextCompression(event.message);
|
|
493
|
+
this._updateRetryStateAfterAssistantMessage(event.message);
|
|
494
|
+
}
|
|
495
|
+
};
|
|
507
496
|
this.agent = config.agent;
|
|
508
497
|
this.session = config.session;
|
|
509
498
|
this.settingsManager = config.settingsManager;
|
|
@@ -620,6 +609,11 @@ export class AgentSession {
|
|
|
620
609
|
getToolBackendInfo() {
|
|
621
610
|
return this.getToolOperations().getBackendInfo?.() ?? { type: "local", cwd: this._cwd };
|
|
622
611
|
}
|
|
612
|
+
/** Whether the current session is using a live, session-owned sandbox connection. */
|
|
613
|
+
isSandbox() {
|
|
614
|
+
const operations = this._sandboxToolOperations;
|
|
615
|
+
return !!operations && operations === this._toolOperations && !operations.isDisconnected();
|
|
616
|
+
}
|
|
623
617
|
supportsDirectoryChange() {
|
|
624
618
|
return this._toolOperations === undefined && this.getToolBackendInfo().type === "local";
|
|
625
619
|
}
|
|
@@ -690,7 +684,39 @@ export class AgentSession {
|
|
|
690
684
|
}));
|
|
691
685
|
}
|
|
692
686
|
async activateSandboxDaemon(options) {
|
|
693
|
-
return this._runActivity("sandbox daemon activation", () => this._enqueueSandboxTransition(() => this._activateSessionRemoteOperations(options.expectedCwd, (operations) => operations.configureRemote(options.url, {
|
|
687
|
+
return this._runActivity("sandbox daemon activation", () => this._enqueueSandboxTransition(() => this._activateSessionRemoteOperations(options.expectedCwd, (operations) => operations.configureRemote(options.url, {
|
|
688
|
+
token: options.token,
|
|
689
|
+
expectedCwd: options.expectedCwd,
|
|
690
|
+
hostWorkspaceRoot: options.hostWorkspaceRoot,
|
|
691
|
+
}))));
|
|
692
|
+
}
|
|
693
|
+
/** Complete only directories available inside the connected sandbox's mounted workspace. */
|
|
694
|
+
async getSandboxDirectoryCompletions(prefix) {
|
|
695
|
+
const operations = this._sandboxToolOperations;
|
|
696
|
+
const backend = operations?.getBackendInfo();
|
|
697
|
+
if (!operations || operations !== this._toolOperations || backend?.type !== "remote" || !backend.configured)
|
|
698
|
+
return [];
|
|
699
|
+
return getSandboxDirectoryCompletions(prefix, operations.cwd, backend.workspace.pathFlavor, operations);
|
|
700
|
+
}
|
|
701
|
+
/** Change only the connected sandbox's working directory, never the host session or mount. */
|
|
702
|
+
async changeSandboxWorkingDirectory(target) {
|
|
703
|
+
const operations = this._sandboxToolOperations;
|
|
704
|
+
const backend = operations?.getBackendInfo();
|
|
705
|
+
if (!operations || operations !== this._toolOperations || backend?.type !== "remote" || !backend.configured) {
|
|
706
|
+
throw new Error("No connected sandbox is active");
|
|
707
|
+
}
|
|
708
|
+
const paths = backend.workspace.pathFlavor === "windows" ? win32 : posix;
|
|
709
|
+
const candidate = paths.resolve(operations.cwd, target);
|
|
710
|
+
if (!isWithinSandboxMount(candidate, backend.workspace.root, backend.workspace.pathFlavor)) {
|
|
711
|
+
throw new Error(`Directory is outside the mounted workspace: ${target}`);
|
|
712
|
+
}
|
|
713
|
+
const directory = await operations.resolveWorkspaceDirectory(candidate);
|
|
714
|
+
if (!isWithinSandboxMount(directory, backend.workspace.root, backend.workspace.pathFlavor)) {
|
|
715
|
+
throw new Error(`Directory is outside the mounted workspace: ${target}`);
|
|
716
|
+
}
|
|
717
|
+
operations.cwd = directory;
|
|
718
|
+
this._refreshBaseSystemPrompt();
|
|
719
|
+
return directory;
|
|
694
720
|
}
|
|
695
721
|
async _activateSessionRemoteOperations(expectedCwd, configure) {
|
|
696
722
|
if (this._sandboxToolOperations)
|
|
@@ -1538,8 +1564,6 @@ export class AgentSession {
|
|
|
1538
1564
|
followUp: [...this._followUpMessages],
|
|
1539
1565
|
});
|
|
1540
1566
|
}
|
|
1541
|
-
// Track last assistant message for auto-compaction check
|
|
1542
|
-
_lastAssistantMessage = undefined;
|
|
1543
1567
|
_consumeStartedQueuedMessage(event) {
|
|
1544
1568
|
if (event.type !== "message_start" || event.message.role !== "user")
|
|
1545
1569
|
return;
|
|
@@ -1665,37 +1689,6 @@ export class AgentSession {
|
|
|
1665
1689
|
});
|
|
1666
1690
|
this._retryAttempt = 0;
|
|
1667
1691
|
}
|
|
1668
|
-
/** Internal handler for agent events - shared by subscribe and reconnect */
|
|
1669
|
-
_handleAgentEvent = async (event) => {
|
|
1670
|
-
if (event.type === "agent_start")
|
|
1671
|
-
this._agentRunEnding = false;
|
|
1672
|
-
// afterToolCall can be skipped when a prepared call is aborted. Never retain per-run tool state.
|
|
1673
|
-
if (event.type === "agent_end") {
|
|
1674
|
-
this._agentRunEnding = true;
|
|
1675
|
-
this._toolStartedAt.clear();
|
|
1676
|
-
this._preToolHookContext.clear();
|
|
1677
|
-
this._pendingContextCompression = undefined;
|
|
1678
|
-
}
|
|
1679
|
-
this._consumeStartedQueuedMessage(event);
|
|
1680
|
-
// Extensions observe the event before public session listeners.
|
|
1681
|
-
await this._runAsyncBarrierCallback(`extension ${event.type} handler`, () => this._emitExtensionEvent(event));
|
|
1682
|
-
this._emit(event.type === "agent_end" ? { ...event, willRetry: this._willRetryAfterAgentEnd(event) } : event);
|
|
1683
|
-
if (event.type === "agent_end") {
|
|
1684
|
-
const entries = this.session.getEntries();
|
|
1685
|
-
const ledger = readUsageLedger(entries);
|
|
1686
|
-
const lastEntry = entries.at(-1);
|
|
1687
|
-
if (ledger.checkpointId && !(lastEntry?.type === "custom" && lastEntry.customType === USAGE_LEDGER_ENTRY_TYPE))
|
|
1688
|
-
this.session.appendCustomEntry(USAGE_LEDGER_ENTRY_TYPE, ledger);
|
|
1689
|
-
this._scheduleExtensionCompactions();
|
|
1690
|
-
if (!this._disposed && this.compressionDetectionEnabled)
|
|
1691
|
-
this._compressionDetector.check(this.getContextUsage()?.percent, this.agent.state.messages, this._buildCurrentAgentContext().systemPrompt, getCompressibleEntries(this.session, ""));
|
|
1692
|
-
}
|
|
1693
|
-
if (event.type === "message_end") {
|
|
1694
|
-
this._persistCompletedMessage(event.message);
|
|
1695
|
-
this._applyPendingContextCompression(event.message);
|
|
1696
|
-
this._updateRetryStateAfterAssistantMessage(event.message);
|
|
1697
|
-
}
|
|
1698
|
-
};
|
|
1699
1692
|
_willRetryAfterAgentEnd(event) {
|
|
1700
1693
|
const settings = this.settingsManager.getRetrySettings();
|
|
1701
1694
|
if (!settings.enabled || this._retryAttempt >= settings.maxRetries) {
|
|
@@ -4104,6 +4097,7 @@ export class AgentSession {
|
|
|
4104
4097
|
getSystemPrompt: () => this.systemPrompt,
|
|
4105
4098
|
getToolOperations,
|
|
4106
4099
|
getToolBackendInfo: () => this.getToolBackendInfo(),
|
|
4100
|
+
isSandbox: () => this.isSandbox(),
|
|
4107
4101
|
getLspStatus: getBoundLspStatus,
|
|
4108
4102
|
configureLsp: (configuration) => {
|
|
4109
4103
|
if (runner !== this._extensionRunner)
|
|
@@ -4116,6 +4110,20 @@ export class AgentSession {
|
|
|
4116
4110
|
const resolvedCommand = prefix ? `${prefix}\n${command}` : command;
|
|
4117
4111
|
return executeBashWithOperations(resolvedCommand, options?.cwd ?? operations.cwd, operations, options);
|
|
4118
4112
|
}),
|
|
4113
|
+
execHostCommand: (command, options) => {
|
|
4114
|
+
const execute = () => this._runActivity("extension host command approval", () => this._executeApprovedHostCommand(runner, command, options));
|
|
4115
|
+
const pending = this._hostCommandApprovalQueue.then(execute, execute);
|
|
4116
|
+
this._hostCommandApprovalQueue = pending.then(() => undefined, () => undefined);
|
|
4117
|
+
return pending;
|
|
4118
|
+
},
|
|
4119
|
+
execHostProcess: (executable, args, options) => {
|
|
4120
|
+
const argv = Array.isArray(args) ? [...args] : args;
|
|
4121
|
+
const request = { ...options };
|
|
4122
|
+
const execute = () => this._runActivity("extension host process approval", () => this._executeApprovedHostProcess(runner, executable, argv, request));
|
|
4123
|
+
const pending = this._hostCommandApprovalQueue.then(execute, execute);
|
|
4124
|
+
this._hostCommandApprovalQueue = pending.then(() => undefined, () => undefined);
|
|
4125
|
+
return pending;
|
|
4126
|
+
},
|
|
4119
4127
|
}, {
|
|
4120
4128
|
registerProvider: (name, config) => {
|
|
4121
4129
|
this._modelRegistry.registerProvider(name, config);
|
|
@@ -4127,6 +4135,132 @@ export class AgentSession {
|
|
|
4127
4135
|
},
|
|
4128
4136
|
});
|
|
4129
4137
|
}
|
|
4138
|
+
async _executeApprovedHostCommand(runner, command, options) {
|
|
4139
|
+
if (runner !== this._extensionRunner)
|
|
4140
|
+
throw new Error(STALE_EXTENSION_CONTEXT_MESSAGE);
|
|
4141
|
+
if (typeof command !== "string" ||
|
|
4142
|
+
!command.trim() ||
|
|
4143
|
+
typeof options?.question !== "string" ||
|
|
4144
|
+
!options.question.trim()) {
|
|
4145
|
+
throw new Error("Host command and approval question must be non-empty strings");
|
|
4146
|
+
}
|
|
4147
|
+
const operations = this._sandboxToolOperations;
|
|
4148
|
+
if (!operations || operations !== this._toolOperations || operations.isDisconnected()) {
|
|
4149
|
+
throw new Error("A connected sandbox is required for approved host commands");
|
|
4150
|
+
}
|
|
4151
|
+
if (!runner.hasUI())
|
|
4152
|
+
throw new Error("Host command requires an interactive approval UI");
|
|
4153
|
+
const signal = options.signal ?? this.agent.signal;
|
|
4154
|
+
if (signal?.aborted)
|
|
4155
|
+
throw new Error("Host command cancelled");
|
|
4156
|
+
const hostCwd = await operations.mapWorkspaceDirectoryToHost(options.cwd ?? operations.cwd);
|
|
4157
|
+
const choice = await runner
|
|
4158
|
+
.getUIContext()
|
|
4159
|
+
.select(`Run on host?\nReason: ${JSON.stringify(options.question)}\nCommand: ${JSON.stringify(command)}\nHost cwd: ${JSON.stringify(hostCwd)}`, ["No", "Yes"], { signal });
|
|
4160
|
+
if (choice !== "Yes" || signal?.aborted)
|
|
4161
|
+
throw new Error("Host command was not approved");
|
|
4162
|
+
if (runner !== this._extensionRunner ||
|
|
4163
|
+
operations !== this._sandboxToolOperations ||
|
|
4164
|
+
operations.isDisconnected()) {
|
|
4165
|
+
throw new Error("Sandbox changed before the host command could run");
|
|
4166
|
+
}
|
|
4167
|
+
return executeBashWithOperations(command, hostCwd, new LocalToolOperations(hostCwd), { ...options, signal });
|
|
4168
|
+
}
|
|
4169
|
+
async _executeApprovedHostProcess(runner, executable, args, options) {
|
|
4170
|
+
if (runner !== this._extensionRunner)
|
|
4171
|
+
throw new Error(STALE_EXTENSION_CONTEXT_MESSAGE);
|
|
4172
|
+
if (typeof executable !== "string" ||
|
|
4173
|
+
!executable.trim() ||
|
|
4174
|
+
executable.includes("\0") ||
|
|
4175
|
+
!Array.isArray(args) ||
|
|
4176
|
+
args.some((arg) => typeof arg !== "string" || arg.includes("\0")) ||
|
|
4177
|
+
!hasValidHostProcessApproval(options)) {
|
|
4178
|
+
throw new Error("Host executable, argv and approval question must be valid strings");
|
|
4179
|
+
}
|
|
4180
|
+
const operations = this._sandboxToolOperations;
|
|
4181
|
+
if (!operations || operations !== this._toolOperations || operations.isDisconnected()) {
|
|
4182
|
+
throw new Error("A connected sandbox is required for approved host processes");
|
|
4183
|
+
}
|
|
4184
|
+
if (!runner.hasUI())
|
|
4185
|
+
throw new Error("Host process requires an interactive approval UI");
|
|
4186
|
+
const signal = options.signal ?? this.agent.signal;
|
|
4187
|
+
if (signal?.aborted)
|
|
4188
|
+
throw new Error("Host process cancelled");
|
|
4189
|
+
const hostCwd = await operations.mapWorkspaceDirectoryToHost(options.cwd ?? operations.cwd);
|
|
4190
|
+
const explanation = options.explanation === undefined ? "" : `\nExplanation (unverified): ${JSON.stringify(options.explanation)}`;
|
|
4191
|
+
const choice = await runner
|
|
4192
|
+
.getUIContext()
|
|
4193
|
+
.select(`Run on host (no shell)?\nReason: ${JSON.stringify(options.question)}${explanation}\nExecutable: ${JSON.stringify(executable)}\nArguments: ${JSON.stringify(args)}\nHost cwd: ${JSON.stringify(hostCwd)}`, ["No", "Yes"], { signal });
|
|
4194
|
+
if (choice !== "Yes" || signal?.aborted)
|
|
4195
|
+
throw new Error("Host process was not approved");
|
|
4196
|
+
if (runner !== this._extensionRunner ||
|
|
4197
|
+
operations !== this._sandboxToolOperations ||
|
|
4198
|
+
operations.isDisconnected()) {
|
|
4199
|
+
throw new Error("Sandbox changed before the host process could run");
|
|
4200
|
+
}
|
|
4201
|
+
return execCommand(executable, args, hostCwd, { signal, timeout: options.timeout });
|
|
4202
|
+
}
|
|
4203
|
+
_createLoadSkillToolDefinition() {
|
|
4204
|
+
const parameters = Type.Object({
|
|
4205
|
+
name: Type.Union([Type.String(), Type.Array(Type.String())], {
|
|
4206
|
+
description: "Name of a listed skill, or an array of skill names to load in one call",
|
|
4207
|
+
}),
|
|
4208
|
+
});
|
|
4209
|
+
return {
|
|
4210
|
+
name: "load_skill",
|
|
4211
|
+
label: "Load skill",
|
|
4212
|
+
description: "Load the full instructions for one or more available skills by name. Use the reported skill directory to resolve relative references. Hidden skills and unknown names are not available.",
|
|
4213
|
+
promptSnippet: "Load instructions for available skills by name (or an array of names)",
|
|
4214
|
+
parameters,
|
|
4215
|
+
renderCall: (args, renderTheme, context) => {
|
|
4216
|
+
const names = getToolNameArgs(args);
|
|
4217
|
+
const expandKey = keyText("app.tools.expand");
|
|
4218
|
+
const hint = !context.expanded && expandKey ? renderTheme.fg("dim", ` (${expandKey} to expand)`) : "";
|
|
4219
|
+
return new Text(renderTheme.fg("customMessageLabel", `\x1b[1m[skill]\x1b[22m `) +
|
|
4220
|
+
renderTheme.fg("customMessageText", names.join(", ")) +
|
|
4221
|
+
hint, 0, 0);
|
|
4222
|
+
},
|
|
4223
|
+
renderResult: (result, options, renderTheme, context) => {
|
|
4224
|
+
const output = options.expanded || context.isError ? getTextOutput(result, context.showImages) : "";
|
|
4225
|
+
return new Text(output ? `\n${renderTheme.fg(context.isError ? "error" : "toolOutput", output)}` : "", 0, 0);
|
|
4226
|
+
},
|
|
4227
|
+
executionMode: "sequential",
|
|
4228
|
+
execute: async (_toolCallId, params, signal) => {
|
|
4229
|
+
if (signal?.aborted)
|
|
4230
|
+
throw new Error("Skill load cancelled");
|
|
4231
|
+
const names = [...new Set(Array.isArray(params.name) ? params.name : [params.name])];
|
|
4232
|
+
if (names.length === 0 || names.some((name) => !name))
|
|
4233
|
+
throw new Error("Specify at least one skill name");
|
|
4234
|
+
const availableSkills = new Map(this.getRegisteredSkills()
|
|
4235
|
+
.filter((skill) => !skill.disableModelInvocation)
|
|
4236
|
+
.map((skill) => [skill.name, skill]));
|
|
4237
|
+
const missing = names.filter((name) => !availableSkills.has(name));
|
|
4238
|
+
if (missing.length > 0)
|
|
4239
|
+
throw new Error(`Skill not available: ${missing.join(", ")}`);
|
|
4240
|
+
const skills = names.map((name) => availableSkills.get(name));
|
|
4241
|
+
const content = await Promise.all(skills.map(async (skill) => {
|
|
4242
|
+
let text = skill.content;
|
|
4243
|
+
if (text === undefined && getSourceBackend(skill.sourceInfo) === "remote") {
|
|
4244
|
+
if (this.getToolBackendInfo().type !== "remote")
|
|
4245
|
+
throw new Error(`Remote skill not available: ${skill.name}`);
|
|
4246
|
+
text = (await this.getToolOperations().readFile(skill.filePath)).toString("utf-8");
|
|
4247
|
+
}
|
|
4248
|
+
else if (text === undefined) {
|
|
4249
|
+
text = await fsReadFile(resolvePath(skill.filePath, this._cwd), "utf-8");
|
|
4250
|
+
}
|
|
4251
|
+
return {
|
|
4252
|
+
type: "text",
|
|
4253
|
+
text: `Skill: ${JSON.stringify(skill.name)}\nSkill directory: ${JSON.stringify(skill.baseDir)}\nFile: ${JSON.stringify(skill.filePath)}\n\n${text}`,
|
|
4254
|
+
};
|
|
4255
|
+
}));
|
|
4256
|
+
if (signal?.aborted)
|
|
4257
|
+
throw new Error("Skill load cancelled");
|
|
4258
|
+
for (const skill of skills)
|
|
4259
|
+
this._loadAssociatedInstructionTools(skill);
|
|
4260
|
+
return { content, details: { names } };
|
|
4261
|
+
},
|
|
4262
|
+
};
|
|
4263
|
+
}
|
|
4130
4264
|
_createLoadToolDefinition() {
|
|
4131
4265
|
const parameters = Type.Object({
|
|
4132
4266
|
name: Type.Union([Type.String(), Type.Array(Type.String())], {
|
|
@@ -4477,6 +4611,7 @@ export class AgentSession {
|
|
|
4477
4611
|
const baseToolDefinitions = this._createRuntimeBaseToolDefinitions(workspaceToolHost);
|
|
4478
4612
|
this._baseToolDefinitions = new Map(Object.entries(baseToolDefinitions));
|
|
4479
4613
|
this._initializeRuntimeLsp(operations);
|
|
4614
|
+
this._baseToolDefinitions.set("load_skill", this._createLoadSkillToolDefinition());
|
|
4480
4615
|
this._baseToolDefinitions.set("load_tool", this._createLoadToolDefinition());
|
|
4481
4616
|
this._baseToolDefinitions.set("unload_tool", this._createUnloadToolDefinition());
|
|
4482
4617
|
const extensionsResult = this._resourceLoader.getExtensions();
|