@code-yeongyu/senpi 2026.8.14 → 2026.8.17
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 +128 -0
- package/README.md +1 -0
- package/dist/bun/cli.js +1 -0
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/register-cursor-agent.d.ts +2 -0
- package/dist/bun/register-cursor-agent.d.ts.map +1 -0
- package/dist/bun/register-cursor-agent.js +4 -0
- package/dist/bun/register-cursor-agent.js.map +1 -0
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +14 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-command.d.ts.map +1 -1
- package/dist/cli/auth-command.js +5 -4
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/core/agent-session-services.js +2 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +127 -13
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +420 -82
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +19 -8
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/cursor-exec-bridge-session.d.ts +11 -0
- package/dist/core/cursor-exec-bridge-session.d.ts.map +1 -0
- package/dist/core/cursor-exec-bridge-session.js +17 -0
- package/dist/core/cursor-exec-bridge-session.js.map +1 -0
- package/dist/core/cursor-exec-bridge.d.ts +52 -0
- package/dist/core/cursor-exec-bridge.d.ts.map +1 -0
- package/dist/core/cursor-exec-bridge.js +196 -0
- package/dist/core/cursor-exec-bridge.js.map +1 -0
- package/dist/core/experimental.d.ts +4 -0
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js +4 -0
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/export-html/template.js +31 -9
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-environment.d.ts +4 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-environment.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-environment.js +30 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-environment.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.d.ts +2 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.js +13 -47
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/availability.d.ts +18 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/availability.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/availability.js +64 -2
- package/dist/core/extensions/builtin/claude-sdk-oauth/availability.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/config-dir-credentials.d.ts +3 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/config-dir-credentials.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/config-dir-credentials.js +27 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/config-dir-credentials.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.d.ts +15 -2
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js +45 -11
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js +17 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +48 -6
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/log.d.ts +1 -1
- package/dist/core/extensions/builtin/compaction/log.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/log.js +2 -0
- package/dist/core/extensions/builtin/compaction/log.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/overflow-retry.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/overflow-retry.js +38 -4
- package/dist/core/extensions/builtin/compaction/overflow-retry.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +2 -1
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/summarization-turn-order.d.ts +33 -0
- package/dist/core/extensions/builtin/compaction/summarization-turn-order.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/summarization-turn-order.js +67 -0
- package/dist/core/extensions/builtin/compaction/summarization-turn-order.js.map +1 -0
- package/dist/core/extensions/builtin/config-reload/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/config-reload/index.js +31 -8
- package/dist/core/extensions/builtin/config-reload/index.js.map +1 -1
- package/dist/core/extensions/builtin/config-reload/routine-settings.d.ts.map +1 -1
- package/dist/core/extensions/builtin/config-reload/routine-settings.js +11 -12
- package/dist/core/extensions/builtin/config-reload/routine-settings.js.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/account-command.d.ts +28 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/account-command.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/account-command.js +278 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/account-command.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/accounts.d.ts +38 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/accounts.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/accounts.js +75 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/accounts.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/affinity.d.ts +24 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/affinity.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/affinity.js +64 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/affinity.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/diagnostics.d.ts +139 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/diagnostics.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/diagnostics.js +362 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/diagnostics.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/errors.d.ts +19 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/errors.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/errors.js +122 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/errors.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/executable.d.ts +30 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/executable.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/executable.js +117 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/executable.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/failover.d.ts +39 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/failover.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/failover.js +155 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/failover.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/guardrails.d.ts +89 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/guardrails.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/guardrails.js +147 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/guardrails.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/home-store.d.ts +20 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/home-store.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/home-store.js +99 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/home-store.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/index.d.ts +25 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/index.js +67 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/index.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.d.ts +27 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js +242 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.d.ts +73 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.js +330 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/session-router.d.ts +94 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/session-router.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/session-router.js +248 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/session-router.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/settings.d.ts +35 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/settings.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/settings.js +186 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/settings.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/spawn-args.d.ts +11 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/spawn-args.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/spawn-args.js +17 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/spawn-args.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/stream-parser.d.ts +104 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/stream-parser.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/stream-parser.js +301 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/stream-parser.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/stream.d.ts +26 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/stream.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/stream.js +587 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/stream.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/transport.d.ts +43 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/transport.d.ts.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/transport.js +196 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/transport.js.map +1 -0
- package/dist/core/extensions/builtin/goal/channel-state-subscriptions.d.ts +9 -0
- package/dist/core/extensions/builtin/goal/channel-state-subscriptions.d.ts.map +1 -0
- package/dist/core/extensions/builtin/goal/channel-state-subscriptions.js +18 -0
- package/dist/core/extensions/builtin/goal/channel-state-subscriptions.js.map +1 -0
- package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.js +10 -9
- package/dist/core/extensions/builtin/goal/monitor-continuation.js.map +1 -1
- package/dist/core/extensions/builtin/goal/terminal-provider-error.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/terminal-provider-error.js +16 -0
- package/dist/core/extensions/builtin/goal/terminal-provider-error.js.map +1 -1
- package/dist/core/extensions/builtin/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +9 -2
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/detectors.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/detectors.js +21 -3
- package/dist/core/extensions/builtin/loop-guard/detectors.js.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/escalation.d.ts +24 -0
- package/dist/core/extensions/builtin/loop-guard/escalation.d.ts.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/escalation.js +77 -0
- package/dist/core/extensions/builtin/loop-guard/escalation.js.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/index.js +98 -3
- package/dist/core/extensions/builtin/loop-guard/index.js.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/notice.d.ts +9 -0
- package/dist/core/extensions/builtin/loop-guard/notice.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/notice.js +17 -0
- package/dist/core/extensions/builtin/loop-guard/notice.js.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/policy.d.ts +4 -0
- package/dist/core/extensions/builtin/loop-guard/policy.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/policy.js +4 -0
- package/dist/core/extensions/builtin/loop-guard/policy.js.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/renderer.d.ts +2 -0
- package/dist/core/extensions/builtin/loop-guard/renderer.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/renderer.js +11 -0
- package/dist/core/extensions/builtin/loop-guard/renderer.js.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/tracker.d.ts +1 -1
- package/dist/core/extensions/builtin/loop-guard/tracker.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/tracker.js +3 -1
- package/dist/core/extensions/builtin/loop-guard/tracker.js.map +1 -1
- package/dist/core/extensions/builtin/mcp/process-tree.js +6 -1
- package/dist/core/extensions/builtin/mcp/process-tree.js.map +1 -1
- package/dist/core/extensions/builtin/monitor-state-event.d.ts +6 -0
- package/dist/core/extensions/builtin/monitor-state-event.d.ts.map +1 -1
- package/dist/core/extensions/builtin/monitor-state-event.js +10 -0
- package/dist/core/extensions/builtin/monitor-state-event.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.js +14 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/grok-4.6.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/grok-4.6.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/grok-4.6.js +91 -0
- package/dist/core/extensions/builtin/prompt-preset/grok-4.6.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/index.js +22 -2
- package/dist/core/extensions/builtin/prompt-preset/index.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +25 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.js +2 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
- package/dist/core/extensions/builtin/reasoning/index.d.ts +3 -0
- package/dist/core/extensions/builtin/reasoning/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/reasoning/index.js +211 -0
- package/dist/core/extensions/builtin/reasoning/index.js.map +1 -0
- package/dist/core/extensions/builtin/service-tier.d.ts +44 -1
- package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
- package/dist/core/extensions/builtin/service-tier.js +176 -24
- package/dist/core/extensions/builtin/service-tier.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +4 -4
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +12 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/keybindings.d.ts +24 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/lockfile-policy.d.ts +15 -0
- package/dist/core/lockfile-policy.d.ts.map +1 -0
- package/dist/core/lockfile-policy.js +15 -0
- package/dist/core/lockfile-policy.js.map +1 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +1 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver.d.ts +34 -7
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +116 -28
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +7 -2
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +19 -5
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +5 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +8 -9
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-api-key-auth.d.ts.map +1 -1
- package/dist/core/provider-api-key-auth.js +45 -2
- package/dist/core/provider-api-key-auth.js.map +1 -1
- package/dist/core/provider-composer.d.ts +12 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +2 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +13 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +15 -0
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/retry-fallback/controller.d.ts +1 -1
- package/dist/core/retry-fallback/controller.d.ts.map +1 -1
- package/dist/core/retry-fallback/controller.js +5 -3
- package/dist/core/retry-fallback/controller.js.map +1 -1
- package/dist/core/sdk.d.ts +5 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +20 -8
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +20 -4
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +50 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +258 -15
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.js +1 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/thinking-levels.d.ts +22 -0
- package/dist/core/thinking-levels.d.ts.map +1 -1
- package/dist/core/thinking-levels.js +29 -0
- package/dist/core/thinking-levels.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +2 -0
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +2 -0
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.js +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +2 -0
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +2 -0
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +18 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/model-favorites.d.ts +2 -1
- package/dist/modes/interactive/components/model-favorites.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-favorites.js +72 -6
- package/dist/modes/interactive/components/model-favorites.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +5 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +10 -6
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +10 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +22 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/editor-paste-transfer.d.ts +10 -0
- package/dist/modes/interactive/editor-paste-transfer.d.ts.map +1 -1
- package/dist/modes/interactive/editor-paste-transfer.js +16 -0
- package/dist/modes/interactive/editor-paste-transfer.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +14 -4
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +111 -52
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.js +36 -0
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +2 -0
- package/dist/modes/interactive/theme/grok-day.json +2 -0
- package/dist/modes/interactive/theme/grok-night.json +2 -0
- package/dist/modes/interactive/theme/light.json +2 -0
- package/dist/modes/interactive/theme/theme-controller.d.ts +10 -2
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +23 -10
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +9 -1
- package/dist/modes/interactive/theme/theme.d.ts +5 -3
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +12 -2
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts +4 -1
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js +5 -2
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts +10 -0
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +119 -46
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/jsonl.d.ts +6 -1
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.js +47 -14
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/multi-session-host.d.ts.map +1 -1
- package/dist/modes/rpc/multi-session-host.js +29 -7
- package/dist/modes/rpc/multi-session-host.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +26 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +25 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-invocation.d.ts +5 -0
- package/dist/modes/rpc/rpc-command-invocation.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-command-invocation.js +2 -0
- package/dist/modes/rpc/rpc-command-invocation.js.map +1 -0
- package/dist/modes/rpc/rpc-command-surface.d.ts +49 -0
- package/dist/modes/rpc/rpc-command-surface.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-command-surface.js +40 -0
- package/dist/modes/rpc/rpc-command-surface.js.map +1 -0
- package/dist/modes/rpc/rpc-input-validation.d.ts +4 -0
- package/dist/modes/rpc/rpc-input-validation.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-input-validation.js +20 -0
- package/dist/modes/rpc/rpc-input-validation.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +12 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +72 -12
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
- package/dist/modes/rpc/session-command-router.js +2 -14
- package/dist/modes/rpc/session-command-router.js.map +1 -1
- package/dist/modes/rpc/session-event-writer.d.ts +29 -10
- package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-writer.js +229 -50
- package/dist/modes/rpc/session-event-writer.js.map +1 -1
- package/dist/server/create-harness.d.ts.map +1 -1
- package/dist/server/create-harness.js +2 -0
- package/dist/server/create-harness.js.map +1 -1
- package/dist/utils/shell.d.ts +27 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +79 -13
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +10 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +14 -19
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/compaction.md +3 -3
- package/docs/custom-provider.md +1 -1
- package/docs/environment-variables.md +8 -2
- package/docs/extensions.md +4 -0
- package/docs/json.md +6 -4
- package/docs/keybindings.md +8 -2
- package/docs/providers.md +56 -0
- package/docs/rpc.md +206 -12
- package/docs/sdk.md +9 -0
- package/docs/settings.md +93 -1
- package/docs/skills.md +14 -3
- package/docs/terminal-setup.md +23 -2
- package/docs/themes.md +24 -3
- package/docs/tui.md +2 -2
- package/docs/usage.md +24 -4
- package/examples/extensions/subagent/agents.ts +40 -9
- package/examples/extensions/subagent/index.ts +26 -3
- package/node_modules/@bufbuild/protobuf/README.md +44 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/clone.d.ts +6 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/clone.js +66 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/boot.d.ts +1 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/boot.js +18 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/enum.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/enum.js +31 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/extension.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/extension.js +28 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/file.d.ts +1 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/file.js +18 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/index.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/index.js +39 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/message.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/message.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/service.d.ts +8 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/service.js +27 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/symbols.d.ts +140 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/symbols.js +43 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/types.d.ts +79 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/types.js +15 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/boot.d.ts +63 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/boot.js +105 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/embed.d.ts +43 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/embed.js +244 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/enum.d.ts +29 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/enum.js +58 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/extension.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/extension.js +28 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/file.d.ts +7 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/file.js +35 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/index.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/index.js +39 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/message.d.ts +15 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/message.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/restore-json-names.d.ts +5 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/restore-json-names.js +29 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/scalar.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/scalar.js +67 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/service.d.ts +8 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/service.js +27 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/symbols.d.ts +145 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/symbols.js +74 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/types.d.ts +85 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/types.js +15 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/create.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/create.js +259 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/descriptors.d.ts +634 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/descriptors.js +53 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/equals.d.ts +46 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/equals.js +209 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/extensions.d.ts +60 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/extensions.js +168 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/fields.d.ts +23 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/fields.js +45 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/from-binary.d.ts +48 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/from-binary.js +247 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/from-json.d.ts +73 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/from-json.js +739 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/index.d.ts +19 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/index.js +55 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/is-message.d.ts +7 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/is-message.js +33 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/json-value.d.ts +16 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/json-value.js +15 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/merge.d.ts +13 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/merge.js +70 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/package.json +4 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/proto-int64.d.ts +98 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/proto-int64.js +131 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/error.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/error.js +36 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/guard.d.ts +20 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/guard.js +78 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/index.d.ts +8 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/index.js +41 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/names.d.ts +30 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/names.js +115 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/nested-types.d.ts +35 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/nested-types.js +110 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/path.d.ts +107 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/path.js +376 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-check.d.ts +19 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-check.js +268 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-types.d.ts +217 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-types.js +16 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect.d.ts +43 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect.js +546 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/scalar.d.ts +43 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/scalar.js +129 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/unsafe.d.ts +39 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/unsafe.js +149 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/registry.d.ts +98 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/registry.js +945 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/to-binary.d.ts +24 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/to-binary.js +199 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/to-json.d.ts +67 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/to-json.js +391 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/from-text.d.ts +35 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/from-text.js +684 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/index.d.ts +4 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/index.js +21 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/is-group-like.d.ts +19 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/is-group-like.js +47 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/reader.d.ts +91 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/reader.js +481 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/to-text.d.ts +34 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/to-text.js +358 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/writer.d.ts +76 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/writer.js +220 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/types.d.ts +135 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/types.js +15 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/unknown-enum.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/unknown-enum.js +26 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/base64-encoding.d.ts +23 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/base64-encoding.js +156 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/binary-encoding.d.ts +268 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/binary-encoding.js +530 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/index.d.ts +5 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/index.js +34 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/size-delimited.d.ts +69 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/size-delimited.js +191 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-encoding.d.ts +28 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-encoding.js +61 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-format.d.ts +13 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-format.js +199 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/varint.d.ts +70 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/varint.js +322 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/any.d.ts +38 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/any.js +75 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/duration.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/duration.js +39 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/any_pb.d.ts +238 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/any_pb.js +27 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/api_pb.d.ts +537 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/api_pb.js +39 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +490 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/compiler/plugin_pb.js +68 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/cpp_features_pb.d.ts +91 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/cpp_features_pb.js +60 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +4143 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/descriptor_pb.js +892 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/duration_pb.d.ts +161 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/duration_pb.js +27 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/empty_pb.d.ts +39 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/empty_pb.js +27 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/field_mask_pb.d.ts +424 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/field_mask_pb.js +27 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/go_features_pb.d.ts +189 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/go_features_pb.js +126 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/java_features_pb.d.ts +194 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/java_features_pb.js +106 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/source_context_pb.d.ts +43 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/source_context_pb.js +27 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/struct_pb.d.ts +195 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/struct_pb.js +59 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/timestamp_pb.d.ts +222 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/timestamp_pb.js +27 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/type_pb.d.ts +722 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/type_pb.js +242 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/wrappers_pb.d.ts +330 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/wrappers_pb.js +67 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/index.d.ts +19 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/index.js +48 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/timestamp.d.ts +21 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/timestamp.js +57 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/wrappers.d.ts +25 -0
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/wrappers.js +66 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/clone.d.ts +6 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/clone.js +63 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/boot.d.ts +1 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/boot.js +14 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/enum.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/enum.js +26 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/extension.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/extension.js +25 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/file.d.ts +1 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/file.js +14 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/index.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/index.js +23 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/message.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/message.js +21 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/service.d.ts +8 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/service.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/symbols.d.ts +140 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/symbols.js +40 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/types.d.ts +79 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/types.js +14 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.d.ts +63 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.js +101 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/embed.d.ts +43 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/embed.js +239 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/enum.d.ts +29 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/enum.js +53 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/extension.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/extension.js +25 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.d.ts +7 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js +32 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.js +23 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/message.d.ts +15 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/message.js +21 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/restore-json-names.d.ts +5 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/restore-json-names.js +26 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/scalar.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/scalar.js +63 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/service.d.ts +8 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/service.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/symbols.d.ts +145 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/symbols.js +71 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/types.d.ts +85 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/types.js +14 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/create.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/create.js +256 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/descriptors.d.ts +634 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/descriptors.js +50 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/equals.d.ts +46 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/equals.js +206 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/extensions.d.ts +60 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/extensions.js +159 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/fields.d.ts +23 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/fields.js +41 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.d.ts +48 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +241 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/from-json.d.ts +73 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +731 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/index.d.ts +19 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/index.js +29 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/is-message.d.ts +7 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/is-message.js +30 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/json-value.d.ts +16 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/json-value.js +14 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/merge.d.ts +13 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/merge.js +67 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/package.json +4 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/proto-int64.d.ts +98 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js +128 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/error.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/error.js +31 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.d.ts +20 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.js +71 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/index.d.ts +8 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/index.js +21 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/names.d.ts +30 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/names.js +109 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/nested-types.d.ts +35 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/nested-types.js +105 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/path.d.ts +107 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/path.js +369 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.d.ts +19 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.js +262 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-types.d.ts +217 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-types.js +14 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.d.ts +43 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +541 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/scalar.d.ts +43 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/scalar.js +124 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/unsafe.d.ts +39 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/unsafe.js +140 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/registry.d.ts +98 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +939 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/to-binary.d.ts +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/to-binary.js +195 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/to-json.d.ts +67 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +386 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/from-text.d.ts +35 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/from-text.js +680 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/index.d.ts +4 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/index.js +15 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/is-group-like.d.ts +19 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/is-group-like.js +44 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/reader.d.ts +91 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/reader.js +477 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/to-text.d.ts +34 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/to-text.js +355 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/writer.d.ts +76 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/writer.js +214 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/types.d.ts +135 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/types.js +14 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/unknown-enum.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/unknown-enum.js +23 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.d.ts +23 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.js +152 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.d.ts +268 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +525 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/index.d.ts +5 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/index.js +18 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/size-delimited.d.ts +69 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/size-delimited.js +186 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.d.ts +28 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +57 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-format.d.ts +13 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-format.js +195 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/varint.d.ts +70 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js +313 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/any.d.ts +38 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/any.js +69 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/duration.d.ts +9 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/duration.js +35 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/any_pb.d.ts +238 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/any_pb.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +537 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.js +36 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +490 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js +65 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/cpp_features_pb.d.ts +91 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/cpp_features_pb.js +57 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +4143 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +888 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/duration_pb.d.ts +161 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/duration_pb.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/empty_pb.d.ts +39 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/empty_pb.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.d.ts +424 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.d.ts +189 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +123 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/java_features_pb.d.ts +194 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/java_features_pb.js +103 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/source_context_pb.d.ts +43 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/source_context_pb.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/struct_pb.d.ts +195 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/struct_pb.js +56 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.d.ts +222 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.d.ts +722 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.js +239 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/wrappers_pb.d.ts +330 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/wrappers_pb.js +64 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/index.d.ts +19 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/index.js +32 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/timestamp.d.ts +21 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/timestamp.js +50 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.d.ts +25 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js +61 -0
- package/node_modules/@bufbuild/protobuf/package.json +147 -0
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +28 -0
- package/node_modules/@code-yeongyu/senpi-codemode/README.md +5 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +14 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/call-capture.ts +64 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-handler.ts +45 -61
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-runtime.ts +8 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-execution-event.ts +201 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool-options.ts +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +22 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +43 -6
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +59 -17
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +14 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +14 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts +25 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +77 -12
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.d.ts +43 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js +67 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/events.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.d.ts +4 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js +127 -88
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.d.ts +5 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js +9 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/errors.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts +12 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js +88 -45
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/repo.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js +28 -19
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/storage.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +6 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +7 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/state.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js +19 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/testing/conformance.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts +18 -5
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +4 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/search/index.d.ts +21 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/search/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/search/index.js +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/search/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.d.ts +29 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js +103 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/search/scanning.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +12 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/README.md +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +40 -14
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +16 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.d.ts +69 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js +159 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cloudflare-gateway-binding.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js +125 -5
- package/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/deterministic-id.d.ts +17 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/deterministic-id.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/deterministic-id.js +14 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/deterministic-id.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-lifecycle.d.ts +13 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-lifecycle.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-lifecycle.js +33 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-lifecycle.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-modern.d.ts +79 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-modern.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-modern.js +360 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-modern.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/gen/agent_pb.d.ts +16797 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/gen/agent_pb.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/gen/agent_pb.js +3828 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/gen/agent_pb.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/pi-args.d.ts +55 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/pi-args.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/pi-args.js +76 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/pi-args.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/types.d.ts +116 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/types.js +16 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/types.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts +191 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +3316 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.lazy.d.ts +29 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.lazy.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.lazy.js +33 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.lazy.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +7 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +13 -9
- package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +7 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +208 -42
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +13 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +10 -7
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +31 -7
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +8 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/cursor.d.ts +16 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/cursor.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/cursor.js +234 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/cursor.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js +6 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +44 -9
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat.js +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor-agent-provider.d.ts +11 -0
- package/node_modules/@earendil-works/pi-ai/dist/cursor-agent-provider.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/cursor-agent-provider.js +11 -0
- package/node_modules/@earendil-works/pi-ai/dist/cursor-agent-provider.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/model.d.ts +6 -1
- package/node_modules/@earendil-works/pi-ai/dist/model.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/model.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.d.ts +12 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js +65 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/alibaba-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/deepseek.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +17 -4
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/block-symbols.d.ts +57 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/block-symbols.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/block-symbols.js +57 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/block-symbols.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +10 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +22 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.js +12 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/pi-user-agent.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/validation.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js +34 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/validation.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +3 -2
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/README.md +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.d.ts +26 -0
- package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.js +121 -0
- package/node_modules/@earendil-works/pi-tui/dist/alt-screen-search.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +21 -0
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts +6 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js +23 -7
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/dollar-invocation-autocomplete.d.ts +9 -0
- package/node_modules/@earendil-works/pi-tui/dist/dollar-invocation-autocomplete.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/dollar-invocation-autocomplete.js +82 -0
- package/node_modules/@earendil-works/pi-tui/dist/dollar-invocation-autocomplete.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +4 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +7 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +30 -0
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +24 -0
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/layout.js +9 -2
- package/node_modules/@earendil-works/pi-tui/dist/layout.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +8 -2
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +6 -2
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +6 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +18 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +21 -0
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +243 -5
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +2 -0
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +33 -8
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +11 -8
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search.d.ts +0 -19
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search.js +0 -41
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search.js.map +0 -1
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { emitProviderAccountsChanged } from "../claude-sdk-oauth/account-events.js";
|
|
2
|
+
import { emptyCredential, listAccounts, pinAccount, removeAccount, } from "./accounts.js";
|
|
3
|
+
import { selectAccount } from "./affinity.js";
|
|
4
|
+
import { collectCursorCliStatus, NATIVE_CURSOR_PROVIDER_ID, registerCursorCliShutdownSafety, renderCursorCliStatus, } from "./diagnostics.js";
|
|
5
|
+
import { CURSOR_CLI_OAUTH_PROVIDER_ID, confirmCursorCliNoApprovalAcknowledgement, importLocalCursorCredential, } from "./oauth-login.js";
|
|
6
|
+
import { cursorCliSessionRouter } from "./session-router.js";
|
|
7
|
+
import { loadCursorCliOauthProviderSettingsFromDisk, persistCursorCliNoApprovalAcknowledgement, } from "./settings.js";
|
|
8
|
+
const USAGE = "Usage: /cursor-account [list | add | remove <name> | pin <name> | unpin | import | acknowledge | status]";
|
|
9
|
+
function asCursorCredential(value) {
|
|
10
|
+
return value !== undefined && value.type === "oauth" ? value : emptyCredential();
|
|
11
|
+
}
|
|
12
|
+
function parseArgs(rawArgs) {
|
|
13
|
+
return rawArgs.trim().split(/\s+/).filter(Boolean);
|
|
14
|
+
}
|
|
15
|
+
function slotStatus(slot, now) {
|
|
16
|
+
if (slot.blockReason === "auth_error")
|
|
17
|
+
return "blocked until re-login";
|
|
18
|
+
if (slot.blockedUntil !== undefined && slot.blockedUntil > now) {
|
|
19
|
+
return `blocked until ${new Date(slot.blockedUntil).toISOString()} (${slot.blockReason ?? "rate_limit"})`;
|
|
20
|
+
}
|
|
21
|
+
return "available";
|
|
22
|
+
}
|
|
23
|
+
function authEventMessage(event) {
|
|
24
|
+
if (event === null || typeof event !== "object")
|
|
25
|
+
return "Cursor CLI (OAuth) authentication update.";
|
|
26
|
+
const value = event;
|
|
27
|
+
if (value.type === "auth_url" && typeof value.url === "string") {
|
|
28
|
+
return `Open this URL to authorize Cursor CLI (OAuth):\n${value.url}`;
|
|
29
|
+
}
|
|
30
|
+
if (value.type === "device_code" && typeof value.verificationUri === "string") {
|
|
31
|
+
return `Open this URL to authorize Cursor CLI (OAuth):\n${value.verificationUri}`;
|
|
32
|
+
}
|
|
33
|
+
return typeof value.message === "string" ? value.message : "Cursor CLI (OAuth) authentication update.";
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Registers `/cursor-account` plus the reload/shutdown teardown for this
|
|
37
|
+
* extension generation: the command reads account state fresh from the
|
|
38
|
+
* credential store on every invocation, and every deferred continuation is
|
|
39
|
+
* fenced so a retired generation is never touched after a reload.
|
|
40
|
+
*/
|
|
41
|
+
export function registerCursorCliAccountCommand(pi, deps = {}) {
|
|
42
|
+
const loadSettings = deps.loadSettings ?? ((cwd) => loadCursorCliOauthProviderSettingsFromDisk(cwd));
|
|
43
|
+
const now = deps.now ?? Date.now;
|
|
44
|
+
// One guard per registration: a reload rebuilds the extension and gets a
|
|
45
|
+
// fresh fence, while the child registry stays process-wide.
|
|
46
|
+
const generation = registerCursorCliShutdownSafety(pi, { generation: deps.generation });
|
|
47
|
+
pi.registerCommand("cursor-account", {
|
|
48
|
+
description: "List and manage Cursor CLI (OAuth) accounts.",
|
|
49
|
+
argumentHint: "[list | add | remove <name> | pin <name> | unpin | import | acknowledge | status]",
|
|
50
|
+
handler: async (rawArgs, ctx) => {
|
|
51
|
+
try {
|
|
52
|
+
const args = parseArgs(rawArgs);
|
|
53
|
+
const action = args[0] ?? "list";
|
|
54
|
+
if (action === "list") {
|
|
55
|
+
showAccounts(ctx, loadSettings(ctx.cwd), generation, now);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (action === "add") {
|
|
59
|
+
await addAccount(ctx);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (action === "remove") {
|
|
63
|
+
await removeNamedAccount(ctx, args[1]);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (action === "pin" && args[1] !== undefined) {
|
|
67
|
+
await pinNamedAccount(ctx, args[1]);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (action === "unpin") {
|
|
71
|
+
await unpinAccount(ctx);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (action === "import") {
|
|
75
|
+
await importAccount(ctx, deps);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (action === "acknowledge") {
|
|
79
|
+
await acknowledgeNoApproval(ctx, deps, generation);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (action === "status") {
|
|
83
|
+
await showStatus(ctx, deps, { loadSettings, generation, now });
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
ctx.ui.notify(USAGE, "error");
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function showAccounts(ctx, settings, generation, now) {
|
|
95
|
+
const credential = asCursorCredential(ctx.modelRegistry.authStorage.get(CURSOR_CLI_OAUTH_PROVIDER_ID));
|
|
96
|
+
const accounts = listAccounts(credential);
|
|
97
|
+
const pinned = settings.pinnedAccount ?? credential.pinned;
|
|
98
|
+
const pinSource = settings.pinnedAccount !== undefined ? "settings" : "stored";
|
|
99
|
+
let affinityPick;
|
|
100
|
+
let affinityError;
|
|
101
|
+
if (accounts.length > 0) {
|
|
102
|
+
try {
|
|
103
|
+
affinityPick = selectAccount(accounts, {
|
|
104
|
+
sessionId: ctx.sessionManager.getSessionId(),
|
|
105
|
+
pinnedAccount: pinned,
|
|
106
|
+
now: now(),
|
|
107
|
+
}).name;
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
affinityError = error instanceof Error ? error.message : String(error);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const lines = ["Cursor CLI (OAuth) accounts:"];
|
|
114
|
+
if (accounts.length === 0)
|
|
115
|
+
lines.push(" (none)");
|
|
116
|
+
for (const account of accounts) {
|
|
117
|
+
const states = [account.name, account.source, slotStatus(account, now())];
|
|
118
|
+
if (account.name === pinned)
|
|
119
|
+
states.push("pinned");
|
|
120
|
+
if (account.name === affinityPick)
|
|
121
|
+
states.push("affinity pick");
|
|
122
|
+
lines.push(` ${states.join(" | ")}`);
|
|
123
|
+
}
|
|
124
|
+
lines.push(`Pinned account: ${pinned === undefined ? "none" : `${pinned} (${pinSource})`}`);
|
|
125
|
+
lines.push(`Affinity pick: ${affinityPick ?? (affinityError ? `unavailable - ${affinityError}` : "none")}`);
|
|
126
|
+
generation.runFencedSync(ctx, () => ctx.ui.notify(lines.join("\n"), "info"));
|
|
127
|
+
}
|
|
128
|
+
async function addAccount(ctx) {
|
|
129
|
+
if (!ctx.hasUI) {
|
|
130
|
+
ctx.ui.notify("/cursor-account add requires an interactive UI.", "error");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
await ctx.modelRegistry.modelRuntime.login(CURSOR_CLI_OAUTH_PROVIDER_ID, "oauth", {
|
|
135
|
+
signal: ctx.signal,
|
|
136
|
+
prompt: async (prompt) => {
|
|
137
|
+
const answer = await ctx.ui.input(prompt.message);
|
|
138
|
+
if (answer === undefined)
|
|
139
|
+
throw new Error("Login cancelled");
|
|
140
|
+
return answer;
|
|
141
|
+
},
|
|
142
|
+
notify: (event) => ctx.ui.notify(authEventMessage(event), "info"),
|
|
143
|
+
});
|
|
144
|
+
emitProviderAccountsChanged(CURSOR_CLI_OAUTH_PROVIDER_ID);
|
|
145
|
+
ctx.ui.notify("Cursor CLI (OAuth) account added.", "info");
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
149
|
+
if (message !== "Login cancelled") {
|
|
150
|
+
ctx.ui.notify(`Failed to add Cursor CLI (OAuth) account: ${message}`, "error");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async function removeNamedAccount(ctx, name) {
|
|
155
|
+
if (!name) {
|
|
156
|
+
ctx.ui.notify("Usage: /cursor-account remove <name>", "error");
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
let removed = false;
|
|
160
|
+
try {
|
|
161
|
+
await ctx.modelRegistry.authStorage.modify(CURSOR_CLI_OAUTH_PROVIDER_ID, async (current) => {
|
|
162
|
+
const credential = asCursorCredential(current);
|
|
163
|
+
if (!listAccounts(credential).some((account) => account.name === name))
|
|
164
|
+
return current;
|
|
165
|
+
removed = true;
|
|
166
|
+
return removeAccount(credential, name);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (!removed) {
|
|
174
|
+
ctx.ui.notify(`Cursor CLI (OAuth) account '${name}' does not exist.`, "error");
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
emitProviderAccountsChanged(CURSOR_CLI_OAUTH_PROVIDER_ID);
|
|
178
|
+
ctx.ui.notify(`Removed Cursor CLI (OAuth) account: ${name}.`, "info");
|
|
179
|
+
}
|
|
180
|
+
async function pinNamedAccount(ctx, name) {
|
|
181
|
+
try {
|
|
182
|
+
await ctx.modelRegistry.authStorage.modify(CURSOR_CLI_OAUTH_PROVIDER_ID, async (current) => {
|
|
183
|
+
const credential = asCursorCredential(current);
|
|
184
|
+
if (!listAccounts(credential).some((account) => account.name === name)) {
|
|
185
|
+
throw new Error(`Cursor CLI (OAuth) account '${name}' does not exist.`);
|
|
186
|
+
}
|
|
187
|
+
return pinAccount(credential, name);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
emitProviderAccountsChanged(CURSOR_CLI_OAUTH_PROVIDER_ID);
|
|
195
|
+
ctx.ui.notify(`Pinned Cursor CLI (OAuth) account: ${name}.`, "info");
|
|
196
|
+
}
|
|
197
|
+
async function unpinAccount(ctx) {
|
|
198
|
+
let hadPin = false;
|
|
199
|
+
try {
|
|
200
|
+
await ctx.modelRegistry.authStorage.modify(CURSOR_CLI_OAUTH_PROVIDER_ID, async (current) => {
|
|
201
|
+
const credential = asCursorCredential(current);
|
|
202
|
+
if (credential.pinned === undefined)
|
|
203
|
+
return current;
|
|
204
|
+
hadPin = true;
|
|
205
|
+
const { pinned: _pinned, ...unpinned } = credential;
|
|
206
|
+
return unpinned;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
ctx.ui.notify(error instanceof Error ? error.message : String(error), "error");
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (!hadPin) {
|
|
214
|
+
ctx.ui.notify("No stored Cursor CLI (OAuth) account pin is set.", "info");
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
emitProviderAccountsChanged(CURSOR_CLI_OAUTH_PROVIDER_ID);
|
|
218
|
+
ctx.ui.notify("Unpinned Cursor CLI (OAuth) account.", "info");
|
|
219
|
+
}
|
|
220
|
+
async function importAccount(ctx, deps) {
|
|
221
|
+
const importCredential = deps.importCredential ?? importLocalCursorCredential;
|
|
222
|
+
const importDeps = { ...deps.importDeps };
|
|
223
|
+
if (importDeps.onPrompt === undefined && ctx.hasUI) {
|
|
224
|
+
importDeps.onPrompt = async (prompt) => {
|
|
225
|
+
const answer = await ctx.ui.input(prompt.message);
|
|
226
|
+
if (answer === undefined)
|
|
227
|
+
throw new Error("Import cancelled");
|
|
228
|
+
return answer;
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
let importedName;
|
|
232
|
+
try {
|
|
233
|
+
await ctx.modelRegistry.authStorage.modify(CURSOR_CLI_OAUTH_PROVIDER_ID, async (current) => {
|
|
234
|
+
const before = asCursorCredential(current);
|
|
235
|
+
const updated = await importCredential(before, importDeps);
|
|
236
|
+
const existing = new Set(listAccounts(before).map((account) => account.name));
|
|
237
|
+
importedName = listAccounts(updated).find((account) => !existing.has(account.name))?.name;
|
|
238
|
+
return updated;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
ctx.ui.notify(`Failed to import local Cursor credential: ${error instanceof Error ? error.message : String(error)}`, "error");
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
emitProviderAccountsChanged(CURSOR_CLI_OAUTH_PROVIDER_ID);
|
|
246
|
+
ctx.ui.notify(`Imported local Cursor credential as '${importedName ?? "a new account"}' (copied into this provider's store).`, "info");
|
|
247
|
+
}
|
|
248
|
+
async function acknowledgeNoApproval(ctx, deps, generation) {
|
|
249
|
+
if (!ctx.hasUI) {
|
|
250
|
+
ctx.ui.notify("/cursor-account acknowledge requires an interactive UI.", "error");
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const persist = deps.persistAcknowledgement ?? persistCursorCliNoApprovalAcknowledgement;
|
|
254
|
+
const acknowledgedAt = await confirmCursorCliNoApprovalAcknowledgement(async (ask) => (await ctx.ui.input(ask.message)) ?? "", () => new Date((deps.now ?? Date.now)()));
|
|
255
|
+
if (acknowledgedAt === undefined) {
|
|
256
|
+
generation.runFencedSync(ctx, () => ctx.ui.notify("No acknowledgement written: unattended Cursor CLI execution stays off until you acknowledge.", "info"));
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
persist(ctx.cwd, acknowledgedAt);
|
|
260
|
+
generation.runFencedSync(ctx, () => ctx.ui.notify(`Acknowledged unattended Cursor CLI tool execution at ${acknowledgedAt}.`, "info"));
|
|
261
|
+
}
|
|
262
|
+
async function showStatus(ctx, deps, bound) {
|
|
263
|
+
// Context reads happen before any await; the render continuation is fenced
|
|
264
|
+
// so a reload during the version probe can never touch a retired context.
|
|
265
|
+
const sessionId = ctx.sessionManager.getSessionId();
|
|
266
|
+
const report = await collectCursorCliStatus({
|
|
267
|
+
sessionId,
|
|
268
|
+
settings: bound.loadSettings(ctx.cwd),
|
|
269
|
+
readCredential: () => ctx.modelRegistry.authStorage.get(CURSOR_CLI_OAUTH_PROVIDER_ID),
|
|
270
|
+
readNativeCredential: deps.readNativeCredential ?? (() => ctx.modelRegistry.authStorage.get(NATIVE_CURSOR_PROVIDER_ID)),
|
|
271
|
+
router: deps.router ?? cursorCliSessionRouter,
|
|
272
|
+
resolveExecutable: deps.resolveExecutable,
|
|
273
|
+
probeVersion: deps.probeVersion,
|
|
274
|
+
now: bound.now,
|
|
275
|
+
});
|
|
276
|
+
bound.generation.runFencedSync(ctx, () => ctx.ui.notify(renderCursorCliStatus(report), "info"));
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=account-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-command.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/account-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAGN,eAAe,EACf,YAAY,EACZ,UAAU,EACV,aAAa,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAEN,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,qBAAqB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,4BAA4B,EAC5B,yCAAyC,EACzC,2BAA2B,GAE3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAA+B,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAEN,0CAA0C,EAC1C,yCAAyC,GACzC,MAAM,eAAe,CAAC;AAiBvB,MAAM,KAAK,GACV,0GAA0G,CAAC;AAE5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UAAU,UAAU,CACxB,GAA4B,EAC5B,IAAiC,EACjC,KAIC;IAED,2EAA2E;IAC3E,0EAA0E;IAC1E,MAAM,SAAS,GAAG,GAAG,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;IACpD,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC;QAC3C,SAAS;QACT,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;QACrC,cAAc,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,4BAA4B,CAAC;QACrF,oBAAoB,EACnB,IAAI,CAAC,oBAAoB,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QAClG,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,sBAAsB;QAC7C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,GAAG,EAAE,KAAK,CAAC,GAAG;KACd,CAAC,CAAC;IACH,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import type { Credential } from \"@earendil-works/pi-ai\";\nimport type { ExtensionAPI, ExtensionCommandContext } from \"../../types.ts\";\nimport { emitProviderAccountsChanged } from \"../claude-sdk-oauth/account-events.ts\";\nimport {\n\ttype CursorCliAccountSlot,\n\ttype CursorCliOauthCredential,\n\temptyCredential,\n\tlistAccounts,\n\tpinAccount,\n\tremoveAccount,\n} from \"./accounts.ts\";\nimport { selectAccount } from \"./affinity.ts\";\nimport {\n\ttype CursorCliGenerationGuard,\n\tcollectCursorCliStatus,\n\tNATIVE_CURSOR_PROVIDER_ID,\n\tregisterCursorCliShutdownSafety,\n\trenderCursorCliStatus,\n} from \"./diagnostics.ts\";\nimport {\n\tCURSOR_CLI_OAUTH_PROVIDER_ID,\n\tconfirmCursorCliNoApprovalAcknowledgement,\n\timportLocalCursorCredential,\n\ttype LocalCursorImportDeps,\n} from \"./oauth-login.ts\";\nimport { type CursorCliSessionRouter, cursorCliSessionRouter } from \"./session-router.ts\";\nimport {\n\ttype CursorCliOauthProviderSettings,\n\tloadCursorCliOauthProviderSettingsFromDisk,\n\tpersistCursorCliNoApprovalAcknowledgement,\n} from \"./settings.ts\";\n\n/** Injectable seams; every default resolves real on-disk state at invocation time. */\nexport type CursorCliAccountCommandDeps = {\n\treadonly loadSettings?: (cwd: string) => CursorCliOauthProviderSettings;\n\treadonly router?: CursorCliSessionRouter;\n\treadonly resolveExecutable?: (settings: CursorCliOauthProviderSettings) => string;\n\treadonly probeVersion?: (executable: string) => Promise<string>;\n\treadonly readNativeCredential?: () => Credential | undefined | Promise<Credential | undefined>;\n\treadonly importCredential?: typeof importLocalCursorCredential;\n\treadonly importDeps?: LocalCursorImportDeps;\n\t/** Acknowledgement persistence seam; the default read-modify-writes the global settings file. */\n\treadonly persistAcknowledgement?: (cwd: string, acknowledgedAt: string) => void;\n\treadonly now?: () => number;\n\treadonly generation?: CursorCliGenerationGuard;\n};\n\nconst USAGE =\n\t\"Usage: /cursor-account [list | add | remove <name> | pin <name> | unpin | import | acknowledge | status]\";\n\nfunction asCursorCredential(value: Credential | undefined): CursorCliOauthCredential {\n\treturn value !== undefined && value.type === \"oauth\" ? (value as CursorCliOauthCredential) : emptyCredential();\n}\n\nfunction parseArgs(rawArgs: string): string[] {\n\treturn rawArgs.trim().split(/\\s+/).filter(Boolean);\n}\n\nfunction slotStatus(slot: CursorCliAccountSlot, now: number): string {\n\tif (slot.blockReason === \"auth_error\") return \"blocked until re-login\";\n\tif (slot.blockedUntil !== undefined && slot.blockedUntil > now) {\n\t\treturn `blocked until ${new Date(slot.blockedUntil).toISOString()} (${slot.blockReason ?? \"rate_limit\"})`;\n\t}\n\treturn \"available\";\n}\n\nfunction authEventMessage(event: unknown): string {\n\tif (event === null || typeof event !== \"object\") return \"Cursor CLI (OAuth) authentication update.\";\n\tconst value = event as Record<string, unknown>;\n\tif (value.type === \"auth_url\" && typeof value.url === \"string\") {\n\t\treturn `Open this URL to authorize Cursor CLI (OAuth):\\n${value.url}`;\n\t}\n\tif (value.type === \"device_code\" && typeof value.verificationUri === \"string\") {\n\t\treturn `Open this URL to authorize Cursor CLI (OAuth):\\n${value.verificationUri}`;\n\t}\n\treturn typeof value.message === \"string\" ? value.message : \"Cursor CLI (OAuth) authentication update.\";\n}\n\n/**\n * Registers `/cursor-account` plus the reload/shutdown teardown for this\n * extension generation: the command reads account state fresh from the\n * credential store on every invocation, and every deferred continuation is\n * fenced so a retired generation is never touched after a reload.\n */\nexport function registerCursorCliAccountCommand(pi: ExtensionAPI, deps: CursorCliAccountCommandDeps = {}): void {\n\tconst loadSettings = deps.loadSettings ?? ((cwd: string) => loadCursorCliOauthProviderSettingsFromDisk(cwd));\n\tconst now = deps.now ?? Date.now;\n\t// One guard per registration: a reload rebuilds the extension and gets a\n\t// fresh fence, while the child registry stays process-wide.\n\tconst generation = registerCursorCliShutdownSafety(pi, { generation: deps.generation });\n\n\tpi.registerCommand(\"cursor-account\", {\n\t\tdescription: \"List and manage Cursor CLI (OAuth) accounts.\",\n\t\targumentHint: \"[list | add | remove <name> | pin <name> | unpin | import | acknowledge | status]\",\n\t\thandler: async (rawArgs: string, ctx: ExtensionCommandContext): Promise<void> => {\n\t\t\ttry {\n\t\t\t\tconst args = parseArgs(rawArgs);\n\t\t\t\tconst action = args[0] ?? \"list\";\n\t\t\t\tif (action === \"list\") {\n\t\t\t\t\tshowAccounts(ctx, loadSettings(ctx.cwd), generation, now);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"add\") {\n\t\t\t\t\tawait addAccount(ctx);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"remove\") {\n\t\t\t\t\tawait removeNamedAccount(ctx, args[1]);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"pin\" && args[1] !== undefined) {\n\t\t\t\t\tawait pinNamedAccount(ctx, args[1]);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"unpin\") {\n\t\t\t\t\tawait unpinAccount(ctx);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"import\") {\n\t\t\t\t\tawait importAccount(ctx, deps);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"acknowledge\") {\n\t\t\t\t\tawait acknowledgeNoApproval(ctx, deps, generation);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"status\") {\n\t\t\t\t\tawait showStatus(ctx, deps, { loadSettings, generation, now });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tctx.ui.notify(USAGE, \"error\");\n\t\t\t} catch (error) {\n\t\t\t\tctx.ui.notify(error instanceof Error ? error.message : String(error), \"error\");\n\t\t\t}\n\t\t},\n\t});\n}\n\nfunction showAccounts(\n\tctx: ExtensionCommandContext,\n\tsettings: CursorCliOauthProviderSettings,\n\tgeneration: CursorCliGenerationGuard,\n\tnow: () => number,\n): void {\n\tconst credential = asCursorCredential(ctx.modelRegistry.authStorage.get(CURSOR_CLI_OAUTH_PROVIDER_ID));\n\tconst accounts = listAccounts(credential);\n\tconst pinned = settings.pinnedAccount ?? credential.pinned;\n\tconst pinSource = settings.pinnedAccount !== undefined ? \"settings\" : \"stored\";\n\tlet affinityPick: string | undefined;\n\tlet affinityError: string | undefined;\n\tif (accounts.length > 0) {\n\t\ttry {\n\t\t\taffinityPick = selectAccount(accounts, {\n\t\t\t\tsessionId: ctx.sessionManager.getSessionId(),\n\t\t\t\tpinnedAccount: pinned,\n\t\t\t\tnow: now(),\n\t\t\t}).name;\n\t\t} catch (error) {\n\t\t\taffinityError = error instanceof Error ? error.message : String(error);\n\t\t}\n\t}\n\tconst lines = [\"Cursor CLI (OAuth) accounts:\"];\n\tif (accounts.length === 0) lines.push(\" (none)\");\n\tfor (const account of accounts) {\n\t\tconst states = [account.name, account.source, slotStatus(account, now())];\n\t\tif (account.name === pinned) states.push(\"pinned\");\n\t\tif (account.name === affinityPick) states.push(\"affinity pick\");\n\t\tlines.push(` ${states.join(\" | \")}`);\n\t}\n\tlines.push(`Pinned account: ${pinned === undefined ? \"none\" : `${pinned} (${pinSource})`}`);\n\tlines.push(`Affinity pick: ${affinityPick ?? (affinityError ? `unavailable - ${affinityError}` : \"none\")}`);\n\tgeneration.runFencedSync(ctx, () => ctx.ui.notify(lines.join(\"\\n\"), \"info\"));\n}\n\nasync function addAccount(ctx: ExtensionCommandContext): Promise<void> {\n\tif (!ctx.hasUI) {\n\t\tctx.ui.notify(\"/cursor-account add requires an interactive UI.\", \"error\");\n\t\treturn;\n\t}\n\ttry {\n\t\tawait ctx.modelRegistry.modelRuntime.login(CURSOR_CLI_OAUTH_PROVIDER_ID, \"oauth\", {\n\t\t\tsignal: ctx.signal,\n\t\t\tprompt: async (prompt: { message: string }) => {\n\t\t\t\tconst answer = await ctx.ui.input(prompt.message);\n\t\t\t\tif (answer === undefined) throw new Error(\"Login cancelled\");\n\t\t\t\treturn answer;\n\t\t\t},\n\t\t\tnotify: (event: unknown) => ctx.ui.notify(authEventMessage(event), \"info\"),\n\t\t});\n\t\temitProviderAccountsChanged(CURSOR_CLI_OAUTH_PROVIDER_ID);\n\t\tctx.ui.notify(\"Cursor CLI (OAuth) account added.\", \"info\");\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tif (message !== \"Login cancelled\") {\n\t\t\tctx.ui.notify(`Failed to add Cursor CLI (OAuth) account: ${message}`, \"error\");\n\t\t}\n\t}\n}\n\nasync function removeNamedAccount(ctx: ExtensionCommandContext, name: string | undefined): Promise<void> {\n\tif (!name) {\n\t\tctx.ui.notify(\"Usage: /cursor-account remove <name>\", \"error\");\n\t\treturn;\n\t}\n\tlet removed = false;\n\ttry {\n\t\tawait ctx.modelRegistry.authStorage.modify(CURSOR_CLI_OAUTH_PROVIDER_ID, async (current) => {\n\t\t\tconst credential = asCursorCredential(current);\n\t\t\tif (!listAccounts(credential).some((account) => account.name === name)) return current;\n\t\t\tremoved = true;\n\t\t\treturn removeAccount(credential, name);\n\t\t});\n\t} catch (error) {\n\t\tctx.ui.notify(error instanceof Error ? error.message : String(error), \"error\");\n\t\treturn;\n\t}\n\tif (!removed) {\n\t\tctx.ui.notify(`Cursor CLI (OAuth) account '${name}' does not exist.`, \"error\");\n\t\treturn;\n\t}\n\temitProviderAccountsChanged(CURSOR_CLI_OAUTH_PROVIDER_ID);\n\tctx.ui.notify(`Removed Cursor CLI (OAuth) account: ${name}.`, \"info\");\n}\n\nasync function pinNamedAccount(ctx: ExtensionCommandContext, name: string): Promise<void> {\n\ttry {\n\t\tawait ctx.modelRegistry.authStorage.modify(CURSOR_CLI_OAUTH_PROVIDER_ID, async (current) => {\n\t\t\tconst credential = asCursorCredential(current);\n\t\t\tif (!listAccounts(credential).some((account) => account.name === name)) {\n\t\t\t\tthrow new Error(`Cursor CLI (OAuth) account '${name}' does not exist.`);\n\t\t\t}\n\t\t\treturn pinAccount(credential, name);\n\t\t});\n\t} catch (error) {\n\t\tctx.ui.notify(error instanceof Error ? error.message : String(error), \"error\");\n\t\treturn;\n\t}\n\temitProviderAccountsChanged(CURSOR_CLI_OAUTH_PROVIDER_ID);\n\tctx.ui.notify(`Pinned Cursor CLI (OAuth) account: ${name}.`, \"info\");\n}\n\nasync function unpinAccount(ctx: ExtensionCommandContext): Promise<void> {\n\tlet hadPin = false;\n\ttry {\n\t\tawait ctx.modelRegistry.authStorage.modify(CURSOR_CLI_OAUTH_PROVIDER_ID, async (current) => {\n\t\t\tconst credential = asCursorCredential(current);\n\t\t\tif (credential.pinned === undefined) return current;\n\t\t\thadPin = true;\n\t\t\tconst { pinned: _pinned, ...unpinned } = credential;\n\t\t\treturn unpinned;\n\t\t});\n\t} catch (error) {\n\t\tctx.ui.notify(error instanceof Error ? error.message : String(error), \"error\");\n\t\treturn;\n\t}\n\tif (!hadPin) {\n\t\tctx.ui.notify(\"No stored Cursor CLI (OAuth) account pin is set.\", \"info\");\n\t\treturn;\n\t}\n\temitProviderAccountsChanged(CURSOR_CLI_OAUTH_PROVIDER_ID);\n\tctx.ui.notify(\"Unpinned Cursor CLI (OAuth) account.\", \"info\");\n}\n\nasync function importAccount(ctx: ExtensionCommandContext, deps: CursorCliAccountCommandDeps): Promise<void> {\n\tconst importCredential = deps.importCredential ?? importLocalCursorCredential;\n\tconst importDeps: LocalCursorImportDeps = { ...deps.importDeps };\n\tif (importDeps.onPrompt === undefined && ctx.hasUI) {\n\t\timportDeps.onPrompt = async (prompt: { message: string }) => {\n\t\t\tconst answer = await ctx.ui.input(prompt.message);\n\t\t\tif (answer === undefined) throw new Error(\"Import cancelled\");\n\t\t\treturn answer;\n\t\t};\n\t}\n\tlet importedName: string | undefined;\n\ttry {\n\t\tawait ctx.modelRegistry.authStorage.modify(CURSOR_CLI_OAUTH_PROVIDER_ID, async (current) => {\n\t\t\tconst before = asCursorCredential(current);\n\t\t\tconst updated = await importCredential(before, importDeps);\n\t\t\tconst existing = new Set(listAccounts(before).map((account) => account.name));\n\t\t\timportedName = listAccounts(updated).find((account) => !existing.has(account.name))?.name;\n\t\t\treturn updated;\n\t\t});\n\t} catch (error) {\n\t\tctx.ui.notify(\n\t\t\t`Failed to import local Cursor credential: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\"error\",\n\t\t);\n\t\treturn;\n\t}\n\temitProviderAccountsChanged(CURSOR_CLI_OAUTH_PROVIDER_ID);\n\tctx.ui.notify(\n\t\t`Imported local Cursor credential as '${importedName ?? \"a new account\"}' (copied into this provider's store).`,\n\t\t\"info\",\n\t);\n}\n\nasync function acknowledgeNoApproval(\n\tctx: ExtensionCommandContext,\n\tdeps: CursorCliAccountCommandDeps,\n\tgeneration: CursorCliGenerationGuard,\n): Promise<void> {\n\tif (!ctx.hasUI) {\n\t\tctx.ui.notify(\"/cursor-account acknowledge requires an interactive UI.\", \"error\");\n\t\treturn;\n\t}\n\tconst persist = deps.persistAcknowledgement ?? persistCursorCliNoApprovalAcknowledgement;\n\tconst acknowledgedAt = await confirmCursorCliNoApprovalAcknowledgement(\n\t\tasync (ask) => (await ctx.ui.input(ask.message)) ?? \"\",\n\t\t() => new Date((deps.now ?? Date.now)()),\n\t);\n\tif (acknowledgedAt === undefined) {\n\t\tgeneration.runFencedSync(ctx, () =>\n\t\t\tctx.ui.notify(\n\t\t\t\t\"No acknowledgement written: unattended Cursor CLI execution stays off until you acknowledge.\",\n\t\t\t\t\"info\",\n\t\t\t),\n\t\t);\n\t\treturn;\n\t}\n\tpersist(ctx.cwd, acknowledgedAt);\n\tgeneration.runFencedSync(ctx, () =>\n\t\tctx.ui.notify(`Acknowledged unattended Cursor CLI tool execution at ${acknowledgedAt}.`, \"info\"),\n\t);\n}\n\nasync function showStatus(\n\tctx: ExtensionCommandContext,\n\tdeps: CursorCliAccountCommandDeps,\n\tbound: {\n\t\tloadSettings: (cwd: string) => CursorCliOauthProviderSettings;\n\t\tgeneration: CursorCliGenerationGuard;\n\t\tnow: () => number;\n\t},\n): Promise<void> {\n\t// Context reads happen before any await; the render continuation is fenced\n\t// so a reload during the version probe can never touch a retired context.\n\tconst sessionId = ctx.sessionManager.getSessionId();\n\tconst report = await collectCursorCliStatus({\n\t\tsessionId,\n\t\tsettings: bound.loadSettings(ctx.cwd),\n\t\treadCredential: () => ctx.modelRegistry.authStorage.get(CURSOR_CLI_OAUTH_PROVIDER_ID),\n\t\treadNativeCredential:\n\t\t\tdeps.readNativeCredential ?? (() => ctx.modelRegistry.authStorage.get(NATIVE_CURSOR_PROVIDER_ID)),\n\t\trouter: deps.router ?? cursorCliSessionRouter,\n\t\tresolveExecutable: deps.resolveExecutable,\n\t\tprobeVersion: deps.probeVersion,\n\t\tnow: bound.now,\n\t});\n\tbound.generation.runFencedSync(ctx, () => ctx.ui.notify(renderCursorCliStatus(report), \"info\"));\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Credential, CredentialStore, OAuthCredential } from "@earendil-works/pi-ai";
|
|
2
|
+
export type CursorCliAccountSlot = {
|
|
3
|
+
name: string;
|
|
4
|
+
access: string;
|
|
5
|
+
refresh: string;
|
|
6
|
+
expires: number;
|
|
7
|
+
source: "login" | "import";
|
|
8
|
+
blockedUntil?: number;
|
|
9
|
+
blockReason?: "rate_limit" | "auth_error";
|
|
10
|
+
};
|
|
11
|
+
export type CursorCliSlotState = Record<string, {
|
|
12
|
+
blockedUntil?: number;
|
|
13
|
+
blockReason?: "rate_limit" | "auth_error";
|
|
14
|
+
}>;
|
|
15
|
+
export type CursorCliOauthCredential = OAuthCredential & {
|
|
16
|
+
accounts?: CursorCliAccountSlot[];
|
|
17
|
+
pinned?: string;
|
|
18
|
+
slotState?: CursorCliSlotState;
|
|
19
|
+
};
|
|
20
|
+
export declare const SENTINEL_OAUTH_FIELDS: {
|
|
21
|
+
readonly access: "cursor-cli-oauth-managed";
|
|
22
|
+
readonly refresh: "cursor-cli-oauth-managed";
|
|
23
|
+
readonly expires: 4102444800000;
|
|
24
|
+
};
|
|
25
|
+
export declare function emptyCredential(): CursorCliOauthCredential;
|
|
26
|
+
export declare function listAccounts(credential: CursorCliOauthCredential): CursorCliAccountSlot[];
|
|
27
|
+
export declare function assertValidAccountName(name: string): void;
|
|
28
|
+
export declare function addAccount(credential: CursorCliOauthCredential, slot: CursorCliAccountSlot): CursorCliOauthCredential;
|
|
29
|
+
export declare function removeAccount(credential: CursorCliOauthCredential, name: string): CursorCliOauthCredential;
|
|
30
|
+
export declare function pinAccount(credential: CursorCliOauthCredential, name: string): CursorCliOauthCredential;
|
|
31
|
+
export declare function assertSentinelInvariant(credential: CursorCliOauthCredential): void;
|
|
32
|
+
export type CursorCliSlotRefresher = (refreshToken: string, signal: AbortSignal) => Promise<{
|
|
33
|
+
refresh: string;
|
|
34
|
+
access: string;
|
|
35
|
+
expires: number;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function refreshSlot(store: CredentialStore, providerId: string, slotName: string, refresher: CursorCliSlotRefresher, signal: AbortSignal): Promise<Credential | undefined>;
|
|
38
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE1F,MAAM,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,YAAY,GAAG,YAAY,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,YAAY,GAAG,YAAY,CAAA;CAAE,CAAC,CAAC;AAEtH,MAAM,MAAM,wBAAwB,GAAG,eAAe,GAAG;IACxD,QAAQ,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,kBAAkB,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;CAIxB,CAAC;AAEX,wBAAgB,eAAe,IAAI,wBAAwB,CAE1D;AAMD,wBAAgB,YAAY,CAAC,UAAU,EAAE,wBAAwB,GAAG,oBAAoB,EAAE,CAEzF;AAID,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAMzD;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,wBAAwB,EAAE,IAAI,EAAE,oBAAoB,GAAG,wBAAwB,CAUrH;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,wBAAwB,EAAE,IAAI,EAAE,MAAM,GAAG,wBAAwB,CAS1G;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,wBAAwB,EAAE,IAAI,EAAE,MAAM,GAAG,wBAAwB,CAGvG;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,wBAAwB,GAAG,IAAI,CAQlF;AAED,MAAM,MAAM,sBAAsB,GAAG,CACpC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,WAAW,KACf,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEnE,wBAAsB,WAAW,CAChC,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,sBAAsB,EACjC,MAAM,EAAE,WAAW,GACjB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAoBjC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export const SENTINEL_OAUTH_FIELDS = {
|
|
2
|
+
access: "cursor-cli-oauth-managed",
|
|
3
|
+
refresh: "cursor-cli-oauth-managed",
|
|
4
|
+
expires: 4_102_444_800_000,
|
|
5
|
+
};
|
|
6
|
+
export function emptyCredential() {
|
|
7
|
+
return { type: "oauth", ...SENTINEL_OAUTH_FIELDS, accounts: [] };
|
|
8
|
+
}
|
|
9
|
+
function storedAccounts(credential) {
|
|
10
|
+
return credential.accounts ?? [];
|
|
11
|
+
}
|
|
12
|
+
export function listAccounts(credential) {
|
|
13
|
+
return [...storedAccounts(credential)];
|
|
14
|
+
}
|
|
15
|
+
const ACCOUNT_NAME_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/;
|
|
16
|
+
export function assertValidAccountName(name) {
|
|
17
|
+
if (!ACCOUNT_NAME_PATTERN.test(name)) {
|
|
18
|
+
throw new Error(`Invalid account name '${name}': use letters, digits, '-' or '_', starting with a letter or digit`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function addAccount(credential, slot) {
|
|
22
|
+
assertValidAccountName(slot.name);
|
|
23
|
+
if (storedAccounts(credential).some((existing) => existing.name === slot.name)) {
|
|
24
|
+
throw new Error(`Account '${slot.name}' already exists`);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
...credential,
|
|
28
|
+
...SENTINEL_OAUTH_FIELDS,
|
|
29
|
+
accounts: [...storedAccounts(credential), slot],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export function removeAccount(credential, name) {
|
|
33
|
+
const accounts = storedAccounts(credential).filter((slot) => slot.name !== name);
|
|
34
|
+
const next = {
|
|
35
|
+
...credential,
|
|
36
|
+
...SENTINEL_OAUTH_FIELDS,
|
|
37
|
+
accounts,
|
|
38
|
+
};
|
|
39
|
+
if (credential.pinned === name)
|
|
40
|
+
delete next.pinned;
|
|
41
|
+
return next;
|
|
42
|
+
}
|
|
43
|
+
export function pinAccount(credential, name) {
|
|
44
|
+
assertValidAccountName(name);
|
|
45
|
+
return { ...credential, ...SENTINEL_OAUTH_FIELDS, pinned: name };
|
|
46
|
+
}
|
|
47
|
+
export function assertSentinelInvariant(credential) {
|
|
48
|
+
if (credential.access !== SENTINEL_OAUTH_FIELDS.access ||
|
|
49
|
+
credential.refresh !== SENTINEL_OAUTH_FIELDS.refresh ||
|
|
50
|
+
credential.expires !== SENTINEL_OAUTH_FIELDS.expires) {
|
|
51
|
+
throw new Error("top-level OAuth fields must remain sentinel values");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export async function refreshSlot(store, providerId, slotName, refresher, signal) {
|
|
55
|
+
return store.modify(providerId, async (current) => {
|
|
56
|
+
if (current?.type !== "oauth")
|
|
57
|
+
return undefined;
|
|
58
|
+
const credential = current;
|
|
59
|
+
assertSentinelInvariant(credential);
|
|
60
|
+
const slot = storedAccounts(credential).find((candidate) => candidate.name === slotName);
|
|
61
|
+
if (!slot || Date.now() < slot.expires)
|
|
62
|
+
return current;
|
|
63
|
+
const refreshed = await refresher(slot.refresh, signal);
|
|
64
|
+
const accounts = storedAccounts(credential).map((candidate) => candidate.name === slotName
|
|
65
|
+
? {
|
|
66
|
+
...candidate,
|
|
67
|
+
access: refreshed.access,
|
|
68
|
+
refresh: refreshed.refresh,
|
|
69
|
+
expires: refreshed.expires,
|
|
70
|
+
}
|
|
71
|
+
: candidate);
|
|
72
|
+
return { ...credential, ...SENTINEL_OAUTH_FIELDS, accounts };
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/accounts.ts"],"names":[],"mappings":"AAoBA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,MAAM,EAAE,0BAA0B;IAClC,OAAO,EAAE,0BAA0B;IACnC,OAAO,EAAE,iBAAiB;CACjB,CAAC;AAEX,MAAM,UAAU,eAAe;IAC9B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,qBAAqB,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAClE,CAAC;AAED,SAAS,cAAc,CAAC,UAAoC;IAC3D,OAAO,UAAU,CAAC,QAAQ,IAAI,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,UAAoC;IAChE,OAAO,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,oBAAoB,G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S,CAAC,OAAO;aAC1B;YACF,CAAC,CAAC,SAAS,CACZ,CAAC;QACF,OAAO,EAAE,GAAG,UAAU,EAAE,GAAG,qBAAqB,EAAE,QAAQ,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { Credential, CredentialStore, OAuthCredential } from \"@earendil-works/pi-ai\";\n\nexport type CursorCliAccountSlot = {\n\tname: string;\n\taccess: string;\n\trefresh: string;\n\texpires: number;\n\tsource: \"login\" | \"import\";\n\tblockedUntil?: number;\n\tblockReason?: \"rate_limit\" | \"auth_error\";\n};\n\nexport type CursorCliSlotState = Record<string, { blockedUntil?: number; blockReason?: \"rate_limit\" | \"auth_error\" }>;\n\nexport type CursorCliOauthCredential = OAuthCredential & {\n\taccounts?: CursorCliAccountSlot[];\n\tpinned?: string;\n\tslotState?: CursorCliSlotState;\n};\n\nexport const SENTINEL_OAUTH_FIELDS = {\n\taccess: \"cursor-cli-oauth-managed\",\n\trefresh: \"cursor-cli-oauth-managed\",\n\texpires: 4_102_444_800_000,\n} as const;\n\nexport function emptyCredential(): CursorCliOauthCredential {\n\treturn { type: \"oauth\", ...SENTINEL_OAUTH_FIELDS, accounts: [] };\n}\n\nfunction storedAccounts(credential: CursorCliOauthCredential): CursorCliAccountSlot[] {\n\treturn credential.accounts ?? [];\n}\n\nexport function listAccounts(credential: CursorCliOauthCredential): CursorCliAccountSlot[] {\n\treturn [...storedAccounts(credential)];\n}\n\nconst ACCOUNT_NAME_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/;\n\nexport function assertValidAccountName(name: string): void {\n\tif (!ACCOUNT_NAME_PATTERN.test(name)) {\n\t\tthrow new Error(\n\t\t\t`Invalid account name '${name}': use letters, digits, '-' or '_', starting with a letter or digit`,\n\t\t);\n\t}\n}\n\nexport function addAccount(credential: CursorCliOauthCredential, slot: CursorCliAccountSlot): CursorCliOauthCredential {\n\tassertValidAccountName(slot.name);\n\tif (storedAccounts(credential).some((existing) => existing.name === slot.name)) {\n\t\tthrow new Error(`Account '${slot.name}' already exists`);\n\t}\n\treturn {\n\t\t...credential,\n\t\t...SENTINEL_OAUTH_FIELDS,\n\t\taccounts: [...storedAccounts(credential), slot],\n\t};\n}\n\nexport function removeAccount(credential: CursorCliOauthCredential, name: string): CursorCliOauthCredential {\n\tconst accounts = storedAccounts(credential).filter((slot) => slot.name !== name);\n\tconst next: CursorCliOauthCredential = {\n\t\t...credential,\n\t\t...SENTINEL_OAUTH_FIELDS,\n\t\taccounts,\n\t};\n\tif (credential.pinned === name) delete next.pinned;\n\treturn next;\n}\n\nexport function pinAccount(credential: CursorCliOauthCredential, name: string): CursorCliOauthCredential {\n\tassertValidAccountName(name);\n\treturn { ...credential, ...SENTINEL_OAUTH_FIELDS, pinned: name };\n}\n\nexport function assertSentinelInvariant(credential: CursorCliOauthCredential): void {\n\tif (\n\t\tcredential.access !== SENTINEL_OAUTH_FIELDS.access ||\n\t\tcredential.refresh !== SENTINEL_OAUTH_FIELDS.refresh ||\n\t\tcredential.expires !== SENTINEL_OAUTH_FIELDS.expires\n\t) {\n\t\tthrow new Error(\"top-level OAuth fields must remain sentinel values\");\n\t}\n}\n\nexport type CursorCliSlotRefresher = (\n\trefreshToken: string,\n\tsignal: AbortSignal,\n) => Promise<{ refresh: string; access: string; expires: number }>;\n\nexport async function refreshSlot(\n\tstore: CredentialStore,\n\tproviderId: string,\n\tslotName: string,\n\trefresher: CursorCliSlotRefresher,\n\tsignal: AbortSignal,\n): Promise<Credential | undefined> {\n\treturn store.modify(providerId, async (current) => {\n\t\tif (current?.type !== \"oauth\") return undefined;\n\t\tconst credential = current as CursorCliOauthCredential;\n\t\tassertSentinelInvariant(credential);\n\t\tconst slot = storedAccounts(credential).find((candidate) => candidate.name === slotName);\n\t\tif (!slot || Date.now() < slot.expires) return current;\n\t\tconst refreshed = await refresher(slot.refresh, signal);\n\t\tconst accounts = storedAccounts(credential).map((candidate) =>\n\t\t\tcandidate.name === slotName\n\t\t\t\t? {\n\t\t\t\t\t\t...candidate,\n\t\t\t\t\t\taccess: refreshed.access,\n\t\t\t\t\t\trefresh: refreshed.refresh,\n\t\t\t\t\t\texpires: refreshed.expires,\n\t\t\t\t\t}\n\t\t\t\t: candidate,\n\t\t);\n\t\treturn { ...credential, ...SENTINEL_OAUTH_FIELDS, accounts };\n\t});\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const DEFAULT_CURSOR_AFFINITY_KEY = "cursor-cli-oauth-default";
|
|
2
|
+
export type CursorAffinityAccountSlot = {
|
|
3
|
+
name: string;
|
|
4
|
+
blockedUntil?: number;
|
|
5
|
+
blockReason?: string;
|
|
6
|
+
};
|
|
7
|
+
export type CursorAffinityOptions = {
|
|
8
|
+
affinityKey?: string;
|
|
9
|
+
sessionId?: string;
|
|
10
|
+
pinnedAccount?: string;
|
|
11
|
+
now?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare class AllCursorAccountsBlockedError extends Error {
|
|
14
|
+
readonly soonestUnblockAt: number | undefined;
|
|
15
|
+
constructor(soonestUnblockAt: number | undefined);
|
|
16
|
+
}
|
|
17
|
+
export declare function getAffinityKey(options: Pick<CursorAffinityOptions, "affinityKey" | "sessionId">): string;
|
|
18
|
+
/** Orders accounts by descending highest-random-weight score for the session key. */
|
|
19
|
+
export declare function rendezvousOrder<T extends CursorAffinityAccountSlot>(key: string, accounts: readonly T[]): T[];
|
|
20
|
+
/** Clears elapsed temporary blocks while retaining auth failures until the account logs in again. */
|
|
21
|
+
export declare function clearExpiredBlocks<T extends CursorAffinityAccountSlot>(accounts: readonly T[], now?: number): T[];
|
|
22
|
+
/** Selects the pinned account or the first available account in session-stable HRW order. */
|
|
23
|
+
export declare function selectAccount<T extends CursorAffinityAccountSlot>(accounts: readonly T[], options?: CursorAffinityOptions): T;
|
|
24
|
+
//# sourceMappingURL=affinity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affinity.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/affinity.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,6BAA6B,CAAC;AAEtE,MAAM,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,qBAAa,6BAA8B,SAAQ,KAAK;IACvD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;gBAElC,gBAAgB,EAAE,MAAM,GAAG,SAAS;CAShD;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,qBAAqB,EAAE,aAAa,GAAG,WAAW,CAAC,GAAG,MAAM,CAExG;AAMD,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,CAAC,SAAS,yBAAyB,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,CAK7G;AAMD,qGAAqG;AACrG,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,yBAAyB,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,SAAa,GAAG,CAAC,EAAE,CAQrH;AAsBD,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,CAAC,SAAS,yBAAyB,EAChE,QAAQ,EAAE,SAAS,CAAC,EAAE,EACtB,OAAO,GAAE,qBAA0B,GACjC,CAAC,CASH"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
export const DEFAULT_CURSOR_AFFINITY_KEY = "cursor-cli-oauth-default";
|
|
3
|
+
export class AllCursorAccountsBlockedError extends Error {
|
|
4
|
+
constructor(soonestUnblockAt) {
|
|
5
|
+
super(soonestUnblockAt === undefined
|
|
6
|
+
? "All Cursor CLI OAuth accounts are blocked until re-login."
|
|
7
|
+
: `All Cursor CLI OAuth accounts are blocked until ${new Date(soonestUnblockAt).toISOString()}.`);
|
|
8
|
+
this.name = "AllCursorAccountsBlockedError";
|
|
9
|
+
this.soonestUnblockAt = soonestUnblockAt;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function getAffinityKey(options) {
|
|
13
|
+
return options.affinityKey ?? options.sessionId ?? DEFAULT_CURSOR_AFFINITY_KEY;
|
|
14
|
+
}
|
|
15
|
+
function score(key, accountName) {
|
|
16
|
+
return createHash("sha256").update(`${key}\0${accountName}`).digest().readBigUInt64BE(0);
|
|
17
|
+
}
|
|
18
|
+
/** Orders accounts by descending highest-random-weight score for the session key. */
|
|
19
|
+
export function rendezvousOrder(key, accounts) {
|
|
20
|
+
return [...accounts]
|
|
21
|
+
.map((account) => ({ account, score: score(key, account.name) }))
|
|
22
|
+
.sort((left, right) => (right.score > left.score ? 1 : right.score < left.score ? -1 : 0))
|
|
23
|
+
.map(({ account }) => account);
|
|
24
|
+
}
|
|
25
|
+
function isBlocked(account, now) {
|
|
26
|
+
return account.blockReason === "auth_error" || (account.blockedUntil !== undefined && account.blockedUntil > now);
|
|
27
|
+
}
|
|
28
|
+
/** Clears elapsed temporary blocks while retaining auth failures until the account logs in again. */
|
|
29
|
+
export function clearExpiredBlocks(accounts, now = Date.now()) {
|
|
30
|
+
return accounts.map((account) => {
|
|
31
|
+
if (account.blockReason !== "auth_error" && account.blockedUntil !== undefined && account.blockedUntil <= now) {
|
|
32
|
+
const { blockedUntil: _blockedUntil, blockReason: _blockReason, ...available } = account;
|
|
33
|
+
return available;
|
|
34
|
+
}
|
|
35
|
+
return account;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function selectUnblocked(accounts, options, now) {
|
|
39
|
+
const pinned = options.pinnedAccount === undefined
|
|
40
|
+
? undefined
|
|
41
|
+
: accounts.find((account) => account.name === options.pinnedAccount);
|
|
42
|
+
if (pinned && !isBlocked(pinned, now))
|
|
43
|
+
return pinned;
|
|
44
|
+
return rendezvousOrder(getAffinityKey(options), accounts).find((account) => !isBlocked(account, now));
|
|
45
|
+
}
|
|
46
|
+
function soonestUnblockAt(accounts, now) {
|
|
47
|
+
const candidates = accounts
|
|
48
|
+
.map((account) => account.blockedUntil)
|
|
49
|
+
.filter((value) => value !== undefined && value > now);
|
|
50
|
+
return candidates.length === 0 ? undefined : Math.min(...candidates);
|
|
51
|
+
}
|
|
52
|
+
/** Selects the pinned account or the first available account in session-stable HRW order. */
|
|
53
|
+
export function selectAccount(accounts, options = {}) {
|
|
54
|
+
const now = options.now ?? Date.now();
|
|
55
|
+
const selected = selectUnblocked(accounts, options, now);
|
|
56
|
+
if (selected)
|
|
57
|
+
return selected;
|
|
58
|
+
const cleared = clearExpiredBlocks(accounts, now);
|
|
59
|
+
const afterClear = selectUnblocked(cleared, options, now);
|
|
60
|
+
if (afterClear)
|
|
61
|
+
return afterClear;
|
|
62
|
+
throw new AllCursorAccountsBlockedError(soonestUnblockAt(accounts, now));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=affinity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affinity.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/affinity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,2BAA2B,GAAG,0BAA0B,CAAC;AAetE,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAGvD,YAAY,gBAAoC;QAC/C,KAAK,CACJ,gBAAgB,KAAK,SAAS;YAC7B,CAAC,CAAC,2DAA2D;YAC7D,CAAC,CAAC,mDAAmD,IAAI,IAA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CAAC,KAAK,EAAmB,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,GAAG,GAAG,CAAC,CAAC;IACzE,OAAO,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC;AACtE,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAC5B,QAAsB,EACtB,UAAiC,EAAE;IAEnC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACtC,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IACzD,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAE9B,MAAM,OAAO,GAAG,kBAAkB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAClD,MAAM,UAAU,GAAG,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAC1D,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAClC,MAAM,IAAI,6BAA6B,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\n\nexport const DEFAULT_CURSOR_AFFINITY_KEY = \"cursor-cli-oauth-default\";\n\nexport type CursorAffinityAccountSlot = {\n\tname: string;\n\tblockedUntil?: number;\n\tblockReason?: string;\n};\n\nexport type CursorAffinityOptions = {\n\taffinityKey?: string;\n\tsessionId?: string;\n\tpinnedAccount?: string;\n\tnow?: number;\n};\n\nexport class AllCursorAccountsBlockedError extends Error {\n\treadonly soonestUnblockAt: number | undefined;\n\n\tconstructor(soonestUnblockAt: number | undefined) {\n\t\tsuper(\n\t\t\tsoonestUnblockAt === undefined\n\t\t\t\t? \"All Cursor CLI OAuth accounts are blocked until re-login.\"\n\t\t\t\t: `All Cursor CLI OAuth accounts are blocked until ${new Date(soonestUnblockAt).toISOString()}.`,\n\t\t);\n\t\tthis.name = \"AllCursorAccountsBlockedError\";\n\t\tthis.soonestUnblockAt = soonestUnblockAt;\n\t}\n}\n\nexport function getAffinityKey(options: Pick<CursorAffinityOptions, \"affinityKey\" | \"sessionId\">): string {\n\treturn options.affinityKey ?? options.sessionId ?? DEFAULT_CURSOR_AFFINITY_KEY;\n}\n\nfunction score(key: string, accountName: string): bigint {\n\treturn createHash(\"sha256\").update(`${key}\\0${accountName}`).digest().readBigUInt64BE(0);\n}\n\n/** Orders accounts by descending highest-random-weight score for the session key. */\nexport function rendezvousOrder<T extends CursorAffinityAccountSlot>(key: string, accounts: readonly T[]): T[] {\n\treturn [...accounts]\n\t\t.map((account) => ({ account, score: score(key, account.name) }))\n\t\t.sort((left, right) => (right.score > left.score ? 1 : right.score < left.score ? -1 : 0))\n\t\t.map(({ account }) => account);\n}\n\nfunction isBlocked(account: CursorAffinityAccountSlot, now: number): boolean {\n\treturn account.blockReason === \"auth_error\" || (account.blockedUntil !== undefined && account.blockedUntil > now);\n}\n\n/** Clears elapsed temporary blocks while retaining auth failures until the account logs in again. */\nexport function clearExpiredBlocks<T extends CursorAffinityAccountSlot>(accounts: readonly T[], now = Date.now()): T[] {\n\treturn accounts.map((account) => {\n\t\tif (account.blockReason !== \"auth_error\" && account.blockedUntil !== undefined && account.blockedUntil <= now) {\n\t\t\tconst { blockedUntil: _blockedUntil, blockReason: _blockReason, ...available } = account;\n\t\t\treturn available as T;\n\t\t}\n\t\treturn account;\n\t});\n}\n\nfunction selectUnblocked<T extends CursorAffinityAccountSlot>(\n\taccounts: readonly T[],\n\toptions: CursorAffinityOptions,\n\tnow: number,\n): T | undefined {\n\tconst pinned =\n\t\toptions.pinnedAccount === undefined\n\t\t\t? undefined\n\t\t\t: accounts.find((account) => account.name === options.pinnedAccount);\n\tif (pinned && !isBlocked(pinned, now)) return pinned;\n\treturn rendezvousOrder(getAffinityKey(options), accounts).find((account) => !isBlocked(account, now));\n}\n\nfunction soonestUnblockAt(accounts: readonly CursorAffinityAccountSlot[], now: number): number | undefined {\n\tconst candidates = accounts\n\t\t.map((account) => account.blockedUntil)\n\t\t.filter((value): value is number => value !== undefined && value > now);\n\treturn candidates.length === 0 ? undefined : Math.min(...candidates);\n}\n\n/** Selects the pinned account or the first available account in session-stable HRW order. */\nexport function selectAccount<T extends CursorAffinityAccountSlot>(\n\taccounts: readonly T[],\n\toptions: CursorAffinityOptions = {},\n): T {\n\tconst now = options.now ?? Date.now();\n\tconst selected = selectUnblocked(accounts, options, now);\n\tif (selected) return selected;\n\n\tconst cleared = clearExpiredBlocks(accounts, now);\n\tconst afterClear = selectUnblocked(cleared, options, now);\n\tif (afterClear) return afterClear;\n\tthrow new AllCursorAccountsBlockedError(soonestUnblockAt(accounts, now));\n}\n"]}
|