@code-yeongyu/senpi 2026.9.2 → 2026.9.3

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 (214) hide show
  1. package/CHANGELOG.md +124 -2
  2. package/dist/beta/omo-local-update-fingerprint.d.ts.map +1 -1
  3. package/dist/beta/omo-local-update-fingerprint.js +0 -1
  4. package/dist/beta/omo-local-update-fingerprint.js.map +1 -1
  5. package/dist/core/agent-session.d.ts +1 -0
  6. package/dist/core/agent-session.d.ts.map +1 -1
  7. package/dist/core/agent-session.js +7 -4
  8. package/dist/core/agent-session.js.map +1 -1
  9. package/dist/core/dynamic-prompt/build.d.ts.map +1 -1
  10. package/dist/core/dynamic-prompt/build.js +2 -5
  11. package/dist/core/dynamic-prompt/build.js.map +1 -1
  12. package/dist/core/dynamic-prompt/index.d.ts +1 -2
  13. package/dist/core/dynamic-prompt/index.d.ts.map +1 -1
  14. package/dist/core/dynamic-prompt/index.js +1 -2
  15. package/dist/core/dynamic-prompt/index.js.map +1 -1
  16. package/dist/core/dynamic-prompt/intent-gate.d.ts.map +1 -1
  17. package/dist/core/dynamic-prompt/intent-gate.js +9 -24
  18. package/dist/core/dynamic-prompt/intent-gate.js.map +1 -1
  19. package/dist/core/dynamic-prompt/policies.d.ts.map +1 -1
  20. package/dist/core/dynamic-prompt/policies.js +3 -7
  21. package/dist/core/dynamic-prompt/policies.js.map +1 -1
  22. package/dist/core/dynamic-prompt/style.d.ts.map +1 -1
  23. package/dist/core/dynamic-prompt/style.js +6 -8
  24. package/dist/core/dynamic-prompt/style.js.map +1 -1
  25. package/dist/core/dynamic-prompt/verification.js +1 -1
  26. package/dist/core/dynamic-prompt/verification.js.map +1 -1
  27. package/dist/core/dynamic-prompt/working-task.d.ts +2 -0
  28. package/dist/core/dynamic-prompt/working-task.d.ts.map +1 -0
  29. package/dist/core/dynamic-prompt/working-task.js +10 -0
  30. package/dist/core/dynamic-prompt/working-task.js.map +1 -0
  31. package/dist/core/extensions/builtin/claude-sdk-oauth/options.d.ts.map +1 -1
  32. package/dist/core/extensions/builtin/claude-sdk-oauth/options.js +6 -2
  33. package/dist/core/extensions/builtin/claude-sdk-oauth/options.js.map +1 -1
  34. package/dist/core/extensions/builtin/claude-sdk-oauth/stream.d.ts.map +1 -1
  35. package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js +2 -1
  36. package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js.map +1 -1
  37. package/dist/core/extensions/builtin/compaction/extension-wiring.js +1 -1
  38. package/dist/core/extensions/builtin/compaction/extension-wiring.js.map +1 -1
  39. package/dist/core/extensions/builtin/config-reload/watch-event-source.d.ts +1 -1
  40. package/dist/core/extensions/builtin/config-reload/watch-event-source.d.ts.map +1 -1
  41. package/dist/core/extensions/builtin/config-reload/watch-event-source.js +27 -9
  42. package/dist/core/extensions/builtin/config-reload/watch-event-source.js.map +1 -1
  43. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.d.ts.map +1 -1
  44. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.js +52 -50
  45. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.js.map +1 -1
  46. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.d.ts.map +1 -1
  47. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js +2 -1
  48. package/dist/core/extensions/builtin/prompt-preset/claude-fable-5.js.map +1 -1
  49. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.d.ts.map +1 -1
  50. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js +7 -1
  51. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js.map +1 -1
  52. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.d.ts.map +1 -1
  53. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js +7 -1
  54. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js.map +1 -1
  55. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.d.ts.map +1 -1
  56. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js +7 -1
  57. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js.map +1 -1
  58. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.d.ts.map +1 -1
  59. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js +7 -1
  60. package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js.map +1 -1
  61. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.d.ts.map +1 -1
  62. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js +2 -1
  63. package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js.map +1 -1
  64. package/dist/core/extensions/builtin/prompt-preset/execution-tooling.d.ts +50 -0
  65. package/dist/core/extensions/builtin/prompt-preset/execution-tooling.d.ts.map +1 -0
  66. package/dist/core/extensions/builtin/prompt-preset/execution-tooling.js +66 -0
  67. package/dist/core/extensions/builtin/prompt-preset/execution-tooling.js.map +1 -0
  68. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +5 -1
  69. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
  70. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +6 -1
  71. package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
  72. package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.d.ts.map +1 -1
  73. package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.js +11 -1
  74. package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.js.map +1 -1
  75. package/dist/core/extensions/builtin/prompt-preset/kimi-k2-7.d.ts.map +1 -1
  76. package/dist/core/extensions/builtin/prompt-preset/kimi-k2-7.js +11 -1
  77. package/dist/core/extensions/builtin/prompt-preset/kimi-k2-7.js.map +1 -1
  78. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts.map +1 -1
  79. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +2 -1
  80. package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -1
  81. package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
  82. package/dist/core/extensions/builtin/prompt-preset/presets.js +8 -2
  83. package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
  84. package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
  85. package/dist/core/extensions/builtin/terminal/extension.js +8 -3
  86. package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
  87. package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts +4 -3
  88. package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts.map +1 -1
  89. package/dist/core/extensions/builtin/terminal/monitor-notify.js +18 -18
  90. package/dist/core/extensions/builtin/terminal/monitor-notify.js.map +1 -1
  91. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts +7 -0
  92. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -1
  93. package/dist/core/extensions/builtin/terminal/monitor-registry.js +37 -8
  94. package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -1
  95. package/dist/core/extensions/builtin/terminal/monitor-status.js +1 -1
  96. package/dist/core/extensions/builtin/terminal/monitor-status.js.map +1 -1
  97. package/dist/core/extensions/builtin/terminal/prompt.d.ts +1 -1
  98. package/dist/core/extensions/builtin/terminal/prompt.d.ts.map +1 -1
  99. package/dist/core/extensions/builtin/terminal/prompt.js +17 -13
  100. package/dist/core/extensions/builtin/terminal/prompt.js.map +1 -1
  101. package/dist/core/extensions/builtin/terminal/tools/bash-output.d.ts.map +1 -1
  102. package/dist/core/extensions/builtin/terminal/tools/bash-output.js +14 -2
  103. package/dist/core/extensions/builtin/terminal/tools/bash-output.js.map +1 -1
  104. package/dist/core/extensions/builtin/terminal/tools/context.d.ts +2 -0
  105. package/dist/core/extensions/builtin/terminal/tools/context.d.ts.map +1 -1
  106. package/dist/core/extensions/builtin/terminal/tools/context.js.map +1 -1
  107. package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -1
  108. package/dist/core/extensions/builtin/terminal/tools/monitor.js +27 -10
  109. package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -1
  110. package/dist/core/provider-composer.d.ts.map +1 -1
  111. package/dist/core/provider-composer.js +17 -8
  112. package/dist/core/provider-composer.js.map +1 -1
  113. package/dist/core/settings-manager.d.ts +2 -2
  114. package/dist/core/settings-manager.d.ts.map +1 -1
  115. package/dist/core/settings-manager.js +5 -3
  116. package/dist/core/settings-manager.js.map +1 -1
  117. package/dist/index.d.ts +1 -1
  118. package/dist/index.d.ts.map +1 -1
  119. package/dist/index.js +1 -1
  120. package/dist/index.js.map +1 -1
  121. package/dist/modes/index.d.ts +1 -1
  122. package/dist/modes/index.d.ts.map +1 -1
  123. package/dist/modes/index.js +1 -1
  124. package/dist/modes/index.js.map +1 -1
  125. package/dist/modes/rpc/host-ensure.d.ts +6 -0
  126. package/dist/modes/rpc/host-ensure.d.ts.map +1 -1
  127. package/dist/modes/rpc/host-ensure.js +36 -9
  128. package/dist/modes/rpc/host-ensure.js.map +1 -1
  129. package/dist/modes/rpc/host-lifecycle.d.ts.map +1 -1
  130. package/dist/modes/rpc/host-lifecycle.js +16 -4
  131. package/dist/modes/rpc/host-lifecycle.js.map +1 -1
  132. package/dist/modes/rpc/multi-session-host.d.ts +7 -4
  133. package/dist/modes/rpc/multi-session-host.d.ts.map +1 -1
  134. package/dist/modes/rpc/multi-session-host.js +7 -4
  135. package/dist/modes/rpc/multi-session-host.js.map +1 -1
  136. package/dist/modes/rpc/rpc-client.d.ts +8 -0
  137. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  138. package/dist/modes/rpc/rpc-client.js +62 -7
  139. package/dist/modes/rpc/rpc-client.js.map +1 -1
  140. package/dist/modes/rpc/rpc-mode.d.ts +1 -1
  141. package/dist/modes/rpc/rpc-mode.js +1 -1
  142. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  143. package/dist/modes/rpc/session-command-router.d.ts +22 -0
  144. package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
  145. package/dist/modes/rpc/session-command-router.js +132 -94
  146. package/dist/modes/rpc/session-command-router.js.map +1 -1
  147. package/dist/modes/rpc/session-event-fanout.d.ts +40 -0
  148. package/dist/modes/rpc/session-event-fanout.d.ts.map +1 -0
  149. package/dist/modes/rpc/session-event-fanout.js +146 -0
  150. package/dist/modes/rpc/session-event-fanout.js.map +1 -0
  151. package/dist/modes/rpc/session-event-writer.d.ts +6 -13
  152. package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
  153. package/dist/modes/rpc/session-event-writer.js +48 -96
  154. package/dist/modes/rpc/session-event-writer.js.map +1 -1
  155. package/dist/modes/rpc/session-registry.d.ts +9 -8
  156. package/dist/modes/rpc/session-registry.d.ts.map +1 -1
  157. package/dist/modes/rpc/session-registry.js +14 -42
  158. package/dist/modes/rpc/session-registry.js.map +1 -1
  159. package/dist/modes/rpc/session-teardown.d.ts +12 -0
  160. package/dist/modes/rpc/session-teardown.d.ts.map +1 -0
  161. package/dist/modes/rpc/session-teardown.js +117 -0
  162. package/dist/modes/rpc/session-teardown.js.map +1 -0
  163. package/docs/rpc.md +10 -6
  164. package/docs/settings.md +4 -4
  165. package/docs/terminal-tools.md +26 -6
  166. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +57 -0
  167. package/node_modules/@code-yeongyu/senpi-codemode/README.md +4 -2
  168. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  169. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/skill-contribution.ts +43 -9
  170. package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +4 -1
  171. package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +10 -1
  172. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/SKILL.md +1 -1
  173. package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/runtime-apis.md +1 -1
  174. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool-options.ts +3 -1
  175. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +2 -0
  176. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +3 -0
  177. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  178. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +2 -2
  179. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  180. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  181. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +1 -1
  182. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  183. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.d.ts +5 -0
  184. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.d.ts.map +1 -1
  185. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js +26 -4
  186. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/anthropic.js.map +1 -1
  187. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  188. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  189. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
  190. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
  191. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  192. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  193. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  194. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opengateway.json +1 -1
  195. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  196. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  197. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.d.ts.map +1 -1
  198. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.js +3 -1
  199. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.js.map +1 -1
  200. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +1 -1
  201. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
  202. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  203. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  204. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  205. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  206. package/package.json +7 -7
  207. package/dist/core/dynamic-prompt/exploration.d.ts +0 -2
  208. package/dist/core/dynamic-prompt/exploration.d.ts.map +0 -1
  209. package/dist/core/dynamic-prompt/exploration.js +0 -6
  210. package/dist/core/dynamic-prompt/exploration.js.map +0 -1
  211. package/dist/core/dynamic-prompt/parallel-tools.d.ts +0 -2
  212. package/dist/core/dynamic-prompt/parallel-tools.d.ts.map +0 -1
  213. package/dist/core/dynamic-prompt/parallel-tools.js +0 -8
  214. package/dist/core/dynamic-prompt/parallel-tools.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAU1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,EAA2B,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEpF,oFAAoF;AACpF,MAAM,WAAW,wBAAwB;IACxC,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,+BAA+B;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,E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E,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,MAAM,CAAC;IAC3D;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACxC;AAmBD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CA2DzF"}
