@code-yeongyu/senpi 2026.9.2-4 → 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 (114) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/core/dynamic-prompt/build.d.ts.map +1 -1
  3. package/dist/core/dynamic-prompt/build.js +2 -5
  4. package/dist/core/dynamic-prompt/build.js.map +1 -1
  5. package/dist/core/dynamic-prompt/index.d.ts +1 -2
  6. package/dist/core/dynamic-prompt/index.d.ts.map +1 -1
  7. package/dist/core/dynamic-prompt/index.js +1 -2
  8. package/dist/core/dynamic-prompt/index.js.map +1 -1
  9. package/dist/core/dynamic-prompt/intent-gate.d.ts.map +1 -1
  10. package/dist/core/dynamic-prompt/intent-gate.js +9 -24
  11. package/dist/core/dynamic-prompt/intent-gate.js.map +1 -1
  12. package/dist/core/dynamic-prompt/policies.d.ts.map +1 -1
  13. package/dist/core/dynamic-prompt/policies.js +3 -7
  14. package/dist/core/dynamic-prompt/policies.js.map +1 -1
  15. package/dist/core/dynamic-prompt/style.d.ts.map +1 -1
  16. package/dist/core/dynamic-prompt/style.js +6 -8
  17. package/dist/core/dynamic-prompt/style.js.map +1 -1
  18. package/dist/core/dynamic-prompt/verification.js +1 -1
  19. package/dist/core/dynamic-prompt/verification.js.map +1 -1
  20. package/dist/core/dynamic-prompt/working-task.d.ts +2 -0
  21. package/dist/core/dynamic-prompt/working-task.d.ts.map +1 -0
  22. package/dist/core/dynamic-prompt/working-task.js +10 -0
  23. package/dist/core/dynamic-prompt/working-task.js.map +1 -0
  24. package/dist/core/extensions/builtin/config-reload/watch-event-source.d.ts +1 -1
  25. package/dist/core/extensions/builtin/config-reload/watch-event-source.d.ts.map +1 -1
  26. package/dist/core/extensions/builtin/config-reload/watch-event-source.js +27 -9
  27. package/dist/core/extensions/builtin/config-reload/watch-event-source.js.map +1 -1
  28. package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
  29. package/dist/core/extensions/builtin/terminal/extension.js +8 -3
  30. package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
  31. package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts +4 -3
  32. package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts.map +1 -1
  33. package/dist/core/extensions/builtin/terminal/monitor-notify.js +18 -18
  34. package/dist/core/extensions/builtin/terminal/monitor-notify.js.map +1 -1
  35. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts +7 -0
  36. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -1
  37. package/dist/core/extensions/builtin/terminal/monitor-registry.js +37 -8
  38. package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -1
  39. package/dist/core/extensions/builtin/terminal/monitor-status.js +1 -1
  40. package/dist/core/extensions/builtin/terminal/monitor-status.js.map +1 -1
  41. package/dist/core/extensions/builtin/terminal/prompt.d.ts +1 -1
  42. package/dist/core/extensions/builtin/terminal/prompt.d.ts.map +1 -1
  43. package/dist/core/extensions/builtin/terminal/prompt.js +17 -13
  44. package/dist/core/extensions/builtin/terminal/prompt.js.map +1 -1
  45. package/dist/core/extensions/builtin/terminal/tools/bash-output.d.ts.map +1 -1
  46. package/dist/core/extensions/builtin/terminal/tools/bash-output.js +14 -2
  47. package/dist/core/extensions/builtin/terminal/tools/bash-output.js.map +1 -1
  48. package/dist/core/extensions/builtin/terminal/tools/context.d.ts +2 -0
  49. package/dist/core/extensions/builtin/terminal/tools/context.d.ts.map +1 -1
  50. package/dist/core/extensions/builtin/terminal/tools/context.js.map +1 -1
  51. package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -1
  52. package/dist/core/extensions/builtin/terminal/tools/monitor.js +27 -10
  53. package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -1
  54. package/dist/modes/rpc/host-ensure.d.ts +6 -0
  55. package/dist/modes/rpc/host-ensure.d.ts.map +1 -1
  56. package/dist/modes/rpc/host-ensure.js +15 -4
  57. package/dist/modes/rpc/host-ensure.js.map +1 -1
  58. package/dist/modes/rpc/host-lifecycle.d.ts.map +1 -1
  59. package/dist/modes/rpc/host-lifecycle.js +16 -4
  60. package/dist/modes/rpc/host-lifecycle.js.map +1 -1
  61. package/dist/modes/rpc/multi-session-host.d.ts +3 -0
  62. package/dist/modes/rpc/multi-session-host.d.ts.map +1 -1
  63. package/dist/modes/rpc/multi-session-host.js +3 -0
  64. package/dist/modes/rpc/multi-session-host.js.map +1 -1
  65. package/dist/modes/rpc/rpc-mode.d.ts +1 -1
  66. package/dist/modes/rpc/rpc-mode.js +1 -1
  67. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  68. package/dist/modes/rpc/session-command-router.d.ts +22 -0
  69. package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
  70. package/dist/modes/rpc/session-command-router.js +132 -94
  71. package/dist/modes/rpc/session-command-router.js.map +1 -1
  72. package/dist/modes/rpc/session-event-fanout.d.ts +3 -1
  73. package/dist/modes/rpc/session-event-fanout.d.ts.map +1 -1
  74. package/dist/modes/rpc/session-event-fanout.js +14 -1
  75. package/dist/modes/rpc/session-event-fanout.js.map +1 -1
  76. package/dist/modes/rpc/session-event-writer.d.ts +2 -0
  77. package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
  78. package/dist/modes/rpc/session-event-writer.js +16 -2
  79. package/dist/modes/rpc/session-event-writer.js.map +1 -1
  80. package/dist/modes/rpc/session-registry.d.ts +9 -8
  81. package/dist/modes/rpc/session-registry.d.ts.map +1 -1
  82. package/dist/modes/rpc/session-registry.js +14 -42
  83. package/dist/modes/rpc/session-registry.js.map +1 -1
  84. package/dist/modes/rpc/session-teardown.d.ts +12 -0
  85. package/dist/modes/rpc/session-teardown.d.ts.map +1 -0
  86. package/dist/modes/rpc/session-teardown.js +117 -0
  87. package/dist/modes/rpc/session-teardown.js.map +1 -0
  88. package/docs/rpc.md +7 -5
  89. package/docs/terminal-tools.md +26 -6
  90. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +12 -0
  91. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  92. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  93. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  94. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  95. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
  96. package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
  97. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  98. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  99. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  100. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  101. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  102. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  103. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  104. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  105. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  106. package/package.json +7 -7
  107. package/dist/core/dynamic-prompt/exploration.d.ts +0 -2
  108. package/dist/core/dynamic-prompt/exploration.d.ts.map +0 -1
  109. package/dist/core/dynamic-prompt/exploration.js +0 -6
  110. package/dist/core/dynamic-prompt/exploration.js.map +0 -1
  111. package/dist/core/dynamic-prompt/parallel-tools.d.ts +0 -2
  112. package/dist/core/dynamic-prompt/parallel-tools.d.ts.map +0 -1
  113. package/dist/core/dynamic-prompt/parallel-tools.js +0 -8
  114. package/dist/core/dynamic-prompt/parallel-tools.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -20,6 +20,43 @@
