sensorium-mcp 3.1.3 → 3.1.4

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 (159) hide show
  1. package/Install-Sensorium.ps1 +251 -39
  2. package/dist/config/agent-settings.d.ts +11 -0
  3. package/dist/config/agent-settings.d.ts.map +1 -1
  4. package/dist/config/agent-settings.js +79 -0
  5. package/dist/config/agent-settings.js.map +1 -1
  6. package/dist/config/index.d.ts +1 -0
  7. package/dist/config/index.d.ts.map +1 -1
  8. package/dist/config/index.js +12 -0
  9. package/dist/config/index.js.map +1 -1
  10. package/dist/config/misc-settings.d.ts +6 -0
  11. package/dist/config/misc-settings.d.ts.map +1 -1
  12. package/dist/config/misc-settings.js +31 -0
  13. package/dist/config/misc-settings.js.map +1 -1
  14. package/dist/dashboard/routes/codex.d.ts +14 -0
  15. package/dist/dashboard/routes/codex.d.ts.map +1 -0
  16. package/dist/dashboard/routes/codex.js +92 -0
  17. package/dist/dashboard/routes/codex.js.map +1 -0
  18. package/dist/dashboard/routes/threads-read.d.ts +10 -7
  19. package/dist/dashboard/routes/threads-read.d.ts.map +1 -1
  20. package/dist/dashboard/routes/threads-read.js +21 -16
  21. package/dist/dashboard/routes/threads-read.js.map +1 -1
  22. package/dist/dashboard/routes.d.ts.map +1 -1
  23. package/dist/dashboard/routes.js +3 -0
  24. package/dist/dashboard/routes.js.map +1 -1
  25. package/dist/dashboard/spa.html +11 -11
  26. package/dist/data/memory/bootstrap.d.ts +1 -1
  27. package/dist/data/memory/bootstrap.d.ts.map +1 -1
  28. package/dist/data/memory/bootstrap.js +23 -14
  29. package/dist/data/memory/bootstrap.js.map +1 -1
  30. package/dist/data/memory/consolidation.d.ts +20 -1
  31. package/dist/data/memory/consolidation.d.ts.map +1 -1
  32. package/dist/data/memory/consolidation.js +53 -3
  33. package/dist/data/memory/consolidation.js.map +1 -1
  34. package/dist/data/memory/key-knowledge.d.ts +38 -0
  35. package/dist/data/memory/key-knowledge.d.ts.map +1 -0
  36. package/dist/data/memory/key-knowledge.js +118 -0
  37. package/dist/data/memory/key-knowledge.js.map +1 -0
  38. package/dist/data/memory/migration-runner.d.ts +1 -1
  39. package/dist/data/memory/migration-runner.d.ts.map +1 -1
  40. package/dist/data/memory/migration-runner.js +23 -1
  41. package/dist/data/memory/migration-runner.js.map +1 -1
  42. package/dist/data/memory/narrative-lint.d.ts +2 -2
  43. package/dist/data/memory/narrative-lint.d.ts.map +1 -1
  44. package/dist/data/memory/narrative-lint.js +23 -13
  45. package/dist/data/memory/narrative-lint.js.map +1 -1
  46. package/dist/data/memory/narrative-resolutions.d.ts +8 -1
  47. package/dist/data/memory/narrative-resolutions.d.ts.map +1 -1
  48. package/dist/data/memory/narrative-resolutions.js +12 -5
  49. package/dist/data/memory/narrative-resolutions.js.map +1 -1
  50. package/dist/data/memory/narrative-sources.d.ts +1 -1
  51. package/dist/data/memory/narrative-sources.d.ts.map +1 -1
  52. package/dist/data/memory/narrative-sources.js +8 -3
  53. package/dist/data/memory/narrative-sources.js.map +1 -1
  54. package/dist/data/memory/narrative-store.d.ts +14 -0
  55. package/dist/data/memory/narrative-store.d.ts.map +1 -1
  56. package/dist/data/memory/narrative-store.js +36 -0
  57. package/dist/data/memory/narrative-store.js.map +1 -1
  58. package/dist/data/memory/narrative.d.ts.map +1 -1
  59. package/dist/data/memory/narrative.js +45 -25
  60. package/dist/data/memory/narrative.js.map +1 -1
  61. package/dist/data/memory/note-archival.d.ts +1 -1
  62. package/dist/data/memory/note-archival.d.ts.map +1 -1
  63. package/dist/data/memory/note-archival.js +7 -3
  64. package/dist/data/memory/note-archival.js.map +1 -1
  65. package/dist/data/memory/schema-ddl.d.ts +1 -1
  66. package/dist/data/memory/schema-ddl.d.ts.map +1 -1
  67. package/dist/data/memory/schema-ddl.js +3 -1
  68. package/dist/data/memory/schema-ddl.js.map +1 -1
  69. package/dist/data/memory/semantic-notes.d.ts +9 -1
  70. package/dist/data/memory/semantic-notes.d.ts.map +1 -1
  71. package/dist/data/memory/semantic-notes.js +4 -2
  72. package/dist/data/memory/semantic-notes.js.map +1 -1
  73. package/dist/data/memory/thread-registry.d.ts +7 -1
  74. package/dist/data/memory/thread-registry.d.ts.map +1 -1
  75. package/dist/data/memory/thread-registry.js +14 -5
  76. package/dist/data/memory/thread-registry.js.map +1 -1
  77. package/dist/data/memory/utils.d.ts +6 -0
  78. package/dist/data/memory/utils.d.ts.map +1 -1
  79. package/dist/data/memory/utils.js +13 -0
  80. package/dist/data/memory/utils.js.map +1 -1
  81. package/dist/integrations/openai/speech.js +4 -4
  82. package/dist/integrations/openai/speech.js.map +1 -1
  83. package/dist/lib/http-retry.d.ts +91 -0
  84. package/dist/lib/http-retry.d.ts.map +1 -0
  85. package/dist/lib/http-retry.js +177 -0
  86. package/dist/lib/http-retry.js.map +1 -0
  87. package/dist/lib/usage-metering/pricing.js +1 -1
  88. package/dist/lib/usage-metering/pricing.js.map +1 -1
  89. package/dist/llm/prompts/narrative.d.ts.map +1 -1
  90. package/dist/llm/prompts/narrative.js +27 -86
  91. package/dist/llm/prompts/narrative.js.map +1 -1
  92. package/dist/services/claude-spawn.service.d.ts.map +1 -1
  93. package/dist/services/claude-spawn.service.js +6 -1
  94. package/dist/services/claude-spawn.service.js.map +1 -1
  95. package/dist/services/codex-spawn.service.d.ts +2 -2
  96. package/dist/services/codex-spawn.service.d.ts.map +1 -1
  97. package/dist/services/codex-spawn.service.js +64 -58
  98. package/dist/services/codex-spawn.service.js.map +1 -1
  99. package/dist/services/consolidation.service.d.ts.map +1 -1
  100. package/dist/services/consolidation.service.js +10 -1
  101. package/dist/services/consolidation.service.js.map +1 -1
  102. package/dist/services/copilot-spawn.service.d.ts.map +1 -1
  103. package/dist/services/copilot-spawn.service.js +6 -1
  104. package/dist/services/copilot-spawn.service.js.map +1 -1
  105. package/dist/services/daily-session.d.ts +21 -10
  106. package/dist/services/daily-session.d.ts.map +1 -1
  107. package/dist/services/daily-session.js +60 -15
  108. package/dist/services/daily-session.js.map +1 -1
  109. package/dist/services/http-retry.d.ts +1 -90
  110. package/dist/services/http-retry.d.ts.map +1 -1
  111. package/dist/services/http-retry.js +1 -176
  112. package/dist/services/http-retry.js.map +1 -1
  113. package/dist/services/mcp-config.service.d.ts.map +1 -1
  114. package/dist/services/mcp-config.service.js +14 -1
  115. package/dist/services/mcp-config.service.js.map +1 -1
  116. package/dist/services/memory-briefing.service.d.ts +1 -1
  117. package/dist/services/memory-briefing.service.d.ts.map +1 -1
  118. package/dist/services/memory-briefing.service.js +33 -30
  119. package/dist/services/memory-briefing.service.js.map +1 -1
  120. package/dist/services/memory-pruning.service.d.ts.map +1 -1
  121. package/dist/services/memory-pruning.service.js +22 -4
  122. package/dist/services/memory-pruning.service.js.map +1 -1
  123. package/dist/services/spawn-common.d.ts +10 -2
  124. package/dist/services/spawn-common.d.ts.map +1 -1
  125. package/dist/services/spawn-common.js +25 -4
  126. package/dist/services/spawn-common.js.map +1 -1
  127. package/dist/services/telegram.d.ts +7 -5
  128. package/dist/services/telegram.d.ts.map +1 -1
  129. package/dist/services/telegram.js +18 -13
  130. package/dist/services/telegram.js.map +1 -1
  131. package/dist/sessions/mcp-registry.d.ts +7 -2
  132. package/dist/sessions/mcp-registry.d.ts.map +1 -1
  133. package/dist/sessions/mcp-registry.js +52 -30
  134. package/dist/sessions/mcp-registry.js.map +1 -1
  135. package/dist/tools/defs/memory-defs.d.ts.map +1 -1
  136. package/dist/tools/defs/memory-defs.js +4 -0
  137. package/dist/tools/defs/memory-defs.js.map +1 -1
  138. package/dist/tools/delegate-tool.js +2 -2
  139. package/dist/tools/delegate-tool.js.map +1 -1
  140. package/dist/tools/memory-tools.d.ts.map +1 -1
  141. package/dist/tools/memory-tools.js +9 -1
  142. package/dist/tools/memory-tools.js.map +1 -1
  143. package/dist/tools/start-session-tool.js +1 -1
  144. package/dist/tools/start-session-tool.js.map +1 -1
  145. package/dist/tools/wait/consolidation-strategy.d.ts +42 -0
  146. package/dist/tools/wait/consolidation-strategy.d.ts.map +1 -0
  147. package/dist/tools/wait/consolidation-strategy.js +50 -0
  148. package/dist/tools/wait/consolidation-strategy.js.map +1 -0
  149. package/dist/tools/wait/drive-handler.d.ts +5 -7
  150. package/dist/tools/wait/drive-handler.d.ts.map +1 -1
  151. package/dist/tools/wait/drive-handler.js +44 -48
  152. package/dist/tools/wait/drive-handler.js.map +1 -1
  153. package/dist/tools/wait/message-processing.d.ts.map +1 -1
  154. package/dist/tools/wait/message-processing.js +2 -1
  155. package/dist/tools/wait/message-processing.js.map +1 -1
  156. package/dist/tools/wait/poll-loop.d.ts.map +1 -1
  157. package/dist/tools/wait/poll-loop.js +2 -8
  158. package/dist/tools/wait/poll-loop.js.map +1 -1
  159. package/package.json +1 -1
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Transient HTTP retry policy.
3
+ *
4
+ * Centralizes the "retry on transient failure" behavior so it can be applied at
5
+ * a single choke point per call site rather than scattered across every request
6
+ * method. It is deliberately PURE: it knows nothing about the Telegram bot token
7
+ * or any other caller secret, so it never risks leaking one. Token redaction and
8
+ * response-body interpretation stay the caller's responsibility.
9
+ *
10
+ * WHY this exists: operators may point TELEGRAM_API_BASE_URL at an nginx reverse
11
+ * proxy or Azure gateway. Those proxies answer with 504 Gateway Timeout (or
12
+ * 502/503) instead of a normal Telegram JSON payload. Without retries a single
13
+ * proxy hiccup drops an operator notification or spins the long-poll loop; a
14
+ * bounded, jittered retry smooths over the transient blips.
15
+ */
16
+ /**
17
+ * HTTP status codes that indicate a TRANSIENT failure — the request may well
18
+ * succeed if retried after a short pause:
19
+ * 408 Request Timeout, 429 Too Many Requests,
20
+ * 500 Internal Server Error, 502 Bad Gateway,
21
+ * 503 Service Unavailable, 504 Gateway Timeout.
22
+ *
23
+ * Every other 4xx is PERMANENT (bad request, unauthorized, not found, …) and is
24
+ * never retried — retrying it only wastes time and risks duplicate side effects.
25
+ */
26
+ export const TRANSIENT_STATUS = new Set([408, 429, 500, 502, 503, 504]);
27
+ /** True when `status` is in the transient (retryable) set. */
28
+ export function isTransientStatus(status) {
29
+ return TRANSIENT_STATUS.has(status);
30
+ }
31
+ /**
32
+ * Upper bound (ms) we are ever willing to wait for a single `Retry-After`
33
+ * hint. A hostile or misconfigured proxy could send an absurd value; clamp it
34
+ * so we never sleep for minutes on end.
35
+ */
36
+ const RETRY_AFTER_MAX_MS = 60_000;
37
+ /**
38
+ * Parse the `Retry-After` response header into milliseconds.
39
+ *
40
+ * Per RFC 9110 the value is either a number of seconds (`Retry-After: 120`) or
41
+ * an HTTP-date (`Retry-After: Wed, 21 Oct 2026 07:28:00 GMT`). Returns
42
+ * `undefined` when the header is absent or unparseable, and clamps any positive
43
+ * result to {@link RETRY_AFTER_MAX_MS}. A date in the past yields `0`.
44
+ */
45
+ export function parseRetryAfterMs(response) {
46
+ const raw = response.headers.get("retry-after");
47
+ if (raw === null)
48
+ return undefined;
49
+ const trimmed = raw.trim();
50
+ if (trimmed === "")
51
+ return undefined;
52
+ // Numeric form: delay in seconds.
53
+ if (/^\d+$/.test(trimmed)) {
54
+ const seconds = Number(trimmed);
55
+ return Math.min(seconds * 1000, RETRY_AFTER_MAX_MS);
56
+ }
57
+ // HTTP-date form: absolute time to retry at.
58
+ const dateMs = Date.parse(trimmed);
59
+ if (Number.isNaN(dateMs))
60
+ return undefined;
61
+ const deltaMs = dateMs - Date.now();
62
+ if (deltaMs <= 0)
63
+ return 0;
64
+ return Math.min(deltaMs, RETRY_AFTER_MAX_MS);
65
+ }
66
+ /** Sensible default: 3 attempts, 500ms base, 8s cap. */
67
+ export const DEFAULT_RETRY_POLICY = {
68
+ maxAttempts: 3,
69
+ baseMs: 500,
70
+ capMs: 8_000,
71
+ };
72
+ /**
73
+ * Exponential backoff with FULL jitter.
74
+ *
75
+ * The deterministic component is `baseMs * 2^attempt`, capped at `capMs`. We
76
+ * then draw a uniformly random value in `[0, capped]` (the "full jitter"
77
+ * strategy from the AWS Architecture Blog). Full jitter — rather than
78
+ * equal-jitter or none — is chosen because it maximizes spread across many
79
+ * concurrent clients hammering the same recovering proxy, which minimizes
80
+ * retry-storm synchronization.
81
+ *
82
+ * @param attempt Zero-based retry index (0 for the first backoff).
83
+ */
84
+ export function computeBackoffMs(attempt, policy = DEFAULT_RETRY_POLICY) {
85
+ const exponential = policy.baseMs * 2 ** attempt;
86
+ const capped = Math.min(exponential, policy.capMs);
87
+ return Math.random() * capped;
88
+ }
89
+ /**
90
+ * Sleep for `ms`, rejecting immediately if `signal` aborts mid-wait.
91
+ *
92
+ * Retries must not swallow an intentional shutdown: if the caller's signal
93
+ * fires while we are backing off, propagate the abort at once rather than
94
+ * finishing the sleep.
95
+ */
96
+ export function abortableDelay(ms, signal) {
97
+ return new Promise((resolve, reject) => {
98
+ if (signal?.aborted) {
99
+ reject(signal.reason ?? new DOMException("Aborted", "AbortError"));
100
+ return;
101
+ }
102
+ let onAbort;
103
+ const timer = setTimeout(() => {
104
+ if (signal && onAbort)
105
+ signal.removeEventListener("abort", onAbort);
106
+ resolve();
107
+ }, ms);
108
+ if (signal) {
109
+ onAbort = () => {
110
+ clearTimeout(timer);
111
+ reject(signal.reason ?? new DOMException("Aborted", "AbortError"));
112
+ };
113
+ signal.addEventListener("abort", onAbort, { once: true });
114
+ }
115
+ });
116
+ }
117
+ /**
118
+ * `fetch` with bounded, jittered retry on transient failures.
119
+ *
120
+ * Behavior:
121
+ * - Performs the fetch. If the response status is transient AND attempts
122
+ * remain, waits (honoring `Retry-After` when present, otherwise
123
+ * {@link computeBackoffMs}) and retries. Otherwise returns the response — the
124
+ * caller still inspects `.ok` to handle permanent (4xx) errors itself.
125
+ * - Only a thrown `TypeError` — how native `fetch` reports a genuine transport
126
+ * failure (DNS, ECONNREFUSED, socket reset) — is retried (if attempts
127
+ * remain, else the last error is rethrown). Every other throw propagates
128
+ * IMMEDIATELY with no wasted backoff: an AbortError / TimeoutError from
129
+ * `init.signal` (or `AbortSignal.timeout`) is intentional and must not be
130
+ * retried, and a programmer error (e.g. a bad argument) is not transient.
131
+ * - The backoff sleep is abort-aware: aborting `init.signal` mid-wait rejects
132
+ * at once.
133
+ *
134
+ * Kept PURE — no knowledge of any caller secret. Token redaction is layered on
135
+ * top by the caller's own try/catch.
136
+ */
137
+ export async function fetchWithRetry(input, init, policy = DEFAULT_RETRY_POLICY) {
138
+ const signal = init?.signal ?? undefined;
139
+ let lastError;
140
+ for (let attempt = 0; attempt < policy.maxAttempts; attempt++) {
141
+ const attemptsRemaining = attempt < policy.maxAttempts - 1;
142
+ let response;
143
+ try {
144
+ response = await fetch(input, init);
145
+ }
146
+ catch (err) {
147
+ // Only a genuine transport failure is retryable. Native `fetch` throws a
148
+ // TypeError for network-level faults (DNS, ECONNREFUSED, socket reset);
149
+ // anything else — AbortError/TimeoutError from a signal, or a programmer
150
+ // error — is intentional or permanent and must propagate at once.
151
+ if (!(err instanceof TypeError))
152
+ throw err;
153
+ lastError = err;
154
+ if (!attemptsRemaining)
155
+ throw err;
156
+ await abortableDelay(computeBackoffMs(attempt, policy), signal);
157
+ continue;
158
+ }
159
+ // Transient HTTP status with attempts left → back off and retry. Otherwise
160
+ // (success, or permanent error, or out of attempts) hand the response back.
161
+ if (isTransientStatus(response.status) && attemptsRemaining) {
162
+ const retryAfter = parseRetryAfterMs(response);
163
+ const waitMs = retryAfter ?? computeBackoffMs(attempt, policy);
164
+ // Release the socket before retrying: an unconsumed undici `Response`
165
+ // body keeps its connection pinned until GC, so a sustained proxy outage
166
+ // would leak one connection per retried 504. Draining first avoids it.
167
+ await response.body?.cancel().catch(() => { });
168
+ await abortableDelay(waitMs, signal);
169
+ continue;
170
+ }
171
+ return response;
172
+ }
173
+ // Unreachable when maxAttempts >= 1, but keeps the type checker happy and
174
+ // guards against a misconfigured policy (maxAttempts <= 0).
175
+ throw lastError ?? new Error("fetchWithRetry: exhausted attempts with no response");
176
+ }
177
+ //# sourceMappingURL=http-retry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-retry.js","sourceRoot":"","sources":["../../src/l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AAM,CAAC,CAAC;YAC/D,sEAAsE;YACtE,yEAAyE;YACzE,uEAAuE;YACvE,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAC9C,MAAM,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACrC,SAAS;QACX,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,0EAA0E;IAC1E,4DAA4D;IAC5D,MAAM,SAAS,IAAI,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;AACtF,CAAC"}
@@ -23,7 +23,7 @@ export const MODEL_PRICES = {
23
23
  // OpenAI transcription — $0.006/min
24
24
  "whisper-1": { audioPerMinute: 0.006 },
25
25
  // Groq transcription — $0.111/hr → per minute
26
- "whisper-large-v3": { audioPerMinute: 0.111 / 60 },
26
+ "whisper-large-v3": { audioPerMinute: 0.0018498 },
27
27
  };
