@code-yeongyu/senpi 2026.9.7-2 → 2026.9.8

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 (199) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/core/agent-session.d.ts +1 -0
  3. package/dist/core/agent-session.d.ts.map +1 -1
  4. package/dist/core/agent-session.js +41 -18
  5. package/dist/core/agent-session.js.map +1 -1
  6. package/dist/core/dynamic-prompt/working-task.js +1 -1
  7. package/dist/core/dynamic-prompt/working-task.js.map +1 -1
  8. package/dist/core/extensions/builtin/cache-keepalive/index.d.ts.map +1 -1
  9. package/dist/core/extensions/builtin/cache-keepalive/index.js +3 -2
  10. package/dist/core/extensions/builtin/cache-keepalive/index.js.map +1 -1
  11. package/dist/core/extensions/builtin/claude-sdk-oauth/account-command.d.ts +2 -0
  12. package/dist/core/extensions/builtin/claude-sdk-oauth/account-command.d.ts.map +1 -1
  13. package/dist/core/extensions/builtin/claude-sdk-oauth/account-command.js +10 -25
  14. package/dist/core/extensions/builtin/claude-sdk-oauth/account-command.js.map +1 -1
  15. package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts +8 -0
  16. package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts.map +1 -1
  17. package/dist/core/extensions/builtin/compaction/deterministic-fallback.js +110 -28
  18. package/dist/core/extensions/builtin/compaction/deterministic-fallback.js.map +1 -1
  19. package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
  20. package/dist/core/extensions/builtin/compaction/index.js +52 -9
  21. package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
  22. package/dist/core/extensions/builtin/goal/agent-end-continuation.d.ts.map +1 -1
  23. package/dist/core/extensions/builtin/goal/agent-end-continuation.js +11 -0
  24. package/dist/core/extensions/builtin/goal/agent-end-continuation.js.map +1 -1
  25. package/dist/core/extensions/builtin/goal/cache-warm.d.ts +17 -11
  26. package/dist/core/extensions/builtin/goal/cache-warm.d.ts.map +1 -1
  27. package/dist/core/extensions/builtin/goal/cache-warm.js +17 -11
  28. package/dist/core/extensions/builtin/goal/cache-warm.js.map +1 -1
  29. package/dist/core/extensions/builtin/goal/continuation.d.ts +3 -1
  30. package/dist/core/extensions/builtin/goal/continuation.d.ts.map +1 -1
  31. package/dist/core/extensions/builtin/goal/continuation.js +17 -2
  32. package/dist/core/extensions/builtin/goal/continuation.js.map +1 -1
  33. package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts.map +1 -1
  34. package/dist/core/extensions/builtin/goal/lifecycle-helpers.js +1 -0
  35. package/dist/core/extensions/builtin/goal/lifecycle-helpers.js.map +1 -1
  36. package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts.map +1 -1
  37. package/dist/core/extensions/builtin/goal/monitor-continuation.js +6 -4
  38. package/dist/core/extensions/builtin/goal/monitor-continuation.js.map +1 -1
  39. package/dist/core/extensions/builtin/gpt-account.d.ts +5 -1
  40. package/dist/core/extensions/builtin/gpt-account.d.ts.map +1 -1
  41. package/dist/core/extensions/builtin/gpt-account.js +9 -26
  42. package/dist/core/extensions/builtin/gpt-account.js.map +1 -1
  43. package/dist/core/extensions/builtin/monitor-state-event.d.ts +18 -0
  44. package/dist/core/extensions/builtin/monitor-state-event.d.ts.map +1 -1
  45. package/dist/core/extensions/builtin/monitor-state-event.js +23 -0
  46. package/dist/core/extensions/builtin/monitor-state-event.js.map +1 -1
  47. package/dist/core/extensions/builtin/oauth-login-interaction.d.ts +24 -0
  48. package/dist/core/extensions/builtin/oauth-login-interaction.d.ts.map +1 -0
  49. package/dist/core/extensions/builtin/oauth-login-interaction.js +77 -0
  50. package/dist/core/extensions/builtin/oauth-login-interaction.js.map +1 -0
  51. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.js +1 -1
  52. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.js.map +1 -1
  53. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js +1 -1
  54. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js.map +1 -1
  55. package/dist/core/extensions/builtin/prompt-preset/execution-tooling.d.ts +14 -7
  56. package/dist/core/extensions/builtin/prompt-preset/execution-tooling.d.ts.map +1 -1
  57. package/dist/core/extensions/builtin/prompt-preset/execution-tooling.js +34 -13
  58. package/dist/core/extensions/builtin/prompt-preset/execution-tooling.js.map +1 -1
  59. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +6 -10
  60. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
  61. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +14 -9
  62. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
  63. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts +15 -15
  64. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts.map +1 -1
  65. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js +49 -21
  66. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js.map +1 -1
  67. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +1 -1
  68. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -1
  69. package/dist/core/extensions/builtin/service-tier.d.ts +2 -0
  70. package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
  71. package/dist/core/extensions/builtin/service-tier.js +17 -1
  72. package/dist/core/extensions/builtin/service-tier.js.map +1 -1
  73. package/dist/core/extensions/builtin/terminal/durable-command.d.ts.map +1 -1
  74. package/dist/core/extensions/builtin/terminal/durable-command.js +3 -0
  75. package/dist/core/extensions/builtin/terminal/durable-command.js.map +1 -1
  76. package/dist/core/extensions/builtin/terminal/durable-file.d.ts.map +1 -1
  77. package/dist/core/extensions/builtin/terminal/durable-file.js +2 -0
  78. package/dist/core/extensions/builtin/terminal/durable-file.js.map +1 -1
  79. package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
  80. package/dist/core/extensions/builtin/terminal/extension.js +14 -2
  81. package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
  82. package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts.map +1 -1
  83. package/dist/core/extensions/builtin/terminal/monitor-notify.js +27 -5
  84. package/dist/core/extensions/builtin/terminal/monitor-notify.js.map +1 -1
  85. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts +17 -0
  86. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -1
  87. package/dist/core/extensions/builtin/terminal/monitor-registry.js +62 -7
  88. package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -1
  89. package/dist/core/extensions/builtin/terminal/notify.d.ts +2 -0
  90. package/dist/core/extensions/builtin/terminal/notify.d.ts.map +1 -1
  91. package/dist/core/extensions/builtin/terminal/notify.js +6 -1
  92. package/dist/core/extensions/builtin/terminal/notify.js.map +1 -1
  93. package/dist/core/extensions/builtin/terminal/session-bundle.d.ts +3 -1
  94. package/dist/core/extensions/builtin/terminal/session-bundle.d.ts.map +1 -1
  95. package/dist/core/extensions/builtin/terminal/session-bundle.js +13 -0
  96. package/dist/core/extensions/builtin/terminal/session-bundle.js.map +1 -1
  97. package/dist/core/extensions/builtin/terminal/shared.d.ts +13 -2
  98. package/dist/core/extensions/builtin/terminal/shared.d.ts.map +1 -1
  99. package/dist/core/extensions/builtin/terminal/shared.js +15 -2
  100. package/dist/core/extensions/builtin/terminal/shared.js.map +1 -1
  101. package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -1
  102. package/dist/core/extensions/builtin/terminal/tools/monitor.js +8 -1
  103. package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -1
  104. package/dist/core/extensions/builtin/tool-search/index.d.ts.map +1 -1
  105. package/dist/core/extensions/builtin/tool-search/index.js +1 -0
  106. package/dist/core/extensions/builtin/tool-search/index.js.map +1 -1
  107. package/dist/core/extensions/builtin/tool-search/service.d.ts +4 -0
  108. package/dist/core/extensions/builtin/tool-search/service.d.ts.map +1 -1
  109. package/dist/core/extensions/builtin/tool-search/service.js +11 -0
  110. package/dist/core/extensions/builtin/tool-search/service.js.map +1 -1
  111. package/dist/core/extensions/runner.d.ts +1 -0
  112. package/dist/core/extensions/runner.d.ts.map +1 -1
  113. package/dist/core/extensions/runner.js +8 -1
  114. package/dist/core/extensions/runner.js.map +1 -1
  115. package/dist/core/extensions/types.d.ts +9 -0
  116. package/dist/core/extensions/types.d.ts.map +1 -1
  117. package/dist/core/extensions/types.js.map +1 -1
  118. package/dist/core/high-reasoning-warning.d.ts.map +1 -1
  119. package/dist/core/high-reasoning-warning.js +4 -6
  120. package/dist/core/high-reasoning-warning.js.map +1 -1
  121. package/dist/core/sdk.d.ts +1 -1
  122. package/dist/core/sdk.d.ts.map +1 -1
  123. package/dist/core/sdk.js +25 -6
  124. package/dist/core/sdk.js.map +1 -1
  125. package/dist/core/settings-manager.js +1 -1
  126. package/dist/core/settings-manager.js.map +1 -1
  127. package/dist/core/settings-shapes.js.map +1 -1
  128. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  129. package/dist/modes/interactive/interactive-mode.js +1 -0
  130. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  131. package/docs/providers.md +5 -1
  132. package/docs/settings.md +1 -0
  133. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +14 -0
  134. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  135. package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +17 -24
  136. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  137. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +2 -2
  138. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  139. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.d.ts +7 -0
  140. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.d.ts.map +1 -1
  141. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.js +19 -0
  142. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.js.map +1 -1
  143. package/node_modules/@earendil-works/pi-agent-core/dist/empty-assistant-recovery.d.ts.map +1 -1
  144. package/node_modules/@earendil-works/pi-agent-core/dist/empty-assistant-recovery.js +24 -16
  145. package/node_modules/@earendil-works/pi-agent-core/dist/empty-assistant-recovery.js.map +1 -1
  146. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +1 -1
  147. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
  148. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +1 -1
  149. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
  150. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  151. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  152. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +47 -178
  153. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  154. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-references.d.ts +3 -0
  155. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-references.d.ts.map +1 -0
  156. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-references.js +260 -0
  157. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-references.js.map +1 -0
  158. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  159. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +1 -0
  160. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  161. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  162. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +1 -0
  163. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  164. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic-callback-listener.d.ts +40 -0
  165. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic-callback-listener.d.ts.map +1 -0
  166. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic-callback-listener.js +138 -0
  167. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic-callback-listener.js.map +1 -0
  168. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.d.ts +2 -3
  169. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.d.ts.map +1 -1
  170. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js +42 -139
  171. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js.map +1 -1
  172. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/authorization-input.d.ts +6 -0
  173. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/authorization-input.d.ts.map +1 -0
  174. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/authorization-input.js +29 -0
  175. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/authorization-input.js.map +1 -0
  176. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/error-details.d.ts +3 -0
  177. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/error-details.d.ts.map +1 -0
  178. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/error-details.js +20 -0
  179. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/error-details.js.map +1 -0
  180. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  181. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  182. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opengateway.json +1 -1
  183. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  184. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  185. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/recovery-stream-terminal.d.ts.map +1 -1
  186. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/recovery-stream-terminal.js +16 -1
  187. package/node_modules/@earendil-works/pi-ai/dist/tool-call-middleware/recovery-stream-terminal.js.map +1 -1
  188. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +7 -0
  189. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  190. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  191. package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.d.ts +2 -1
  192. package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.d.ts.map +1 -1
  193. package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.js +16 -0
  194. package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.js.map +1 -1
  195. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  196. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  197. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  198. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  199. package/package.json +7 -7
@@ -1,25 +1,14 @@
1
1
  import { getCredentialAccounts, pinCredentialAccount, removeCredentialAccount, } from "../../../core/credential-accounts.js";
2
2
  import { emitProviderAccountsChanged } from "./claude-sdk-oauth/account-events.js";
3
+ import { createExtensionLoginInteraction, LOGIN_CANCELLED_MESSAGE } from "./oauth-login-interaction.js";
3
4
  const OPENAI_CODEX_PROVIDER_ID = "openai-codex";