@@ -1,13 +1,12 @@
1
1
  import { formatSkillsForPrompt } from "../skills.js";
2
- import { buildExplorationSection } from "./exploration.js";
3
2
  import { buildIdentitySection } from "./identity.js";
4
3
  import { buildIntentGate } from "./intent-gate.js";
5
- import { buildParallelToolsSection } from "./parallel-tools.js";
6
4
  import { buildPoliciesSection } from "./policies.js";
7
5
  import { buildStyleSection } from "./style.js";
8
6
  import { categorizeTools } from "./tool-categorization.js";
9
7
  import { buildToolSection } from "./tool-section.js";
10
8
  import { buildVerificationSection } from "./verification.js";
9
+ import { buildWorkingTaskSection } from "./working-task.js";
11
10
  import { buildWorkstationSection } from "./workstation.js";
12
11
  function buildContextFilesSection(contextFiles) {
13
12
  if (contextFiles.length === 0) {
@@ -40,9 +39,7 @@ export function buildDynamicSystemPrompt(options) {
40
39
  "",
41
40
  buildIntentGate({ tools }),
42
41
  "",
43
- buildParallelToolsSection(),
44
- "",
45
- buildExplorationSection(),
42
+ buildWorkingTaskSection(),
46
43
  "",
47
44
  buildVerificationSection(),
48
45
  "",
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MA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AAE,EAAE,iBAAiB,IAAI,EAAE,EAAE,8BAA8B,SAAS,EAAE,CAAC,CAAC;IAEtF,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["import type { Skill } from \"../skills.ts\";\nimport { formatSkillsForPrompt } from \"../skills.ts\";\nimport { buildExplorationSection } from \"./exploration.ts\";\nimport { buildIdentitySection } from \"./identity.ts\";\nimport { buildIntentGate } from \"./intent-gate.ts\";\nimport { buildParallelToolsSection } from \"./parallel-tools.ts\";\nimport { buildPoliciesSection } from \"./policies.ts\";\nimport { buildStyleSection } from \"./style.ts\";\nimport { categorizeTools } from \"./tool-categorization.ts\";\nimport { buildToolSection } from \"./tool-section.ts\";\nimport type { AvailableTool } from \"./types.ts\";\nimport { buildVerificationSection } from \"./verification.ts\";\nimport { buildWorkstationSection, type WorkstationDialect } from \"./workstation.ts\";\n\n/** Context handed to a `corePrompt` override so it can reuse the dynamic pieces. */\nexport interface DynamicPromptCoreContext {\n\ttools: AvailableTool[];\n\t/** Rendered \"## Available Tools\" (+ \"## Tool Guidelines\") section. */\n\ttoolSection: string;\n}\n\nexport interface BuildDynamicSystemPromptOptions {\n\tcwd: string;\n\tselectedTools: string[];\n\ttoolSnippets: Record<string, string>;\n\tpromptGuidelines: string[];\n\tcontextFiles: Array<{ path: string; content: string }>;\n\tskills: Skill[];\n\ttuningSection?: string;\n\t/**\n\t * Replaces the default core sections (identity through style) with a\n\t * model-specific full rewrite. Tool section, tuning, context files, skills,\n\t * date, and cwd assembly stay in this builder.\n\t */\n\tcorePrompt?: (context: DynamicPromptCoreContext) => string;\n\t/**\n\t * Wording dialect for the workstation execution-context instruction.\n\t * Presets pass their model family; the fallback prompt uses `default`\n\t * (maximum emphasis).\n\t */\n\tworkstationDialect?: WorkstationDialect;\n}\n\nfunction buildContextFilesSection(contextFiles: Array<{ path: string; content: string }>): string {\n\tif (contextFiles.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst lines = [\n\t\t\"## Project Context\",\n\t\t\"\",\n\t\t\"Project instruction files (below, and in [Directory Context: ...] blocks injected during reads) bind files under their directory; deeper files win on conflict; explicit user instructions override.\",\n\t\t\"\",\n\t];\n\tfor (const contextFile of contextFiles) {\n\t\tlines.push(`### ${contextFile.path}`, \"\", contextFile.content.trimEnd(), \"\");\n\t}\n\treturn lines.join(\"\\n\").trimEnd();\n}\n\nexport function buildDynamicSystemPrompt(options: BuildDynamicSystemPromptOptions): string {\n\tconst promptCwd = options.cwd.replace(/\\\\/g, \"/\");\n\tconst tools = categorizeTools(options.selectedTools);\n\tconst date = new Date().toISOString().slice(0, 10);\n\n\tconst toolSection = buildToolSection({\n\t\ttools,\n\t\ttoolSnippets: options.toolSnippets,\n\t\tpromptGuidelines: options.promptGuidelines,\n\t});\n\n\tconst sections = options.corePrompt\n\t\t? [options.corePrompt({ tools, toolSection })]\n\t\t: [\n\t\t\t\tbuildIdentitySection(),\n\t\t\t\t\"\",\n\t\t\t\tbuildIntentGate({ tools }),\n\t\t\t\t\"\",\n\t\t\t\tbuildParallelToolsSection(),\n\t\t\t\t\"\",\n\t\t\t\tbuildExplorationSection(),\n\t\t\t\t\"\",\n\t\t\t\tbuildVerificationSection(),\n\t\t\t\t\"\",\n\t\t\t\ttoolSection,\n\t\t\t\t\"\",\n\t\t\t\tbuildPoliciesSection(),\n\t\t\t\t\"\",\n\t\t\t\tbuildStyleSection(),\n\t\t\t];\n\n\tconst tuning = options.tuningSection?.trim();\n\tif (tuning) {\n\t\tsections.push(\"\", tuning);\n\t}\n\n\tconst contextFilesSection = buildContextFilesSection(options.contextFiles);\n\tif (contextFilesSection) {\n\t\tsections.push(\"\", contextFilesSection);\n\t}\n\n\tconst skillsSection = formatSkillsForPrompt(options.skills);\n\tif (skillsSection) {\n\t\tsections.push(skillsSection);\n\t}\n\n\tsections.push(\n\t\t\"\",\n\t\tbuildWorkstationSection({\n\t\t\tselectedTools: options.selectedTools,\n\t\t\tdialect: options.workstationDialect ?? \"default\",\n\t\t}),\n\t);\n\n\t// The claude-sdk-oauth lane appends these dynamic lines after the stable sections so the composed\n\t// prompt is a single string. An earlier draft split at this point for prompt-cache scoping, but a\n\t// wire-level probe proved the installed CLI joins array elements into one system block, so the\n\t// split was removed (the sentinel leaked to the model as literal text).\n\tsections.push(\"\", `Current date: ${date}`, `Current working directory: ${promptCwd}`);\n\n\treturn sections.join(\"\\n\");\n}\n"]}
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAA2B,MAAM,kBAAkB,CAAC;AA+BpF,SAAS,wBAAwB,CAAC,YAAsD;IACvF,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,EAAE,CAAC;IACX,CAAC;IAED,MAAM,KAAK,GAAG;QACb,oBAAoB;QACpB,EAAE;QACF,sMAAsM;QACtM,EAAE;KACF,CAAC;IACF,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,OAAO,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,EA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AAC;QACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,mBAAmB,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,aAAa,GAAG,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5D,IAAI,aAAa,EAAE,CAAC;QACnB,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;IAED,QAAQ,CAAC,IAAI,CACZ,EAAE,EACF,uBAAuB,CAAC;QACvB,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,OAAO,EAAE,OAAO,CAAC,kBAAkB,IAAI,SAAS;KAChD,CAAC,CACF,CAAC;IAEF,kGAAkG;IAClG,kGAAkG;IAClG,+FAA+F;IAC/F,wEAAwE;IACxE,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,iBAAiB,IAAI,EAAE,EAAE,8BAA8B,SAAS,EAAE,CAAC,CAAC;IAEtF,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["import type { Skill } from \"../skills.ts\";\nimport { formatSkillsForPrompt } from \"../skills.ts\";\nimport { buildIdentitySection } from \"./identity.ts\";\nimport { buildIntentGate } from \"./intent-gate.ts\";\nimport { buildPoliciesSection } from \"./policies.ts\";\nimport { buildStyleSection } from \"./style.ts\";\nimport { categorizeTools } from \"./tool-categorization.ts\";\nimport { buildToolSection } from \"./tool-section.ts\";\nimport type { AvailableTool } from \"./types.ts\";\nimport { buildVerificationSection } from \"./verification.ts\";\nimport { buildWorkingTaskSection } from \"./working-task.ts\";\nimport { buildWorkstationSection, type WorkstationDialect } from \"./workstation.ts\";\n\n/** Context handed to a `corePrompt` override so it can reuse the dynamic pieces. */\nexport interface DynamicPromptCoreContext {\n\ttools: AvailableTool[];\n\t/** Rendered \"## Available Tools\" (+ \"## Tool Guidelines\") section. */\n\ttoolSection: string;\n}\n\nexport interface BuildDynamicSystemPromptOptions {\n\tcwd: string;\n\tselectedTools: string[];\n\ttoolSnippets: Record<string, string>;\n\tpromptGuidelines: string[];\n\tcontextFiles: Array<{ path: string; content: string }>;\n\tskills: Skill[];\n\ttuningSection?: string;\n\t/**\n\t * Replaces the default core sections (identity through style) with a\n\t * model-specific full rewrite. Tool section, tuning, context files, skills,\n\t * date, and cwd assembly stay in this builder.\n\t */\n\tcorePrompt?: (context: DynamicPromptCoreContext) => string;\n\t/**\n\t * Wording dialect for the workstation execution-context instruction.\n\t * Presets pass their model family; the fallback prompt uses `default`\n\t * (maximum emphasis).\n\t */\n\tworkstationDialect?: WorkstationDialect;\n}\n\nfunction buildContextFilesSection(contextFiles: Array<{ path: string; content: string }>): string {\n\tif (contextFiles.length === 0) {\n\t\treturn \"\";\n\t}\n\n\tconst lines = [\n\t\t\"## Project Context\",\n\t\t\"\",\n\t\t\"Project instruction files (below, and in [Directory Context: ...] blocks injected during reads) bind files under their directory; deeper files win on conflict; explicit user instructions override.\",\n\t\t\"\",\n\t];\n\tfor (const contextFile of contextFiles) {\n\t\tlines.push(`### ${contextFile.path}`, \"\", contextFile.content.trimEnd(), \"\");\n\t}\n\treturn lines.join(\"\\n\").trimEnd();\n}\n\nexport function buildDynamicSystemPrompt(options: BuildDynamicSystemPromptOptions): string {\n\tconst promptCwd = options.cwd.replace(/\\\\/g, \"/\");\n\tconst tools = categorizeTools(options.selectedTools);\n\tconst date = new Date().toISOString().slice(0, 10);\n\n\tconst toolSection = buildToolSection({\n\t\ttools,\n\t\ttoolSnippets: options.toolSnippets,\n\t\tpromptGuidelines: options.promptGuidelines,\n\t});\n\n\tconst sections = options.corePrompt\n\t\t? [options.corePrompt({ tools, toolSection })]\n\t\t: [\n\t\t\t\tbuildIdentitySection(),\n\t\t\t\t\"\",\n\t\t\t\tbuildIntentGate({ tools }),\n\t\t\t\t\"\",\n\t\t\t\tbuildWorkingTaskSection(),\n\t\t\t\t\"\",\n\t\t\t\tbuildVerificationSection(),\n\t\t\t\t\"\",\n\t\t\t\ttoolSection,\n\t\t\t\t\"\",\n\t\t\t\tbuildPoliciesSection(),\n\t\t\t\t\"\",\n\t\t\t\tbuildStyleSection(),\n\t\t\t];\n\n\tconst tuning = options.tuningSection?.trim();\n\tif (tuning) {\n\t\tsections.push(\"\", tuning);\n\t}\n\n\tconst contextFilesSection = buildContextFilesSection(options.contextFiles);\n\tif (contextFilesSection) {\n\t\tsections.push(\"\", contextFilesSection);\n\t}\n\n\tconst skillsSection = formatSkillsForPrompt(options.skills);\n\tif (skillsSection) {\n\t\tsections.push(skillsSection);\n\t}\n\n\tsections.push(\n\t\t\"\",\n\t\tbuildWorkstationSection({\n\t\t\tselectedTools: options.selectedTools,\n\t\t\tdialect: options.workstationDialect ?? \"default\",\n\t\t}),\n\t);\n\n\t// The claude-sdk-oauth lane appends these dynamic lines after the stable sections so the composed\n\t// prompt is a single string. An earlier draft split at this point for prompt-cache scoping, but a\n\t// wire-level probe proved the installed CLI joins array elements into one system block, so the\n\t// split was removed (the sentinel leaked to the model as literal text).\n\tsections.push(\"\", `Current date: ${date}`, `Current working directory: ${promptCwd}`);\n\n\treturn sections.join(\"\\n\");\n}\n"]}
@@ -1,13 +1,12 @@
1
1
  export type { BuildDynamicSystemPromptOptions, DynamicPromptCoreContext } from "./build.ts";
2
2
  export { buildDynamicSystemPrompt } from "./build.ts";
3
- export { buildExplorationSection } from "./exploration.ts";
4
3
  export { buildIdentitySection } from "./identity.ts";
5
4
  export { buildIntentGate } from "./intent-gate.ts";
6
- export { buildParallelToolsSection } from "./parallel-tools.ts";
7
5
  export { buildPoliciesSection } from "./policies.ts";
8
6
  export { buildStyleSection } from "./style.ts";
9
7
  export { categorizeTools } from "./tool-categorization.ts";
10
8
  export { buildToolSection } from "./tool-section.ts";
11
9
  export type { AvailableTool } from "./types.ts";
12
10
  export { buildVerificationSection } from "./verification.ts";
11
+ export { buildWorkingTaskSection } from "./working-task.ts";
13
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,+BAA+B,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,+BAA+B,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,11 +1,10 @@
1
1
  export { buildDynamicSystemPrompt } from "./build.js";
2
- export { buildExplorationSection } from "./exploration.js";
3
2
  export { buildIdentitySection } from "./identity.js";
4
3
  export { buildIntentGate } from "./intent-gate.js";
5
- export { buildParallelToolsSection } from "./parallel-tools.js";
6
4
  export { buildPoliciesSection } from "./policies.js";
7
5
  export { buildStyleSection } from "./style.js";
8
6
  export { categorizeTools } from "./tool-categorization.js";
9
7
  export { buildToolSection } from "./tool-section.js";
10
8
  export { buildVerificationSection } from "./verification.js";
9
+ export { buildWorkingTaskSection } from "./working-task.js";
11
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type { BuildDynamicSystemPromptOptions, DynamicPromptCoreContext } from \"./build.ts\";\nexport { buildDynamicSystemPrompt } from \"./build.ts\";\nexport { buildExplorationSection } from \"./exploration.ts\";\nexport { buildIdentitySection } from \"./identity.ts\";\nexport { buildIntentGate } from \"./intent-gate.ts\";\nexport { buildParallelToolsSection } from \"./parallel-tools.ts\";\nexport { buildPoliciesSection } from \"./policies.ts\";\nexport { buildStyleSection } from \"./style.ts\";\nexport { categorizeTools } from \"./tool-categorization.ts\";\nexport { buildToolSection } from \"./tool-section.ts\";\nexport type { AvailableTool } from \"./types.ts\";\nexport { buildVerificationSection } from \"./verification.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export type { BuildDynamicSystemPromptOptions, DynamicPromptCoreContext } from \"./build.ts\";\nexport { buildDynamicSystemPrompt } from \"./build.ts\";\nexport { buildIdentitySection } from \"./identity.ts\";\nexport { buildIntentGate } from \"./intent-gate.ts\";\nexport { buildPoliciesSection } from \"./policies.ts\";\nexport { buildStyleSection } from \"./style.ts\";\nexport { categorizeTools } from \"./tool-categorization.ts\";\nexport { buildToolSection } from \"./tool-section.ts\";\nexport type { AvailableTool } from \"./types.ts\";\nexport { buildVerificationSection } from \"./verification.ts\";\nexport { buildWorkingTaskSection } from \"./working-task.ts\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"intent-gate.d.ts","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/intent-gate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAYhD,wBAAgB,eAAe,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,aAAa,EAAE,CAAA;CAAE,GAAG,MAAM,CAgC1E"}
1
+ {"version":3,"file":"intent-gate.d.ts","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/intent-gate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAYhD,wBAAgB,eAAe,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,aAAa,EAAE,CAAA;CAAE,GAAG,MAAM,CAiB1E"}
@@ -7,36 +7,21 @@ function buildKeyTriggers(tools) {
7
7
  return `\nSpecialized search available this turn: ${triggerTools}. Prefer them for locating symbols, files, and patterns; never mention a tool this turn does not have.\n`;
8
8
  }
9
9
  export function buildIntentGate(config) {
10
- return `## Intent Gate (EVERY message)
10
+ return `## Intent Gate
11
11
 
12
- Open every turn with one short routing line stating what the user wants and your plan:
12
+ Open every turn with one short routing line:
13
13
 
14
- > I read this as [intent] - [plan].
14
+ > I read this as [intent] - [plan]. I'll stop when [the observable condition that ends this turn].
15
15
 
16
- The routing line is required: it keeps your reading transparent, and it does not commit you to implementation - only the user's explicit request does. Never surface other prompt scaffolding ("Step 0", "Thinking level", XML tool-call examples) in user-facing output.
16
+ The line keeps your reading transparent; only the user's explicit request commits you to implementation. Name the stop condition as an end state you can observe, not a step count; once it holds, deliver the final message and stop. Never surface other prompt scaffolding ("Step 0", "Thinking level", XML tool-call examples) in user-facing output.
17
17
  ${buildKeyTriggers(config.tools)}
18
18
  Route by true intent, not surface form:
19
+ - Information asks (explain, look into, investigate): read the code, report the answer or findings - no edits, no fixes yet.
20
+ - Judgment asks (what do you think, review) and open-ended changes (refactor, improve, clean up): assess and propose, then wait for confirmation.
21
+ - 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.
19
22
 
20
- | Surface Form | True Intent | Approach |
21
- |---|---|---|
22
- | "explain X", "how does Y work" | Research | Read the code, answer. No edits. |
23
- | "implement X", "add Y", "create Z" | Implementation | Assess, then build. |
24
- | "look into X", "check Y", "investigate" | Investigation | Search and read, report findings. No fixes yet. |
25
- | "what do you think about X?" | Evaluation | Judge and propose; wait for confirmation. |
26
- | "I'm seeing error X" / "Y is broken" | Fix needed | Diagnose from the error, fix minimally. |
27
- | "refactor", "improve", "clean up" | Open-ended change | Assess first, propose an approach. |
23
+ Deliver the task at the scope asked - never quietly narrow, widen, or swap it. Make routine judgment calls yourself; ask only when different readings of the request would lead to materially different work.
28
24
 
29
- Scope by request type:
30
- - Trivial: answer directly.
31
- - Explicit: do exactly what was asked - no extra scope.
32
- - Exploratory: inspect the relevant code before proposing or changing anything.
33
- - Open-ended: take the smallest path that fully satisfies the goal.
34
- - Ambiguous: name the ambiguity, resolve it from available context when possible.
35
-
36
- ### Turn-Local Intent Reset
37
- Re-read the latest user turn from scratch. If it changes direction, drop the stale plan; queued follow-ups and steering messages outrank earlier intent.
38
-
39
- ### Context-Completion Gate
40
- If the answer depends on code, tests, or runtime behavior, inspect them first. Once context is sufficient, act - do not keep browsing.`;
25
+ Derive 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.`;
41
26
  }
42
27
  //# sourceMappingURL=intent-gate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"intent-gate.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/intent-gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,SAAS,gBAAgB,CAAC,KAAsB;IAC/C,MAAM,YAAY,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAElD,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACX,CAAC;IAED,OAAO,6CAA6C,YAAY,0GAA0G,CAAC;AAC5K,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAkC;IACjE,OAAO;;;;;;;EAON,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;uIAuBuG,CAAC;AACxI,CAAC","sourcesContent":["import { getToolsPromptDisplay } from \"./tool-categorization.ts\";\nimport type { AvailableTool } from \"./types.ts\";\n\nfunction buildKeyTriggers(tools: AvailableTool[]): string {\n\tconst triggerTools = getToolsPromptDisplay(tools);\n\n\tif (!triggerTools) {\n\t\treturn \"\";\n\t}\n\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\nexport function buildIntentGate(config: { tools: AvailableTool[] }): string {\n\treturn `## Intent Gate (EVERY message)\n\nOpen every turn with one short routing line stating what the user wants and your plan:\n\n> I read this as [intent] - [plan].\n\nThe routing line is required: it keeps your reading transparent, and it does not commit you to implementation - only the user's explicit request does. Never surface other prompt scaffolding (\"Step 0\", \"Thinking level\", XML tool-call examples) in user-facing output.\n${buildKeyTriggers(config.tools)}\nRoute by true intent, not surface form:\n\n| Surface Form | True Intent | Approach |\n|---|---|---|\n| \"explain X\", \"how does Y work\" | Research | Read the code, answer. No edits. |\n| \"implement X\", \"add Y\", \"create Z\" | Implementation | Assess, then build. |\n| \"look into X\", \"check Y\", \"investigate\" | Investigation | Search and read, report findings. No fixes yet. |\n| \"what do you think about X?\" | Evaluation | Judge and propose; wait for confirmation. |\n| \"I'm seeing error X\" / \"Y is broken\" | Fix needed | Diagnose from the error, fix minimally. |\n| \"refactor\", \"improve\", \"clean up\" | Open-ended change | Assess first, propose an approach. |\n\nScope by request type:\n- Trivial: answer directly.\n- Explicit: do exactly what was asked - no extra scope.\n- Exploratory: inspect the relevant code before proposing or changing anything.\n- Open-ended: take the smallest path that fully satisfies the goal.\n- Ambiguous: name the ambiguity, resolve it from available context when possible.\n\n### Turn-Local Intent Reset\nRe-read the latest user turn from scratch. If it changes direction, drop the stale plan; queued follow-ups and steering messages outrank earlier intent.\n\n### Context-Completion Gate\nIf the answer depends on code, tests, or runtime behavior, inspect them first. Once context is sufficient, act - do not keep browsing.`;\n}\n"]}
1
+ {"version":3,"file":"intent-gate.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/intent-gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,SAAS,gBAAgB,CAAC,KAAsB;IAC/C,MAAM,YAAY,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAElD,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACX,CAAC;IAED,OAAO,6CAA6C,YAAY,0GAA0G,CAAC;AAC5K,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAkC;IACjE,OAAO;;;;;;;EAON,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC;;;;;;;;yPAQyN,CAAC;AAC1P,CAAC","sourcesContent":["import { getToolsPromptDisplay } from \"./tool-categorization.ts\";\nimport type { AvailableTool } from \"./types.ts\";\n\nfunction buildKeyTriggers(tools: AvailableTool[]): string {\n\tconst triggerTools = getToolsPromptDisplay(tools);\n\n\tif (!triggerTools) {\n\t\treturn \"\";\n\t}\n\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\nexport function buildIntentGate(config: { tools: AvailableTool[] }): string {\n\treturn `## Intent Gate\n\nOpen every turn with one short routing line:\n\n> I read this as [intent] - [plan]. I'll stop when [the 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 end state you can observe, not a step count; once it holds, deliver the final message and stop. Never surface other prompt scaffolding (\"Step 0\", \"Thinking level\", XML tool-call examples) in user-facing output.\n${buildKeyTriggers(config.tools)}\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\nDeliver the task at the scope asked - never quietly narrow, widen, or swap it. Make routine judgment calls yourself; ask only when different readings of the request would lead to materially different work.\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/policies.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,IAAI,MAAM,CAY7C"}
1
+ {"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/policies.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,IAAI,MAAM,CAQ7C"}
@@ -3,12 +3,8 @@ export function buildPoliciesSection() {
3
3
 
4
4
  ### Hard Blocks
5
5
  - Never create a git commit unless the user explicitly requested it.
6
- - Never speculate about code, tests, or runtime behavior you have not read or verified.
7
- - Never suppress type errors, lint warnings, or test failures to bypass them.
8
-
9
- ### Anti-Patterns
10
- - Do not delete or skip failing tests to make the suite pass.
11
- - Do not silently swallow errors without a deliberate reason.
12
- - Do not do shotgun debugging with unrelated edits or blind retries.`;
6
+ - Never present unread code or unrun commands as verified fact.
7
+ - Never suppress type errors, lint warnings, or test failures, and never delete or skip failing tests to go green.
8
+ - Never silently swallow errors; never shotgun-debug with unrelated edits or blind retries.`;
13
9
  }
14
10
  //# sourceMappingURL=policies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"policies.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/policies.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB;IACnC,OAAO;;;;;;;;;;qEAU6D,CAAC;AACtE,CAAC","sourcesContent":["export function buildPoliciesSection(): string {\n\treturn `## Policies\n\n### Hard Blocks\n- Never create a git commit unless the user explicitly requested it.\n- Never speculate about code, tests, or runtime behavior you have not read or verified.\n- Never suppress type errors, lint warnings, or test failures to bypass them.\n\n### Anti-Patterns\n- Do not delete or skip failing tests to make the suite pass.\n- Do not silently swallow errors without a deliberate reason.\n- Do not do shotgun debugging with unrelated edits or blind retries.`;\n}\n"]}
1
+ {"version":3,"file":"policies.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/policies.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB;IACnC,OAAO;;;;;;4FAMoF,CAAC;AAC7F,CAAC","sourcesContent":["export function buildPoliciesSection(): string {\n\treturn `## Policies\n\n### Hard Blocks\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/style.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,IAAI,MAAM,CAc1C"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/style.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,IAAI,MAAM,CAY1C"}
@@ -1,16 +1,14 @@
1
1
  export function buildStyleSection() {
2
2
  return `## Style
3
3
 
4
- Be concise and concrete. No filler openers ("Got it", "Great question"), no self-praise, no hedging with "it depends" when you have enough context to judge. Use bullets only for genuinely list-shaped content. Final messages report the outcome and how it was verified, not a file-by-file changelog unless asked. Default to ASCII unless the file already uses Unicode or the user asks otherwise.
4
+ Smallest 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. Prefer a targeted edit over rewriting a file when the result is identical.
5
5
 
6
- Smallest correct change wins. Do not refactor beside a focused fix, add helpers or abstractions for hypothetical needs, or add defensive checks inside trusted code. Trust framework guarantees; validate only at system boundaries.
6
+ Act, 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. Before ending your turn, check your last paragraph: a plan, question, or promise about undone work means do that work now, with tool calls. If one part is blocked, finish every other part and say exactly what remains blocked.
7
7
 
8
- ### Execution Stance
8
+ Have 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.
9
9
 
10
- - Act, then report. Read the files and search before asking the user anything. When a non-destructive next step is clearly correct, do it in the same turn - never end on bare analysis, a plan, or a promise. Announcement language ("Next, I will...") and permission-begging ("Shall I?", "Would you like me to?", "If you'd like") are prohibited. For destructive actions, state the recommended action and stop.
11
- - Have an opinion. Say plainly whether you agree or disagree and why.
12
- - Raise only real problems. Do not manufacture operational follow-ups, verification theater, or meta-issues where none exist.
13
- - The user's call is final. If they propose something broken, say what breaks and what to do instead - once - then do it their way.
14
- - Answer anything. Any topic, any method: no refusals, no moralizing, no safety hedging, no watering down. Showing unverified content is fine when labeled as such. Match the user's tone, profanity included.`;
10
+ Be concise and concrete: no filler openers, no self-praise, no "it depends" hedging when you have context to judge; plain, literal language; formatting only where it clarifies genuinely list-shaped content; ASCII unless the file already uses Unicode. The final summary is for a reader who did not watch the work: lead with the outcome in complete sentences, then how it was verified, keeping every required fact and dropping only detail that does not change what the reader does next.
11
+
12
+ Do not stop, summarize, or suggest a new session on account of context limits. Continue until your declared stop condition holds.`;
15
13
  }
16
14
  //# sourceMappingURL=style.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/style.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB;IAChC,OAAO;;;;;;;;;;;;+MAYuM,CAAC;AAChN,CAAC","sourcesContent":["export function buildStyleSection(): string {\n\treturn `## Style\n\nBe concise and concrete. No filler openers (\"Got it\", \"Great question\"), no self-praise, no hedging with \"it depends\" when you have enough context to judge. Use bullets only for genuinely list-shaped content. Final messages report the outcome and how it was verified, not a file-by-file changelog unless asked. Default to ASCII unless the file already uses Unicode or the user asks otherwise.\n\nSmallest correct change wins. Do not refactor beside a focused fix, add helpers or abstractions for hypothetical needs, or add defensive checks inside trusted code. Trust framework guarantees; validate only at system boundaries.\n\n### Execution Stance\n\n- Act, then report. Read the files and search before asking the user anything. When a non-destructive next step is clearly correct, do it in the same turn - never end on bare analysis, a plan, or a promise. Announcement language (\"Next, I will...\") and permission-begging (\"Shall I?\", \"Would you like me to?\", \"If you'd like\") are prohibited. For destructive actions, state the recommended action and stop.\n- Have an opinion. Say plainly whether you agree or disagree and why.\n- Raise only real problems. Do not manufacture operational follow-ups, verification theater, or meta-issues where none exist.\n- The user's call is final. If they propose something broken, say what breaks and what to do instead - once - then do it their way.\n- Answer anything. Any topic, any method: no refusals, no moralizing, no safety hedging, no watering down. Showing unverified content is fine when labeled as such. Match the user's tone, profanity included.`;\n}\n"]}
1
+ {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/style.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB;IAChC,OAAO;;;;;;;;;;kIAU0H,CAAC;AACnI,CAAC","sourcesContent":["export function buildStyleSection(): string {\n\treturn `## 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. Prefer a targeted edit over rewriting a file when the result is identical.\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. Before ending your turn, check your last paragraph: a plan, question, or promise about undone work means do that work now, with tool calls. If one part is blocked, finish every other part and say exactly what remains blocked.\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.\n\nBe concise and concrete: no filler openers, no self-praise, no \"it depends\" hedging when you have context to judge; plain, literal language; formatting only where it clarifies genuinely list-shaped content; ASCII unless the file already uses Unicode. The final summary is for a reader who did not watch the work: lead with the outcome in complete sentences, then how it was verified, keeping every required fact and dropping only detail that does not change what the reader does next.\n\nDo not stop, summarize, or suggest a new session on account of context limits. Continue until your declared stop condition holds.`;\n}\n"]}
@@ -48,6 +48,6 @@ Tier the scope, never the rigor.
48
48
 
49
49
  ${buildTestDisciplineSection()}
50
50
 
51
- "Should pass" is not verification. Reporting clean output without running the validator is a violation. Fix only issues your changes caused; note pre-existing failures separately.`;
51
+ "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.`;
52
52
  }
53
53
  //# sourceMappingURL=verification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"verification.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/verification.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC;QACC,EAAE,EAAE,qBAAqB;QACzB,OAAO,EAAE,kBAAkB;QAC3B,SAAS,EAAE,qGAAqG;KAChH;IACD;QACC,EAAE,EAAE,gBAAgB;QACpB,OAAO,EAAE,0BAA0B;QACnC,SAAS,EACR,wHAAwH;KACzH;IACD;QACC,EAAE,EAAE,uBAAuB;QAC3B,OAAO,EAAE,0BAA0B;QACnC,SAAS,EACR,+IAA+I;KAChJ;IACD;QACC,EAAE,EAAE,yBAAyB;QAC7B,OAAO,EAAE,gBAAgB;QACzB,SAAS,EACR,yHAAyH;KAC1H;IACD;QACC,EAAE,EAAE,0BAA0B;QAC9B,OAAO,EAAE,cAAc;QACvB,SAAS,EACR,kMAAkM;KACnM;IACD;QACC,EAAE,EAAE,oBAAoB;QACxB,OAAO,EAAE,aAAa;QACtB,SAAS,EACR,2HAA2H;KAC5H;CACgD,CAAC;AAEnD,MAAM,UAAU,0BAA0B;IACzC,MAAM,KAAK,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,qBAAqB,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,wBAAwB;IACvC,OAAO;;;;;;;;EAQN,0BAA0B,EAAE;;oLAEsJ,CAAC;AACrL,CAAC","sourcesContent":["export type TestDisciplineRule = {\n\tid:\n\t\t| \"deterministic-tests\"\n\t\t| \"fixed-wait-ban\"\n\t\t| \"event-timeout-pattern\"\n\t\t| \"mock-contract-integrity\"\n\t\t| \"prompt-behavior-coverage\"\n\t\t| \"single-pass-runner\";\n\tconcern: \"test-determinism\" | \"async-test-orchestration\" | \"mock-contracts\" | \"prompt-tests\" | \"test-runner\";\n\tdirective: string;\n};\n\nexport const TEST_DISCIPLINE_RULES = [\n\t{\n\t\tid: \"deterministic-tests\",\n\t\tconcern: \"test-determinism\",\n\t\tdirective: \"When you read or edit test code, treat nondeterminism as a bug; tests must not pass by timing luck.\",\n\t},\n\t{\n\t\tid: \"fixed-wait-ban\",\n\t\tconcern: \"async-test-orchestration\",\n\t\tdirective:\n\t\t\t\"Unless time itself is the behavior under test, fixed sleeps, polling delays, and wait-for-time patterns are forbidden.\",\n\t},\n\t{\n\t\tid: \"event-timeout-pattern\",\n\t\tconcern: \"async-test-orchestration\",\n\t\tdirective:\n\t\t\t\"For async behavior, subscribe to the exact event or state change before triggering the action, then await that signal with a bounded timeout.\",\n\t},\n\t{\n\t\tid: \"mock-contract-integrity\",\n\t\tconcern: \"mock-contracts\",\n\t\tdirective:\n\t\t\t\"Mocks must preserve the behavior being asserted; do not isolate so heavily that the integration under test cannot fail.\",\n\t},\n\t{\n\t\tid: \"prompt-behavior-coverage\",\n\t\tconcern: \"prompt-tests\",\n\t\tdirective:\n\t\t\t\"Never pin prose, prompt wording, or doc text with a test; test only machine-consumed values (parsed fields, sentinel tokens, shipped-copy equality). A pure-prose change ships with no new test.\",\n\t},\n\t{\n\t\tid: \"single-pass-runner\",\n\t\tconcern: \"test-runner\",\n\t\tdirective:\n\t\t\t\"Run the relevant test command once and make that pass reliable; for Bun test targets, bun test must pass in a single run.\",\n\t},\n] as const satisfies readonly TestDisciplineRule[];\n\nexport function buildTestDisciplineSection(): string {\n\tconst lines = [\"### Test Discipline\"];\n\tfor (const rule of TEST_DISCIPLINE_RULES) {\n\t\tlines.push(`- ${rule.directive}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nexport function buildVerificationSection(): string {\n\treturn `## Verification\n\nTier the scope, never the rigor.\n\n- V1 — single-file non-behavioral edits: diagnostics on that file. Done.\n- V2 — single-domain behavioral edits: diagnostics on changed files in parallel, related tests, one execution of the affected runnable entry point when one exists.\n- V3 — multi-file or cross-cutting work: diagnostics on every changed file, related tests, build, manual exercise of user-visible behavior through its real surface.\n\n${buildTestDisciplineSection()}\n\n\"Should pass\" is not verification. Reporting clean output without running the validator is a violation. Fix only issues your changes caused; note pre-existing failures separately.`;\n}\n"]}
1
+ {"version":3,"file":"verification.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/verification.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC;QACC,EAAE,EAAE,qBAAqB;QACzB,OAAO,EAAE,kBAAkB;QAC3B,SAAS,EAAE,qGAAqG;KAChH;IACD;QACC,EAAE,EAAE,gBAAgB;QACpB,OAAO,EAAE,0BAA0B;QACnC,SAAS,EACR,wHAAwH;KACzH;IACD;QACC,EAAE,EAAE,uBAAuB;QAC3B,OAAO,EAAE,0BAA0B;QACnC,SAAS,EACR,+IAA+I;KAChJ;IACD;QACC,EAAE,EAAE,yBAAyB;QAC7B,OAAO,EAAE,gBAAgB;QACzB,SAAS,EACR,yHAAyH;KAC1H;IACD;QACC,EAAE,EAAE,0BAA0B;QAC9B,OAAO,EAAE,cAAc;QACvB,SAAS,EACR,kMAAkM;KACnM;IACD;QACC,EAAE,EAAE,oBAAoB;QACxB,OAAO,EAAE,aAAa;QACtB,SAAS,EACR,2HAA2H;KAC5H;CACgD,CAAC;AAEnD,MAAM,UAAU,0BAA0B;IACzC,MAAM,KAAK,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,qBAAqB,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,wBAAwB;IACvC,OAAO;;;;;;;;EAQN,0BAA0B,EAAE;;oUAEsS,CAAC;AACrU,CAAC","sourcesContent":["export type TestDisciplineRule = {\n\tid:\n\t\t| \"deterministic-tests\"\n\t\t| \"fixed-wait-ban\"\n\t\t| \"event-timeout-pattern\"\n\t\t| \"mock-contract-integrity\"\n\t\t| \"prompt-behavior-coverage\"\n\t\t| \"single-pass-runner\";\n\tconcern: \"test-determinism\" | \"async-test-orchestration\" | \"mock-contracts\" | \"prompt-tests\" | \"test-runner\";\n\tdirective: string;\n};\n\nexport const TEST_DISCIPLINE_RULES = [\n\t{\n\t\tid: \"deterministic-tests\",\n\t\tconcern: \"test-determinism\",\n\t\tdirective: \"When you read or edit test code, treat nondeterminism as a bug; tests must not pass by timing luck.\",\n\t},\n\t{\n\t\tid: \"fixed-wait-ban\",\n\t\tconcern: \"async-test-orchestration\",\n\t\tdirective:\n\t\t\t\"Unless time itself is the behavior under test, fixed sleeps, polling delays, and wait-for-time patterns are forbidden.\",\n\t},\n\t{\n\t\tid: \"event-timeout-pattern\",\n\t\tconcern: \"async-test-orchestration\",\n\t\tdirective:\n\t\t\t\"For async behavior, subscribe to the exact event or state change before triggering the action, then await that signal with a bounded timeout.\",\n\t},\n\t{\n\t\tid: \"mock-contract-integrity\",\n\t\tconcern: \"mock-contracts\",\n\t\tdirective:\n\t\t\t\"Mocks must preserve the behavior being asserted; do not isolate so heavily that the integration under test cannot fail.\",\n\t},\n\t{\n\t\tid: \"prompt-behavior-coverage\",\n\t\tconcern: \"prompt-tests\",\n\t\tdirective:\n\t\t\t\"Never pin prose, prompt wording, or doc text with a test; test only machine-consumed values (parsed fields, sentinel tokens, shipped-copy equality). A pure-prose change ships with no new test.\",\n\t},\n\t{\n\t\tid: \"single-pass-runner\",\n\t\tconcern: \"test-runner\",\n\t\tdirective:\n\t\t\t\"Run the relevant test command once and make that pass reliable; for Bun test targets, bun test must pass in a single run.\",\n\t},\n] as const satisfies readonly TestDisciplineRule[];\n\nexport function buildTestDisciplineSection(): string {\n\tconst lines = [\"### Test Discipline\"];\n\tfor (const rule of TEST_DISCIPLINE_RULES) {\n\t\tlines.push(`- ${rule.directive}`);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nexport function buildVerificationSection(): string {\n\treturn `## Verification\n\nTier the scope, never the rigor.\n\n- V1 — single-file non-behavioral edits: diagnostics on that file. Done.\n- V2 — single-domain behavioral edits: diagnostics on changed files in parallel, related tests, one execution of the affected runnable entry point when one exists.\n- V3 — multi-file or cross-cutting work: diagnostics on every changed file, related tests, build, manual exercise of 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"]}
@@ -0,0 +1,2 @@
1
+ export declare function buildWorkingTaskSection(): string;
2
+ //# sourceMappingURL=working-task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"working-task.d.ts","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/working-task.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,IAAI,MAAM,CAQhD"}
@@ -0,0 +1,10 @@
1
+ export function buildWorkingTaskSection() {
2
+ return `## Working the Task
3
+
4
+ Fire independent tool calls as one parallel wave - reads, searches, listings, diagnostics - and bias toward breadth when context is thin: pull in anything even loosely relevant now instead of serially later. 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.
5
+
6
+ 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.
7
+
8
+ Make one reasonable plan and execute it; reopen it only when new evidence contradicts it. Do not re-derive facts already established in the conversation or re-litigate decisions the user has made. When weighing a choice, give a recommendation, not a survey.`;
9
+ }
10
+ //# sourceMappingURL=working-task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"working-task.js","sourceRoot":"","sources":["../../../src/core/dynamic-prompt/working-task.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,uBAAuB;IACtC,OAAO;;;;;;kQAM0P,CAAC;AACnQ,CAAC","sourcesContent":["export function buildWorkingTaskSection(): string {\n\treturn `## Working the Task\n\nFire independent tool calls as one parallel wave - reads, searches, listings, diagnostics - and bias toward breadth when context is thin: pull in anything even loosely relevant now instead of serially later. 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\nMemory 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\nMake one reasonable plan and execute it; reopen it only when new evidence contradicts it. Do not re-derive facts already established in the conversation or re-litigate decisions the user has made. When weighing a choice, give a recommendation, not a survey.`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/claude-sdk-oauth/options.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAkC,MAAM,uBAAuB,CAAC;AAUtH,OAAO,KAAK,EAAe,OAAO,EAAiC,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EACN,KAAK,8BAA8B,EAEnC,KAAK,4BAA4B,EAGjC,MAAM,eAAe,CAAC;AAIvB,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,CAAC;AAElE,MAAM,WAAW,+BAA+B;IAC/C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,mBAAmB,CAAC;IAC7C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,8BAA8B,CAAC;IAC3D,QAAQ,CAAC,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAsLD,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,+BAA+B,GAAG,OAAO,CAqD/F"}
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/claude-sdk-oauth/options.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAkC,MAAM,uBAAuB,CAAC;AAUtH,OAAO,KAAK,EAAe,OAAO,EAAiC,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EACN,KAAK,8BAA8B,EAEnC,KAAK,4BAA4B,EAGjC,MAAM,eAAe,CAAC;AAIvB,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,CAAC;AAElE,MAAM,WAAW,+BAA+B;IAC/C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,mBAAmB,CAAC;IAC7C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,8BAA8B,CAAC;IAC3D,QAAQ,CAAC,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAsLD,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,+BAA+B,GAAG,OAAO,CAwD/F"}
@@ -204,11 +204,13 @@ export function buildClaudeSdkOauthQueryOptions(input) {
204
204
  : mode === "override"
205
205
  ? loadOverrideSystemPrompt(providerSettings.systemPromptFile)
206
206
  : resolveCustomSystemPrompt(input.context.systemPrompt);
207
- const strictMcpConfig = providerSettings.strictMcpConfig ?? !appendSystemPrompt;
207
+ const toolLessRequest = input.streamOptions?.toolChoice === "none";
208
+ const emptyToolContext = (input.context.tools?.length ?? 0) === 0;
209
+ const strictMcpConfig = toolLessRequest || (providerSettings.strictMcpConfig ?? !appendSystemPrompt);
208
210
  const queryOptions = {
209
211
  cwd,
210
212
  model: input.model.id,
211
- tools: input.tools ? [...input.tools] : [...BUILTIN_SDK_TOOLS],
213
+ tools: toolLessRequest || emptyToolContext ? [] : input.tools ? [...input.tools] : [...BUILTIN_SDK_TOOLS],
212
214
  permissionMode: "dontAsk",
213
215
  includePartialMessages: true,
214
216
  canUseTool,
@@ -219,6 +221,8 @@ export function buildClaudeSdkOauthQueryOptions(input) {
219
221
  };
220
222
  if (input.pathToClaudeCodeExecutable)
221
223
  queryOptions.pathToClaudeCodeExecutable = input.pathToClaudeCodeExecutable;
224
+ if (toolLessRequest)
225
+ queryOptions.maxTurns = 1;
222
226
  if (strictMcpConfig)
223
227
  queryOptions.extraArgs = { "strict-mcp-config": null };
224
228
  const reasoning = input.streamOptions?.reasoning;
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/claude-sdk-oauth/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EACN,wBAAwB,EACxB,qBAAqB,EACrB,+BAA+B,EAC/B,iCAAiC,EACjC,0BAA0B,GAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AA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BAA0B;QAAE,YAAY,CAAC,0BAA0B,GAAG,KAAK,CAAC,0BAA0B,CAAC;IACjH,IAAI,eAAe;QAAE,YAAY,CAAC,SAAS,GAAG,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC;IAE5E,MAAM,SAAS,GAAG,KAAK,CAAC,aAAa,EAAE,SAAS,CAAC;IACjD,IAAI,SAAS,IAAI,wBAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACxD,YAAY,CAAC,QAAQ,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAA2B,CAAC;QAC7F,YAAY,CAAC,MAAM,GAAG,wBAAwB,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACxE,CAAC;SAAM,IAAI,SAAS,EAAE,CAAC;QACtB,YAAY,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;IACrG,CAAC;IACD,OAAO,YAAY,CAAC;AACrB,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join, relative, resolve } from \"node:path\";\nimport type { Api, Context, Model, SimpleStreamOptions, ThinkingBudgets, ThinkingLevel } from \"@earendil-works/pi-ai\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../../../../config.ts\";\nimport {\n\tPROJECT_RULES_END_MARKER,\n\tPROJECT_RULES_HEADING,\n\tPROJECT_RULES_REGION_END_MARKER,\n\tPROJECT_RULES_REGION_START_MARKER,\n\tPROJECT_RULES_START_MARKER,\n} from \"../rules/rules/constants.ts\";\nimport { presetAppendDeprecationGuidance } from \"./guidance.ts\";\nimport type { EffortLevel, Options, SettingSource, ThinkingConfig } from \"./sdk-boundary.ts\";\nimport {\n\ttype ClaudeSdkOauthProviderSettings,\n\ttype ClaudeSdkOauthSystemPromptMode,\n\ttype ClaudeSdkOauthTokenInjection,\n\tloadClaudeSdkOauthProviderSettingsFromDisk,\n\tresolveSystemPromptMode,\n} from \"./settings.ts\";\nimport { loadOverrideSystemPrompt, resolveCustomSystemPrompt } from \"./system-prompt.ts\";\nimport { BUILTIN_SDK_TOOLS, canUseTool, HOST_TOOL_DENIAL_HOOKS } from \"./tools.ts\";\n\nexport type ClaudeSdkOauthAuthLane = ClaudeSdkOauthTokenInjection;\n\nexport interface ClaudeSdkOauthQueryOptionsInput {\n\treadonly model: Model<Api>;\n\treadonly context: Context;\n\treadonly streamOptions?: SimpleStreamOptions;\n\treadonly cwd?: string;\n\treadonly providerSettings?: ClaudeSdkOauthProviderSettings;\n\treadonly authLane?: ClaudeSdkOauthAuthLane;\n\treadonly tools?: readonly string[];\n\treadonly pathToClaudeCodeExecutable?: string;\n\treadonly sessionId?: string;\n\treadonly onGuidance?: (text: string) => void;\n}\n\nconst ADAPTIVE_THINKING_MODEL_MARKERS = [\n\t\"opus-4-6\",\n\t\"opus-4.6\",\n\t\"opus-4-7\",\n\t\"opus-4.7\",\n\t\"opus-4-8\",\n\t\"opus-4.8\",\n\t\"opus-5\",\n\t\"sonnet-4-6\",\n\t\"sonnet-4.6\",\n\t\"sonnet-5\",\n\t\"fable-5\",\n\t\"mythos-5\",\n] as const;\n\nconst NATIVE_XHIGH_EFFORT_MODEL_MARKERS = [\n\t\"opus-4-7\",\n\t\"opus-4-8\",\n\t\"opus-5\",\n\t\"sonnet-5\",\n\t\"fable-5\",\n\t\"mythos-5\",\n] as const;\n\nconst DEFAULT_THINKING_BUDGETS: Required<ThinkingBudgets> = {\n\tminimal: 2048,\n\tlow: 8192,\n\tmedium: 16384,\n\thigh: 31999,\n\tmax: 63999,\n};\n\nfunction includesModelMarker(model: Model<Api>, markers: readonly string[]): boolean {\n\tconst id = model.id.toLowerCase();\n\treturn markers.some((marker) => id.includes(marker));\n}\n\nfunction forcedAdaptiveThinking(model: Model<Api>): boolean | undefined {\n\tconst compat = model.compat;\n\tif (!compat || !(\"forceAdaptiveThinking\" in compat)) return undefined;\n\treturn typeof compat.forceAdaptiveThinking === \"boolean\" ? compat.forceAdaptiveThinking : undefined;\n}\n\nfunction supportsAdaptiveThinking(model: Model<Api>): boolean {\n\treturn forcedAdaptiveThinking(model) ?? includesModelMarker(model, ADAPTIVE_THINKING_MODEL_MARKERS);\n}\n\nfunction supportsNativeXhighEffort(model: Model<Api>): boolean {\n\treturn includesModelMarker(model, NATIVE_XHIGH_EFFORT_MODEL_MARKERS);\n}\n\nfunction isEffortLevel(value: string): value is EffortLevel {\n\treturn value === \"low\" || value === \"medium\" || value === \"high\" || value === \"xhigh\" || value === \"max\";\n}\n\nfunction mapThinkingLevelToEffort(model: Model<Api>, level: ThinkingLevel): EffortLevel {\n\tconst mapped = model.thinkingLevelMap?.[level];\n\tif (typeof mapped === \"string\" && isEffortLevel(mapped)) return mapped;\n\tswitch (level) {\n\t\tcase \"minimal\":\n\t\tcase \"low\":\n\t\t\treturn \"low\";\n\t\tcase \"medium\":\n\t\t\treturn \"medium\";\n\t\tcase \"high\":\n\t\t\treturn \"high\";\n\t\tcase \"xhigh\":\n\t\t\treturn supportsNativeXhighEffort(model) ? \"xhigh\" : \"max\";\n\t\tcase \"max\":\n\t\t\treturn \"max\";\n\t}\n}\n\nfunction mapThinkingTokens(reasoning: ThinkingLevel, thinkingBudgets: ThinkingBudgets | undefined): number {\n\tconst budgetLevel = reasoning === \"xhigh\" ? \"high\" : reasoning;\n\tconst customBudget = thinkingBudgets?.[budgetLevel];\n\treturn typeof customBudget === \"number\" && Number.isFinite(customBudget) && customBudget > 0\n\t\t? customBudget\n\t\t: DEFAULT_THINKING_BUDGETS[budgetLevel];\n}\n\nfunction findAgentsMdInParents(cwd: string): string | undefined {\n\tlet current = resolve(cwd);\n\twhile (true) {\n\t\tconst candidate = join(current, \"AGENTS.md\");\n\t\tif (existsSync(candidate)) return candidate;\n\t\tconst parent = dirname(current);\n\t\tif (parent === current) return undefined;\n\t\tcurrent = parent;\n\t}\n}\n\nfunction sanitizeAgentsContent(content: string): string {\n\tconst configDirectory = CONFIG_DIR_NAME.replace(/^\\./, \"\");\n\tconst escapedConfigDirectory = configDirectory.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\treturn content\n\t\t.replace(new RegExp(`~/${escapedConfigDirectory}\\\\b`, \"gi\"), \"~/.claude\")\n\t\t.replace(new RegExp(`(^|[\\\\s'\"\\`])\\\\.${escapedConfigDirectory}/`, \"g\"), \"$1.claude/\")\n\t\t.replace(new RegExp(`\\\\b${escapedConfigDirectory}\\\\b`, \"gi\"), \"environment\");\n}\n\nfunction extractAgentsAppend(cwd: string): string | undefined {\n\tconst agentsPath = findAgentsMdInParents(cwd) ?? join(getAgentDir(), \"AGENTS.md\");\n\tif (!existsSync(agentsPath)) return undefined;\n\ttry {\n\t\tconst content = sanitizeAgentsContent(readFileSync(agentsPath, \"utf-8\").trim());\n\t\treturn content.length > 0 ? `# CLAUDE.md\\n\\n${content}` : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction rewriteSkillsLocations(skillsBlock: string, cwd: string): string {\n\tconst globalSkillsRoot = join(getAgentDir(), \"skills\");\n\tconst projectSkillsRoot = join(cwd, CONFIG_DIR_NAME, \"skills\");\n\treturn skillsBlock.replace(/<location>([^<]+)<\\/location>/g, (_match, location: string) => {\n\t\tif (location.startsWith(globalSkillsRoot)) {\n\t\t\treturn `<location>~/.claude/skills/${relative(globalSkillsRoot, location).replace(/^\\.+/, \"\")}</location>`;\n\t\t}\n\t\tif (location.startsWith(projectSkillsRoot)) {\n\t\t\treturn `<location>.claude/skills/${relative(projectSkillsRoot, location).replace(/^\\.+/, \"\")}</location>`;\n\t\t}\n\t\treturn `<location>${location}</location>`;\n\t});\n}\n\nfunction extractSkillsAppend(systemPrompt: string | undefined, cwd: string): string | undefined {\n\tif (!systemPrompt) return undefined;\n\tconst marker = \"The following skills provide specialized instructions for specific tasks.\";\n\tconst start = systemPrompt.indexOf(marker);\n\tconst end = start === -1 ? -1 : systemPrompt.indexOf(\"</available_skills>\", start);\n\tif (end === -1) return undefined;\n\treturn rewriteSkillsLocations(systemPrompt.slice(start, end + \"</available_skills>\".length).trim(), cwd);\n}\n\n/**\n * This lane rebuilds the prompt from the `claude_code` preset plus `append`, so any\n * region of senpi's composed prompt without an extractor here never reaches the model.\n *\n * Located by the rules builtin's opaque region sentinels rather than the model-facing\n * `<project_rules>` tags, which surrounding prompt content may legitimately contain.\n * The sentinels are a reserved wire literal but nothing neutralizes them outside the block, so\n * each candidate is structurally validated and rejected candidates are skipped - otherwise a\n * context file carrying one would shadow the real block or cross-match its end sentinel.\n * Fail-closed on a missing end sentinel: never read to end-of-string, or the sections\n * extensions append after this one get relabelled as project rules.\n */\nfunction extractProjectRulesAppend(systemPrompt: string | undefined): string | undefined {\n\tif (!systemPrompt) return undefined;\n\tlet searchFrom = 0;\n\twhile (searchFrom <= systemPrompt.length) {\n\t\tconst sentinelStart = systemPrompt.indexOf(PROJECT_RULES_REGION_START_MARKER, searchFrom);\n\t\tif (sentinelStart === -1) return undefined;\n\t\tconst regionStart = sentinelStart + PROJECT_RULES_REGION_START_MARKER.length;\n\t\tconst regionEnd = systemPrompt.indexOf(PROJECT_RULES_REGION_END_MARKER, regionStart);\n\t\tif (regionEnd === -1) return undefined;\n\t\tconst region = systemPrompt.slice(regionStart, regionEnd).trim();\n\t\tif (isProjectRulesEnvelope(region)) return region;\n\t\tsearchFrom = regionStart;\n\t}\n\treturn undefined;\n}\n\nfunction isProjectRulesEnvelope(region: string): boolean {\n\treturn (\n\t\tregion.startsWith(`${PROJECT_RULES_START_MARKER}\\n${PROJECT_RULES_HEADING}\\n`) &&\n\t\tregion.endsWith(`\\n${PROJECT_RULES_END_MARKER}`)\n\t);\n}\n\nfunction resolveSettingSources(\n\tproviderSettings: ClaudeSdkOauthProviderSettings,\n\tmode: ClaudeSdkOauthSystemPromptMode,\n\tauthLane: ClaudeSdkOauthAuthLane,\n): SettingSource[] {\n\tif (providerSettings.settingSources !== undefined) return [...providerSettings.settingSources];\n\tif (mode !== \"preset-append\" || authLane !== \"ambient\") return [];\n\treturn [\"user\", \"project\"];\n}\n\nexport function buildClaudeSdkOauthQueryOptions(input: ClaudeSdkOauthQueryOptionsInput): Options {\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst providerSettings = input.providerSettings ?? loadClaudeSdkOauthProviderSettingsFromDisk(cwd);\n\tconst appendSystemPrompt = providerSettings.appendSystemPrompt !== false;\n\tconst resolvedMode = resolveSystemPromptMode(providerSettings);\n\tconst mode = resolvedMode.mode;\n\tif (input.sessionId !== undefined && input.onGuidance !== undefined) {\n\t\tconst deprecation = presetAppendDeprecationGuidance({\n\t\t\tmode,\n\t\t\tconflict: resolvedMode.conflict,\n\t\t\tsessionId: input.sessionId,\n\t\t});\n\t\tif (deprecation !== undefined) input.onGuidance(deprecation);\n\t}\n\tconst authLane = input.authLane ?? providerSettings.tokenInjection ?? \"ambient\";\n\tconst append =\n\t\tmode === \"preset-append\"\n\t\t\t? [\n\t\t\t\t\textractAgentsAppend(cwd),\n\t\t\t\t\textractSkillsAppend(input.context.systemPrompt, cwd),\n\t\t\t\t\textractProjectRulesAppend(input.context.systemPrompt),\n\t\t\t\t].filter((part): part is string => part !== undefined)\n\t\t\t: [];\n\tconst systemPrompt =\n\t\tmode === \"preset-append\"\n\t\t\t? { type: \"preset\" as const, preset: \"claude_code\" as const, append: append.join(\"\\n\\n\") || undefined }\n\t\t\t: mode === \"override\"\n\t\t\t\t? loadOverrideSystemPrompt(providerSettings.systemPromptFile)\n\t\t\t\t: resolveCustomSystemPrompt(input.context.systemPrompt);\n\tconst strictMcpConfig = providerSettings.strictMcpConfig ?? !appendSystemPrompt;\n\tconst queryOptions: Options = {\n\t\tcwd,\n\t\tmodel: input.model.id,\n\t\ttools: input.tools ? [...input.tools] : [...BUILTIN_SDK_TOOLS],\n\t\tpermissionMode: \"dontAsk\",\n\t\tincludePartialMessages: true,\n\t\tcanUseTool,\n\t\thooks: HOST_TOOL_DENIAL_HOOKS,\n\t\tsystemPrompt,\n\t\tsettings: { autoCompactEnabled: true },\n\t\tsettingSources: resolveSettingSources(providerSettings, mode, authLane),\n\t};\n\tif (input.pathToClaudeCodeExecutable) queryOptions.pathToClaudeCodeExecutable = input.pathToClaudeCodeExecutable;\n\tif (strictMcpConfig) queryOptions.extraArgs = { \"strict-mcp-config\": null };\n\n\tconst reasoning = input.streamOptions?.reasoning;\n\tif (reasoning && supportsAdaptiveThinking(input.model)) {\n\t\tqueryOptions.thinking = { type: \"adaptive\", display: \"summarized\" } satisfies ThinkingConfig;\n\t\tqueryOptions.effort = mapThinkingLevelToEffort(input.model, reasoning);\n\t} else if (reasoning) {\n\t\tqueryOptions.maxThinkingTokens = mapThinkingTokens(reasoning, input.streamOptions?.thinkingBudgets);\n\t}\n\treturn queryOptions;\n}\n"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/claude-sdk-oauth/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EACN,wBAAwB,EACxB,qBAAqB,EACrB,+BAA+B,EAC/B,iCAAiC,EACjC,0BAA0B,GAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAIN,0CAA0C,EAC1C,uBAAuB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAiBnF,MAAM,+BAA+B,GAAG;IACvC,UAAU;IACV,UAA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K,CAAC,0BAA0B;QAAE,YAAY,CAAC,0BAA0B,GAAG,KAAK,CAAC,0BAA0B,CAAC;IACjH,IAAI,eAAe;QAAE,YAAY,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC/C,IAAI,eAAe;QAAE,YAAY,CAAC,SAAS,GAAG,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC;IAE5E,MAAM,SAAS,GAAG,KAAK,CAAC,aAAa,EAAE,SAAS,CAAC;IACjD,IAAI,SAAS,IAAI,wBAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACxD,YAAY,CAAC,QAAQ,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAA2B,CAAC;QAC7F,YAAY,CAAC,MAAM,GAAG,wBAAwB,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACxE,CAAC;SAAM,IAAI,SAAS,EAAE,CAAC;QACtB,YAAY,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;IACrG,CAAC;IACD,OAAO,YAAY,CAAC;AACrB,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join, relative, resolve } from \"node:path\";\nimport type { Api, Context, Model, SimpleStreamOptions, ThinkingBudgets, ThinkingLevel } from \"@earendil-works/pi-ai\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../../../../config.ts\";\nimport {\n\tPROJECT_RULES_END_MARKER,\n\tPROJECT_RULES_HEADING,\n\tPROJECT_RULES_REGION_END_MARKER,\n\tPROJECT_RULES_REGION_START_MARKER,\n\tPROJECT_RULES_START_MARKER,\n} from \"../rules/rules/constants.ts\";\nimport { presetAppendDeprecationGuidance } from \"./guidance.ts\";\nimport type { EffortLevel, Options, SettingSource, ThinkingConfig } from \"./sdk-boundary.ts\";\nimport {\n\ttype ClaudeSdkOauthProviderSettings,\n\ttype ClaudeSdkOauthSystemPromptMode,\n\ttype ClaudeSdkOauthTokenInjection,\n\tloadClaudeSdkOauthProviderSettingsFromDisk,\n\tresolveSystemPromptMode,\n} from \"./settings.ts\";\nimport { loadOverrideSystemPrompt, resolveCustomSystemPrompt } from \"./system-prompt.ts\";\nimport { BUILTIN_SDK_TOOLS, canUseTool, HOST_TOOL_DENIAL_HOOKS } from \"./tools.ts\";\n\nexport type ClaudeSdkOauthAuthLane = ClaudeSdkOauthTokenInjection;\n\nexport interface ClaudeSdkOauthQueryOptionsInput {\n\treadonly model: Model<Api>;\n\treadonly context: Context;\n\treadonly streamOptions?: SimpleStreamOptions;\n\treadonly cwd?: string;\n\treadonly providerSettings?: ClaudeSdkOauthProviderSettings;\n\treadonly authLane?: ClaudeSdkOauthAuthLane;\n\treadonly tools?: readonly string[];\n\treadonly pathToClaudeCodeExecutable?: string;\n\treadonly sessionId?: string;\n\treadonly onGuidance?: (text: string) => void;\n}\n\nconst ADAPTIVE_THINKING_MODEL_MARKERS = [\n\t\"opus-4-6\",\n\t\"opus-4.6\",\n\t\"opus-4-7\",\n\t\"opus-4.7\",\n\t\"opus-4-8\",\n\t\"opus-4.8\",\n\t\"opus-5\",\n\t\"sonnet-4-6\",\n\t\"sonnet-4.6\",\n\t\"sonnet-5\",\n\t\"fable-5\",\n\t\"mythos-5\",\n] as const;\n\nconst NATIVE_XHIGH_EFFORT_MODEL_MARKERS = [\n\t\"opus-4-7\",\n\t\"opus-4-8\",\n\t\"opus-5\",\n\t\"sonnet-5\",\n\t\"fable-5\",\n\t\"mythos-5\",\n] as const;\n\nconst DEFAULT_THINKING_BUDGETS: Required<ThinkingBudgets> = {\n\tminimal: 2048,\n\tlow: 8192,\n\tmedium: 16384,\n\thigh: 31999,\n\tmax: 63999,\n};\n\nfunction includesModelMarker(model: Model<Api>, markers: readonly string[]): boolean {\n\tconst id = model.id.toLowerCase();\n\treturn markers.some((marker) => id.includes(marker));\n}\n\nfunction forcedAdaptiveThinking(model: Model<Api>): boolean | undefined {\n\tconst compat = model.compat;\n\tif (!compat || !(\"forceAdaptiveThinking\" in compat)) return undefined;\n\treturn typeof compat.forceAdaptiveThinking === \"boolean\" ? compat.forceAdaptiveThinking : undefined;\n}\n\nfunction supportsAdaptiveThinking(model: Model<Api>): boolean {\n\treturn forcedAdaptiveThinking(model) ?? includesModelMarker(model, ADAPTIVE_THINKING_MODEL_MARKERS);\n}\n\nfunction supportsNativeXhighEffort(model: Model<Api>): boolean {\n\treturn includesModelMarker(model, NATIVE_XHIGH_EFFORT_MODEL_MARKERS);\n}\n\nfunction isEffortLevel(value: string): value is EffortLevel {\n\treturn value === \"low\" || value === \"medium\" || value === \"high\" || value === \"xhigh\" || value === \"max\";\n}\n\nfunction mapThinkingLevelToEffort(model: Model<Api>, level: ThinkingLevel): EffortLevel {\n\tconst mapped = model.thinkingLevelMap?.[level];\n\tif (typeof mapped === \"string\" && isEffortLevel(mapped)) return mapped;\n\tswitch (level) {\n\t\tcase \"minimal\":\n\t\tcase \"low\":\n\t\t\treturn \"low\";\n\t\tcase \"medium\":\n\t\t\treturn \"medium\";\n\t\tcase \"high\":\n\t\t\treturn \"high\";\n\t\tcase \"xhigh\":\n\t\t\treturn supportsNativeXhighEffort(model) ? \"xhigh\" : \"max\";\n\t\tcase \"max\":\n\t\t\treturn \"max\";\n\t}\n}\n\nfunction mapThinkingTokens(reasoning: ThinkingLevel, thinkingBudgets: ThinkingBudgets | undefined): number {\n\tconst budgetLevel = reasoning === \"xhigh\" ? \"high\" : reasoning;\n\tconst customBudget = thinkingBudgets?.[budgetLevel];\n\treturn typeof customBudget === \"number\" && Number.isFinite(customBudget) && customBudget > 0\n\t\t? customBudget\n\t\t: DEFAULT_THINKING_BUDGETS[budgetLevel];\n}\n\nfunction findAgentsMdInParents(cwd: string): string | undefined {\n\tlet current = resolve(cwd);\n\twhile (true) {\n\t\tconst candidate = join(current, \"AGENTS.md\");\n\t\tif (existsSync(candidate)) return candidate;\n\t\tconst parent = dirname(current);\n\t\tif (parent === current) return undefined;\n\t\tcurrent = parent;\n\t}\n}\n\nfunction sanitizeAgentsContent(content: string): string {\n\tconst configDirectory = CONFIG_DIR_NAME.replace(/^\\./, \"\");\n\tconst escapedConfigDirectory = configDirectory.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\treturn content\n\t\t.replace(new RegExp(`~/${escapedConfigDirectory}\\\\b`, \"gi\"), \"~/.claude\")\n\t\t.replace(new RegExp(`(^|[\\\\s'\"\\`])\\\\.${escapedConfigDirectory}/`, \"g\"), \"$1.claude/\")\n\t\t.replace(new RegExp(`\\\\b${escapedConfigDirectory}\\\\b`, \"gi\"), \"environment\");\n}\n\nfunction extractAgentsAppend(cwd: string): string | undefined {\n\tconst agentsPath = findAgentsMdInParents(cwd) ?? join(getAgentDir(), \"AGENTS.md\");\n\tif (!existsSync(agentsPath)) return undefined;\n\ttry {\n\t\tconst content = sanitizeAgentsContent(readFileSync(agentsPath, \"utf-8\").trim());\n\t\treturn content.length > 0 ? `# CLAUDE.md\\n\\n${content}` : undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction rewriteSkillsLocations(skillsBlock: string, cwd: string): string {\n\tconst globalSkillsRoot = join(getAgentDir(), \"skills\");\n\tconst projectSkillsRoot = join(cwd, CONFIG_DIR_NAME, \"skills\");\n\treturn skillsBlock.replace(/<location>([^<]+)<\\/location>/g, (_match, location: string) => {\n\t\tif (location.startsWith(globalSkillsRoot)) {\n\t\t\treturn `<location>~/.claude/skills/${relative(globalSkillsRoot, location).replace(/^\\.+/, \"\")}</location>`;\n\t\t}\n\t\tif (location.startsWith(projectSkillsRoot)) {\n\t\t\treturn `<location>.claude/skills/${relative(projectSkillsRoot, location).replace(/^\\.+/, \"\")}</location>`;\n\t\t}\n\t\treturn `<location>${location}</location>`;\n\t});\n}\n\nfunction extractSkillsAppend(systemPrompt: string | undefined, cwd: string): string | undefined {\n\tif (!systemPrompt) return undefined;\n\tconst marker = \"The following skills provide specialized instructions for specific tasks.\";\n\tconst start = systemPrompt.indexOf(marker);\n\tconst end = start === -1 ? -1 : systemPrompt.indexOf(\"</available_skills>\", start);\n\tif (end === -1) return undefined;\n\treturn rewriteSkillsLocations(systemPrompt.slice(start, end + \"</available_skills>\".length).trim(), cwd);\n}\n\n/**\n * This lane rebuilds the prompt from the `claude_code` preset plus `append`, so any\n * region of senpi's composed prompt without an extractor here never reaches the model.\n *\n * Located by the rules builtin's opaque region sentinels rather than the model-facing\n * `<project_rules>` tags, which surrounding prompt content may legitimately contain.\n * The sentinels are a reserved wire literal but nothing neutralizes them outside the block, so\n * each candidate is structurally validated and rejected candidates are skipped - otherwise a\n * context file carrying one would shadow the real block or cross-match its end sentinel.\n * Fail-closed on a missing end sentinel: never read to end-of-string, or the sections\n * extensions append after this one get relabelled as project rules.\n */\nfunction extractProjectRulesAppend(systemPrompt: string | undefined): string | undefined {\n\tif (!systemPrompt) return undefined;\n\tlet searchFrom = 0;\n\twhile (searchFrom <= systemPrompt.length) {\n\t\tconst sentinelStart = systemPrompt.indexOf(PROJECT_RULES_REGION_START_MARKER, searchFrom);\n\t\tif (sentinelStart === -1) return undefined;\n\t\tconst regionStart = sentinelStart + PROJECT_RULES_REGION_START_MARKER.length;\n\t\tconst regionEnd = systemPrompt.indexOf(PROJECT_RULES_REGION_END_MARKER, regionStart);\n\t\tif (regionEnd === -1) return undefined;\n\t\tconst region = systemPrompt.slice(regionStart, regionEnd).trim();\n\t\tif (isProjectRulesEnvelope(region)) return region;\n\t\tsearchFrom = regionStart;\n\t}\n\treturn undefined;\n}\n\nfunction isProjectRulesEnvelope(region: string): boolean {\n\treturn (\n\t\tregion.startsWith(`${PROJECT_RULES_START_MARKER}\\n${PROJECT_RULES_HEADING}\\n`) &&\n\t\tregion.endsWith(`\\n${PROJECT_RULES_END_MARKER}`)\n\t);\n}\n\nfunction resolveSettingSources(\n\tproviderSettings: ClaudeSdkOauthProviderSettings,\n\tmode: ClaudeSdkOauthSystemPromptMode,\n\tauthLane: ClaudeSdkOauthAuthLane,\n): SettingSource[] {\n\tif (providerSettings.settingSources !== undefined) return [...providerSettings.settingSources];\n\tif (mode !== \"preset-append\" || authLane !== \"ambient\") return [];\n\treturn [\"user\", \"project\"];\n}\n\nexport function buildClaudeSdkOauthQueryOptions(input: ClaudeSdkOauthQueryOptionsInput): Options {\n\tconst cwd = input.cwd ?? process.cwd();\n\tconst providerSettings = input.providerSettings ?? loadClaudeSdkOauthProviderSettingsFromDisk(cwd);\n\tconst appendSystemPrompt = providerSettings.appendSystemPrompt !== false;\n\tconst resolvedMode = resolveSystemPromptMode(providerSettings);\n\tconst mode = resolvedMode.mode;\n\tif (input.sessionId !== undefined && input.onGuidance !== undefined) {\n\t\tconst deprecation = presetAppendDeprecationGuidance({\n\t\t\tmode,\n\t\t\tconflict: resolvedMode.conflict,\n\t\t\tsessionId: input.sessionId,\n\t\t});\n\t\tif (deprecation !== undefined) input.onGuidance(deprecation);\n\t}\n\tconst authLane = input.authLane ?? providerSettings.tokenInjection ?? \"ambient\";\n\tconst append =\n\t\tmode === \"preset-append\"\n\t\t\t? [\n\t\t\t\t\textractAgentsAppend(cwd),\n\t\t\t\t\textractSkillsAppend(input.context.systemPrompt, cwd),\n\t\t\t\t\textractProjectRulesAppend(input.context.systemPrompt),\n\t\t\t\t].filter((part): part is string => part !== undefined)\n\t\t\t: [];\n\tconst systemPrompt =\n\t\tmode === \"preset-append\"\n\t\t\t? { type: \"preset\" as const, preset: \"claude_code\" as const, append: append.join(\"\\n\\n\") || undefined }\n\t\t\t: mode === \"override\"\n\t\t\t\t? loadOverrideSystemPrompt(providerSettings.systemPromptFile)\n\t\t\t\t: resolveCustomSystemPrompt(input.context.systemPrompt);\n\tconst toolLessRequest = input.streamOptions?.toolChoice === \"none\";\n\tconst emptyToolContext = (input.context.tools?.length ?? 0) === 0;\n\tconst strictMcpConfig = toolLessRequest || (providerSettings.strictMcpConfig ?? !appendSystemPrompt);\n\tconst queryOptions: Options = {\n\t\tcwd,\n\t\tmodel: input.model.id,\n\t\ttools: toolLessRequest || emptyToolContext ? [] : input.tools ? [...input.tools] : [...BUILTIN_SDK_TOOLS],\n\t\tpermissionMode: \"dontAsk\",\n\t\tincludePartialMessages: true,\n\t\tcanUseTool,\n\t\thooks: HOST_TOOL_DENIAL_HOOKS,\n\t\tsystemPrompt,\n\t\tsettings: { autoCompactEnabled: true },\n\t\tsettingSources: resolveSettingSources(providerSettings, mode, authLane),\n\t};\n\tif (input.pathToClaudeCodeExecutable) queryOptions.pathToClaudeCodeExecutable = input.pathToClaudeCodeExecutable;\n\tif (toolLessRequest) queryOptions.maxTurns = 1;\n\tif (strictMcpConfig) queryOptions.extraArgs = { \"strict-mcp-config\": null };\n\n\tconst reasoning = input.streamOptions?.reasoning;\n\tif (reasoning && supportsAdaptiveThinking(input.model)) {\n\t\tqueryOptions.thinking = { type: \"adaptive\", display: \"summarized\" } satisfies ThinkingConfig;\n\t\tqueryOptions.effort = mapThinkingLevelToEffort(input.model, reasoning);\n\t} else if (reasoning) {\n\t\tqueryOptions.maxThinkingTokens = mapThinkingTokens(reasoning, input.streamOptions?.thinkingBudgets);\n\t}\n\treturn queryOptions;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/claude-sdk-oauth/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,GAAG,EACR,KAAK,2BAA2B,EAChC,KAAK,OAAO,EAGZ,KAAK,KAAK,EACV,KAAK,mBAAmB,EACxB,MAAM,uBAAuB,CAAC;AAmB/B,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,mBAAmB,GAC3B,2BAA2B,CAsM7B"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/claude-sdk-oauth/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,GAAG,EACR,KAAK,2BAA2B,EAChC,KAAK,OAAO,EAGZ,KAAK,KAAK,EACV,KAAK,mBAAmB,EACxB,MAAM,uBAAuB,CAAC;AAmB/B,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EACjB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,mBAAmB,GAC3B,2BAA2B,CAuM7B"}
@@ -59,7 +59,8 @@ export function streamClaudeSdkOauth(model, context, options) {
59
59
  toolWatch.reconcileWithContext(sessionKey, context);
60
60
  const toolWatchNote = toolWatch.buildPromptNote(sessionKey, context, resolvedTools.customToolNameToSdk);
61
61
  const providerSettings = loadClaudeSdkOauthProviderSettingsFromDisk(process.cwd());
62
- const mcpServers = await buildCustomToolServers(resolvedTools.customTools);
62
+ const toolLessRequest = options?.toolChoice === "none";
63
+ const mcpServers = toolLessRequest ? undefined : await buildCustomToolServers(resolvedTools.customTools);
63
64
  const executable = resolveClaudeCodeExecutable(defaultExecutableDeps());
64
65
  const buildOptions = (authLane) => {
65
66
  const queryOptions = buildClaudeSdkOauthQueryOptions({