28
28
  /**
29
29
  * Pure cost in USD for one usage event. Unknown models (absent from the table)
@@ -1 +1 @@
1
- {"version":3,"file":"pricing.js","sourceRoot":"","sources":["../../../src/lib/usage-metering/pricing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAA+B;IACtD,cAAc;IACd,QAAQ,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE;IAClD,aAAa,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE;IACzD,iCAAiC;IACjC,wBAAwB,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;IAChD,oCAAoC;IACpC,WAAW,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE;IACtC,8CAA8C;IAC9C,kBAAkB,EAAE,EAAE,cAAc,EAAE,KAAK,GAAG,EAAE,EAAE;CACnD,CAAC;AAUF;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAA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AAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,MAAM,CAiDR"}
1
+ {"version":3,"file":"narrative.d.ts","sourceRoot":"","sources":["../../../src/llm/prompts/narrative.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAgBhF,wBAAgB,WAAW,CACzB,UAAU,EAAE,mBAAmB,EAC/B,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,MAAM,CA2BR;AAED,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,mBAAmB,EAC/B,mBAAmB,EAAE,MAAM,EAC3B,eAAe,EAAE,mBAAmB,EACpC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,MAAM,CAqBR"}
@@ -1,67 +1,35 @@
1
1
  /**
2
2
  * Prompt builders for the temporal narrative pipeline.
3
3
  */
