dal-code 1.0.46 → 1.0.47
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 +7 -0
- package/PRIVACY.md +18 -11
- package/dal-docs/extensions.md +16 -4
- package/dist/core/extensions/engine-specifiers.js +1 -0
- package/dist/core/extensions/errors.d.ts +12 -0
- package/dist/core/extensions/errors.js +1 -0
- package/dist/core/extensions/index.d.ts +1 -0
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/runner.d.ts +1 -1
- package/dist/core/extensions/runner.js +1 -1
- package/dist/core/extensions/types.d.ts +3 -0
- package/dist/core/extensions/virtual-modules.js +1 -1
- package/dist/dal/manifest.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/modes/index.d.ts +2 -2
- package/dist/modes/index.js +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +13 -1
- package/dist/modes/rpc/rpc-client.js +3 -3
- package/dist/modes/rpc/rpc-mode.js +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +14 -0
- package/dist/node_modules/@dalcode/dal-advisor/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-awake/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-bridge/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-capabilities/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-codeindex/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-compat/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-dap/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-gateway/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-goal/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-guard/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-halo/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-interactive/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-learn/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-office/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +4 -4
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.js +5 -5
- package/dist/node_modules/@dalcode/dal-plugins/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-recall/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-remote/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-review/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-rewind/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-router/package.json +6 -5
- package/dist/node_modules/@dalcode/dal-router/src/config.d.ts +1 -0
- package/dist/node_modules/@dalcode/dal-router/src/config.js +2 -2
- package/dist/node_modules/@dalcode/dal-router/src/roles/index.js +7 -7
- package/dist/node_modules/@dalcode/dal-router/src/roles/planner.js +5 -4
- package/dist/node_modules/@dalcode/dal-router/src/roles/prompts.js +21 -12
- package/dist/node_modules/@dalcode/dal-rtk/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-skills/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-statusline/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-structured/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-subagent/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-sync/LICENSE +21 -0
- package/dist/node_modules/@dalcode/dal-sync/package.json +35 -0
- package/dist/node_modules/@dalcode/dal-sync/src/client.js +1 -0
- package/dist/node_modules/@dalcode/dal-sync/src/core.js +2 -0
- package/dist/node_modules/@dalcode/dal-sync/src/index.js +4 -0
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +4 -3
- package/dist/node_modules/@dalcode/dal-telemetry/src/config.js +3 -3
- package/dist/node_modules/@dalcode/dal-telemetry/src/failure-queue.js +3 -3
- package/dist/node_modules/@dalcode/dal-telemetry/src/failure-reporting.js +3 -5
- package/dist/node_modules/@dalcode/dal-terminal/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/package.json +3 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/src/index.js +4 -4
- package/dist/node_modules/@dalcode/dal-tool-catalog/src/repair-hook.js +2 -2
- package/dist/node_modules/@dalcode/dal-tool-catalog/src/repair.js +2 -2
- package/dist/node_modules/@dalcode/dal-usage/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-web/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-workflow/package.json +2 -2
- package/dist/node_modules/@dalcode/deepailab/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.d.ts +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/version.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-codemode/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-mcp/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sdk/index.js +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/bun/register-bedrock.js +0 -1
- package/dist/cli/experimental/auth.js +0 -1
- package/dist/cli/experimental/cli.js +0 -1
- package/dist/cli/experimental/command-options.js +0 -1
- package/dist/cli/experimental/command.js +0 -1
- package/dist/cli/experimental/commands/client.js +0 -1
- package/dist/cli/experimental/commands/pi.js +0 -1
- package/dist/cli/experimental/commands/server.js +0 -1
- package/dist/cli/experimental/transport-address.js +0 -1
- package/dist/client/index.js +0 -1
- package/dist/client/remote-session.js +0 -1
- package/dist/client/transcript.js +0 -1
- package/dist/core/provider-attribution.js +0 -1
- package/dist/modes/interactive/components/daxnuts.js +0 -1
- package/dist/modes/interactive/theme/theme-json.js +0 -12
- package/dist/modes/interactive/theme/theme-schema.json +0 -356
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +0 -37
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +0 -104
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +0 -16
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/config.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/context.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +0 -10
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/assistant.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/effect-gate.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/execution/tools.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/hooks.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +0 -17
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/bash.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/bounded.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/chord.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/context.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/harness.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/hooks.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/jsonl.js +0 -4
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/collapse.js +0 -3
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/entries.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/frames.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/generation.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/job.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/plugin.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/post-tools.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/task-api.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/kinds/tool.js +0 -3
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/membrane.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/memory.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/scheduler.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/session.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/system.js +0 -8
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/types.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/pico3/view.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +0 -5
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/result.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/boundary.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/checkpoint.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/deferred.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/generation.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/reconcile.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/recovery.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/response.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/retry.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/structural.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/terminal.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tool-placement.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive/tools.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/drive.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/harness.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/lane.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/progress.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/reducer.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/restore.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/transcript.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/runtime/types.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/commit.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork-policy.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/in-memory-storage-state.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/fork.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/io.js +0 -3
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/legacy-v3.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js +0 -8
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +0 -5
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/mutation-line.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/datasets.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/session-repo.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/benchmark/storage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/session-repo.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance/storage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/gating-storage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/instrumented-storage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/storage-decorator.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/types.js +0 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/session/values.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +0 -10
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/system-prompt.js +0 -2
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/telemetry.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js +0 -12
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.js +0 -16
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js +0 -14
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.js +0 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/adaptive-publisher.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/output-capture.js +0 -5
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +0 -5
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/usage.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/node.js +0 -1
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/index.js +0 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/auth/oauth/oauth-page.js +0 -74
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/images-models.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/assistant-message-frame.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/deferred-tools.js +0 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.js +0 -1
- package/dist/server/create-harness.js +0 -1
- package/dist/utils/clipboard-native.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseArgs as t}from"./cli/args.js";import{CONFIG_DIR_NAME as n,getAgentDir as a,getDocsPath as i,getExamplesPath as s,getPackageDir as l,getReadmePath as m,SHARED_SKILL_CONFIG_DIRS as p,VERSION as c}from"./config.js";import{agentLogPath as S,appendAgentLog as T}from"./core/agent-log.js";import{AgentSession as g,parseSkillBlock as E}from"./core/agent-session.js";import{readStoredCredential as C}from"./core/auth-storage.js";import{BackgroundProcessManager as h,MAX_BACKGROUND_PROCESSES as R}from"./core/background-processes.js";import{calculateContextTokens as A,collectEntriesForBranchSummary as D,compact as L,DEFAULT_COMPACTION_SETTINGS as _,estimateTokens as M,findCutPoint as k,findTurnStartIndex as y,generateBranchSummary as I,generateSummary as O,generateSummaryWithUsage as F,getLastAssistantUsage as N,prepareBranchEntries as v,serializeConversation as B,shouldCompact as H}from"./core/compaction/index.js";import{createEventBus as b}from"./core/event-bus.js";import{createExtensionRuntime as W,defineTool as K,discoverAndLoadExtensions as V,ExtensionRunner as j,isBashToolResult as G,isEditToolResult as z,isFindToolResult as X,isGrepToolResult as Y,isLsToolResult as q,isPowerShellToolResult as Q,isReadToolResult as J,isToolCallEventType as Z,isWriteToolResult as $,wrapRegisteredTool as ee,wrapRegisteredTools as oe}from"./core/extensions/index.js";import{getHostCapabilities as re,HOST_CAPABILITIES_ENV as ne,HOST_TOKEN_ENV as ae,HOST_TOKEN_HEADER as ie,HOST_URL_ENV as se,HostCallError as le,HostCapabilities as me,parseHostCapabilities as pe}from"./core/host-capabilities.js";import{convertToLlm as de}from"./core/messages.js";import{ModelRegistry as Te}from"./core/model-registry.js";import{resolveCliModel as ge,resolveModelScopeWithDiagnostics as Ee}from"./core/model-resolver.js";import{CredentialSynchronizationError as Ce,ModelRuntime as ue}from"./core/model-runtime.js";import{DefaultPackageManager as Re}from"./core/package-manager.js";import{buildRuleSet as Ae,matchPermissionRules as De,parsePermissionRule as Le}from"./core/permissions/rules.js";import{simpleCommands as Me,unwrapCommand as ke}from"./core/permissions/shell-words.js";import{evaluateToolPolicy as Ie,readAccessDenial as Oe,registerPermissionAskHandler as Fe}from"./core/permissions/tool-policy.js";import{describeProjectFacts as ve,detectProjectFacts as Be,projectPackageManager as He}from"./core/project-facts.js";import{buildProjectMap as be,formatProjectMapPrompt as Ue}from"./core/project-map.js";import{DefaultResourceLoader as Ke,loadProjectContextFiles as Ve}from"./core/resource-loader.js";import{detectSandboxAvailability as Ge,getProcessShellSandbox as ze,PROTECTED_WRITE_NAMES as Xe,registerSandboxEscalationHandler as Ye,resolveSandboxPolicy as qe,SANDBOX_ENV as Qe,ShellSandbox as Je,systemTempDirs as Ze}from"./core/sandbox/index.js";import{AgentSessionRuntime as eo,createAgentSession as oo,createAgentSessionFromServices as to,createAgentSessionRuntime as ro,createAgentSessionServices as no,createBashTool as ao,createCodingTools as io,createEditTool as so,createFindTool as lo,createGrepTool as mo,createLsTool as po,createPowerShellTool as co,createReadOnlyTools as So,createReadTool as To,createWriteTool as fo}from"./core/sdk.js";import{buildContextEntries as Eo,buildSessionContext as xo,buildSessionProjection as Co,CURRENT_SESSION_VERSION as uo,getLatestCompactionEntry as ho,migrateSessionEntries as Ro,parseSessionEntries as Po,SessionManager as Ao,sessionEntryToContextMessages as Do}from"./core/session-manager.js";import{SettingsManager as _o}from"./core/settings-manager.js";import{formatSkillsForPrompt as ko,loadSkills as yo,loadSkillsFromDir as Io}from"./core/skills.js";import{createSyntheticSourceInfo as Fo}from"./core/source-info.js";import{getToolDenial as vo}from"./core/tool-denial.js";import{isReadOnlyBashCommand as Ho}from"./core/tools/bash-read-only.js";import{generateDiffString as bo,generateUnifiedPatch as Uo,normalizeForFuzzyMatch as Wo}from"./core/tools/edit-diff.js";import{createBashToolDefinition as Vo,createEditToolDefinition as jo,createFindToolDefinition as Go,createGrepToolDefinition as zo,createLocalBashOperations as Xo,createLocalPowerShellOperations as Yo,createLsToolDefinition as qo,createPowerShellToolDefinition as Qo,createProcessToolDefinition as Jo,createReadToolDefinition as Zo,createWriteToolDefinition as $o,DEFAULT_MAX_BYTES as et,DEFAULT_MAX_LINES as ot,formatSize as tt,registerShellExecutionGuard as rt,shellExecutionRefusal as nt,truncateHead as at,truncateLine as it,truncateTail as st,withFileMutationQueue as lt}from"./core/tools/index.js";import{expandTempDirVariable as pt,resolveToCwd as ct}from"./core/tools/path-utils.js";import{formatReadLineRange as St}from"./core/tools/render-utils.js";import{hasTrustRequiringProjectResources as ft,ProjectTrustStore as gt}from"./core/trust-manager.js";import{VIRTUAL_MODEL_STATE_ENTRY as xt}from"./core/virtual-models.js";import{claimWorkspace as ut,defaultWorkspaceLockDir as ht,gitDirOf as Rt,readWorkspaceLock as Pt,releaseWorkspace as At,STALE_AFTER_MS as Dt,shellCommandDirectory as Lt,WORKSPACE_LOCK_DIR_NAME as _t,WORKSPACE_LOCK_FILE as Mt,workspaceLockIsLive as kt,workspaceLockPath as yt,workspaceOwnerSessionId as It}from"./core/workspace-lock.js";import{applyShellEnvironmentPolicy as Ft,DEFAULT_SHELL_ENV_EXCLUDES as Nt,isDalCodeCredentialName as vt,withoutDalCodeCredentials as Bt}from"./dal/child-env.js";import{ADAPTATION_FILE as wt,adaptationState as bt,adaptPackage as Ut,applyCommunityEnv as Wt,communityEnv as Kt,ensurePackageAdapted as Vt,isAdaptablePackage as jt,readAdaptation as Gt,scanHardcodedPiPaths as zt,tryEnsurePackageAdapted as Xt,verifyAdaptation as Yt}from"./dal/extension-compat.js";export*from"./dal/hooks/index.js";import{isHostExtensionPath as Jt,markHostExtensionPaths as Zt}from"./dal/host-extensions.js";import{ENGINE_MARKET_CACHE_FILE as er,fetchSignedMarket as or,MARKET_SECTIONS as tr,marketCacheDir as rr,readSignedSection as nr,resolveMarketEndpoint as ar,verifySignedSection as ir}from"./dal/reviewed/market.js";import{createCodemodeExtension as lr}from"./extensions/codemode/index.js";import{createMcpExtension as pr}from"./extensions/mcp/index.js";import{loadMcpRuntime as dr}from"./extensions/mcp/runtime.lazy.js";import{createToolSearchExtension as Tr}from"./extensions/tool-search/index.js";import{main as gr}from"./main.js";import{InteractiveMode as xr,RpcClient as Cr,runPrintMode as ur,runRpcMode as hr}from"./modes/index.js";import{ArminComponent as Pr,AssistantMessageComponent as Ar,BashExecutionComponent as Dr,BorderedLoader as Lr,BranchSummaryMessageComponent as _r,CompactionSummaryMessageComponent as Mr,CustomEditor as kr,CustomMessageComponent as yr,DynamicBorder as Ir,ExtensionEditorComponent as Or,ExtensionInputComponent as Fr,ExtensionSelectorComponent as Nr,FooterComponent as vr,keyHint as Br,keyText as Hr,LoginDialogComponent as wr,ModelSelectorComponent as br,OAuthSelectorComponent as Ur,rawKeyHint as Wr,renderDiff as Kr,SessionSelectorComponent as Vr,SettingsSelectorComponent as jr,ShowImagesSelectorComponent as Gr,SkillInvocationMessageComponent as zr,ThemeSelectorComponent as Xr,ThinkingSelectorComponent as Yr,ToolExecutionComponent as qr,TreeSelectorComponent as Qr,truncateToVisualLines as Jr,UserMessageComponent as Zr,UserMessageSelectorComponent as $r}from"./modes/interactive/components/index.js";import{getLanguageFromPath as on,getMarkdownTheme as tn,getSelectListTheme as rn,getSettingsListTheme as nn,highlightCode as an,initTheme as sn,Theme as ln}from"./modes/interactive/theme/theme.js";import{copyToClipboard as pn}from"./utils/clipboard.js";import{parseFrontmatter as dn,stripFrontmatter as Sn}from"./utils/frontmatter.js";import{convertToPng as fn}from"./utils/image-convert.js";import{formatDimensionNote as En,resizeImage as xn}from"./utils/image-resize.js";import{detectSupportedImageMimeTypeFromFile as un}from"./utils/mime.js";import{openBrowser as Rn}from"./utils/open-browser.js";import{getPowerShellConfig as An,getShellConfig as Dn,getShellEnv as Ln}from"./utils/shell.js";export{wt as ADAPTATION_FILE,g as AgentSession,eo as AgentSessionRuntime,Pr as ArminComponent,Ar as AssistantMessageComponent,h as BackgroundProcessManager,Dr as BashExecutionComponent,Lr as BorderedLoader,_r as BranchSummaryMessageComponent,n as CONFIG_DIR_NAME,uo as CURRENT_SESSION_VERSION,Mr as CompactionSummaryMessageComponent,Ce as CredentialSynchronizationError,kr as CustomEditor,yr as CustomMessageComponent,_ as DEFAULT_COMPACTION_SETTINGS,et as DEFAULT_MAX_BYTES,ot as DEFAULT_MAX_LINES,Nt as DEFAULT_SHELL_ENV_EXCLUDES,Re as DefaultPackageManager,Ke as DefaultResourceLoader,Ir as DynamicBorder,er as ENGINE_MARKET_CACHE_FILE,Or as ExtensionEditorComponent,Fr as ExtensionInputComponent,j as ExtensionRunner,Nr as ExtensionSelectorComponent,vr as FooterComponent,ne as HOST_CAPABILITIES_ENV,ae as HOST_TOKEN_ENV,ie as HOST_TOKEN_HEADER,se as HOST_URL_ENV,le as HostCallError,me as HostCapabilities,xr as InteractiveMode,wr as LoginDialogComponent,tr as MARKET_SECTIONS,R as MAX_BACKGROUND_PROCESSES,Te as ModelRegistry,ue as ModelRuntime,br as ModelSelectorComponent,Ur as OAuthSelectorComponent,Xe as PROTECTED_WRITE_NAMES,gt as ProjectTrustStore,Cr as RpcClient,Qe as SANDBOX_ENV,p as SHARED_SKILL_CONFIG_DIRS,Dt as STALE_AFTER_MS,Ao as SessionManager,Vr as SessionSelectorComponent,_o as SettingsManager,jr as SettingsSelectorComponent,Je as ShellSandbox,Gr as ShowImagesSelectorComponent,zr as SkillInvocationMessageComponent,ln as Theme,Xr as ThemeSelectorComponent,Yr as ThinkingSelectorComponent,qr as ToolExecutionComponent,Qr as TreeSelectorComponent,Zr as UserMessageComponent,$r as UserMessageSelectorComponent,c as VERSION,xt as VIRTUAL_MODEL_STATE_ENTRY,_t as WORKSPACE_LOCK_DIR_NAME,Mt as WORKSPACE_LOCK_FILE,Ut as adaptPackage,bt as adaptationState,S as agentLogPath,T as appendAgentLog,Wt as applyCommunityEnv,Ft as applyShellEnvironmentPolicy,Eo as buildContextEntries,be as buildProjectMap,Ae as buildRuleSet,xo as buildSessionContext,Co as buildSessionProjection,A as calculateContextTokens,ut as claimWorkspace,D as collectEntriesForBranchSummary,Kt as communityEnv,L as compact,de as convertToLlm,fn as convertToPng,pn as copyToClipboard,oo as createAgentSession,to as createAgentSessionFromServices,ro as createAgentSessionRuntime,no as createAgentSessionServices,ao as createBashTool,Vo as createBashToolDefinition,lr as createCodemodeExtension,io as createCodingTools,so as createEditTool,jo as createEditToolDefinition,b as createEventBus,W as createExtensionRuntime,lo as createFindTool,Go as createFindToolDefinition,mo as createGrepTool,zo as createGrepToolDefinition,Xo as createLocalBashOperations,Yo as createLocalPowerShellOperations,po as createLsTool,qo as createLsToolDefinition,pr as createMcpExtension,co as createPowerShellTool,Qo as createPowerShellToolDefinition,Jo as createProcessToolDefinition,So as createReadOnlyTools,To as createReadTool,Zo as createReadToolDefinition,Fo as createSyntheticSourceInfo,Tr as createToolSearchExtension,fo as createWriteTool,$o as createWriteToolDefinition,ht as defaultWorkspaceLockDir,K as defineTool,ve as describeProjectFacts,Be as detectProjectFacts,Ge as detectSandboxAvailability,un as detectSupportedImageMimeTypeFromFile,V as discoverAndLoadExtensions,Vt as ensurePackageAdapted,M as estimateTokens,Ie as evaluateToolPolicy,pt as expandTempDirVariable,or as fetchSignedMarket,k as findCutPoint,y as findTurnStartIndex,En as formatDimensionNote,Ue as formatProjectMapPrompt,St as formatReadLineRange,tt as formatSize,ko as formatSkillsForPrompt,I as generateBranchSummary,bo as generateDiffString,O as generateSummary,F as generateSummaryWithUsage,Uo as generateUnifiedPatch,a as getAgentDir,i as getDocsPath,s as getExamplesPath,re as getHostCapabilities,on as getLanguageFromPath,N as getLastAssistantUsage,ho as getLatestCompactionEntry,tn as getMarkdownTheme,l as getPackageDir,An as getPowerShellConfig,ze as getProcessShellSandbox,m as getReadmePath,rn as getSelectListTheme,nn as getSettingsListTheme,Dn as getShellConfig,Ln as getShellEnv,vo as getToolDenial,Rt as gitDirOf,ft as hasTrustRequiringProjectResources,an as highlightCode,sn as initTheme,jt as isAdaptablePackage,G as isBashToolResult,vt as isDalCodeCredentialName,z as isEditToolResult,X as isFindToolResult,Y as isGrepToolResult,Jt as isHostExtensionPath,q as isLsToolResult,Q as isPowerShellToolResult,Ho as isReadOnlyBashCommand,J as isReadToolResult,Z as isToolCallEventType,$ as isWriteToolResult,Br as keyHint,Hr as keyText,dr as loadMcpRuntime,Ve as loadProjectContextFiles,yo as loadSkills,Io as loadSkillsFromDir,gr as main,Zt as markHostExtensionPaths,rr as marketCacheDir,De as matchPermissionRules,Ro as migrateSessionEntries,Wo as normalizeForFuzzyMatch,Rn as openBrowser,t as parseArgs,dn as parseFrontmatter,pe as parseHostCapabilities,Le as parsePermissionRule,Po as parseSessionEntries,E as parseSkillBlock,v as prepareBranchEntries,He as projectPackageManager,Wr as rawKeyHint,Oe as readAccessDenial,Gt as readAdaptation,nr as readSignedSection,C as readStoredCredential,Pt as readWorkspaceLock,Fe as registerPermissionAskHandler,Ye as registerSandboxEscalationHandler,rt as registerShellExecutionGuard,At as releaseWorkspace,Kr as renderDiff,xn as resizeImage,ge as resolveCliModel,ar as resolveMarketEndpoint,Ee as resolveModelScopeWithDiagnostics,qe as resolveSandboxPolicy,ct as resolveToCwd,ur as runPrintMode,hr as runRpcMode,zt as scanHardcodedPiPaths,B as serializeConversation,Do as sessionEntryToContextMessages,Lt as shellCommandDirectory,nt as shellExecutionRefusal,H as shouldCompact,Me as simpleCommands,Sn as stripFrontmatter,Ze as systemTempDirs,at as truncateHead,it as truncateLine,st as truncateTail,Jr as truncateToVisualLines,Xt as tryEnsurePackageAdapted,ke as unwrapCommand,Yt as verifyAdaptation,ir as verifySignedSection,lt as withFileMutationQueue,Bt as withoutDalCodeCredentials,kt as workspaceLockIsLive,yt as workspaceLockPath,It as workspaceOwnerSessionId,ee as wrapRegisteredTool,oe as wrapRegisteredTools};
|
|
1
|
+
import{parseArgs as t}from"./cli/args.js";import{CONFIG_DIR_NAME as n,getAgentDir as a,getDocsPath as i,getExamplesPath as s,getPackageDir as l,getReadmePath as m,SHARED_SKILL_CONFIG_DIRS as p,VERSION as c}from"./config.js";import{agentLogPath as S,appendAgentLog as E}from"./core/agent-log.js";import{AgentSession as f,parseSkillBlock as g}from"./core/agent-session.js";import{readStoredCredential as C}from"./core/auth-storage.js";import{BackgroundProcessManager as R,MAX_BACKGROUND_PROCESSES as h}from"./core/background-processes.js";import{calculateContextTokens as P,collectEntriesForBranchSummary as D,compact as L,DEFAULT_COMPACTION_SETTINGS as _,estimateTokens as M,findCutPoint as k,findTurnStartIndex as I,generateBranchSummary as y,generateSummary as F,generateSummaryWithUsage as O,getLastAssistantUsage as N,prepareBranchEntries as v,serializeConversation as B,shouldCompact as H}from"./core/compaction/index.js";import{createEventBus as b}from"./core/event-bus.js";import{createExtensionRuntime as W,defineTool as K,discoverAndLoadExtensions as V,ExtensionFatalError as j,ExtensionRunner as G,isBashToolResult as z,isEditToolResult as X,isFatalExtensionError as q,isFindToolResult as Q,isGrepToolResult as Y,isLsToolResult as J,isPowerShellToolResult as Z,isReadToolResult as $,isToolCallEventType as ee,isWriteToolResult as oe,REQUIRED_EXTENSION_FAILED as te,RequiredExtensionError as re,wrapRegisteredTool as ne,wrapRegisteredTools as ae}from"./core/extensions/index.js";import{getHostCapabilities as se,HOST_CAPABILITIES_ENV as le,HOST_TOKEN_ENV as me,HOST_TOKEN_HEADER as pe,HOST_URL_ENV as ce,HostCallError as de,HostCapabilities as Se,parseHostCapabilities as Ee}from"./core/host-capabilities.js";import{convertToLlm as fe}from"./core/messages.js";import{ModelRegistry as xe}from"./core/model-registry.js";import{resolveCliModel as ue,resolveModelScopeWithDiagnostics as Re}from"./core/model-resolver.js";import{CredentialSynchronizationError as Ae,ModelRuntime as Pe}from"./core/model-runtime.js";import{DefaultPackageManager as Le}from"./core/package-manager.js";import{buildRuleSet as Me,matchPermissionRules as ke,parsePermissionRule as Ie}from"./core/permissions/rules.js";import{simpleCommands as Fe,unwrapCommand as Oe}from"./core/permissions/shell-words.js";import{evaluateToolPolicy as ve,readAccessDenial as Be,registerPermissionAskHandler as He}from"./core/permissions/tool-policy.js";import{describeProjectFacts as be,detectProjectFacts as Ue,projectPackageManager as We}from"./core/project-facts.js";import{buildProjectMap as Ve,formatProjectMapPrompt as je}from"./core/project-map.js";import{DefaultResourceLoader as ze,loadProjectContextFiles as Xe}from"./core/resource-loader.js";import{detectSandboxAvailability as Qe,getProcessShellSandbox as Ye,PROTECTED_WRITE_NAMES as Je,registerSandboxEscalationHandler as Ze,resolveSandboxPolicy as $e,SANDBOX_ENV as eo,ShellSandbox as oo,systemTempDirs as to}from"./core/sandbox/index.js";import{AgentSessionRuntime as no,createAgentSession as ao,createAgentSessionFromServices as io,createAgentSessionRuntime as so,createAgentSessionServices as lo,createBashTool as mo,createCodingTools as po,createEditTool as co,createFindTool as So,createGrepTool as Eo,createLsTool as To,createPowerShellTool as fo,createReadOnlyTools as go,createReadTool as xo,createWriteTool as Co}from"./core/sdk.js";import{buildContextEntries as Ro,buildSessionContext as ho,buildSessionProjection as Ao,CURRENT_SESSION_VERSION as Po,getLatestCompactionEntry as Do,migrateSessionEntries as Lo,parseSessionEntries as _o,SessionManager as Mo,sessionEntryToContextMessages as ko}from"./core/session-manager.js";import{SettingsManager as yo}from"./core/settings-manager.js";import{formatSkillsForPrompt as Oo,loadSkills as No,loadSkillsFromDir as vo}from"./core/skills.js";import{createSyntheticSourceInfo as Ho}from"./core/source-info.js";import{getToolDenial as bo}from"./core/tool-denial.js";import{isReadOnlyBashCommand as Wo}from"./core/tools/bash-read-only.js";import{generateDiffString as Vo,generateUnifiedPatch as jo,normalizeForFuzzyMatch as Go}from"./core/tools/edit-diff.js";import{createBashToolDefinition as Xo,createEditToolDefinition as qo,createFindToolDefinition as Qo,createGrepToolDefinition as Yo,createLocalBashOperations as Jo,createLocalPowerShellOperations as Zo,createLsToolDefinition as $o,createPowerShellToolDefinition as et,createProcessToolDefinition as ot,createReadToolDefinition as tt,createWriteToolDefinition as rt,DEFAULT_MAX_BYTES as nt,DEFAULT_MAX_LINES as at,formatSize as it,registerShellExecutionGuard as st,shellExecutionRefusal as lt,truncateHead as mt,truncateLine as pt,truncateTail as ct,withFileMutationQueue as dt}from"./core/tools/index.js";import{expandTempDirVariable as Et,resolveToCwd as Tt}from"./core/tools/path-utils.js";import{formatReadLineRange as gt}from"./core/tools/render-utils.js";import{hasTrustRequiringProjectResources as Ct,ProjectTrustStore as ut}from"./core/trust-manager.js";import{VIRTUAL_MODEL_STATE_ENTRY as ht}from"./core/virtual-models.js";import{claimWorkspace as Pt,defaultWorkspaceLockDir as Dt,gitDirOf as Lt,readWorkspaceLock as _t,releaseWorkspace as Mt,STALE_AFTER_MS as kt,shellCommandDirectory as It,WORKSPACE_LOCK_DIR_NAME as yt,WORKSPACE_LOCK_FILE as Ft,workspaceLockIsLive as Ot,workspaceLockPath as Nt,workspaceOwnerSessionId as vt}from"./core/workspace-lock.js";import{applyShellEnvironmentPolicy as Ht,DEFAULT_SHELL_ENV_EXCLUDES as wt,isDalCodeCredentialName as bt,withoutDalCodeCredentials as Ut}from"./dal/child-env.js";import{ADAPTATION_FILE as Kt,adaptationState as Vt,adaptPackage as jt,applyCommunityEnv as Gt,communityEnv as zt,ensurePackageAdapted as Xt,isAdaptablePackage as qt,readAdaptation as Qt,scanHardcodedPiPaths as Yt,tryEnsurePackageAdapted as Jt,verifyAdaptation as Zt}from"./dal/extension-compat.js";export*from"./dal/hooks/index.js";import{isHostExtensionPath as or,markHostExtensionPaths as tr}from"./dal/host-extensions.js";import{ENGINE_MARKET_CACHE_FILE as nr,fetchSignedMarket as ar,MARKET_SECTIONS as ir,marketCacheDir as sr,readSignedSection as lr,resolveMarketEndpoint as mr,verifySignedSection as pr}from"./dal/reviewed/market.js";import{createCodemodeExtension as dr}from"./extensions/codemode/index.js";import{createMcpExtension as Er}from"./extensions/mcp/index.js";import{loadMcpRuntime as fr}from"./extensions/mcp/runtime.lazy.js";import{createToolSearchExtension as xr}from"./extensions/tool-search/index.js";import{main as ur}from"./main.js";import{InteractiveMode as hr,RpcClient as Ar,RpcCommandError as Pr,runPrintMode as Dr,runRpcMode as Lr}from"./modes/index.js";import{ArminComponent as Mr,AssistantMessageComponent as kr,BashExecutionComponent as Ir,BorderedLoader as yr,BranchSummaryMessageComponent as Fr,CompactionSummaryMessageComponent as Or,CustomEditor as Nr,CustomMessageComponent as vr,DynamicBorder as Br,ExtensionEditorComponent as Hr,ExtensionInputComponent as wr,ExtensionSelectorComponent as br,FooterComponent as Ur,keyHint as Wr,keyText as Kr,LoginDialogComponent as Vr,ModelSelectorComponent as jr,OAuthSelectorComponent as Gr,rawKeyHint as zr,renderDiff as Xr,SessionSelectorComponent as qr,SettingsSelectorComponent as Qr,ShowImagesSelectorComponent as Yr,SkillInvocationMessageComponent as Jr,ThemeSelectorComponent as Zr,ThinkingSelectorComponent as $r,ToolExecutionComponent as en,TreeSelectorComponent as on,truncateToVisualLines as tn,UserMessageComponent as rn,UserMessageSelectorComponent as nn}from"./modes/interactive/components/index.js";import{getLanguageFromPath as sn,getMarkdownTheme as ln,getSelectListTheme as mn,getSettingsListTheme as pn,highlightCode as cn,initTheme as dn,Theme as Sn}from"./modes/interactive/theme/theme.js";import{copyToClipboard as Tn}from"./utils/clipboard.js";import{parseFrontmatter as gn,stripFrontmatter as xn}from"./utils/frontmatter.js";import{convertToPng as un}from"./utils/image-convert.js";import{formatDimensionNote as hn,resizeImage as An}from"./utils/image-resize.js";import{detectSupportedImageMimeTypeFromFile as Dn}from"./utils/mime.js";import{openBrowser as _n}from"./utils/open-browser.js";import{getPowerShellConfig as kn,getShellConfig as In,getShellEnv as yn}from"./utils/shell.js";export{Kt as ADAPTATION_FILE,f as AgentSession,no as AgentSessionRuntime,Mr as ArminComponent,kr as AssistantMessageComponent,R as BackgroundProcessManager,Ir as BashExecutionComponent,yr as BorderedLoader,Fr as BranchSummaryMessageComponent,n as CONFIG_DIR_NAME,Po as CURRENT_SESSION_VERSION,Or as CompactionSummaryMessageComponent,Ae as CredentialSynchronizationError,Nr as CustomEditor,vr as CustomMessageComponent,_ as DEFAULT_COMPACTION_SETTINGS,nt as DEFAULT_MAX_BYTES,at as DEFAULT_MAX_LINES,wt as DEFAULT_SHELL_ENV_EXCLUDES,Le as DefaultPackageManager,ze as DefaultResourceLoader,Br as DynamicBorder,nr as ENGINE_MARKET_CACHE_FILE,Hr as ExtensionEditorComponent,j as ExtensionFatalError,wr as ExtensionInputComponent,G as ExtensionRunner,br as ExtensionSelectorComponent,Ur as FooterComponent,le as HOST_CAPABILITIES_ENV,me as HOST_TOKEN_ENV,pe as HOST_TOKEN_HEADER,ce as HOST_URL_ENV,de as HostCallError,Se as HostCapabilities,hr as InteractiveMode,Vr as LoginDialogComponent,ir as MARKET_SECTIONS,h as MAX_BACKGROUND_PROCESSES,xe as ModelRegistry,Pe as ModelRuntime,jr as ModelSelectorComponent,Gr as OAuthSelectorComponent,Je as PROTECTED_WRITE_NAMES,ut as ProjectTrustStore,te as REQUIRED_EXTENSION_FAILED,re as RequiredExtensionError,Ar as RpcClient,Pr as RpcCommandError,eo as SANDBOX_ENV,p as SHARED_SKILL_CONFIG_DIRS,kt as STALE_AFTER_MS,Mo as SessionManager,qr as SessionSelectorComponent,yo as SettingsManager,Qr as SettingsSelectorComponent,oo as ShellSandbox,Yr as ShowImagesSelectorComponent,Jr as SkillInvocationMessageComponent,Sn as Theme,Zr as ThemeSelectorComponent,$r as ThinkingSelectorComponent,en as ToolExecutionComponent,on as TreeSelectorComponent,rn as UserMessageComponent,nn as UserMessageSelectorComponent,c as VERSION,ht as VIRTUAL_MODEL_STATE_ENTRY,yt as WORKSPACE_LOCK_DIR_NAME,Ft as WORKSPACE_LOCK_FILE,jt as adaptPackage,Vt as adaptationState,S as agentLogPath,E as appendAgentLog,Gt as applyCommunityEnv,Ht as applyShellEnvironmentPolicy,Ro as buildContextEntries,Ve as buildProjectMap,Me as buildRuleSet,ho as buildSessionContext,Ao as buildSessionProjection,P as calculateContextTokens,Pt as claimWorkspace,D as collectEntriesForBranchSummary,zt as communityEnv,L as compact,fe as convertToLlm,un as convertToPng,Tn as copyToClipboard,ao as createAgentSession,io as createAgentSessionFromServices,so as createAgentSessionRuntime,lo as createAgentSessionServices,mo as createBashTool,Xo as createBashToolDefinition,dr as createCodemodeExtension,po as createCodingTools,co as createEditTool,qo as createEditToolDefinition,b as createEventBus,W as createExtensionRuntime,So as createFindTool,Qo as createFindToolDefinition,Eo as createGrepTool,Yo as createGrepToolDefinition,Jo as createLocalBashOperations,Zo as createLocalPowerShellOperations,To as createLsTool,$o as createLsToolDefinition,Er as createMcpExtension,fo as createPowerShellTool,et as createPowerShellToolDefinition,ot as createProcessToolDefinition,go as createReadOnlyTools,xo as createReadTool,tt as createReadToolDefinition,Ho as createSyntheticSourceInfo,xr as createToolSearchExtension,Co as createWriteTool,rt as createWriteToolDefinition,Dt as defaultWorkspaceLockDir,K as defineTool,be as describeProjectFacts,Ue as detectProjectFacts,Qe as detectSandboxAvailability,Dn as detectSupportedImageMimeTypeFromFile,V as discoverAndLoadExtensions,Xt as ensurePackageAdapted,M as estimateTokens,ve as evaluateToolPolicy,Et as expandTempDirVariable,ar as fetchSignedMarket,k as findCutPoint,I as findTurnStartIndex,hn as formatDimensionNote,je as formatProjectMapPrompt,gt as formatReadLineRange,it as formatSize,Oo as formatSkillsForPrompt,y as generateBranchSummary,Vo as generateDiffString,F as generateSummary,O as generateSummaryWithUsage,jo as generateUnifiedPatch,a as getAgentDir,i as getDocsPath,s as getExamplesPath,se as getHostCapabilities,sn as getLanguageFromPath,N as getLastAssistantUsage,Do as getLatestCompactionEntry,ln as getMarkdownTheme,l as getPackageDir,kn as getPowerShellConfig,Ye as getProcessShellSandbox,m as getReadmePath,mn as getSelectListTheme,pn as getSettingsListTheme,In as getShellConfig,yn as getShellEnv,bo as getToolDenial,Lt as gitDirOf,Ct as hasTrustRequiringProjectResources,cn as highlightCode,dn as initTheme,qt as isAdaptablePackage,z as isBashToolResult,bt as isDalCodeCredentialName,X as isEditToolResult,q as isFatalExtensionError,Q as isFindToolResult,Y as isGrepToolResult,or as isHostExtensionPath,J as isLsToolResult,Z as isPowerShellToolResult,Wo as isReadOnlyBashCommand,$ as isReadToolResult,ee as isToolCallEventType,oe as isWriteToolResult,Wr as keyHint,Kr as keyText,fr as loadMcpRuntime,Xe as loadProjectContextFiles,No as loadSkills,vo as loadSkillsFromDir,ur as main,tr as markHostExtensionPaths,sr as marketCacheDir,ke as matchPermissionRules,Lo as migrateSessionEntries,Go as normalizeForFuzzyMatch,_n as openBrowser,t as parseArgs,gn as parseFrontmatter,Ee as parseHostCapabilities,Ie as parsePermissionRule,_o as parseSessionEntries,g as parseSkillBlock,v as prepareBranchEntries,We as projectPackageManager,zr as rawKeyHint,Be as readAccessDenial,Qt as readAdaptation,lr as readSignedSection,C as readStoredCredential,_t as readWorkspaceLock,He as registerPermissionAskHandler,Ze as registerSandboxEscalationHandler,st as registerShellExecutionGuard,Mt as releaseWorkspace,Xr as renderDiff,An as resizeImage,ue as resolveCliModel,mr as resolveMarketEndpoint,Re as resolveModelScopeWithDiagnostics,$e as resolveSandboxPolicy,Tt as resolveToCwd,Dr as runPrintMode,Lr as runRpcMode,Yt as scanHardcodedPiPaths,B as serializeConversation,ko as sessionEntryToContextMessages,It as shellCommandDirectory,lt as shellExecutionRefusal,H as shouldCompact,Fe as simpleCommands,xn as stripFrontmatter,to as systemTempDirs,mt as truncateHead,pt as truncateLine,ct as truncateTail,tn as truncateToVisualLines,Jt as tryEnsurePackageAdapted,Oe as unwrapCommand,Zt as verifyAdaptation,pr as verifySignedSection,dt as withFileMutationQueue,Ut as withoutDalCodeCredentials,Ot as workspaceLockIsLive,Nt as workspaceLockPath,vt as workspaceOwnerSessionId,ne as wrapRegisteredTool,ae as wrapRegisteredTools};
|
package/dist/modes/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export { runAcpMode } from "./acp/acp-mode.ts";
|
|
|
2
2
|
export { InteractiveMode, type InteractiveModeOptions } from "./interactive/interactive-mode.ts";
|
|
3
3
|
export type { JsonAgentSessionEvent } from "./json-event.ts";
|
|
4
4
|
export { type PrintModeOptions, runPrintMode } from "./print-mode.ts";
|
|
5
|
-
export { type ModelInfo, RpcClient, type RpcClientOptions, type RpcEventListener, type RpcExitListener, type RpcHostRequestHandler, type RpcProcessExit, } from "./rpc/rpc-client.ts";
|
|
5
|
+
export { type ModelInfo, RpcClient, type RpcClientOptions, RpcCommandError, type RpcEventListener, type RpcExitListener, type RpcHostRequestHandler, type RpcProcessExit, } from "./rpc/rpc-client.ts";
|
|
6
6
|
export { runRpcMode } from "./rpc/rpc-mode.ts";
|
|
7
|
-
export type { RpcCommand, RpcExtensionUIRequest, RpcExtensionUIResponse, RpcHostRequest, RpcHostResponse, RpcResponse, RpcSessionState, } from "./rpc/rpc-types.ts";
|
|
7
|
+
export type { RpcCommand, RpcErrorCode, RpcExtensionErrorEvent, RpcExtensionUIRequest, RpcExtensionUIResponse, RpcHostRequest, RpcHostResponse, RpcResponse, RpcSessionState, } from "./rpc/rpc-types.ts";
|
package/dist/modes/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{runAcpMode as e}from"./acp/acp-mode.js";import{InteractiveMode as
|
|
1
|
+
import{runAcpMode as e}from"./acp/acp-mode.js";import{InteractiveMode as t}from"./interactive/interactive-mode.js";import{runPrintMode as n}from"./print-mode.js";import{RpcClient as d,RpcCommandError as f}from"./rpc/rpc-client.js";import{runRpcMode as M}from"./rpc/rpc-mode.js";export{t as InteractiveMode,d as RpcClient,f as RpcCommandError,e as runAcpMode,n as runPrintMode,M as runRpcMode};
|
|
@@ -9,7 +9,19 @@ import type { HostCapability } from "../../core/host-capabilities.ts";
|
|
|
9
9
|
import type { SandboxStatus } from "../../core/sandbox/shell-sandbox.ts";
|
|
10
10
|
import type { SessionEntry, SessionTreeNode } from "../../core/session-manager.ts";
|
|
11
11
|
import type { JsonAgentSessionEvent } from "../json-event.ts";
|
|
12
|
-
import type { PermissionModeStatus, RpcApprovalRequest, RpcExtensionUIRequest, RpcExtensionUIResponse, RpcHostRequest, RpcMessageMeta, RpcPermissionMode, RpcSessionState, RpcSlashCommand, TelemetryConsentStatus } from "./rpc-types.ts";
|
|
12
|
+
import type { PermissionModeStatus, RpcApprovalRequest, RpcErrorCode, RpcExtensionUIRequest, RpcExtensionUIResponse, RpcHostRequest, RpcMessageMeta, RpcPermissionMode, RpcResponse, RpcSessionState, RpcSlashCommand, TelemetryConsentStatus } from "./rpc-types.ts";
|
|
13
|
+
export declare class RpcCommandError extends Error {
|
|
14
|
+
readonly command: string;
|
|
15
|
+
readonly code?: RpcErrorCode;
|
|
16
|
+
readonly extensionError?: {
|
|
17
|
+
extensionPath: string;
|
|
18
|
+
event: string;
|
|
19
|
+
error: string;
|
|
20
|
+
};
|
|
21
|
+
constructor(response: Extract<RpcResponse, {
|
|
22
|
+
success: false;
|
|
23
|
+
}>);
|
|
24
|
+
}
|
|
13
25
|
export interface RpcClientOptions {
|
|
14
26
|
cliPath?: string;
|
|
15
27
|
cwd?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var w=Object.defineProperty;var h=(
|
|
2
|
-
`);return e.length>u?e.slice(-u):e}h(E,"rpcStderrTail");const x=new Set(["select","confirm","input","editor","requestInput","requestChoice"]);class I{static{h(this,"RpcClient")}process=null;stopReadingStdout=null;eventListeners=[];pendingRequests=new Map;requestId=0;extensionUIHandler=null;approvalHandler=null;hostRequestHandler=null;stderr="";exitError=null;options;exitListeners=new Set;exitInfo;stopping=!1;turnInFlight=!1;constructor(t={}){this.options=t}async start(){if(this.process)throw new Error("Client already started");this.exitError=null,this.exitInfo=void 0,this.stopping=!1,this.turnInFlight=!1;const t=this.options.cliPath??"dist/cli.js",e=["--mode","rpc"];this.options.provider&&e.push("--provider",this.options.provider),this.options.model&&e.push("--model",this.options.model),this.options.args&&e.push(...this.options.args);const s=f(process.execPath,[t,...e],{cwd:this.options.cwd,env:{...this.options.inheritEnv===!1?{}:process.env,...this.options.env},stdio:["pipe","pipe","pipe"],detached:process.platform!=="win32"});if(this.process=s,s.stderr?.on("data",n=>{this.stderr+=n.toString(),process.stderr.write(n)}),s.once("exit",(n,r)=>{if(this.process!==s)return;this.reportExit({code:n,signal:r});const o=this.createProcessExitError(n,r);this.exitError=o,this.rejectPendingRequests(o)}),s.once("error",n=>{if(this.process!==s)return;const r=new Error(`Agent process error: ${n.message}. Stderr: ${this.stderr}`);s.exitCode===null&&s.signalCode===null&&this.reportExit({code:null,signal:null,error:n.message}),this.exitError=r,this.rejectPendingRequests(r)}),s.stdin?.on("error",n=>{if(this.process!==s)return;const r=this.exitError??new Error(`Agent process stdin error: ${n.message}. Stderr: ${this.stderr}`);this.exitError=r,this.rejectPendingRequests(r)}),this.stopReadingStdout=_(s.stdout,n=>{this.handleLine(n)}),await new Promise(n=>setTimeout(n,100)),this.process.exitCode!==null){const n=this.exitError??this.createProcessExitError(this.process.exitCode,this.process.signalCode);throw this.exitError=n,n}}async stop(){if(!this.process)return;this.stopReadingStdout?.(),this.stopReadingStdout=null,this.stopping=!0;const t=this.process,e=h(n=>{try{t.pid!==void 0&&process.platform!=="win32"?process.kill(-t.pid,n):t.kill(n)}catch{t.kill(n)}},"signal"),s=t.exitCode!==null||t.signalCode!==null;s||e("SIGTERM"),await new Promise(n=>{if(s){n();return}const r=setTimeout(()=>{e("SIGKILL"),n()},1e3);t.on("exit",()=>{clearTimeout(r),e("SIGKILL"),n()})}),this.process=null,this.pendingRequests.clear()}onExit(t){const e=this.exitInfo;return e?(queueMicrotask(()=>t(e)),()=>{}):(this.exitListeners.add(t),()=>{this.exitListeners.delete(t)})}getExit(){return this.exitInfo}onEvent(t){return this.eventListeners.push(t),()=>{const e=this.eventListeners.indexOf(t);e!==-1&&this.eventListeners.splice(e,1)}}setExtensionUIHandler(t){this.extensionUIHandler=t}setApprovalHandler(t){this.approvalHandler=t}getStderr(){return this.stderr}async prompt(t,e,s){const n=await this.send({type:"prompt",message:t,images:e,streamingBehavior:s}),{disposition:r}=this.getData(n);return r!=="handled"&&(this.turnInFlight=!0),r}async steer(t,e){const s=await this.send({type:"steer",message:t,images:e});return this.getData(s).disposition}async followUp(t,e){const s=await this.send({type:"follow_up",message:t,images:e});return this.getData(s).disposition}async abort(){await this.send({type:"abort"})}async clearQueue(){const t=await this.send({type:"clear_queue"});return this.getData(t)}async newSession(t){const e=await this.send({type:"new_session",parentSession:t});return this.getData(e)}async getState(){const t=await this.send({type:"get_state"});return this.getData(t)}async setModel(t,e){const s=await this.send({type:"set_model",provider:t,modelId:e});return this.getData(s)}async cycleModel(){const t=await this.send({type:"cycle_model"});return this.getData(t)}async getAvailableModels(){const t=await this.send({type:"get_available_models"});return this.getData(t).models}async setThinkingLevel(t){await this.send({type:"set_thinking_level",level:t})}async cycleThinkingLevel(){const t=await this.send({type:"cycle_thinking_level"});return this.getData(t)}async getAvailableThinkingLevels(){const t=await this.send({type:"get_available_thinking_levels"});return this.getData(t).levels}async setSteeringMode(t){await this.send({type:"set_steering_mode",mode:t})}async setFollowUpMode(t){await this.send({type:"set_follow_up_mode",mode:t})}async compact(t){const e=await this.send({type:"compact",customInstructions:t});return this.getData(e)}async setAutoCompaction(t){await this.send({type:"set_auto_compaction",enabled:t})}async setAutoRetry(t){await this.send({type:"set_auto_retry",enabled:t})}async abortRetry(){await this.send({type:"abort_retry"})}async bash(t){const e=await this.send({type:"bash",command:t});return this.getData(e)}async abortBash(){await this.send({type:"abort_bash"})}async getSandboxStatus(){const t=await this.send({type:"get_sandbox_status"});return this.getData(t)}async listBackgroundProcesses(){const t=await this.send({type:"list_background_processes"});return this.getData(t).processes}async readBackgroundProcess(t,e){const s=await this.send({type:"read_background_process",processId:t,...e!==void 0?{tail:e}:{}});return this.getData(s)}async stopBackgroundProcess(t){const e=await this.send({type:"stop_background_process",processId:t});return this.getData(e).process}async setEnvironment(t){const e=await this.send({type:"set_environment",...t});return this.getData(e).changed}async setTelemetryConsent(t){const e=await this.send({type:"set_telemetry_consent",usage:t.usage,...t.failures!==void 0?{failures:t.failures}:{}});return this.getData(e)}async getPermissionMode(){const t=await this.send({type:"get_permission_mode"});return this.getData(t)}async setPermissionMode(t,e={}){const s=await this.send({type:"set_permission_mode",mode:t,...e.save!==void 0?{save:e.save}:{}});return this.getData(s)}async getSessionStats(){const t=await this.send({type:"get_session_stats"});return this.getData(t)}async exportHtml(t){const e=await this.send({type:"export_html",outputPath:t});return this.getData(e)}async switchSession(t){const e=await this.send({type:"switch_session",sessionPath:t});return this.getData(e)}async fork(t){const e=await this.send({type:"fork",entryId:t});return this.getData(e)}async clone(){const t=await this.send({type:"clone"});return this.getData(t)}async getForkMessages(){const t=await this.send({type:"get_fork_messages"});return this.getData(t).messages}async getEntries(t){const e=await this.send({type:"get_entries",since:t});return this.getData(e)}async getTree(){const t=await this.send({type:"get_tree"});return this.getData(t)}async getLastAssistantText(){const t=await this.send({type:"get_last_assistant_text"});return this.getData(t).text}async setSessionName(t){await this.send({type:"set_session_name",name:t})}async getMessages(){const t=await this.send({type:"get_messages"});return this.getData(t).messages}async getMessagesWithMeta(){const t=await this.send({type:"get_messages"});return this.getData(t)}async respondToApproval(t,e){const s=await this.send({type:"approval_response",optionId:e},t);return this.getData(s)}async getCommands(){const t=await this.send({type:"get_commands"});return this.getData(t).commands}async setHostCapabilities(t,e){this.hostRequestHandler=e;const s=await this.send({type:"set_host_capabilities",capabilities:t});return this.getData(s).capabilities}waitForIdle(t=6e4){return new Promise((e,s)=>{const n=setTimeout(()=>{r(),o(),s(new Error(`Timeout waiting for agent to become idle. Stderr: ${this.stderr}`))},t),r=this.onEvent(i=>{i.type==="agent_settled"&&(clearTimeout(n),r(),o(),e())}),o=this.onExit(i=>{clearTimeout(n),r(),s(this.createExitWhileWaitingError(i))})})}collectEvents(t=6e4){return new Promise((e,s)=>{const n=[],r=setTimeout(()=>{o(),i(),s(new Error(`Timeout collecting events. Stderr: ${this.stderr}`))},t),o=this.onEvent(a=>{n.push(a),a.type==="agent_settled"&&(clearTimeout(r),o(),i(),e(n))}),i=this.onExit(a=>{clearTimeout(r),o(),s(this.createExitWhileWaitingError(a))})})}async promptAndWait(t,e,s=6e4){const n=this.collectEvents(s);return await this.prompt(t,e),n}handleLine(t){try{const e=JSON.parse(t);if(e.type==="agent_start"?this.turnInFlight=!0:e.type==="agent_settled"&&(this.turnInFlight=!1),e.type==="response"&&e.id&&this.pendingRequests.has(e.id)){const s=this.pendingRequests.get(e.id);this.pendingRequests.delete(e.id),s.resolve(e);return}if(e.type==="approval_request"&&this.approvalHandler&&this.answerApprovalRequest(e),e.type==="extension_ui_request"&&x.has(e.method)&&!(e.approval===!0&&this.approvalHandler)&&this.answerExtensionUIRequest(e),e.type==="host_request"){this.answerHostRequest(e);return}for(const s of[...this.eventListeners])s(e)}catch{}}async answerExtensionUIRequest(t){const e={type:"extension_ui_response",id:t.id,cancelled:!0};let s=e;if(this.extensionUIHandler)try{s=await this.extensionUIHandler(t)??e}catch{s=e}const n=this.process?.stdin;if(!(!n||n.destroyed||!n.writable))try{n.write(d({...s,id:t.id}))}catch{}}async answerApprovalRequest(t){let e="deny";try{e=await this.approvalHandler?.(t)??"deny"}catch{e="deny"}try{await this.respondToApproval(t.id,e)}catch{}}async answerHostRequest(t){let e;if(!this.hostRequestHandler)e={type:"host_response",id:t.id,error:"host has no handler for host requests"};else try{const n=await this.hostRequestHandler(t);e={type:"host_response",id:t.id,result:n??null}}catch(n){e={type:"host_response",id:t.id,error:n instanceof Error?n.message:String(n)}}const s=this.process?.stdin;if(!(!s||s.destroyed||!s.writable))try{s.write(d(e))}catch{}}reportExit(t){if(this.exitInfo)return;const e={code:t.code,signal:t.signal,stderrTail:E(this.stderr),expected:this.stopping,turnInFlight:this.turnInFlight,...t.error?{error:t.error}:{}};this.exitInfo=e,this.turnInFlight=!1;const s=[...this.exitListeners];this.exitListeners.clear();for(const n of s)try{n(e)}catch{}}createExitWhileWaitingError(t){const e=t.signal?`signal ${t.signal}`:`code ${t.code??"unknown"}`,s=t.stderrTail?`
|
|
1
|
+
var w=Object.defineProperty;var h=(d,t)=>w(d,"name",{value:t,configurable:!0});import{spawn as m}from"node:child_process";import{attachJsonlLineReader as f,serializeJsonLine as p}from"./jsonl.js";class _ extends Error{static{h(this,"RpcCommandError")}command;code;extensionError;constructor(t){super(t.error),this.name="RpcCommandError",this.command=t.command,t.code!==void 0&&(this.code=t.code),t.extensionError!==void 0&&(this.extensionError=t.extensionError)}}const E=20,u=2e3;function x(d){const e=d.split(/\r?\n/u).filter(s=>s.trim().length>0).slice(-E).join(`
|
|
2
|
+
`);return e.length>u?e.slice(-u):e}h(x,"rpcStderrTail");const v=new Set(["select","confirm","input","editor","requestInput","requestChoice"]);class S{static{h(this,"RpcClient")}process=null;stopReadingStdout=null;eventListeners=[];pendingRequests=new Map;requestId=0;extensionUIHandler=null;approvalHandler=null;hostRequestHandler=null;stderr="";exitError=null;options;exitListeners=new Set;exitInfo;stopping=!1;turnInFlight=!1;constructor(t={}){this.options=t}async start(){if(this.process)throw new Error("Client already started");this.exitError=null,this.exitInfo=void 0,this.stopping=!1,this.turnInFlight=!1;const t=this.options.cliPath??"dist/cli.js",e=["--mode","rpc"];this.options.provider&&e.push("--provider",this.options.provider),this.options.model&&e.push("--model",this.options.model),this.options.args&&e.push(...this.options.args);const s=m(process.execPath,[t,...e],{cwd:this.options.cwd,env:{...this.options.inheritEnv===!1?{}:process.env,...this.options.env},stdio:["pipe","pipe","pipe"],detached:process.platform!=="win32"});if(this.process=s,s.stderr?.on("data",n=>{this.stderr+=n.toString(),process.stderr.write(n)}),s.once("exit",(n,r)=>{if(this.process!==s)return;this.reportExit({code:n,signal:r});const o=this.createProcessExitError(n,r);this.exitError=o,this.rejectPendingRequests(o)}),s.once("error",n=>{if(this.process!==s)return;const r=new Error(`Agent process error: ${n.message}. Stderr: ${this.stderr}`);s.exitCode===null&&s.signalCode===null&&this.reportExit({code:null,signal:null,error:n.message}),this.exitError=r,this.rejectPendingRequests(r)}),s.stdin?.on("error",n=>{if(this.process!==s)return;const r=this.exitError??new Error(`Agent process stdin error: ${n.message}. Stderr: ${this.stderr}`);this.exitError=r,this.rejectPendingRequests(r)}),this.stopReadingStdout=f(s.stdout,n=>{this.handleLine(n)}),await new Promise(n=>setTimeout(n,100)),this.process.exitCode!==null){const n=this.exitError??this.createProcessExitError(this.process.exitCode,this.process.signalCode);throw this.exitError=n,n}}async stop(){if(!this.process)return;this.stopReadingStdout?.(),this.stopReadingStdout=null,this.stopping=!0;const t=this.process,e=h(n=>{try{t.pid!==void 0&&process.platform!=="win32"?process.kill(-t.pid,n):t.kill(n)}catch{t.kill(n)}},"signal"),s=t.exitCode!==null||t.signalCode!==null;s||e("SIGTERM"),await new Promise(n=>{if(s){n();return}const r=setTimeout(()=>{e("SIGKILL"),n()},1e3);t.on("exit",()=>{clearTimeout(r),e("SIGKILL"),n()})}),this.process=null,this.pendingRequests.clear()}onExit(t){const e=this.exitInfo;return e?(queueMicrotask(()=>t(e)),()=>{}):(this.exitListeners.add(t),()=>{this.exitListeners.delete(t)})}getExit(){return this.exitInfo}onEvent(t){return this.eventListeners.push(t),()=>{const e=this.eventListeners.indexOf(t);e!==-1&&this.eventListeners.splice(e,1)}}setExtensionUIHandler(t){this.extensionUIHandler=t}setApprovalHandler(t){this.approvalHandler=t}getStderr(){return this.stderr}async prompt(t,e,s){const n=await this.send({type:"prompt",message:t,images:e,streamingBehavior:s}),{disposition:r}=this.getData(n);return r!=="handled"&&(this.turnInFlight=!0),r}async steer(t,e){const s=await this.send({type:"steer",message:t,images:e});return this.getData(s).disposition}async followUp(t,e){const s=await this.send({type:"follow_up",message:t,images:e});return this.getData(s).disposition}async abort(){await this.send({type:"abort"})}async clearQueue(){const t=await this.send({type:"clear_queue"});return this.getData(t)}async newSession(t){const e=await this.send({type:"new_session",parentSession:t});return this.getData(e)}async getState(){const t=await this.send({type:"get_state"});return this.getData(t)}async setModel(t,e){const s=await this.send({type:"set_model",provider:t,modelId:e});return this.getData(s)}async cycleModel(){const t=await this.send({type:"cycle_model"});return this.getData(t)}async getAvailableModels(){const t=await this.send({type:"get_available_models"});return this.getData(t).models}async setThinkingLevel(t){await this.send({type:"set_thinking_level",level:t})}async cycleThinkingLevel(){const t=await this.send({type:"cycle_thinking_level"});return this.getData(t)}async getAvailableThinkingLevels(){const t=await this.send({type:"get_available_thinking_levels"});return this.getData(t).levels}async setSteeringMode(t){await this.send({type:"set_steering_mode",mode:t})}async setFollowUpMode(t){await this.send({type:"set_follow_up_mode",mode:t})}async compact(t){const e=await this.send({type:"compact",customInstructions:t});return this.getData(e)}async setAutoCompaction(t){await this.send({type:"set_auto_compaction",enabled:t})}async setAutoRetry(t){await this.send({type:"set_auto_retry",enabled:t})}async abortRetry(){await this.send({type:"abort_retry"})}async bash(t){const e=await this.send({type:"bash",command:t});return this.getData(e)}async abortBash(){await this.send({type:"abort_bash"})}async getSandboxStatus(){const t=await this.send({type:"get_sandbox_status"});return this.getData(t)}async listBackgroundProcesses(){const t=await this.send({type:"list_background_processes"});return this.getData(t).processes}async readBackgroundProcess(t,e){const s=await this.send({type:"read_background_process",processId:t,...e!==void 0?{tail:e}:{}});return this.getData(s)}async stopBackgroundProcess(t){const e=await this.send({type:"stop_background_process",processId:t});return this.getData(e).process}async setEnvironment(t){const e=await this.send({type:"set_environment",...t});return this.getData(e).changed}async setTelemetryConsent(t){const e=await this.send({type:"set_telemetry_consent",usage:t.usage,...t.failures!==void 0?{failures:t.failures}:{}});return this.getData(e)}async getPermissionMode(){const t=await this.send({type:"get_permission_mode"});return this.getData(t)}async setPermissionMode(t,e={}){const s=await this.send({type:"set_permission_mode",mode:t,...e.save!==void 0?{save:e.save}:{}});return this.getData(s)}async getSessionStats(){const t=await this.send({type:"get_session_stats"});return this.getData(t)}async exportHtml(t){const e=await this.send({type:"export_html",outputPath:t});return this.getData(e)}async switchSession(t){const e=await this.send({type:"switch_session",sessionPath:t});return this.getData(e)}async fork(t){const e=await this.send({type:"fork",entryId:t});return this.getData(e)}async clone(){const t=await this.send({type:"clone"});return this.getData(t)}async getForkMessages(){const t=await this.send({type:"get_fork_messages"});return this.getData(t).messages}async getEntries(t){const e=await this.send({type:"get_entries",since:t});return this.getData(e)}async getTree(){const t=await this.send({type:"get_tree"});return this.getData(t)}async getLastAssistantText(){const t=await this.send({type:"get_last_assistant_text"});return this.getData(t).text}async setSessionName(t){await this.send({type:"set_session_name",name:t})}async getMessages(){const t=await this.send({type:"get_messages"});return this.getData(t).messages}async getMessagesWithMeta(){const t=await this.send({type:"get_messages"});return this.getData(t)}async respondToApproval(t,e){const s=await this.send({type:"approval_response",optionId:e},t);return this.getData(s)}async getCommands(){const t=await this.send({type:"get_commands"});return this.getData(t).commands}async setHostCapabilities(t,e){this.hostRequestHandler=e;const s=await this.send({type:"set_host_capabilities",capabilities:t});return this.getData(s).capabilities}waitForIdle(t=6e4){return new Promise((e,s)=>{const n=setTimeout(()=>{r(),o(),s(new Error(`Timeout waiting for agent to become idle. Stderr: ${this.stderr}`))},t),r=this.onEvent(i=>{i.type==="agent_settled"&&(clearTimeout(n),r(),o(),e())}),o=this.onExit(i=>{clearTimeout(n),r(),s(this.createExitWhileWaitingError(i))})})}collectEvents(t=6e4){return new Promise((e,s)=>{const n=[],r=setTimeout(()=>{o(),i(),s(new Error(`Timeout collecting events. Stderr: ${this.stderr}`))},t),o=this.onEvent(a=>{n.push(a),a.type==="agent_settled"&&(clearTimeout(r),o(),i(),e(n))}),i=this.onExit(a=>{clearTimeout(r),o(),s(this.createExitWhileWaitingError(a))})})}async promptAndWait(t,e,s=6e4){const n=this.collectEvents(s);return await this.prompt(t,e),n}handleLine(t){try{const e=JSON.parse(t);if(e.type==="agent_start"?this.turnInFlight=!0:e.type==="agent_settled"&&(this.turnInFlight=!1),e.type==="response"&&e.id&&this.pendingRequests.has(e.id)){const s=this.pendingRequests.get(e.id);this.pendingRequests.delete(e.id),s.resolve(e);return}if(e.type==="approval_request"&&this.approvalHandler&&this.answerApprovalRequest(e),e.type==="extension_ui_request"&&v.has(e.method)&&!(e.approval===!0&&this.approvalHandler)&&this.answerExtensionUIRequest(e),e.type==="host_request"){this.answerHostRequest(e);return}for(const s of[...this.eventListeners])s(e)}catch{}}async answerExtensionUIRequest(t){const e={type:"extension_ui_response",id:t.id,cancelled:!0};let s=e;if(this.extensionUIHandler)try{s=await this.extensionUIHandler(t)??e}catch{s=e}const n=this.process?.stdin;if(!(!n||n.destroyed||!n.writable))try{n.write(p({...s,id:t.id}))}catch{}}async answerApprovalRequest(t){let e="deny";try{e=await this.approvalHandler?.(t)??"deny"}catch{e="deny"}try{await this.respondToApproval(t.id,e)}catch{}}async answerHostRequest(t){let e;if(!this.hostRequestHandler)e={type:"host_response",id:t.id,error:"host has no handler for host requests"};else try{const n=await this.hostRequestHandler(t);e={type:"host_response",id:t.id,result:n??null}}catch(n){e={type:"host_response",id:t.id,error:n instanceof Error?n.message:String(n)}}const s=this.process?.stdin;if(!(!s||s.destroyed||!s.writable))try{s.write(p(e))}catch{}}reportExit(t){if(this.exitInfo)return;const e={code:t.code,signal:t.signal,stderrTail:x(this.stderr),expected:this.stopping,turnInFlight:this.turnInFlight,...t.error?{error:t.error}:{}};this.exitInfo=e,this.turnInFlight=!1;const s=[...this.exitListeners];this.exitListeners.clear();for(const n of s)try{n(e)}catch{}}createExitWhileWaitingError(t){const e=t.signal?`signal ${t.signal}`:`code ${t.code??"unknown"}`,s=t.stderrTail?`
|
|
3
3
|
Last stderr output:
|
|
4
|
-
${t.stderrTail}`:"";return new Error(`Agent process exited (${e}) before the turn finished.${s}`)}createProcessExitError(t,e){return new Error(`Agent process exited (code=${t} signal=${e}). Stderr: ${this.stderr}`)}rejectPendingRequests(t){for(const e of this.pendingRequests.values())e.reject(t);this.pendingRequests.clear()}async send(t,e){const s=this.process,n=s?.stdin;if(!s||!n)throw new Error("Client not started");if(this.exitError)throw this.exitError;if(s.exitCode!==null){const i=this.createProcessExitError(s.exitCode,s.signalCode);throw this.exitError=i,i}if(n.destroyed||!n.writable){const i=new Error(`Agent process stdin is not writable. Stderr: ${this.stderr}`);throw this.exitError=i,i}const r=e??`req_${++this.requestId}`,o={...t,id:r};return new Promise((i,a)=>{const l=setTimeout(()=>{this.pendingRequests.delete(r),a(new Error(`Timeout waiting for response to ${t.type}. Stderr: ${this.stderr}`))},this.options.requestTimeoutMs??3e4);this.pendingRequests.set(r,{resolve:h(c=>{clearTimeout(l),i(c)},"resolve"),reject:h(c=>{clearTimeout(l),a(c)},"reject")});try{n.write(
|
|
4
|
+
${t.stderrTail}`:"";return new Error(`Agent process exited (${e}) before the turn finished.${s}`)}createProcessExitError(t,e){return new Error(`Agent process exited (code=${t} signal=${e}). Stderr: ${this.stderr}`)}rejectPendingRequests(t){for(const e of this.pendingRequests.values())e.reject(t);this.pendingRequests.clear()}async send(t,e){const s=this.process,n=s?.stdin;if(!s||!n)throw new Error("Client not started");if(this.exitError)throw this.exitError;if(s.exitCode!==null){const i=this.createProcessExitError(s.exitCode,s.signalCode);throw this.exitError=i,i}if(n.destroyed||!n.writable){const i=new Error(`Agent process stdin is not writable. Stderr: ${this.stderr}`);throw this.exitError=i,i}const r=e??`req_${++this.requestId}`,o={...t,id:r};return new Promise((i,a)=>{const l=setTimeout(()=>{this.pendingRequests.delete(r),a(new Error(`Timeout waiting for response to ${t.type}. Stderr: ${this.stderr}`))},this.options.requestTimeoutMs??3e4);this.pendingRequests.set(r,{resolve:h(c=>{clearTimeout(l),i(c)},"resolve"),reject:h(c=>{clearTimeout(l),a(c)},"reject")});try{n.write(p(o))}catch(c){const g=c instanceof Error?c:new Error(String(c)),y=this.pendingRequests.get(r);this.pendingRequests.delete(r),y?.reject(g)}})}getData(t){if(!t.success)throw new _(t);return t.data}}export{S as RpcClient,_ as RpcCommandError,x as rpcStderrTail};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var z=Object.defineProperty;var i=(u,o)=>z(u,"name",{value:o,configurable:!0});import*as f from"node:crypto";import{resolveExtensionNotify as K}from"../../core/extensions/index.js";import{DEFAULT_HOST_CALL_TIMEOUT_MS as Q,getHostCapabilities as N,HostCallError as k,parseHostCapabilities as V}from"../../core/host-capabilities.js";import{flushRawStdout as X,takeOverStdout as Y,waitForRawStdoutBackpressure as S,writeRawStdout as Z}from"../../core/output-guard.js";import{killTrackedDetachedChildren as ee}from"../../utils/shell.js";import{theme as te}from"../interactive/theme/theme.js";import{toJsonEvent as se}from"../json-event.js";import{openApproval as ne,ResolvedApprovals as oe}from"./approvals.js";import{applyEnvironmentUpdate as re}from"./environment-update.js";import{attachJsonlLineReader as ie,serializeJsonLine as ae}from"./jsonl.js";import{buildMessageMeta as le}from"./message-meta.js";const ce="Prompt aborted before it started";async function we(u){Y();let o=u.session,T,E;const c=i(e=>{Z(ae(e))},"output"),r=i((e,t,s)=>s===void 0?{id:e,type:"response",command:t,success:!0}:{id:e,type:"response",command:t,success:!0,data:s},"success"),d=i((e,t,s)=>({id:e,type:"response",command:t,success:!1,error:s}),"error"),g=new Map,R=new oe,w=new Map,O=i((e,t)=>{const s=f.randomUUID();return new Promise((n,a)=>{const l=i(()=>{clearTimeout(U),t.signal?.removeEventListener("abort",h),w.delete(s)},"cleanup"),p=i(_=>{l(),c({type:"host_request_cancelled",id:s}),a(_)},"giveUp"),h=i(()=>p(new k("aborted","host call aborted")),"onAbort"),U=setTimeout(()=>p(new k("timeout","host did not answer in time")),t.timeoutMs??Q);t.signal?.addEventListener("abort",h,{once:!0}),w.set(s,{resolve:i(_=>{l(),n(_)},"resolve"),reject:i(_=>{l(),a(_)},"reject")});const v={type:"host_request",id:s,capability:e.capability,method:e.method,params:e.params};c(v)})},"rpcHostTransport");let A=!1,P=!1;const L=[];function y(e,t,s,n){if(e?.signal?.aborted)return Promise.resolve(t);const a=f.randomUUID(),l=s.method,p=e?.approval&&(l==="select"||l==="confirm")?ne(a,l,e.approval,{options:Array.isArray(s.options)?s.options:void 0,timeout:e.timeout}):void 0;return new Promise((h,U)=>{let v;const _=i((b,x)=>{if(!p)return;const I=x?p.kindOf(x):void 0,B=b==="dialog"&&!I?"cancelled":b;R.remember(a,I,B);const H={type:"approval_resolved",id:a,...I?{optionId:I}:{},via:B};c(H)},"settleApproval"),M=i(()=>{v&&clearTimeout(v),e?.signal?.removeEventListener("abort",$),g.delete(a)},"cleanup"),$=i(()=>{M(),_("aborted"),h(t)},"onAbort");e?.signal?.addEventListener("abort",$,{once:!0}),e?.timeout&&(v=setTimeout(()=>{M(),_("timeout"),h(t)},e.timeout)),g.set(a,{resolve:i((b,x="dialog")=>{M(),_(x,b),h(n(b))},"resolve"),reject:U,...p?{approval:p}:{}}),p&&c(p.request),c({type:"extension_ui_request",id:a,...s,...p?{approval:!0}:{}})})}i(y,"createDialogPromise");const j=i(()=>({select:i((e,t,s)=>y(s,void 0,{method:"select",title:e,options:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?void 0:"value"in n?n.value:void 0),"select"),confirm:i((e,t,s)=>y(s,!1,{method:"confirm",title:e,message:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?!1:"confirmed"in n?n.confirmed:!1),"confirm"),input:i((e,t,s)=>y(s,void 0,{method:"input",title:e,placeholder:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?void 0:"value"in n?n.value:void 0),"input"),notify(e,t){const s=K(e,t);c({type:"extension_ui_request",id:f.randomUUID(),method:"notify",message:s.message,notifyType:s.type})},setPanel(e,t){c({type:"extension_ui_request",id:f.randomUUID(),method:"setPanel",panelId:e,panel:t})},requestInput:i(e=>y(e,void 0,{method:"requestInput",title:e.title,placeholder:e.placeholder,timeout:e.timeout},t=>"cancelled"in t&&t.cancelled?void 0:"value"in t?t.value:void 0),"requestInput"),requestChoice:i(e=>y(e,void 0,{method:"requestChoice",title:e.title,items:e.items,timeout:e.timeout},t=>"cancelled"in t&&t.cancelled?void 0:"value"in t?t.value:void 0),"requestChoice"),onTerminalInput(){return()=>{}},setStatus(e,t){c({type:"extension_ui_request",id:f.randomUUID(),method:"setStatus",statusKey:e,statusText:t})},setWorkingMessage(e){},setWorkingVisible(e){},setWorkingIndicator(e){},setHiddenThinkingLabel(e){},setWidget(e,t,s){(t===void 0||Array.isArray(t))&&c({type:"extension_ui_request",id:f.randomUUID(),method:"setWidget",widgetKey:e,widgetLines:t,widgetPlacement:s?.placement})},setFooter(e){},setHeader(e){},setTitle(e){c({type:"extension_ui_request",id:f.randomUUID(),method:"setTitle",title:e})},async custom(){},pasteToEditor(e){this.setEditorText(e)},setEditorText(e){c({type:"extension_ui_request",id:f.randomUUID(),method:"set_editor_text",text:e})},getEditorText(){return""},async editor(e,t){const s=f.randomUUID();return new Promise((n,a)=>{g.set(s,{resolve:i(l=>{"cancelled"in l&&l.cancelled?n(void 0):"value"in l?n(l.value):n(void 0)},"resolve"),reject:a}),c({type:"extension_ui_request",id:s,method:"editor",title:e,prefill:t})})},addAutocompleteProvider(){},setEditorComponent(){},getEditorComponent(){},get theme(){return te},getAllThemes(){return[]},getTheme(e){},setTheme(e){return{success:!1,error:"Theme switching not supported in RPC mode"}},getToolsExpanded(){return!1},setToolsExpanded(e){}}),"createExtensionUIContext");u.setRebindSession(async()=>{await m()});const m=i(async()=>{o=u.session,T?.(),E?.(),T=o.subscribe(e=>{c(se(e)),e.type==="agent_settled"&&q()}),E=o.agent.subscribe(async()=>{const e=o.enterStallStage("host:stdout","host");try{await S()}finally{e()}}),await o.bindExtensions({uiContext:j(),mode:"rpc",commandContextActions:{waitForIdle:i(()=>o.waitForIdle(),"waitForIdle"),newSession:i(async e=>u.newSession(e),"newSession"),fork:i(async(e,t)=>({cancelled:(await u.fork(e,t)).cancelled}),"fork"),navigateTree:i(async(e,t)=>({cancelled:(await o.navigateTree(e,{summarize:t?.summarize,customInstructions:t?.customInstructions,replaceInstructions:t?.replaceInstructions,label:t?.label})).cancelled}),"navigateTree"),switchSession:i(async(e,t)=>u.switchSession(e,t),"switchSession"),reload:i(async()=>{await o.reload()},"reload")},shutdownHandler:i(()=>{A=!0},"shutdownHandler"),onError:i(e=>{c({type:"extension_error",extensionPath:e.extensionPath,event:e.event,error:e.error})},"onError")})},"rebindSession"),G=i(()=>{const e=["SIGTERM","SIGINT"];process.platform!=="win32"&&e.push("SIGHUP");for(const t of e){const s=i(()=>{ee(),C(t==="SIGHUP"?129:t==="SIGINT"?130:143,t)},"handler");process.on(t,s),L.push(()=>process.off(t,s))}},"registerSignalHandlers");await m(),G();const J=i(async e=>{const t=e.id;switch(e.type){case"prompt":{let s=!1,n=!1;o.prompt(e.message,{images:e.images,streamingBehavior:e.streamingBehavior,source:"rpc",preflightResult:i(a=>{if(a==="cancelled"){n=!0;return}s=!0,c(r(t,"prompt",{disposition:a}))},"preflightResult")}).then(()=>{n&&!s&&c(d(t,"prompt",ce))},a=>{s||c(d(t,"prompt",a.message))});return}case"steer":{const s=await o.steer(e.message,e.images,{source:"rpc"});return r(t,"steer",{disposition:s})}case"follow_up":{const s=await o.followUp(e.message,e.images,{source:"rpc"});return r(t,"follow_up",{disposition:s})}case"abort":return await o.abort(),r(t,"abort");case"clear_queue":return r(t,"clear_queue",o.clearQueue());case"new_session":{const s=e.parentSession?{parentSession:e.parentSession}:void 0,n=await u.newSession(s);return n.cancelled||await m(),r(t,"new_session",n)}case"get_state":{const s={model:o.model,thinkingLevel:o.thinkingLevel,isStreaming:o.isStreaming,isCompacting:o.isCompacting,steeringMode:o.steeringMode,followUpMode:o.followUpMode,sessionFile:o.sessionFile,sessionId:o.sessionId,sessionName:o.sessionName,autoCompactionEnabled:o.autoCompactionEnabled,messageCount:o.messages.length,pendingMessageCount:o.pendingMessageCount};return r(t,"get_state",s)}case"set_model":{const n=o.modelRuntime.getAvailableSnapshot().find(a=>a.provider===e.provider&&a.id===e.modelId);return n?(await o.setModel(n),r(t,"set_model",n)):d(t,"set_model",`Model not found: ${e.provider}/${e.modelId}`)}case"cycle_model":{const s=await o.cycleModel();return s?r(t,"cycle_model",s):r(t,"cycle_model",null)}case"get_available_models":{const s=o.modelRuntime.getAvailableSnapshot();return r(t,"get_available_models",{models:s})}case"set_thinking_level":return o.setThinkingLevel(e.level),r(t,"set_thinking_level");case"cycle_thinking_level":{const s=o.cycleThinkingLevel();return s?r(t,"cycle_thinking_level",{level:s}):r(t,"cycle_thinking_level",null)}case"get_available_thinking_levels":{const s=o.getAvailableThinkingLevels();return r(t,"get_available_thinking_levels",{levels:s})}case"set_steering_mode":return o.setSteeringMode(e.mode),r(t,"set_steering_mode");case"set_follow_up_mode":return o.setFollowUpMode(e.mode),r(t,"set_follow_up_mode");case"compact":{const s=await o.compact(e.customInstructions);return r(t,"compact",s)}case"set_auto_compaction":return o.setAutoCompactionEnabled(e.enabled),r(t,"set_auto_compaction");case"set_auto_retry":return o.setAutoRetryEnabled(e.enabled),r(t,"set_auto_retry");case"abort_retry":return o.abortRetry(),r(t,"abort_retry");case"bash":{const s=await o.extensionRunner.emitUserBash({type:"user_bash",command:e.command,excludeFromContext:e.excludeFromContext??!1,cwd:o.sessionManager.getCwd()});if(s?.result)return o.recordBashResult(e.command,s.result,{excludeFromContext:e.excludeFromContext}),r(t,"bash",s.result);const n=await o.executeBash(e.command,void 0,{excludeFromContext:e.excludeFromContext,id:t,operations:s?.operations});return r(t,"bash",n)}case"abort_bash":return o.abortBash(),r(t,"abort_bash");case"get_sandbox_status":return r(t,"get_sandbox_status",o.getSandboxStatus()??null);case"list_background_processes":return r(t,"list_background_processes",{processes:o.backgroundProcesses.list()});case"read_background_process":{const{text:s,truncated:n,info:a}=o.backgroundProcesses.read(e.processId,e.tail!==void 0?{tail:e.tail}:{tail:200});return r(t,"read_background_process",{text:s,truncated:n,process:a})}case"stop_background_process":{const s=await o.backgroundProcesses.stop(e.processId);return r(t,"stop_background_process",{process:s})}case"get_session_stats":{const s=o.getSessionStats();return r(t,"get_session_stats",s)}case"export_html":{const s=await o.exportToHtml(e.outputPath);return r(t,"export_html",{path:s})}case"switch_session":{const s=await u.switchSession(e.sessionPath);return s.cancelled||await m(),r(t,"switch_session",s)}case"fork":{const s=await u.fork(e.entryId);return s.cancelled||await m(),r(t,"fork",{text:s.selectedText,cancelled:s.cancelled})}case"clone":{const s=o.sessionManager.getLeafId();if(!s)return d(t,"clone","Cannot clone session: no current entry selected");const n=await u.fork(s,{position:"at"});return n.cancelled||await m(),r(t,"clone",{cancelled:n.cancelled})}case"get_fork_messages":{const s=o.getUserMessagesForForking();return r(t,"get_fork_messages",{messages:s})}case"get_entries":{const s=o.sessionManager;let n=s.getEntries();if(e.since!==void 0){const a=n.findIndex(l=>l.id===e.since);if(a===-1)return d(t,"get_entries",`Entry not found: ${e.since}`);n=n.slice(a+1)}return r(t,"get_entries",{entries:n,leafId:s.getLeafId()})}case"get_tree":{const s=o.sessionManager;return r(t,"get_tree",{tree:s.getTree(),leafId:s.getLeafId()})}case"get_last_assistant_text":{const s=o.getLastAssistantText();return r(t,"get_last_assistant_text",{text:s})}case"set_session_name":{const s=e.name.trim();return s?(o.setSessionName(s),r(t,"set_session_name")):d(t,"set_session_name","Session name cannot be empty")}case"get_messages":{const s=o.messages,n=le(s,o.sessionManager.buildSessionProjection());return r(t,"get_messages",{messages:s,meta:n})}case"get_commands":{const s=[];for(const n of o.extensionRunner.getRegisteredCommands())s.push({name:n.invocationName,description:n.description,source:"extension",sourceInfo:n.sourceInfo});for(const n of o.promptTemplates)s.push({name:n.name,description:n.description,source:"prompt",sourceInfo:n.sourceInfo});for(const n of o.resourceLoader.getSkills().skills)s.push({name:`skill:${n.name}`,description:n.description,source:"skill",sourceInfo:n.sourceInfo});return r(t,"get_commands",{commands:s})}case"set_host_capabilities":{const s=N();return s.set("rpc",V(e.capabilities),O),r(t,"set_host_capabilities",{capabilities:s.list()})}case"set_environment":{const s=re({set:e.set,unset:e.unset});return r(t,"set_environment",{changed:s})}case"set_telemetry_consent":{const{usage:s,failures:n}=e;if(typeof s!="boolean"||n!==void 0&&typeof n!="boolean")return d(t,"set_telemetry_consent","set_telemetry_consent: usage must be a boolean, failures a boolean or omitted");const a=globalThis[Symbol.for("dalcode.telemetry.consentApi")];return a?r(t,"set_telemetry_consent",a.set({usage:s,failures:n})):d(t,"set_telemetry_consent","set_telemetry_consent: telemetry is not loaded in this engine")}case"get_permission_mode":case"set_permission_mode":{const s=globalThis[Symbol.for("dalcode.guard.modeApi")];if(!s)return d(t,e.type,`${e.type}: the permission extension is not loaded in this engine`);if(e.type==="get_permission_mode")return r(t,"get_permission_mode",s.get());const{mode:n,save:a}=e,l=s.set({mode:n,save:a});return"error"in l?d(t,"set_permission_mode",`set_permission_mode: ${l.error}`):r(t,"set_permission_mode",l)}case"approval_response":{const s=g.get(e.id);if(s?.approval){const a=s.approval.request.options.find(l=>l.id===e.optionId);return a?(s.resolve(s.approval.responseFor(a.kind),"approval_response"),r(t,"approval_response",{accepted:!0,optionId:a.kind,via:"approval_response"})):d(t,"approval_response",`Unknown option ${String(e.optionId)} for approval ${e.id}; expected one of ${s.approval.request.options.map(l=>l.id).join(", ")}`)}const n=R.get(e.id);return n?r(t,"approval_response",{accepted:!1,...n}):d(t,"approval_response",`Unknown approval: ${e.id}`)}default:{const s=e;return d(t,s.type,`Unknown command: ${s.type}`)}}},"handleCommand");let F=i(()=>{},"detachInput");async function C(e=0,t){P&&process.exit(e),P=!0;for(const s of L)s();T?.(),E?.(),N().clear("rpc");for(const s of w.values())s.reject(new k("unavailable","RPC host disconnected"));await u.dispose(),F(),process.stdin.pause(),t!=="SIGTERM"&&await X(),process.exit(e)}i(C,"shutdown");async function q(){A&&await C()}i(q,"checkShutdownRequested");const W=i(async e=>{let t;try{t=JSON.parse(e)}catch(n){c(d(void 0,"parse",`Failed to parse command: ${n instanceof Error?n.message:String(n)}`)),await S();return}if(typeof t=="object"&&t!==null&&"type"in t&&t.type==="extension_ui_response"){const n=t,a=g.get(n.id);a&&(g.delete(n.id),a.resolve(n));return}if(typeof t=="object"&&t!==null&&"type"in t&&t.type==="host_response"){const n=t,a=w.get(n.id);a&&("error"in n?a.reject(new k("host_error",String(n.error))):a.resolve(n.result));return}const s=t;try{const n=await J(s);n&&(c(n),await S()),await q()}catch(n){c(d(s.id,s.type,n instanceof Error?n.message:String(n))),await S()}},"handleInputLine"),D=i(()=>{C()},"onInputEnd");return process.stdin.on("end",D),F=(()=>{const e=ie(process.stdin,t=>{W(t)});return()=>{e(),process.stdin.off("end",D)}})(),new Promise(()=>{})}i(we,"runRpcMode");export{ce as PROMPT_ABORTED_BEFORE_START,we as runRpcMode};
|
|
1
|
+
var z=Object.defineProperty;var a=(u,o)=>z(u,"name",{value:o,configurable:!0});import*as f from"node:crypto";import{RequiredExtensionError as K,resolveExtensionNotify as Q}from"../../core/extensions/index.js";import{DEFAULT_HOST_CALL_TIMEOUT_MS as V,getHostCapabilities as N,HostCallError as k,parseHostCapabilities as X}from"../../core/host-capabilities.js";import{flushRawStdout as Y,takeOverStdout as Z,waitForRawStdoutBackpressure as S,writeRawStdout as ee}from"../../core/output-guard.js";import{killTrackedDetachedChildren as te}from"../../utils/shell.js";import{theme as se}from"../interactive/theme/theme.js";import{toJsonEvent as ne}from"../json-event.js";import{openApproval as oe,ResolvedApprovals as re}from"./approvals.js";import{applyEnvironmentUpdate as ie}from"./environment-update.js";import{attachJsonlLineReader as ae,serializeJsonLine as le}from"./jsonl.js";import{buildMessageMeta as ce}from"./message-meta.js";const de="Prompt aborted before it started";async function xe(u){Z();let o=u.session,T,E;const c=a(e=>{ee(le(e))},"output"),r=a((e,t,s)=>s===void 0?{id:e,type:"response",command:t,success:!0}:{id:e,type:"response",command:t,success:!0,data:s},"success"),d=a((e,t,s,n)=>n instanceof K?{id:e,type:"response",command:t,success:!1,error:s,code:n.code,extensionError:{extensionPath:n.extensionError.extensionPath,event:n.extensionError.event,error:n.extensionError.error}}:{id:e,type:"response",command:t,success:!1,error:s},"error"),g=new Map,R=new re,w=new Map,O=a((e,t)=>{const s=f.randomUUID();return new Promise((n,i)=>{const l=a(()=>{clearTimeout(U),t.signal?.removeEventListener("abort",h),w.delete(s)},"cleanup"),p=a(_=>{l(),c({type:"host_request_cancelled",id:s}),i(_)},"giveUp"),h=a(()=>p(new k("aborted","host call aborted")),"onAbort"),U=setTimeout(()=>p(new k("timeout","host did not answer in time")),t.timeoutMs??V);t.signal?.addEventListener("abort",h,{once:!0}),w.set(s,{resolve:a(_=>{l(),n(_)},"resolve"),reject:a(_=>{l(),i(_)},"reject")});const y={type:"host_request",id:s,capability:e.capability,method:e.method,params:e.params};c(y)})},"rpcHostTransport");let P=!1,A=!1;const L=[];function v(e,t,s,n){if(e?.signal?.aborted)return Promise.resolve(t);const i=f.randomUUID(),l=s.method,p=e?.approval&&(l==="select"||l==="confirm")?oe(i,l,e.approval,{options:Array.isArray(s.options)?s.options:void 0,timeout:e.timeout}):void 0;return new Promise((h,U)=>{let y;const _=a((b,x)=>{if(!p)return;const I=x?p.kindOf(x):void 0,B=b==="dialog"&&!I?"cancelled":b;R.remember(i,I,B);const H={type:"approval_resolved",id:i,...I?{optionId:I}:{},via:B};c(H)},"settleApproval"),M=a(()=>{y&&clearTimeout(y),e?.signal?.removeEventListener("abort",$),g.delete(i)},"cleanup"),$=a(()=>{M(),_("aborted"),h(t)},"onAbort");e?.signal?.addEventListener("abort",$,{once:!0}),e?.timeout&&(y=setTimeout(()=>{M(),_("timeout"),h(t)},e.timeout)),g.set(i,{resolve:a((b,x="dialog")=>{M(),_(x,b),h(n(b))},"resolve"),reject:U,...p?{approval:p}:{}}),p&&c(p.request),c({type:"extension_ui_request",id:i,...s,...p?{approval:!0}:{}})})}a(v,"createDialogPromise");const j=a(()=>({select:a((e,t,s)=>v(s,void 0,{method:"select",title:e,options:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?void 0:"value"in n?n.value:void 0),"select"),confirm:a((e,t,s)=>v(s,!1,{method:"confirm",title:e,message:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?!1:"confirmed"in n?n.confirmed:!1),"confirm"),input:a((e,t,s)=>v(s,void 0,{method:"input",title:e,placeholder:t,timeout:s?.timeout},n=>"cancelled"in n&&n.cancelled?void 0:"value"in n?n.value:void 0),"input"),notify(e,t){const s=Q(e,t);c({type:"extension_ui_request",id:f.randomUUID(),method:"notify",message:s.message,notifyType:s.type})},setPanel(e,t){c({type:"extension_ui_request",id:f.randomUUID(),method:"setPanel",panelId:e,panel:t})},requestInput:a(e=>v(e,void 0,{method:"requestInput",title:e.title,placeholder:e.placeholder,timeout:e.timeout},t=>"cancelled"in t&&t.cancelled?void 0:"value"in t?t.value:void 0),"requestInput"),requestChoice:a(e=>v(e,void 0,{method:"requestChoice",title:e.title,items:e.items,timeout:e.timeout},t=>"cancelled"in t&&t.cancelled?void 0:"value"in t?t.value:void 0),"requestChoice"),onTerminalInput(){return()=>{}},setStatus(e,t){c({type:"extension_ui_request",id:f.randomUUID(),method:"setStatus",statusKey:e,statusText:t})},setWorkingMessage(e){},setWorkingVisible(e){},setWorkingIndicator(e){},setHiddenThinkingLabel(e){},setWidget(e,t,s){(t===void 0||Array.isArray(t))&&c({type:"extension_ui_request",id:f.randomUUID(),method:"setWidget",widgetKey:e,widgetLines:t,widgetPlacement:s?.placement})},setFooter(e){},setHeader(e){},setTitle(e){c({type:"extension_ui_request",id:f.randomUUID(),method:"setTitle",title:e})},async custom(){},pasteToEditor(e){this.setEditorText(e)},setEditorText(e){c({type:"extension_ui_request",id:f.randomUUID(),method:"set_editor_text",text:e})},getEditorText(){return""},async editor(e,t){const s=f.randomUUID();return new Promise((n,i)=>{g.set(s,{resolve:a(l=>{"cancelled"in l&&l.cancelled?n(void 0):"value"in l?n(l.value):n(void 0)},"resolve"),reject:i}),c({type:"extension_ui_request",id:s,method:"editor",title:e,prefill:t})})},addAutocompleteProvider(){},setEditorComponent(){},getEditorComponent(){},get theme(){return se},getAllThemes(){return[]},getTheme(e){},setTheme(e){return{success:!1,error:"Theme switching not supported in RPC mode"}},getToolsExpanded(){return!1},setToolsExpanded(e){}}),"createExtensionUIContext");u.setRebindSession(async()=>{await m()});const m=a(async()=>{o=u.session,T?.(),E?.(),T=o.subscribe(e=>{c(ne(e)),e.type==="agent_settled"&&F()}),E=o.agent.subscribe(async()=>{const e=o.enterStallStage("host:stdout","host");try{await S()}finally{e()}}),await o.bindExtensions({uiContext:j(),mode:"rpc",commandContextActions:{waitForIdle:a(()=>o.waitForIdle(),"waitForIdle"),newSession:a(async e=>u.newSession(e),"newSession"),fork:a(async(e,t)=>({cancelled:(await u.fork(e,t)).cancelled}),"fork"),navigateTree:a(async(e,t)=>({cancelled:(await o.navigateTree(e,{summarize:t?.summarize,customInstructions:t?.customInstructions,replaceInstructions:t?.replaceInstructions,label:t?.label})).cancelled}),"navigateTree"),switchSession:a(async(e,t)=>u.switchSession(e,t),"switchSession"),reload:a(async()=>{await o.reload()},"reload")},shutdownHandler:a(()=>{P=!0},"shutdownHandler"),onError:a(e=>{const t={type:"extension_error",extensionPath:e.extensionPath,event:e.event,error:e.error};e.fatal&&(t.fatal=!0),c(t)},"onError")})},"rebindSession"),G=a(()=>{const e=["SIGTERM","SIGINT"];process.platform!=="win32"&&e.push("SIGHUP");for(const t of e){const s=a(()=>{te(),C(t==="SIGHUP"?129:t==="SIGINT"?130:143,t)},"handler");process.on(t,s),L.push(()=>process.off(t,s))}},"registerSignalHandlers");await m(),G();const J=a(async e=>{const t=e.id;switch(e.type){case"prompt":{let s=!1,n=!1;o.prompt(e.message,{images:e.images,streamingBehavior:e.streamingBehavior,source:"rpc",preflightResult:a(i=>{if(i==="cancelled"){n=!0;return}s=!0,c(r(t,"prompt",{disposition:i}))},"preflightResult")}).then(()=>{n&&!s&&c(d(t,"prompt",de))},i=>{s||c(d(t,"prompt",i.message,i))});return}case"steer":{const s=await o.steer(e.message,e.images,{source:"rpc"});return r(t,"steer",{disposition:s})}case"follow_up":{const s=await o.followUp(e.message,e.images,{source:"rpc"});return r(t,"follow_up",{disposition:s})}case"abort":return await o.abort(),r(t,"abort");case"clear_queue":return r(t,"clear_queue",o.clearQueue());case"new_session":{const s=e.parentSession?{parentSession:e.parentSession}:void 0,n=await u.newSession(s);return n.cancelled||await m(),r(t,"new_session",n)}case"get_state":{const s={model:o.model,thinkingLevel:o.thinkingLevel,isStreaming:o.isStreaming,isCompacting:o.isCompacting,steeringMode:o.steeringMode,followUpMode:o.followUpMode,sessionFile:o.sessionFile,sessionId:o.sessionId,sessionName:o.sessionName,autoCompactionEnabled:o.autoCompactionEnabled,messageCount:o.messages.length,pendingMessageCount:o.pendingMessageCount};return r(t,"get_state",s)}case"set_model":{const n=o.modelRuntime.getAvailableSnapshot().find(i=>i.provider===e.provider&&i.id===e.modelId);return n?(await o.setModel(n),r(t,"set_model",n)):d(t,"set_model",`Model not found: ${e.provider}/${e.modelId}`)}case"cycle_model":{const s=await o.cycleModel();return s?r(t,"cycle_model",s):r(t,"cycle_model",null)}case"get_available_models":{const s=o.modelRuntime.getAvailableSnapshot();return r(t,"get_available_models",{models:s})}case"set_thinking_level":return o.setThinkingLevel(e.level),r(t,"set_thinking_level");case"cycle_thinking_level":{const s=o.cycleThinkingLevel();return s?r(t,"cycle_thinking_level",{level:s}):r(t,"cycle_thinking_level",null)}case"get_available_thinking_levels":{const s=o.getAvailableThinkingLevels();return r(t,"get_available_thinking_levels",{levels:s})}case"set_steering_mode":return o.setSteeringMode(e.mode),r(t,"set_steering_mode");case"set_follow_up_mode":return o.setFollowUpMode(e.mode),r(t,"set_follow_up_mode");case"compact":{const s=await o.compact(e.customInstructions);return r(t,"compact",s)}case"set_auto_compaction":return o.setAutoCompactionEnabled(e.enabled),r(t,"set_auto_compaction");case"set_auto_retry":return o.setAutoRetryEnabled(e.enabled),r(t,"set_auto_retry");case"abort_retry":return o.abortRetry(),r(t,"abort_retry");case"bash":{const s=await o.extensionRunner.emitUserBash({type:"user_bash",command:e.command,excludeFromContext:e.excludeFromContext??!1,cwd:o.sessionManager.getCwd()});if(s?.result)return o.recordBashResult(e.command,s.result,{excludeFromContext:e.excludeFromContext}),r(t,"bash",s.result);const n=await o.executeBash(e.command,void 0,{excludeFromContext:e.excludeFromContext,id:t,operations:s?.operations});return r(t,"bash",n)}case"abort_bash":return o.abortBash(),r(t,"abort_bash");case"get_sandbox_status":return r(t,"get_sandbox_status",o.getSandboxStatus()??null);case"list_background_processes":return r(t,"list_background_processes",{processes:o.backgroundProcesses.list()});case"read_background_process":{const{text:s,truncated:n,info:i}=o.backgroundProcesses.read(e.processId,e.tail!==void 0?{tail:e.tail}:{tail:200});return r(t,"read_background_process",{text:s,truncated:n,process:i})}case"stop_background_process":{const s=await o.backgroundProcesses.stop(e.processId);return r(t,"stop_background_process",{process:s})}case"get_session_stats":{const s=o.getSessionStats();return r(t,"get_session_stats",s)}case"export_html":{const s=await o.exportToHtml(e.outputPath);return r(t,"export_html",{path:s})}case"switch_session":{const s=await u.switchSession(e.sessionPath);return s.cancelled||await m(),r(t,"switch_session",s)}case"fork":{const s=await u.fork(e.entryId);return s.cancelled||await m(),r(t,"fork",{text:s.selectedText,cancelled:s.cancelled})}case"clone":{const s=o.sessionManager.getLeafId();if(!s)return d(t,"clone","Cannot clone session: no current entry selected");const n=await u.fork(s,{position:"at"});return n.cancelled||await m(),r(t,"clone",{cancelled:n.cancelled})}case"get_fork_messages":{const s=o.getUserMessagesForForking();return r(t,"get_fork_messages",{messages:s})}case"get_entries":{const s=o.sessionManager;let n=s.getEntries();if(e.since!==void 0){const i=n.findIndex(l=>l.id===e.since);if(i===-1)return d(t,"get_entries",`Entry not found: ${e.since}`);n=n.slice(i+1)}return r(t,"get_entries",{entries:n,leafId:s.getLeafId()})}case"get_tree":{const s=o.sessionManager;return r(t,"get_tree",{tree:s.getTree(),leafId:s.getLeafId()})}case"get_last_assistant_text":{const s=o.getLastAssistantText();return r(t,"get_last_assistant_text",{text:s})}case"set_session_name":{const s=e.name.trim();return s?(o.setSessionName(s),r(t,"set_session_name")):d(t,"set_session_name","Session name cannot be empty")}case"get_messages":{const s=o.messages,n=ce(s,o.sessionManager.buildSessionProjection());return r(t,"get_messages",{messages:s,meta:n})}case"get_commands":{const s=[];for(const n of o.extensionRunner.getRegisteredCommands())s.push({name:n.invocationName,description:n.description,source:"extension",sourceInfo:n.sourceInfo});for(const n of o.promptTemplates)s.push({name:n.name,description:n.description,source:"prompt",sourceInfo:n.sourceInfo});for(const n of o.resourceLoader.getSkills().skills)s.push({name:`skill:${n.name}`,description:n.description,source:"skill",sourceInfo:n.sourceInfo});return r(t,"get_commands",{commands:s})}case"set_host_capabilities":{const s=N();return s.set("rpc",X(e.capabilities),O),r(t,"set_host_capabilities",{capabilities:s.list()})}case"set_environment":{const s=ie({set:e.set,unset:e.unset});return r(t,"set_environment",{changed:s})}case"set_telemetry_consent":{const{usage:s,failures:n}=e;if(typeof s!="boolean"||n!==void 0&&typeof n!="boolean")return d(t,"set_telemetry_consent","set_telemetry_consent: usage must be a boolean, failures a boolean or omitted");const i=globalThis[Symbol.for("dalcode.telemetry.consentApi")];return i?r(t,"set_telemetry_consent",i.set({usage:s,failures:n})):d(t,"set_telemetry_consent","set_telemetry_consent: telemetry is not loaded in this engine")}case"get_permission_mode":case"set_permission_mode":{const s=globalThis[Symbol.for("dalcode.guard.modeApi")];if(!s)return d(t,e.type,`${e.type}: the permission extension is not loaded in this engine`);if(e.type==="get_permission_mode")return r(t,"get_permission_mode",s.get());const{mode:n,save:i}=e,l=s.set({mode:n,save:i});return"error"in l?d(t,"set_permission_mode",`set_permission_mode: ${l.error}`):r(t,"set_permission_mode",l)}case"approval_response":{const s=g.get(e.id);if(s?.approval){const i=s.approval.request.options.find(l=>l.id===e.optionId);return i?(s.resolve(s.approval.responseFor(i.kind),"approval_response"),r(t,"approval_response",{accepted:!0,optionId:i.kind,via:"approval_response"})):d(t,"approval_response",`Unknown option ${String(e.optionId)} for approval ${e.id}; expected one of ${s.approval.request.options.map(l=>l.id).join(", ")}`)}const n=R.get(e.id);return n?r(t,"approval_response",{accepted:!1,...n}):d(t,"approval_response",`Unknown approval: ${e.id}`)}default:{const s=e;return d(t,s.type,`Unknown command: ${s.type}`)}}},"handleCommand");let q=a(()=>{},"detachInput");async function C(e=0,t){A&&process.exit(e),A=!0;for(const s of L)s();T?.(),E?.(),N().clear("rpc");for(const s of w.values())s.reject(new k("unavailable","RPC host disconnected"));await u.dispose(),q(),process.stdin.pause(),t!=="SIGTERM"&&await Y(),process.exit(e)}a(C,"shutdown");async function F(){P&&await C()}a(F,"checkShutdownRequested");const W=a(async e=>{let t;try{t=JSON.parse(e)}catch(n){c(d(void 0,"parse",`Failed to parse command: ${n instanceof Error?n.message:String(n)}`)),await S();return}if(typeof t=="object"&&t!==null&&"type"in t&&t.type==="extension_ui_response"){const n=t,i=g.get(n.id);i&&(g.delete(n.id),i.resolve(n));return}if(typeof t=="object"&&t!==null&&"type"in t&&t.type==="host_response"){const n=t,i=w.get(n.id);i&&("error"in n?i.reject(new k("host_error",String(n.error))):i.resolve(n.result));return}const s=t;try{const n=await J(s);n&&(c(n),await S()),await F()}catch(n){c(d(s.id,s.type,n instanceof Error?n.message:String(n),n)),await S()}},"handleInputLine"),D=a(()=>{C()},"onInputEnd");return process.stdin.on("end",D),q=(()=>{const e=ae(process.stdin,t=>{W(t)});return()=>{e(),process.stdin.off("end",D)}})(),new Promise(()=>{})}a(xe,"runRpcMode");export{de as PROMPT_ABORTED_BEFORE_START,xe as runRpcMode};
|
|
@@ -522,7 +522,21 @@ export type RpcResponse = {
|
|
|
522
522
|
command: string;
|
|
523
523
|
success: false;
|
|
524
524
|
error: string;
|
|
525
|
+
code?: RpcErrorCode;
|
|
526
|
+
extensionError?: {
|
|
527
|
+
extensionPath: string;
|
|
528
|
+
event: string;
|
|
529
|
+
error: string;
|
|
530
|
+
};
|
|
525
531
|
};
|
|
532
|
+
export type RpcErrorCode = "required_extension_failed";
|
|
533
|
+
export interface RpcExtensionErrorEvent {
|
|
534
|
+
type: "extension_error";
|
|
535
|
+
extensionPath: string;
|
|
536
|
+
event: string;
|
|
537
|
+
error: string;
|
|
538
|
+
fatal?: true;
|
|
539
|
+
}
|
|
526
540
|
export type RpcExtensionUIRequest = {
|
|
527
541
|
type: "extension_ui_request";
|
|
528
542
|
id: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-advisor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "advisor: the model asks another strong model to review its current plan and point out risks. Adapted from @juicesharp/rpiv-advisor 2.13.8 (MIT).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
24
|
-
"@dalcode/dal-router": "1.0.
|
|
23
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
24
|
+
"@dalcode/dal-router": "1.0.47",
|
|
25
25
|
"typebox": "1.3.27"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-awake",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Keeps the computer from going to sleep while a long agent run is in progress, and lets it sleep again when the run ends. Adapted from @narumitw/pi-caffeinate (MIT).",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.47"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-bridge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
22
22
|
"typebox": "1.3.7"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-capabilities",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Capability center for DAL: switches on the reviewed MCP connectors, skills and engine packages a task needs (installed automatically from the signed DAL market), with /capabilities to list, disable and enable them.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@dalcode/dal-mcp": "1.0.
|
|
27
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
28
|
-
"@dalcode/deepailab": "1.0.
|
|
26
|
+
"@dalcode/dal-mcp": "1.0.47",
|
|
27
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
28
|
+
"@dalcode/deepailab": "1.0.47"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-codeindex",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Code index: a persistent local symbol and reference index (tree-sitter WebAssembly grammars) the model queries to find definitions, callers, file outlines and related files without repeated grep.",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
22
22
|
"@vscode/tree-sitter-wasm": "0.3.1",
|
|
23
23
|
"ignore": "7.0.8",
|
|
24
24
|
"typebox": "1.3.27"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-compat",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Claude Code compatibility: the user's and project's .claude/rules/ and .claude/CLAUDE.md apply in DAL. Grown from the claude-rules extension example.",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
22
22
|
"minimatch": "10.2.6"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-dap",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Debugger for DAL: breakpoints, stepping, call stacks and variables in Node.js and Python programs over the Debug Adapter Protocol, installing the adapter on first use. The DAP client is adapted from oh-my-pi's src/dap (MIT).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
27
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
28
28
|
"typebox": "1.3.27"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-gateway",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dalcode/deepailab": "1.0.
|
|
20
|
+
"@dalcode/deepailab": "1.0.47"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-goal",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Goal mode for DAL: /goal keeps the agent working on one objective until it is verified complete, with token and continuation limits. Adapted from @narumitw/pi-goal 0.54.11 (MIT, narumiruna); the independent completion check adapts pi-goal-x 0.32.3 (MIT, Lucas).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
25
|
-
"@dalcode/dal-subagent": "1.0.
|
|
24
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
25
|
+
"@dalcode/dal-subagent": "1.0.47",
|
|
26
26
|
"typebox": "1.3.27"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-guard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
25
|
-
"@dalcode/dal-bridge": "1.0.
|
|
26
|
-
"@dalcode/dal-halo": "1.0.
|
|
24
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
25
|
+
"@dalcode/dal-bridge": "1.0.47",
|
|
26
|
+
"@dalcode/dal-halo": "1.0.47"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-interactive",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Terminal-UI conveniences adopted from pi's example extensions: the questionnaire tool (the model asks you questions), /handoff (carry context into a new session) and interactive ! commands (vim, git rebase -i, htop). Active only in the TUI; stands down under DAL Code.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
23
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
24
24
|
"typebox": "1.3.7"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-lang",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
-
"@dalcode/dal-bridge": "1.0.
|
|
20
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
21
|
+
"@dalcode/dal-bridge": "1.0.47"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-learn",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Self-evolution for DAL: lessons learned from earlier sessions (project and personal), a project map of verified commands and locations, effect tracking, and skill proposals for recurring procedures (/lessons).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
30
|
+
"@dalcode/dal-pi-kit": "1.0.47"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@earendil-works/pi-coding-agent": "^1.0.9"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-lsp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dalcode/dal-bridge": "1.0.
|
|
25
|
-
"@dalcode/dal-dap": "1.0.
|
|
26
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
24
|
+
"@dalcode/dal-bridge": "1.0.47",
|
|
25
|
+
"@dalcode/dal-dap": "1.0.47",
|
|
26
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
27
27
|
"cross-spawn": "7.0.6",
|
|
28
28
|
"typebox": "1.3.7",
|
|
29
29
|
"typescript": "5.9.3",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@dalcode/dal-bridge": "1.0.
|
|
33
|
-
"@dalcode/dal-guard": "1.0.
|
|
34
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
35
|
-
"@dalcode/deepailab": "1.0.
|
|
36
|
-
"@earendil-works/pi-mcp": "1.0.
|
|
32
|
+
"@dalcode/dal-bridge": "1.0.47",
|
|
33
|
+
"@dalcode/dal-guard": "1.0.47",
|
|
34
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
35
|
+
"@dalcode/deepailab": "1.0.47",
|
|
36
|
+
"@earendil-works/pi-mcp": "1.0.47",
|
|
37
37
|
"cross-spawn": "7.0.6"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dalcode/dal-office",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dalcode/dal-pi-kit": "1.0.
|
|
21
|
+
"@dalcode/dal-pi-kit": "1.0.47",
|
|
22
22
|
"docx": "9.7.1",
|
|
23
23
|
"echarts": "6.1.0",
|
|
24
24
|
"exceljs": "4.4.0",
|