@code-yeongyu/senpi 2026.11.13 → 2026.11.15

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/bundle/chunks/{args-H56W53X6.js → args-JWBI5LNO.js} +1 -1
  3. package/dist/bundle/chunks/{azure-openai-responses-MNN2TINI.js → azure-openai-responses-PEMLRPJ5.js} +1 -1
  4. package/dist/bundle/chunks/{chunk-HZQHA4PA.js → chunk-3RILB2OD.js} +1 -1
  5. package/dist/bundle/chunks/{chunk-Y4PFEXFN.js → chunk-5IXYN6DK.js} +1 -1
  6. package/dist/bundle/chunks/{chunk-BKDXY6EM.js → chunk-5NECOJNK.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-NI2AOYP6.js → chunk-6MRUNB3Z.js} +1 -1
  8. package/dist/bundle/chunks/chunk-6QQL3SKM.js +2 -0
  9. package/dist/bundle/chunks/{chunk-I4N2OIY4.js → chunk-6QXAYNO7.js} +17 -17
  10. package/dist/bundle/chunks/{chunk-7T2LAWZ4.js → chunk-73HGQTJN.js} +1 -1
  11. package/dist/bundle/chunks/chunk-75O3CWR5.js +2 -0
  12. package/dist/bundle/chunks/{chunk-AZ27TE3H.js → chunk-7BX3JQ7F.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-NDI6N4NJ.js → chunk-7CXLNKEH.js} +1 -1
  14. package/dist/bundle/chunks/{chunk-E6ZBTSC6.js → chunk-A3LGSX7Z.js} +1 -1
  15. package/dist/bundle/chunks/{chunk-7GD2EO6T.js → chunk-FYVQEZYN.js} +1 -1
  16. package/dist/bundle/chunks/{chunk-U4FAWC6C.js → chunk-GXPH7RN6.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-SFACYIB6.js → chunk-IK3S2NDB.js} +1 -1
  18. package/dist/bundle/chunks/{chunk-V4VDIV3U.js → chunk-PWA75RQU.js} +1 -1
  19. package/dist/bundle/chunks/{chunk-IREUIMFE.js → chunk-PWTXZXHH.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-KKB3K5CV.js → chunk-Q4RJ4WLE.js} +1 -1
  21. package/dist/bundle/chunks/chunk-QVG5SUSV.js +2 -0
  22. package/dist/bundle/chunks/chunk-RLIY3AUC.js +2 -0
  23. package/dist/bundle/chunks/{chunk-EQT4WNCW.js → chunk-TACOXP5H.js} +1 -1
  24. package/dist/bundle/chunks/{chunk-NXGSYUMV.js → chunk-TB6LIKVR.js} +2 -2
  25. package/dist/bundle/chunks/{chunk-JLCZIEBC.js → chunk-THYIV26N.js} +1 -1
  26. package/dist/bundle/chunks/{chunk-6FE42M54.js → chunk-VGHGM5PR.js} +1 -1
  27. package/dist/bundle/chunks/{chunk-CU6HUYL7.js → chunk-WAGFTIT4.js} +1 -1
  28. package/dist/bundle/chunks/{chunk-UYPH6RHY.js → chunk-Z4PN2MDA.js} +2 -2
  29. package/dist/bundle/chunks/{chunk-JJYN347Z.js → chunk-ZJUL5ODW.js} +1 -1
  30. package/dist/bundle/chunks/{cli-main-MY53RXU3.js → cli-main-MM2XCVYE.js} +1 -1
  31. package/dist/bundle/chunks/credential-accounts-RXZIUKFM.js +2 -0
  32. package/dist/bundle/chunks/github-copilot.js +1 -1
  33. package/dist/bundle/chunks/{hand-entry-AXTVMVJK.js → hand-entry-MBOPYO6I.js} +1 -1
  34. package/dist/bundle/chunks/{headless-host-SU5O2KZ2.js → headless-host-OEK6W65T.js} +1 -1
  35. package/dist/bundle/chunks/{health-write-TN7EXGLI.js → health-write-44JERGEJ.js} +1 -1
  36. package/dist/bundle/chunks/{help-fast-path-TFQ4HJNO.js → help-fast-path-JWHUCE4E.js} +1 -1
  37. package/dist/bundle/chunks/{host-command-FG56Y53E.js → host-command-O2K2WIPO.js} +1 -1
  38. package/dist/bundle/chunks/{host-session-command-UFEOW7EP.js → host-session-command-EWA6N4JJ.js} +1 -1
  39. package/dist/bundle/chunks/interactive-mode-VSZYRVYY.js +2 -0
  40. package/dist/bundle/chunks/{login-health-XBTIORM4.js → login-health-V4B6LSCP.js} +1 -1
  41. package/dist/bundle/chunks/main-VEWKRBTD.js +2 -0
  42. package/dist/bundle/chunks/{multi-session-host-Q6SHI22A.js → multi-session-host-HC6NR5N2.js} +1 -1
  43. package/dist/bundle/chunks/{openai-codex-responses-VRGOAFEG.js → openai-codex-responses-IFPWK7NG.js} +1 -1
  44. package/dist/bundle/chunks/openai-responses-2BTL5MA2.js +5 -0
  45. package/dist/bundle/chunks/{package-manager-cli-LILAWI3Q.js → package-manager-cli-OZ6DK6GI.js} +3 -3
  46. package/dist/bundle/chunks/{role-KODRTWH5.js → role-BTH5PVME.js} +1 -1
  47. package/dist/bundle/chunks/{rotation-stream-2KNROTYB.js → rotation-stream-ZGPXLY62.js} +1 -1
  48. package/dist/bundle/chunks/rpc-mode-WPF3NVBL.js +2 -0
  49. package/dist/bundle/chunks/{run-attached-tui-OEFHV5CZ.js → run-attached-tui-RVVYEINN.js} +1 -1
  50. package/dist/bundle/chunks/{schedule-command-VO4RP2KX.js → schedule-command-6TAAG2KU.js} +1 -1
  51. package/dist/bundle/chunks/{session-control-endpoint-CCVRJHSC.js → session-control-endpoint-3FNVOKKT.js} +1 -1
  52. package/dist/bundle/chunks/{session-picker-VN5I2ZDI.js → session-picker-YDXDCBRL.js} +1 -1
  53. package/dist/bundle/chunks/session-slot-N4E4OSCX.js +2 -0
  54. package/dist/bundle/chunks/session-worker.js +22 -21
  55. package/dist/bundle/chunks/{state-store-7RVODZJU.js → state-store-I6MUHET3.js} +1 -1
  56. package/dist/bundle/cli.js +2 -2
  57. package/dist/bundle/index.js +1 -1
  58. package/dist/bundle/rpc-entry.js +1 -1
  59. package/dist/bundle/runtime-manifest.json +1 -1
  60. package/dist/core/agent-session.d.ts +5 -3
  61. package/dist/core/agent-session.js +16 -6
  62. package/dist/core/credential-accounts.d.ts +5 -3
  63. package/dist/core/credential-accounts.js +8 -6
  64. package/dist/core/credential-pool/classify.js +5 -1
  65. package/dist/core/extensions/builtin/anthropic-subscription/content-blocks.d.ts +6 -0
  66. package/dist/core/extensions/builtin/anthropic-subscription/content-blocks.js +14 -0
  67. package/dist/core/extensions/builtin/anthropic-subscription/prompt-bridge.js +3 -1
  68. package/dist/core/extensions/builtin/anthropic-subscription/session-sync.js +4 -1
  69. package/dist/core/extensions/builtin/permission-system/index.js +5 -1
  70. package/dist/core/reasoning-baseline.d.ts +8 -1
  71. package/dist/core/reasoning-baseline.js +24 -0
  72. package/dist/modes/rpc/connection-handler.js +4 -0
  73. package/dist/modes/rpc/method-classes-schema-session.d.ts +3 -0
  74. package/dist/modes/rpc/method-classes-schema-session.js +6 -2
  75. package/dist/modes/rpc/method-classes-schema.d.ts +3 -0
  76. package/dist/modes/rpc/project-expected-cwd.d.ts +29 -0
  77. package/dist/modes/rpc/project-expected-cwd.js +45 -0
  78. package/dist/modes/rpc/rpc-error-types.d.ts +7 -1
  79. package/dist/modes/rpc/rpc-error-types.js +6 -0
  80. package/dist/modes/rpc/rpc-session-command-types.d.ts +3 -0
  81. package/dist/package-manager-cli.d.ts +14 -0
  82. package/dist/package-manager-cli.js +20 -4
  83. package/dist/utils/version-check.d.ts +10 -7
  84. package/dist/utils/version-check.js +24 -5
  85. package/docs/rpc.md +20 -7
  86. package/package.json +7 -7
  87. package/dist/bundle/chunks/chunk-GLTOBXZY.js +0 -2
  88. package/dist/bundle/chunks/chunk-PBUV2Z3R.js +0 -2
  89. package/dist/bundle/chunks/chunk-WRBOKYPS.js +0 -2
  90. package/dist/bundle/chunks/credential-accounts-ZB5IXHIG.js +0 -2
  91. package/dist/bundle/chunks/interactive-mode-PHES47E3.js +0 -2
  92. package/dist/bundle/chunks/main-PR4FI6HQ.js +0 -2
  93. package/dist/bundle/chunks/openai-responses-I7PXRWCM.js +0 -4
  94. package/dist/bundle/chunks/rpc-mode-CGVK4SSA.js +0 -2
  95. package/dist/bundle/chunks/session-slot-GHJVOSG7.js +0 -2