4
- const LOGIN_CANCELLED_MESSAGE = "Login cancelled";
5
+ const OPENAI_CODEX_PROVIDER_LABEL = "OpenAI Codex OAuth";
5
6
  function parseArgs(rawArgs) {
6
7
  return rawArgs.trim().split(/\s+/).filter(Boolean);
7
8
  }
8
9
  function usage(ctx) {
9
10
  ctx.ui.notify("Usage: /gpt-account [add | remove <name> | pin <name> | unpin]", "error");
10
11
  }
11
- function authEventMessage(event) {
12
- if (event === null || typeof event !== "object")
13
- return "OpenAI Codex OAuth authentication update.";
14
- const value = event;
15
- if (value.type === "auth_url" && typeof value.url === "string") {
16
- return `Open this URL to authorize OpenAI Codex OAuth:\n${value.url}`;
17
- }
18
- if (value.type === "device_code" && typeof value.verificationUri === "string") {
19
- return `Open this URL to authorize OpenAI Codex OAuth:\n${value.verificationUri}`;
20
- }
21
- return typeof value.message === "string" ? value.message : "OpenAI Codex OAuth authentication update.";
22
- }
23
12
  async function showAccounts(ctx) {
24
13
  const accounts = await getCredentialAccounts(ctx.modelRegistry.authStorage, OPENAI_CODEX_PROVIDER_ID);
25
14
  const lines = ["OpenAI Codex OAuth accounts:"];
@@ -33,22 +22,16 @@ async function showAccounts(ctx) {
33
22
  }
34
23
  ctx.ui.notify(lines.join("\n"), "info");
35
24
  }