20
20
 
21
21
  ### Removed
22
22
 
23
+ ## [2026.9.3] - 2026-09-03
24
+
25
+ ### Added
26
+
27
+ ### Changed
28
+
29
+ - The universal fallback system prompt (models without a dedicated preset) is rewritten to the contracts proven by the dieted per-model presets: the routing line now declares an observable stop condition, the Surface Form table and request-classification taxonomy are compressed into three intent-family decision rules, parallel-tool and exploration guidance merge into one Working the Task section with a one-plan commitment rule, verification adopts the claim-audit rule, policies collapse into four hard blocks, and the style section gains end-of-turn, blocked-part, surgical-edit, and context-continuation rules — at a net cost of +6 tokens.
30
+ - The terminal monitor footer now labels paused monitors as `muted` or `N muted` while preserving the `paused` wire field.
31
+
32
+ ### Fixed
33
+
34
+ - A failing RPC socket host startup now reports its own cause instead of the signal `ensureHost` sent while cleaning up. `startHost()` kills the just-spawned child when registration fails before the pidfile is written, and that kill recorded the same early-exit result a genuine self-exit produces, so the catch block dropped the real error and always reported `exited with code null (SIGTERM) before answering get_protocol_info`. On the `windows-latest` runner this made every transient startup failure unobservable and surfaced as the flaky `RPC named pipes (Windows)` job ([#1290](https://github.com/code-yeongyu/senpi/issues/1290)).
35
+
36
+ - The shared RPC supervisor's observer receives content-free session and agent lifecycle records even without a session attachment, so it no longer exits the host during an active turn.
37
+ - The Windows RPC host supervisor no longer dies when its baseline process-identity probe times out; a failed baseline read is treated as unknown instead of throwing past the startup guard and taking the internal host down with it.
38
+ - The Windows shared RPC host is no longer shut down by its own identity watchdog when the PowerShell process probe merely times out; an absent identity is confirmed with `kill(pid, 0)` before the host is treated as exited.
39
+ - Shared RPC host startup no longer runs its orphaned-directory cleanup while holding the endpoint lock, so a concurrent `senpi` start on a busy machine no longer fails with a raw `database is locked` when the cleanup's temp-directory scan and per-candidate process probes outlast the lock budget.
40
+
41
+ - `/reload` and hot-reload no longer stall for seconds on macOS/Linux: config-reload's per-directory `fs.watch` subscriptions are created and torn down on the watch worker thread instead of the interactive main thread (measured lifecycle phase 2.0-3.2s → ~150ms idle, 12s+ → ~150ms under load).
42
+ - The `monitor` tool's prompt surfaces document its file branch: `prompt.ts`, the tool description, and `docs/terminal-tools.md` now state that `command` and `path` are mutually exclusive and show the native `monitor({ description, path, event? })` recipe, instead of publishing a command-only signature that made the file branch added on 2026-08-29 unreachable and led agents to abandon the tool for a plain background session. Schema branch labels are symmetric, so `command` no longer claims to be unconditionally required.
43
+ - Multi-session RPC `close_session` teardown is bounded by a 10-second grace period (configurable via `SENPI_RPC_CLOSE_GRACE_MS`), force-releasing the session and path reservation on expiry; a second close joins the in-flight teardown instead of returning `unknown_session`.
44
+ - Monitor wake-budget pauses now use single-source, scoped state: only the noisy monitor is muted, quiet monitors are not left permanently paused, and `rearm` without a `bash_id` resumes all paused monitors.
45
+ - Real interactive and RPC user input now resumes paused terminal monitors while extension-generated input and tool calls remain unable to unpause them.
46
+ - Rearming a muted monitor now reports how many filter-matching output lines were dropped while it was muted; the count resets on resume.
47
+ - `bash_output` now reports when the peeked session is a muted monitor (`details.monitorMuted`, plus `mutedDropped` and a short note) so the muted state remains in the model's textual context; non-monitor sessions are unchanged.
48
+
49
+ ### New Features
50
+
51
+ ### Breaking Changes
52
+
53
+ ### Added
54
+
55
+ ### Changed
56
+
57
+ ### Fixed
58
+
59
+ ### Removed
23
60
  ## [2026.9.2-4] - 2026-09-02
24
61
 
25
62
  ### Added
@@ -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,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,C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AAE,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,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAA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AAO,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,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IA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C;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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AAuB,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"]}
@@ -10,6 +10,6 @@ export type FsWatchEventSourceOptions = {
10
10
  readonly platform?: NodeJS.Platform;
11
11
  readonly createRecursiveWorker?: RecursiveWatchWorkerFactory;
12
12
  };
13
- /** Production event source. Recursive setup and teardown run off the interactive main thread. */
13
+ /** Production event source. Watch setup and teardown run off the interactive main thread. */
14
14
  export declare function createFsWatchEventSource(onError?: (error: unknown, path: string) => void, options?: FsWatchEventSourceOptions): WatchEventSource;
15
15
  //# sourceMappingURL=watch-event-source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"watch-event-source.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/config-reload/watch-event-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,MAAM,WAAW,oBAAoB;IACpC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAAC;IACjE,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;IAC3D,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACpC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,MAAM,2BAA2B,GAAG,MAAM,oBAAoB,CAAC;AAErE,MAAM,MAAM,yBAAyB,GAAG;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IACpC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,2BAA2B,CAAC;CAC7D,CAAC;AA4EF,iGAAiG;AACjG,wBAAgB,wBAAwB,CACvC,OAAO,GAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,IAAe,EAC1D,OAAO,GAAE,yBAA8B,GACrC,gBAAgB,CAkDlB"}
1
+ {"version":3,"file":"watch-event-source.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/config-reload/watch-event-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,MAAM,WAAW,oBAAoB;IACpC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAAC;IACjE,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;IAC3D,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACpC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,MAAM,2BAA2B,GAAG,MAAM,oBAAoB,CAAC;AAErE,MAAM,MAAM,yBAAyB,GAAG;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IACpC,QAAQ,CAAC,qBAAqB,CAAC,EAAE,2BAA2B,CAAC;CAC7D,CAAC;AA+EF,6FAA6F;AAC7F,wBAAgB,wBAAwB,CACvC,OAAO,GAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,IAAe,EAC1D,OAAO,GAAE,yBAA8B,GACrC,gBAAgB,CAiElB"}
@@ -17,7 +17,7 @@ parentPort.on("message", (message) => {
17
17
  try {
18
18
  const watcher = watch(
19
19
  message.path,
20
- { recursive: true, encoding: "utf8" },
20
+ { recursive: message.recursive !== false, encoding: "utf8" },
21
21
  (eventType, filename) => {
22
22
  parentPort.postMessage({
23
23
  kind: "event",
@@ -63,11 +63,14 @@ function isRecursiveWatchMessage(message) {
63
63
  (message.filename === null || typeof message.filename === "string"));
64
64
  }
65
65
  /**
66
- * Platforms whose recursive fs.watch handles are expensive to create and tear down on the
67
- * interactive main thread: inotify tree walks on Linux, FSEvents stream teardown on macOS.
66
+ * Platforms whose fs.watch handles are expensive to create and tear down on the
67
+ * interactive main thread: inotify tree walks on Linux, FSEvents stream rendezvous on
68
+ * macOS. Non-recursive per-directory watches pay the same FSEvents setup latency —
69
+ * measured 2.7-8.0s per watch-engine target under system load — so every watch is
70
+ * offloaded, not only recursive ones.
68
71
  */
69
- const WORKER_OFFLOADED_RECURSIVE_PLATFORMS = new Set(["linux", "darwin"]);
70
- /** Production event source. Recursive setup and teardown run off the interactive main thread. */
72
+ const WORKER_OFFLOADED_WATCH_PLATFORMS = new Set(["linux", "darwin"]);
73
+ /** Production event source. Watch setup and teardown run off the interactive main thread. */
71
74
  export function createFsWatchEventSource(onError = () => { }, options = {}) {
72
75
  const recursiveSubscriptions = new Map();
73
76
  let recursiveWorker;
@@ -91,19 +94,34 @@ export function createFsWatchEventSource(onError = () => { }, options = {}) {
91
94
  worker.on("error", (error) => {
92
95
  for (const subscription of recursiveSubscriptions.values())
93
96
  onError(error, subscription.path);
97
+ // A worker that raised an uncaught error is dead; keeping it would leave every
98
+ // live subscription silent. Drop it and move the survivors to a fresh worker.
99
+ if (recursiveWorker !== worker)
100
+ return;
101
+ recursiveWorker = undefined;
102
+ if (recursiveSubscriptions.size === 0)
103
+ return;
104
+ const replacement = ensureRecursiveWorker();
105
+ for (const [id, subscription] of recursiveSubscriptions) {
106
+ replacement.postMessage({ kind: "watch", id, path: subscription.path, recursive: subscription.recursive });
107
+ }
94
108
  });
95
109
  recursiveWorker = worker;
96
110
  return worker;
97
111
  };
98
112
  return (path, listener, watchOptions) => {
99
- if (WORKER_OFFLOADED_RECURSIVE_PLATFORMS.has(options.platform ?? process.platform) && watchOptions?.recursive) {
113
+ if (WORKER_OFFLOADED_WATCH_PLATFORMS.has(options.platform ?? process.platform)) {
100
114
  const id = nextSubscriptionId++;
101
- const worker = ensureRecursiveWorker();
102
- recursiveSubscriptions.set(id, { path, listener });
103
- worker.postMessage({ kind: "watch", id, path });
115
+ const recursive = watchOptions?.recursive ?? false;
116
+ ensureRecursiveWorker().postMessage({ kind: "watch", id, path, recursive });
117
+ recursiveSubscriptions.set(id, { path, listener, recursive });
104
118
  return () => {
105
119
  if (!recursiveSubscriptions.delete(id))
106
120
  return;
121
+ // Resolve at unsubscribe time: the worker may have been replaced after a crash.
122
+ const worker = recursiveWorker;
123
+ if (!worker)
124
+ return;
107
125
  if (recursiveSubscriptions.size > 0) {
108
126
  worker.postMessage({ kind: "unwatch", id });
109
127
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"watch-event-source.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/config-reload/watch-event-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAqBtE,MAAM,6BAA6B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CrC,CAAC;AAEF,SAAS,0BAA0B;IAClC,OAAO,IAAI,MAAM,CAAC,6BAA6B,EAAE;QAChD,IAAI,EAAE,IAAI;KACV,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAgB;IAChD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1F,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,OAAO,OAAO,CAAC,EAAE,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACvE,IAAI,OAAO,CAAC,I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C,KAAc,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;YACzE,CAAC,CAAC;QACH,CAAC;QAED,MAAM,OAAO,GAAG,qBAAqB,CACpC,IAAI,EACJ,QAAQ,EACR,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAC7D,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,IAAI,KAAK,EAAE,CAC/C,CAAC;QACF,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC/B,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { Worker } from \"node:worker_threads\";\nimport { watchWithErrorHandler } from \"../../../../utils/fs-watch.ts\";\nimport type { WatchEventListener, WatchEventSource } from \"./watch-engine.ts\";\n\nexport interface RecursiveWatchWorker {\n\ton(event: \"message\", listener: (message: unknown) => void): this;\n\ton(event: \"error\", listener: (error: Error) => void): this;\n\tpostMessage(message: unknown): void;\n\tterminate(): Promise<number>;\n}\n\nexport type RecursiveWatchWorkerFactory = () => RecursiveWatchWorker;\n\nexport type FsWatchEventSourceOptions = {\n\treadonly platform?: NodeJS.Platform;\n\treadonly createRecursiveWorker?: RecursiveWatchWorkerFactory;\n};\n\ntype RecursiveWatchMessage =\n\t| { readonly kind: \"event\"; readonly id: number; readonly eventType: string; readonly filename: string | null }\n\t| { readonly kind: \"error\"; readonly id: number; readonly message: string };\n\nconst RECURSIVE_WATCH_WORKER_SOURCE = `\nconst { watch } = require(\"node:fs\");\nconst { parentPort } = require(\"node:worker_threads\");\n\nif (!parentPort) throw new Error(\"Recursive watch worker requires a parent port\");\n\nconst watchers = new Map();\nparentPort.on(\"message\", (message) => {\n\tif (message.kind === \"unwatch\") {\n\t\twatchers.get(message.id)?.close();\n\t\twatchers.delete(message.id);\n\t\treturn;\n\t}\n\tif (message.kind !== \"watch\") return;\n\ttry {\n\t\tconst watcher = watch(\n\t\t\tmessage.path,\n\t\t\t{ recursive: true, encoding: \"utf8\" },\n\t\t\t(eventType, filename) => {\n\t\t\t\tparentPort.postMessage({\n\t\t\t\t\tkind: \"event\",\n\t\t\t\t\tid: message.id,\n\t\t\t\t\teventType,\n\t\t\t\t\tfilename: typeof filename === \"string\" ? filename : null,\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\t\twatcher.on(\"error\", (error) => {\n\t\t\tparentPort.postMessage({\n\t\t\t\tkind: \"error\",\n\t\t\t\tid: message.id,\n\t\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t});\n\t\twatchers.set(message.id, watcher);\n\t} catch (error) {\n\t\tparentPort.postMessage({\n\t\t\tkind: \"error\",\n\t\t\tid: message.id,\n\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t});\n\t}\n});\n`;\n\nfunction createRecursiveWatchWorker(): RecursiveWatchWorker {\n\treturn new Worker(RECURSIVE_WATCH_WORKER_SOURCE, {\n\t\teval: true,\n\t});\n}\n\nfunction isRecursiveWatchMessage(message: unknown): message is RecursiveWatchMessage {\n\tif (typeof message !== \"object\" || message === null || !(\"kind\" in message)) return false;\n\tif (!(\"id\" in message) || typeof message.id !== \"number\") return false;\n\tif (message.kind === \"error\") return \"message\" in message && typeof message.message === \"string\";\n\treturn (\n\t\tmessage.kind === \"event\" &&\n\t\t\"eventType\" in message &&\n\t\ttypeof message.eventType === \"string\" &&\n\t\t\"filename\" in message &&\n\t\t(message.filename === null || typeof message.filename === \"string\")\n\t);\n}\n\n/**\n * Platforms whose recursive fs.watch handles are expensive to create and tear down on the\n * interactive main thread: inotify tree walks on Linux, FSEvents stream teardown on macOS.\n */\nconst WORKER_OFFLOADED_RECURSIVE_PLATFORMS: ReadonlySet<NodeJS.Platform> = new Set([\"linux\", \"darwin\"]);\n\n/** Production event source. Recursive setup and teardown run off the interactive main thread. */\nexport function createFsWatchEventSource(\n\tonError: (error: unknown, path: string) => void = () => {},\n\toptions: FsWatchEventSourceOptions = {},\n): WatchEventSource {\n\tconst recursiveSubscriptions = new Map<number, { readonly path: string; readonly listener: WatchEventListener }>();\n\tlet recursiveWorker: RecursiveWatchWorker | undefined;\n\tlet nextSubscriptionId = 1;\n\n\tconst ensureRecursiveWorker = (): RecursiveWatchWorker => {\n\t\tif (recursiveWorker) return recursiveWorker;\n\t\tconst worker = (options.createRecursiveWorker ?? createRecursiveWatchWorker)();\n\t\tworker.on(\"message\", (message) => {\n\t\t\tif (!isRecursiveWatchMessage(message)) return;\n\t\t\tconst subscription = recursiveSubscriptions.get(message.id);\n\t\t\tif (!subscription) return;\n\t\t\tif (message.kind === \"event\") {\n\t\t\t\tsubscription.listener(message.eventType, message.filename);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonError(new Error(message.message), subscription.path);\n\t\t});\n\t\tworker.on(\"error\", (error) => {\n\t\t\tfor (const subscription of recursiveSubscriptions.values()) onError(error, subscription.path);\n\t\t});\n\t\trecursiveWorker = worker;\n\t\treturn worker;\n\t};\n\n\treturn (path, listener, watchOptions) => {\n\t\tif (WORKER_OFFLOADED_RECURSIVE_PLATFORMS.has(options.platform ?? process.platform) && watchOptions?.recursive) {\n\t\t\tconst id = nextSubscriptionId++;\n\t\t\tconst worker = ensureRecursiveWorker();\n\t\t\trecursiveSubscriptions.set(id, { path, listener });\n\t\t\tworker.postMessage({ kind: \"watch\", id, path });\n\t\t\treturn () => {\n\t\t\t\tif (!recursiveSubscriptions.delete(id)) return;\n\t\t\t\tif (recursiveSubscriptions.size > 0) {\n\t\t\t\t\tworker.postMessage({ kind: \"unwatch\", id });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\trecursiveWorker = undefined;\n\t\t\t\tvoid worker.terminate().catch((error: unknown) => onError(error, path));\n\t\t\t};\n\t\t}\n\n\t\tconst watcher = watchWithErrorHandler(\n\t\t\tpath,\n\t\t\tlistener,\n\t\t\t() => onError(new Error(`fs.watch failed for ${path}`), path),\n\t\t\t{ recursive: watchOptions?.recursive ?? false },\n\t\t);\n\t\treturn () => watcher?.close();\n\t};\n}\n"]}
1
+ {"version":3,"file":"watch-event-source.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/config-reload/watch-event-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAqBtE,MAAM,6BAA6B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CrC,CAAC;AAEF,SAAS,0BAA0B;IAClC,OAAO,IAAI,MAAM,CAAC,6BAA6B,EAAE;QAChD,IAAI,EAAE,IAAI;KACV,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAgB;IAChD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1F,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,OAAO,OAAO,CAAC,EAAE,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACvE,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,SAAS,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC;IACjG,OAAO,CACN,OAAO,CAAC,IAAI,KAAK,OAAO;QACxB,WAAW,IAAI,OAAO;QACtB,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ;QACrC,UAAU,IAAI,OAAO;QACrB,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CACnE,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,gCAAgC,GAAiC,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAA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C,CAAC;oBAC5C,OAAO;gBACR,CAAC;gBACD,eAAe,GAAG,SAAS,CAAC;gBAC5B,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;YACzE,CAAC,CAAC;QACH,CAAC;QAED,MAAM,OAAO,GAAG,qBAAqB,CACpC,IAAI,EACJ,QAAQ,EACR,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAC7D,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,IAAI,KAAK,EAAE,CAC/C,CAAC;QACF,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC/B,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { Worker } from \"node:worker_threads\";\nimport { watchWithErrorHandler } from \"../../../../utils/fs-watch.ts\";\nimport type { WatchEventListener, WatchEventSource } from \"./watch-engine.ts\";\n\nexport interface RecursiveWatchWorker {\n\ton(event: \"message\", listener: (message: unknown) => void): this;\n\ton(event: \"error\", listener: (error: Error) => void): this;\n\tpostMessage(message: unknown): void;\n\tterminate(): Promise<number>;\n}\n\nexport type RecursiveWatchWorkerFactory = () => RecursiveWatchWorker;\n\nexport type FsWatchEventSourceOptions = {\n\treadonly platform?: NodeJS.Platform;\n\treadonly createRecursiveWorker?: RecursiveWatchWorkerFactory;\n};\n\ntype RecursiveWatchMessage =\n\t| { readonly kind: \"event\"; readonly id: number; readonly eventType: string; readonly filename: string | null }\n\t| { readonly kind: \"error\"; readonly id: number; readonly message: string };\n\nconst RECURSIVE_WATCH_WORKER_SOURCE = `\nconst { watch } = require(\"node:fs\");\nconst { parentPort } = require(\"node:worker_threads\");\n\nif (!parentPort) throw new Error(\"Recursive watch worker requires a parent port\");\n\nconst watchers = new Map();\nparentPort.on(\"message\", (message) => {\n\tif (message.kind === \"unwatch\") {\n\t\twatchers.get(message.id)?.close();\n\t\twatchers.delete(message.id);\n\t\treturn;\n\t}\n\tif (message.kind !== \"watch\") return;\n\ttry {\n\t\tconst watcher = watch(\n\t\t\tmessage.path,\n\t\t\t{ recursive: message.recursive !== false, encoding: \"utf8\" },\n\t\t\t(eventType, filename) => {\n\t\t\t\tparentPort.postMessage({\n\t\t\t\t\tkind: \"event\",\n\t\t\t\t\tid: message.id,\n\t\t\t\t\teventType,\n\t\t\t\t\tfilename: typeof filename === \"string\" ? filename : null,\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\t\twatcher.on(\"error\", (error) => {\n\t\t\tparentPort.postMessage({\n\t\t\t\tkind: \"error\",\n\t\t\t\tid: message.id,\n\t\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t\t});\n\t\t});\n\t\twatchers.set(message.id, watcher);\n\t} catch (error) {\n\t\tparentPort.postMessage({\n\t\t\tkind: \"error\",\n\t\t\tid: message.id,\n\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t});\n\t}\n});\n`;\n\nfunction createRecursiveWatchWorker(): RecursiveWatchWorker {\n\treturn new Worker(RECURSIVE_WATCH_WORKER_SOURCE, {\n\t\teval: true,\n\t});\n}\n\nfunction isRecursiveWatchMessage(message: unknown): message is RecursiveWatchMessage {\n\tif (typeof message !== \"object\" || message === null || !(\"kind\" in message)) return false;\n\tif (!(\"id\" in message) || typeof message.id !== \"number\") return false;\n\tif (message.kind === \"error\") return \"message\" in message && typeof message.message === \"string\";\n\treturn (\n\t\tmessage.kind === \"event\" &&\n\t\t\"eventType\" in message &&\n\t\ttypeof message.eventType === \"string\" &&\n\t\t\"filename\" in message &&\n\t\t(message.filename === null || typeof message.filename === \"string\")\n\t);\n}\n\n/**\n * Platforms whose fs.watch handles are expensive to create and tear down on the\n * interactive main thread: inotify tree walks on Linux, FSEvents stream rendezvous on\n * macOS. Non-recursive per-directory watches pay the same FSEvents setup latency —\n * measured 2.7-8.0s per watch-engine target under system load — so every watch is\n * offloaded, not only recursive ones.\n */\nconst WORKER_OFFLOADED_WATCH_PLATFORMS: ReadonlySet<NodeJS.Platform> = new Set([\"linux\", \"darwin\"]);\n\n/** Production event source. Watch setup and teardown run off the interactive main thread. */\nexport function createFsWatchEventSource(\n\tonError: (error: unknown, path: string) => void = () => {},\n\toptions: FsWatchEventSourceOptions = {},\n): WatchEventSource {\n\tconst recursiveSubscriptions = new Map<\n\t\tnumber,\n\t\t{ readonly path: string; readonly listener: WatchEventListener; readonly recursive: boolean }\n\t>();\n\tlet recursiveWorker: RecursiveWatchWorker | undefined;\n\tlet nextSubscriptionId = 1;\n\n\tconst ensureRecursiveWorker = (): RecursiveWatchWorker => {\n\t\tif (recursiveWorker) return recursiveWorker;\n\t\tconst worker = (options.createRecursiveWorker ?? createRecursiveWatchWorker)();\n\t\tworker.on(\"message\", (message) => {\n\t\t\tif (!isRecursiveWatchMessage(message)) return;\n\t\t\tconst subscription = recursiveSubscriptions.get(message.id);\n\t\t\tif (!subscription) return;\n\t\t\tif (message.kind === \"event\") {\n\t\t\t\tsubscription.listener(message.eventType, message.filename);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonError(new Error(message.message), subscription.path);\n\t\t});\n\t\tworker.on(\"error\", (error) => {\n\t\t\tfor (const subscription of recursiveSubscriptions.values()) onError(error, subscription.path);\n\t\t\t// A worker that raised an uncaught error is dead; keeping it would leave every\n\t\t\t// live subscription silent. Drop it and move the survivors to a fresh worker.\n\t\t\tif (recursiveWorker !== worker) return;\n\t\t\trecursiveWorker = undefined;\n\t\t\tif (recursiveSubscriptions.size === 0) return;\n\t\t\tconst replacement = ensureRecursiveWorker();\n\t\t\tfor (const [id, subscription] of recursiveSubscriptions) {\n\t\t\t\treplacement.postMessage({ kind: \"watch\", id, path: subscription.path, recursive: subscription.recursive });\n\t\t\t}\n\t\t});\n\t\trecursiveWorker = worker;\n\t\treturn worker;\n\t};\n\n\treturn (path, listener, watchOptions) => {\n\t\tif (WORKER_OFFLOADED_WATCH_PLATFORMS.has(options.platform ?? process.platform)) {\n\t\t\tconst id = nextSubscriptionId++;\n\t\t\tconst recursive = watchOptions?.recursive ?? false;\n\t\t\tensureRecursiveWorker().postMessage({ kind: \"watch\", id, path, recursive });\n\t\t\trecursiveSubscriptions.set(id, { path, listener, recursive });\n\t\t\treturn () => {\n\t\t\t\tif (!recursiveSubscriptions.delete(id)) return;\n\t\t\t\t// Resolve at unsubscribe time: the worker may have been replaced after a crash.\n\t\t\t\tconst worker = recursiveWorker;\n\t\t\t\tif (!worker) return;\n\t\t\t\tif (recursiveSubscriptions.size > 0) {\n\t\t\t\t\tworker.postMessage({ kind: \"unwatch\", id });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\trecursiveWorker = undefined;\n\t\t\t\tvoid worker.terminate().catch((error: unknown) => onError(error, path));\n\t\t\t};\n\t\t}\n\n\t\tconst watcher = watchWithErrorHandler(\n\t\t\tpath,\n\t\t\tlistener,\n\t\t\t() => onError(new Error(`fs.watch failed for ${path}`), path),\n\t\t\t{ recursive: watchOptions?.recursive ?? false },\n\t\t);\n\t\treturn () => watcher?.close();\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/extension.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AAoKrE,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAsGhE;AAED,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/extension.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AAqKrE,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAyGhE;AAED,eAAe,yBAAyB,CAAC"}
@@ -107,6 +107,7 @@ function buildToolContext(pi, state) {
107
107
  state.bundle?.notifyBackgroundExit(id, runtime);
108
108
  },
109
109
  onMonitorRearmed: (id) => state.monitorNotifier?.rearm(id),
110
+ onMonitorsResumed: (ids) => state.monitorNotifier?.resume(ids),
110
111
  };
111
112
  }
112
113
  function shouldStepAside(ctx) {
@@ -181,7 +182,7 @@ export function registerTerminalExtension(pi) {
181
182
  getContext: () => state.ctx,
182
183
  getMode: () => state.settings.notify,
183
184
  getSettings: () => state.settings.monitor,
184
- pauseMonitors: () => state.bundle?.monitors.pauseAll() ?? [],
185
+ pauseMonitors: (ids) => state.bundle?.monitors.pause(ids) ?? [],
185
186
  });
186
187
  const sessionKey = sessionKeyOf(ctx);
187
188
  if (event.reason === "reload") {
@@ -206,8 +207,12 @@ export function registerTerminalExtension(pi) {
206
207
  syncToolset(pi, state);
207
208
  });
208
209
  pi.on("input", (event) => {
209
- if (event.source !== "extension")
210
- state.monitorNotifier?.noteActivity();
210
+ if (event.source === "extension")
211
+ return;
212
+ state.monitorNotifier?.noteActivity();
213
+ const resumed = state.bundle?.monitors.resume() ?? [];
214
+ if (resumed.length > 0)
215
+ state.monitorNotifier?.resume(resumed.map((monitor) => monitor.id));
211
216
  });
212
217
  pi.on("tool_call", () => {
213
218
  state.monitorNotifier?.noteActivity();