@@ -194,14 +194,18 @@ const SURFACE_AND_ACCOUNT_SCHEMAS = {
194
194
  get_commands: session("get_commands", {}),
195
195
  get_loaded_surfaces: session("get_loaded_surfaces", {}),
196
196
  get_project_trust: session("get_project_trust", {}),
197
- set_project_trust: session("set_project_trust", { choice: literals("trust", "trust_parent", "do_not_trust") }),
197
+ set_project_trust: session("set_project_trust", {
198
+ choice: literals("trust", "trust_parent", "do_not_trust"),
199
+ expectedCwd: OptStr,
200
+ }),
198
201
  get_project_settings: session("get_project_settings", {}),
199
- set_project_setting: session("set_project_setting", { key: Id, value: Type.Unknown() }),
202
+ set_project_setting: session("set_project_setting", { key: Id, value: Type.Unknown(), expectedCwd: OptStr }),
200
203
  read_project_file: session("read_project_file", { path: PathStr }),
201
204
  write_project_file: session("write_project_file", {
202
205
  path: PathStr,
203
206
  content: Str,
204
207
  ifEtag: Type.Union([Id, Type.Null()]),
208
+ expectedCwd: OptStr,
205
209
  }),
206
210
  extension_request: session("extension_request", { name: Id, data: Opt(Type.Unknown()) }),
207
211
  "eval_cells.list": session("eval_cells.list", {}),
@@ -1305,6 +1305,7 @@ export declare const RPC_INBOUND_SCHEMAS: {
1305
1305
  readonly sessionId: import("typebox").TOptional<import("typebox").TString>;
1306
1306
  } & {
1307
1307
  readonly choice: import("typebox").TUnion<[import("typebox").TLiteral<string>, ...import("typebox").TLiteral<string>[]]>;
1308
+ readonly expectedCwd: import("typebox").TOptional<import("typebox").TString>;
1308
1309
  }>;
1309
1310
  readonly get_project_settings: import("typebox").TObject<{
1310
1311
  id: import("typebox").TOptional<import("typebox").TString>;
@@ -1322,6 +1323,7 @@ export declare const RPC_INBOUND_SCHEMAS: {
1322
1323
  } & {
1323
1324
  readonly key: import("typebox").TString;
1324
1325
  readonly value: import("typebox").TUnknown;
1326
+ readonly expectedCwd: import("typebox").TOptional<import("typebox").TString>;
1325
1327
  }>;
1326
1328
  readonly read_project_file: import("typebox").TObject<{
1327
1329
  id: import("typebox").TOptional<import("typebox").TString>;
@@ -1342,6 +1344,7 @@ export declare const RPC_INBOUND_SCHEMAS: {
1342
1344
  readonly path: import("typebox").TString;
1343
1345
  readonly content: import("typebox").TString;
1344
1346
  readonly ifEtag: import("typebox").TUnion<[import("typebox").TString, import("typebox").TNull]>;
1347
+ readonly expectedCwd: import("typebox").TOptional<import("typebox").TString>;
1345
1348
  }>;
1346
1349
  readonly extension_request: import("typebox").TObject<{
1347
1350
  id: import("typebox").TOptional<import("typebox").TString>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A project write may state the folder its caller means (`expectedCwd`). A client that reaches a session by a key that
3
+ * can since name another session (a remote desktop, through a relay) states it, so the write lands only in the project
4
+ * it means: when the session's working directory is another folder, the write is refused and nothing is written.
5
+ * Absent, the write goes as it always has.
6
+ */
7
+ import { RPC_ERROR_INVALID_ARGUMENT, RPC_ERROR_PROJECT_CWD_MISMATCH } from "./rpc-error-types.ts";
8
+ /**
9
+ * A folder path for comparison. Trailing separators of the path's own style are dropped (only `/` for a POSIX path;
10
+ * `\\` or `/` for a drive or UNC path), but a bare POSIX or drive root keeps one: `"/"` stays `"/"`, and a bare drive
11
+ * root becomes `"X:\\"` (`"C:"`, `"C:/"` and `"c:\\"` all become `"C:\\"`). A Windows drive letter is compared
12
+ * without case (`c:` and `C:` are one drive). Nothing else is folded: the rest of the path is compared as written,
13
+ * because whether a file system ignores case depends on the volume and cannot be assumed; and nothing is trimmed,
14
+ * since on POSIX `"/w/app "` and `"/w/app\\"` are other directories.
15
+ */
16
+ export declare function comparableFolder(path: string): string;
17
+ export interface CwdMismatch {
18
+ readonly message: string;
19
+ readonly errorCode: typeof RPC_ERROR_PROJECT_CWD_MISMATCH | typeof RPC_ERROR_INVALID_ARGUMENT;
20
+ }
21
+ /**
22
+ * The refusal of a project write whose stated folder is not the session's, or whose `expectedCwd` is present but not a
23
+ * string, or undefined when it may go.
24
+ */
25
+ export declare function projectCwdMismatch(command: {
26
+ readonly type: string;
27
+ readonly expectedCwd?: unknown;
28
+ }, sessionCwd: string): CwdMismatch | undefined;
29
+ //# sourceMappingURL=project-expected-cwd.d.ts.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * A project write may state the folder its caller means (`expectedCwd`). A client that reaches a session by a key that
3
+ * can since name another session (a remote desktop, through a relay) states it, so the write lands only in the project
4
+ * it means: when the session's working directory is another folder, the write is refused and nothing is written.
5
+ * Absent, the write goes as it always has.
6
+ */
7
+ import { RPC_ERROR_INVALID_ARGUMENT, RPC_ERROR_PROJECT_CWD_MISMATCH } from "./rpc-error-types.js";
8
+ /** The project writes that may state the folder they mean. */
9
+ const PROJECT_WRITES = new Set(["set_project_trust", "set_project_setting", "write_project_file"]);
10
+ /**
11
+ * A folder path for comparison. Trailing separators of the path's own style are dropped (only `/` for a POSIX path;
12
+ * `\\` or `/` for a drive or UNC path), but a bare POSIX or drive root keeps one: `"/"` stays `"/"`, and a bare drive
13
+ * root becomes `"X:\\"` (`"C:"`, `"C:/"` and `"c:\\"` all become `"C:\\"`). A Windows drive letter is compared
14
+ * without case (`c:` and `C:` are one drive). Nothing else is folded: the rest of the path is compared as written,
15
+ * because whether a file system ignores case depends on the volume and cannot be assumed; and nothing is trimmed,
16
+ * since on POSIX `"/w/app "` and `"/w/app\\"` are other directories.
17
+ */
18
+ export function comparableFolder(path) {
19
+ if (path.startsWith("/"))
20
+ return path.replace(/\/+$/u, "") || "/";
21
+ const hasDrive = /^[A-Za-z]:/u.test(path);
22
+ const folded = hasDrive ? `${path.slice(0, 1).toUpperCase()}${path.slice(1)}` : path;
23
+ const stripped = folded.replace(/[/\\]+$/u, "");
24
+ return hasDrive && stripped.length === 2 ? `${stripped}\\` : stripped;
25
+ }
26
+ /**
27
+ * The refusal of a project write whose stated folder is not the session's, or whose `expectedCwd` is present but not a
28
+ * string, or undefined when it may go.
29
+ */
30
+ export function projectCwdMismatch(command, sessionCwd) {
31
+ if (!PROJECT_WRITES.has(command.type) || command.expectedCwd === undefined)
32
+ return undefined;
33
+ if (typeof command.expectedCwd !== "string")
34
+ return {
35
+ message: "expectedCwd must be a string: the folder this write is for; nothing was written.",
36
+ errorCode: RPC_ERROR_INVALID_ARGUMENT,
37
+ };
38
+ if (comparableFolder(command.expectedCwd) === comparableFolder(sessionCwd))
39
+ return undefined;
40
+ return {
41
+ message: "This session is in another folder than the one this write is for; nothing was written.",
42
+ errorCode: RPC_ERROR_PROJECT_CWD_MISMATCH,
43
+ };
44
+ }
45
+ //# sourceMappingURL=project-expected-cwd.js.map
@@ -22,6 +22,12 @@ export declare const RPC_ERROR_RESPONSE_TOO_LARGE = "response_too_large";
22
22
  * throwing `toJSON`); `error` names the cause. Sent in place of the reply so the caller is never left waiting (senpi#5702).
23
23
  */
24
24
  export declare const RPC_ERROR_RESPONSE_UNWRITABLE = "response_unwritable";
25
+ /**
26
+ * A project write stated the folder its caller means (`expectedCwd`) and the session is in another one: nothing is
27
+ * written. A client that names a session by a key that may since point at another session states the folder it
28
+ * means, so a write never lands in the wrong project.
29
+ */
30
+ export declare const RPC_ERROR_PROJECT_CWD_MISMATCH = "project_cwd_mismatch";
25
31
  export declare const RPC_ERROR_OPEN_FAILED = "open_failed";
26
32
  export declare const RPC_ERROR_OWNER_CHANGED = "owner_changed";
27
33
  export declare const RPC_ERROR_SESSION_NOT_HELD = "session_not_held";
@@ -131,5 +137,5 @@ export declare const RPC_ERROR_RELEASE_FAILED = "release_failed";
131
137
  export declare const RPC_ERROR_HOST_DRAINING = "host_draining";
132
138
  /** The supervisor has closed admission; a launch-owning caller may ensure a successor. */
133
139
  export declare const RPC_ERROR_HOST_STOPPING = "host_stopping";
134
- export type RpcErrorCode = typeof RPC_ERROR_SESSION_IDENTITY_MISMATCH | typeof RPC_ERROR_SESSION_BUSY_LIFECYCLE | typeof RPC_ERROR_ATTACHED_ELSEWHERE | typeof RPC_ERROR_OWNER_CHANGED | typeof RPC_ERROR_SESSION_NOT_HELD | typeof RPC_ERROR_HOST_STOPPING | typeof RPC_ERROR_UNKNOWN_SESSION | typeof RPC_ERROR_SESSION_NOT_ATTACHED | typeof RPC_ERROR_SESSION_CLOSING | typeof RPC_ERROR_SESSION_PATH_IN_USE | typeof RPC_ERROR_SESSION_HELD | typeof RPC_ERROR_SESSION_RESERVATION_LIMIT | typeof RPC_ERROR_MISSING_SESSION_ID | typeof RPC_ERROR_MULTI_SESSION_DISABLED | typeof RPC_ERROR_INVALID_PATH | typeof RPC_ERROR_OPEN_FAILED | typeof RPC_ERROR_MEDIA_NOT_FOUND | typeof RPC_ERROR_PROJECT_TRUST_LOCKED | typeof RPC_ERROR_PROJECT_TRUST_EXTENSION_DECIDED | typeof RPC_ERROR_PROJECT_SETTINGS_WRITE_FAILED | typeof RPC_ERROR_PROJECT_NOT_TRUSTED | typeof RPC_ERROR_PROJECT_SETTINGS_UNREADABLE | typeof RPC_ERROR_PROJECT_FILE_NOT_ALLOWED | typeof RPC_ERROR_PROJECT_FILE_CONFLICT | typeof RPC_ERROR_PROJECT_FILE_TOO_LARGE | typeof RPC_ERROR_PROJECT_FILE_WRITE_FAILED | typeof RPC_ERROR_INVALID_SESSION_CONTEXT | typeof RPC_ERROR_INVALID_SUBSCRIPTION | typeof RPC_ERROR_UNKNOWN_SUBSCRIPTION | typeof RPC_ERROR_SUBSCRIPTION_LIMIT | typeof RPC_ERROR_UNSUPPORTED_TRANSPORT | typeof RPC_ERROR_INVALID_SESSION_KIND | typeof RPC_ERROR_INVALID_LAUNCH_PROFILE | typeof RPC_ERROR_INVALID_SESSION_ID | typeof RPC_ERROR_SESSION_ID_IN_USE | typeof RPC_ERROR_HOST_MEMORY_PRESSURE | typeof RPC_ERROR_WARM_FAILED | typeof RPC_ERROR_STREAMING | typeof RPC_ERROR_ENTRY_NOT_FOUND | typeof RPC_ERROR_MODEL_NOT_FOUND | typeof RPC_ERROR_EFFECT_ID_CONFLICT | typeof RPC_ERROR_TRANSCRIPT_UNREADABLE | typeof RPC_ERROR_PROVIDER_UNAVAILABLE | typeof RPC_ERROR_PROVIDER_CREDENTIALS_MISSING | typeof RPC_ERROR_PROVIDER_CREDENTIALS_EXPIRED | typeof RPC_ERROR_NO_MODEL_SELECTED | typeof RPC_ERROR_TURN_CONFLICT | typeof RPC_ERROR_CONTEXT_BUDGET | typeof RPC_ERROR_EVAL_CELL_NOT_FOUND | typeof RPC_ERROR_INVALID_EVAL_CELL_REQUEST | typeof RPC_ERROR_EVAL_CELLS_UNAVAILABLE | typeof RPC_ERROR_NOT_ASSISTANT | typeof RPC_ERROR_NOT_USER | typeof RPC_ERROR_EMPTY_TEXT | typeof RPC_ERROR_UNKNOWN_COMMAND | typeof RPC_ERROR_STALE_LEAF | typeof RPC_ERROR_TURN_ACTIVE | typeof RPC_ERROR_SESSION_BUSY | typeof RPC_ERROR_ATTACHED | typeof RPC_ERROR_INVALID_RELEASE_REASON | typeof RPC_ERROR_RELEASE_UNSUPPORTED | typeof RPC_ERROR_RELEASE_FAILED | typeof RPC_ERROR_HOST_DRAINING | typeof RPC_ERROR_RESPONSE_UNWRITABLE;
140
+ export type RpcErrorCode = typeof RPC_ERROR_SESSION_IDENTITY_MISMATCH | typeof RPC_ERROR_SESSION_BUSY_LIFECYCLE | typeof RPC_ERROR_ATTACHED_ELSEWHERE | typeof RPC_ERROR_OWNER_CHANGED | typeof RPC_ERROR_SESSION_NOT_HELD | typeof RPC_ERROR_HOST_STOPPING | typeof RPC_ERROR_UNKNOWN_SESSION | typeof RPC_ERROR_SESSION_NOT_ATTACHED | typeof RPC_ERROR_SESSION_CLOSING | typeof RPC_ERROR_SESSION_PATH_IN_USE | typeof RPC_ERROR_SESSION_HELD | typeof RPC_ERROR_SESSION_RESERVATION_LIMIT | typeof RPC_ERROR_MISSING_SESSION_ID | typeof RPC_ERROR_MULTI_SESSION_DISABLED | typeof RPC_ERROR_INVALID_PATH | typeof RPC_ERROR_OPEN_FAILED | typeof RPC_ERROR_MEDIA_NOT_FOUND | typeof RPC_ERROR_PROJECT_TRUST_LOCKED | typeof RPC_ERROR_PROJECT_TRUST_EXTENSION_DECIDED | typeof RPC_ERROR_PROJECT_SETTINGS_WRITE_FAILED | typeof RPC_ERROR_PROJECT_NOT_TRUSTED | typeof RPC_ERROR_PROJECT_SETTINGS_UNREADABLE | typeof RPC_ERROR_PROJECT_FILE_NOT_ALLOWED | typeof RPC_ERROR_PROJECT_FILE_CONFLICT | typeof RPC_ERROR_PROJECT_FILE_TOO_LARGE | typeof RPC_ERROR_PROJECT_FILE_WRITE_FAILED | typeof RPC_ERROR_INVALID_SESSION_CONTEXT | typeof RPC_ERROR_INVALID_SUBSCRIPTION | typeof RPC_ERROR_UNKNOWN_SUBSCRIPTION | typeof RPC_ERROR_SUBSCRIPTION_LIMIT | typeof RPC_ERROR_UNSUPPORTED_TRANSPORT | typeof RPC_ERROR_INVALID_SESSION_KIND | typeof RPC_ERROR_INVALID_LAUNCH_PROFILE | typeof RPC_ERROR_INVALID_SESSION_ID | typeof RPC_ERROR_SESSION_ID_IN_USE | typeof RPC_ERROR_HOST_MEMORY_PRESSURE | typeof RPC_ERROR_WARM_FAILED | typeof RPC_ERROR_STREAMING | typeof RPC_ERROR_ENTRY_NOT_FOUND | typeof RPC_ERROR_MODEL_NOT_FOUND | typeof RPC_ERROR_EFFECT_ID_CONFLICT | typeof RPC_ERROR_TRANSCRIPT_UNREADABLE | typeof RPC_ERROR_PROVIDER_UNAVAILABLE | typeof RPC_ERROR_PROVIDER_CREDENTIALS_MISSING | typeof RPC_ERROR_PROVIDER_CREDENTIALS_EXPIRED | typeof RPC_ERROR_NO_MODEL_SELECTED | typeof RPC_ERROR_TURN_CONFLICT | typeof RPC_ERROR_CONTEXT_BUDGET | typeof RPC_ERROR_EVAL_CELL_NOT_FOUND | typeof RPC_ERROR_INVALID_EVAL_CELL_REQUEST | typeof RPC_ERROR_EVAL_CELLS_UNAVAILABLE | typeof RPC_ERROR_NOT_ASSISTANT | typeof RPC_ERROR_NOT_USER | typeof RPC_ERROR_EMPTY_TEXT | typeof RPC_ERROR_UNKNOWN_COMMAND | typeof RPC_ERROR_STALE_LEAF | typeof RPC_ERROR_TURN_ACTIVE | typeof RPC_ERROR_SESSION_BUSY | typeof RPC_ERROR_ATTACHED | typeof RPC_ERROR_INVALID_RELEASE_REASON | typeof RPC_ERROR_RELEASE_UNSUPPORTED | typeof RPC_ERROR_RELEASE_FAILED | typeof RPC_ERROR_HOST_DRAINING | typeof RPC_ERROR_RESPONSE_UNWRITABLE | typeof RPC_ERROR_PROJECT_CWD_MISMATCH;
135
141
  //# sourceMappingURL=rpc-error-types.d.ts.map
@@ -22,6 +22,12 @@ export const RPC_ERROR_RESPONSE_TOO_LARGE = "response_too_large";
22
22
  * throwing `toJSON`); `error` names the cause. Sent in place of the reply so the caller is never left waiting (senpi#5702).
23
23
  */
24
24
  export const RPC_ERROR_RESPONSE_UNWRITABLE = "response_unwritable";
25
+ /**
26
+ * A project write stated the folder its caller means (`expectedCwd`) and the session is in another one: nothing is
27
+ * written. A client that names a session by a key that may since point at another session states the folder it
28
+ * means, so a write never lands in the wrong project.
29
+ */
30
+ export const RPC_ERROR_PROJECT_CWD_MISMATCH = "project_cwd_mismatch";
25
31
  export const RPC_ERROR_OPEN_FAILED = "open_failed";
26
32
  export const RPC_ERROR_OWNER_CHANGED = "owner_changed";
27
33
  export const RPC_ERROR_SESSION_NOT_HELD = "session_not_held";
@@ -480,6 +480,7 @@ export type RpcSessionCommand = {
480
480
  id?: string;
481
481
  type: "set_project_trust";
482
482
  choice: "trust" | "trust_parent" | "do_not_trust";
483
+ expectedCwd?: string;
483
484
  } | {
484
485
  id?: string;
485
486
  type: "get_project_settings";
@@ -488,6 +489,7 @@ export type RpcSessionCommand = {
488
489
  type: "set_project_setting";
489
490
  key: string;
490
491
  value: unknown;
492
+ expectedCwd?: string;
491
493
  } | {
492
494
  id?: string;
493
495
  type: "read_project_file";
@@ -498,6 +500,7 @@ export type RpcSessionCommand = {
498
500
  path: string;
499
501
  content: string;
500
502
  ifEtag: string | null;
503
+ expectedCwd?: string;
501
504
  } | {
502
505
  id?: string;
503
506
  type: "extension_request";
@@ -1,6 +1,20 @@
1
+ import { type InstallMethod } from "./config.ts";
1
2
  import type { InlineExtension } from "./core/extensions/types.ts";
2
3
  export type PackageCommand = "install" | "remove" | "update" | "list";
3
4
  export declare function cleanupManagedInstall(): void;
5
+ export interface SelfUpdatePlan {
6
+ packageName: string;
7
+ installSpec: string;
8
+ version: string;
9
+ shouldRun: boolean;
10
+ note?: string;
11
+ }
12
+ /**
13
+ * The latest-version lookup failed. A standalone binary cannot update itself in place, and since senpi#6633 its lookup
14
+ * asks the unauthenticated GitHub API (60 requests per hour per IP), so a failed lookup points it at the download page
15
+ * instead of failing `update --self`. Every other install still fails, because it would run an install command.
16
+ */
17
+ export declare function selfUpdatePlanAfterLookupFailure(installMethod: InstallMethod, reason: string): SelfUpdatePlan;
4
18
  export interface PackageCommandRuntimeOptions {
5
19
  extensionFactories?: InlineExtension[];
6
20
  }
@@ -576,6 +576,19 @@ function printSelfUpdateNote(note) {
576
576
  }
577
577
  console.log();
578
578
  }
579
+ /**
580
+ * The latest-version lookup failed. A standalone binary cannot update itself in place, and since senpi#6633 its lookup
581
+ * asks the unauthenticated GitHub API (60 requests per hour per IP), so a failed lookup points it at the download page
582
+ * instead of failing `update --self`. Every other install still fails, because it would run an install command.
583
+ */
584
+ export function selfUpdatePlanAfterLookupFailure(installMethod, reason) {
585
+ if (installMethod !== "bun-binary") {
586
+ throw new Error(`Could not determine latest ${APP_NAME} version${reason ? `: ${reason}` : "."}`);
587
+ }
588
+ console.log(chalk.yellow(`Could not check the latest ${APP_NAME} release${reason ? ` (${reason})` : ""}.`));
589
+ console.log(chalk.cyan("Download from: https://github.com/code-yeongyu/senpi/releases/latest"));
590
+ return { packageName: PACKAGE_NAME, installSpec: PACKAGE_NAME, version: VERSION, shouldRun: false };
591
+ }
579
592
  async function getSelfUpdatePlan(force) {
580
593
  const brandUpdate = brandProfile()?.update;
581
594
  if (brandUpdate) {
@@ -593,12 +606,15 @@ async function getSelfUpdatePlan(force) {
593
606
  latestRelease = await getLatestPiRelease(VERSION, { retry: true });
594
607
  }
595
608
  catch (error) {
596
- throw new Error(`Could not determine latest ${APP_NAME} version: ${formatVersionCheckError(error)}`, {
597
- cause: error,
598
- });
609
+ try {
610
+ return selfUpdatePlanAfterLookupFailure(detectInstallMethod(), formatVersionCheckError(error));
611
+ }
612
+ catch (planError) {
613
+ throw planError instanceof Error ? Object.assign(planError, { cause: error }) : planError;
614
+ }
599
615
  }
600
616
  if (!latestRelease) {
601
- throw new Error(`Could not determine latest ${APP_NAME} version.`);
617
+ return selfUpdatePlanAfterLookupFailure(detectInstallMethod(), "");
602
618
  }
603
619
  const packageName = latestRelease.packageName ?? PACKAGE_NAME;
604
620
  const installSpec = `${packageName}@${latestRelease.version}`;
@@ -1,4 +1,7 @@
1
+ import { type InstallMethod } from "../config.ts";
1
2
  import { type BrandUpdateChannel } from "../core/brand.ts";
3
+ /** Version of the latest GitHub Release, from its tag; drafts and prereleases are not installable. */
4
+ export declare function readLatestReleaseVersion(payload: unknown): string | undefined;
2
5
  /** Reads the available version out of whichever registry document was fetched. */
3
6
  export declare function readAvailableVersion(payload: unknown, channel: BrandUpdateChannel | undefined): string | undefined;
4
7
  export interface LatestPiRelease {
@@ -11,13 +14,13 @@ export declare function formatVersionCheckError(error: unknown): string;
11
14
  export declare function comparePackageVersions(leftVersion: string, rightVersion: string): number | undefined;
12
15
  export declare function isNewerPackageVersion(candidateVersion: string, currentVersion: string): boolean;
13
16
  export declare function getReleaseChangelogUrl(version: string): string;
14
- export declare function getLatestPiRelease(currentVersion: string, options?: {
17
+ export interface VersionCheckOptions {
15
18
  timeoutMs?: number;
16
19
  retry?: boolean;
17
- }): Promise<LatestPiRelease | undefined>;
18
- export declare function getLatestPiVersion(currentVersion: string, options?: {
19
- timeoutMs?: number;
20
- retry?: boolean;
21
- }): Promise<string | undefined>;
22
- export declare function checkForNewPiVersion(currentVersion: string): Promise<LatestPiRelease | undefined>;
20
+ /** Defaults to the running install; tests pass it explicitly. */
21
+ installMethod?: InstallMethod;
22
+ }
23
+ export declare function getLatestPiRelease(currentVersion: string, options?: VersionCheckOptions): Promise<LatestPiRelease | undefined>;
24
+ export declare function getLatestPiVersion(currentVersion: string, options?: VersionCheckOptions): Promise<string | undefined>;
25
+ export declare function checkForNewPiVersion(currentVersion: string, options?: Pick<VersionCheckOptions, "installMethod">): Promise<LatestPiRelease | undefined>;
23
26
  //# sourceMappingURL=version-check.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { compare, valid } from "semver";
2
- import { PACKAGE_NAME } from "../config.js";
2
+ import { detectInstallMethod, PACKAGE_NAME } from "../config.js";
3
3
  import { brandProfile, envValue } from "../core/brand.js";
4
4
  import { fetchWithRetry } from "./management-http.js";
5
5
  import { getPiUserAgent } from "./pi-user-agent.js";
@@ -11,6 +11,20 @@ function latestVersionUrl(channel) {
11
11
  ? `${REGISTRY_BASE_URL}/-/package/${encodeURIComponent(channel.packageName)}/dist-tags`
12
12
  : LATEST_VERSION_URL;
13
13
  }
14
+ // A standalone binary can only be updated from a GitHub Release ("Download from: .../releases/latest" in config.ts),
15
+ // and npm can publish before that release exists (senpi#6633), so a binary reads the latest release, never npm.
16
+ const LATEST_RELEASE_URL = "https://api.github.com/repos/code-yeongyu/senpi/releases/latest";
17
+ /** Version of the latest GitHub Release, from its tag; drafts and prereleases are not installable. */
18
+ export function readLatestReleaseVersion(payload) {
19
+ if (typeof payload !== "object" || payload === null)
20
+ return undefined;
21
+ const release = payload;
22
+ if (release.draft === true || release.prerelease === true)
23
+ return undefined;
24
+ const tag = typeof release.tag_name === "string" ? release.tag_name.trim() : "";
25
+ const version = tag.startsWith("v") ? tag.slice(1) : tag;
26
+ return version || undefined;
27
+ }
14
28
  /** Reads the available version out of whichever registry document was fetched. */
15
29
  export function readAvailableVersion(payload, channel) {
16
30
  if (typeof payload !== "object" || payload === null)
@@ -96,10 +110,11 @@ export async function getLatestPiRelease(currentVersion, options = {}) {
96
110
  // advertising them would send the user after an update they cannot apply.
97
111
  return undefined;
98
112
  }
99
- const response = await fetchWithRetry(latestVersionUrl(channel), {
113
+ const fromRelease = !channel && (options.installMethod ?? detectInstallMethod()) === "bun-binary";
114
+ const response = await fetchWithRetry(fromRelease ? LATEST_RELEASE_URL : latestVersionUrl(channel), {
100
115
  headers: {
101
116
  "User-Agent": getPiUserAgent(currentVersion),
102
- accept: "application/json",
117
+ accept: fromRelease ? "application/vnd.github+json" : "application/json",
103
118
  },
104
119
  }, {
105
120
  maxRetries: options.retry ? 2 : 0,
@@ -107,6 +122,10 @@ export async function getLatestPiRelease(currentVersion, options = {}) {
107
122
  });
108
123
  if (!response.ok)
109
124
  return undefined;
125
+ if (fromRelease) {
126
+ const releaseVersion = readLatestReleaseVersion(await response.json());
127
+ return releaseVersion ? { version: releaseVersion } : undefined;
128
+ }
110
129
  const data = (await response.json());
111
130
  const availableVersion = readAvailableVersion(data, channel);
112
131
  if (!availableVersion) {
@@ -122,11 +141,11 @@ export async function getLatestPiRelease(currentVersion, options = {}) {
122
141
  export async function getLatestPiVersion(currentVersion, options = {}) {
123
142
  return (await getLatestPiRelease(currentVersion, options))?.version;
124
143
  }
125
- export async function checkForNewPiVersion(currentVersion) {
144
+ export async function checkForNewPiVersion(currentVersion, options = {}) {
126
145
  if (envValue("SKIP_VERSION_CHECK"))
127
146
  return undefined;
128
147
  try {
129
- const latestRelease = await getLatestPiRelease(currentVersion);
148
+ const latestRelease = await getLatestPiRelease(currentVersion, options);
130
149
  if (latestRelease && isNewerPackageVersion(latestRelease.version, currentVersion)) {
131
150
  return latestRelease;
132
151
  }
package/docs/rpc.md CHANGED
@@ -6287,12 +6287,12 @@ as they would on `reload`, and the next session opened in the folder gets the sa
6287
6287
  implied by `open_session` or by a permission preset; only this explicit request saves a decision.
6288
6288
 
6289
6289
  ```json
6290
- {"type": "set_project_trust", "choice": "trust"}
6290
+ {"type": "set_project_trust", "choice": "trust", "expectedCwd": "/home/me/project"}
6291
6291
  ```
6292
6292
 
6293
- `choice` is `trust` (this folder), `trust_parent` (the parent folder; clears this folder's own entry, as `/trust`
6293
+ `expectedCwd` is optional, as on every project write: see [The folder a project write is for](#the-folder-a-project-write-is-for). `choice` is `trust` (this folder), `trust_parent` (the parent folder; clears this folder's own entry, as `/trust`
6294
6294
  does) or `do_not_trust`. The response carries the same `data` as `get_project_trust`, read after the change.
6295
- Errors: `invalid_argument` for an unknown choice, `project_trust_locked` when the launch named the trust, and
6295
+ Errors: `invalid_argument` for an unknown choice or an `expectedCwd` that is not a string, `project_cwd_mismatch` when `expectedCwd` names another folder than the session's (nothing is saved or applied), `project_trust_locked` when the launch named the trust, and
6296
6296
  `project_trust_extension_decided` when a `project_trust` handler of an extension loaded before trust (never a
6297
6297
  project extension) decides the other way: such a handler decides before any saved choice when a session opens, so
6298
6298
  the request is refused and nothing is saved or applied. A folder with nothing trust gates stays trusted whatever is
@@ -6332,11 +6332,12 @@ the file: values the session reads when it starts (default model and thinking le
6332
6332
  modes) apply after `reload` or in the next session.
6333
6333
 
6334
6334
  ```json
6335
- {"type": "set_project_setting", "key": "defaultThinkingLevel", "value": "high"}
6335
+ {"type": "set_project_setting", "key": "defaultThinkingLevel", "value": "high", "expectedCwd": "/home/me/project"}
6336
6336
  ```
6337
6337
 
6338
6338
  The response carries the same `data` as `get_project_settings`, read after the write. Errors:
6339
- `invalid_argument` when `key` is not an identifier (`[A-Za-z][A-Za-z0-9_]*`) or `value` is missing,
6339
+ `invalid_argument` when `key` is not an identifier (`[A-Za-z][A-Za-z0-9_]*`), `value` is missing or `expectedCwd` is
6340
+ not a string, `project_cwd_mismatch` when `expectedCwd` names another folder (nothing is written),
6340
6341
  `project_not_trusted` while the project is untrusted (trust it first), `project_settings_unreadable` when the
6341
6342
  existing file does not parse (nothing is written), and `project_settings_write_failed` when writing the file fails
6342
6343
  (permissions, a held lock).
@@ -6377,19 +6378,31 @@ Errors: `invalid_argument` when `path` is not a string, `project_file_not_allowe
6377
6378
  other path, or when a folder on the way or the file itself is a symlink or not a regular file and folder, and
6378
6379
  `project_file_too_large` (`errorData: { limitBytes }`) for a stored file over 512 KiB.
6379
6380
 
6381
+ #### The folder a project write is for
6382
+
6383
+ `set_project_trust`, `set_project_setting` and `write_project_file` take an optional `expectedCwd`: the folder the
6384
+ caller means. A client that reaches a session by a key that can since name another session (a remote desktop, through
6385
+ a relay) states it, so the write lands only in that folder's project. When it is given and the session's working
6386
+ directory is another folder, the write is refused with `project_cwd_mismatch` and nothing is written or applied. Both
6387
+ paths are compared with only trailing separators of the path's own style dropped (`/` for a POSIX path; `\` or `/`
6388
+ for a drive or UNC path) and a Windows drive letter in either case; nothing is trimmed and the rest of the path is
6389
+ compared as written. A present `expectedCwd` that is not a string is refused with `invalid_argument`. Without it, a
6390
+ write behaves as before.
6391
+
6380
6392
  #### write_project_file
6381
6393
 
6382
6394
  Replaces (or creates) one of the files `read_project_file` reads, naming the version it replaces.
6383
6395
 
6384
6396
  ```json
6385
- {"type": "write_project_file", "path": "AGENTS.md", "content": "# Project rules\n", "ifEtag": "sha256-…"}
6397
+ {"type": "write_project_file", "path": "AGENTS.md", "content": "# Project rules\n", "ifEtag": "sha256-…", "expectedCwd": "/home/me/project"}
6386
6398
  ```
6387
6399
 
6388
6400
  `ifEtag` is required: the `etag` last read, or `null` to create a file that must not exist yet. Missing parent
6389
6401
  folders are created. The file lands by a temporary file and a rename, so a reader never sees a partial write, and
6390
6402
  writes to one file are applied one at a time. The response carries the same `data` as `read_project_file`, read
6391
6403
  after the write. The session reads its instruction files when they are next loaded (a new session or `reload`).
6392
- Errors: `invalid_argument` when `content` is not a string or `ifEtag` is neither a string nor `null`,
6404
+ Errors: `invalid_argument` when `content` is not a string, `ifEtag` is neither a string nor `null`, or `expectedCwd` is
6405
+ not a string, `project_cwd_mismatch` when `expectedCwd` names another folder (nothing is written),
6393
6406
  `project_not_trusted` while the project is untrusted, `project_file_not_allowed` as for `read_project_file`,
6394
6407
  `project_file_too_large` (`errorData: { limitBytes }`) for content over 512 KiB or a stored file over 512 KiB (its
6395
6408
  version cannot be checked without reading it), `project_file_conflict` when
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-yeongyu/senpi",
3
- "version": "2026.11.13",
3
+ "version": "2026.11.15",
4
4
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -92,10 +92,10 @@
92
92
  },
93
93
  "dependencies": {
94
94
  "@earendil-works/chord": "0.99.1",
95
- "@earendil-works/pi-agent-core": "npm:@code-yeongyu/senpi-agent-core@2026.11.13",
96
- "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.13",
97
- "@earendil-works/pi-realm-registry": "npm:@code-yeongyu/senpi-realm-registry@2026.11.13",
98
- "@earendil-works/pi-tui": "npm:@code-yeongyu/senpi-tui@2026.11.13",
95
+ "@earendil-works/pi-agent-core": "npm:@code-yeongyu/senpi-agent-core@2026.11.15",
96
+ "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.15",
97
+ "@earendil-works/pi-realm-registry": "npm:@code-yeongyu/senpi-realm-registry@2026.11.15",
98
+ "@earendil-works/pi-tui": "npm:@code-yeongyu/senpi-tui@2026.11.15",
99
99
  "@silvia-odwyer/photon-node": "0.3.4",
100
100
  "ajv": "8.20.0",
101
101
  "chalk": "6.0.0",
@@ -116,8 +116,8 @@
116
116
  "yaml": "2.9.1",
117
117
  "@anthropic-ai/claude-agent-sdk": "0.3.321",
118
118
  "@anthropic-ai/sdk": "0.127.0",
119
- "@code-yeongyu/senpi-codemode": "2026.11.13",
120
- "@earendil-works/pi-pty": "npm:@code-yeongyu/senpi-pty@2026.11.13",
119
+ "@code-yeongyu/senpi-codemode": "2026.11.15",
120
+ "@earendil-works/pi-pty": "npm:@code-yeongyu/senpi-pty@2026.11.15",
121
121
  "@modelcontextprotocol/sdk": "1.32.1",
122
122
  "@mozilla/readability": "0.6.0",
123
123
  "linkedom": "0.18.13",
@@ -1,2 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{require_semver}from"./chunk-ZOFZRJSL.js";import{fetchWithRetry}from"./chunk-2SOVDETB.js";import{APP_NAME,BRAND,DISPLAY_VERSION,PACKAGE_NAME,brandProfile,envValue}from"./chunk-SODMQEHO.js";import{__toESM}from"./chunk-IKOFCODM.js";import{spawnSync}from"node:child_process";import{homedir as osHomedir}from"node:os";import{posix,win32}from"node:path";var RUNTIME_ENV_VAR="SENPI_RUNTIME",MIN_BUN_VERSION="1.4.0";function normalize(path){return path.replaceAll("\\","/")}function paths(options){return options.platform==="win32"?win32:posix}function bunRoot(options){let configured=options.env.BUN_INSTALL;return configured!==void 0&&configured.trim()!==""?configured:paths(options).join(options.homedir,".bun")}function resolveOrSelf(path,options){try{return options.realpath(path)}catch{return path}}function isUnderBunGlobalTree(scriptRealPath,options){let globalRoot=paths(options).join(bunRoot(options),"install","global"),script=normalize(scriptRealPath);for(let candidate of new Set([globalRoot,resolveOrSelf(globalRoot,options)]))if(script.startsWith(`${normalize(candidate)}/`))return!0;return!1}function isInstalledPackageScript(scriptRealPath){return normalize(scriptRealPath).includes("/node_modules/")}function bunVersionSatisfies(version){let actual=/^v?(\d+)\.(\d+)\.(\d+)/.exec(version?.trim()??""),minimum=/^(\d+)\.(\d+)\.(\d+)/.exec(MIN_BUN_VERSION);if(!actual||!minimum)return!1;for(let index=1;index<=3;index++){let difference=Number(actual[index])-Number(minimum[index]);if(difference!==0)return difference>0}return!0}function bunExecutableName(options){return options.platform==="win32"?"bun.exe":"bun"}function pathCandidateNames(options){if(options.platform!=="win32")return["bun"];let extensions=(options.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";").map(extension=>extension.trim()).filter(extension=>extension.length>0);return extensions.length>0?extensions.map(extension=>`bun${extension}`):["bun.exe"]}function findBunBinary(options){let path=paths(options),executable=bunExecutableName(options),rootCandidates=[path.join(bunRoot(options),"bin",executable),path.join(options.homedir,".bun","bin",executable)];for(let candidate of rootCandidates)if(options.exists(candidate))return candidate;let pathValue=options.env.PATH??options.env.Path;if(pathValue===void 0||pathValue==="")return;let names=pathCandidateNames(options);for(let directory of pathValue.split(path.delimiter))if(directory!=="")for(let name of names){let candidate=path.join(directory,name);if(options.exists(candidate))return candidate}}function readRuntimePin(options){let value=options.env[RUNTIME_ENV_VAR];if(value==="node"||value==="bun")return value}function resolveBunReexec(input){if(input.versions.bun!==void 0)return{action:"stay",reason:"already-bun"};let pinned=readRuntimePin(input.options);if(pinned==="node")return{action:"stay",reason:"runtime-pinned-node"};if(input.hasInheritedInspectorOption)return{action:"stay",reason:"inspector"};let trustsInstalledBun=pinned==="bun"||isUnderBunGlobalTree(input.scriptRealPath,input.options);if(!trustsInstalledBun&&!isInstalledPackageScript(input.scriptRealPath))return{action:"stay",reason:"not-bun-install"};let bunPath=findBunBinary(input.options);return bunPath===void 0?{action:"stay",reason:"bun-not-found"}:!trustsInstalledBun&&!bunVersionSatisfies(input.options.bunVersion(bunPath))?{action:"stay",reason:"bun-too-old"}:{action:"reexec",bunPath}}function readBunVersion(bunPath){try{let result=spawnSync(bunPath,["--version"],{encoding:"utf8",timeout:5e3,windowsHide:!0});if(result.status!==0)return;let version=result.stdout.trim();return version===""?void 0:version}catch{return}}function processBunRuntimeOptions(exists,realpath){return{env:process.env,homedir:osHomedir(),platform:process.platform,exists,realpath,bunVersion:readBunVersion}}function getPiUserAgent(version=DISPLAY_VERSION){let runtime=process.versions.bun?`bun/${process.versions.bun}`:`node/${process.version}`;return`${BRAND?.userAgent??APP_NAME}/${version} (${process.platform}; ${runtime}; ${process.arch})`}var import_semver=__toESM(require_semver(),1);var REGISTRY_BASE_URL="https://registry.npmjs.org",LATEST_VERSION_URL=`${REGISTRY_BASE_URL}/${encodeURIComponent(PACKAGE_NAME)}/latest`;function latestVersionUrl(channel){return channel?`${REGISTRY_BASE_URL}/-/package/${encodeURIComponent(channel.packageName)}/dist-tags`:LATEST_VERSION_URL}function readAvailableVersion(payload,channel){if(typeof payload!="object"||payload===null)return;let source=payload,raw=channel?source[channel.distTag]:source.version;return typeof raw=="string"&&raw.trim()?raw.trim():void 0}var DEFAULT_VERSION_CHECK_TIMEOUT_MS=1e4,RELEASE_CHANGELOG_BASE_URL="https://github.com/code-yeongyu/senpi/blob",RELEASE_CHANGELOG_PATH="packages/coding-agent/CHANGELOG.md",SENPI_CALVER_PATTERN=/^(\d{4})\.(\d{1,2})\.(\d{1,2})(?:-([1-9]\d*))?$/;function parseSenpiCalVer(version){let match=SENPI_CALVER_PATTERN.exec(version);if(match)return[Number(match[1]),Number(match[2]),Number(match[3]),Number(match[4]??1)]}function canonicalCalVer([year,month,day,revision]){return revision>1?`${year}.${month}.${day}-${revision}`:`${year}.${month}.${day}`}function formatVersionCheckError(error){let rootMessage=error instanceof Error&&error.message?error.message:String(error),cause=error instanceof Error?error.cause:void 0,causes=cause instanceof AggregateError?cause.errors:cause===void 0?[]:[cause],codes=causes.map(value=>typeof value=="object"&&value!==null&&"code"in value&&typeof value.code=="string"?value.code:void 0).filter(code=>code!==void 0);if(codes.length>0)return`${rootMessage} (${[...new Set(codes)].join(", ")})`;let causeMessage=causes.find(value=>value instanceof Error&&!!value.message)?.message;return causeMessage?`${rootMessage} (cause: ${causeMessage})`:rootMessage}function comparePackageVersions(leftVersion,rightVersion){let leftTrimmed=leftVersion.trim(),rightTrimmed=rightVersion.trim(),leftCalVer=parseSenpiCalVer(leftTrimmed),rightCalVer=parseSenpiCalVer(rightTrimmed);if(leftCalVer&&rightCalVer){for(let index=0;index<leftCalVer.length;index++)if(leftCalVer[index]!==rightCalVer[index])return leftCalVer[index]<rightCalVer[index]?-1:1;return 0}let left=(0,import_semver.valid)(leftCalVer?canonicalCalVer(leftCalVer):leftTrimmed),right=(0,import_semver.valid)(rightCalVer?canonicalCalVer(rightCalVer):rightTrimmed);if(!(!left||!right))return(0,import_semver.compare)(left,right)}function isNewerPackageVersion(candidateVersion,currentVersion){let comparison=comparePackageVersions(candidateVersion,currentVersion);return comparison!==void 0&&comparison>0}function getReleaseChangelogUrl(version){let trimmedVersion=version.trim(),channel=brandProfile()?.update;if(channel?.changelogUrl)return channel.changelogUrl.replace("{version}",trimmedVersion);let tag=trimmedVersion.startsWith("v")?trimmedVersion:`v${trimmedVersion}`;return`${RELEASE_CHANGELOG_BASE_URL}/${tag}/${RELEASE_CHANGELOG_PATH}`}async function getLatestPiRelease(currentVersion,options={}){if(envValue("OFFLINE"))return;let brand=brandProfile(),channel=brand?.update;if(brand&&!channel)return;let response=await fetchWithRetry(latestVersionUrl(channel),{headers:{"User-Agent":getPiUserAgent(currentVersion),accept:"application/json"}},{maxRetries:options.retry?2:0,timeoutMs:options.timeoutMs??DEFAULT_VERSION_CHECK_TIMEOUT_MS});if(!response.ok)return;let data=await response.json(),availableVersion=readAvailableVersion(data,channel);if(!availableVersion)return;if(channel)return{version:availableVersion,packageName:channel.packageName};let packageName=typeof data.packageName=="string"&&data.packageName.trim()?data.packageName.trim():void 0,note=typeof data.note=="string"&&data.note.trim()?data.note.trim():void 0;return{version:availableVersion,packageName,note}}async function checkForNewPiVersion(currentVersion){if(!envValue("SKIP_VERSION_CHECK"))try{let latestRelease=await getLatestPiRelease(currentVersion);return latestRelease&&isNewerPackageVersion(latestRelease.version,currentVersion)?latestRelease:void 0}catch{return}}export{RUNTIME_ENV_VAR,MIN_BUN_VERSION,bunVersionSatisfies,findBunBinary,resolveBunReexec,processBunRuntimeOptions,getPiUserAgent,formatVersionCheckError,isNewerPackageVersion,getReleaseChangelogUrl,getLatestPiRelease,checkForNewPiVersion};
@@ -1,2 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{usageLimitResetMs}from"./chunk-WB4BUHOH.js";import{rateLimitModelFamily}from"./chunk-NJ43NBSP.js";import{normalizeProviderError}from"./chunk-AC72EWI5.js";import{extract429RetryAfterMs,parseRetryAfterMsMarker}from"./chunk-RQFD6LG2.js";import{getOverflowPatterns}from"./chunk-SFACYIB6.js";import{ModelsError,OAuthTokenEndpointError,PROVIDER_NOT_CONFIGURED_PREFIX,USAGE_LIMIT_EXHAUSTION,isOAuthRefreshUnavailableError}from"./chunk-OH5TKHW7.js";import{credentialPoolBlockedDiagnostic,readProviderDiagnostic}from"./chunk-JGKH3D6W.js";import{attachProviderDiagnostic,siwcRecoveryFromDiagnostic}from"./chunk-3SASTB6Y.js";function rendezvousOrder(key,slots,hasher){return[...slots].map(slot=>({slot,score:hasher(`${key}\0${slot.name}`)})).sort((left,right)=>right.score>left.score?1:right.score<left.score?-1:0).map(({slot})=>slot)}function applyAccountOrder(order,ranked){if(order===void 0||order.length===0)return[...ranked];let byName=new Map(ranked.map(slot=>[slot.name,slot])),front=[];for(let name of order){let slot=byName.get(name);slot!==void 0&&!front.includes(slot)&&front.push(slot)}return[...front,...ranked.filter(slot=>!front.includes(slot))]}function withoutOrderedAccount(credential,name){if(credential.order===void 0||!credential.order.includes(name))return credential;let order=credential.order.filter(entry=>entry!==name),next={...credential};return order.length===0?delete next.order:next.order=order,next}function isSlotBlocked(slot,now){return slot.blockReason==="auth_error"||slot.blockedUntil!==void 0&&slot.blockedUntil>now}var DEFAULT_SLOT_BLOCK_MS=6e4,MAX_SLOT_BLOCK_MS=2880*60*1e3;function escapeRegExp(text){return text.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var ACCOUNT_USAGE_LIMIT_TEXT=new RegExp([...USAGE_LIMIT_EXHAUSTION.markers.map(escapeRegExp),String.raw`\b(?:hit|reached)\s+your\b[^.]*?\blimit\b`,String.raw`\busage\s+limit\s+reached\b`,String.raw`\b(?:Go|Free)UsageLimitError\b`,String.raw`\bblocking_limit\b`,String.raw`\brapid_refill_breaker\b`,String.raw`\bquota\s+exceeded\b`].join("|"),"i");function isAccountUsageLimitText(text){return ACCOUNT_USAGE_LIMIT_TEXT.test(text)}var COOLDOWN_BASE_MS=DEFAULT_SLOT_BLOCK_MS,COOLDOWN_CAP_MS=MAX_SLOT_BLOCK_MS,GUESSED_BACKOFF_CAP_MS=1800*1e3,RETRY_SAME_MAX_ATTEMPTS=2,ACCOUNT_POOL_REFUSAL_NOTE="No request was sent: the account pool refused it locally.";function rateLimitCooldown(failureCount,serverHintMs,policy={}){let cap=policy.capMs??COOLDOWN_CAP_MS,base=policy.baseMs??COOLDOWN_BASE_MS,backoff=Math.min(cap,GUESSED_BACKOFF_CAP_MS,base*2**Math.max(0,failureCount)),floored=serverHintMs===void 0?backoff:Math.max(backoff,serverHintMs);return{cooldownMs:Math.min(cap,floored),retryAfterWasCapped:floored>cap}}function usageLimitCooldown(resetMs,policy={}){let cap=policy.capMs??COOLDOWN_CAP_MS;return{cooldownMs:Math.min(cap,resetMs),retryAfterWasCapped:resetMs>cap}}var INVALID_KEY_TEXT=/invalid[ _-]?(?:api[ _-]?)?key|authentication[_ ]?error|invalid x-api-key|unauthorized/i,REVOKED_TOKEN_TEXT=/invalidated (?:oauth )?token|(?<!\b(?:session|csrf|xsrf|page|pagination|continuation|cursor|sync|stream|upload|idempotency|request|nonce|state)[ _-])token(?:[ _-](?:invalidated|revoked)|\s(?:has been|was) (?:invalidated|revoked))/i,REFUSED_GRANT_CODES=new Set(["invalid_grant","refresh_token_expired","refresh_token_invalidated","refresh_token_reused","token_revoked"]),REFUSED_GRANT_TOKEN=/(?<![a-z_])(invalid_grant|refresh_token_(?:expired|invalidated|reused)|token_revoked)(?![a-z_])/,CLIENT_FAULT_CODES=new Set(["invalid_client","invalid_request","invalid_scope","unauthorized_client","unsupported_grant_type"]),NETWORK_FAULT_CODES=new Set(["ECONNRESET","ECONNREFUSED","ECONNABORTED","ETIMEDOUT","EHOSTUNREACH","EHOSTDOWN","ENETUNREACH","ENETDOWN","ENETRESET","ENOTFOUND","EAI_AGAIN","EPIPE","EADDRNOTAVAIL","ERR_SOCKET_CONNECTION_TIMEOUT","UND_ERR_CONNECT_TIMEOUT","UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_SOCKET","UND_ERR_CLOSED","ConnectionRefused","ConnectionClosed","FailedToOpenSocket"]),AUTH_ERROR_CODES=new Set(["authentication_error","invalid_api_key","token_invalidated",...REFUSED_GRANT_CODES]),MAX_CAUSE_LINKS=16,ACCOUNT_SCOPED_403_TEXT=/account|credential|token|api[ _-]?key|organization|subscription/i,MODEL_SCOPED_REFUSAL_TEXT=[/(?:does not include(?: access to)?|not entitled to(?: use)?|no access to)[^.]{0,60}?\bmodel\b/i,/\bmodel\b.{0,80}?\b(?:is not|not|no)\b.{0,40}?\b(?:available|included|entitled|enabled|accessible)\b.{0,40}?\b(?:plan|subscription)\b/i,/(?:plan|subscription)[^.]{0,30}?\bdoes not\b[^.]{0,20}?\binclude access to\b/i],RATE_LIMIT_TEXT=/rate[ _-]?limit|too many requests|resource_exhausted/i,BILLING_TEXT=/billing|credits?[ _-]?(?:required|exhausted|balance)|insufficient[ _-]?(?:funds|quota|credit)|payment[ _-]?required|quota[ _-]?exhausted/i,OVERLOAD_TEXT=/overloaded/i,NETWORK_TEXT=/econnreset|econnrefused|etimedout|enotfound|socket hang up|fetch failed|network error|request timed out/i,WEBSOCKET_REQUEST_FAULT_TEXT=/websocket closed 100[89]\b/i,WEBSOCKET_TRANSPORT_FAULT_TEXT=/websocket (?:closed|error|connect timeout|liveness timeout)/i,FAIL_FAST_TEXT=/context[ _-]?(?:length|window)|maximum context|invalid[ _-]?model|model[ _-]?not[ _-]?found|malformed[ _-]?stream|premature[ _-]?(?:close|stream)/i,ABORT_TEXT=/\baborted?\b/i,TEMPORARY_FAULT_TEXT=/time[ds]?[ _-]?out|timed out|disconnect|reset before|connection reset|gateway|temporarily|unavailable/i;function limitFromProviderCode(error){let diagnostic=readProviderDiagnostic(error);if(diagnostic?.evidence==="structured_code")switch(diagnostic.code){case"rate_limit_exceeded":return{kind:"throttle"};case"usage_limit_reached":case"usage_not_included":return diagnostic.resetsAt===void 0?{kind:"spent"}:{kind:"spent",resetsAt:diagnostic.resetsAt};default:return}}function isAbort(error,message){return error instanceof Error&&error.name==="AbortError"?!0:ABORT_TEXT.test(message)}function failedRefresh(error){let seen=new Set;for(;typeof error=="object"&&error!==null&&!seen.has(error)&&seen.size<MAX_CAUSE_LINKS;){if(seen.add(error),error instanceof ModelsError)return error.code==="oauth"?error:void 0;error=Reflect.get(error,"cause")}}function oauthBodyErrorCode(message){let start=message.indexOf("{"),end=message.lastIndexOf("}");if(!(start<0||end<=start))try{let body=JSON.parse(message.slice(start,end+1));if(typeof body!="object"||body===null)return;let field=Reflect.get(body,"error");if(typeof field=="string")return field;if(typeof field=="object"&&field!==null){let code=Reflect.get(field,"code");return typeof code=="string"?code:void 0}return}catch{return}}function isRefusedGrant(refresh){let cause=refresh.cause;if(!(cause instanceof OAuthTokenEndpointError))return!1;let code=cause.oauthError??oauthBodyErrorCode(cause.message);return code!==void 0&&CLIENT_FAULT_CODES.has(code)?!1:cause.credentialRefused||cause.status===401?!0:code!==void 0&&REFUSED_GRANT_CODES.has(code)?[400,403,404].includes(cause.status):cause.status===400&&REFUSED_GRANT_TOKEN.test(cause.message)}function isRefreshNetworkFault(refresh,text){let seen=new Set,error=refresh.cause;for(;typeof error=="object"&&error!==null&&!seen.has(error)&&seen.size<MAX_CAUSE_LINKS;){if(seen.add(error),error instanceof OAuthTokenEndpointError)return!1;let code=Reflect.get(error,"code");if(typeof code=="string")return NETWORK_FAULT_CODES.has(code);error=Reflect.get(error,"cause")}return NETWORK_TEXT.test(text)}function hasAuthDiagnostic(error){let diagnostic=readProviderDiagnostic(error);return diagnostic===void 0?!1:diagnostic.category==="auth"||diagnostic.code!==void 0&&AUTH_ERROR_CODES.has(diagnostic.code)}function isOverflowText(text){return getOverflowPatterns().some(pattern=>pattern.test(text))}var JSON_BODY=/\{\s*"[^"]+"\s*:/;function rateLimitHint(codedThrottle,codedReset,text,status,usageLimit,diagnosticRetryAfterMs,nowMs){let sourced=(hint,source)=>hint===void 0?{hint,resetSource:"default_backoff"}:{hint,resetSource:source};if(codedThrottle)return sourced(parseRetryAfterMsMarker(text),"retry_after");if(codedReset!==void 0)return sourced(codedReset,"reset_field");let retryAfter=extract429RetryAfterMs({status:status??429,bodyText:text},nowMs);return retryAfter!==void 0?parseRetryAfterMsMarker(text)!==void 0?sourced(retryAfter,"retry_after"):sourced(retryAfter,JSON_BODY.test(text)?"reset_field":"reset_prose"):usageLimit?diagnosticRetryAfterMs!==void 0?sourced(diagnosticRetryAfterMs,"reset_field"):sourced(usageLimitResetMs(text,nowMs),JSON_BODY.test(text)?"reset_field":"reset_prose"):sourced(void 0,"default_backoff")}function credentialFailureText(error){let normalized=normalizeProviderError(error);return normalized.messageCarriesBody?normalized.message:`${normalized.message} ${normalized.body??""}`}function classifyCredentialFailure(error,context={}){if(isOAuthRefreshUnavailableError(error))return{kind:"retry_same",maxAttempts:RETRY_SAME_MAX_ATTEMPTS};let normalized=normalizeProviderError(error),text=normalized.messageCarriesBody?normalized.message:`${normalized.message} ${normalized.body??""}`,status=normalized.status,failureCount=context.failureCount??0;if(error instanceof Error&&error.name==="AbortError")return{kind:"fail_request"};switch(siwcRecoveryFromDiagnostic(readProviderDiagnostic(error))){case"usage_limit":return{kind:"failover",block:{reason:"rate_limit",usageLimit:!0,...rateLimitCooldown(failureCount,void 0,{baseMs:context.cooldownBaseMs,capMs:Math.min(context.cooldownCapMs??COOLDOWN_CAP_MS,30*6e4)})}};case"account_disabled":return{kind:"failover",block:{reason:"account_disabled"}};case"auth":return{kind:"failover",block:{reason:"auth_error"}};case"request":return{kind:"fail_request"};case"transient":return{kind:"retry_same",maxAttempts:RETRY_SAME_MAX_ATTEMPTS};case void 0:break}if(isAbort(error,text))return{kind:"fail_request"};if(text.includes(ACCOUNT_POOL_REFUSAL_NOTE))return{kind:"fail_request"};let providerFault=status===408||status!==void 0&&status>=500&&status<600||status===void 0&&(TEMPORARY_FAULT_TEXT.test(text)||NETWORK_TEXT.test(text)||OVERLOAD_TEXT.test(text)),codedLimit=limitFromProviderCode(error),usageLimit=codedLimit!==void 0?codedLimit.kind==="spent":isAccountUsageLimitText(text)&&!isOverflowText(text),limitText=codedLimit!==void 0||RATE_LIMIT_TEXT.test(text)||usageLimit;if(text.includes(PROVIDER_NOT_CONFIGURED_PREFIX))return{kind:"failover",block:{reason:"auth_error"}};let statusFault=status===408||status===429||status!==void 0&&status>=500&&status<600,refresh=failedRefresh(error);if(refresh!==void 0)return!statusFault&&isRefusedGrant(refresh)?{kind:"failover",block:{reason:"auth_error"}}:isRefreshNetworkFault(refresh,text)?{kind:"retry_same",maxAttempts:RETRY_SAME_MAX_ATTEMPTS}:{kind:"fail_request"};if(!providerFault&&status!==429&&hasAuthDiagnostic(error))return{kind:"failover",block:{reason:"auth_error"}};if(status===401||!providerFault&&status!==429&&(INVALID_KEY_TEXT.test(text)||REVOKED_TOKEN_TEXT.test(text)))return{kind:"failover",block:{reason:"auth_error"}};if(status===403&&!limitText)return MODEL_SCOPED_REFUSAL_TEXT.some(pattern=>pattern.test(text))?{kind:"fail_request"}:ACCOUNT_SCOPED_403_TEXT.test(text)?{kind:"failover",block:{reason:"auth_error"}}:{kind:"fail_request"};if(status===402||!providerFault&&BILLING_TEXT.test(text))return{kind:"failover",block:{reason:"account_disabled"}};if(status===429||limitText){if(codedLimit===void 0&&MODEL_SCOPED_REFUSAL_TEXT.some(pattern=>pattern.test(text)))return{kind:"fail_request"};let nowMs=context.nowMs??Date.now(),codedResetMs=codedLimit?.kind==="spent"&&codedLimit.resetsAt!==void 0?codedLimit.resetsAt-nowMs:void 0,codedReset=codedResetMs!==void 0&&codedResetMs>0?codedResetMs:void 0,{hint,resetSource}=rateLimitHint(codedLimit?.kind==="throttle",codedReset,text,status,usageLimit,normalized.retryAfterMs,nowMs),modelFamily=rateLimitModelFamily(text),policy={baseMs:context.cooldownBaseMs,capMs:context.cooldownCapMs};return{kind:"failover",block:{reason:"rate_limit",...usageLimit&&hint!==void 0&&hint>0?usageLimitCooldown(hint,policy):rateLimitCooldown(failureCount,hint,policy),resetSource,...modelFamily===void 0?{}:{modelFamily}}}}return isOverflowText(text)||status===400||status===404||FAIL_FAST_TEXT.test(text)?{kind:"fail_request"}:WEBSOCKET_REQUEST_FAULT_TEXT.test(text)?{kind:"fail_request"}:WEBSOCKET_TRANSPORT_FAULT_TEXT.test(text)?{kind:"retry_same",maxAttempts:RETRY_SAME_MAX_ATTEMPTS}:status===529||OVERLOAD_TEXT.test(text)||status!==void 0&&status>=500&&status<600?{kind:"retry_same",maxAttempts:RETRY_SAME_MAX_ATTEMPTS}:status===408||NETWORK_TEXT.test(text)?{kind:"retry_same",maxAttempts:RETRY_SAME_MAX_ATTEMPTS}:{kind:"fail_request"}}var CredentialFailoverError=class extends Error{constructor(action,original,options={}){let detail=original instanceof Error?original.message:String(original);super(detail,{cause:original}),this.name="CredentialFailoverError",this.action=action,this.original=original,this.retryAt=options.retryAt}};function isAvailable(slot,now){return!(slot.blockReason==="account_disabled"||slot.blockedUntil!==void 0&&slot.blockedUntil>now)}function coolingProbe(slots,attempted){if(attempted.size>0)return[];let soonest=slots.filter(slot=>slot.blockReason==="rate_limit"&&slot.blockedUntil!==void 0).reduce((best,slot)=>best===void 0||(slot.blockedUntil??0)<(best.blockedUntil??0)?slot:best,void 0);return soonest===void 0?[]:[soonest]}function attemptCandidates(slots,attempted,now){let available=slots.filter(slot=>!attempted.has(slot.name)&&isAvailable(slot,now));return available.length>0?available:coolingProbe(slots,attempted)}function noSlotsError(slots,now){let retryAt=soonestRetryAt(slots,now);return new CredentialFailoverError({kind:"fail_request"},new Error(noSlotsMessage(slots,now)),retryAt===void 0?{}:{retryAt})}function dueBack(epochMs){return`${localTime(epochMs)} (${new Date(epochMs).toISOString()})`}function localTime(epochMs){return new Date(epochMs).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"})}function noSlotsMessage(slots,now){let blocked=slots.map(slot=>{let reason=slot.blockReason??"blocked";return slot.blockedUntil!==void 0&&slot.blockedUntil>now?`${slot.name} (${reason} until ${dueBack(slot.blockedUntil)})`:reason==="account_disabled"?`${slot.name} (account_disabled until re-login)`:`${slot.name} (${reason})`}),firstBack=soonestRetryAt(slots,now),step=firstBack===void 0?"Sign in again or add a new API key for this provider, or choose another model.":`Wait until ${localTime(firstBack)}, or choose another model.`;return blocked.length===0?`No credential slots available. ${step}`:`No credential slots available: ${blocked.join(", ")}. ${step}`}function isRateLimitBlock(action){return action.kind==="failover"&&action.block.reason==="rate_limit"}var OUT_OF_POOL_REASONS=new Set(["auth_error","account_disabled"]);function limitedUntil(slots,now){let resets=[];for(let slot of slots)if(!OUT_OF_POOL_REASONS.has(slot.blockReason??"")){if(slot.blockReason!=="rate_limit"||slot.blockedUntil===void 0||slot.blockedUntil<=now)return;resets.push(slot.blockedUntil)}return resets.length===0?void 0:Math.min(...resets)}function soonestRetryAt(slots,now){let deadlines=slots.map(slot=>slot.blockedUntil).filter(value=>value!==void 0&&value>now);return deadlines.length===0?void 0:Math.min(...deadlines)}async function settle(stream){let iterator=stream[Symbol.asyncIterator]();try{await iterator.return?.(void 0)}catch{}}async function*runCredentialFailover(options){let now=options.now??Date.now,classify=options.classify??classifyCredentialFailure,attempted=new Set,retriesBySlot=new Map,lastError,lastOriginal,lastTerminalEvent,startAnnounced=!1,unsettled;try{for(;;){let slots=await options.listSlots(),candidates=attemptCandidates(slots,attempted,now());if(candidates.length===0){let limitedRetryAt=lastError===void 0||isRateLimitBlock(lastError.action)?limitedUntil(slots,now()):void 0;if(lastTerminalEvent!==void 0){yield limitedRetryAt===void 0||options.withPoolRetryAt===void 0?lastTerminalEvent:options.withPoolRetryAt(lastTerminalEvent,limitedRetryAt);return}let retryAt=soonestRetryAt(slots,now()),refusal=lastError===void 0||lastOriginal===void 0?noSlotsError(slots,now()):new CredentialFailoverError(lastError.action,lastOriginal,retryAt===void 0?{}:{retryAt});throw limitedRetryAt===void 0?refusal:attachProviderDiagnostic(refusal,credentialPoolBlockedDiagnostic(limitedRetryAt))}let slot=options.select(candidates);unsettled=slot;let committedOutput=!1,terminalEvent,attemptStream;try{attemptStream=await options.runAttempt(slot);for await(let event of attemptStream){let failure=options.errorFromEvent?.(event);if(failure!==void 0)throw terminalEvent=event,failure;if(options.isStreamStart?.(event)){if(startAnnounced)continue;startAnnounced=!0}committedOutput||=options.isCommittedOutput(event),yield event}unsettled=void 0,await options.onSuccess?.(slot);return}catch(error){attemptStream&&await settle(attemptStream);let failureCount=(slot.failureCount??0)+(retriesBySlot.get(slot.name)??0),action=classify(error,{failureCount});if(lastOriginal=error,lastTerminalEvent=terminalEvent,action.kind==="retry_same"&&!committedOutput){let used=(retriesBySlot.get(slot.name)??0)+1;if(retriesBySlot.set(slot.name,used),used<action.maxAttempts){unsettled=void 0,await options.releaseSlot?.(slot);continue}if(terminalEvent!==void 0){yield terminalEvent;return}throw new CredentialFailoverError(action,error)}if(action.kind!=="failover"){if(terminalEvent!==void 0){yield terminalEvent;return}throw new CredentialFailoverError(action,error)}unsettled=void 0,await options.persistBlock(slot,action.block,error),attempted.add(slot.name);let failure=new CredentialFailoverError(action,error);if(lastError=failure,await options.onRotate?.({slot,block:action.block,attempt:attempted.size,committedOutput}),committedOutput){if(terminalEvent!==void 0){yield terminalEvent;return}throw failure}}}}finally{unsettled!==void 0&&await options.releaseSlot?.(unsettled)}}function parseAccountStrategy(value,field){switch(value){case void 0:case"cache-affine":case"fill-first":case"round-robin":return value;default:throw new Error(`${field} must be "cache-affine", "fill-first", or "round-robin"`)}}function orderAccounts(accounts,ranked,accountOrder,strategy="cache-affine",offset=0){switch(strategy){case"cache-affine":return applyAccountOrder(accountOrder,ranked);case"fill-first":return applyAccountOrder(accountOrder,accounts);case"round-robin":{let ordered=applyAccountOrder(accountOrder,accounts);if(ordered.length===0)return ordered;let start=offset%ordered.length;return[...ordered.slice(start),...ordered.slice(0,start)]}default:{let unsupported=strategy;throw new Error(`Unknown account strategy: ${unsupported}`)}}}function preferHeadroom(ordered,provider,limits,now,preferredAccount){let preferred=ordered.find(account=>account.name===preferredAccount),normal=preferred===void 0?ordered:[preferred,...ordered.filter(account=>account!==preferred)],nearLimit=new Set(limits.filter(limit=>limit.provider===provider&&limit.windows.some(window=>window.usedPercent>=95&&(window.resetsAt===void 0||!(Date.parse(window.resetsAt)<=now)))).map(limit=>limit.account)),withHeadroom=normal.filter(account=>!nearLimit.has(account.name));return withHeadroom.length>0?withHeadroom:normal}export{rendezvousOrder,applyAccountOrder,withoutOrderedAccount,isSlotBlocked,MAX_SLOT_BLOCK_MS,ACCOUNT_POOL_REFUSAL_NOTE,credentialFailureText,classifyCredentialFailure,CredentialFailoverError,isAvailable,attemptCandidates,noSlotsError,runCredentialFailover,parseAccountStrategy,orderAccounts,preferHeadroom};
@@ -1,2 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{external_exports}from"./chunk-36BLGKRO.js";var clientMessageIdentitySchema=external_exports.object({clientMessageId:external_exports.string().min(1).max(256).optional(),clientTurnId:external_exports.string().min(1).max(256).optional()});function clientMessageIdentity(value={}){return{...value.clientMessageId===void 0?{}:{clientMessageId:value.clientMessageId},...value.clientTurnId===void 0?{}:{clientTurnId:value.clientTurnId}}}function readClientMessageIdentity(value){let parsed=clientMessageIdentitySchema.safeParse(value);return parsed.success?clientMessageIdentity(parsed.data):{}}var RPC_ERROR_UNKNOWN_SESSION="unknown_session",RPC_ERROR_SESSION_NOT_ATTACHED="session_not_attached";var RPC_ERROR_SESSION_CLOSING="session_closing";var RPC_ERROR_SESSION_HELD="session_held";var RPC_ERROR_MISSING_SESSION_ID="missing_session_id";var RPC_ERROR_INVALID_PATH="invalid_path",RPC_ERROR_INVALID_ARGUMENT="invalid_argument",RPC_ERROR_RESPONSE_TOO_LARGE="response_too_large",RPC_ERROR_RESPONSE_UNWRITABLE="response_unwritable",RPC_ERROR_OPEN_FAILED="open_failed",RPC_ERROR_OWNER_CHANGED="owner_changed";var RPC_ERROR_MEDIA_NOT_FOUND="media_not_found",RPC_ERROR_PROJECT_TRUST_LOCKED="project_trust_locked",RPC_ERROR_PROJECT_TRUST_EXTENSION_DECIDED="project_trust_extension_decided",RPC_ERROR_PROJECT_SETTINGS_WRITE_FAILED="project_settings_write_failed",RPC_ERROR_PROJECT_NOT_TRUSTED="project_not_trusted",RPC_ERROR_PROJECT_SETTINGS_UNREADABLE="project_settings_unreadable",RPC_ERROR_PROJECT_FILE_NOT_ALLOWED="project_file_not_allowed",RPC_ERROR_PROJECT_FILE_CONFLICT="project_file_conflict",RPC_ERROR_PROJECT_FILE_TOO_LARGE="project_file_too_large",RPC_ERROR_PROJECT_FILE_WRITE_FAILED="project_file_write_failed",RPC_ERROR_INVALID_SESSION_CONTEXT="invalid_session_context",RPC_ERROR_INVALID_SESSION_ENV="invalid_session_env",RPC_ERROR_INVALID_SUBSCRIPTION="invalid_subscription",RPC_ERROR_UNKNOWN_SUBSCRIPTION="unknown_subscription",RPC_ERROR_SUBSCRIPTION_LIMIT="subscription_limit",RPC_ERROR_UNSUPPORTED_TRANSPORT="unsupported_transport",RPC_ERROR_FEATURE_DISABLED="feature_disabled",RPC_ERROR_INVALID_SESSION_KIND="invalid_session_kind",RPC_ERROR_INVALID_LAUNCH_PROFILE="invalid_launch_profile";var RPC_ERROR_WARM_FAILED="warm_failed";var RPC_ERROR_ENTRY_NOT_FOUND="not_found",RPC_ERROR_MODEL_NOT_FOUND="model_not_found",RPC_ERROR_EFFECT_ID_CONFLICT="effect_id_conflict",RPC_ERROR_TRANSCRIPT_UNREADABLE="transcript_unreadable",RPC_ERROR_PROVIDER_UNAVAILABLE="provider_unavailable",RPC_ERROR_PROVIDER_CREDENTIALS_MISSING="provider_credentials_missing",RPC_ERROR_PROVIDER_CREDENTIALS_EXPIRED="provider_credentials_expired",RPC_ERROR_NO_MODEL_SELECTED="no_model_selected",RPC_ERROR_TURN_CONFLICT="turn_conflict",RPC_ERROR_CONTEXT_BUDGET="context_budget",RPC_ERROR_EVAL_CELL_NOT_FOUND="eval_cell_not_found",RPC_ERROR_INVALID_EVAL_CELL_REQUEST="invalid_eval_cell_request",RPC_ERROR_EVAL_CELLS_UNAVAILABLE="eval_cells_unavailable";var RPC_ERROR_UNKNOWN_COMMAND="unknown_command",RPC_ERROR_TURN_ACTIVE="turn_active",RPC_ERROR_SESSION_BUSY="session_busy",RPC_ERROR_ATTACHED="attached",RPC_ERROR_INVALID_RELEASE_REASON="invalid_release_reason",RPC_ERROR_RELEASE_UNSUPPORTED="release_unsupported",RPC_ERROR_RELEASE_FAILED="release_failed",RPC_ERROR_HOST_DRAINING="host_draining";var STEER_WHEN_IDLE_CAPABILITY="steer_when_idle",USER_ACTIVITY_CAPABILITY="user_activity",SESSION_MODEL_SCOPE_CAPABILITY="session_model_scope";export{clientMessageIdentitySchema,clientMessageIdentity,readClientMessageIdentity,RPC_ERROR_UNKNOWN_SESSION,RPC_ERROR_SESSION_NOT_ATTACHED,RPC_ERROR_SESSION_CLOSING,RPC_ERROR_SESSION_HELD,RPC_ERROR_MISSING_SESSION_ID,RPC_ERROR_INVALID_PATH,RPC_ERROR_INVALID_ARGUMENT,RPC_ERROR_RESPONSE_TOO_LARGE,RPC_ERROR_RESPONSE_UNWRITABLE,RPC_ERROR_OPEN_FAILED,RPC_ERROR_OWNER_CHANGED,RPC_ERROR_MEDIA_NOT_FOUND,RPC_ERROR_PROJECT_TRUST_LOCKED,RPC_ERROR_PROJECT_TRUST_EXTENSION_DECIDED,RPC_ERROR_PROJECT_SETTINGS_WRITE_FAILED,RPC_ERROR_PROJECT_NOT_TRUSTED,RPC_ERROR_PROJECT_SETTINGS_UNREADABLE,RPC_ERROR_PROJECT_FILE_NOT_ALLOWED,RPC_ERROR_PROJECT_FILE_CONFLICT,RPC_ERROR_PROJECT_FILE_TOO_LARGE,RPC_ERROR_PROJECT_FILE_WRITE_FAILED,RPC_ERROR_INVALID_SESSION_CONTEXT,RPC_ERROR_INVALID_SESSION_ENV,RPC_ERROR_INVALID_SUBSCRIPTION,RPC_ERROR_UNKNOWN_SUBSCRIPTION,RPC_ERROR_SUBSCRIPTION_LIMIT,RPC_ERROR_UNSUPPORTED_TRANSPORT,RPC_ERROR_FEATURE_DISABLED,RPC_ERROR_INVALID_SESSION_KIND,RPC_ERROR_INVALID_LAUNCH_PROFILE,RPC_ERROR_WARM_FAILED,RPC_ERROR_ENTRY_NOT_FOUND,RPC_ERROR_MODEL_NOT_FOUND,RPC_ERROR_EFFECT_ID_CONFLICT,RPC_ERROR_TRANSCRIPT_UNREADABLE,RPC_ERROR_PROVIDER_UNAVAILABLE,RPC_ERROR_PROVIDER_CREDENTIALS_MISSING,RPC_ERROR_PROVIDER_CREDENTIALS_EXPIRED,RPC_ERROR_NO_MODEL_SELECTED,RPC_ERROR_TURN_CONFLICT,RPC_ERROR_CONTEXT_BUDGET,RPC_ERROR_EVAL_CELL_NOT_FOUND,RPC_ERROR_INVALID_EVAL_CELL_REQUEST,RPC_ERROR_EVAL_CELLS_UNAVAILABLE,RPC_ERROR_UNKNOWN_COMMAND,RPC_ERROR_TURN_ACTIVE,RPC_ERROR_SESSION_BUSY,RPC_ERROR_ATTACHED,RPC_ERROR_INVALID_RELEASE_REASON,RPC_ERROR_RELEASE_UNSUPPORTED,RPC_ERROR_RELEASE_FAILED,RPC_ERROR_HOST_DRAINING,STEER_WHEN_IDLE_CAPABILITY,USER_ACTIVITY_CAPABILITY,SESSION_MODEL_SCOPE_CAPABILITY};
@@ -1,2 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{accountCanServe,accountsNeedingUser,assertValidAccountName2 as assertValidAccountName,credentialPoolRepository,getCredentialAccounts,pinCredentialAccount,removeCredentialAccount,renameCredentialAccount,selectedOAuthAccount,signOutClaudeCliSlotsForLogout,summarizeCredentialAccounts}from"./chunk-UYPH6RHY.js";import"./chunk-GILDYS3O.js";import"./chunk-KLAX467B.js";import"./chunk-C4AHHZ6P.js";import"./chunk-CEFKVI3E.js";import"./chunk-HGCQAMC6.js";import"./chunk-GZVCRV7I.js";import"./chunk-236TAYFX.js";import"./chunk-36BLGKRO.js";import"./chunk-FKX6EWFV.js";import"./chunk-U3VOXCGP.js";import"./chunk-7X72IACK.js";import"./chunk-EUCZC2RF.js";import"./chunk-WHQ2QPP5.js";import"./chunk-PBUV2Z3R.js";import"./chunk-WB4BUHOH.js";import"./chunk-NJ43NBSP.js";import"./chunk-AC72EWI5.js";import"./chunk-RQFD6LG2.js";import"./chunk-62OVOJPI.js";import"./chunk-G7U4BOJP.js";import"./chunk-SFACYIB6.js";import"./chunk-XDEZA6U6.js";import"./chunk-COH5F7QV.js";import"./chunk-RFB5CBW7.js";import"./chunk-Y7QPP7BG.js";import"./chunk-IREUIMFE.js";import"./chunk-GVSBCJFI.js";import"./chunk-Z6TEQEZO.js";import"./chunk-ZG3MNTNX.js";import"./chunk-WHPDEDCC.js";import"./chunk-HK46JMSC.js";import"./chunk-5ROMKDLK.js";import"./chunk-3W47LTXQ.js";import"./chunk-UAOOH2V7.js";import"./chunk-WDTJ6JKE.js";import"./chunk-OH5TKHW7.js";import"./chunk-NDNQ23SK.js";import"./chunk-JGKH3D6W.js";import"./chunk-3SASTB6Y.js";import"./chunk-PJ34QVL5.js";import"./chunk-SODMQEHO.js";import"./chunk-ATQFN5HI.js";import"./chunk-MIENF2YK.js";import"./chunk-IKOFCODM.js";export{accountCanServe,accountsNeedingUser,assertValidAccountName,credentialPoolRepository,getCredentialAccounts,pinCredentialAccount,removeCredentialAccount,renameCredentialAccount,selectedOAuthAccount,signOutClaudeCliSlotsForLogout,summarizeCredentialAccounts};
@@ -1,2 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{InteractiveMode,OptimisticUserEchoController,formatCrashExtensionHint,formatResumeCommand,isApiKeyLoginProvider,replayStartupSubmission,shouldShowRetryIndicator,showsStartupDetails,showsStartupHeader}from"./chunk-I4N2OIY4.js";import"./chunk-Y4PFEXFN.js";import"./chunk-KKB3K5CV.js";import"./chunk-NI2AOYP6.js";import"./chunk-WRBOKYPS.js";import"./chunk-CU6HUYL7.js";import"./chunk-NLYT7BND.js";import"./chunk-EQT4WNCW.js";import"./chunk-DEUEMEV3.js";import"./chunk-XI6THO4F.js";import"./chunk-7GD2EO6T.js";import"./chunk-WMDJMN5W.js";import"./chunk-GTJJ73DE.js";import"./chunk-VD7AKTGP.js";import{createInteractiveTui,createInteractiveTuiReference}from"./chunk-V4VDIV3U.js";import"./chunk-M2VJVJMK.js";import"./chunk-TQHNFP77.js";import"./chunk-BKDXY6EM.js";import"./chunk-HKCFMDJN.js";import"./chunk-E6ZBTSC6.js";import"./chunk-3QPE75AR.js";import"./chunk-ULWRGKP2.js";import"./chunk-4B5JSLLR.js";import"./chunk-FWIO636S.js";import"./chunk-MOVB6H22.js";import"./chunk-DLPV4B3R.js";import"./chunk-VPVD5G32.js";import"./chunk-H4QOEVS5.js";import"./chunk-RNLFZ67U.js";import"./chunk-SOMFLLPD.js";import"./chunk-MTQQ2VQH.js";import"./chunk-WMHESZCU.js";import"./chunk-IJXKHJYR.js";import"./chunk-QMRJYMNH.js";import"./chunk-DZQA5LVN.js";import"./chunk-IEY2SL46.js";import"./chunk-26UBFF6N.js";import"./chunk-4JMGWVRH.js";import"./chunk-E5O4SP5I.js";import"./chunk-AT5G5BUI.js";import"./chunk-7WYJAYHH.js";import"./chunk-5HMYIYQB.js";import"./chunk-OSNR3IRD.js";import"./chunk-UCXBDE6R.js";import"./chunk-YI6KRJDC.js";import"./chunk-VUY4BZDI.js";import"./chunk-SF4MQDKZ.js";import"./chunk-UYPH6RHY.js";import"./chunk-AZ27TE3H.js";import"./chunk-GILDYS3O.js";import"./chunk-KLAX467B.js";import"./chunk-C4AHHZ6P.js";import"./chunk-CEFKVI3E.js";import"./chunk-HGCQAMC6.js";import"./chunk-GZVCRV7I.js";import"./chunk-236TAYFX.js";import"./chunk-36BLGKRO.js";import"./chunk-FKX6EWFV.js";import"./chunk-U3VOXCGP.js";import"./chunk-7X72IACK.js";import"./chunk-EUCZC2RF.js";import"./chunk-WHQ2QPP5.js";import"./chunk-PBUV2Z3R.js";import"./chunk-WB4BUHOH.js";import"./chunk-NJ43NBSP.js";import"./chunk-KDUJCDLM.js";import"./chunk-6APXZK7W.js";import"./chunk-YU2P3CAR.js";import"./chunk-2IKL4F24.js";import"./chunk-KJR3XXMI.js";import"./chunk-IYL5E4QQ.js";import"./chunk-7THM57HH.js";import"./chunk-AC72EWI5.js";import"./chunk-RQFD6LG2.js";import"./chunk-HZQHA4PA.js";import"./chunk-4PMRUR4L.js";import"./chunk-LPYBKMPT.js";import"./chunk-JJYN347Z.js";import"./chunk-NDI6N4NJ.js";import"./chunk-R7J5TEYK.js";import"./chunk-62OVOJPI.js";import"./chunk-G7U4BOJP.js";import"./chunk-SFACYIB6.js";import"./chunk-XDEZA6U6.js";import"./chunk-WOHQJ6JB.js";import"./chunk-COH5F7QV.js";import"./chunk-RFB5CBW7.js";import"./chunk-Y7QPP7BG.js";import"./chunk-IREUIMFE.js";import"./chunk-GVSBCJFI.js";import"./chunk-QTS2XGPQ.js";import"./chunk-Z6TEQEZO.js";import"./chunk-ZG3MNTNX.js";import"./chunk-WHPDEDCC.js";import"./chunk-HK46JMSC.js";import"./chunk-5ROMKDLK.js";import"./chunk-3W47LTXQ.js";import"./chunk-UAOOH2V7.js";import"./chunk-WDTJ6JKE.js";import"./chunk-OH5TKHW7.js";import"./chunk-NDNQ23SK.js";import"./chunk-JGKH3D6W.js";import"./chunk-3SASTB6Y.js";import"./chunk-PJ34QVL5.js";import"./chunk-BMX2U22F.js";import"./chunk-GLTOBXZY.js";import"./chunk-U4FAWC6C.js";import"./chunk-ZOFZRJSL.js";import"./chunk-ZFIC2DZV.js";import"./chunk-2SOVDETB.js";import"./chunk-LJFQYCFH.js";import"./chunk-K3GAGIPX.js";import"./chunk-RUGTHELO.js";import"./chunk-42XRJQM6.js";import"./chunk-IHES3JES.js";import"./chunk-5XHOHZIR.js";import"./chunk-HW6AAS3R.js";import"./chunk-SODMQEHO.js";import"./chunk-ATQFN5HI.js";import"./chunk-EYSV6A7S.js";import"./chunk-MIENF2YK.js";import"./chunk-OXNWERO4.js";import"./chunk-44BJPS5I.js";import"./chunk-AOTHPTMU.js";import"./chunk-O5RYI3IW.js";import"./chunk-RFFMEA4B.js";import"./chunk-IKOFCODM.js";export{InteractiveMode,OptimisticUserEchoController,createInteractiveTui,createInteractiveTuiReference,formatCrashExtensionHint,formatResumeCommand,isApiKeyLoginProvider,replayStartupSubmission,shouldShowRetryIndicator,showsStartupDetails,showsStartupHeader};
@@ -1,2 +0,0 @@
1
- import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{applyGrokNeoThemeFallback,collectAuthDiagnostics,collectExtensionLoadDiagnostics,createCliRuntimeFactory,createSessionManager,interactiveAuthNotices,main,promptConfirm,resolveAutoTitleSessions}from"./chunk-I4N2OIY4.js";import"./chunk-Y4PFEXFN.js";import"./chunk-KKB3K5CV.js";import"./chunk-NI2AOYP6.js";import"./chunk-WRBOKYPS.js";import"./chunk-CU6HUYL7.js";import"./chunk-NLYT7BND.js";import"./chunk-EQT4WNCW.js";import"./chunk-DEUEMEV3.js";import"./chunk-XI6THO4F.js";import"./chunk-7GD2EO6T.js";import"./chunk-WMDJMN5W.js";import"./chunk-GTJJ73DE.js";import"./chunk-VD7AKTGP.js";import"./chunk-V4VDIV3U.js";import"./chunk-M2VJVJMK.js";import"./chunk-TQHNFP77.js";import"./chunk-BKDXY6EM.js";import"./chunk-HKCFMDJN.js";import"./chunk-E6ZBTSC6.js";import"./chunk-3QPE75AR.js";import"./chunk-ULWRGKP2.js";import"./chunk-4B5JSLLR.js";import"./chunk-FWIO636S.js";import"./chunk-MOVB6H22.js";import"./chunk-DLPV4B3R.js";import"./chunk-VPVD5G32.js";import"./chunk-H4QOEVS5.js";import"./chunk-RNLFZ67U.js";import"./chunk-SOMFLLPD.js";import"./chunk-MTQQ2VQH.js";import"./chunk-WMHESZCU.js";import"./chunk-IJXKHJYR.js";import"./chunk-QMRJYMNH.js";import"./chunk-DZQA5LVN.js";import"./chunk-IEY2SL46.js";import"./chunk-26UBFF6N.js";import"./chunk-4JMGWVRH.js";import"./chunk-E5O4SP5I.js";import"./chunk-AT5G5BUI.js";import"./chunk-7WYJAYHH.js";import"./chunk-5HMYIYQB.js";import"./chunk-OSNR3IRD.js";import"./chunk-UCXBDE6R.js";import"./chunk-YI6KRJDC.js";import"./chunk-VUY4BZDI.js";import"./chunk-SF4MQDKZ.js";import"./chunk-UYPH6RHY.js";import"./chunk-AZ27TE3H.js";import"./chunk-GILDYS3O.js";import"./chunk-KLAX467B.js";import"./chunk-C4AHHZ6P.js";import"./chunk-CEFKVI3E.js";import"./chunk-HGCQAMC6.js";import"./chunk-GZVCRV7I.js";import"./chunk-236TAYFX.js";import"./chunk-36BLGKRO.js";import"./chunk-FKX6EWFV.js";import"./chunk-U3VOXCGP.js";import"./chunk-7X72IACK.js";import"./chunk-EUCZC2RF.js";import"./chunk-WHQ2QPP5.js";import"./chunk-PBUV2Z3R.js";import"./chunk-WB4BUHOH.js";import"./chunk-NJ43NBSP.js";import"./chunk-KDUJCDLM.js";import"./chunk-6APXZK7W.js";import"./chunk-YU2P3CAR.js";import"./chunk-2IKL4F24.js";import"./chunk-KJR3XXMI.js";import"./chunk-IYL5E4QQ.js";import"./chunk-7THM57HH.js";import"./chunk-AC72EWI5.js";import"./chunk-RQFD6LG2.js";import"./chunk-HZQHA4PA.js";import"./chunk-4PMRUR4L.js";import"./chunk-LPYBKMPT.js";import"./chunk-JJYN347Z.js";import"./chunk-NDI6N4NJ.js";import"./chunk-R7J5TEYK.js";import"./chunk-62OVOJPI.js";import"./chunk-G7U4BOJP.js";import"./chunk-SFACYIB6.js";import"./chunk-XDEZA6U6.js";import"./chunk-WOHQJ6JB.js";import"./chunk-COH5F7QV.js";import"./chunk-RFB5CBW7.js";import"./chunk-Y7QPP7BG.js";import"./chunk-IREUIMFE.js";import"./chunk-GVSBCJFI.js";import"./chunk-QTS2XGPQ.js";import"./chunk-Z6TEQEZO.js";import"./chunk-ZG3MNTNX.js";import"./chunk-WHPDEDCC.js";import"./chunk-HK46JMSC.js";import"./chunk-5ROMKDLK.js";import"./chunk-3W47LTXQ.js";import"./chunk-UAOOH2V7.js";import"./chunk-WDTJ6JKE.js";import"./chunk-OH5TKHW7.js";import"./chunk-NDNQ23SK.js";import"./chunk-JGKH3D6W.js";import"./chunk-3SASTB6Y.js";import"./chunk-PJ34QVL5.js";import"./chunk-BMX2U22F.js";import"./chunk-GLTOBXZY.js";import"./chunk-U4FAWC6C.js";import"./chunk-ZOFZRJSL.js";import"./chunk-ZFIC2DZV.js";import"./chunk-2SOVDETB.js";import"./chunk-LJFQYCFH.js";import"./chunk-K3GAGIPX.js";import"./chunk-RUGTHELO.js";import"./chunk-42XRJQM6.js";import"./chunk-IHES3JES.js";import"./chunk-5XHOHZIR.js";import"./chunk-HW6AAS3R.js";import"./chunk-SODMQEHO.js";import"./chunk-ATQFN5HI.js";import"./chunk-EYSV6A7S.js";import"./chunk-MIENF2YK.js";import"./chunk-OXNWERO4.js";import"./chunk-44BJPS5I.js";import"./chunk-AOTHPTMU.js";import"./chunk-O5RYI3IW.js";import"./chunk-RFFMEA4B.js";import"./chunk-IKOFCODM.js";export{applyGrokNeoThemeFallback,collectAuthDiagnostics,collectExtensionLoadDiagnostics,createCliRuntimeFactory,createSessionManager,interactiveAuthNotices,main,promptConfirm,resolveAutoTitleSessions};