@bastani/atomic 0.9.4 → 0.9.5-alpha.10
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 +136 -2
- package/README.md +2 -2
- package/dist/builtin/cursor/CHANGELOG.md +6 -0
- package/dist/builtin/cursor/package.json +3 -3
- package/dist/builtin/cursor/src/model-mapper.ts +6 -3
- package/dist/builtin/intercom/CHANGELOG.md +31 -0
- package/dist/builtin/intercom/README.md +29 -21
- package/dist/builtin/intercom/broker/broker.ts +9 -120
- package/dist/builtin/intercom/broker/client.ts +29 -54
- package/dist/builtin/intercom/broker/delivered-message-cache.ts +44 -0
- package/dist/builtin/intercom/broker/paths.ts +42 -5
- package/dist/builtin/intercom/broker/pending-send-registry.ts +142 -0
- package/dist/builtin/intercom/broker/send-handler.ts +106 -0
- package/dist/builtin/intercom/broker/send-signature.ts +37 -0
- package/dist/builtin/intercom/broker/spawn.ts +78 -10
- package/dist/builtin/intercom/config.ts +6 -3
- package/dist/builtin/intercom/contact-supervisor-tool.ts +6 -4
- package/dist/builtin/intercom/foreground-detach-handoff.ts +136 -0
- package/dist/builtin/intercom/index-heavy.ts +50 -54
- package/dist/builtin/intercom/index.ts +320 -272
- package/dist/builtin/intercom/intercom-tool.ts +9 -3
- package/dist/builtin/intercom/lazy-heavy-proxy.ts +114 -0
- package/dist/builtin/intercom/lazy-subagent-ack.ts +20 -0
- package/dist/builtin/intercom/lazy-tool-execution.ts +39 -0
- package/dist/builtin/intercom/lifecycle-lease.ts +51 -0
- package/dist/builtin/intercom/lifecycle.ts +37 -20
- package/dist/builtin/intercom/package.json +12 -6
- package/dist/builtin/intercom/reply-routing.ts +17 -0
- package/dist/builtin/intercom/result-renderers.ts +1 -1
- package/dist/builtin/intercom/subagent-relay.ts +58 -12
- package/dist/builtin/intercom/types.ts +3 -3
- package/dist/builtin/intercom/ui/compose.ts +2 -2
- package/dist/builtin/intercom/ui/inline-message.ts +2 -2
- package/dist/builtin/intercom/ui/session-list.ts +2 -2
- package/dist/builtin/mcp/CHANGELOG.md +23 -0
- package/dist/builtin/mcp/OAUTH.md +1 -0
- package/dist/builtin/mcp/README.md +10 -6
- package/dist/builtin/mcp/apps-cancellation.ts +32 -0
- package/dist/builtin/mcp/call-tool-result.ts +9 -0
- package/dist/builtin/mcp/caller-wait.ts +50 -0
- package/dist/builtin/mcp/command-registration.ts +82 -0
- package/dist/builtin/mcp/direct-tool-executor.ts +279 -0
- package/dist/builtin/mcp/direct-tools.ts +40 -255
- package/dist/builtin/mcp/host-html-template.ts +4 -2
- package/dist/builtin/mcp/index.ts +274 -239
- package/dist/builtin/mcp/init.ts +96 -126
- package/dist/builtin/mcp/mcp-auth-flow.ts +247 -237
- package/dist/builtin/mcp/mcp-callback-server.ts +89 -68
- package/dist/builtin/mcp/mcp-oauth-provider.ts +23 -1
- package/dist/builtin/mcp/metadata-hydration.ts +52 -0
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/mcp/proxy-auth.ts +4 -4
- package/dist/builtin/mcp/proxy-call.ts +111 -40
- package/dist/builtin/mcp/proxy-connect.ts +35 -15
- package/dist/builtin/mcp/proxy-info-modes.ts +106 -23
- package/dist/builtin/mcp/proxy-modes.ts +3 -3
- package/dist/builtin/mcp/session-cleanup-barrier.ts +43 -0
- package/dist/builtin/mcp/startup-warmup.ts +98 -0
- package/dist/builtin/mcp/state-lease.ts +12 -0
- package/dist/builtin/mcp/tool-result-renderer.ts +3 -3
- package/dist/builtin/mcp/ui-server.ts +8 -8
- package/dist/builtin/mcp/ui-session.ts +9 -18
- package/dist/builtin/subagents/CHANGELOG.md +60 -0
- package/dist/builtin/subagents/README.md +30 -29
- package/dist/builtin/subagents/agents/code-simplifier.md +2 -2
- package/dist/builtin/subagents/agents/codebase-analyzer.md +2 -2
- package/dist/builtin/subagents/agents/codebase-locator.md +2 -2
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +2 -2
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +2 -2
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +2 -2
- package/dist/builtin/subagents/agents/codebase-research-locator.md +2 -2
- package/dist/builtin/subagents/agents/debugger.md +2 -2
- package/dist/builtin/subagents/agents/worker.md +2 -2
- package/dist/builtin/subagents/package.json +5 -5
- package/dist/builtin/subagents/prompts/review-loop.md +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +37 -36
- package/dist/builtin/subagents/src/extension/api-lifecycle.ts +64 -0
- package/dist/builtin/subagents/src/extension/fanout-child.ts +44 -51
- package/dist/builtin/subagents/src/extension/index.ts +289 -320
- package/dist/builtin/subagents/src/extension/prompt-guidance.ts +7 -10
- package/dist/builtin/subagents/src/extension/schemas.ts +22 -5
- package/dist/builtin/subagents/src/extension/startup-maintenance.ts +89 -0
- package/dist/builtin/subagents/src/extension/tool-description.ts +29 -0
- package/dist/builtin/subagents/src/intercom/intercom-bridge.ts +13 -2
- package/dist/builtin/subagents/src/intercom/result-intercom.ts +4 -4
- package/dist/builtin/subagents/src/runs/background/async-event-journal.ts +106 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-common.ts +26 -20
- package/dist/builtin/subagents/src/runs/background/async-execution-single.ts +13 -2
- package/dist/builtin/subagents/src/runs/background/async-execution-types.ts +3 -0
- package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +1 -1
- package/dist/builtin/subagents/src/runs/background/completion-claims.ts +189 -0
- package/dist/builtin/subagents/src/runs/background/completion-dedupe.ts +44 -7
- package/dist/builtin/subagents/src/runs/background/completion-notification.ts +34 -0
- package/dist/builtin/subagents/src/runs/background/notify.ts +72 -22
- package/dist/builtin/subagents/src/runs/background/result-delivery-processor.ts +232 -0
- package/dist/builtin/subagents/src/runs/background/result-file-claims.ts +151 -0
- package/dist/builtin/subagents/src/runs/background/result-quarantine.ts +72 -0
- package/dist/builtin/subagents/src/runs/background/result-retry-scheduler.ts +48 -0
- package/dist/builtin/subagents/src/runs/background/result-status.ts +81 -0
- package/dist/builtin/subagents/src/runs/background/result-watcher-data.ts +59 -0
- package/dist/builtin/subagents/src/runs/background/result-watcher.ts +177 -233
- package/dist/builtin/subagents/src/runs/background/run-id-resolver.ts +3 -2
- package/dist/builtin/subagents/src/runs/background/stale-run-reconciler.ts +73 -14
- package/dist/builtin/subagents/src/runs/background/subagent-runner-streaming.ts +29 -15
- package/dist/builtin/subagents/src/runs/background/top-level-async.ts +1 -2
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-dynamic-step.ts +1 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +1 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-step.ts +1 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-sequential-step.ts +7 -9
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-types.ts +3 -13
- package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +2 -15
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt-finalize.ts +2 -2
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt.ts +63 -46
- package/dist/builtin/subagents/src/runs/foreground/execution-detach-reservations.ts +48 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-detach-route.ts +17 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-run-sync.ts +39 -26
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +3 -1
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-chain.ts +3 -51
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +6 -11
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-input.ts +11 -2
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +5 -112
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-resume.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +68 -118
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +79 -7
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +2 -2
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +3 -0
- package/dist/builtin/subagents/src/runs/shared/pi-args.ts +2 -2
- package/dist/builtin/subagents/src/runs/shared/pi-spawn.ts +55 -12
- package/dist/builtin/subagents/src/shared/artifacts.ts +22 -11
- package/dist/builtin/subagents/src/shared/event-jsonl-writer.ts +294 -0
- package/dist/builtin/subagents/src/shared/exclusive-file-publication.ts +44 -0
- package/dist/builtin/subagents/src/shared/jsonl-writer.ts +1 -0
- package/dist/builtin/subagents/src/shared/model-info.ts +2 -2
- package/dist/builtin/subagents/src/shared/settings.ts +20 -10
- package/dist/builtin/subagents/src/shared/types-async.ts +3 -1
- package/dist/builtin/subagents/src/shared/types-config.ts +2 -0
- package/dist/builtin/subagents/src/shared/types-runtime.ts +3 -2
- package/dist/builtin/subagents/src/slash/slash-commands.ts +9 -12
- package/dist/builtin/subagents/src/slash/slash-live-state.ts +63 -32
- package/dist/builtin/subagents/src/tui/render-event-formatting.ts +15 -48
- package/dist/builtin/subagents/src/tui/render-layout.ts +9 -0
- package/dist/builtin/subagents/src/tui/render-result.ts +7 -0
- package/dist/builtin/subagents/src/tui/render-stable-output.ts +1 -0
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +27 -25
- package/dist/builtin/subagents/src/tui/render-widget.ts +177 -132
- package/dist/builtin/subagents/src/tui/render.ts +1 -1
- package/dist/builtin/web-access/CHANGELOG.md +14 -0
- package/dist/builtin/web-access/README.md +4 -0
- package/dist/builtin/web-access/content-tools.ts +8 -3
- package/dist/builtin/web-access/index-heavy.ts +1 -1
- package/dist/builtin/web-access/index.ts +190 -46
- package/dist/builtin/web-access/lifecycle-lease.ts +38 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/web-access/result-renderers.ts +1 -1
- package/dist/builtin/web-access/summary-review.ts +1 -1
- package/dist/builtin/web-access/web-search-activity.ts +1 -1
- package/dist/builtin/web-access/web-search-return.ts +7 -0
- package/dist/builtin/web-access/web-search-summary.ts +1 -1
- package/dist/builtin/web-access/web-search-tool.ts +4 -2
- package/dist/builtin/workflows/CHANGELOG.md +98 -0
- package/dist/builtin/workflows/README.md +20 -16
- package/dist/builtin/workflows/builtin/deep-research-codebase-utils.ts +33 -9
- package/dist/builtin/workflows/builtin/goal-artifacts.ts +3 -1
- package/dist/builtin/workflows/builtin/goal-ledger.ts +3 -0
- package/dist/builtin/workflows/builtin/goal-prompts.ts +39 -5
- package/dist/builtin/workflows/builtin/goal-reducer.ts +21 -0
- package/dist/builtin/workflows/builtin/goal-reports.ts +23 -0
- package/dist/builtin/workflows/builtin/goal-review.ts +85 -6
- package/dist/builtin/workflows/builtin/goal-runner.ts +122 -49
- package/dist/builtin/workflows/builtin/goal-schemas.ts +22 -0
- package/dist/builtin/workflows/builtin/goal-types.ts +25 -1
- package/dist/builtin/workflows/builtin/goal.d.ts +5 -0
- package/dist/builtin/workflows/builtin/goal.ts +13 -2
- package/dist/builtin/workflows/builtin/index.d.ts +8 -0
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +16 -5
- package/dist/builtin/workflows/builtin/ralph-core.ts +100 -15
- package/dist/builtin/workflows/builtin/ralph-models.ts +98 -66
- package/dist/builtin/workflows/builtin/ralph-review-gate.ts +37 -5
- package/dist/builtin/workflows/builtin/ralph-reviewer-prompt.ts +159 -0
- package/dist/builtin/workflows/builtin/ralph-runner.ts +75 -165
- package/dist/builtin/workflows/builtin/ralph.d.ts +3 -0
- package/dist/builtin/workflows/builtin/ralph.ts +4 -1
- package/dist/builtin/workflows/builtin/review-convergence.ts +111 -0
- package/dist/builtin/workflows/builtin/shared-prompts.ts +20 -1
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/create-spec/SKILL.md +2 -0
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +16 -13
- package/dist/builtin/workflows/skills/impeccable/reference/adapt.md +1 -0
- package/dist/builtin/workflows/skills/impeccable/reference/adapt.native.md +58 -0
- package/dist/builtin/workflows/skills/impeccable/reference/android.md +40 -0
- package/dist/builtin/workflows/skills/impeccable/reference/animate.md +2 -0
- package/dist/builtin/workflows/skills/impeccable/reference/audit.md +2 -0
- package/dist/builtin/workflows/skills/impeccable/reference/audit.native.md +139 -0
- package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +69 -62
- package/dist/builtin/workflows/skills/impeccable/reference/critique.md +21 -7
- package/dist/builtin/workflows/skills/impeccable/reference/document.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +92 -0
- package/dist/builtin/workflows/skills/impeccable/reference/init.md +29 -7
- package/dist/builtin/workflows/skills/impeccable/reference/ios.md +45 -0
- package/dist/builtin/workflows/skills/impeccable/reference/layout.md +25 -1
- package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +23 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +2 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +75 -14
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +31 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +64 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +118 -11
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +16 -11
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +66 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +42 -10
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/fonts.mjs +30 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +4 -6
- package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +660 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/hook-before-edit.mjs +516 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +1764 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/hook.mjs +61 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +4 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/is-generated.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-component.mjs +13 -16
- package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +17 -11
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +104 -37
- package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +9 -0
- package/dist/builtin/workflows/src/durable/backend.ts +12 -0
- package/dist/builtin/workflows/src/durable/child-primitive.ts +12 -8
- package/dist/builtin/workflows/src/durable/dbos-backend.ts +63 -2
- package/dist/builtin/workflows/src/durable/dbos-envelope.ts +28 -0
- package/dist/builtin/workflows/src/durable/resume-catalog.ts +12 -0
- package/dist/builtin/workflows/src/durable/resume-runtime.ts +5 -2
- package/dist/builtin/workflows/src/durable/stage-primitive.ts +167 -28
- package/dist/builtin/workflows/src/durable/types.ts +30 -1
- package/dist/builtin/workflows/src/engine/primitives/task.ts +3 -1
- package/dist/builtin/workflows/src/engine/run-durable-finalize.ts +1 -2
- package/dist/builtin/workflows/src/engine/run-returned-status.ts +50 -16
- package/dist/builtin/workflows/src/engine/run.ts +32 -32
- package/dist/builtin/workflows/src/engine/runtime.ts +5 -0
- package/dist/builtin/workflows/src/extension/extension-factory.ts +3 -0
- package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +9 -2
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +137 -27
- package/dist/builtin/workflows/src/extension/lifecycle-notifications.ts +22 -6
- package/dist/builtin/workflows/src/extension/public-types.ts +1 -1
- package/dist/builtin/workflows/src/extension/workflow-command-completions.ts +13 -1
- package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +19 -4
- package/dist/builtin/workflows/src/extension/workflow-command-surfaces.ts +9 -0
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +17 -17
- package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +48 -23
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +15 -2
- package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +20 -8
- package/dist/builtin/workflows/src/extension/workflow-tool.ts +24 -8
- package/dist/builtin/workflows/src/runs/background/status.ts +4 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-continuation.ts +13 -3
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +29 -8
- package/dist/builtin/workflows/src/runs/foreground/executor-hil.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +8 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +4 -3
- package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +2 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +18 -19
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-unresolved-overflow.ts +38 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-tool-execution-buffer.ts +47 -0
- package/dist/builtin/workflows/src/runs/shared/model-fallback-candidates.ts +1 -1
- package/dist/builtin/workflows/src/runs/shared/worktree-git.ts +155 -20
- package/dist/builtin/workflows/src/runs/shared/worktree-types.ts +6 -0
- package/dist/builtin/workflows/src/runs/shared/worktree.ts +2 -1
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +2 -2
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +2 -2
- package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +18 -1
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +23 -5
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +4 -0
- package/dist/builtin/workflows/src/shared/resume-continuation.ts +2 -0
- package/dist/builtin/workflows/src/shared/returned-run-status.ts +116 -0
- package/dist/builtin/workflows/src/shared/workflow-failures-decisions.ts +2 -0
- package/dist/builtin/workflows/src/tui/graph-view-render-helpers.ts +21 -3
- package/dist/builtin/workflows/src/tui/graph-view-state.ts +3 -0
- package/dist/builtin/workflows/src/tui/graph-view-types.ts +3 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +1 -23
- package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +54 -9
- package/dist/builtin/workflows/src/tui/stage-chat-view-pending-tools.ts +9 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-render-settings.ts +27 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +5 -6
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +5 -2
- package/dist/builtin/workflows/src/tui/status-list.ts +22 -15
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +4 -4
- package/dist/bun/internal-intercom-broker.d.ts +6 -0
- package/dist/bun/internal-intercom-broker.d.ts.map +1 -0
- package/dist/bun/internal-intercom-broker.js +39 -0
- package/dist/bun/internal-intercom-broker.js.map +1 -0
- package/dist/bun/split-loader.d.ts +2 -0
- package/dist/bun/split-loader.d.ts.map +1 -0
- package/dist/bun/split-loader.js +50 -0
- package/dist/bun/split-loader.js.map +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +2 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -4
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts +26 -6
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +178 -19
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +25 -4
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +12 -2
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +1 -1
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +1 -1
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +13 -4
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-models.d.ts +2 -2
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +2 -1
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts +2 -0
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +152 -4
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +4 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +15 -1
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +6 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +6 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/anthropic-thinking-guard.d.ts +5 -5
- package/dist/core/anthropic-thinking-guard.d.ts.map +1 -1
- package/dist/core/anthropic-thinking-guard.js +42 -32
- package/dist/core/anthropic-thinking-guard.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +15 -15
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +14 -9
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/builtin-packages.d.ts.map +1 -1
- package/dist/core/builtin-packages.js +8 -4
- package/dist/core/builtin-packages.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +2 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +79 -46
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/context-assistant-turns.d.ts +42 -0
- package/dist/core/compaction/context-assistant-turns.d.ts.map +1 -0
- package/dist/core/compaction/context-assistant-turns.js +87 -0
- package/dist/core/compaction/context-assistant-turns.js.map +1 -0
- package/dist/core/compaction/context-compaction-critical.d.ts +15 -0
- package/dist/core/compaction/context-compaction-critical.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-critical.js +57 -0
- package/dist/core/compaction/context-compaction-critical.js.map +1 -0
- package/dist/core/compaction/context-compaction-eviction-alternates.d.ts +18 -0
- package/dist/core/compaction/context-compaction-eviction-alternates.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-eviction-alternates.js +186 -0
- package/dist/core/compaction/context-compaction-eviction-alternates.js.map +1 -0
- package/dist/core/compaction/context-compaction-eviction.d.ts +12 -0
- package/dist/core/compaction/context-compaction-eviction.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-eviction.js +222 -0
- package/dist/core/compaction/context-compaction-eviction.js.map +1 -0
- package/dist/core/compaction/context-compaction-prompt.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction-prompt.js +1 -1
- package/dist/core/compaction/context-compaction-prompt.js.map +1 -1
- package/dist/core/compaction/context-compaction-runner.d.ts +7 -1
- package/dist/core/compaction/context-compaction-runner.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction-runner.js +113 -21
- package/dist/core/compaction/context-compaction-runner.js.map +1 -1
- package/dist/core/compaction/context-compaction-types.d.ts +2 -0
- package/dist/core/compaction/context-compaction-types.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction-types.js.map +1 -1
- package/dist/core/compaction/context-deletion-application.d.ts +5 -4
- package/dist/core/compaction/context-deletion-application.d.ts.map +1 -1
- package/dist/core/compaction/context-deletion-application.js +17 -15
- package/dist/core/compaction/context-deletion-application.js.map +1 -1
- package/dist/core/compaction/context-deletion-store.d.ts.map +1 -1
- package/dist/core/compaction/context-deletion-store.js +1 -1
- package/dist/core/compaction/context-deletion-store.js.map +1 -1
- package/dist/core/compaction/context-deletion-targets.d.ts +2 -1
- package/dist/core/compaction/context-deletion-targets.d.ts.map +1 -1
- package/dist/core/compaction/context-deletion-targets.js +36 -31
- package/dist/core/compaction/context-deletion-targets.js.map +1 -1
- package/dist/core/compaction/context-deletion-tool-helpers.d.ts.map +1 -1
- package/dist/core/compaction/context-deletion-tool-helpers.js +116 -43
- package/dist/core/compaction/context-deletion-tool-helpers.js.map +1 -1
- package/dist/core/compaction/context-transcript-analysis.d.ts +4 -2
- package/dist/core/compaction/context-transcript-analysis.d.ts.map +1 -1
- package/dist/core/compaction/context-transcript-analysis.js +36 -40
- package/dist/core/compaction/context-transcript-analysis.js.map +1 -1
- package/dist/core/copilot-anthropic-sse-repair.d.ts +23 -0
- package/dist/core/copilot-anthropic-sse-repair.d.ts.map +1 -0
- package/dist/core/copilot-anthropic-sse-repair.js +340 -0
- package/dist/core/copilot-anthropic-sse-repair.js.map +1 -0
- package/dist/core/copilot-gemini-reasoning.d.ts +16 -8
- package/dist/core/copilot-gemini-reasoning.d.ts.map +1 -1
- package/dist/core/copilot-gemini-reasoning.js +27 -22
- package/dist/core/copilot-gemini-reasoning.js.map +1 -1
- package/dist/core/copilot-hosts.d.ts +12 -0
- package/dist/core/copilot-hosts.d.ts.map +1 -0
- package/dist/core/copilot-hosts.js +33 -0
- package/dist/core/copilot-hosts.js.map +1 -0
- package/dist/core/copilot-model-catalog.d.ts.map +1 -1
- package/dist/core/copilot-model-catalog.js +3 -2
- package/dist/core/copilot-model-catalog.js.map +1 -1
- package/dist/core/copilot-model-synthesis.d.ts.map +1 -1
- package/dist/core/copilot-model-synthesis.js +3 -1
- package/dist/core/copilot-model-synthesis.js.map +1 -1
- package/dist/core/extensions/agent-events.d.ts +1 -1
- package/dist/core/extensions/agent-events.d.ts.map +1 -1
- package/dist/core/extensions/agent-events.js.map +1 -1
- package/dist/core/extensions/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.js +6 -0
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts +8 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +10 -4
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/provider-types.d.ts +2 -7
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +6 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +72 -29
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +5 -5
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/messages.d.ts +9 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +100 -18
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-registry-builtins.d.ts.map +1 -1
- package/dist/core/model-registry-builtins.js +5 -0
- package/dist/core/model-registry-builtins.js.map +1 -1
- package/dist/core/model-registry-custom-loader.d.ts.map +1 -1
- package/dist/core/model-registry-custom-loader.js +49 -8
- package/dist/core/model-registry-custom-loader.js.map +1 -1
- package/dist/core/model-registry-dynamic.d.ts.map +1 -1
- package/dist/core/model-registry-dynamic.js +11 -5
- package/dist/core/model-registry-dynamic.js.map +1 -1
- package/dist/core/model-registry-loader.d.ts.map +1 -1
- package/dist/core/model-registry-loader.js +8 -0
- package/dist/core/model-registry-loader.js.map +1 -1
- package/dist/core/model-registry-schemas.d.ts +93 -8
- package/dist/core/model-registry-schemas.d.ts.map +1 -1
- package/dist/core/model-registry-schemas.js +24 -12
- package/dist/core/model-registry-schemas.js.map +1 -1
- package/dist/core/model-registry-types.d.ts +7 -6
- package/dist/core/model-registry-types.d.ts.map +1 -1
- package/dist/core/model-registry-types.js.map +1 -1
- package/dist/core/model-registry.d.ts +5 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +23 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver-cli.d.ts.map +1 -1
- package/dist/core/model-resolver-cli.js +33 -5
- package/dist/core/model-resolver-cli.js.map +1 -1
- package/dist/core/model-resolver-initial.d.ts +6 -1
- package/dist/core/model-resolver-initial.d.ts.map +1 -1
- package/dist/core/model-resolver-initial.js +12 -7
- package/dist/core/model-resolver-initial.js.map +1 -1
- package/dist/core/model-resolver-scope.d.ts +9 -0
- package/dist/core/model-resolver-scope.d.ts.map +1 -1
- package/dist/core/model-resolver-scope.js +12 -4
- package/dist/core/model-resolver-scope.js.map +1 -1
- package/dist/core/model-resolver.d.ts +4 -3
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +2 -2
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/openai-responses-payload-sanitizer.d.ts +7 -0
- package/dist/core/openai-responses-payload-sanitizer.d.ts.map +1 -0
- package/dist/core/openai-responses-payload-sanitizer.js +74 -0
- package/dist/core/openai-responses-payload-sanitizer.js.map +1 -0
- package/dist/core/package-manager-auto-resources.d.ts +2 -2
- package/dist/core/package-manager-auto-resources.d.ts.map +1 -1
- package/dist/core/package-manager-auto-resources.js +32 -52
- package/dist/core/package-manager-auto-resources.js.map +1 -1
- package/dist/core/package-manager-resolver.d.ts.map +1 -1
- package/dist/core/package-manager-resolver.js +23 -14
- package/dist/core/package-manager-resolver.js.map +1 -1
- package/dist/core/package-manager-resource-collector.d.ts +3 -3
- package/dist/core/package-manager-resource-collector.d.ts.map +1 -1
- package/dist/core/package-manager-resource-collector.js +76 -73
- package/dist/core/package-manager-resource-collector.js.map +1 -1
- package/dist/core/package-manager-resource-files.d.ts +9 -8
- package/dist/core/package-manager-resource-files.d.ts.map +1 -1
- package/dist/core/package-manager-resource-files.js +92 -81
- package/dist/core/package-manager-resource-files.js.map +1 -1
- package/dist/core/prompt-templates-async.d.ts +3 -0
- package/dist/core/prompt-templates-async.d.ts.map +1 -0
- package/dist/core/prompt-templates-async.js +118 -0
- package/dist/core/prompt-templates-async.js.map +1 -0
- package/dist/core/provider-context-usage.d.ts +11 -0
- package/dist/core/provider-context-usage.d.ts.map +1 -0
- package/dist/core/provider-context-usage.js +58 -0
- package/dist/core/provider-context-usage.js.map +1 -0
- package/dist/core/resource-loader-assets.d.ts +3 -3
- package/dist/core/resource-loader-assets.d.ts.map +1 -1
- package/dist/core/resource-loader-assets.js +66 -83
- package/dist/core/resource-loader-assets.js.map +1 -1
- package/dist/core/resource-loader-context-files.d.ts +1 -0
- package/dist/core/resource-loader-context-files.d.ts.map +1 -1
- package/dist/core/resource-loader-context-files.js +13 -10
- package/dist/core/resource-loader-context-files.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts +1 -1
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-core.js +5 -5
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-extensions.d.ts.map +1 -1
- package/dist/core/resource-loader-extensions.js +4 -0
- package/dist/core/resource-loader-extensions.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +54 -7
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +7 -1
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/sdk-types.d.ts +2 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +9 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-entry-normalization.d.ts +7 -0
- package/dist/core/session-entry-normalization.d.ts.map +1 -0
- package/dist/core/session-entry-normalization.js +14 -0
- package/dist/core/session-entry-normalization.js.map +1 -0
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +1 -0
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-history.d.ts +2 -2
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-history.js +127 -108
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +3 -2
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +6 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-manager-core.d.ts.map +1 -1
- package/dist/core/settings-manager-core.js +3 -2
- package/dist/core/settings-manager-core.js.map +1 -1
- package/dist/core/settings-storage.d.ts.map +1 -1
- package/dist/core/settings-storage.js +2 -1
- package/dist/core/settings-storage.js.map +1 -1
- package/dist/core/settings-types.d.ts +2 -1
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/skills-async.d.ts +3 -0
- package/dist/core/skills-async.d.ts.map +1 -0
- package/dist/core/skills-async.js +269 -0
- package/dist/core/skills-async.js.map +1 -0
- package/dist/core/slash-commands.d.ts +2 -0
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +141 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +11 -8
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/trust-manager.d.ts +9 -0
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +44 -2
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/main-deferred-startup.d.ts +33 -0
- package/dist/main-deferred-startup.d.ts.map +1 -0
- package/dist/main-deferred-startup.js +44 -0
- package/dist/main-deferred-startup.js.map +1 -0
- package/dist/main-early-input.d.ts +41 -0
- package/dist/main-early-input.d.ts.map +1 -0
- package/dist/main-early-input.js +154 -0
- package/dist/main-early-input.js.map +1 -0
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +1 -0
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts +0 -6
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +47 -39
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js +0 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +15 -0
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-options.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-options.js +3 -1
- package/dist/modes/interactive/components/settings-selector-options.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +2 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +37 -2
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.js +0 -1
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +21 -9
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/interactive-child-ordering.d.ts +7 -0
- package/dist/modes/interactive/interactive-child-ordering.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-child-ordering.js +26 -0
- package/dist/modes/interactive/interactive-child-ordering.js.map +1 -0
- package/dist/modes/interactive/interactive-deferred-startup.d.ts +8 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +86 -26
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.js +13 -13
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +16 -0
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-hotkeys-debug.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-hotkeys-debug.js +4 -3
- package/dist/modes/interactive/interactive-hotkeys-debug.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +360 -230
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +19 -4
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +46 -4
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +3 -3
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +3 -3
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +27 -17
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.d.ts +8 -1
- package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +14 -10
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-onboarding.d.ts +0 -9
- package/dist/modes/interactive/interactive-onboarding.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-onboarding.js +24 -201
- package/dist/modes/interactive/interactive-onboarding.js.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js +43 -9
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +93 -10
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.js +3 -2
- package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.js +10 -8
- package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +9 -5
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +102 -98
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/global-theme.js +26 -2
- package/dist/modes/interactive/theme/global-theme.js.map +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.js +2 -0
- package/dist/modes/interactive/theme/theme-class.js.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.js +3 -0
- package/dist/modes/interactive/theme/theme-loading.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -1
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/utils/child-process.d.ts +8 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +39 -6
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +3 -0
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/event-loop.d.ts +7 -0
- package/dist/utils/event-loop.d.ts.map +1 -0
- package/dist/utils/event-loop.js +14 -0
- package/dist/utils/event-loop.js.map +1 -0
- package/dist/utils/fs-watch.d.ts +24 -1
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/fs-watch.js +60 -5
- package/dist/utils/fs-watch.js.map +1 -1
- package/dist/utils/json.d.ts +4 -0
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/json.js +8 -0
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/module-require.d.ts +11 -0
- package/dist/utils/module-require.d.ts.map +1 -1
- package/dist/utils/module-require.js +14 -1
- package/dist/utils/module-require.js.map +1 -1
- package/dist/utils/split-launcher.d.ts +38 -0
- package/dist/utils/split-launcher.d.ts.map +1 -0
- package/dist/utils/split-launcher.js +63 -0
- package/dist/utils/split-launcher.js.map +1 -0
- package/docs/changelog.mdx +19 -0
- package/docs/compaction.md +100 -64
- package/docs/custom-provider.md +18 -5
- package/docs/development.md +4 -0
- package/docs/extensions.md +11 -2
- package/docs/json.md +3 -1
- package/docs/keybindings.md +2 -2
- package/docs/models.md +69 -10
- package/docs/providers.md +3 -2
- package/docs/quickstart.md +15 -11
- package/docs/rpc.md +5 -3
- package/docs/sdk.md +1 -1
- package/docs/settings.md +33 -3
- package/docs/subagents.md +40 -5
- package/docs/terminal-setup.md +4 -0
- package/docs/tools.md +1 -1
- package/docs/usage.md +8 -6
- package/docs/windows.md +4 -0
- package/docs/workflows.md +59 -36
- package/examples/extensions/preset.ts +2 -2
- package/examples/extensions/subagent/README.md +2 -2
- package/examples/extensions/subagent/index.ts +1 -2
- package/examples/extensions/subagent/schemas.ts +4 -1
- package/examples/sdk/12-full-control.ts +1 -1
- package/npm-shrinkwrap.json +538 -51
- package/package.json +10 -9
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-behavior.ts +0 -75
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-component.ts +0 -202
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-edit.ts +0 -97
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-editor.ts +0 -160
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-frame.ts +0 -72
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-render-modes.ts +0 -161
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-render-selectors.ts +0 -203
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-selectors.ts +0 -234
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-state.ts +0 -103
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-types.ts +0 -29
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify.ts +0 -9
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-clarify.ts +0 -117
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@bastani/atomic";
|
|
2
2
|
import { randomUUID } from "crypto";
|
|
3
3
|
import { Type } from "typebox";
|
|
4
|
-
import { Text } from "@
|
|
4
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
5
5
|
import type { IntercomClient } from "./broker/client.ts";
|
|
6
6
|
import type { Message } from "./types.ts";
|
|
7
7
|
import { renderIntercomResult } from "./result-renderers.js";
|
|
@@ -30,7 +30,7 @@ export function registerIntercomTool(pi: ExtensionAPI, deps: IntercomToolDeps):
|
|
|
30
30
|
pi.registerTool({
|
|
31
31
|
name: "intercom",
|
|
32
32
|
label: "Intercom",
|
|
33
|
-
description: `Send a message to another
|
|
33
|
+
description: `Send a message to another local agent session running on this machine.
|
|
34
34
|
Use this to communicate findings, request help, or coordinate work with other sessions.
|
|
35
35
|
|
|
36
36
|
Usage:
|
|
@@ -41,7 +41,7 @@ Usage:
|
|
|
41
41
|
intercom({ action: "pending" }) → List unresolved inbound asks
|
|
42
42
|
intercom({ action: "status" }) → Show connection status`,
|
|
43
43
|
promptSnippet:
|
|
44
|
-
"Use to coordinate with other local
|
|
44
|
+
"Use to coordinate with other local agent sessions: list peers, send updates, ask for help, or check intercom connectivity.",
|
|
45
45
|
|
|
46
46
|
parameters: Type.Object({
|
|
47
47
|
action: Type.String({
|
|
@@ -104,6 +104,7 @@ Usage:
|
|
|
104
104
|
return {
|
|
105
105
|
content: [{ type: "text", text: `${currentSection}\n\n${otherSection}` }],
|
|
106
106
|
isError: false,
|
|
107
|
+
details: {},
|
|
107
108
|
};
|
|
108
109
|
} catch (error) {
|
|
109
110
|
return {
|
|
@@ -141,6 +142,7 @@ Usage:
|
|
|
141
142
|
return {
|
|
142
143
|
content: [{ type: "text", text: "Message cancelled by user" }],
|
|
143
144
|
isError: false,
|
|
145
|
+
details: {},
|
|
144
146
|
};
|
|
145
147
|
}
|
|
146
148
|
}
|
|
@@ -268,6 +270,7 @@ Usage:
|
|
|
268
270
|
return {
|
|
269
271
|
content: [{ type: "text", text: `**Reply from ${to}:**\n${replyText}${replyAttachments}` }],
|
|
270
272
|
isError: false,
|
|
273
|
+
details: {},
|
|
271
274
|
};
|
|
272
275
|
} catch (error) {
|
|
273
276
|
rejectReplyWaiter(toError(error));
|
|
@@ -343,6 +346,7 @@ Usage:
|
|
|
343
346
|
return {
|
|
344
347
|
content: [{ type: "text", text: "No unresolved inbound asks." }],
|
|
345
348
|
isError: false,
|
|
349
|
+
details: {},
|
|
346
350
|
};
|
|
347
351
|
}
|
|
348
352
|
|
|
@@ -355,6 +359,7 @@ Usage:
|
|
|
355
359
|
return {
|
|
356
360
|
content: [{ type: "text", text: `**Pending asks:**\n${lines.join("\n")}` }],
|
|
357
361
|
isError: false,
|
|
362
|
+
details: {},
|
|
358
363
|
};
|
|
359
364
|
}
|
|
360
365
|
|
|
@@ -368,6 +373,7 @@ Usage:
|
|
|
368
373
|
text: `**Intercom Status:**\nConnected: Yes\nSession ID: ${mySessionId}\nActive sessions: ${sessions.length}`,
|
|
369
374
|
}],
|
|
370
375
|
isError: false,
|
|
376
|
+
details: {},
|
|
371
377
|
};
|
|
372
378
|
} catch (error) {
|
|
373
379
|
return {
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AgentEndEvent, AgentStartEvent, ExtensionAPI, ExtensionContext, ExtensionHandler,
|
|
3
|
+
MessageRenderer, ModelSelectEvent, RegisteredCommand, SessionShutdownEvent,
|
|
4
|
+
SessionStartEvent, ToolDefinition, ToolExecutionEndEvent, ToolExecutionStartEvent,
|
|
5
|
+
TurnEndEvent, TurnStartEvent,
|
|
6
|
+
} from "@bastani/atomic";
|
|
7
|
+
|
|
8
|
+
type CapturedCommand = Omit<RegisteredCommand, "name" | "sourceInfo">;
|
|
9
|
+
type CapturedShortcut = Parameters<ExtensionAPI["registerShortcut"]>[1];
|
|
10
|
+
type EventHandler = Parameters<ExtensionAPI["events"]["on"]>[1];
|
|
11
|
+
type EventPayload = Parameters<EventHandler>[0];
|
|
12
|
+
const LIVE_EVENT_SUBSCRIPTIONS = new Set(["pi-intercom:detach-response"]);
|
|
13
|
+
|
|
14
|
+
export type ToolRenderResultArgs = Parameters<NonNullable<ToolDefinition["renderResult"]>>;
|
|
15
|
+
export type ForwardedEventMap = {
|
|
16
|
+
session_start: SessionStartEvent;
|
|
17
|
+
session_shutdown: SessionShutdownEvent;
|
|
18
|
+
turn_start: TurnStartEvent;
|
|
19
|
+
turn_end: TurnEndEvent;
|
|
20
|
+
agent_start: AgentStartEvent;
|
|
21
|
+
agent_end: AgentEndEvent;
|
|
22
|
+
tool_execution_start: ToolExecutionStartEvent;
|
|
23
|
+
tool_execution_end: ToolExecutionEndEvent;
|
|
24
|
+
model_select: ModelSelectEvent;
|
|
25
|
+
};
|
|
26
|
+
type LazyLifecycleEvent = keyof ForwardedEventMap;
|
|
27
|
+
type ForwardedHandler<K extends LazyLifecycleEvent> = ExtensionHandler<ForwardedEventMap[K]>;
|
|
28
|
+
type ForwardedHandlerMap = { [K in LazyLifecycleEvent]: ForwardedHandler<K>[] };
|
|
29
|
+
type AnyForwardedHandler = { [K in LazyLifecycleEvent]: ForwardedHandler<K> }[LazyLifecycleEvent];
|
|
30
|
+
export interface HeavyRuntimeReadiness {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
awaitAutomaticBrokerReady(): Promise<void>;
|
|
33
|
+
awaitForegroundBrokerReady(): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type CapturedHeavy = {
|
|
37
|
+
tools: Map<string, ToolDefinition>;
|
|
38
|
+
commands: Map<string, CapturedCommand>;
|
|
39
|
+
handlers: ForwardedHandlerMap;
|
|
40
|
+
shortcuts: Map<string, CapturedShortcut>;
|
|
41
|
+
eventHandlers: Map<string, EventHandler[]>;
|
|
42
|
+
runtimeReadiness?: HeavyRuntimeReadiness;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export function createForwardedHandlerMap(): ForwardedHandlerMap {
|
|
46
|
+
return {
|
|
47
|
+
session_start: [], session_shutdown: [], turn_start: [], turn_end: [], agent_start: [],
|
|
48
|
+
agent_end: [], tool_execution_start: [], tool_execution_end: [], model_select: [],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function addHandler<K extends LazyLifecycleEvent>(captured: CapturedHeavy, event: K, handler: ForwardedHandler<K>): void {
|
|
53
|
+
captured.handlers[event].push(handler);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function captureForwardedHandler(captured: CapturedHeavy, event: LazyLifecycleEvent, handler: AnyForwardedHandler): void {
|
|
57
|
+
switch (event) {
|
|
58
|
+
case "session_start": addHandler(captured, event, handler as ForwardedHandler<"session_start">); return;
|
|
59
|
+
case "session_shutdown": addHandler(captured, event, handler as ForwardedHandler<"session_shutdown">); return;
|
|
60
|
+
case "turn_start": addHandler(captured, event, handler as ForwardedHandler<"turn_start">); return;
|
|
61
|
+
case "turn_end": addHandler(captured, event, handler as ForwardedHandler<"turn_end">); return;
|
|
62
|
+
case "agent_start": addHandler(captured, event, handler as ForwardedHandler<"agent_start">); return;
|
|
63
|
+
case "agent_end": addHandler(captured, event, handler as ForwardedHandler<"agent_end">); return;
|
|
64
|
+
case "tool_execution_start": addHandler(captured, event, handler as ForwardedHandler<"tool_execution_start">); return;
|
|
65
|
+
case "tool_execution_end": addHandler(captured, event, handler as ForwardedHandler<"tool_execution_end">); return;
|
|
66
|
+
case "model_select": addHandler(captured, event, handler as ForwardedHandler<"model_select">);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function addEventHandler(captured: CapturedHeavy, event: string, handler: EventHandler): void {
|
|
71
|
+
const handlers = captured.eventHandlers.get(event) ?? [];
|
|
72
|
+
handlers.push(handler);
|
|
73
|
+
captured.eventHandlers.set(event, handlers);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function dispatchHandlers<K extends LazyLifecycleEvent>(
|
|
77
|
+
captured: CapturedHeavy, eventName: K, event: ForwardedEventMap[K], ctx: ExtensionContext,
|
|
78
|
+
): Promise<void> {
|
|
79
|
+
for (const handler of captured.handlers[eventName]) await handler(event, ctx);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export async function dispatchEventHandlers(captured: CapturedHeavy, eventName: string, payload: EventPayload): Promise<void> {
|
|
83
|
+
for (const handler of captured.eventHandlers.get(eventName) ?? []) await handler(payload);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function createHeavyProxy(pi: ExtensionAPI, captured: CapturedHeavy): ExtensionAPI {
|
|
87
|
+
return new Proxy(pi, {
|
|
88
|
+
get(target, prop, receiver) {
|
|
89
|
+
if (prop === "registerTool") return (tool: ToolDefinition) => captured.tools.set(tool.name, tool);
|
|
90
|
+
if (prop === "registerCommand") return (name: string, options: CapturedCommand) => captured.commands.set(name, options);
|
|
91
|
+
if (prop === "on") return (event: LazyLifecycleEvent, handler: AnyForwardedHandler) => captureForwardedHandler(captured, event, handler);
|
|
92
|
+
if (prop === "registerShortcut") return (shortcut: string, options: CapturedShortcut) => captured.shortcuts.set(shortcut, options);
|
|
93
|
+
if (prop === "registerMessageRenderer") return (customType: string, renderer: MessageRenderer) => pi.registerMessageRenderer(customType, renderer);
|
|
94
|
+
if (prop === "events") {
|
|
95
|
+
return new Proxy(pi.events, {
|
|
96
|
+
get(eventTarget, eventProp, eventReceiver) {
|
|
97
|
+
if (eventProp === "on") {
|
|
98
|
+
return (event: string, handler: EventHandler) => {
|
|
99
|
+
if (LIVE_EVENT_SUBSCRIPTIONS.has(event)) return pi.events.on(event, handler);
|
|
100
|
+
addEventHandler(captured, event, handler);
|
|
101
|
+
return () => {
|
|
102
|
+
const handlers = captured.eventHandlers.get(event) ?? [];
|
|
103
|
+
captured.eventHandlers.set(event, handlers.filter((candidate) => candidate !== handler));
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return Reflect.get(eventTarget, eventProp, eventReceiver);
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return Reflect.get(target, prop, receiver);
|
|
112
|
+
},
|
|
113
|
+
}) as ExtensionAPI;
|
|
114
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
2
|
+
|
|
3
|
+
const SUBAGENT_RESULT_INTERCOM_EVENT = "subagent:result-intercom";
|
|
4
|
+
const SUBAGENT_RESULT_INTERCOM_DELIVERY_EVENT = "subagent:result-intercom-delivery";
|
|
5
|
+
|
|
6
|
+
export function rejectLazyResultRelay(
|
|
7
|
+
pi: ExtensionAPI,
|
|
8
|
+
eventName: string,
|
|
9
|
+
payload: unknown,
|
|
10
|
+
error: unknown,
|
|
11
|
+
): void {
|
|
12
|
+
if (eventName !== SUBAGENT_RESULT_INTERCOM_EVENT || !payload || typeof payload !== "object") return;
|
|
13
|
+
const requestId = (payload as { requestId?: unknown }).requestId;
|
|
14
|
+
if (typeof requestId !== "string") return;
|
|
15
|
+
pi.events.emit(SUBAGENT_RESULT_INTERCOM_DELIVERY_EVENT, {
|
|
16
|
+
requestId,
|
|
17
|
+
delivered: false,
|
|
18
|
+
error: error instanceof Error ? error.message : String(error),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ExtensionCommandContext, ExtensionContext, ToolDefinition } from "@bastani/atomic";
|
|
2
|
+
|
|
3
|
+
type CommandHandler = (args: string, ctx: ExtensionCommandContext) => void | Promise<void>;
|
|
4
|
+
type ExecutableHeavy = {
|
|
5
|
+
tools: Map<string, ToolDefinition>;
|
|
6
|
+
commands: Map<string, { handler: CommandHandler }>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type HeavyHandle<THeavy extends ExecutableHeavy> = {
|
|
10
|
+
heavy: THeavy;
|
|
11
|
+
assertCurrent: () => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export async function executeHeavyTool<THeavy extends ExecutableHeavy>(
|
|
15
|
+
loadHeavy: (ctx?: ExtensionContext) => Promise<HeavyHandle<THeavy>>,
|
|
16
|
+
name: string,
|
|
17
|
+
args: Parameters<NonNullable<ToolDefinition["execute"]>>,
|
|
18
|
+
): Promise<Awaited<ReturnType<NonNullable<ToolDefinition["execute"]>>>> {
|
|
19
|
+
const handle = await loadHeavy(args[4]);
|
|
20
|
+
handle.assertCurrent();
|
|
21
|
+
const tool = handle.heavy.tools.get(name);
|
|
22
|
+
if (!tool?.execute) throw new Error(`Intercom tool implementation not found: ${name}`);
|
|
23
|
+
const result = await tool.execute(...args);
|
|
24
|
+
handle.assertCurrent();
|
|
25
|
+
return result as Awaited<ReturnType<NonNullable<ToolDefinition["execute"]>>>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function runHeavyCommand<THeavy extends ExecutableHeavy>(
|
|
29
|
+
loadHeavy: (ctx?: ExtensionContext) => Promise<HeavyHandle<THeavy>>,
|
|
30
|
+
args: string | undefined,
|
|
31
|
+
ctx: ExtensionCommandContext,
|
|
32
|
+
): Promise<void> {
|
|
33
|
+
const handle = await loadHeavy(ctx);
|
|
34
|
+
handle.assertCurrent();
|
|
35
|
+
const command = handle.heavy.commands.get("intercom");
|
|
36
|
+
if (!command) throw new Error("Intercom command implementation not found");
|
|
37
|
+
await command.handler(args ?? "", ctx);
|
|
38
|
+
handle.assertCurrent();
|
|
39
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface LifecycleLease<TShutdown> {
|
|
2
|
+
readonly id: number;
|
|
3
|
+
readonly priorCleanup: Promise<void>;
|
|
4
|
+
retired: boolean;
|
|
5
|
+
shutdown: TShutdown | null;
|
|
6
|
+
cleanupBarrier: Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function createLifecycleLease<TShutdown>(
|
|
10
|
+
id: number,
|
|
11
|
+
priorCleanup: Promise<void> = Promise.resolve(),
|
|
12
|
+
): LifecycleLease<TShutdown> {
|
|
13
|
+
return { id, priorCleanup, retired: false, shutdown: null, cleanupBarrier: priorCleanup };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function retireLifecycleLease<TShutdown>(lease: LifecycleLease<TShutdown>, shutdown: TShutdown): void {
|
|
17
|
+
if (lease.retired) return;
|
|
18
|
+
lease.retired = true;
|
|
19
|
+
lease.shutdown = shutdown;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function retainSettledLifecycleCleanup<TShutdown>(
|
|
23
|
+
lease: LifecycleLease<TShutdown>,
|
|
24
|
+
cleanup: readonly (Promise<unknown> | null)[],
|
|
25
|
+
): Promise<void> {
|
|
26
|
+
const previousCleanup = lease.cleanupBarrier;
|
|
27
|
+
const pendingCleanup = cleanup.filter((task): task is Promise<unknown> => task !== null);
|
|
28
|
+
lease.cleanupBarrier = Promise.allSettled([previousCleanup, ...pendingCleanup]).then(() => undefined);
|
|
29
|
+
return lease.cleanupBarrier;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function assertCurrentLifecycleLease<TShutdown>(
|
|
33
|
+
current: LifecycleLease<TShutdown>,
|
|
34
|
+
expected: LifecycleLease<TShutdown>,
|
|
35
|
+
message: string,
|
|
36
|
+
): void {
|
|
37
|
+
if (current !== expected || expected.retired) throw new Error(message);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Rejection-safe FIFO for lifecycle forwarding that must not overtake replay. */
|
|
41
|
+
export class SerializedLifecycleForwarder {
|
|
42
|
+
private tail: Promise<void> = Promise.resolve();
|
|
43
|
+
|
|
44
|
+
get settled(): Promise<void> { return this.tail; }
|
|
45
|
+
|
|
46
|
+
enqueue<T>(operation: () => Promise<T>): Promise<T> {
|
|
47
|
+
const result = this.tail.then(operation, operation);
|
|
48
|
+
this.tail = result.then(() => undefined, () => undefined);
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -33,11 +33,44 @@ interface LifecycleDeps {
|
|
|
33
33
|
syncPresenceStatus(): void;
|
|
34
34
|
syncPresenceIdentity(sessionId: string): void;
|
|
35
35
|
currentStatus(): string;
|
|
36
|
+
restoreIntercomSessionIdEnv?(): void;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export function registerIntercomLifecycle(pi: ExtensionAPI, deps: LifecycleDeps): void {
|
|
39
|
-
|
|
40
|
+
let hasActiveSession = false;
|
|
41
|
+
|
|
42
|
+
async function cleanupRuntime(reason: string): Promise<void> {
|
|
43
|
+
deps.setRuntimeStarted(false);
|
|
44
|
+
deps.setShuttingDown(true);
|
|
45
|
+
deps.setDisposed(true);
|
|
46
|
+
deps.incrementRuntimeGeneration();
|
|
47
|
+
deps.clearStartupConnectTimer();
|
|
48
|
+
deps.clearReconnectTimer();
|
|
49
|
+
deps.rejectReplyWaiter(new Error(reason));
|
|
50
|
+
deps.replyTracker.reset();
|
|
51
|
+
deps.pendingIdleMessages.length = 0;
|
|
52
|
+
deps.clearInboundFlushTimer();
|
|
53
|
+
deps.setAgentRunning(false);
|
|
54
|
+
deps.activeTools.clear();
|
|
55
|
+
const activeClient = deps.client();
|
|
56
|
+
deps.setClient(null);
|
|
57
|
+
if (activeClient) {
|
|
58
|
+
try {
|
|
59
|
+
await activeClient.disconnect();
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.error(`Intercom failed to disconnect during ${reason.toLowerCase()}; continuing cleanup:`, error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
deps.restoreIntercomSessionIdEnv?.();
|
|
65
|
+
deps.setRuntimeContext(null);
|
|
66
|
+
deps.setCurrentSessionId(null);
|
|
67
|
+
deps.setSessionStartedAt(null);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
40
71
|
if (!deps.config.enabled) return;
|
|
72
|
+
if (hasActiveSession) await cleanupRuntime("Session replaced");
|
|
73
|
+
hasActiveSession = true;
|
|
41
74
|
deps.setShuttingDown(false);
|
|
42
75
|
deps.setDisposed(false);
|
|
43
76
|
deps.setRuntimeStarted(true);
|
|
@@ -63,25 +96,9 @@ export function registerIntercomLifecycle(pi: ExtensionAPI, deps: LifecycleDeps)
|
|
|
63
96
|
});
|
|
64
97
|
|
|
65
98
|
pi.on("session_shutdown", async () => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
deps.clearStartupConnectTimer();
|
|
70
|
-
deps.clearReconnectTimer();
|
|
71
|
-
deps.rejectReplyWaiter(new Error("Session shutting down"));
|
|
72
|
-
deps.replyTracker.reset();
|
|
73
|
-
deps.pendingIdleMessages.length = 0;
|
|
74
|
-
deps.clearInboundFlushTimer();
|
|
75
|
-
deps.setAgentRunning(false);
|
|
76
|
-
deps.activeTools.clear();
|
|
77
|
-
const activeClient = deps.client();
|
|
78
|
-
if (activeClient) {
|
|
79
|
-
await activeClient.disconnect();
|
|
80
|
-
deps.setClient(null);
|
|
81
|
-
}
|
|
82
|
-
deps.setRuntimeContext(null);
|
|
83
|
-
deps.setCurrentSessionId(null);
|
|
84
|
-
deps.setSessionStartedAt(null);
|
|
99
|
+
if (!hasActiveSession) return;
|
|
100
|
+
hasActiveSession = false;
|
|
101
|
+
await cleanupRuntime("Session shutting down");
|
|
85
102
|
});
|
|
86
103
|
|
|
87
104
|
pi.on("turn_end", () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/intercom",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5-alpha.10",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension providing a private coordination channel between parent and child agent sessions. Fork of: https://github.com/nicobailon/pi-intercom",
|
|
6
6
|
"contributors": [
|
|
@@ -18,10 +18,7 @@
|
|
|
18
18
|
".": "./index.ts"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
|
-
"
|
|
22
|
-
"types.ts",
|
|
23
|
-
"config.ts",
|
|
24
|
-
"reply-tracker.ts",
|
|
21
|
+
"*.ts",
|
|
25
22
|
"broker/**/*.ts",
|
|
26
23
|
"ui/**/*.ts",
|
|
27
24
|
"skills/**/*",
|
|
@@ -29,6 +26,14 @@
|
|
|
29
26
|
"CHANGELOG.md",
|
|
30
27
|
"LICENSE"
|
|
31
28
|
],
|
|
29
|
+
"atomic": {
|
|
30
|
+
"extensions": [
|
|
31
|
+
"./index.ts"
|
|
32
|
+
],
|
|
33
|
+
"skills": [
|
|
34
|
+
"./skills"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
32
37
|
"pi": {
|
|
33
38
|
"extensions": [
|
|
34
39
|
"./index.ts"
|
|
@@ -39,7 +44,7 @@
|
|
|
39
44
|
},
|
|
40
45
|
"peerDependencies": {
|
|
41
46
|
"@bastani/atomic": "*",
|
|
42
|
-
"@earendil-works/pi-tui": "^0.80.
|
|
47
|
+
"@earendil-works/pi-tui": "^0.80.6"
|
|
43
48
|
},
|
|
44
49
|
"peerDependenciesMeta": {
|
|
45
50
|
"@bastani/atomic": {
|
|
@@ -50,6 +55,7 @@
|
|
|
50
55
|
}
|
|
51
56
|
},
|
|
52
57
|
"dependencies": {
|
|
58
|
+
"tsx": "^4.20.6",
|
|
53
59
|
"typebox": "^1.1.24"
|
|
54
60
|
}
|
|
55
61
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Message, SessionInfo } from "./types.js";
|
|
2
|
+
|
|
3
|
+
export interface PendingReplyRoute {
|
|
4
|
+
from: string;
|
|
5
|
+
replyTo: string;
|
|
6
|
+
resolve(message: Message): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Routes only the exact sender/thread pair to a blocking tool waiter. */
|
|
10
|
+
export function routeIncomingReply(waiter: PendingReplyRoute | null | undefined, from: SessionInfo, message: Message): boolean {
|
|
11
|
+
if (!waiter) return false;
|
|
12
|
+
const senderTarget = from.name || from.id;
|
|
13
|
+
const fromMatches = senderTarget.toLowerCase() === waiter.from.toLowerCase() || from.id === waiter.from;
|
|
14
|
+
if (!fromMatches || message.replyTo !== waiter.replyTo) return false;
|
|
15
|
+
waiter.resolve(message);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ToolDefinition } from "@bastani/atomic";
|
|
2
|
-
import { Text } from "@
|
|
2
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
3
3
|
|
|
4
4
|
type ToolResultRenderer = NonNullable<ToolDefinition["renderResult"]>;
|
|
5
5
|
type ToolRenderResultArgs = Parameters<ToolResultRenderer>;
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
getErrorMessage,
|
|
10
10
|
parseSubagentIntercomPayload,
|
|
11
11
|
} from "./intercom-utils.js";
|
|
12
|
+
import { DeliveredMessageCache } from "./broker/delivered-message-cache.js";
|
|
13
|
+
import { buildSendSignature } from "./broker/send-signature.js";
|
|
12
14
|
|
|
13
15
|
interface SubagentRelayDeps {
|
|
14
16
|
runtimeGeneration(): number;
|
|
@@ -23,6 +25,7 @@ interface SubagentRelayDeps {
|
|
|
23
25
|
|
|
24
26
|
export function registerSubagentRelay(pi: ExtensionAPI, deps: SubagentRelayDeps): void {
|
|
25
27
|
const { getLiveContext, currentSessionTargetMatches, sendIncomingMessage, ensureConnected, resolveSessionTarget } = deps;
|
|
28
|
+
const localDeliveries = new DeliveredMessageCache();
|
|
26
29
|
function deliverLocalSubagentRelayMessage(sender: "subagent-control" | "subagent-result", status: string, messageText: string): void {
|
|
27
30
|
const now = Date.now();
|
|
28
31
|
sendIncomingMessage({
|
|
@@ -60,6 +63,37 @@ export function registerSubagentRelay(pi: ExtensionAPI, deps: SubagentRelayDeps)
|
|
|
60
63
|
...(error ? { error: getErrorMessage(error) } : {}),
|
|
61
64
|
});
|
|
62
65
|
}
|
|
66
|
+
function acknowledgeResult(options: { acknowledge?: boolean }, requestId: string | undefined, delivered: boolean, error?: unknown): void {
|
|
67
|
+
if (options.acknowledge) emitResultDelivery(requestId, delivered, error);
|
|
68
|
+
}
|
|
69
|
+
function deliverLocal(
|
|
70
|
+
parsed: ReturnType<typeof parseSubagentIntercomPayload> & {},
|
|
71
|
+
options: { sender: "subagent-control" | "subagent-result"; status: string; errorEntryType: string; acknowledge?: boolean },
|
|
72
|
+
): void {
|
|
73
|
+
try {
|
|
74
|
+
const signature = buildSendSignature(parsed.to, { text: parsed.message });
|
|
75
|
+
const match = parsed.requestId ? localDeliveries.lookup(parsed.requestId, signature) : "miss";
|
|
76
|
+
if (match === "conflict") {
|
|
77
|
+
throw new Error(`Intercom message ID '${parsed.requestId}' was already delivered with a different target or payload`);
|
|
78
|
+
}
|
|
79
|
+
if (match === "miss") {
|
|
80
|
+
deliverLocalSubagentRelayMessage(options.sender, options.status, parsed.message);
|
|
81
|
+
if (parsed.requestId) localDeliveries.record(parsed.requestId, signature);
|
|
82
|
+
}
|
|
83
|
+
acknowledgeResult(options, parsed.requestId, true);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
try {
|
|
86
|
+
recordSubagentDeliveryError(options.errorEntryType, parsed.to, parsed.message, error);
|
|
87
|
+
} catch (recordError) {
|
|
88
|
+
console.error("Failed to record local subagent relay error:", recordError);
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
acknowledgeResult(options, parsed.requestId, false, error);
|
|
92
|
+
} catch (ackError) {
|
|
93
|
+
console.error("Failed to acknowledge local subagent relay error:", ackError);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
63
97
|
function relaySubagentIntercomPayload(payload: unknown, options: {
|
|
64
98
|
sender: "subagent-control" | "subagent-result";
|
|
65
99
|
status: string;
|
|
@@ -73,11 +107,11 @@ export function registerSubagentRelay(pi: ExtensionAPI, deps: SubagentRelayDeps)
|
|
|
73
107
|
void (async () => {
|
|
74
108
|
const relayStillLive = () => !deps.runtimeStarted() || Boolean(getLiveContext(deps.runtimeContext(), relayGeneration));
|
|
75
109
|
if (!relayStillLive()) {
|
|
110
|
+
acknowledgeResult(options, parsed.requestId, false);
|
|
76
111
|
return;
|
|
77
112
|
}
|
|
78
113
|
if (currentSessionTargetMatches(parsed.to)) {
|
|
79
|
-
|
|
80
|
-
if (options.acknowledge) emitResultDelivery(parsed.requestId, true);
|
|
114
|
+
deliverLocal(parsed, options);
|
|
81
115
|
return;
|
|
82
116
|
}
|
|
83
117
|
|
|
@@ -87,35 +121,47 @@ export function registerSubagentRelay(pi: ExtensionAPI, deps: SubagentRelayDeps)
|
|
|
87
121
|
activeClient = await ensureConnected("background");
|
|
88
122
|
target = await resolveSessionTarget(activeClient, parsed.to) ?? parsed.to;
|
|
89
123
|
} catch (error) {
|
|
90
|
-
if (!relayStillLive())
|
|
124
|
+
if (!relayStillLive()) {
|
|
125
|
+
acknowledgeResult(options, parsed.requestId, false, error);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
91
128
|
recordSubagentDeliveryError(options.errorEntryType, parsed.to, parsed.message, error);
|
|
92
|
-
|
|
129
|
+
acknowledgeResult(options, parsed.requestId, false, error);
|
|
93
130
|
return;
|
|
94
131
|
}
|
|
95
132
|
|
|
96
133
|
if (!relayStillLive()) {
|
|
134
|
+
acknowledgeResult(options, parsed.requestId, false);
|
|
97
135
|
return;
|
|
98
136
|
}
|
|
99
137
|
if (currentSessionTargetMatches(parsed.to, target, activeClient)) {
|
|
100
|
-
|
|
101
|
-
if (options.acknowledge) emitResultDelivery(parsed.requestId, true);
|
|
138
|
+
deliverLocal(parsed, options);
|
|
102
139
|
return;
|
|
103
140
|
}
|
|
104
141
|
|
|
105
142
|
try {
|
|
106
|
-
const result = await activeClient.send(target, {
|
|
107
|
-
|
|
143
|
+
const result = await activeClient.send(target, {
|
|
144
|
+
text: parsed.message,
|
|
145
|
+
...(parsed.requestId ? { messageId: parsed.requestId } : {}),
|
|
146
|
+
});
|
|
147
|
+
if (!relayStillLive()) {
|
|
148
|
+
acknowledgeResult(options, parsed.requestId, result.delivered);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
108
151
|
if (!result.delivered) {
|
|
109
152
|
const error = new Error(result.reason ?? "Session may not exist or has disconnected.");
|
|
110
153
|
recordSubagentDeliveryError(options.errorEntryType, parsed.to, parsed.message, error);
|
|
111
|
-
|
|
154
|
+
acknowledgeResult(options, parsed.requestId, false, error);
|
|
112
155
|
return;
|
|
113
156
|
}
|
|
114
|
-
|
|
157
|
+
acknowledgeResult(options, parsed.requestId, true);
|
|
115
158
|
} catch (error) {
|
|
116
|
-
if (!relayStillLive())
|
|
159
|
+
if (!relayStillLive()) {
|
|
160
|
+
acknowledgeResult(options, parsed.requestId, false, error);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
117
163
|
recordSubagentDeliveryError(options.errorEntryType, parsed.to, parsed.message, error);
|
|
118
|
-
|
|
164
|
+
acknowledgeResult(options, parsed.requestId, false, error);
|
|
119
165
|
}
|
|
120
166
|
})();
|
|
121
167
|
}
|
|
@@ -31,7 +31,7 @@ export type ClientMessage =
|
|
|
31
31
|
| { type: "register"; session: Omit<SessionInfo, "id"> }
|
|
32
32
|
| { type: "unregister" }
|
|
33
33
|
| { type: "list"; requestId: string }
|
|
34
|
-
| { type: "send"; to: string; message: Message }
|
|
34
|
+
| { type: "send"; to: string; message: Message; attemptId?: string }
|
|
35
35
|
| { type: "presence"; name?: string; status?: string; model?: string };
|
|
36
36
|
|
|
37
37
|
export type BrokerMessage =
|
|
@@ -42,5 +42,5 @@ export type BrokerMessage =
|
|
|
42
42
|
| { type: "session_joined"; session: SessionInfo }
|
|
43
43
|
| { type: "session_left"; sessionId: string }
|
|
44
44
|
| { type: "error"; error: string }
|
|
45
|
-
| { type: "delivered"; messageId: string }
|
|
46
|
-
| { type: "delivery_failed"; messageId: string; reason: string };
|
|
45
|
+
| { type: "delivered"; messageId: string; attemptId?: string }
|
|
46
|
+
| { type: "delivery_failed"; messageId: string; reason: string; attemptId?: string };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Component, TUI } from "@
|
|
2
|
-
import { truncateToWidth, visibleWidth } from "@
|
|
1
|
+
import type { Component, TUI } from "@earendil-works/pi-tui";
|
|
2
|
+
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
3
3
|
import type { KeybindingsManager, Theme } from "@bastani/atomic";
|
|
4
4
|
import type { IntercomClient } from "../broker/client.js";
|
|
5
5
|
import type { SessionInfo } from "../types.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Component } from "@
|
|
2
|
-
import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@
|
|
1
|
+
import type { Component } from "@earendil-works/pi-tui";
|
|
2
|
+
import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
3
3
|
import type { Theme } from "@bastani/atomic";
|
|
4
4
|
import type { SessionInfo, Message } from "../types.js";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Component } from "@
|
|
2
|
-
import { truncateToWidth, visibleWidth } from "@
|
|
1
|
+
import type { Component } from "@earendil-works/pi-tui";
|
|
2
|
+
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
3
3
|
import type { KeybindingsManager, Theme } from "@bastani/atomic";
|
|
4
4
|
import type { SessionInfo } from "../types.js";
|
|
5
5
|
|
|
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.9.5-alpha.10] - 2026-07-11
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Aligned the MCP extension peer dependencies with upstream `pi-ai`/`pi-tui` `^0.80.6` as part of the consolidated Pi sync; no MCP source behavior changed ([#1703](https://github.com/bastani-inc/atomic/issues/1703)).
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Replaced one-shot detached MCP startup with generation-safe, retryable single-flight initialization shared by background startup, proxy/direct tools, and readiness-critical commands. Initialization fast paths now validate the active context and exact session lease, commands retain the state they initialized across lazy module imports, and stale or unpublished state cannot execute or publish after shutdown, restart, or context disposal. Replacement startup normally waits for retired initialization plus state/OAuth cleanup, but bounded observed teardown prevents non-abortable SDK work from permanently poisoning later sessions while fencing late completion.
|
|
19
|
+
- Made readiness, lazy-connection, manager-close, and UI-start waits caller-local across direct tools and proxy connect/call/search/describe/list paths. Pre-aborted calls start no producer; one aborted waiter rejects promptly with its exact reason; late shared failures stay observed; late UI runtimes are closed; and proxy modes plus metadata hydration revalidate session ownership after waits and before metadata mutation or SDK side effects.
|
|
20
|
+
- Completed MCP Apps cancellation lifecycles for direct and proxy UI calls by emitting exactly one terminal `tool-cancelled` before session teardown, preserving the exact host abort reason over SDK wrappers, isolating notification failures, keeping success `tool-result` mutually exclusive, forwarding real cancellation events from reused runtimes, and observing asynchronous browser AppBridge send failures.
|
|
21
|
+
|
|
22
|
+
## [0.9.5-alpha.9] - 2026-07-09
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- Improved startup responsiveness by keeping first-run/default lazy MCP metadata bootstrap out of `initializeMcp()`'s synchronous path. Cached direct tools and the MCP proxy still register immediately, explicit `eager`/`keep-alive` servers still connect during initialization, missing configured or `MCP_DIRECT_TOOLS`-selected direct-tool metadata is warmed in the background, and explicit proxy `search`, `describe`, and server-list requests hydrate cold-cache lazy server metadata on demand instead of broadening startup warmup. Warmed direct tools are registered live in the current session after metadata refresh rather than requiring restart. Cold-cache `describe` first narrows hydration to prefix-matched or explicitly requested servers, treats hyphen/underscore prefixes as aliases, and does not fan out to unrelated lazy servers after a prefix-directed miss; cold-cache proxy `search` intentionally hydrates all matching lazy servers so unscoped searches can see every configured tool.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Aligned MCP tool result expansion hints with the CLI-wide `Ctrl+o` keybinding copy.
|
|
31
|
+
- Fixed MCP background direct-tool warmup cancellation so stale in-flight connects are discarded before metadata/cache mutation, direct-tool refresh callbacks are guarded to the active session, completed warmups clear their active handle safely, and env-selected direct tool servers hydrate without forcing every lazy server eager.
|
|
32
|
+
|
|
10
33
|
## [0.9.4] - 2026-07-03
|
|
11
34
|
|
|
12
35
|
### Changed
|
|
@@ -191,6 +191,7 @@ A Node.js HTTP server runs on `localhost` at path `/callback`:
|
|
|
191
191
|
- Displays success/error HTML pages
|
|
192
192
|
- Validates state parameter for CSRF protection
|
|
193
193
|
- Has a 5-minute timeout for pending authorizations
|
|
194
|
+
- Rejects and removes pending authorization waiters during session restart/shutdown before replacement-session startup continues
|
|
194
195
|
|
|
195
196
|
## Token Storage
|
|
196
197
|
|