@code-yeongyu/senpi 2026.8.16 → 2026.8.18
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 +74 -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/core/agent-session-services.js +2 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +48 -5
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +239 -61
- package/dist/core/agent-session.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/extensions/builtin/cursor-cli-oauth/account-command.d.ts +31 -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 +298 -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 +69 -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 +77 -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 +361 -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 +37 -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 +196 -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/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +5 -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/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/model-resolver.js +1 -1
- 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 +14 -2
- 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-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +1 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +6 -0
- package/dist/core/sdk.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.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +13 -7
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +32 -27
- 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 +26 -4
- package/dist/modes/rpc/multi-session-host.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 +12 -12
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/providers.md +52 -1
- package/docs/rpc.md +78 -6
- package/docs/skills.md +14 -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 +26 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-runtime.ts +2 -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/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 -2
- 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/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/cursor.d.ts +6 -9
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js +42 -9
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.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/huggingface.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/openrouter.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/xai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +3 -1
- 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/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/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/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/package.json +1 -1
- package/package.json +11 -8
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export const DEFAULT_RATE_LIMIT_BLOCK_MS = 60_000;
|
|
2
|
+
export const MAX_RATE_LIMIT_BLOCK_MS = 48 * 60 * 60 * 1_000;
|
|
3
|
+
/** Add each probe-observed Cursor context failure as one exact line. */
|
|
4
|
+
export const CURSOR_CONTEXT_OVERFLOW_WORDINGS = [];
|
|
5
|
+
const OTHER_ERROR = { kind: "other", retryable: false };
|
|
6
|
+
const MAX_TEXT_DEPTH = 5;
|
|
7
|
+
const MAX_TEXT_VALUES = 100;
|
|
8
|
+
function record(value) {
|
|
9
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
10
|
+
? value
|
|
11
|
+
: undefined;
|
|
12
|
+
}
|
|
13
|
+
function collectText(value, output, seen, depth) {
|
|
14
|
+
if (output.length >= MAX_TEXT_VALUES || depth > MAX_TEXT_DEPTH)
|
|
15
|
+
return;
|
|
16
|
+
if (typeof value === "string") {
|
|
17
|
+
output.push(value);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (value instanceof Error) {
|
|
21
|
+
output.push(value.message);
|
|
22
|
+
}
|
|
23
|
+
if (value === null || typeof value !== "object" || seen.has(value))
|
|
24
|
+
return;
|
|
25
|
+
seen.add(value);
|
|
26
|
+
for (const nested of Object.values(value)) {
|
|
27
|
+
collectText(nested, output, seen, depth + 1);
|
|
28
|
+
if (output.length >= MAX_TEXT_VALUES)
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function errorText(input) {
|
|
33
|
+
const parts = [];
|
|
34
|
+
const seen = new Set();
|
|
35
|
+
collectText(input.stderr, parts, seen, 0);
|
|
36
|
+
collectText(input.resultEvent, parts, seen, 0);
|
|
37
|
+
collectText(input.thrown, parts, seen, 0);
|
|
38
|
+
return parts.join("\n");
|
|
39
|
+
}
|
|
40
|
+
function errorLines(text) {
|
|
41
|
+
return text
|
|
42
|
+
.split(/\r?\n/)
|
|
43
|
+
.map((line) => line.trim())
|
|
44
|
+
.filter((line) => line.length > 0);
|
|
45
|
+
}
|
|
46
|
+
function hasExactLine(lines, wording) {
|
|
47
|
+
return lines.some((line) => line === wording);
|
|
48
|
+
}
|
|
49
|
+
function hasTypedKind(value, kind) {
|
|
50
|
+
return record(value)?.kind === kind;
|
|
51
|
+
}
|
|
52
|
+
function positiveNumber(value) {
|
|
53
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0)
|
|
54
|
+
return undefined;
|
|
55
|
+
return Math.ceil(value);
|
|
56
|
+
}
|
|
57
|
+
function findRetryAfterMs(value, seen, depth) {
|
|
58
|
+
if (depth > MAX_TEXT_DEPTH || value === null || typeof value !== "object" || seen.has(value))
|
|
59
|
+
return undefined;
|
|
60
|
+
seen.add(value);
|
|
61
|
+
const object = record(value);
|
|
62
|
+
if (object) {
|
|
63
|
+
const direct = positiveNumber(object.retryAfterMs) ?? positiveNumber(object.retry_after_ms);
|
|
64
|
+
if (direct !== undefined)
|
|
65
|
+
return direct;
|
|
66
|
+
}
|
|
67
|
+
for (const nested of Object.values(value)) {
|
|
68
|
+
const found = findRetryAfterMs(nested, seen, depth + 1);
|
|
69
|
+
if (found !== undefined)
|
|
70
|
+
return found;
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
function retryAfterMs(input, text) {
|
|
75
|
+
const structured = findRetryAfterMs(input.resultEvent, new Set(), 0) ?? findRetryAfterMs(input.thrown, new Set(), 0);
|
|
76
|
+
if (structured !== undefined)
|
|
77
|
+
return structured;
|
|
78
|
+
const milliseconds = text.match(/\bretry[-_ ]?after[-_ ]?ms\s*[:=]\s*(\d+(?:\.\d+)?)/i);
|
|
79
|
+
if (milliseconds)
|
|
80
|
+
return Math.ceil(Number(milliseconds[1]));
|
|
81
|
+
const seconds = text.match(/\bretry[-_ ]?after\s*[:=]\s*(\d+(?:\.\d+)?)/i);
|
|
82
|
+
return seconds ? Math.ceil(Number(seconds[1]) * 1_000) : undefined;
|
|
83
|
+
}
|
|
84
|
+
function rateLimitBlockMs(input, text) {
|
|
85
|
+
return Math.min(MAX_RATE_LIMIT_BLOCK_MS, retryAfterMs(input, text) ?? DEFAULT_RATE_LIMIT_BLOCK_MS);
|
|
86
|
+
}
|
|
87
|
+
/** Classifies observed cursor-agent stderr, result events, and typed transport failures. */
|
|
88
|
+
export function classifyCursorCliError(input) {
|
|
89
|
+
if (!input || typeof input !== "object")
|
|
90
|
+
return OTHER_ERROR;
|
|
91
|
+
if (hasTypedKind(input.thrown, "binary_missing"))
|
|
92
|
+
return { kind: "binary_missing", retryable: false };
|
|
93
|
+
if (hasTypedKind(input.thrown, "malformed_stream") || hasTypedKind(input.resultEvent, "malformed_stream")) {
|
|
94
|
+
return { kind: "malformed_stream", retryable: false };
|
|
95
|
+
}
|
|
96
|
+
const text = errorText(input);
|
|
97
|
+
const lines = errorLines(text);
|
|
98
|
+
if (hasExactLine(lines, "The provided API key is invalid.") &&
|
|
99
|
+
hasExactLine(lines, "The API key was loaded from the CURSOR_API_KEY environment variable.")) {
|
|
100
|
+
return { kind: "invalid_api_key", retryable: false };
|
|
101
|
+
}
|
|
102
|
+
if (hasExactLine(lines, "Error: Your macOS login keychain is locked.")) {
|
|
103
|
+
return { kind: "keychain_locked", retryable: false };
|
|
104
|
+
}
|
|
105
|
+
if (lines.some((line) => /^(?:Error:\s*)?Invalid model value:\s+\S.*$/.test(line))) {
|
|
106
|
+
return { kind: "invalid_model", retryable: false };
|
|
107
|
+
}
|
|
108
|
+
if (/\b(?:HTTP\s*)?429\b|\brate[ _-]?limit(?:ed|ing)?\b|\btoo many requests\b/i.test(text)) {
|
|
109
|
+
return { kind: "rate_limit", retryable: true, blockMs: rateLimitBlockMs(input, text) };
|
|
110
|
+
}
|
|
111
|
+
if (/\b(?:HTTP\s*)?401\b|\bunauthori[sz]ed\b|\bauthentication (?:failed|required)\b|\bnot logged in\b/i.test(text)) {
|
|
112
|
+
return { kind: "auth_error", retryable: false };
|
|
113
|
+
}
|
|
114
|
+
if (CURSOR_CONTEXT_OVERFLOW_WORDINGS.some((wording) => hasExactLine(lines, wording) || hasExactLine(lines, `Error: ${wording}`))) {
|
|
115
|
+
return { kind: "context_overflow", retryable: false };
|
|
116
|
+
}
|
|
117
|
+
if (/\b(?:ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENETUNREACH|EHOSTUNREACH|ENOTFOUND|EAI_AGAIN)\b|\bnetwork error\b|\bconnection (?:reset|refused|lost)\b|\bsocket hang up\b|\bfetch failed\b/i.test(text)) {
|
|
118
|
+
return { kind: "network", retryable: true };
|
|
119
|
+
}
|
|
120
|
+
return OTHER_ERROR;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/errors.ts"],"names":[],"mappings":"AAyBA,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAClD,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;AAE5D,wEAAwE;AACxE,MAAM,CAAC,MAAM,gCAAgC,GAAsB,EAAE,CAAC;AAEtE,MAAM,WAAW,GAAiC,EAAE,IAAI,E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,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,6CAA6C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACpF,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACpD,CAAC;IACD,IAAI,2EAA2E,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5F,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;IACxF,CAAC;IACD,IAAI,mGAAmG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACpH,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACjD,CAAC;IACD,IACC,gCAAgC,CAAC,IAAI,CACpC,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,YAAY,CAAC,KAAK,EAAE,UAAU,OAAO,EAAE,CAAC,CACrF,EACA,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACvD,CAAC;IACD,IACC,qLAAqL,CAAC,IAAI,CACzL,IAAI,CACJ,EACA,CAAC;QACF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC7C,CAAC;IACD,OAAO,WAAW,CAAC;AACpB,CAAC","sourcesContent":["export type CursorCliErrorKind =\n\t| \"binary_missing\"\n\t| \"invalid_api_key\"\n\t| \"keychain_locked\"\n\t| \"invalid_model\"\n\t| \"rate_limit\"\n\t| \"auth_error\"\n\t| \"context_overflow\"\n\t| \"network\"\n\t| \"malformed_stream\"\n\t| \"other\";\n\nexport type CursorCliErrorClassification = {\n\tkind: CursorCliErrorKind;\n\tretryable: boolean;\n\tblockMs?: number;\n};\n\nexport type CursorCliErrorInput = {\n\texitCode?: unknown;\n\tstderr?: unknown;\n\tresultEvent?: unknown;\n\tthrown?: unknown;\n};\n\nexport const DEFAULT_RATE_LIMIT_BLOCK_MS = 60_000;\nexport const MAX_RATE_LIMIT_BLOCK_MS = 48 * 60 * 60 * 1_000;\n\n/** Add each probe-observed Cursor context failure as one exact line. */\nexport const CURSOR_CONTEXT_OVERFLOW_WORDINGS: readonly string[] = [];\n\nconst OTHER_ERROR: CursorCliErrorClassification = { kind: \"other\", retryable: false };\nconst MAX_TEXT_DEPTH = 5;\nconst MAX_TEXT_VALUES = 100;\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value)\n\t\t? (value as Record<string, unknown>)\n\t\t: undefined;\n}\n\nfunction collectText(value: unknown, output: string[], seen: Set<object>, depth: number): void {\n\tif (output.length >= MAX_TEXT_VALUES || depth > MAX_TEXT_DEPTH) return;\n\tif (typeof value === \"string\") {\n\t\toutput.push(value);\n\t\treturn;\n\t}\n\tif (value instanceof Error) {\n\t\toutput.push(value.message);\n\t}\n\tif (value === null || typeof value !== \"object\" || seen.has(value)) return;\n\tseen.add(value);\n\tfor (const nested of Object.values(value)) {\n\t\tcollectText(nested, output, seen, depth + 1);\n\t\tif (output.length >= MAX_TEXT_VALUES) return;\n\t}\n}\n\nfunction errorText(input: CursorCliErrorInput): string {\n\tconst parts: string[] = [];\n\tconst seen = new Set<object>();\n\tcollectText(input.stderr, parts, seen, 0);\n\tcollectText(input.resultEvent, parts, seen, 0);\n\tcollectText(input.thrown, parts, seen, 0);\n\treturn parts.join(\"\\n\");\n}\n\nfunction errorLines(text: string): string[] {\n\treturn text\n\t\t.split(/\\r?\\n/)\n\t\t.map((line) => line.trim())\n\t\t.filter((line) => line.length > 0);\n}\n\nfunction hasExactLine(lines: readonly string[], wording: string): boolean {\n\treturn lines.some((line) => line === wording);\n}\n\nfunction hasTypedKind(value: unknown, kind: CursorCliErrorKind): boolean {\n\treturn record(value)?.kind === kind;\n}\n\nfunction positiveNumber(value: unknown): number | undefined {\n\tif (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) return undefined;\n\treturn Math.ceil(value);\n}\n\nfunction findRetryAfterMs(value: unknown, seen: Set<object>, depth: number): number | undefined {\n\tif (depth > MAX_TEXT_DEPTH || value === null || typeof value !== \"object\" || seen.has(value)) return undefined;\n\tseen.add(value);\n\tconst object = record(value);\n\tif (object) {\n\t\tconst direct = positiveNumber(object.retryAfterMs) ?? positiveNumber(object.retry_after_ms);\n\t\tif (direct !== undefined) return direct;\n\t}\n\tfor (const nested of Object.values(value)) {\n\t\tconst found = findRetryAfterMs(nested, seen, depth + 1);\n\t\tif (found !== undefined) return found;\n\t}\n\treturn undefined;\n}\n\nfunction retryAfterMs(input: CursorCliErrorInput, text: string): number | undefined {\n\tconst structured =\n\t\tfindRetryAfterMs(input.resultEvent, new Set<object>(), 0) ?? findRetryAfterMs(input.thrown, new Set<object>(), 0);\n\tif (structured !== undefined) return structured;\n\tconst milliseconds = text.match(/\\bretry[-_ ]?after[-_ ]?ms\\s*[:=]\\s*(\\d+(?:\\.\\d+)?)/i);\n\tif (milliseconds) return Math.ceil(Number(milliseconds[1]));\n\tconst seconds = text.match(/\\bretry[-_ ]?after\\s*[:=]\\s*(\\d+(?:\\.\\d+)?)/i);\n\treturn seconds ? Math.ceil(Number(seconds[1]) * 1_000) : undefined;\n}\n\nfunction rateLimitBlockMs(input: CursorCliErrorInput, text: string): number {\n\treturn Math.min(MAX_RATE_LIMIT_BLOCK_MS, retryAfterMs(input, text) ?? DEFAULT_RATE_LIMIT_BLOCK_MS);\n}\n\n/** Classifies observed cursor-agent stderr, result events, and typed transport failures. */\nexport function classifyCursorCliError(input: CursorCliErrorInput | null | undefined): CursorCliErrorClassification {\n\tif (!input || typeof input !== \"object\") return OTHER_ERROR;\n\tif (hasTypedKind(input.thrown, \"binary_missing\")) return { kind: \"binary_missing\", retryable: false };\n\tif (hasTypedKind(input.thrown, \"malformed_stream\") || hasTypedKind(input.resultEvent, \"malformed_stream\")) {\n\t\treturn { kind: \"malformed_stream\", retryable: false };\n\t}\n\n\tconst text = errorText(input);\n\tconst lines = errorLines(text);\n\tif (\n\t\thasExactLine(lines, \"The provided API key is invalid.\") &&\n\t\thasExactLine(lines, \"The API key was loaded from the CURSOR_API_KEY environment variable.\")\n\t) {\n\t\treturn { kind: \"invalid_api_key\", retryable: false };\n\t}\n\tif (hasExactLine(lines, \"Error: Your macOS login keychain is locked.\")) {\n\t\treturn { kind: \"keychain_locked\", retryable: false };\n\t}\n\tif (lines.some((line) => /^(?:Error:\\s*)?Invalid model value:\\s+\\S.*$/.test(line))) {\n\t\treturn { kind: \"invalid_model\", retryable: false };\n\t}\n\tif (/\\b(?:HTTP\\s*)?429\\b|\\brate[ _-]?limit(?:ed|ing)?\\b|\\btoo many requests\\b/i.test(text)) {\n\t\treturn { kind: \"rate_limit\", retryable: true, blockMs: rateLimitBlockMs(input, text) };\n\t}\n\tif (/\\b(?:HTTP\\s*)?401\\b|\\bunauthori[sz]ed\\b|\\bauthentication (?:failed|required)\\b|\\bnot logged in\\b/i.test(text)) {\n\t\treturn { kind: \"auth_error\", retryable: false };\n\t}\n\tif (\n\t\tCURSOR_CONTEXT_OVERFLOW_WORDINGS.some(\n\t\t\t(wording) => hasExactLine(lines, wording) || hasExactLine(lines, `Error: ${wording}`),\n\t\t)\n\t) {\n\t\treturn { kind: \"context_overflow\", retryable: false };\n\t}\n\tif (\n\t\t/\\b(?:ECONNRESET|ECONNREFUSED|ETIMEDOUT|ENETUNREACH|EHOSTUNREACH|ENOTFOUND|EAI_AGAIN)\\b|\\bnetwork error\\b|\\bconnection (?:reset|refused|lost)\\b|\\bsocket hang up\\b|\\bfetch failed\\b/i.test(\n\t\t\ttext,\n\t\t)\n\t) {\n\t\treturn { kind: \"network\", retryable: true };\n\t}\n\treturn OTHER_ERROR;\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type CursorAgentDirectoryEntry = {
|
|
2
|
+
name: string;
|
|
3
|
+
isDirectory: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type CursorAgentExecutableDeps = {
|
|
6
|
+
env: (name: string) => string | undefined;
|
|
7
|
+
settings: {
|
|
8
|
+
executablePath?: string;
|
|
9
|
+
};
|
|
10
|
+
homeDirectory: string;
|
|
11
|
+
pathDelimiter: string;
|
|
12
|
+
isExecutableFile: (candidate: string) => boolean;
|
|
13
|
+
readDirectory: (directory: string) => CursorAgentDirectoryEntry[];
|
|
14
|
+
};
|
|
15
|
+
export type VersionProbeOptions = {
|
|
16
|
+
encoding: "utf8";
|
|
17
|
+
timeout: number;
|
|
18
|
+
};
|
|
19
|
+
export type VersionProbeCallback = (error: Error | null, stdout: string, stderr: string) => void;
|
|
20
|
+
export type VersionProbeDeps = {
|
|
21
|
+
execFile: (file: string, args: string[], options: VersionProbeOptions, callback: VersionProbeCallback) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare class CursorAgentNotInstalledError extends Error {
|
|
24
|
+
readonly kind = "binary_missing";
|
|
25
|
+
constructor();
|
|
26
|
+
}
|
|
27
|
+
export declare function resolveCursorAgentExecutable(deps: CursorAgentExecutableDeps): string;
|
|
28
|
+
export declare function probeCursorAgentVersion(executable: string, deps?: VersionProbeDeps): Promise<string>;
|
|
29
|
+
export declare function defaultCursorAgentExecutableDeps(): CursorAgentExecutableDeps;
|
|
30
|
+
//# sourceMappingURL=executable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executable.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/executable.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACvC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IACjD,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,yBAAyB,EAAE,CAAC;CAClE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;AAEjG,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC/G,CAAC;AAEF,qBAAa,4BAA6B,SAAQ,KAAK;IACtD,QAAQ,CAAC,IAAI,oBAAoB;;CASjC;AA6CD,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,yBAAyB,GAAG,MAAM,CAkBpF;AAUD,wBAAgB,uBAAuB,CACtC,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE,gBAA0C,GAC9C,OAAO,CAAC,MAAM,CAAC,CAUjB;AAED,wBAAgB,gCAAgC,IAAI,yBAAyB,CAqB5E"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { execFile as nodeExecFile } from "node:child_process";
|
|
2
|
+
import { accessSync, constants, readdirSync, statSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { delimiter, join } from "node:path";
|
|
5
|
+
export class CursorAgentNotInstalledError extends Error {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("Cursor CLI is not installed. Install it with `curl https://cursor.com/install -fsS | bash`, " +
|
|
8
|
+
"then ensure ~/.local/bin is on your PATH.");
|
|
9
|
+
this.kind = "binary_missing";
|
|
10
|
+
this.name = "CursorAgentNotInstalledError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function executableCandidate(candidate, deps) {
|
|
14
|
+
if (!candidate)
|
|
15
|
+
return undefined;
|
|
16
|
+
try {
|
|
17
|
+
return deps.isExecutableFile(candidate) ? candidate : undefined;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function resolveFromPath(deps) {
|
|
24
|
+
const pathValue = deps.env("PATH");
|
|
25
|
+
if (!pathValue)
|
|
26
|
+
return undefined;
|
|
27
|
+
for (const directory of pathValue.split(deps.pathDelimiter)) {
|
|
28
|
+
if (!directory)
|
|
29
|
+
continue;
|
|
30
|
+
const candidate = executableCandidate(join(directory, "cursor-agent"), deps);
|
|
31
|
+
if (candidate)
|
|
32
|
+
return candidate;
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
function resolveFromInstalledVersions(deps) {
|
|
37
|
+
const versionsDirectory = join(deps.homeDirectory, ".local", "share", "cursor-agent", "versions");
|
|
38
|
+
let entries;
|
|
39
|
+
try {
|
|
40
|
+
entries = deps.readDirectory(versionsDirectory);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const directoryNames = entries
|
|
46
|
+
.filter((entry) => entry.isDirectory)
|
|
47
|
+
.map((entry) => entry.name)
|
|
48
|
+
.sort()
|
|
49
|
+
.reverse();
|
|
50
|
+
for (const directoryName of directoryNames) {
|
|
51
|
+
const candidate = executableCandidate(join(versionsDirectory, directoryName, "cursor-agent"), deps);
|
|
52
|
+
if (candidate)
|
|
53
|
+
return candidate;
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
export function resolveCursorAgentExecutable(deps) {
|
|
58
|
+
const orderedCandidates = [
|
|
59
|
+
deps.env("SENPI_CURSOR_CLI_OAUTH_EXECUTABLE"),
|
|
60
|
+
deps.env("CURSOR_AGENT_EXECUTABLE"),
|
|
61
|
+
deps.settings.executablePath,
|
|
62
|
+
];
|
|
63
|
+
for (const candidate of orderedCandidates) {
|
|
64
|
+
const executable = executableCandidate(candidate, deps);
|
|
65
|
+
if (executable)
|
|
66
|
+
return executable;
|
|
67
|
+
}
|
|
68
|
+
const pathExecutable = resolveFromPath(deps);
|
|
69
|
+
if (pathExecutable)
|
|
70
|
+
return pathExecutable;
|
|
71
|
+
const installedExecutable = resolveFromInstalledVersions(deps);
|
|
72
|
+
if (installedExecutable)
|
|
73
|
+
return installedExecutable;
|
|
74
|
+
throw new CursorAgentNotInstalledError();
|
|
75
|
+
}
|
|
76
|
+
const defaultVersionProbeDeps = {
|
|
77
|
+
execFile: (file, args, options, callback) => {
|
|
78
|
+
nodeExecFile(file, args, options, (error, stdout, stderr) => {
|
|
79
|
+
callback(error, stdout, stderr);
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
export function probeCursorAgentVersion(executable, deps = defaultVersionProbeDeps) {
|
|
84
|
+
return new Promise((resolve, reject) => {
|
|
85
|
+
deps.execFile(executable, ["--version"], { encoding: "utf8", timeout: 10_000 }, (error, stdout) => {
|
|
86
|
+
if (error) {
|
|
87
|
+
reject(error);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
resolve(stdout.trim());
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export function defaultCursorAgentExecutableDeps() {
|
|
95
|
+
return {
|
|
96
|
+
env: (name) => process.env[name],
|
|
97
|
+
settings: {},
|
|
98
|
+
homeDirectory: homedir(),
|
|
99
|
+
pathDelimiter: delimiter,
|
|
100
|
+
isExecutableFile: (candidate) => {
|
|
101
|
+
try {
|
|
102
|
+
if (!statSync(candidate).isFile())
|
|
103
|
+
return false;
|
|
104
|
+
accessSync(candidate, constants.X_OK);
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
readDirectory: (directory) => readdirSync(directory, { withFileTypes: true }).map((entry) => ({
|
|
112
|
+
name: entry.name,
|
|
113
|
+
isDirectory: entry.isDirectory(),
|
|
114
|
+
})),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=executable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executable.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/executable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA2B5C,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IAGtD;QACC,KAAK,CACJ,8FAA8F;YAC7F,2CAA2C,CAC5C,CAAC;QANM,SAAI,GAAG,gBAAgB,CAAC;QAOhC,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC5C,CAAC;CACD;AAED,SAAS,mBAAmB,CAAC,SAA6B,EAAE,IAA+B;IAC1F,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAC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AW,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YACjG,IAAI,KAAK,EAAE,CAAC;gBACX,MAAM,CAAC,KAAK,CAAC,CAAC;gBACd,OAAO;YACR,CAAC;YACD,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gCAAgC;IAC/C,OAAO;QACN,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QAChC,QAAQ,EAAE,EAAE;QACZ,aAAa,EAAE,OAAO,EAAE;QACxB,aAAa,EAAE,SAAS;QACxB,gBAAgB,EAAE,CAAC,SAAS,EAAE,EAAE;YAC/B,IAAI,CAAC;gBACJ,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE;oBAAE,OAAO,KAAK,CAAC;gBAChD,UAAU,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;YACb,CAAC;YAAC,MAAM,CAAC;gBACR,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QACD,aAAa,EAAE,CAAC,SAAS,EAAE,EAAE,CAC5B,WAAW,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC/D,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE;SAChC,CAAC,CAAC;KACJ,CAAC;AACH,CAAC","sourcesContent":["import { execFile as nodeExecFile } from \"node:child_process\";\nimport { accessSync, constants, readdirSync, statSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { delimiter, join } from \"node:path\";\n\nexport type CursorAgentDirectoryEntry = {\n\tname: string;\n\tisDirectory: boolean;\n};\n\nexport type CursorAgentExecutableDeps = {\n\tenv: (name: string) => string | undefined;\n\tsettings: { executablePath?: string };\n\thomeDirectory: string;\n\tpathDelimiter: string;\n\tisExecutableFile: (candidate: string) => boolean;\n\treadDirectory: (directory: string) => CursorAgentDirectoryEntry[];\n};\n\nexport type VersionProbeOptions = {\n\tencoding: \"utf8\";\n\ttimeout: number;\n};\n\nexport type VersionProbeCallback = (error: Error | null, stdout: string, stderr: string) => void;\n\nexport type VersionProbeDeps = {\n\texecFile: (file: string, args: string[], options: VersionProbeOptions, callback: VersionProbeCallback) => void;\n};\n\nexport class CursorAgentNotInstalledError extends Error {\n\treadonly kind = \"binary_missing\";\n\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Cursor CLI is not installed. Install it with `curl https://cursor.com/install -fsS | bash`, \" +\n\t\t\t\t\"then ensure ~/.local/bin is on your PATH.\",\n\t\t);\n\t\tthis.name = \"CursorAgentNotInstalledError\";\n\t}\n}\n\nfunction executableCandidate(candidate: string | undefined, deps: CursorAgentExecutableDeps): string | undefined {\n\tif (!candidate) return undefined;\n\ttry {\n\t\treturn deps.isExecutableFile(candidate) ? candidate : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction resolveFromPath(deps: CursorAgentExecutableDeps): string | undefined {\n\tconst pathValue = deps.env(\"PATH\");\n\tif (!pathValue) return undefined;\n\n\tfor (const directory of pathValue.split(deps.pathDelimiter)) {\n\t\tif (!directory) continue;\n\t\tconst candidate = executableCandidate(join(directory, \"cursor-agent\"), deps);\n\t\tif (candidate) return candidate;\n\t}\n\treturn undefined;\n}\n\nfunction resolveFromInstalledVersions(deps: CursorAgentExecutableDeps): string | undefined {\n\tconst versionsDirectory = join(deps.homeDirectory, \".local\", \"share\", \"cursor-agent\", \"versions\");\n\tlet entries: CursorAgentDirectoryEntry[];\n\ttry {\n\t\tentries = deps.readDirectory(versionsDirectory);\n\t} catch {\n\t\treturn undefined;\n\t}\n\n\tconst directoryNames = entries\n\t\t.filter((entry) => entry.isDirectory)\n\t\t.map((entry) => entry.name)\n\t\t.sort()\n\t\t.reverse();\n\n\tfor (const directoryName of directoryNames) {\n\t\tconst candidate = executableCandidate(join(versionsDirectory, directoryName, \"cursor-agent\"), deps);\n\t\tif (candidate) return candidate;\n\t}\n\treturn undefined;\n}\n\nexport function resolveCursorAgentExecutable(deps: CursorAgentExecutableDeps): string {\n\tconst orderedCandidates = [\n\t\tdeps.env(\"SENPI_CURSOR_CLI_OAUTH_EXECUTABLE\"),\n\t\tdeps.env(\"CURSOR_AGENT_EXECUTABLE\"),\n\t\tdeps.settings.executablePath,\n\t];\n\tfor (const candidate of orderedCandidates) {\n\t\tconst executable = executableCandidate(candidate, deps);\n\t\tif (executable) return executable;\n\t}\n\n\tconst pathExecutable = resolveFromPath(deps);\n\tif (pathExecutable) return pathExecutable;\n\n\tconst installedExecutable = resolveFromInstalledVersions(deps);\n\tif (installedExecutable) return installedExecutable;\n\n\tthrow new CursorAgentNotInstalledError();\n}\n\nconst defaultVersionProbeDeps: VersionProbeDeps = {\n\texecFile: (file, args, options, callback) => {\n\t\tnodeExecFile(file, args, options, (error, stdout, stderr) => {\n\t\t\tcallback(error, stdout, stderr);\n\t\t});\n\t},\n};\n\nexport function probeCursorAgentVersion(\n\texecutable: string,\n\tdeps: VersionProbeDeps = defaultVersionProbeDeps,\n): Promise<string> {\n\treturn new Promise((resolve, reject) => {\n\t\tdeps.execFile(executable, [\"--version\"], { encoding: \"utf8\", timeout: 10_000 }, (error, stdout) => {\n\t\t\tif (error) {\n\t\t\t\treject(error);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(stdout.trim());\n\t\t});\n\t});\n}\n\nexport function defaultCursorAgentExecutableDeps(): CursorAgentExecutableDeps {\n\treturn {\n\t\tenv: (name) => process.env[name],\n\t\tsettings: {},\n\t\thomeDirectory: homedir(),\n\t\tpathDelimiter: delimiter,\n\t\tisExecutableFile: (candidate) => {\n\t\t\ttry {\n\t\t\t\tif (!statSync(candidate).isFile()) return false;\n\t\t\t\taccessSync(candidate, constants.X_OK);\n\t\t\t\treturn true;\n\t\t\t} catch {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\treadDirectory: (directory) =>\n\t\t\treaddirSync(directory, { withFileTypes: true }).map((entry) => ({\n\t\t\t\tname: entry.name,\n\t\t\t\tisDirectory: entry.isDirectory(),\n\t\t\t})),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { CredentialStore } from "@earendil-works/pi-ai";
|
|
2
|
+
import { type CursorCliAccountSlot } from "./accounts.ts";
|
|
3
|
+
import { type CursorAffinityOptions } from "./affinity.ts";
|
|
4
|
+
import { type CursorCliErrorClassification, type CursorCliErrorInput } from "./errors.ts";
|
|
5
|
+
export type CursorCliFailoverNotice = {
|
|
6
|
+
type: "cursor_account_changed";
|
|
7
|
+
message: string;
|
|
8
|
+
fromAccount: string;
|
|
9
|
+
toAccount: string;
|
|
10
|
+
freshChat: true;
|
|
11
|
+
priorContextCarriedOver: false;
|
|
12
|
+
};
|
|
13
|
+
export type CursorCliAttemptOptions = {
|
|
14
|
+
/** Cross-account Cursor chats cannot be resumed because each account has its own HOME. */
|
|
15
|
+
freshChat: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type CursorCliFailoverOptions<TEvent> = {
|
|
18
|
+
store: CredentialStore;
|
|
19
|
+
providerId: string;
|
|
20
|
+
affinity?: CursorAffinityOptions;
|
|
21
|
+
runAttempt: (account: CursorCliAccountSlot, options: CursorCliAttemptOptions) => AsyncIterable<TEvent> | Promise<AsyncIterable<TEvent>>;
|
|
22
|
+
now?: () => number;
|
|
23
|
+
classify?: (input: CursorCliErrorInput) => CursorCliErrorClassification;
|
|
24
|
+
errorFromEvent?: (event: TEvent) => CursorCliErrorInput | undefined;
|
|
25
|
+
isVisibleAssistantDelta?: (event: TEvent) => boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare class CursorCliFailoverError extends Error {
|
|
28
|
+
readonly classification: CursorCliErrorClassification;
|
|
29
|
+
readonly original: unknown;
|
|
30
|
+
readonly visibleAssistantDeltaEmitted: boolean;
|
|
31
|
+
constructor(classification: CursorCliErrorClassification, original: unknown, visibleAssistantDeltaEmitted: boolean);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Runs one Cursor CLI stream at a time and rotates accounts only before any
|
|
35
|
+
* assistant text is visible. Replacement accounts always start a fresh chat;
|
|
36
|
+
* this module never accepts or transfers a chat id or transcript context.
|
|
37
|
+
*/
|
|
38
|
+
export declare function runCursorCliFailover<TEvent>(options: CursorCliFailoverOptions<TEvent>): AsyncGenerator<TEvent | CursorCliFailoverNotice>;
|
|
39
|
+
//# sourceMappingURL=failover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failover.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/failover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,KAAK,oBAAoB,EAA+C,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,KAAK,qBAAqB,EAAiB,MAAM,eAAe,CAAC;AAC1E,OAAO,EACN,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EAIxB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,IAAI,CAAC;IAChB,uBAAuB,EAAE,KAAK,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACrC,0FAA0F;IAC1F,SAAS,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,MAAM,IAAI;IAC9C,KAAK,EAAE,eAAe,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,UAAU,EAAE,CACX,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,uBAAuB,KAC5B,aAAa,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,4BAA4B,CAAC;IACxE,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,mBAAmB,GAAG,SAAS,CAAC;IACpE,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;CACrD,CAAC;AAEF,qBAAa,sBAAuB,SAAQ,KAAK;IAChD,QAAQ,CAAC,cAAc,EAAE,4BAA4B,CAAC;IACtD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,4BAA4B,EAAE,OAAO,CAAC;gBAEnC,cAAc,EAAE,4BAA4B,EAAE,QAAQ,EAAE,OAAO,EAAE,4BAA4B,EAAE,OAAO;CAOlH;AAyHD;;;;GAIG;AACH,wBAAuB,oBAAoB,CAAC,MAAM,EACjD,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACvC,cAAc,CAAC,MAAM,GAAG,uBAAuB,CAAC,CAmClD"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { listAccounts } from "./accounts.js";
|
|
2
|
+
import { selectAccount } from "./affinity.js";
|
|
3
|
+
import { classifyCursorCliError, DEFAULT_RATE_LIMIT_BLOCK_MS, MAX_RATE_LIMIT_BLOCK_MS, } from "./errors.js";
|
|
4
|
+
export class CursorCliFailoverError extends Error {
|
|
5
|
+
constructor(classification, original, visibleAssistantDeltaEmitted) {
|
|
6
|
+
super(errorMessage(original));
|
|
7
|
+
this.name = "CursorCliFailoverError";
|
|
8
|
+
this.classification = classification;
|
|
9
|
+
this.original = original;
|
|
10
|
+
this.visibleAssistantDeltaEmitted = visibleAssistantDeltaEmitted;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
class CursorCliNoAssistantOutputError extends Error {
|
|
14
|
+
constructor() {
|
|
15
|
+
super("Cursor CLI attempt completed without visible assistant text");
|
|
16
|
+
this.name = "CursorCliNoAssistantOutputError";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function record(value) {
|
|
20
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
21
|
+
? value
|
|
22
|
+
: undefined;
|
|
23
|
+
}
|
|
24
|
+
function errorMessage(error) {
|
|
25
|
+
if (error instanceof Error)
|
|
26
|
+
return error.message;
|
|
27
|
+
if (typeof error === "string")
|
|
28
|
+
return error;
|
|
29
|
+
const message = record(error)?.message;
|
|
30
|
+
return typeof message === "string" ? message : "Cursor CLI attempt failed";
|
|
31
|
+
}
|
|
32
|
+
function errorInput(error) {
|
|
33
|
+
const value = record(error);
|
|
34
|
+
if (value && ("exitCode" in value || "stderr" in value || "resultEvent" in value || "thrown" in value)) {
|
|
35
|
+
return error;
|
|
36
|
+
}
|
|
37
|
+
return { thrown: error };
|
|
38
|
+
}
|
|
39
|
+
function defaultErrorFromEvent(event) {
|
|
40
|
+
const value = record(event);
|
|
41
|
+
if (value?.type === "malformed_stream")
|
|
42
|
+
return { thrown: event };
|
|
43
|
+
if (value?.type === "result" && (value.is_error === true || value.subtype === "error")) {
|
|
44
|
+
return { resultEvent: event };
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
function defaultIsVisibleAssistantDelta(event) {
|
|
49
|
+
const value = record(event);
|
|
50
|
+
if (!value)
|
|
51
|
+
return false;
|
|
52
|
+
if (value.type === "assistant") {
|
|
53
|
+
const message = record(value.message);
|
|
54
|
+
if (!Array.isArray(message?.content))
|
|
55
|
+
return false;
|
|
56
|
+
return message.content.some((item) => {
|
|
57
|
+
const block = record(item);
|
|
58
|
+
return block?.type === "text" && typeof block.text === "string" && block.text.length > 0;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return ((value.type === "assistant_delta" || value.type === "text_delta") &&
|
|
62
|
+
typeof value.delta === "string" &&
|
|
63
|
+
value.delta.length > 0);
|
|
64
|
+
}
|
|
65
|
+
function notice(fromAccount, toAccount) {
|
|
66
|
+
return {
|
|
67
|
+
type: "cursor_account_changed",
|
|
68
|
+
message: `Cursor account changed from '${fromAccount}' to '${toAccount}'; a fresh chat was started and prior context was not carried over.`,
|
|
69
|
+
fromAccount,
|
|
70
|
+
toAccount,
|
|
71
|
+
freshChat: true,
|
|
72
|
+
priorContextCarriedOver: false,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async function readCredential(store, providerId) {
|
|
76
|
+
const current = await store.read(providerId);
|
|
77
|
+
return current?.type === "oauth" ? current : undefined;
|
|
78
|
+
}
|
|
79
|
+
async function selectStoredAccount(options, now) {
|
|
80
|
+
const credential = await readCredential(options.store, options.providerId);
|
|
81
|
+
const accounts = credential ? listAccounts(credential) : [];
|
|
82
|
+
return selectAccount(accounts, {
|
|
83
|
+
...options.affinity,
|
|
84
|
+
pinnedAccount: options.affinity?.pinnedAccount ?? credential?.pinned,
|
|
85
|
+
now,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function blockedAccount(account, classification, now) {
|
|
89
|
+
if (classification.kind === "auth_error") {
|
|
90
|
+
const { blockedUntil: _blockedUntil, ...withoutExpiry } = account;
|
|
91
|
+
return { ...withoutExpiry, blockReason: "auth_error" };
|
|
92
|
+
}
|
|
93
|
+
const duration = Math.min(MAX_RATE_LIMIT_BLOCK_MS, classification.blockMs ?? DEFAULT_RATE_LIMIT_BLOCK_MS);
|
|
94
|
+
return { ...account, blockedUntil: now + duration, blockReason: "rate_limit" };
|
|
95
|
+
}
|
|
96
|
+
async function persistBlock(store, providerId, account) {
|
|
97
|
+
await store.modify(providerId, async (current) => {
|
|
98
|
+
if (current?.type !== "oauth")
|
|
99
|
+
return current;
|
|
100
|
+
const credential = current;
|
|
101
|
+
return {
|
|
102
|
+
...credential,
|
|
103
|
+
accounts: (credential.accounts ?? []).map((existing) => existing.name === account.name
|
|
104
|
+
? { ...existing, blockedUntil: account.blockedUntil, blockReason: account.blockReason }
|
|
105
|
+
: existing),
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function isFailoverKind(classification) {
|
|
110
|
+
return classification.kind === "rate_limit" || classification.kind === "auth_error";
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Runs one Cursor CLI stream at a time and rotates accounts only before any
|
|
114
|
+
* assistant text is visible. Replacement accounts always start a fresh chat;
|
|
115
|
+
* this module never accepts or transfers a chat id or transcript context.
|
|
116
|
+
*/
|
|
117
|
+
export async function* runCursorCliFailover(options) {
|
|
118
|
+
const now = options.now ?? Date.now;
|
|
119
|
+
const classify = options.classify ?? classifyCursorCliError;
|
|
120
|
+
const errorFromEvent = options.errorFromEvent ?? defaultErrorFromEvent;
|
|
121
|
+
const isVisibleAssistantDelta = options.isVisibleAssistantDelta ?? defaultIsVisibleAssistantDelta;
|
|
122
|
+
let account = await selectStoredAccount(options, now());
|
|
123
|
+
let freshChat = false;
|
|
124
|
+
while (true) {
|
|
125
|
+
let visibleAssistantDeltaEmitted = false;
|
|
126
|
+
try {
|
|
127
|
+
const attemptStream = await options.runAttempt(account, { freshChat });
|
|
128
|
+
for await (const event of attemptStream) {
|
|
129
|
+
const failure = errorFromEvent(event);
|
|
130
|
+
if (failure !== undefined)
|
|
131
|
+
throw failure;
|
|
132
|
+
visibleAssistantDeltaEmitted ||= isVisibleAssistantDelta(event);
|
|
133
|
+
yield event;
|
|
134
|
+
}
|
|
135
|
+
if (!visibleAssistantDeltaEmitted)
|
|
136
|
+
throw new CursorCliNoAssistantOutputError();
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
const classification = classify(errorInput(error));
|
|
141
|
+
const surfaced = new CursorCliFailoverError(classification, error, visibleAssistantDeltaEmitted);
|
|
142
|
+
if (!isFailoverKind(classification))
|
|
143
|
+
throw surfaced;
|
|
144
|
+
const blocked = blockedAccount(account, classification, now());
|
|
145
|
+
await persistBlock(options.store, options.providerId, blocked);
|
|
146
|
+
if (visibleAssistantDeltaEmitted)
|
|
147
|
+
throw surfaced;
|
|
148
|
+
const nextAccount = await selectStoredAccount(options, now());
|
|
149
|
+
yield notice(account.name, nextAccount.name);
|
|
150
|
+
account = nextAccount;
|
|
151
|
+
freshChat = true;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=failover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failover.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/cursor-cli-oauth/failover.ts"],"names":[],"mappings":"AACA,OAAO,EAA4D,YAAY,EAAE,MAAM,eAAe,CAAC;AACvG,OAAO,EAA8B,aAAa,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAGN,sBAAsB,EACtB,2BAA2B,EAC3B,uBAAuB,GACvB,MAAM,aAAa,CAAC;AA8BrB,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAKhD,YAAY,cAA4C,EAAE,QAAiB,EAAE,4BAAqC;QACjH,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,4BAA4B,GAAG,4BAA4B,CAAC;IAClE,CAAC;CACD;AAED,MAAM,+BAAgC,SAAQ,KAAK;IAClD;QACC,KA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\nimport { type CursorCliAccountSlot, type CursorCliOauthCredential, listAccounts } from \"./accounts.ts\";\nimport { type CursorAffinityOptions, selectAccount } from \"./affinity.ts\";\nimport {\n\ttype CursorCliErrorClassification,\n\ttype CursorCliErrorInput,\n\tclassifyCursorCliError,\n\tDEFAULT_RATE_LIMIT_BLOCK_MS,\n\tMAX_RATE_LIMIT_BLOCK_MS,\n} from \"./errors.ts\";\n\nexport type CursorCliFailoverNotice = {\n\ttype: \"cursor_account_changed\";\n\tmessage: string;\n\tfromAccount: string;\n\ttoAccount: string;\n\tfreshChat: true;\n\tpriorContextCarriedOver: false;\n};\n\nexport type CursorCliAttemptOptions = {\n\t/** Cross-account Cursor chats cannot be resumed because each account has its own HOME. */\n\tfreshChat: boolean;\n};\n\nexport type CursorCliFailoverOptions<TEvent> = {\n\tstore: CredentialStore;\n\tproviderId: string;\n\taffinity?: CursorAffinityOptions;\n\trunAttempt: (\n\t\taccount: CursorCliAccountSlot,\n\t\toptions: CursorCliAttemptOptions,\n\t) => AsyncIterable<TEvent> | Promise<AsyncIterable<TEvent>>;\n\tnow?: () => number;\n\tclassify?: (input: CursorCliErrorInput) => CursorCliErrorClassification;\n\terrorFromEvent?: (event: TEvent) => CursorCliErrorInput | undefined;\n\tisVisibleAssistantDelta?: (event: TEvent) => boolean;\n};\n\nexport class CursorCliFailoverError extends Error {\n\treadonly classification: CursorCliErrorClassification;\n\treadonly original: unknown;\n\treadonly visibleAssistantDeltaEmitted: boolean;\n\n\tconstructor(classification: CursorCliErrorClassification, original: unknown, visibleAssistantDeltaEmitted: boolean) {\n\t\tsuper(errorMessage(original));\n\t\tthis.name = \"CursorCliFailoverError\";\n\t\tthis.classification = classification;\n\t\tthis.original = original;\n\t\tthis.visibleAssistantDeltaEmitted = visibleAssistantDeltaEmitted;\n\t}\n}\n\nclass CursorCliNoAssistantOutputError extends Error {\n\tconstructor() {\n\t\tsuper(\"Cursor CLI attempt completed without visible assistant text\");\n\t\tthis.name = \"CursorCliNoAssistantOutputError\";\n\t}\n}\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value)\n\t\t? (value as Record<string, unknown>)\n\t\t: undefined;\n}\n\nfunction errorMessage(error: unknown): string {\n\tif (error instanceof Error) return error.message;\n\tif (typeof error === \"string\") return error;\n\tconst message = record(error)?.message;\n\treturn typeof message === \"string\" ? message : \"Cursor CLI attempt failed\";\n}\n\nfunction errorInput(error: unknown): CursorCliErrorInput {\n\tconst value = record(error);\n\tif (value && (\"exitCode\" in value || \"stderr\" in value || \"resultEvent\" in value || \"thrown\" in value)) {\n\t\treturn error as CursorCliErrorInput;\n\t}\n\treturn { thrown: error };\n}\n\nfunction defaultErrorFromEvent<TEvent>(event: TEvent): CursorCliErrorInput | undefined {\n\tconst value = record(event);\n\tif (value?.type === \"malformed_stream\") return { thrown: event };\n\tif (value?.type === \"result\" && (value.is_error === true || value.subtype === \"error\")) {\n\t\treturn { resultEvent: event };\n\t}\n\treturn undefined;\n}\n\nfunction defaultIsVisibleAssistantDelta<TEvent>(event: TEvent): boolean {\n\tconst value = record(event);\n\tif (!value) return false;\n\tif (value.type === \"assistant\") {\n\t\tconst message = record(value.message);\n\t\tif (!Array.isArray(message?.content)) return false;\n\t\treturn message.content.some((item) => {\n\t\t\tconst block = record(item);\n\t\t\treturn block?.type === \"text\" && typeof block.text === \"string\" && block.text.length > 0;\n\t\t});\n\t}\n\treturn (\n\t\t(value.type === \"assistant_delta\" || value.type === \"text_delta\") &&\n\t\ttypeof value.delta === \"string\" &&\n\t\tvalue.delta.length > 0\n\t);\n}\n\nfunction notice(fromAccount: string, toAccount: string): CursorCliFailoverNotice {\n\treturn {\n\t\ttype: \"cursor_account_changed\",\n\t\tmessage: `Cursor account changed from '${fromAccount}' to '${toAccount}'; a fresh chat was started and prior context was not carried over.`,\n\t\tfromAccount,\n\t\ttoAccount,\n\t\tfreshChat: true,\n\t\tpriorContextCarriedOver: false,\n\t};\n}\n\nasync function readCredential(\n\tstore: CredentialStore,\n\tproviderId: string,\n): Promise<CursorCliOauthCredential | undefined> {\n\tconst current = await store.read(providerId);\n\treturn current?.type === \"oauth\" ? (current as CursorCliOauthCredential) : undefined;\n}\n\nasync function selectStoredAccount(\n\toptions: Pick<CursorCliFailoverOptions<never>, \"store\" | \"providerId\" | \"affinity\">,\n\tnow: number,\n): Promise<CursorCliAccountSlot> {\n\tconst credential = await readCredential(options.store, options.providerId);\n\tconst accounts = credential ? listAccounts(credential) : [];\n\treturn selectAccount(accounts, {\n\t\t...options.affinity,\n\t\tpinnedAccount: options.affinity?.pinnedAccount ?? credential?.pinned,\n\t\tnow,\n\t});\n}\n\nfunction blockedAccount(\n\taccount: CursorCliAccountSlot,\n\tclassification: CursorCliErrorClassification,\n\tnow: number,\n): CursorCliAccountSlot {\n\tif (classification.kind === \"auth_error\") {\n\t\tconst { blockedUntil: _blockedUntil, ...withoutExpiry } = account;\n\t\treturn { ...withoutExpiry, blockReason: \"auth_error\" };\n\t}\n\tconst duration = Math.min(MAX_RATE_LIMIT_BLOCK_MS, classification.blockMs ?? DEFAULT_RATE_LIMIT_BLOCK_MS);\n\treturn { ...account, blockedUntil: now + duration, blockReason: \"rate_limit\" };\n}\n\nasync function persistBlock(store: CredentialStore, providerId: string, account: CursorCliAccountSlot): Promise<void> {\n\tawait store.modify(providerId, async (current) => {\n\t\tif (current?.type !== \"oauth\") return current;\n\t\tconst credential = current as CursorCliOauthCredential;\n\t\treturn {\n\t\t\t...credential,\n\t\t\taccounts: (credential.accounts ?? []).map((existing) =>\n\t\t\t\texisting.name === account.name\n\t\t\t\t\t? { ...existing, blockedUntil: account.blockedUntil, blockReason: account.blockReason }\n\t\t\t\t\t: existing,\n\t\t\t),\n\t\t};\n\t});\n}\n\nfunction isFailoverKind(classification: CursorCliErrorClassification): boolean {\n\treturn classification.kind === \"rate_limit\" || classification.kind === \"auth_error\";\n}\n\n/**\n * Runs one Cursor CLI stream at a time and rotates accounts only before any\n * assistant text is visible. Replacement accounts always start a fresh chat;\n * this module never accepts or transfers a chat id or transcript context.\n */\nexport async function* runCursorCliFailover<TEvent>(\n\toptions: CursorCliFailoverOptions<TEvent>,\n): AsyncGenerator<TEvent | CursorCliFailoverNotice> {\n\tconst now = options.now ?? Date.now;\n\tconst classify = options.classify ?? classifyCursorCliError;\n\tconst errorFromEvent = options.errorFromEvent ?? defaultErrorFromEvent;\n\tconst isVisibleAssistantDelta = options.isVisibleAssistantDelta ?? defaultIsVisibleAssistantDelta;\n\tlet account = await selectStoredAccount(options, now());\n\tlet freshChat = false;\n\n\twhile (true) {\n\t\tlet visibleAssistantDeltaEmitted = false;\n\t\ttry {\n\t\t\tconst attemptStream = await options.runAttempt(account, { freshChat });\n\t\t\tfor await (const event of attemptStream) {\n\t\t\t\tconst failure = errorFromEvent(event);\n\t\t\t\tif (failure !== undefined) throw failure;\n\t\t\t\tvisibleAssistantDeltaEmitted ||= isVisibleAssistantDelta(event);\n\t\t\t\tyield event;\n\t\t\t}\n\t\t\tif (!visibleAssistantDeltaEmitted) throw new CursorCliNoAssistantOutputError();\n\t\t\treturn;\n\t\t} catch (error) {\n\t\t\tconst classification = classify(errorInput(error));\n\t\t\tconst surfaced = new CursorCliFailoverError(classification, error, visibleAssistantDeltaEmitted);\n\t\t\tif (!isFailoverKind(classification)) throw surfaced;\n\n\t\t\tconst blocked = blockedAccount(account, classification, now());\n\t\t\tawait persistBlock(options.store, options.providerId, blocked);\n\t\t\tif (visibleAssistantDeltaEmitted) throw surfaced;\n\n\t\t\tconst nextAccount = await selectStoredAccount(options, now());\n\t\t\tyield notice(account.name, nextAccount.name);\n\t\t\taccount = nextAccount;\n\t\t\tfreshChat = true;\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type CursorCliOauthExecutionMode } from "./settings.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Guardrails for unattended Cursor CLI execution.
|
|
4
|
+
*
|
|
5
|
+
* The Cursor CLI runs its own tools the moment `--force` is on the argv, so
|
|
6
|
+
* that decision is never implicit: it requires the explicit
|
|
7
|
+
* `noApprovalAcknowledgedAt` acknowledgement, plan mode never forces, and a
|
|
8
|
+
* disabled force merely warns. Command denylists ride along through the
|
|
9
|
+
* per-account HOME's `cli-config.json`, strictly in the probe-proven shape
|
|
10
|
+
* (task 2: `permissions.deny` with exact full-command `Shell(...)` entries).
|
|
11
|
+
*/
|
|
12
|
+
/** Sandbox modes the installed CLI accepts (task 2 probe: allowed choices are exactly these). */
|
|
13
|
+
export declare const CURSOR_CLI_OAUTH_SANDBOX_MODES: readonly ["enabled", "disabled"];
|
|
14
|
+
export declare const CURSOR_CLI_OAUTH_NO_APPROVAL_EXPLANATION = "The Cursor CLI executes its own tools autonomously: with --force there is no senpi approval, no senpi sandboxing, and no tool-level audit for what it runs.";
|
|
15
|
+
export declare const CURSOR_CLI_OAUTH_ACKNOWLEDGEMENT_STEP = "Set \"cursorCliOauthProvider.noApprovalAcknowledgedAt\" to the current ISO-8601 timestamp (for example \"2026-08-17T12:00:00.000Z\") in senpi settings to acknowledge this once.";
|
|
16
|
+
/** One warning per session when force is disabled in agent mode (contracts block, task 18). */
|
|
17
|
+
export declare const CURSOR_CLI_OAUTH_FORCE_DISABLED_WARNING = "cursor-cli-oauth: forceExecution is disabled in agent mode, so the Cursor CLI will auto-reject every tool call; set executionMode to \"plan\" for planning turns that do not need execution.";
|
|
18
|
+
export type CursorCliGuardrailWarningCode = "force_execution_disabled" | "sandbox_mode_ignored" | "deny_command_rejected";
|
|
19
|
+
export type CursorCliGuardrailWarning = {
|
|
20
|
+
readonly kind: "warning";
|
|
21
|
+
readonly code: CursorCliGuardrailWarningCode;
|
|
22
|
+
readonly message: string;
|
|
23
|
+
};
|
|
24
|
+
export type CursorCliExecutionRefusal = {
|
|
25
|
+
readonly kind: "refusal";
|
|
26
|
+
readonly code: "no_approval_acknowledgement_required";
|
|
27
|
+
readonly message: string;
|
|
28
|
+
readonly acknowledgementStep: string;
|
|
29
|
+
};
|
|
30
|
+
export type CursorCliGuardrailSession = {
|
|
31
|
+
/** Every warning emitted so far in this session; one-time gates live here. */
|
|
32
|
+
readonly warnings: readonly CursorCliGuardrailWarning[];
|
|
33
|
+
/** Emit a warning once per deduplication key; returns whether it was emitted. */
|
|
34
|
+
warn(code: CursorCliGuardrailWarningCode, message: string, key?: string): boolean;
|
|
35
|
+
/** Validate a sandbox mode against the probe-proven allowlist, warning once per rejected value. */
|
|
36
|
+
validateSandboxMode(value: string | undefined): string | undefined;
|
|
37
|
+
};
|
|
38
|
+
export declare function createCursorCliGuardrailSession(): CursorCliGuardrailSession;
|
|
39
|
+
export type CursorCliExecutionPolicyInput = {
|
|
40
|
+
readonly forceExecution: boolean;
|
|
41
|
+
readonly noApprovalAcknowledgedAt: string | undefined;
|
|
42
|
+
readonly executionMode: CursorCliOauthExecutionMode;
|
|
43
|
+
readonly sandboxMode: string | undefined;
|
|
44
|
+
};
|
|
45
|
+
export type CursorCliExecutionDecision = {
|
|
46
|
+
readonly status: "refused";
|
|
47
|
+
readonly refusal: CursorCliExecutionRefusal;
|
|
48
|
+
} | {
|
|
49
|
+
readonly status: "allowed";
|
|
50
|
+
readonly force: boolean;
|
|
51
|
+
readonly executionMode: CursorCliOauthExecutionMode;
|
|
52
|
+
readonly sandboxMode: string | undefined;
|
|
53
|
+
readonly denyCommands: readonly string[];
|
|
54
|
+
/** Warnings accumulated in the session so far (not only this decision). */
|
|
55
|
+
readonly warnings: readonly CursorCliGuardrailWarning[];
|
|
56
|
+
};
|
|
57
|
+
/** Typed refusal for an unacknowledged force attempt; never confused with a warning. */
|
|
58
|
+
export declare class CursorCliExecutionRefusalError extends Error {
|
|
59
|
+
readonly code: "no_approval_acknowledgement_required";
|
|
60
|
+
readonly refusal: CursorCliExecutionRefusal;
|
|
61
|
+
constructor(refusal: CursorCliExecutionRefusal);
|
|
62
|
+
}
|
|
63
|
+
export declare function sanitizeCursorCliDenyCommands(entries: readonly string[], warn?: (message: string) => void): readonly string[];
|
|
64
|
+
/**
|
|
65
|
+
* Decide whether a turn may run unattended.
|
|
66
|
+
*
|
|
67
|
+
* - `--force` is emitted only in agent mode, only when force is requested, and
|
|
68
|
+
* only after `noApprovalAcknowledgedAt` is set; otherwise the decision is a
|
|
69
|
+
* typed refusal naming the acknowledgement step.
|
|
70
|
+
* - Plan mode never emits `--force` (the CLI only plans), so it needs no
|
|
71
|
+
* acknowledgement.
|
|
72
|
+
* - Force disabled in agent mode is allowed but warns once per session.
|
|
73
|
+
* - Unproven sandbox modes are ignored with one warning per distinct value.
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveCursorCliExecutionPolicy(input: CursorCliExecutionPolicyInput, session: CursorCliGuardrailSession, denyCommands?: readonly string[]): CursorCliExecutionDecision;
|
|
76
|
+
/**
|
|
77
|
+
* Pre-spawn hook: (re-)apply the deny list to the sandbox HOME's
|
|
78
|
+
* `cli-config.json`.
|
|
79
|
+
*
|
|
80
|
+
* The CLI rewrites this file during every invocation (task 2 observed its own
|
|
81
|
+
* keys appearing and `cli-config.json.bad` sidecars for malformed content), so
|
|
82
|
+
* this must run immediately before each spawn, composing with the home-store
|
|
83
|
+
* prepare pass that re-writes `auth.json` on the same cadence. Writes only the
|
|
84
|
+
* probe-proven shape (`permissions.deny` with exact `Shell(<full command>)`
|
|
85
|
+
* entries) and preserves every CLI-owned key already present. Writes nothing
|
|
86
|
+
* when no deny commands are configured.
|
|
87
|
+
*/
|
|
88
|
+
export declare function applyCursorCliDenyConfig(home: string, denyCommands: readonly string[]): void;
|
|
89
|
+
//# sourceMappingURL=guardrails.d.ts.map
|