4
+ /**
5
+ * Shared house style for every resolution: a dated event log (what + when),
6
+ * never flattering prose or thematic essays. Keeping one constant avoids the
7
+ * near-identical per-resolution style blocks drifting apart.
8
+ */
9
+ const LOG_STYLE = `STYLE:
10
+ - A dated log: one event per line, each line self-contained. NOT prose paragraphs, NOT thematic arcs.
11
+ - First person for yourself ("I ..."), third person for the operator ("The operator ...").
12
+ - Every line names an exact system/thread/feature/version/ID and carries at least one concrete identifier.
13
+ - Keep cause->effect in each line: what triggered it, what was decided, what resulted.
14
+ - Date each entry with a single point date. A "YYYY-MM-DD to YYYY-MM-DD" range is allowed ONLY where the instructions above permit it, and a ranged line must still name the concrete systems/versions/counts — never collapse it into vague wording like "various improvements".
15
+ - FORBIDDEN — do not write summaries, commentary, opinions, assessments, or your own conclusions of any kind (e.g. "what works", "what's fragile", "overall", "this shows", "the project is healthy", "current state"). No praise or filler ("significant progress", "notable", "pivotal", "crucial", "the period was marked by"); no marketing tone.
16
+ - Output ONLY dated event lines: no title, no intro, no closing or summary section whatsoever. Start directly with the first dated entry and stop after the last one.`;
4
17
  export function buildPrompt(resolution, episodesText, notesText, episodeCount, periodLabel, periodStart) {
5
18
  const startYear = new Date(periodStart).getFullYear();
6
19
  const endYear = new Date().getFullYear();
7
20
  const instructions = {
8
- day: `Write a narrative of what happened today (${periodLabel}). Tell the story chronologically — what happened, why, what it caused. Include timestamps (hours:minutes) for each event. Write in flowing prose, connecting events with cause and effect. Be specific: name systems, threads, versions, IDs. Target ~400 tokens.`,
9
- week: `Write a narrative of the key developments this week (${periodLabel}). Tell the story chronologically by day. For each event: what triggered it, what was decided, what resulted. Connect events across days — show how Monday's decision led to Wednesday's outcome. Write in flowing prose, not a list. Use day-level dates, no hours. Target ~800 tokens.`,
10
- month: `Write a chronological decision log for this month (${periodLabel}). Format: "Date — decision/event. Reason. Result." One entry per line. Each entry should have enough context to stand alone — a reader who sees only this entry should understand why it matters. Only include: decisions that changed project direction, bugs that broke something, features shipped. Skip routine fixes, code reviews, type errors, status checks. Day-level dates, no hours. End with unresolved items. Target ~1600 tokens.`,
11
- quarter: `Write a narrative overview of this quarter (${periodLabel}) organized by initiative. Group by subsystem (e.g. "Dashboard", "Memory system", "Narrative pipeline", "Session management"). For each initiative, write 1-2 flowing paragraphs that tell the STORY of how it evolved: what the state was at the start of the quarter, what problems appeared, what decisions were made and why, and where it ended up. Reference specific dates, versions, and IDs as evidence within the prose — but do NOT use a list or log format. The reader should understand the arc of each initiative from a connected narrative, not from scanning dated entries. Include initiatives where direction changed, major bugs appeared, features shipped, or architecture shifted. Episodes marked [imp: 0.6+] are operator-priority — weave them in. End with a short "Unresolved" section. Target ~3000 tokens.`,
12
- half_year: `Write a high-level evolution summary for this half-year (${periodLabel}). Do NOT repeat the quarterly grouped changelog — instead, synthesize it into 5-8 thematic arcs that show HOW the project evolved. For each arc: what the system looked like at the start, what forces drove change, and where it ended up. Example arcs: "Memory system evolution", "Session management maturity", "Narrative pipeline development". Within each arc, reference specific dates and versions as evidence, but the focus is the trajectory, not individual events. End with a "Current state" section: what works, what's fragile, what's next. Target ~4000 tokens.`,
21
+ day: `Write a dated event log of what happened today (${periodLabel}). One event per line, format: "HH:MM — what happened. Why / what was decided. Result." Chronological. Only real events (decisions, bugs, fixes/features shipped, operator requests) — skip filler and status noise. Name systems, threads, versions, IDs. Target ~400 tokens.`,
22
+ week: `Write a dated event log of the key developments this week (${periodLabel}). One event per line, format: "YYYY-MM-DD — what happened. Why / what was decided. Result." Chronological by day. Only what mattered — decisions that changed direction, bugs that broke something, features shipped; skip routine fixes and status checks. Name systems, threads, versions, IDs. Target ~500 tokens.`,
23
+ month: `Write a chronological decision log for this month (${periodLabel}). Format: "Date — decision/event. Reason. Result." One entry per line, day-level dates, no hours. An important event — a decision that changed direction, a bug that broke something, a feature shipped — gets its OWN single date, with enough context to stand alone. Several less-important events that don't each warrant a line — group them into ONE "YYYY-MM-DD to YYYY-MM-DD" line that still names the concrete systems/versions/counts (never vague wording). Target ~500 tokens.`,
24
+ quarter: `Write a dated decision log for this quarter (${periodLabel}). Format: "Date — decision/event. Reason. Result." One entry per line, day-level dates. A strategic item — direction change, major bug, feature/system shipped, architecture shift — gets its OWN single date; episodes marked [imp: 0.6+] are operator-priority, include them. Several less-important events that don't each warrant a line — group them into ONE "YYYY-MM-DD to YYYY-MM-DD" line that still names the concrete systems/versions/counts (never vague wording). Target ~450 tokens.`,
25
+ half_year: `Write a dated milestone log for this half-year (${periodLabel}). Format: "Date — milestone/decision. Reason. Result." One entry per line, day- or month-level dates. A major turning point — direction change, system shipped, architecture shift — gets its OWN single date. Several less-important events that don't each warrant a line — group them into ONE "YYYY-MM-DD to YYYY-MM-DD" line that still names the concrete systems/versions/counts (never vague wording). Target ~400 tokens.`,
13
26
  };
14
- const styleByResolution = {
15
- day: `STYLE:
16
- - Write flowing prose, not bullet points or numbered lists. Connect events into a story.
17
- - First person for yourself ("I did..."), third person for the operator ("The operator...").
18
- - Name every system, thread, feature by exact name with IDs where available.
19
- - Be concrete — every sentence needs at least one identifier (name, version, date, ID, number).
20
- - Preserve cause-and-effect chains: "X happened because Y, which led to Z."
21
- - No filler phrases: "significant progress", "notable improvement", "pivotal moment", "crucial step".
22
- - NEVER open with "In [Month]..." or "During [Month]..." — start with what happened.
23
- - NEVER write introductory or concluding paragraphs that summarize.`,
24
- week: `STYLE:
25
- - Write flowing prose, not bullet points or numbered lists. Connect events into a weekly story.
26
- - First person for yourself ("I did..."), third person for the operator ("The operator...").
27
- - Name every system, thread, feature by exact name with IDs where available.
28
- - Be concrete — every sentence needs at least one identifier (name, version, date, ID, number).
29
- - Preserve cause-and-effect chains across days.
30
- - No filler phrases: "significant progress", "notable improvement", "pivotal moment", "crucial step".
31
- - NEVER open with "In [Month]..." or "During [Month]..." — start with what happened.
32
- - NEVER write introductory or concluding paragraphs that summarize.`,
33
- month: `STYLE:
34
- - Each log entry: 1-2 sentences with full context. A reader should understand the entry without reading others.
35
- - First person for yourself ("I did..."), third person for the operator ("The operator...").
36
- - Name every system, thread, feature by exact name with IDs where available.
37
- - No filler phrases: "significant progress", "notable improvement", "pivotal moment", "crucial step".
38
- - NEVER open with "In [Month]..." or "During [Month]..." or "The period was marked by...".
39
- - NEVER write introductory or concluding paragraphs.`,
40
- quarter: `STYLE:
41
- - Start each initiative with its name on its own line, then write 1-2 prose paragraphs. NO dated entries, NO log format.
42
- - Write flowing connected narrative — "The memory system entered the quarter with X problem. In April, Y happened because Z, which led to W by May."
43
- - First person for yourself ("I did..."), third person for the operator ("The operator...").
44
- - Name every system, thread, feature by exact name with IDs where available.
45
- - Reference dates and versions naturally within prose, not as entry prefixes.
46
- - Show cross-month cause-effect — how one month's decisions shaped the next.
47
- - No filler phrases: "significant progress", "notable improvement", "pivotal moment", "crucial step".
48
- - NEVER open with "In [Month]..." or "During [Month]..." or "The period was marked by...".
49
- - NEVER write introductory or concluding paragraphs.`,
50
- half_year: `STYLE:
51
- - Write in thematic arc paragraphs, not a chronological list. Each arc = 1-2 paragraphs.
52
- - First person for yourself ("I did..."), third person for the operator ("The operator...").
53
- - Name every system, thread, feature by exact name with IDs where available.
54
- - Within each arc, reference specific dates and versions as evidence of the trajectory.
55
- - No filler phrases: "significant progress", "notable improvement", "pivotal moment", "crucial step".
56
- - NEVER open with "In [Month]..." or "During [Month]..." or "The period was marked by...".
57
- - NEVER write an introductory paragraph. Start directly with the first arc.`,
58
- };
59
- return `You are a temporal memory narrator. You create concise records from raw interaction data.
27
+ return `You are a temporal memory narrator. You create concise, dated event logs from raw interaction data.
60
28
 
61
29
  ${instructions[resolution]}
62
30
 
63
- ${styleByResolution[resolution]}
64
- - Only use years in the range ${startYear}${startYear !== endYear ? `–${endYear}` : ""}.
31
+ ${LOG_STYLE}
32
+ - Only use years in the range ${startYear}${startYear !== endYear ? `-${endYear}` : ""}.
65
33
 
66
34
  SOURCE DATA (${episodeCount} episodes):
67
35
 
@@ -77,43 +45,16 @@ export function buildHierarchicalPrompt(resolution, childNarrativesText, childRe
77
45
  const startYear = new Date(periodStart).getFullYear();
78
46
  const endYear = new Date().getFullYear();
79
47
  const instructions = {
80
- month: `Write a chronological decision log for this month (${periodLabel}). You have ${childCount} weekly narratives below. Format: "Date — decision/event. Reason. Result." One entry per line. Each entry should have enough context to stand alone — a reader who sees only this entry should understand why it matters. Preserve important context from the weekly narratives — don't compress away the reasons and consequences. Only include: decisions that changed project direction, bugs that broke something, features shipped. Skip routine fixes, code reviews, type errors. Day-level dates, no hours. End with unresolved items. Target ~1600 tokens.`,
81
- quarter: `Write a narrative overview of this quarter (${periodLabel}) organized by initiative. You have ${childCount} monthly narratives and possibly top-importance raw episodes below. Group by subsystem (e.g. "Dashboard", "Memory system", "Narrative pipeline", "Session management"). For each initiative, write 1-2 flowing paragraphs that tell the STORY of how it evolved: what the state was at the start, what problems appeared, what decisions were made and why, and where it ended up. Reference specific dates, versions, and IDs within the prose — but do NOT use a list or log format. Synthesize the monthly narratives into a connected story, don't just re-list their entries. The reader should understand each initiative's arc from prose, not from scanning dated lines. Raw episodes marked [imp: 0.6+] are operator-priority — weave them in. End with a short "Unresolved" section. Target ~3000 tokens.`,
82
- half_year: `Write a high-level evolution summary for this half-year (${periodLabel}). You have ${childCount} quarterly changelogs and possibly top-importance raw episodes below. Do NOT repeat the quarterly grouped changelogs — instead, synthesize them into 5-8 thematic arcs that show HOW the project evolved over 6 months. For each arc: what the system looked like at the start of the period, what forces drove change (operator feedback, bugs, scaling needs), and where it ended up. Example arcs: "Memory system evolution", "Session management maturity", "Narrative pipeline development". Within each arc, reference specific dates and versions as evidence, but the focus is the trajectory — not individual events. End with a "Current state" section: what works, what's fragile, what's next. Target ~4000 tokens.`,
83
- };
84
- const styleByResolution = {
85
- month: `STYLE:
86
- - Each log entry: 1-3 sentences with full context. Explain the situation, not just the fact.
87
- - First person for yourself ("I did..."), third person for the operator ("The operator...").
88
- - Name every system, thread, feature by exact name with IDs where available.
89
- - Every sentence must have at least one identifier (name, version, date, ID, number).
90
- - No filler phrases: "significant progress", "notable improvement", "pivotal moment", "crucial step", "driven by", "shaped the direction", "the focus remains on".
91
- - NEVER open with "In [Month]..." or "During [Month]..." or "The period was marked by...".
92
- - NEVER write introductory or concluding paragraphs.`,
93
- quarter: `STYLE:
94
- - Start each initiative with its name on its own line, then write 1-2 prose paragraphs. NO dated entries, NO log format.
95
- - Write flowing connected narrative that tells the story of each initiative's evolution.
96
- - First person for yourself ("I did..."), third person for the operator ("The operator...").
97
- - Name every system, thread, feature by exact name with IDs where available.
98
- - Reference dates and versions naturally within prose, not as entry prefixes.
99
- - No filler phrases: "significant progress", "notable improvement", "pivotal moment", "crucial step", "driven by", "shaped the direction", "the focus remains on".
100
- - NEVER open with "In [Month]..." or "During [Month]..." or "The period was marked by...".
101
- - NEVER write introductory or concluding paragraphs.`,
102
- half_year: `STYLE:
103
- - Write in thematic arc paragraphs. Each arc = 1-2 paragraphs showing system evolution.
104
- - First person for yourself ("I did..."), third person for the operator ("The operator...").
105
- - Name every system, thread, feature by exact name with IDs where available.
106
- - Reference dates and versions as evidence of the trajectory within prose.
107
- - No filler phrases: "significant progress", "notable improvement", "pivotal moment", "crucial step", "driven by", "shaped the direction", "the focus remains on".
108
- - NEVER open with "In [Month]..." or "During [Month]..." or "The period was marked by...".
109
- - NEVER write introductory or concluding paragraphs.`,
48
+ month: `Write a chronological decision log for this month (${periodLabel}). You have ${childCount} weekly narratives below. Format: "Date — decision/event. Reason. Result." One entry per line, day-level dates, no hours. Preserve the reasons and consequences from the weekly narratives — don't compress them away. An important event — a decision that changed direction, a bug that broke something, a feature shipped — gets its OWN single date. Several less-important events that don't each warrant a line — group them into ONE "YYYY-MM-DD to YYYY-MM-DD" line that still names the concrete systems/versions/counts (never vague wording). Target ~500 tokens.`,
49
+ quarter: `Write a dated decision log for this quarter (${periodLabel}). You have ${childCount} monthly logs and possibly top-importance raw episodes below. Format: "Date — decision/event. Reason. Result." One entry per line, day-level dates. Synthesize the monthly logs. A strategic item — direction change, major bug, feature/system shipped, architecture shift — gets its OWN single date; raw episodes marked [imp: 0.6+] are operator-priority, include them. Several less-important events that don't each warrant a line — group them into ONE "YYYY-MM-DD to YYYY-MM-DD" line that still names the concrete systems/versions/counts (never vague wording). Target ~450 tokens.`,
50
+ half_year: `Write a dated milestone log for this half-year (${periodLabel}). You have ${childCount} quarterly logs and possibly top-importance raw episodes below. Format: "Date — milestone/decision. Reason. Result." One entry per line, day- or month-level dates. A major turning point — direction change, system shipped, architecture shift — gets its OWN single date. Several less-important events that don't each warrant a line — group them into ONE "YYYY-MM-DD to YYYY-MM-DD" line that still names the concrete systems/versions/counts (never vague wording). Target ~400 tokens.`,
110
51
  };
111
- return `You are a temporal memory narrator. You synthesize lower-resolution narratives into higher-level summaries.
52
+ return `You are a temporal memory narrator. You synthesize lower-resolution logs into higher-level dated logs.
112
53
 
113
54
  ${instructions[resolution]}
114
55
 
115
- ${styleByResolution[resolution] || ""}
116
- - Only use years in the range ${startYear}${startYear !== endYear ? `–${endYear}` : ""}.
56
+ ${LOG_STYLE}
57
+ - Only use years in the range ${startYear}${startYear !== endYear ? `-${endYear}` : ""}.
117
58
 
118
59
  SOURCE: ${childCount} ${childResolution} narratives
119
60
 
@@ -1 +1 @@
1
- {"version":3,"file":"narrative.js","sourceRoot":"","sources":["../../../src/llm/prompts/narrative.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,UAAU,WAAW,CACzB,UAA+B,EAC/B,YAAoB,EACpB,SAAiB,EACjB,YAAoB,EACpB,WAAmB,EACnB,WAAmB;IAEnB,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;IACtD,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACzC,MAAM,YAAY,GAAwC;QACxD,GAAG,EAAE,6CAA6C,WAAW,oQAAoQ;QACjU,IAAI,EAAE,wDAAwD,WAAW,0RAA0R;QACnW,KAAK,EAAE,sDAAsD,WAAW,kbAAkb;QAC1f,OAAO,EAAE,+CAA+C,WAAW,2yBAA2yB;QAC92B,SAAS,EAAE,4DAA4D,WAAW,sjBAAsjB;KACzoB,CAAC;IAEF,MAAM,iBAAiB,GAAwC;QAC7D,GAAG,EAAE;;;;;;;;oEAQ2D;QAChE,IAAI,EAAE;;;;;;;;oEAQ0D;QAChE,KAAK,EAAE;;;;;;qDAM0C;QACjD,OAAO,EAAE;;;;;;;;;qDASwC;QACjD,SAAS,EAAE;;;;;;;4EAO6D;KACzE,CAAC;IAEF,OAAO;;EAEP,YAAY,CAAC,UAAU,CAAC;;EAExB,iBAAiB,CAAC,UAAU,CAAC;gCACC,SAAS,GAAG,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE;;eAEvE,YAAY;;;EAGzB,YAAY,IAAI,8BAA8B;;;EAG9C,SAAS,IAAI,YAAY;;oCAES,CAAC;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 @@
1
- {"version":3,"file":"claude-spawn.service.d.ts","sourceRoot":"","sources":["../../src/services/claude-spawn.service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0BH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAWL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,iBAAiB,QAAO,MAAM,GAAG,IAQ7C,CAAC;AAqDF,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,sBAAsB,EACvC,gBAAgB,CAAC,EAAE,MAAM,EACzB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,EAChC,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,WAAW,CAAC,CA4HtB"}
1
+ {"version":3,"file":"claude-spawn.service.d.ts","sourceRoot":"","sources":["../../src/services/claude-spawn.service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0BH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAWL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAE3B,eAAO,MAAM,iBAAiB,QAAO,MAAM,GAAG,IAQ7C,CAAC;AAqDF,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,sBAAsB,EACvC,gBAAgB,CAAC,EAAE,MAAM,EACzB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,EAChC,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,WAAW,CAAC,CAiItB"}
@@ -79,7 +79,7 @@ export async function spawnAgentProcess(claudePath, name, threadId, threadLifecy
79
79
  if ("error" in pre)
80
80
  return pre;
81
81
  workingDirectory = normalizeWorkingDirectory(workingDirectory);
82
- const logFilePath = buildThreadLogPath(name, threadId, "json");
82
+ const logFilePath = buildThreadLogPath(name, "claude", threadId, "json");
83
83
  const effectiveConfigPath = buildClaudeMcpConfig(pre.transport, threadId);
84
84
  const claudeConfigDir = join(PROCESS_BASE_DIR, "claude-configs", String(threadId));
85
85
  mkdirSync(claudeConfigDir, { recursive: true });
@@ -148,6 +148,11 @@ export async function spawnAgentProcess(claudePath, name, threadId, threadLifecy
148
148
  // read was already destructive, so the message is simply gone. 0 disables
149
149
  // the timer; the long-poll has its own ceiling and keepalives when awake.
150
150
  CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT: "0",
151
+ // The CLI caps MCP tool output at ~25k tokens by default and spills anything
152
+ // larger to a file with only a ~2KB inline preview. A large bootstrap briefing
153
+ // exceeds that cap, so the agent sees the preview instead of the full briefing.
154
+ // Raise the cap so the whole briefing arrives inline. Claude-only knob.
155
+ MAX_MCP_OUTPUT_TOKENS: "50000",
151
156
  ENABLE_TOOL_SEARCH: "false",
152
157
  ...(oauthToken ? { CLAUDE_CODE_OAUTH_TOKEN: oauthToken } : {}),
153
158
  ...(memorySourceThreadId !== undefined
@@ -1 +1 @@
1
- {"version":3,"file":"claude-spawn.service.js","sourceRoot":"","sources":["../../src/services/claude-spawn.service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,oBAAoB,CAA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AoB,CAAC,QAAQ,CAAC;YACjC,cAAc;YACd,mBAAmB;YACnB,SAAS;YACT,WAAW;YACX,IAAI;YACJ,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC;YAClC,iBAAiB;YACjB,aAAa;SACd;QACD,GAAG,EAAE,QAAQ;QACb,GAAG,EAAE,gBAAgB;KACtB,EACD,eAAe,CAChB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"claude-spawn.service.js","sourceRoot":"","sources":["../../src/services/claude-spawn.service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,sBAAsB,GAEvB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAkB,EAAE;IACnD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,gBAAgB,EAAE,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,cAAc,CAAC;;YAEtE,KAAK,MAAM,SAAS,IAAI;gBACtB,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC;gBACzE,uCAAuC;gBACvC,6CAA6C;aAC9C;gBACC,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;oBAC1B,QAAQ,CAAC,yBAAyB,GAAG,SAAS,CAAC;oBAC/C,MAAM;gBACR,CAAC;IACP,CAAC;IACD,MAAM,WAAW,GAAG,aAAa;QAC/B,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,UAAU,KAAK,QAAQ;YACvB,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,qBAAqB,EAAE;YAC5D,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,qBAAqB,EAAE,CAAC;IAC1D,OAAO,WAAW,CAChB;QACE,QAAQ;QACR,IAAI;QACJ,WAAW;QACX,UAAU,EAAE,mBAAmB;QAC/B,UAAU,EAAE,QAAQ;QACpB,oBAAoB;QACpB,UAAU;QACV,GAAG,EAAE,UAAU;QACf,IAAI,EAAE;YACJ,WAAW;YACX,gCAAgC;YAChC,8EAA8E;YAC9E,GAAG,oBAAoB,CAAC,QAAQ,CAAC;YACjC,cAAc;YACd,mBAAmB;YACnB,SAAS;YACT,WAAW;YACX,IAAI;YACJ,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC;YAClC,iBAAiB;YACjB,aAAa;SACd;QACD,GAAG,EAAE,QAAQ;QACb,GAAG,EAAE,gBAAgB;KACtB,EACD,eAAe,CAChB,CAAC;AACJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Codex-specific spawn logic: CLI/native-exe resolution (including Volta layout
3
- * discovery on Windows) and the Codex `exec` process launch.
2
+ * Codex-specific spawn logic: package-manager-agnostic discovery of codex's
3
+ * bin/codex.js on Windows (launched via node.exe) and the Codex `exec` launch.
4
4
  */
5
5
  import type { ThreadLifecycleService } from "./thread-lifecycle.service.js";
6
6
  import { type SpawnResult } from "./spawn-common.js";
@@ -1 +1 @@
1
- {"version":3,"file":"codex-spawn.service.d.ts","sourceRoot":"","sources":["../../src/services/codex-spawn.service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAQL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAK3B,eAAO,MAAM,gBAAgB,QAAO,MAAM,GAAG,IAC4C,CAAC;AA6E1F,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,sBAAsB,EACvC,gBAAgB,CAAC,EAAE,MAAM,EACzB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAC/B,OAAO,CAAC,WAAW,CAAC,CAqDtB"}
1
+ {"version":3,"file":"codex-spawn.service.d.ts","sourceRoot":"","sources":["../../src/services/codex-spawn.service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,EAQL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAuD3B,eAAO,MAAM,gBAAgB,QAAO,MAAM,GAAG,IACiC,CAAC;AAE/E,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,sBAAsB,EACvC,gBAAgB,CAAC,EAAE,MAAM,EACzB,oBAAoB,CAAC,EAAE,MAAM,EAC7B,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAC/B,OAAO,CAAC,WAAW,CAAC,CAuDtB"}