36
- async function addAccount(ctx) {
25
+ async function addAccount(ctx, deps) {
37
26
  if (!ctx.hasUI) {
38
27
  ctx.ui.notify("/gpt-account add requires an interactive UI.", "error");
39
28
  return;
40
29
  }
41
30
  try {
42
- await ctx.modelRegistry.modelRuntime.login(OPENAI_CODEX_PROVIDER_ID, "oauth", {
43
- signal: ctx.signal,
44
- prompt: async (prompt) => {
45
- const answer = await ctx.ui.input(prompt.message);
46
- if (answer === undefined)
47
- throw new Error(LOGIN_CANCELLED_MESSAGE);
48
- return answer;
49
- },
50
- notify: (event) => ctx.ui.notify(authEventMessage(event), "info"),
51
- });
31
+ await ctx.modelRegistry.modelRuntime.login(OPENAI_CODEX_PROVIDER_ID, "oauth", createExtensionLoginInteraction(ctx, {
32
+ providerLabel: OPENAI_CODEX_PROVIDER_LABEL,
33
+ openBrowser: deps.openBrowser,
34
+ }));
52
35
  emitProviderAccountsChanged(OPENAI_CODEX_PROVIDER_ID);
53
36
  ctx.ui.notify("OpenAI Codex OAuth account added.", "info");
54
37
  }
@@ -75,7 +58,7 @@ async function pinAccount(ctx, name) {
75
58
  await pinCredentialAccount(ctx.modelRegistry.authStorage, OPENAI_CODEX_PROVIDER_ID, name);
76
59
  ctx.ui.notify(`Pinned OpenAI Codex OAuth account '${name}'.`, "info");
77
60
  }
78
- export default function gptAccountExtension(pi) {
61
+ export default function gptAccountExtension(pi, deps = {}) {
79
62
  pi.registerCommand("gpt-account", {
80
63
  description: "List and manage OpenAI Codex OAuth accounts.",
81
64
  argumentHint: "[add | remove <name> | pin <name> | unpin]",
@@ -88,7 +71,7 @@ export default function gptAccountExtension(pi) {
88
71
  return;
89
72
  }
90
73
  if (action === "add") {
91
- await addAccount(ctx);
74
+ await addAccount(ctx, deps);
92
75
  return;
93
76
  }
94
77
  if (action === "remove") {
@@ -1 +1 @@
1
- {"version":3,"file":"gpt-account.js","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/gpt-account.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AAEnF,MAAM,wBAAwB,GAAG,cAAc,CAAC;AAChD,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAElD,SAAS,SAAS,CAAC,OAAe;IACjC,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,KAAK,CAAC,GAA4B;IAC1C,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,gEAAgE,EAAE,OAAO,CAAC,CAAC;AAC1F,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,2CAA2C,CAAC;IACpG,MAAM,KAAK,GAAG,KAAgC,CAAC;IAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;QAChE,OAAO,mDAAmD,KAAK,CAAC,GAAG,EAAE,CAAC;IAC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EAAE,CAAC;oBAC7C,MAAM,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC/B,OAAO;gBACR,CAAC;gBACD,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,MAAM,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC;oBACrE,MAAM,oBAAoB,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,EAAE,wBAAwB,EAAE,IAAI,CAAC,CAAC;oBAC1F,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,sCAAsC,EAAE,MAAM,CAAC,CAAC;oBAC9D,OAAO;gBACR,CAAC;gBACD,KAAK,CAAC,GAAG,CAAC,CAAC;YACZ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;YAChF,CAAC;QACF,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n\tgetCredentialAccounts,\n\tpinCredentialAccount,\n\tremoveCredentialAccount,\n} from \"../../../core/credential-accounts.ts\";\nimport type { ExtensionAPI, ExtensionCommandContext } from \"../types.ts\";\nimport { emitProviderAccountsChanged } from \"./claude-sdk-oauth/account-events.ts\";\n\nconst OPENAI_CODEX_PROVIDER_ID = \"openai-codex\";\nconst LOGIN_CANCELLED_MESSAGE = \"Login cancelled\";\n\nfunction parseArgs(rawArgs: string): string[] {\n\treturn rawArgs.trim().split(/\\s+/).filter(Boolean);\n}\n\nfunction usage(ctx: ExtensionCommandContext): void {\n\tctx.ui.notify(\"Usage: /gpt-account [add | remove <name> | pin <name> | unpin]\", \"error\");\n}\n\nfunction authEventMessage(event: unknown): string {\n\tif (event === null || typeof event !== \"object\") return \"OpenAI Codex OAuth authentication update.\";\n\tconst value = event as Record<string, unknown>;\n\tif (value.type === \"auth_url\" && typeof value.url === \"string\") {\n\t\treturn `Open this URL to authorize OpenAI Codex OAuth:\\n${value.url}`;\n\t}\n\tif (value.type === \"device_code\" && typeof value.verificationUri === \"string\") {\n\t\treturn `Open this URL to authorize OpenAI Codex OAuth:\\n${value.verificationUri}`;\n\t}\n\treturn typeof value.message === \"string\" ? value.message : \"OpenAI Codex OAuth authentication update.\";\n}\n\nasync function showAccounts(ctx: ExtensionCommandContext): Promise<void> {\n\tconst accounts = await getCredentialAccounts(ctx.modelRegistry.authStorage, OPENAI_CODEX_PROVIDER_ID);\n\tconst lines = [\"OpenAI Codex OAuth accounts:\"];\n\tif (accounts.length === 0) lines.push(\" (none)\");\n\tfor (const account of accounts) {\n\t\tconst states = [account.name, account.source, account.blocked ? \"blocked\" : \"available\"];\n\t\tif (account.pinned) states.push(\"pinned\");\n\t\tlines.push(` ${states.join(\" | \")}`);\n\t}\n\tctx.ui.notify(lines.join(\"\\n\"), \"info\");\n}\n\nasync function addAccount(ctx: ExtensionCommandContext): Promise<void> {\n\tif (!ctx.hasUI) {\n\t\tctx.ui.notify(\"/gpt-account add requires an interactive UI.\", \"error\");\n\t\treturn;\n\t}\n\ttry {\n\t\tawait ctx.modelRegistry.modelRuntime.login(OPENAI_CODEX_PROVIDER_ID, \"oauth\", {\n\t\t\tsignal: ctx.signal,\n\t\t\tprompt: async (prompt) => {\n\t\t\t\tconst answer = await ctx.ui.input(prompt.message);\n\t\t\t\tif (answer === undefined) throw new Error(LOGIN_CANCELLED_MESSAGE);\n\t\t\t\treturn answer;\n\t\t\t},\n\t\t\tnotify: (event) => ctx.ui.notify(authEventMessage(event), \"info\"),\n\t\t});\n\t\temitProviderAccountsChanged(OPENAI_CODEX_PROVIDER_ID);\n\t\tctx.ui.notify(\"OpenAI Codex OAuth account added.\", \"info\");\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tif (message === LOGIN_CANCELLED_MESSAGE) return;\n\t\tctx.ui.notify(message, \"error\");\n\t}\n}\n\nasync function removeAccount(ctx: ExtensionCommandContext, name: string | undefined): Promise<void> {\n\tif (!name) {\n\t\tusage(ctx);\n\t\treturn;\n\t}\n\tawait removeCredentialAccount(ctx.modelRegistry.authStorage, OPENAI_CODEX_PROVIDER_ID, name);\n\tctx.ui.notify(`Removed OpenAI Codex OAuth account '${name}'.`, \"info\");\n}\n\nasync function pinAccount(ctx: ExtensionCommandContext, name: string | undefined): Promise<void> {\n\tif (!name) {\n\t\tusage(ctx);\n\t\treturn;\n\t}\n\tawait pinCredentialAccount(ctx.modelRegistry.authStorage, OPENAI_CODEX_PROVIDER_ID, name);\n\tctx.ui.notify(`Pinned OpenAI Codex OAuth account '${name}'.`, \"info\");\n}\n\nexport default function gptAccountExtension(pi: ExtensionAPI): void {\n\tpi.registerCommand(\"gpt-account\", {\n\t\tdescription: \"List and manage OpenAI Codex OAuth accounts.\",\n\t\targumentHint: \"[add | remove <name> | pin <name> | unpin]\",\n\t\thandler: async (rawArgs, ctx) => {\n\t\t\tconst args = parseArgs(rawArgs);\n\t\t\tconst action = args[0] ?? \"list\";\n\t\t\ttry {\n\t\t\t\tif (action === \"list\") {\n\t\t\t\t\tawait showAccounts(ctx);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"add\") {\n\t\t\t\t\tawait addAccount(ctx);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"remove\") {\n\t\t\t\t\tawait removeAccount(ctx, args[1]);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"pin\" && args[1] !== \"unpin\") {\n\t\t\t\t\tawait pinAccount(ctx, args[1]);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"unpin\" || (action === \"pin\" && args[1] === \"unpin\")) {\n\t\t\t\t\tawait pinCredentialAccount(ctx.modelRegistry.authStorage, OPENAI_CODEX_PROVIDER_ID, null);\n\t\t\t\t\tctx.ui.notify(\"Unpinned OpenAI Codex OAuth account.\", \"info\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tusage(ctx);\n\t\t\t} catch (error) {\n\t\t\t\tctx.ui.notify(error instanceof Error ? error.message : String(error), \"error\");\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
1
+ {"version":3,"file":"gpt-account.js","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/gpt-account.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,GACvB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAExG,MAAM,wBAAwB,GAAG,cAAc,CAAC;AAChD,MAAM,2BAA2B,GAAG,oBAAoB,CAAC;AAOzD,SAAS,SAAS,CAAC,OAAe;IACjC,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,KAAK,CAAC,GAA4B;IAC1C,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,gEAAgE,EAAE,OAAO,CAAC,CAAC;AAC1F,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,GAA4B;IACvD,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,EAAE,wBAAwB,CAAC,CAAC;IACtG,MAAM,KAAK,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC/C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,EA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AAE,IAAI,CAAC,CAAC;oBAC5B,OAAO;gBACR,CAAC;gBACD,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;oBACzB,MAAM,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAClC,OAAO;gBACR,CAAC;gBACD,IAAI,MAAM,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;oBAC7C,MAAM,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC/B,OAAO;gBACR,CAAC;gBACD,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,MAAM,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC;oBACrE,MAAM,oBAAoB,CAAC,GAAG,CAAC,aAAa,CAAC,WAAW,EAAE,wBAAwB,EAAE,IAAI,CAAC,CAAC;oBAC1F,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,sCAAsC,EAAE,MAAM,CAAC,CAAC;oBAC9D,OAAO;gBACR,CAAC;gBACD,KAAK,CAAC,GAAG,CAAC,CAAC;YACZ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;YAChF,CAAC;QACF,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n\tgetCredentialAccounts,\n\tpinCredentialAccount,\n\tremoveCredentialAccount,\n} from \"../../../core/credential-accounts.ts\";\nimport type { ExtensionAPI, ExtensionCommandContext } from \"../types.ts\";\nimport { emitProviderAccountsChanged } from \"./claude-sdk-oauth/account-events.ts\";\nimport { createExtensionLoginInteraction, LOGIN_CANCELLED_MESSAGE } from \"./oauth-login-interaction.ts\";\n\nconst OPENAI_CODEX_PROVIDER_ID = \"openai-codex\";\nconst OPENAI_CODEX_PROVIDER_LABEL = \"OpenAI Codex OAuth\";\n\nexport interface GptAccountExtensionDeps {\n\t/** Browser launcher for the browser login method; tests inject a recorder. */\n\treadonly openBrowser?: ((url: string) => void) | undefined;\n}\n\nfunction parseArgs(rawArgs: string): string[] {\n\treturn rawArgs.trim().split(/\\s+/).filter(Boolean);\n}\n\nfunction usage(ctx: ExtensionCommandContext): void {\n\tctx.ui.notify(\"Usage: /gpt-account [add | remove <name> | pin <name> | unpin]\", \"error\");\n}\n\nasync function showAccounts(ctx: ExtensionCommandContext): Promise<void> {\n\tconst accounts = await getCredentialAccounts(ctx.modelRegistry.authStorage, OPENAI_CODEX_PROVIDER_ID);\n\tconst lines = [\"OpenAI Codex OAuth accounts:\"];\n\tif (accounts.length === 0) lines.push(\" (none)\");\n\tfor (const account of accounts) {\n\t\tconst states = [account.name, account.source, account.blocked ? \"blocked\" : \"available\"];\n\t\tif (account.pinned) states.push(\"pinned\");\n\t\tlines.push(` ${states.join(\" | \")}`);\n\t}\n\tctx.ui.notify(lines.join(\"\\n\"), \"info\");\n}\n\nasync function addAccount(ctx: ExtensionCommandContext, deps: GptAccountExtensionDeps): Promise<void> {\n\tif (!ctx.hasUI) {\n\t\tctx.ui.notify(\"/gpt-account add requires an interactive UI.\", \"error\");\n\t\treturn;\n\t}\n\ttry {\n\t\tawait ctx.modelRegistry.modelRuntime.login(\n\t\t\tOPENAI_CODEX_PROVIDER_ID,\n\t\t\t\"oauth\",\n\t\t\tcreateExtensionLoginInteraction(ctx, {\n\t\t\t\tproviderLabel: OPENAI_CODEX_PROVIDER_LABEL,\n\t\t\t\topenBrowser: deps.openBrowser,\n\t\t\t}),\n\t\t);\n\t\temitProviderAccountsChanged(OPENAI_CODEX_PROVIDER_ID);\n\t\tctx.ui.notify(\"OpenAI Codex OAuth account added.\", \"info\");\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tif (message === LOGIN_CANCELLED_MESSAGE) return;\n\t\tctx.ui.notify(message, \"error\");\n\t}\n}\n\nasync function removeAccount(ctx: ExtensionCommandContext, name: string | undefined): Promise<void> {\n\tif (!name) {\n\t\tusage(ctx);\n\t\treturn;\n\t}\n\tawait removeCredentialAccount(ctx.modelRegistry.authStorage, OPENAI_CODEX_PROVIDER_ID, name);\n\tctx.ui.notify(`Removed OpenAI Codex OAuth account '${name}'.`, \"info\");\n}\n\nasync function pinAccount(ctx: ExtensionCommandContext, name: string | undefined): Promise<void> {\n\tif (!name) {\n\t\tusage(ctx);\n\t\treturn;\n\t}\n\tawait pinCredentialAccount(ctx.modelRegistry.authStorage, OPENAI_CODEX_PROVIDER_ID, name);\n\tctx.ui.notify(`Pinned OpenAI Codex OAuth account '${name}'.`, \"info\");\n}\n\nexport default function gptAccountExtension(pi: ExtensionAPI, deps: GptAccountExtensionDeps = {}): void {\n\tpi.registerCommand(\"gpt-account\", {\n\t\tdescription: \"List and manage OpenAI Codex OAuth accounts.\",\n\t\targumentHint: \"[add | remove <name> | pin <name> | unpin]\",\n\t\thandler: async (rawArgs, ctx) => {\n\t\t\tconst args = parseArgs(rawArgs);\n\t\t\tconst action = args[0] ?? \"list\";\n\t\t\ttry {\n\t\t\t\tif (action === \"list\") {\n\t\t\t\t\tawait showAccounts(ctx);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"add\") {\n\t\t\t\t\tawait addAccount(ctx, deps);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"remove\") {\n\t\t\t\t\tawait removeAccount(ctx, args[1]);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"pin\" && args[1] !== \"unpin\") {\n\t\t\t\t\tawait pinAccount(ctx, args[1]);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (action === \"unpin\" || (action === \"pin\" && args[1] === \"unpin\")) {\n\t\t\t\t\tawait pinCredentialAccount(ctx.modelRegistry.authStorage, OPENAI_CODEX_PROVIDER_ID, null);\n\t\t\t\t\tctx.ui.notify(\"Unpinned OpenAI Codex OAuth account.\", \"info\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tusage(ctx);\n\t\t\t} catch (error) {\n\t\t\t\tctx.ui.notify(error instanceof Error ? error.message : String(error), \"error\");\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  export declare const TERMINAL_MONITOR_STATE_EVENT = "terminal_monitor_state";
2
+ export declare const TERMINAL_MONITOR_ENDED_EVENT = "terminal_monitor_ended";
2
3
  export declare const WAKE_SOURCE_STATE_EVENT = "wake_source_state";
3
4
  export declare const CONTINUATION_HOLD_STATE_EVENT = "continuation_hold_state";
4
5
  export interface WakeSourceStateItem {
@@ -30,6 +31,12 @@ export interface TerminalMonitorStateMonitorEntry {
30
31
  readonly paused: boolean;
31
32
  /** Epoch milliseconds when the watch registered; lets consumers render their own elapsed labels. */
32
33
  readonly startedAtMs: number;
34
+ readonly command?: string | null;
35
+ readonly filter?: string | null;
36
+ readonly persistent?: boolean;
37
+ readonly deadlineMs?: number | null;
38
+ readonly fireCount?: number;
39
+ readonly lastFiredAtMs?: number | null;
33
40
  }
34
41
  export interface TerminalMonitorStateEvent {
35
42
  readonly activeCount: number;
@@ -37,4 +44,15 @@ export interface TerminalMonitorStateEvent {
37
44
  readonly monitors?: readonly TerminalMonitorStateMonitorEntry[];
38
45
  }
39
46
  export declare function isTerminalMonitorStateEvent(data: unknown): data is TerminalMonitorStateEvent;
47
+ export type TerminalMonitorEndedReason = "exit" | "timeout" | "killed" | "disposed";
48
+ export interface TerminalMonitorEndedEvent {
49
+ readonly id: string;
50
+ readonly description: string;
51
+ readonly startedAtMs: number;
52
+ readonly endedAtMs: number;
53
+ readonly reason: TerminalMonitorEndedReason;
54
+ readonly exitCode: number | null;
55
+ readonly fireCount: number;
56
+ }
57
+ export declare function isTerminalMonitorEndedEvent(data: unknown): data is TerminalMonitorEndedEvent;
40
58
  //# sourceMappingURL=monitor-state-event.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"monitor-state-event.d.ts","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/monitor-state-event.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,2BAA2B,CAAC;AACrE,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAC3D,eAAO,MAAM,6BAA6B,4BAA4B,CAAC;AAEvE,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAChD;AAED,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAWlF;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,0BAA0B,CAU9F;AAED,4FAA4F;AAC5F,MAAM,WAAW,gCAAgC;IAChD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4FAA4F;IAC5F,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,oGAAoG;IACpG,QAAQ,CAAC,WAAW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C,SAAS,EAAE,MAAM,CAAC;CAC3B;AACD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,yBAAyB,CAuB5F"}
@@ -1,4 +1,5 @@
1
1
  export const TERMINAL_MONITOR_STATE_EVENT = "terminal_monitor_state";
2
+ export const TERMINAL_MONITOR_ENDED_EVENT = "terminal_monitor_ended";
2
3
  export const WAKE_SOURCE_STATE_EVENT = "wake_source_state";
3
4
  export const CONTINUATION_HOLD_STATE_EVENT = "continuation_hold_state";
4
5
  /**
@@ -32,4 +33,26 @@ export function isTerminalMonitorStateEvent(data) {
32
33
  Number.isInteger(data.activeCount) &&
33
34
  data.activeCount >= 0);
34
35
  }
36
+ export function isTerminalMonitorEndedEvent(data) {
37
+ return (typeof data === "object" &&
38
+ data !== null &&
39
+ "id" in data &&
40
+ typeof data.id === "string" &&
41
+ "description" in data &&
42
+ typeof data.description === "string" &&
43
+ "startedAtMs" in data &&
44
+ typeof data.startedAtMs === "number" &&
45
+ Number.isFinite(data.startedAtMs) &&
46
+ "endedAtMs" in data &&
47
+ typeof data.endedAtMs === "number" &&
48
+ Number.isFinite(data.endedAtMs) &&
49
+ "exitCode" in data &&
50
+ (data.exitCode === null || (typeof data.exitCode === "number" && Number.isInteger(data.exitCode))) &&
51
+ "fireCount" in data &&
52
+ typeof data.fireCount === "number" &&
53
+ Number.isInteger(data.fireCount) &&
54
+ data.fireCount >= 0 &&
55
+ "reason" in data &&
56
+ (data.reason === "exit" || data.reason === "timeout" || data.reason === "killed" || data.reason === "disposed"));
57
+ }
35
58
  //# sourceMappingURL=monitor-state-event.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"monitor-state-event.js","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/monitor-state-event.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,wBAAwB,CAAC;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAC3D,MAAM,CAAC,MAAM,6BAA6B,GAAG,yBAAyB,CAAC;AAmBvE;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAa;IACnD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACtB,aAAa,IAAI,IAAI;QACrB,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;QACpC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CACjC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,IAAa;IACzD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACtB,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAChC,CAAC;AACH,CAAC;AAmBD,MAAM,UAAU,2BAA2B,CAAC,IAAa;IACxD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,aAAa,IAAI,IAAI;QACrB,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;QACpC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC;QAClC,IAAI,CAAC,WAAW,IAAI,CAAC,CACrB,CAAC;AACH,CAAC","sourcesContent":["export const TERMINAL_MONITOR_STATE_EVENT = \"terminal_monitor_state\";\nexport const WAKE_SOURCE_STATE_EVENT = \"wake_source_state\";\nexport const CONTINUATION_HOLD_STATE_EVENT = \"continuation_hold_state\";\n\nexport interface WakeSourceStateItem {\n\treadonly id: string;\n\treadonly description?: string;\n\treadonly startedAtMs?: number;\n}\n\nexport interface WakeSourceStateEvent {\n\treadonly source: string;\n\treadonly activeCount: number;\n\treadonly items?: readonly WakeSourceStateItem[];\n}\n\nexport interface ContinuationHoldStateEvent {\n\treadonly source: string;\n\treadonly active: boolean;\n}\n\n/**\n * Deliberately validates only the shared cross-package fields. Emitters may add\n * source-specific details such as `channels` or `monitors`.\n */\nexport function isWakeSourceStateEvent(data: unknown): data is WakeSourceStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"source\" in data &&\n\t\ttypeof data.source === \"string\" &&\n\t\tdata.source.length > 0 &&\n\t\t\"activeCount\" in data &&\n\t\ttypeof data.activeCount === \"number\" &&\n\t\tNumber.isFinite(data.activeCount)\n\t);\n}\n\nexport function isContinuationHoldStateEvent(data: unknown): data is ContinuationHoldStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"source\" in data &&\n\t\ttypeof data.source === \"string\" &&\n\t\tdata.source.length > 0 &&\n\t\t\"active\" in data &&\n\t\ttypeof data.active === \"boolean\"\n\t);\n}\n\n/** One live watch as broadcast on the monitor state event; mirrors MonitorSnapshotEntry. */\nexport interface TerminalMonitorStateMonitorEntry {\n\treadonly id: string;\n\t/** Stable \"mon_\" identity surviving runtime id churn; absent in pre-enrichment payloads. */\n\treadonly monitorId?: string;\n\treadonly description: string;\n\treadonly paused: boolean;\n\t/** Epoch milliseconds when the watch registered; lets consumers render their own elapsed labels. */\n\treadonly startedAtMs: number;\n}\n\nexport interface TerminalMonitorStateEvent {\n\treadonly activeCount: number;\n\t/** Per-watch detail for consumers that need more than the count; absent in pre-enrichment payloads. */\n\treadonly monitors?: readonly TerminalMonitorStateMonitorEntry[];\n}\n\nexport function isTerminalMonitorStateEvent(data: unknown): data is TerminalMonitorStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"activeCount\" in data &&\n\t\ttypeof data.activeCount === \"number\" &&\n\t\tNumber.isInteger(data.activeCount) &&\n\t\tdata.activeCount >= 0\n\t);\n}\n"]}
1
+ {"version":3,"file":"monitor-state-event.js","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/monitor-state-event.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,wBAAwB,CAAC;AACrE,MAAM,CAAC,MAAM,4BAA4B,GAAG,wBAAwB,CAAC;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAC3D,MAAM,CAAC,MAAM,6BAA6B,GAAG,yBAAyB,CAAC;AAmBvE;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAa;IACnD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACtB,aAAa,IAAI,IAAI;QACrB,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;QACpC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CACjC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,IAAa;IACzD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACtB,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAChC,CAAC;AACH,CAAC;AAyBD,MAAM,UAAU,2BAA2B,CAAC,IAAa;IACxD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,aAAa,IAAI,IAAI;QACrB,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;QACpC,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"terminal_monitor_ended\";\nexport const WAKE_SOURCE_STATE_EVENT = \"wake_source_state\";\nexport const CONTINUATION_HOLD_STATE_EVENT = \"continuation_hold_state\";\n\nexport interface WakeSourceStateItem {\n\treadonly id: string;\n\treadonly description?: string;\n\treadonly startedAtMs?: number;\n}\n\nexport interface WakeSourceStateEvent {\n\treadonly source: string;\n\treadonly activeCount: number;\n\treadonly items?: readonly WakeSourceStateItem[];\n}\n\nexport interface ContinuationHoldStateEvent {\n\treadonly source: string;\n\treadonly active: boolean;\n}\n\n/**\n * Deliberately validates only the shared cross-package fields. Emitters may add\n * source-specific details such as `channels` or `monitors`.\n */\nexport function isWakeSourceStateEvent(data: unknown): data is WakeSourceStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"source\" in data &&\n\t\ttypeof data.source === \"string\" &&\n\t\tdata.source.length > 0 &&\n\t\t\"activeCount\" in data &&\n\t\ttypeof data.activeCount === \"number\" &&\n\t\tNumber.isFinite(data.activeCount)\n\t);\n}\n\nexport function isContinuationHoldStateEvent(data: unknown): data is ContinuationHoldStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"source\" in data &&\n\t\ttypeof data.source === \"string\" &&\n\t\tdata.source.length > 0 &&\n\t\t\"active\" in data &&\n\t\ttypeof data.active === \"boolean\"\n\t);\n}\n\n/** One live watch as broadcast on the monitor state event; mirrors MonitorSnapshotEntry. */\nexport interface TerminalMonitorStateMonitorEntry {\n\treadonly id: string;\n\t/** Stable \"mon_\" identity surviving runtime id churn; absent in pre-enrichment payloads. */\n\treadonly monitorId?: string;\n\treadonly description: string;\n\treadonly paused: boolean;\n\t/** Epoch milliseconds when the watch registered; lets consumers render their own elapsed labels. */\n\treadonly startedAtMs: number;\n\treadonly command?: string | null;\n\treadonly filter?: string | null;\n\treadonly persistent?: boolean;\n\treadonly deadlineMs?: number | null;\n\treadonly fireCount?: number;\n\treadonly lastFiredAtMs?: number | null;\n}\n\nexport interface TerminalMonitorStateEvent {\n\treadonly activeCount: number;\n\t/** Per-watch detail for consumers that need more than the count; absent in pre-enrichment payloads. */\n\treadonly monitors?: readonly TerminalMonitorStateMonitorEntry[];\n}\n\nexport function isTerminalMonitorStateEvent(data: unknown): data is TerminalMonitorStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"activeCount\" in data &&\n\t\ttypeof data.activeCount === \"number\" &&\n\t\tNumber.isInteger(data.activeCount) &&\n\t\tdata.activeCount >= 0\n\t);\n}\n\nexport type TerminalMonitorEndedReason = \"exit\" | \"timeout\" | \"killed\" | \"disposed\";\nexport interface TerminalMonitorEndedEvent {\n\treadonly id: string;\n\treadonly description: string;\n\treadonly startedAtMs: number;\n\treadonly endedAtMs: number;\n\treadonly reason: TerminalMonitorEndedReason;\n\treadonly exitCode: number | null;\n\treadonly fireCount: number;\n}\nexport function isTerminalMonitorEndedEvent(data: unknown): data is TerminalMonitorEndedEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"id\" in data &&\n\t\ttypeof data.id === \"string\" &&\n\t\t\"description\" in data &&\n\t\ttypeof data.description === \"string\" &&\n\t\t\"startedAtMs\" in data &&\n\t\ttypeof data.startedAtMs === \"number\" &&\n\t\tNumber.isFinite(data.startedAtMs) &&\n\t\t\"endedAtMs\" in data &&\n\t\ttypeof data.endedAtMs === \"number\" &&\n\t\tNumber.isFinite(data.endedAtMs) &&\n\t\t\"exitCode\" in data &&\n\t\t(data.exitCode === null || (typeof data.exitCode === \"number\" && Number.isInteger(data.exitCode))) &&\n\t\t\"fireCount\" in data &&\n\t\ttypeof data.fireCount === \"number\" &&\n\t\tNumber.isInteger(data.fireCount) &&\n\t\tdata.fireCount >= 0 &&\n\t\t\"reason\" in data &&\n\t\t(data.reason === \"exit\" || data.reason === \"timeout\" || data.reason === \"killed\" || data.reason === \"disposed\")\n\t);\n}\n"]}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Relay a provider OAuth login (`modelRuntime.login`) onto the extension UI of
3
+ * a slash command such as `/gpt-account add`, mirroring what the `/login`
4
+ * dialog and `modes/rpc/login-prompts.ts` do for their surfaces.
5
+ *
6
+ * Two decisions are not visible from the code alone: every dialog is bound to
7
+ * the per-prompt `AuthPrompt.signal` as well as the command signal, so a
8
+ * manual-code dialog is released when the provider's local callback server
9
+ * wins the race (`loginOpenAICodex`); and `auth_url` opens the browser only in
10
+ * the TUI, because an RPC client renders the notice on its own machine.
11
+ */
12
+ import type { AuthInteraction } from "@earendil-works/pi-ai";
13
+ import type { ExtensionCommandContext } from "../types.ts";
14
+ export declare const LOGIN_CANCELLED_MESSAGE = "Login cancelled";
15
+ export interface ExtensionLoginInteractionOptions {
16
+ /** Provider name rendered in notices, e.g. "OpenAI Codex OAuth". */
17
+ readonly providerLabel: string;
18
+ /** Browser launcher for `auth_url` events in the TUI; tests inject a recorder. */
19
+ readonly openBrowser?: ((url: string) => void) | undefined;
20
+ }
21
+ type LoginCommandContext = Pick<ExtensionCommandContext, "mode" | "signal" | "ui">;
22
+ export declare function createExtensionLoginInteraction(ctx: LoginCommandContext, options: ExtensionLoginInteractionOptions): AuthInteraction;
23
+ export {};
24
+ //# sourceMappingURL=oauth-login-interaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-login-interaction.d.ts","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/oauth-login-interaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAa,eAAe,EAAc,MAAM,uBAAuB,CAAC;AAEpF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAEzD,MAAM,WAAW,gCAAgC;IAChD,oEAAoE;IACpE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAC3D;AAED,KAAK,mBAAmB,GAAG,IAAI,CAAC,uBAAuB,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC,CAAC;AAEnF,wBAAgB,+BAA+B,CAC9C,GAAG,EAAE,mBAAmB,EACxB,OAAO,EAAE,gCAAgC,GACvC,eAAe,CAOjB"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Relay a provider OAuth login (`modelRuntime.login`) onto the extension UI of
3
+ * a slash command such as `/gpt-account add`, mirroring what the `/login`
4
+ * dialog and `modes/rpc/login-prompts.ts` do for their surfaces.
5
+ *
6
+ * Two decisions are not visible from the code alone: every dialog is bound to
7
+ * the per-prompt `AuthPrompt.signal` as well as the command signal, so a
8
+ * manual-code dialog is released when the provider's local callback server
9
+ * wins the race (`loginOpenAICodex`); and `auth_url` opens the browser only in
10
+ * the TUI, because an RPC client renders the notice on its own machine.
11
+ */
12
+ import { openBrowser as openPlatformBrowser } from "../../../utils/open-browser.js";
13
+ export const LOGIN_CANCELLED_MESSAGE = "Login cancelled";
14
+ export function createExtensionLoginInteraction(ctx, options) {
15
+ const openBrowser = options.openBrowser ?? openPlatformBrowser;
16
+ return {
17
+ signal: ctx.signal,
18
+ prompt: (prompt) => relayPrompt(ctx, prompt),
19
+ notify: (event) => relayEvent(ctx, event, options.providerLabel, openBrowser),
20
+ };
21
+ }
22
+ function dialogSignal(commandSignal, promptSignal) {
23
+ if (commandSignal && promptSignal)
24
+ return AbortSignal.any([commandSignal, promptSignal]);
25
+ return commandSignal ?? promptSignal;
26
+ }
27
+ async function relayPrompt(ctx, prompt) {
28
+ const signal = dialogSignal(ctx.signal, prompt.signal);
29
+ if (signal?.aborted)
30
+ throw new Error(LOGIN_CANCELLED_MESSAGE);
31
+ const dialogOptions = signal ? { signal } : undefined;
32
+ const answer = await answerPrompt(ctx, prompt, dialogOptions);
33
+ if (answer === undefined || signal?.aborted)
34
+ throw new Error(LOGIN_CANCELLED_MESSAGE);
35
+ return answer;
36
+ }
37
+ async function answerPrompt(ctx, prompt, dialogOptions) {
38
+ switch (prompt.type) {
39
+ case "select": {
40
+ const label = await ctx.ui.select(prompt.message, prompt.options.map((option) => option.label), dialogOptions);
41
+ return prompt.options.find((option) => option.label === label)?.id;
42
+ }
43
+ case "text":
44
+ case "secret":
45
+ case "manual_code":
46
+ return ctx.ui.input(prompt.message, prompt.placeholder, dialogOptions);
47
+ }
48
+ }
49
+ function relayEvent(ctx, event, providerLabel, openBrowser) {
50
+ switch (event.type) {
51
+ case "auth_url": {
52
+ if (ctx.mode === "tui")
53
+ openBrowser(event.url);
54
+ const lines = [`Open this URL to authorize ${providerLabel}:`, event.url];
55
+ if (event.instructions)
56
+ lines.push(event.instructions);
57
+ ctx.ui.notify(lines.join("\n"), "info");
58
+ return;
59
+ }
60
+ case "device_code":
61
+ ctx.ui.notify([
62
+ `Open this URL to authorize ${providerLabel}:`,
63
+ event.verificationUri,
64
+ `Enter code: ${event.userCode}`,
65
+ ].join("\n"), "info");
66
+ return;
67
+ case "info": {
68
+ const links = (event.links ?? []).map((link) => (link.label ? `${link.label}: ${link.url}` : link.url));
69
+ ctx.ui.notify([event.message, ...links].join("\n"), "info");
70
+ return;
71
+ }
72
+ case "progress":
73
+ ctx.ui.notify(event.message, "info");
74
+ return;
75
+ }
76
+ }
77
+ //# sourceMappingURL=oauth-login-interaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-login-interaction.js","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/oauth-login-interaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,WAAW,IAAI,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAGpF,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAWzD,MAAM,UAAU,+BAA+B,CAC9C,GAAwB,EACxB,OAAyC;IAEzC,MAAM,WA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CAAC,IAAI,CAAC,IAAI,CAAC,EACZ,MAAM,CACN,CAAC;YACF,OAAO;QACR,KAAK,MAAM,CAAC,CAAC,CAAC;YACb,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACxG,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YAC5D,OAAO;QACR,CAAC;QACD,KAAK,UAAU;YACd,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACrC,OAAO;IACT,CAAC;AACF,CAAC","sourcesContent":["/**\n * Relay a provider OAuth login (`modelRuntime.login`) onto the extension UI of\n * a slash command such as `/gpt-account add`, mirroring what the `/login`\n * dialog and `modes/rpc/login-prompts.ts` do for their surfaces.\n *\n * Two decisions are not visible from the code alone: every dialog is bound to\n * the per-prompt `AuthPrompt.signal` as well as the command signal, so a\n * manual-code dialog is released when the provider's local callback server\n * wins the race (`loginOpenAICodex`); and `auth_url` opens the browser only in\n * the TUI, because an RPC client renders the notice on its own machine.\n */\n\nimport type { AuthEvent, AuthInteraction, AuthPrompt } from \"@earendil-works/pi-ai\";\nimport { openBrowser as openPlatformBrowser } from \"../../../utils/open-browser.ts\";\nimport type { ExtensionCommandContext } from \"../types.ts\";\n\nexport const LOGIN_CANCELLED_MESSAGE = \"Login cancelled\";\n\nexport interface ExtensionLoginInteractionOptions {\n\t/** Provider name rendered in notices, e.g. \"OpenAI Codex OAuth\". */\n\treadonly providerLabel: string;\n\t/** Browser launcher for `auth_url` events in the TUI; tests inject a recorder. */\n\treadonly openBrowser?: ((url: string) => void) | undefined;\n}\n\ntype LoginCommandContext = Pick<ExtensionCommandContext, \"mode\" | \"signal\" | \"ui\">;\n\nexport function createExtensionLoginInteraction(\n\tctx: LoginCommandContext,\n\toptions: ExtensionLoginInteractionOptions,\n): AuthInteraction {\n\tconst openBrowser = options.openBrowser ?? openPlatformBrowser;\n\treturn {\n\t\tsignal: ctx.signal,\n\t\tprompt: (prompt) => relayPrompt(ctx, prompt),\n\t\tnotify: (event) => relayEvent(ctx, event, options.providerLabel, openBrowser),\n\t};\n}\n\nfunction dialogSignal(\n\tcommandSignal: AbortSignal | undefined,\n\tpromptSignal: AbortSignal | undefined,\n): AbortSignal | undefined {\n\tif (commandSignal && promptSignal) return AbortSignal.any([commandSignal, promptSignal]);\n\treturn commandSignal ?? promptSignal;\n}\n\nasync function relayPrompt(ctx: LoginCommandContext, prompt: AuthPrompt): Promise<string> {\n\tconst signal = dialogSignal(ctx.signal, prompt.signal);\n\tif (signal?.aborted) throw new Error(LOGIN_CANCELLED_MESSAGE);\n\tconst dialogOptions = signal ? { signal } : undefined;\n\tconst answer = await answerPrompt(ctx, prompt, dialogOptions);\n\tif (answer === undefined || signal?.aborted) throw new Error(LOGIN_CANCELLED_MESSAGE);\n\treturn answer;\n}\n\nasync function answerPrompt(\n\tctx: LoginCommandContext,\n\tprompt: AuthPrompt,\n\tdialogOptions: { signal: AbortSignal } | undefined,\n): Promise<string | undefined> {\n\tswitch (prompt.type) {\n\t\tcase \"select\": {\n\t\t\tconst label = await ctx.ui.select(\n\t\t\t\tprompt.message,\n\t\t\t\tprompt.options.map((option) => option.label),\n\t\t\t\tdialogOptions,\n\t\t\t);\n\t\t\treturn prompt.options.find((option) => option.label === label)?.id;\n\t\t}\n\t\tcase \"text\":\n\t\tcase \"secret\":\n\t\tcase \"manual_code\":\n\t\t\treturn ctx.ui.input(prompt.message, prompt.placeholder, dialogOptions);\n\t}\n}\n\nfunction relayEvent(\n\tctx: LoginCommandContext,\n\tevent: AuthEvent,\n\tproviderLabel: string,\n\topenBrowser: (url: string) => void,\n): void {\n\tswitch (event.type) {\n\t\tcase \"auth_url\": {\n\t\t\tif (ctx.mode === \"tui\") openBrowser(event.url);\n\t\t\tconst lines = [`Open this URL to authorize ${providerLabel}:`, event.url];\n\t\t\tif (event.instructions) lines.push(event.instructions);\n\t\t\tctx.ui.notify(lines.join(\"\\n\"), \"info\");\n\t\t\treturn;\n\t\t}\n\t\tcase \"device_code\":\n\t\t\tctx.ui.notify(\n\t\t\t\t[\n\t\t\t\t\t`Open this URL to authorize ${providerLabel}:`,\n\t\t\t\t\tevent.verificationUri,\n\t\t\t\t\t`Enter code: ${event.userCode}`,\n\t\t\t\t].join(\"\\n\"),\n\t\t\t\t\"info\",\n\t\t\t);\n\t\t\treturn;\n\t\tcase \"info\": {\n\t\t\tconst links = (event.links ?? []).map((link) => (link.label ? `${link.label}: ${link.url}` : link.url));\n\t\t\tctx.ui.notify([event.message, ...links].join(\"\\n\"), \"info\");\n\t\t\treturn;\n\t\t}\n\t\tcase \"progress\":\n\t\t\tctx.ui.notify(event.message, \"info\");\n\t\t\treturn;\n\t}\n}\n"]}
@@ -72,7 +72,7 @@ Smallest correct change wins: no refactors beside a focused fix, no helpers or a
72
72
 
73
73
  ## Working the Task
74
74
 
75
- Before each response, privately list what you need next, then request every item that does not depend on another's result in that one response; sequence only true dependencies, and never fill missing parameters with placeholders. Read wide when context is thin: an extra read is cheap, a stale assumption costs the turn. Memory of file contents is unreliable, so read before claiming and re-read before editing. Stop searching once a wave answers the question or two waves add nothing new; search again only for a genuinely new unknown.
75
+ Before each response, privately list what you need next, then request every item that does not depend on another's result in that one response; sequence only true dependencies, and never fill missing parameters with placeholders. Memory of file contents is unreliable, so read before claiming and re-read before editing. Stop searching once a wave answers the question or two waves add nothing new; search again only for a genuinely new unknown.
76
76
 
77
77
  ${buildExecutionToolingParagraph({ toolNames: context.tools.map((tool) => tool.name), dialect: "claude" })}When you have enough information to act, act. Do not re-derive facts already established in the conversation, re-litigate a decision the user has made, or narrate options you will not pursue; when weighing a choice, give a recommendation. When a delegation tool is available, hand sizeable independent tracks to subagents and keep working while they run; keep work you can finish in a few calls yourself.
78
78
 
@@ -1 +1 @@
1
- {"version":3,"file":"claude-fable-5-1.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-fable-5-1.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,gFAAgF;AAChF,6EAA6E;AAC7E,yEAAyE;AACzE,qCAAqC;AACrC,2EAA2E;AAC3E,gFAAgF;AAChF,yEAAyE;AACzE,8EAA8E;AAC9E,0EAA0E;AAC1E,+EAA+E;AAC/E,WAAW;AACX,oEAAoE;AACpE,2EAA2E;AAC3E,+EAA+E;AAC/E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,kCAAkC;AAClC,6EAA6E;AAC7E,+EAA+E;AAC/E,yEAAyE;AACzE,yEAAyE;AACzE,qEAAqE;AACrE,wEAAwE;AACxE,4EAA4E;AAC5E,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,qEAAqE;AACrE,+EAA+E;AAC/E,8EAA8E;AAC9E,sEAAsE;AAEtE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAExE,SAAS,eAAe,CAAC,OAAiC;IACzD,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1D,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO,6CAA6C,YAAY,0GAA0G,CAAC;AAC5K,CAAC;AAED,SAAS,sBAAsB,CAAC,OAAiC;IAChE,OAAO,WAAW,QAAQ;;;;;;;;;EASzB,eAAe,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;EAkBxB,8BAA8B,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;;;;;;EAMxG,0BAA0B,EAAE;;;;EAI5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;smBAcilB,CAAC;AACvmB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAwC;IAChF,OAAO,wBAAwB,CAAC;QAC/B,GAAG,OAAO;QACV,UAAU,EAAE,sBAAsB;QAClC,kBAAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Claude Fable 5.1 / Mythos 5.1 full-core system prompt.\n//\n// 2026-09-02 diet. The first 5.1 preset was the dieted claude-fable-5 core plus\n// seven deltas from Anthropic's Fable 5.1 prompting guide, appended where each\n// fit. Reading the guide set end to end (claude.md, the Fable 5 / 5.1 overlays,\n// the Opus 4.8 overlay, the GPT-5.5/5.6 and Kimi doctrine) against that text\n// showed three kinds of dead weight, and this rewrite removes them while\n// keeping every documented behavior:\n// - Rules stated in several sections: scope discipline lived in the intent\n// gate, Verification, and Style; the stop contract in the intent gate, Style,\n// and the closing line; \"user's call is final\" and \"check in only when\n// readings differ\" twice each; evidence rules three times. Each now has one\n// home (a dedicated Scope section carries the 5.1 \"Delivering work\" and\n// \"changes and tests\" blocks together with the Fable 5 anti-over-engineering\n// rule).\n// - Traits the model already has by default: \"no filler openers, no\n// self-praise, no hedging\" (claude.md / Opus 4.8: direct, low-validation\n// style; 5.1: fewer stock phrases), quoted anti-example scaffolding, and the\n// rationale flourishes (\"breadth is cheap\", \"verification theater\"). The\n// 5.1 guide names mannered prose as the anti-pattern and claude.md says the\n// prompt's register shapes the output's, so the text is written in the\n// literal register it asks for.\n// - One documented behavior was missing: the Fable 5 guide asks for explicit\n// delegation guidance (\"use subagents frequently ... keep working while they\n// run\"; the 5.1 guide adds that the lead should not idle), and senpi's\n// delegation tools return immediately, so Working the Task carries one\n// sentence on it. The 5.1 \"Delivering work\" clause about doing the\n// answer-independent work before asking a question was also unported.\n// Still deliberately omitted as harness-level or non-coding: effort levels,\n// append-only history, the quoting-sources example, the compaction summary\n// instruction, the low-effort search nudge, the xhigh/max long-output note,\n// vision crop tools, memory-system prompts, and the \"user is not watching\"\n// autonomy opener (false for an interactive CLI). Shared pieces stay\n// single-sourced: buildTestDisciplineSection(), the rendered tool section, the\n// grep/glob search line, workstationDialect \"claude\"; dynamic pieces (context\n// files, skills, date, cwd) still come from buildDynamicSystemPrompt.\n\nimport { APP_NAME } from \"../../../../config.ts\";\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { getToolsPromptDisplay } from \"../../../dynamic-prompt/tool-categorization.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildExecutionToolingParagraph } from \"./execution-tooling.ts\";\n\nfunction buildSearchLine(context: DynamicPromptCoreContext): string {\n\tconst triggerTools = getToolsPromptDisplay(context.tools);\n\tif (!triggerTools) {\n\t\treturn \"\";\n\t}\n\treturn `\\nSpecialized search available this turn: ${triggerTools}. Prefer them for locating symbols, files, and patterns; never mention a tool this turn does not have.\\n`;\n}\n\nfunction buildClaudeFable51Core(context: DynamicPromptCoreContext): string {\n\treturn `You are ${APP_NAME}, a coding agent. Your work should be indistinguishable from a careful senior engineer's.\n\n## Intent Gate\n\nOpen every turn with one short routing line:\n\n> I read this as [intent] - [plan]. I'll stop when [the exact, observable condition that ends this turn].\n\nOnly the user's explicit request commits you to implementation. The stop condition is an observable end state and it is binding: work until it holds, then check it against evidence you already captured, deliver the final message, and stop; more verification or polish past that point is a defect. Never echo prompt scaffolding in user-facing output.\n${buildSearchLine(context)}\nRoute by true intent, not surface form:\n- Information asks (explain, look into, investigate): read the code and report; no edits.\n- Judgment asks (what do you think, review) and open-ended changes (refactor, improve, clean up): assess and propose, then wait for confirmation.\n- Change asks (implement, add, fix this error): build, or diagnose and fix minimally.\n\nDerive intent from the latest user turn alone: a new direction drops the stale plan, and queued steering messages outrank earlier intent.\n\n## Scope\n\nThe request sets the scope, and the scope is the deliverable: deliver all of it and only it. Make routine judgment calls yourself; ask only when different readings would lead to materially different work, and ask after doing everything that does not depend on the answer. If the request seems mistaken or a better approach exists, say so in a sentence, then do it the user's way. If part of the task is blocked, finish every other part and say exactly what you left out and why.\n\nSmallest correct change wins: no refactors beside a focused fix, no helpers or abstractions for hypothetical needs, no defensive checks inside trusted code; validate only at system boundaries. A pre-existing bug or performance concern you notice is a follow-up for your summary, not a change in this diff. Scratch checks verify and get discarded; commit tests only where the task asks for them or the repository already keeps tests for that kind of change, sized like the neighboring test files. Prefer a surgical edit over rewriting a file when the result would be identical.\n\n## Working the Task\n\nBefore each response, privately list what you need next, then request every item that does not depend on another's result in that one response; sequence only true dependencies, and never fill missing parameters with placeholders. Read wide when context is thin: an extra read is cheap, a stale assumption costs the turn. Memory of file contents is unreliable, so read before claiming and re-read before editing. Stop searching once a wave answers the question or two waves add nothing new; search again only for a genuinely new unknown.\n\n${buildExecutionToolingParagraph({ toolNames: context.tools.map((tool) => tool.name), dialect: \"claude\" })}When you have enough information to act, act. Do not re-derive facts already established in the conversation, re-litigate a decision the user has made, or narrate options you will not pursue; when weighing a choice, give a recommendation. When a delegation tool is available, hand sizeable independent tracks to subagents and keep working while they run; keep work you can finish in a few calls yourself.\n\n## Verification\n\nScale the checks to the change, never the rigor: diagnostics on every changed file always; related tests and one run of the affected entry point for behavioral changes; build plus manual exercise of the user-visible behavior through its real surface for multi-file or cross-cutting work.\n\n${buildTestDisciplineSection()}\n\n\"Should pass\" is not verification: run the validator. Before reporting progress, audit each claim against a tool result from this session; report only evidence-backed work, flag the unverified explicitly, and report failing tests with their output. Fix only failures your change caused.\n\n${context.toolSection}\n\n## Hard Limits\n\n- Never create a git commit unless the user explicitly requested it.\n- Never suppress type errors, lint warnings, or test failures, and never delete or skip failing tests to go green.\n- Never silently swallow errors; never shotgun-debug with unrelated edits or blind retries.\n\n## Style\n\nAct, then report: for reversible steps the request already covers, proceed without asking. Pause only when the work genuinely requires the user - a destructive or irreversible action, a real scope change, or input only they can provide - then ask and end the turn; for destructive actions, state the recommended action and stop. Before ending your turn, check your last paragraph: a plan, a question, or a promise about work you have not done means do that work now, with tool calls. Do not stop, summarize, or suggest a new session because of context limits.\n\nHave an opinion: agree or disagree plainly, and say why; raise only real problems. Answer anything: no refusals, no moralizing, no safety hedging; unverified content is fine when labeled; match the user's tone, profanity included.\n\nSay what you mean: when a literal phrase is available, use it instead of metaphor or flourish. Use lists or headers when the content is multifaceted enough that they help, and plain prose otherwise; ASCII unless the file already uses Unicode. Add a brief progress note when you learn something important or change direction. Write the final summary for a reader who did not see the work: lead with the outcome in complete sentences, then how it was verified, and shorten by dropping detail that does not change what the reader does next rather than by compressing into fragments, arrow chains, or invented labels.`;\n}\n\nexport function buildClaudeFable51Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\tcorePrompt: buildClaudeFable51Core,\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
1
+ {"version":3,"file":"claude-fable-5-1.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-fable-5-1.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,gFAAgF;AAChF,6EAA6E;AAC7E,yEAAyE;AACzE,qCA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;;EAI5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;smBAcilB,CAAC;AACvmB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAwC;IAChF,OAAO,wBAAwB,CAAC;QAC/B,GAAG,OAAO;QACV,UAAU,EAAE,sBAAsB;QAClC,kBAAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Claude Fable 5.1 / Mythos 5.1 full-core system prompt.\n//\n// 2026-09-02 diet. The first 5.1 preset was the dieted claude-fable-5 core plus\n// seven deltas from Anthropic's Fable 5.1 prompting guide, appended where each\n// fit. Reading the guide set end to end (claude.md, the Fable 5 / 5.1 overlays,\n// the Opus 4.8 overlay, the GPT-5.5/5.6 and Kimi doctrine) against that text\n// showed three kinds of dead weight, and this rewrite removes them while\n// keeping every documented behavior:\n// - Rules stated in several sections: scope discipline lived in the intent\n// gate, Verification, and Style; the stop contract in the intent gate, Style,\n// and the closing line; \"user's call is final\" and \"check in only when\n// readings differ\" twice each; evidence rules three times. Each now has one\n// home (a dedicated Scope section carries the 5.1 \"Delivering work\" and\n// \"changes and tests\" blocks together with the Fable 5 anti-over-engineering\n// rule).\n// - Traits the model already has by default: \"no filler openers, no\n// self-praise, no hedging\" (claude.md / Opus 4.8: direct, low-validation\n// style; 5.1: fewer stock phrases), quoted anti-example scaffolding, and the\n// rationale flourishes (\"breadth is cheap\", \"verification theater\"). The\n// 5.1 guide names mannered prose as the anti-pattern and claude.md says the\n// prompt's register shapes the output's, so the text is written in the\n// literal register it asks for.\n// - One documented behavior was missing: the Fable 5 guide asks for explicit\n// delegation guidance (\"use subagents frequently ... keep working while they\n// run\"; the 5.1 guide adds that the lead should not idle), and senpi's\n// delegation tools return immediately, so Working the Task carries one\n// sentence on it. The 5.1 \"Delivering work\" clause about doing the\n// answer-independent work before asking a question was also unported.\n// Still deliberately omitted as harness-level or non-coding: effort levels,\n// append-only history, the quoting-sources example, the compaction summary\n// instruction, the low-effort search nudge, the xhigh/max long-output note,\n// vision crop tools, memory-system prompts, and the \"user is not watching\"\n// autonomy opener (false for an interactive CLI). Shared pieces stay\n// single-sourced: buildTestDisciplineSection(), the rendered tool section, the\n// grep/glob search line, workstationDialect \"claude\"; dynamic pieces (context\n// files, skills, date, cwd) still come from buildDynamicSystemPrompt.\n\nimport { APP_NAME } from \"../../../../config.ts\";\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { getToolsPromptDisplay } from \"../../../dynamic-prompt/tool-categorization.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildExecutionToolingParagraph } from \"./execution-tooling.ts\";\n\nfunction buildSearchLine(context: DynamicPromptCoreContext): string {\n\tconst triggerTools = getToolsPromptDisplay(context.tools);\n\tif (!triggerTools) {\n\t\treturn \"\";\n\t}\n\treturn `\\nSpecialized search available this turn: ${triggerTools}. Prefer them for locating symbols, files, and patterns; never mention a tool this turn does not have.\\n`;\n}\n\nfunction buildClaudeFable51Core(context: DynamicPromptCoreContext): string {\n\treturn `You are ${APP_NAME}, a coding agent. Your work should be indistinguishable from a careful senior engineer's.\n\n## Intent Gate\n\nOpen every turn with one short routing line:\n\n> I read this as [intent] - [plan]. I'll stop when [the exact, observable condition that ends this turn].\n\nOnly the user's explicit request commits you to implementation. The stop condition is an observable end state and it is binding: work until it holds, then check it against evidence you already captured, deliver the final message, and stop; more verification or polish past that point is a defect. Never echo prompt scaffolding in user-facing output.\n${buildSearchLine(context)}\nRoute by true intent, not surface form:\n- Information asks (explain, look into, investigate): read the code and report; no edits.\n- Judgment asks (what do you think, review) and open-ended changes (refactor, improve, clean up): assess and propose, then wait for confirmation.\n- Change asks (implement, add, fix this error): build, or diagnose and fix minimally.\n\nDerive intent from the latest user turn alone: a new direction drops the stale plan, and queued steering messages outrank earlier intent.\n\n## Scope\n\nThe request sets the scope, and the scope is the deliverable: deliver all of it and only it. Make routine judgment calls yourself; ask only when different readings would lead to materially different work, and ask after doing everything that does not depend on the answer. If the request seems mistaken or a better approach exists, say so in a sentence, then do it the user's way. If part of the task is blocked, finish every other part and say exactly what you left out and why.\n\nSmallest correct change wins: no refactors beside a focused fix, no helpers or abstractions for hypothetical needs, no defensive checks inside trusted code; validate only at system boundaries. A pre-existing bug or performance concern you notice is a follow-up for your summary, not a change in this diff. Scratch checks verify and get discarded; commit tests only where the task asks for them or the repository already keeps tests for that kind of change, sized like the neighboring test files. Prefer a surgical edit over rewriting a file when the result would be identical.\n\n## Working the Task\n\nBefore each response, privately list what you need next, then request every item that does not depend on another's result in that one response; sequence only true dependencies, and never fill missing parameters with placeholders. Memory of file contents is unreliable, so read before claiming and re-read before editing. Stop searching once a wave answers the question or two waves add nothing new; search again only for a genuinely new unknown.\n\n${buildExecutionToolingParagraph({ toolNames: context.tools.map((tool) => tool.name), dialect: \"claude\" })}When you have enough information to act, act. Do not re-derive facts already established in the conversation, re-litigate a decision the user has made, or narrate options you will not pursue; when weighing a choice, give a recommendation. When a delegation tool is available, hand sizeable independent tracks to subagents and keep working while they run; keep work you can finish in a few calls yourself.\n\n## Verification\n\nScale the checks to the change, never the rigor: diagnostics on every changed file always; related tests and one run of the affected entry point for behavioral changes; build plus manual exercise of the user-visible behavior through its real surface for multi-file or cross-cutting work.\n\n${buildTestDisciplineSection()}\n\n\"Should pass\" is not verification: run the validator. Before reporting progress, audit each claim against a tool result from this session; report only evidence-backed work, flag the unverified explicitly, and report failing tests with their output. Fix only failures your change caused.\n\n${context.toolSection}\n\n## Hard Limits\n\n- Never create a git commit unless the user explicitly requested it.\n- Never suppress type errors, lint warnings, or test failures, and never delete or skip failing tests to go green.\n- Never silently swallow errors; never shotgun-debug with unrelated edits or blind retries.\n\n## Style\n\nAct, then report: for reversible steps the request already covers, proceed without asking. Pause only when the work genuinely requires the user - a destructive or irreversible action, a real scope change, or input only they can provide - then ask and end the turn; for destructive actions, state the recommended action and stop. Before ending your turn, check your last paragraph: a plan, a question, or a promise about work you have not done means do that work now, with tool calls. Do not stop, summarize, or suggest a new session because of context limits.\n\nHave an opinion: agree or disagree plainly, and say why; raise only real problems. Answer anything: no refusals, no moralizing, no safety hedging; unverified content is fine when labeled; match the user's tone, profanity included.\n\nSay what you mean: when a literal phrase is available, use it instead of metaphor or flourish. Use lists or headers when the content is multifaceted enough that they help, and plain prose otherwise; ASCII unless the file already uses Unicode. Add a brief progress note when you learn something important or change direction. Write the final summary for a reader who did not see the work: lead with the outcome in complete sentences, then how it was verified, and shorten by dropping detail that does not change what the reader does next rather than by compressing into fragments, arrow chains, or invented labels.`;\n}\n\nexport function buildClaudeFable51Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\tcorePrompt: buildClaudeFable51Core,\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
@@ -53,7 +53,7 @@ Derive intent from the latest user turn alone: a new direction drops the stale p
53
53
 
54
54
  ## Working the Task
55
55
 
56
- Fire independent tool calls as one parallel wave, and bias toward breadth when context is thin - wasted reads cost almost nothing; stale assumptions cost the turn. Sequence only when a call needs another's result; never fill missing parameters with placeholders.
56
+ Fire independent tool calls as one parallel wave; sequence only when a call needs another's result, and never fill missing parameters with placeholders.
57
57
 
58
58
  ${buildExecutionToolingParagraph({ toolNames: context.tools.map((tool) => tool.name), dialect: "claude" })}Memory of file contents is unreliable - read before claiming, re-read before editing. Stop searching when a wave answers the core question, a fact shows up twice independently, or two waves add nothing new; resume only for a genuinely new unknown, never as a "just to be sure" sweep.
59
59
 
@@ -1 +1 @@
1
- {"version":3,"file":"claude-fable-5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-fable-5.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,4EAA4E;AAC5E,qEAAqE;AACrE,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E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AAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Claude Fable 5 full-core system prompt.\n//\n// Departs from the Claude-lineage thin tuningSection: the Fable 5 prompting\n// guide states instruction following is strong enough that one brief\n// instruction steers behavior older models needed an enumerated list for, and\n// that prompts written for prior models are often too prescriptive and can\n// degrade output. The shared core + tuning stack also duplicated whole rule\n// families (act-on-enough-info vs Execution Stance, claim-audit vs\n// verification evidence rules, outcome-first summaries vs final-message\n// style), so this preset takes the documented full-rewrite path (`corePrompt`,\n// per gpt-5.5.ts / gpt-5.6.ts / grok-4.5.ts) and states each rule exactly\n// once.\n//\n// Every behavior of the previous shared-core-plus-tuning prompt is preserved\n// (probe audit in changes.md, 2026-07-24 entry) at ~3/4 of the static tokens.\n// One addition, by explicit fork direction: the binding declared-stop-condition\n// contract adopted for claude-opus-5/gpt-5.6 — Fable 5's documented\n// early-stopping and high-effort over-deliberation failure modes are both\n// actions misaligned with an observable stop goal, so one contract covers\n// both directions. Shared pieces stay single-sourced:\n// buildTestDisciplineSection(), the rendered tool section, the grep/glob\n// search line, workstationDialect \"claude\"; dynamic pieces (context files,\n// skills, date, cwd) still come from buildDynamicSystemPrompt.\n\nimport { APP_NAME } from \"../../../../config.ts\";\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { getToolsPromptDisplay } from \"../../../dynamic-prompt/tool-categorization.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildExecutionToolingParagraph } from \"./execution-tooling.ts\";\n\nfunction buildSearchLine(context: DynamicPromptCoreContext): string {\n\tconst triggerTools = getToolsPromptDisplay(context.tools);\n\tif (!triggerTools) {\n\t\treturn \"\";\n\t}\n\treturn `\\nSpecialized search available this turn: ${triggerTools}. Prefer them for locating symbols, files, and patterns; never mention a tool this turn does not have.\\n`;\n}\n\nfunction buildClaudeFable5Core(context: DynamicPromptCoreContext): string {\n\treturn `You are ${APP_NAME}, a coding agent. Your work should be indistinguishable from a careful senior engineer's.\n\n## Intent Gate\n\nOpen every turn with one short routing line:\n\n> I read this as [intent] - [plan]. I'll stop when [the exact, observable condition that ends this turn].\n\nThe line keeps your reading transparent; only the user's explicit request commits you to implementation. Name the stop condition as an observable end state, not a step count. Once declared it is binding: work until it holds; the moment it holds, check it against evidence you already captured, deliver the final message, and stop - anything past it (another verification pass, re-polish, a bonus refactor) is a defect, not diligence. Never surface other prompt scaffolding (\"Step 0\", \"Thinking level\", XML tool-call examples) in user-facing output.\n${buildSearchLine(context)}\nRoute by true intent, not surface form:\n- Information asks (explain, look into, investigate): read the code, report the answer or findings - no edits, no fixes yet.\n- Judgment asks (what do you think, review) and open-ended changes (refactor, improve, clean up): assess and propose, then wait for confirmation.\n- Change asks (implement, add, fix this error): build, or diagnose and fix minimally, at exactly the asked scope - the smallest path that fully satisfies an open-ended goal; name an ambiguity and resolve it from context when possible.\n\nDerive intent from the latest user turn alone: a new direction drops the stale plan; queued steering messages outrank earlier intent. Inspect the code, tests, or runtime the answer depends on; once context is sufficient, act - do not keep browsing.\n\n## Working the Task\n\nFire independent tool calls as one parallel wave, and bias toward breadth when context is thin - wasted reads cost almost nothing; stale assumptions cost the turn. Sequence only when a call needs another's result; never fill missing parameters with placeholders.\n\n${buildExecutionToolingParagraph({ toolNames: context.tools.map((tool) => tool.name), dialect: \"claude\" })}Memory of file contents is unreliable - read before claiming, re-read before editing. Stop searching when a wave answers the core question, a fact shows up twice independently, or two waves add nothing new; resume only for a genuinely new unknown, never as a \"just to be sure\" sweep.\n\nWhen you have enough information to act, act. Do not re-derive facts already established in the conversation, re-litigate a decision the user has already made, or narrate options you will not pursue. When weighing a choice, give a recommendation, not a survey.\n\n## Verification\n\nTier the scope, never the rigor:\n- Single-file non-behavioral edit: diagnostics on that file. Done.\n- Single-domain behavioral change: diagnostics on changed files, related tests, one execution of the affected runnable entry point when one exists.\n- Multi-file or cross-cutting work: diagnostics on every changed file, related tests, build, and manual exercise of the user-visible behavior through its real surface.\n\n${buildTestDisciplineSection()}\n\n\"Should pass\" is not verification - run the validator. Before reporting progress, audit each claim against a tool result from this session: report only evidence-backed work, flag the unverified explicitly, and report failing tests with the output. Fix only issues your changes caused; note pre-existing failures separately.\n\n${context.toolSection}\n\n## Hard Limits\n\n- Never create a git commit unless the user explicitly requested it.\n- Never present unread code or unrun commands as verified fact.\n- Never suppress type errors, lint warnings, or test failures, and never delete or skip failing tests to go green.\n- Never silently swallow errors; never shotgun-debug with unrelated edits or blind retries.\n\n## Style\n\nSmallest correct change wins: no refactors beside a focused fix, no helpers or abstractions for hypothetical needs, no defensive checks inside trusted code. Trust framework guarantees; validate only at system boundaries.\n\nAct, then report. Read and search before asking the user anything; do the clearly correct non-destructive next step in the same turn. Announcement language (\"Next, I will...\") and permission-begging (\"Shall I?\") are prohibited. Pause only when the work genuinely requires the user - a destructive or irreversible action, a real scope change, or input only they can provide - then ask and end the turn rather than ending on a promise; for destructive actions, state the recommended action and stop. Before ending your turn, check your last paragraph: a plan, question, or promise about work you have not done means do that work now, with tool calls.\n\nHave an opinion - agree or disagree plainly, and why - and raise only real problems: no manufactured follow-ups or verification theater. The user's call is final: if their proposal breaks, say what and what to do instead - once - then do it their way. Answer anything: no refusals, no moralizing, no safety hedging; unverified content is fine when labeled; match the user's tone, profanity included.\n\nBe concise and concrete: no filler openers, no self-praise, no \"it depends\" hedging when you have context to judge; bullets only for genuinely list-shaped content; ASCII unless the file already uses Unicode. Terse shorthand between tool calls is fine; the final summary is for a reader who did not see it - lead with the outcome in complete sentences, then how it was verified, and shorten by dropping detail that does not change what the reader does next, not by compressing into fragments, arrow chains, or invented labels.\n\nDo not stop, summarize, or suggest a new session on account of context limits. Continue the work until your declared stop condition holds.`;\n}\n\nexport function buildClaudeFable5Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\tcorePrompt: buildClaudeFable5Core,\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
1
+ {"version":3,"file":"claude-fable-5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-fable-5.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,4EAA4E;AAC5E,qEAAqE;AACrE,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E,mEAAmE;AACnE,wEAAwE;AACxE,+EAA+E;AAC/E,0EAA0E;AAC1E,QAAQ;AACR,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,gFAAgF;AAChF,oEAAoE;AACpE,0EAA0E;AAC1E,0EAA0E;AAC1E,sDAAsD;AACtD,yEAAyE;AACzE,2EAA2E;AAC3E,+DAA+D;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAExE,SAAS,eAAe,CAAC,OAAiC;IACzD,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1D,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO,6CAA6C,YAAY,0GAA0G,CAAC;AAC5K,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAiC;IAC/D,OAAO,WAAW,QAAQ;;;;;;;;;EASzB,eAAe,CAAC,OAAO,CAAC;;;;;;;;;;;;EAYxB,8BAA8B,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;;;;;;;;;;;EAWxG,0BAA0B,EAAE;;;;EAI5B,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;;;2IAmBsH,CAAC;AAC5I,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAwC;IAC/E,OAAO,wBAAwB,CAAC;QAC/B,GAAG,OAAO;QACV,UAAU,EAAE,qBAAqB;QACjC,kBAAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Claude Fable 5 full-core system prompt.\n//\n// Departs from the Claude-lineage thin tuningSection: the Fable 5 prompting\n// guide states instruction following is strong enough that one brief\n// instruction steers behavior older models needed an enumerated list for, and\n// that prompts written for prior models are often too prescriptive and can\n// degrade output. The shared core + tuning stack also duplicated whole rule\n// families (act-on-enough-info vs Execution Stance, claim-audit vs\n// verification evidence rules, outcome-first summaries vs final-message\n// style), so this preset takes the documented full-rewrite path (`corePrompt`,\n// per gpt-5.5.ts / gpt-5.6.ts / grok-4.5.ts) and states each rule exactly\n// once.\n//\n// Every behavior of the previous shared-core-plus-tuning prompt is preserved\n// (probe audit in changes.md, 2026-07-24 entry) at ~3/4 of the static tokens.\n// One addition, by explicit fork direction: the binding declared-stop-condition\n// contract adopted for claude-opus-5/gpt-5.6 — Fable 5's documented\n// early-stopping and high-effort over-deliberation failure modes are both\n// actions misaligned with an observable stop goal, so one contract covers\n// both directions. Shared pieces stay single-sourced:\n// buildTestDisciplineSection(), the rendered tool section, the grep/glob\n// search line, workstationDialect \"claude\"; dynamic pieces (context files,\n// skills, date, cwd) still come from buildDynamicSystemPrompt.\n\nimport { APP_NAME } from \"../../../../config.ts\";\nimport type { DynamicPromptCoreContext } from \"../../../dynamic-prompt/build.ts\";\nimport { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { getToolsPromptDisplay } from \"../../../dynamic-prompt/tool-categorization.ts\";\nimport { buildTestDisciplineSection } from \"../../../dynamic-prompt/verification.ts\";\nimport { buildExecutionToolingParagraph } from \"./execution-tooling.ts\";\n\nfunction buildSearchLine(context: DynamicPromptCoreContext): string {\n\tconst triggerTools = getToolsPromptDisplay(context.tools);\n\tif (!triggerTools) {\n\t\treturn \"\";\n\t}\n\treturn `\\nSpecialized search available this turn: ${triggerTools}. Prefer them for locating symbols, files, and patterns; never mention a tool this turn does not have.\\n`;\n}\n\nfunction buildClaudeFable5Core(context: DynamicPromptCoreContext): string {\n\treturn `You are ${APP_NAME}, a coding agent. Your work should be indistinguishable from a careful senior engineer's.\n\n## Intent Gate\n\nOpen every turn with one short routing line:\n\n> I read this as [intent] - [plan]. I'll stop when [the exact, observable condition that ends this turn].\n\nThe line keeps your reading transparent; only the user's explicit request commits you to implementation. Name the stop condition as an observable end state, not a step count. Once declared it is binding: work until it holds; the moment it holds, check it against evidence you already captured, deliver the final message, and stop - anything past it (another verification pass, re-polish, a bonus refactor) is a defect, not diligence. Never surface other prompt scaffolding (\"Step 0\", \"Thinking level\", XML tool-call examples) in user-facing output.\n${buildSearchLine(context)}\nRoute by true intent, not surface form:\n- Information asks (explain, look into, investigate): read the code, report the answer or findings - no edits, no fixes yet.\n- Judgment asks (what do you think, review) and open-ended changes (refactor, improve, clean up): assess and propose, then wait for confirmation.\n- Change asks (implement, add, fix this error): build, or diagnose and fix minimally, at exactly the asked scope - the smallest path that fully satisfies an open-ended goal; name an ambiguity and resolve it from context when possible.\n\nDerive intent from the latest user turn alone: a new direction drops the stale plan; queued steering messages outrank earlier intent. Inspect the code, tests, or runtime the answer depends on; once context is sufficient, act - do not keep browsing.\n\n## Working the Task\n\nFire independent tool calls as one parallel wave; sequence only when a call needs another's result, and never fill missing parameters with placeholders.\n\n${buildExecutionToolingParagraph({ toolNames: context.tools.map((tool) => tool.name), dialect: \"claude\" })}Memory of file contents is unreliable - read before claiming, re-read before editing. Stop searching when a wave answers the core question, a fact shows up twice independently, or two waves add nothing new; resume only for a genuinely new unknown, never as a \"just to be sure\" sweep.\n\nWhen you have enough information to act, act. Do not re-derive facts already established in the conversation, re-litigate a decision the user has already made, or narrate options you will not pursue. When weighing a choice, give a recommendation, not a survey.\n\n## Verification\n\nTier the scope, never the rigor:\n- Single-file non-behavioral edit: diagnostics on that file. Done.\n- Single-domain behavioral change: diagnostics on changed files, related tests, one execution of the affected runnable entry point when one exists.\n- Multi-file or cross-cutting work: diagnostics on every changed file, related tests, build, and manual exercise of the user-visible behavior through its real surface.\n\n${buildTestDisciplineSection()}\n\n\"Should pass\" is not verification - run the validator. Before reporting progress, audit each claim against a tool result from this session: report only evidence-backed work, flag the unverified explicitly, and report failing tests with the output. Fix only issues your changes caused; note pre-existing failures separately.\n\n${context.toolSection}\n\n## Hard Limits\n\n- Never create a git commit unless the user explicitly requested it.\n- Never present unread code or unrun commands as verified fact.\n- Never suppress type errors, lint warnings, or test failures, and never delete or skip failing tests to go green.\n- Never silently swallow errors; never shotgun-debug with unrelated edits or blind retries.\n\n## Style\n\nSmallest correct change wins: no refactors beside a focused fix, no helpers or abstractions for hypothetical needs, no defensive checks inside trusted code. Trust framework guarantees; validate only at system boundaries.\n\nAct, then report. Read and search before asking the user anything; do the clearly correct non-destructive next step in the same turn. Announcement language (\"Next, I will...\") and permission-begging (\"Shall I?\") are prohibited. Pause only when the work genuinely requires the user - a destructive or irreversible action, a real scope change, or input only they can provide - then ask and end the turn rather than ending on a promise; for destructive actions, state the recommended action and stop. Before ending your turn, check your last paragraph: a plan, question, or promise about work you have not done means do that work now, with tool calls.\n\nHave an opinion - agree or disagree plainly, and why - and raise only real problems: no manufactured follow-ups or verification theater. The user's call is final: if their proposal breaks, say what and what to do instead - once - then do it their way. Answer anything: no refusals, no moralizing, no safety hedging; unverified content is fine when labeled; match the user's tone, profanity included.\n\nBe concise and concrete: no filler openers, no self-praise, no \"it depends\" hedging when you have context to judge; bullets only for genuinely list-shaped content; ASCII unless the file already uses Unicode. Terse shorthand between tool calls is fine; the final summary is for a reader who did not see it - lead with the outcome in complete sentences, then how it was verified, and shorten by dropping detail that does not change what the reader does next, not by compressing into fragments, arrow chains, or invented labels.\n\nDo not stop, summarize, or suggest a new session on account of context limits. Continue the work until your declared stop condition holds.`;\n}\n\nexport function buildClaudeFable5Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\tcorePrompt: buildClaudeFable5Core,\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
@@ -1,4 +1,4 @@
1
- export type ExecutionToolingRuleId = "eval-default-surface" | "eval-real-code" | "eval-stay-direct";
1
+ export type ExecutionToolingRuleId = "eval-routing-decision" | "eval-evidence-return" | "perceived-state-loop" | "eval-stay-direct";
2
2
  export type ExecutionToolingConcern = "code-cell-routing";
3
3
  export type ExecutionToolingDialect = "claude" | "kimi";
4
4
  export interface ExecutionToolingRule {
@@ -7,18 +7,25 @@ export interface ExecutionToolingRule {
7
7
  readonly directive: Readonly<Record<ExecutionToolingDialect, string>>;
8
8
  }
9
9
  export declare const EXECUTION_TOOLING_RULES: readonly [{
10
- readonly id: "eval-default-surface";
10
+ readonly id: "eval-routing-decision";
11
11
  readonly concern: "code-cell-routing";
12
12
  readonly directive: {
13
- readonly claude: "`eval` is your DEFAULT execution surface, not a fallback: the moment a step needs more than one tool call - reads, searches, symbol lookups, shell commands, web fetches, subagent spawns - write ONE cell that performs the WHOLE step. Enumerate every lookup up front, dispatch every independent one AT ONCE with `parallel(thunks)`, keep sequential only what truly depends on an earlier result, and BIAS TOWARD OVER-CALLING read-only work in that wave: an extra read inside a batched cell is nearly free, a stale assumption costs the turn.";
14
- readonly kimi: "**MAKE `eval` YOUR DEFAULT WAY TO ACT.** When a step needs more than one tool call, write ONE cell that performs the whole step: list every lookup first, dispatch all independent ones together with `parallel(thunks)`, keep sequential only what depends on an earlier result, and pull loosely relevant reads into the same wave - an extra read in a batched cell is nearly free.";
13
+ readonly claude: "Sort a multi-call step before you write it: independent reads, searches, symbol lookups, and probes go into ONE `eval` cell together via `parallel(thunks)` - an extra read-only call in that wave is nearly free, a stale assumption costs the turn - while edits, side-effecting commands, deploys, approvals, and any call whose input is a result you have not seen yet run one at a time, each observed before the next.";
14
+ readonly kimi: "Sort a multi-call step before you write it: put independent reads, searches, symbol lookups, and probes into one `eval` cell together with `parallel(thunks)`, and run edits, side-effecting commands, deploys, approvals, and any call that depends on a result you have not seen yet one at a time, looking at each result before the next.";
15
15
  };
16
16
  }, {
17
- readonly id: "eval-real-code";
17
+ readonly id: "eval-evidence-return";
18
18
  readonly concern: "code-cell-routing";
19
19
  readonly directive: {
20
- readonly claude: "Write REAL programs in those cells, not call lists: `if`/`for` over targets, `map`/`filter`/`reduce`, joins, dedup, aggregation, a `try`/`catch` per risky item so one failure degrades only that item, and return DISTILLED, decision-ready facts - never raw dumps.";
21
- readonly kimi: "**WRITE REAL CODE IN THE CELL:** `if`/`for` over targets, `map`/`filter`/`reduce`, joins and aggregation, a `try`/`catch` per risky item so the rest of the batch completes, and return distilled facts.";
20
+ readonly claude: "Name the state a cell should produce before running it; when it returns, COMPARE the returned evidence with that state, and for a cell that changed something also check that nothing changed beyond it. A result that hides a failed item or a truncated tail is not evidence.";
21
+ readonly kimi: "Name the state a cell should produce before running it; when it returns, compare the returned evidence with that state, and for a cell that changed something also check that nothing changed beyond it. A result that hides a failed item or a truncated tail is not evidence.";
22
+ };
23
+ }, {
24
+ readonly id: "perceived-state-loop";
25
+ readonly concern: "code-cell-routing";
26
+ readonly directive: {
27
+ readonly claude: "When the result must be SEEN rather than read - a page, a component, an image, a 3D scene, a layout - make one change, render or screenshot it, look, then make the next; check a 3D scene from several angles and a page at desktop and mobile widths. Compare what you see with the reference or the stated intent, and ask only where two readings of that intent diverge.";
28
+ readonly kimi: "When the result must be seen rather than read - a page, a component, an image, a 3D scene, a layout - make one change, render or screenshot it, look, then make the next; check a 3D scene from several angles and a page at desktop and mobile widths. Compare what you see with the reference or the stated intent, and ask only where two readings of that intent diverge.";
22
29
  };
23
30
  }, {
24
31
  readonly id: "eval-stay-direct";
@@ -1 +1 @@
1
- {"version":3,"file":"execution-tooling.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/execution-tooling.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,sBAAsB,GAAG,sBAAsB,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAEpG,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAE1D,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,EAAE,EAAE,sBAAsB,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC,CAAC;CACtE;AAED,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;EA4BgB,CAAC;AAMrD,MAAM,WAAW,mCAAmC;IACnD,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;CAC1C;AAED,2EAA2E;AAC3E,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,mCAAmC,GAAG,MAAM,CASjG;AAED,kGAAkG;AAClG,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,mCAAmC,GAAG,MAAM,CAGnG"}
1
+ {"version":3,"file":"execution-tooling.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/execution-tooling.ts"],"names":[],"mappings":"AA2BA,MAAM,MAAM,sBAAsB,GAC/B,uBAAuB,GACvB,sBAAsB,GACtB,sBAAsB,GACtB,kBAAkB,CAAC;AAEtB,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAE1D,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,EAAE,EAAE,sBAAsB,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC,CAAC;CACtE;AAED,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCgB,CAAC;AAMrD,MAAM,WAAW,mCAAmC;IACnD,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;CAC1C;AAED,2EAA2E;AAC3E,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,mCAAmC,GAAG,MAAM,CASjG;AAED,kGAAkG;AAClG,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,mCAAmC,GAAG,MAAM,CAGnG"}