@cydm/pie 4.8.0 → 4.10.0

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 (49) hide show
  1. package/README.md +51 -27
  2. package/dist/builtin/extensions/ask-user/index.js +4 -4
  3. package/dist/builtin/extensions/cron/index.js +906 -158
  4. package/dist/builtin/extensions/im-forward/README.md +4 -2
  5. package/dist/builtin/extensions/im-forward/index.js +6875 -3972
  6. package/dist/builtin/extensions/memory/index.js +76 -28
  7. package/dist/builtin/extensions/pie-ipc/README.md +2 -2
  8. package/dist/builtin/extensions/pie-ipc/index.js +285 -61
  9. package/dist/builtin/extensions/pie-proc/README.md +7 -7
  10. package/dist/builtin/extensions/pie-proc/index.js +493 -107
  11. package/dist/builtin/extensions/plan-mode/index.js +5 -5
  12. package/dist/builtin/extensions/subagent/index.js +8 -8
  13. package/dist/builtin/extensions/todo/index.js +4 -4
  14. package/dist/builtin/skills/chrome-devtools-axi/SKILL.md +26 -24
  15. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-bridge.js +199 -121
  16. package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-runtime.js +1 -1
  17. package/dist/builtin/skills/chrome-devtools-axi/chunk-HAUDUMDO.js +795 -0
  18. package/dist/builtin/skills/chrome-devtools-axi/{cli-ZE754CTH.js → cli-K7ESY3XD.js} +433 -255
  19. package/dist/builtin/skills/computer-use-axi/SKILL.md +25 -8
  20. package/dist/builtin/skills/computer-use-axi/computer-use-axi-broker.js +367 -65
  21. package/dist/builtin/skills/computer-use-axi/computer-use-axi-runtime.js +2 -2
  22. package/dist/builtin/skills/tui-use/tui-use-daemon.cjs +451 -43
  23. package/dist/chunks/{chunk-Y3I2UV5Y.js → chunk-5QMS6RQC.js} +353 -287
  24. package/dist/chunks/chunk-6WKBQZWM.js +19 -0
  25. package/dist/chunks/{chunk-LAJXWOKS.js → chunk-7LICWWUE.js} +11 -9
  26. package/dist/chunks/{chunk-5KI4Y4LA.js → chunk-BQWHLYYZ.js} +4 -3
  27. package/dist/chunks/{chunk-4PR34UZF.js → chunk-BTUMBUDU.js} +159 -145
  28. package/dist/chunks/{chunk-NHV2CALB.js → chunk-FC5AN5QP.js} +409 -32
  29. package/dist/chunks/{chunk-3W3SXVPB.js → chunk-G2K4GY6N.js} +993 -371
  30. package/dist/chunks/{chunk-BLDI2GRF.js → chunk-HK3FHIAH.js} +1364 -446
  31. package/dist/chunks/chunk-IZKHSUNQ.js +30 -0
  32. package/dist/chunks/{chunk-CGSFBWOM.js → chunk-KWK7KTSZ.js} +4 -3
  33. package/dist/chunks/chunk-OU33ROFD.js +717 -0
  34. package/dist/chunks/{chunk-Z2FKA2ZH.js → chunk-XMTRKMBG.js} +104 -22
  35. package/dist/chunks/{host-image-fallback-N7RHNPYN.js → host-image-fallback-3TEMOQM5.js} +1 -1
  36. package/dist/chunks/{manager-cli-NEZA46M5.js → manager-cli-Y6HM3MHA.js} +5 -5
  37. package/dist/chunks/{model-registry-3XAHXXTA.js → model-registry-QKJ3YVDS.js} +2 -2
  38. package/dist/chunks/{read-file-understanding-FMPXR6EJ.js → read-file-understanding-N2ZZQLTZ.js} +5 -5
  39. package/dist/chunks/{src-EGXFJ3WA.js → src-3PSR2AAX.js} +3 -3
  40. package/dist/chunks/{src-B44QWSGM.js → src-D5GN4Q5O.js} +2 -2
  41. package/dist/chunks/{src-CLE5ILN4.js → src-F5N6O2HR.js} +20 -4
  42. package/dist/chunks/{src-Q7LU27C2.js → src-TIDKYA5F.js} +31 -1
  43. package/dist/chunks/{test-stream-OR3EJBNF.js → test-stream-JAJHK44G.js} +2 -2
  44. package/dist/cli.js +4123 -2389
  45. package/models.schema.json +271 -0
  46. package/package.json +2 -2
  47. package/dist/builtin/skills/chrome-devtools-axi/chunk-Z2A5LA5A.js +0 -407
  48. package/dist/chunks/chunk-EGZ5TZRM.js +0 -1444
  49. package/dist/chunks/{manager-upgrade-CTU3ISCW.js → manager-upgrade-LSTOHBUV.js} +3 -3
@@ -21,11 +21,15 @@ function readDistillWorkerLog(memoryRoot, limit = 20) {
21
21
  return [];
22
22
  }
23
23
  }
24
- function spawnDistillWorker(memoryRoot, date) {
25
- return spawnDistillCli(memoryRoot, ["--date", date]);
24
+ var MEMORY_DISTILL_RETRYABLE_EXIT_CODE = 75;
25
+ function distillExitCode(result) {
26
+ return result.ok ? 0 : result.retryable ? MEMORY_DISTILL_RETRYABLE_EXIT_CODE : 1;
26
27
  }
27
- function spawnDistillAutoWorker(memoryRoot) {
28
- return spawnDistillCli(memoryRoot, ["--auto"]);
28
+ function spawnDistillWorker(memoryRoot, date, sessionsDir) {
29
+ return spawnDistillCli(memoryRoot, ["--date", date, ...sessionsDir ? ["--sessions-dir", sessionsDir] : []]);
30
+ }
31
+ function spawnDistillAutoWorker(memoryRoot, sessionsDir) {
32
+ return spawnDistillCli(memoryRoot, ["--auto", ...sessionsDir ? ["--sessions-dir", sessionsDir] : []]);
29
33
  }
30
34
  function spawnDistillCli(memoryRoot, modeArgs) {
31
35
  const logPath = distillWorkerLogPath(memoryRoot);
@@ -156,7 +160,28 @@ async function readExcludeCwds() {
156
160
  return [];
157
161
  }
158
162
  }
159
- async function runDistillWorkerMain(memoryRoot, date, noExit = false) {
163
+ function isTransientDistillError(message) {
164
+ const lower = message.toLowerCase();
165
+ if (/^(?:(?:harvest|evidence|apply):\s*)?memory store is contended \(write\.lock\)/i.test(message.trim())) {
166
+ return true;
167
+ }
168
+ if (/^(?:harvest|evidence|apply):/i.test(message)) {
169
+ return false;
170
+ }
171
+ if (/^(?:distill:[^:]+:\s*)?distill (?:response contains no json array|response contains invalid json|response is not an array|candidate is not an object|candidate has invalid shape|quote is implausibly long)/i.test(
172
+ message.trim()
173
+ )) {
174
+ return true;
175
+ }
176
+ if (lower.includes("no complete model/key pair") || lower.includes("invalid api key") || lower.includes("unauthorized") || lower.includes("forbidden") || lower.includes("eacces") || lower.includes("eperm") || lower.includes("erofs") || lower.includes("enospc")) {
177
+ return false;
178
+ }
179
+ if (lower.includes("syntaxerror") || lower.includes("invalid json") || lower.includes("in json at position")) {
180
+ return false;
181
+ }
182
+ return lower.includes("timed out") || lower.includes("timeout") || lower.includes("rate limit") || lower.includes("too many requests") || lower.includes("overloaded") || lower.includes("temporarily unavailable") || lower.includes("service unavailable") || lower.includes("bad gateway") || lower.includes("gateway timeout") || lower.includes("fetch failed") || lower.includes("connection error") || lower.includes("network error") || lower.includes("socket hang up") || lower.includes("econnreset") || lower.includes("econnrefused") || lower.includes("etimedout") || lower.includes("enotfound") || lower.includes("eai_again") || lower.includes("stopreason=length") || /(?:^|:\s*|http\s+|status(?:\s*code)?\s*[:=]?\s*)(?:429|500|502|503|504|529)\b/.test(lower);
183
+ }
184
+ async function runDistillWorkerMain(memoryRoot, date, noExit = false, sessionsDir) {
160
185
  const log = (message) => {
161
186
  try {
162
187
  fs.appendFileSync(distillWorkerLogPath(memoryRoot), `[${(/* @__PURE__ */ new Date()).toISOString()}] ${message}
@@ -171,11 +196,11 @@ async function runDistillWorkerMain(memoryRoot, date, noExit = false) {
171
196
  let result;
172
197
  let ledger;
173
198
  try {
174
- const { ModelRegistry } = await import("./model-registry-3XAHXXTA.js");
199
+ const { ModelRegistry } = await import("./model-registry-QKJ3YVDS.js");
175
200
  const { AuthStorage } = await import("./auth-storage-C3FZMT7J.js");
176
201
  const { getSessionsDir } = await import("./config-4EOI5NOU.js");
177
- const { FileSessionStore } = await import("./src-EGXFJ3WA.js");
178
- const { MemoryStore, runDistillation } = await import("./src-CLE5ILN4.js");
202
+ const { FileSessionStore } = await import("./src-3PSR2AAX.js");
203
+ const { MemoryStore, runDistillation } = await import("./src-F5N6O2HR.js");
179
204
  const store = new MemoryStore(memoryRoot);
180
205
  ledger = store;
181
206
  const registry = new ModelRegistry(AuthStorage.create());
@@ -190,7 +215,7 @@ async function runDistillWorkerMain(memoryRoot, date, noExit = false) {
190
215
  if (!resolved.model || !resolved.apiKey) {
191
216
  throw new Error(`no complete model/key pair for class ${modelClass}${resolved.fallbackReason ? `: ${resolved.fallbackReason}` : ""}`);
192
217
  }
193
- const { completeSimple } = await import("./src-Q7LU27C2.js");
218
+ const { completeSimple } = await import("./src-TIDKYA5F.js");
194
219
  const message = await withModelTimeout(
195
220
  completeSimple(
196
221
  resolved.model,
@@ -207,13 +232,15 @@ async function runDistillWorkerMain(memoryRoot, date, noExit = false) {
207
232
  `memory ${modelClass} model call`
208
233
  );
209
234
  if (message.stopReason && message.stopReason !== "stop") {
210
- throw new Error(`memory model call ended with stopReason=${message.stopReason}`);
235
+ const detail = typeof message.errorMessage === "string" && message.errorMessage.trim() ? `: ${message.errorMessage.trim()}` : "";
236
+ throw new Error(`memory model call ended with stopReason=${message.stopReason}${detail}`);
211
237
  }
212
238
  return message.content.filter((block) => block.type === "text").map((block) => block.text).join("\n");
213
239
  };
240
+ const resolvedSessionsDir = sessionsDir ? path.resolve(sessionsDir) : getSessionsDir();
214
241
  const distilled = await runDistillation(
215
242
  {
216
- sessionStore: new FileSessionStore(getSessionsDir()),
243
+ sessionStore: new FileSessionStore(resolvedSessionsDir),
217
244
  memoryStore: store,
218
245
  lightCall: modelCall("light"),
219
246
  balancedCall: modelCall("balanced"),
@@ -229,7 +256,9 @@ async function runDistillWorkerMain(memoryRoot, date, noExit = false) {
229
256
  } else {
230
257
  ledger?.clearFailures(date);
231
258
  }
232
- result = { ok: distilled.status === "applied" || distilled.status === "skipped-ran" || distilled.status === "skipped-empty", status: distilled.status, error: distilled.error };
259
+ const ok = distilled.status === "applied" || distilled.status === "skipped-ran" || distilled.status === "skipped-empty";
260
+ const retryable = !ok && distilled.error !== void 0 && isTransientDistillError(distilled.error);
261
+ result = { ok, status: distilled.status, error: distilled.error, ...retryable ? { retryable: true } : {} };
233
262
  } catch (error) {
234
263
  const message = error instanceof Error ? error.message : String(error);
235
264
  log(`failed ${date}: ${message}`);
@@ -237,17 +266,18 @@ async function runDistillWorkerMain(memoryRoot, date, noExit = false) {
237
266
  ledger?.recordFailure(date, message);
238
267
  } catch {
239
268
  }
240
- result = { ok: false, error: message };
269
+ const retryable = isTransientDistillError(message);
270
+ result = { ok: false, error: message, ...retryable ? { retryable: true } : {} };
241
271
  } finally {
242
272
  release();
243
273
  }
244
274
  if (!noExit) {
245
- const exitCode = result.ok ? 0 : 1;
275
+ const exitCode = distillExitCode(result);
246
276
  setTimeout(() => process.exit(exitCode), 50).unref?.();
247
277
  }
248
278
  return result;
249
279
  }
250
- async function runDistillAuto(memoryRoot, days = 7, runner) {
280
+ async function runDistillAuto(memoryRoot, days = 7, runner, sessionsDir) {
251
281
  const log = (message) => {
252
282
  try {
253
283
  fs.appendFileSync(distillWorkerLogPath(memoryRoot), `[${(/* @__PURE__ */ new Date()).toISOString()}] ${message}
@@ -255,16 +285,55 @@ async function runDistillAuto(memoryRoot, days = 7, runner) {
255
285
  } catch {
256
286
  }
257
287
  };
258
- const { MemoryStore, todayKey } = await import("./src-CLE5ILN4.js");
288
+ const { MemoryStore, todayKey, harvestSessionsForDate } = await import("./src-F5N6O2HR.js");
259
289
  const store = new MemoryStore(memoryRoot);
260
290
  const today = todayKey(Date.now());
261
291
  const dates = [];
292
+ let pinnedSessionStore;
293
+ let recoveryCwdFilter;
294
+ if (sessionsDir) {
295
+ try {
296
+ const { FileSessionStore } = await import("./src-3PSR2AAX.js");
297
+ pinnedSessionStore = new FileSessionStore(path.resolve(sessionsDir));
298
+ const excludeCwds = await readExcludeCwds();
299
+ if (excludeCwds.length > 0) {
300
+ recoveryCwdFilter = (cwd) => {
301
+ if (!cwd) return true;
302
+ const normalized = normalizeCwdPath(cwd);
303
+ return !excludeCwds.some((excluded) => pathContains(excluded, normalized));
304
+ };
305
+ }
306
+ } catch {
307
+ }
308
+ }
262
309
  for (let offset = days; offset >= 1; offset -= 1) {
263
310
  const probe = /* @__PURE__ */ new Date();
264
311
  probe.setDate(probe.getDate() - offset);
265
312
  const date = todayKey(probe.getTime());
266
313
  if (date === today) continue;
267
- if (!store.hasRun(date)) dates.push(date);
314
+ if (!store.hasRun(date)) {
315
+ dates.push(date);
316
+ continue;
317
+ }
318
+ if (pinnedSessionStore) {
319
+ const run = store.loadState().runs[date];
320
+ if (run && run.ops === 0 && !run.gated && !store.readJournal(date)) {
321
+ try {
322
+ if (harvestSessionsForDate(pinnedSessionStore, date, { maxCharsPerSession: 256, cwdFilter: recoveryCwdFilter }).length > 0) {
323
+ store.transaction(() => {
324
+ const state = store.loadState();
325
+ const latest = state.runs[date];
326
+ if (latest && latest.ops === 0 && !latest.gated && !store.readJournal(date)) {
327
+ delete state.runs[date];
328
+ store.writeState(state);
329
+ }
330
+ });
331
+ dates.push(date);
332
+ }
333
+ } catch {
334
+ }
335
+ }
336
+ }
268
337
  }
269
338
  if (dates.length === 0) {
270
339
  log("auto: no missing checkpoints in the window");
@@ -275,8 +344,9 @@ async function runDistillAuto(memoryRoot, days = 7, runner) {
275
344
  let ok = true;
276
345
  let deferred = false;
277
346
  let failures = 0;
347
+ let hasPermanentFailure = false;
278
348
  for (const date of dates) {
279
- const result = await (runner ?? runDistillWorkerMain)(memoryRoot, date, true);
349
+ const result = await (runner ?? runDistillWorkerMain)(memoryRoot, date, true, sessionsDir);
280
350
  if (!result.ok && result.busy) {
281
351
  lines.push(`${date}: busy \u2014 another distillation worker is running; next schedule retries`);
282
352
  deferred = true;
@@ -286,17 +356,29 @@ async function runDistillAuto(memoryRoot, days = 7, runner) {
286
356
  if (!result.ok) {
287
357
  ok = false;
288
358
  failures += 1;
289
- log(`auto: ${date} failed (retryable); continuing the remaining dates`);
359
+ const isRetryable = result.retryable ?? (result.error !== void 0 && isTransientDistillError(result.error));
360
+ if (!isRetryable) hasPermanentFailure = true;
361
+ log(`auto: ${date} failed (${isRetryable ? "transient/retryable" : "permanent"}); continuing the remaining dates`);
290
362
  }
291
363
  }
292
- if (failures > 0) lines.push(`${failures} date(s) failed (retryable; next run retries them)`);
293
- if (!process.env.NODE_TEST_CONTEXT) setTimeout(() => process.exit(ok || deferred ? 0 : 1), 50).unref?.();
294
- return { ok: ok || deferred, lines };
364
+ if (failures > 0) {
365
+ lines.push(
366
+ hasPermanentFailure ? `${failures} date(s) failed (includes permanent config/storage failure; inspect log)` : `${failures} date(s) failed (transient/retryable; next run retries them)`
367
+ );
368
+ }
369
+ const succeeded = failures === 0;
370
+ const retryable = failures > 0 && !hasPermanentFailure;
371
+ if (!process.env.NODE_TEST_CONTEXT) {
372
+ const code = distillExitCode({ ok: succeeded, retryable });
373
+ setTimeout(() => process.exit(code), 50).unref?.();
374
+ }
375
+ return { ok: succeeded, ...retryable ? { retryable: true } : {}, lines };
295
376
  }
296
377
 
297
378
  export {
298
379
  distillWorkerLogPath,
299
380
  readDistillWorkerLog,
381
+ distillExitCode,
300
382
  spawnDistillWorker,
301
383
  spawnDistillAutoWorker,
302
384
  runDistillWorkerMain,
@@ -5,7 +5,7 @@ import "./chunk-LZQXQOPJ.js";
5
5
  import * as os from "node:os";
6
6
  async function describeImageViaUnderstandingChain(options) {
7
7
  try {
8
- const { understandReadFile } = await import("./read-file-understanding-FMPXR6EJ.js");
8
+ const { understandReadFile } = await import("./read-file-understanding-N2ZZQLTZ.js");
9
9
  const ext = options.filePath.toLowerCase().split(".").pop() ?? "";
10
10
  const mimeType = ext === "png" ? "image/png" : ext === "gif" ? "image/gif" : ext === "webp" ? "image/webp" : "image/jpeg";
11
11
  const result = await understandReadFile(
@@ -1,10 +1,10 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
- import {
3
- getConfigDir
4
- } from "./chunk-CBDQJMUI.js";
5
2
  import {
6
3
  readProcessCommandLine
7
4
  } from "./chunk-7RJXKN7N.js";
5
+ import {
6
+ getConfigDir
7
+ } from "./chunk-CBDQJMUI.js";
8
8
  import "./chunk-LZQXQOPJ.js";
9
9
 
10
10
  // src/commands/manager-cli.ts
@@ -346,7 +346,7 @@ function isTooBroadForWorkerSandbox(input) {
346
346
  }
347
347
  const root = path2.parse(resolved).root;
348
348
  if (resolved === root || resolved === os.homedir()) return true;
349
- const forbidden = [os.tmpdir(), "/tmp", "/var/tmp", "/private/tmp", "/private/var/tmp"];
349
+ const forbidden = [os.homedir(), os.tmpdir(), "/tmp", "/var/tmp", "/private/tmp", "/private/var/tmp"];
350
350
  for (const candidate of forbidden) {
351
351
  try {
352
352
  const real = fs2.realpathSync(candidate);
@@ -907,7 +907,7 @@ function withStartLock(dir, fn) {
907
907
  });
908
908
  }
909
909
  async function runUpgradeCommand(args) {
910
- const { upgradePaths, performUpgrade, cliEffects, parseTarget } = await import("./manager-upgrade-CTU3ISCW.js");
910
+ const { upgradePaths, performUpgrade, cliEffects, parseTarget } = await import("./manager-upgrade-LSTOHBUV.js");
911
911
  const targetIdx = args.indexOf("--target");
912
912
  if (targetIdx >= 0 && typeof args[targetIdx + 1] !== "string") {
913
913
  console.error('--target expects "latest" or an x.y.z version (no value given)');
@@ -4,9 +4,9 @@ import {
4
4
  assertNoSecretSubstrings,
5
5
  configuredRemoteCredentialValues,
6
6
  loadResolvedModelsConfig
7
- } from "./chunk-NHV2CALB.js";
7
+ } from "./chunk-FC5AN5QP.js";
8
8
  import "./chunk-CBDQJMUI.js";
9
- import "./chunk-3W3SXVPB.js";
9
+ import "./chunk-G2K4GY6N.js";
10
10
  import "./chunk-XXGYUYXI.js";
11
11
  import "./chunk-LZQXQOPJ.js";
12
12
  export {
@@ -1,12 +1,12 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  understandReadFile
4
- } from "./chunk-4PR34UZF.js";
5
- import "./chunk-BLDI2GRF.js";
6
- import "./chunk-Y3I2UV5Y.js";
7
- import "./chunk-5KI4Y4LA.js";
8
- import "./chunk-3W3SXVPB.js";
4
+ } from "./chunk-BTUMBUDU.js";
5
+ import "./chunk-HK3FHIAH.js";
6
+ import "./chunk-5QMS6RQC.js";
7
+ import "./chunk-BQWHLYYZ.js";
9
8
  import "./chunk-F7EBZTZO.js";
9
+ import "./chunk-G2K4GY6N.js";
10
10
  import "./chunk-XXGYUYXI.js";
11
11
  import "./chunk-LZQXQOPJ.js";
12
12
  export {
@@ -142,9 +142,9 @@ import {
142
142
  substituteArgs,
143
143
  validateRetainedTailEntries,
144
144
  verifyPreparedCompactionCommit
145
- } from "./chunk-Y3I2UV5Y.js";
146
- import "./chunk-5KI4Y4LA.js";
147
- import "./chunk-3W3SXVPB.js";
145
+ } from "./chunk-5QMS6RQC.js";
146
+ import "./chunk-BQWHLYYZ.js";
147
+ import "./chunk-G2K4GY6N.js";
148
148
  import "./chunk-XXGYUYXI.js";
149
149
  import "./chunk-LZQXQOPJ.js";
150
150
  export {
@@ -8,8 +8,8 @@ import {
8
8
  createToolCallerIdentity,
9
9
  getAgentFailureMetadata,
10
10
  getToolCallerIdentity
11
- } from "./chunk-5KI4Y4LA.js";
12
- import "./chunk-3W3SXVPB.js";
11
+ } from "./chunk-BQWHLYYZ.js";
12
+ import "./chunk-G2K4GY6N.js";
13
13
  import "./chunk-XXGYUYXI.js";
14
14
  import "./chunk-LZQXQOPJ.js";
15
15
  export {
@@ -63,6 +63,7 @@ import {
63
63
  clusterCandidates,
64
64
  collectFilesForGrep,
65
65
  collectLastAssistantText,
66
+ collectProjectKeyAliases,
66
67
  collectSharedCapabilityPromptAdditions,
67
68
  conflictingValues,
68
69
  consumptionSummary,
@@ -144,6 +145,10 @@ import {
144
145
  getToolCapabilityMetadata,
145
146
  harvestSessionsForDate,
146
147
  hasAntonymCross,
148
+ hasCjk,
149
+ hasExactCjkAntonymSwap,
150
+ hasMatchingAsciiAntonymSwap,
151
+ hasTechnicalTokenMismatch,
147
152
  interpretBashExit,
148
153
  interpretShellExit,
149
154
  isInfrastructureSession,
@@ -151,6 +156,7 @@ import {
151
156
  isPrivateHostname,
152
157
  isRetired,
153
158
  isToolAllowedInPlanMode,
159
+ legacyProjectKeyFor,
154
160
  listGatedPatches,
155
161
  looksLikeSecretPresent,
156
162
  markCompletedPlanSteps,
@@ -161,6 +167,7 @@ import {
161
167
  nearDuplicate,
162
168
  normalizeForClustering,
163
169
  normalizeForFuzzyMatch,
170
+ normalizeGitUrl,
164
171
  normalizeStatus,
165
172
  normalizeToLF,
166
173
  normalizeTodos,
@@ -205,6 +212,7 @@ import {
205
212
  toSessionRecord,
206
213
  todayKey,
207
214
  tokenJaccard,
215
+ tokenizeCasePreserving,
208
216
  touchLiveSession,
209
217
  transplantMessages,
210
218
  truncateHead,
@@ -213,12 +221,12 @@ import {
213
221
  understandFileWithModel,
214
222
  validateTodos,
215
223
  writeJournalNarrative
216
- } from "./chunk-BLDI2GRF.js";
217
- import "./chunk-Y3I2UV5Y.js";
218
- import "./chunk-5KI4Y4LA.js";
224
+ } from "./chunk-HK3FHIAH.js";
225
+ import "./chunk-5QMS6RQC.js";
226
+ import "./chunk-BQWHLYYZ.js";
219
227
  import {
220
228
  hashText
221
- } from "./chunk-3W3SXVPB.js";
229
+ } from "./chunk-G2K4GY6N.js";
222
230
  import "./chunk-XXGYUYXI.js";
223
231
  import "./chunk-LZQXQOPJ.js";
224
232
  export {
@@ -285,6 +293,7 @@ export {
285
293
  clusterCandidates,
286
294
  collectFilesForGrep,
287
295
  collectLastAssistantText,
296
+ collectProjectKeyAliases,
288
297
  collectSharedCapabilityPromptAdditions,
289
298
  conflictingValues,
290
299
  consumptionSummary,
@@ -366,6 +375,10 @@ export {
366
375
  getToolCapabilityMetadata,
367
376
  harvestSessionsForDate,
368
377
  hasAntonymCross,
378
+ hasCjk,
379
+ hasExactCjkAntonymSwap,
380
+ hasMatchingAsciiAntonymSwap,
381
+ hasTechnicalTokenMismatch,
369
382
  hashText,
370
383
  interpretBashExit,
371
384
  interpretShellExit,
@@ -374,6 +387,7 @@ export {
374
387
  isPrivateHostname,
375
388
  isRetired,
376
389
  isToolAllowedInPlanMode,
390
+ legacyProjectKeyFor,
377
391
  listGatedPatches,
378
392
  looksLikeSecretPresent,
379
393
  markCompletedPlanSteps,
@@ -384,6 +398,7 @@ export {
384
398
  nearDuplicate,
385
399
  normalizeForClustering,
386
400
  normalizeForFuzzyMatch,
401
+ normalizeGitUrl,
387
402
  normalizeStatus,
388
403
  normalizeToLF,
389
404
  normalizeTodos,
@@ -428,6 +443,7 @@ export {
428
443
  toSessionRecord,
429
444
  todayKey,
430
445
  tokenJaccard,
446
+ tokenizeCasePreserving,
431
447
  touchLiveSession,
432
448
  transplantMessages,
433
449
  truncateHead,
@@ -1,8 +1,11 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
+ ACTIVE_THINKING_LEVELS,
4
+ ALL_THINKING_LEVELS,
3
5
  ANTHROPIC_PROMPT_CACHE_CAPABILITY,
4
6
  AssistantMessageEventStream,
5
7
  BUILTIN_MODEL_DEFINITIONS,
8
+ DEFAULT_THINKING_BUDGETS,
6
9
  EMPTY_ASSISTANT_CONTENT_ERROR,
7
10
  EMPTY_ASSISTANT_CONTENT_ERROR_CODE,
8
11
  EmptyAssistantContentError,
@@ -11,6 +14,7 @@ import {
11
14
  NO_CACHE_CAPABILITY,
12
15
  OPENAI_COMPAT_PROTOCOL_ERROR_CODE,
13
16
  OpenAICompatProtocolError,
17
+ PORTABLE_THINKING_LEVELS,
14
18
  RESPONSES_PROTOCOL_ERROR_CODE,
15
19
  ResponsesProtocolError,
16
20
  assertAssistantHasContent,
@@ -21,6 +25,7 @@ import {
21
25
  completeSimple,
22
26
  createAssistantMessageEventStream,
23
27
  createModel,
28
+ describeThinkingLevel,
24
29
  disposeModelTransports,
25
30
  fileKindForToolModelPurpose,
26
31
  getAllModels,
@@ -31,15 +36,22 @@ import {
31
36
  getEnvApiKey,
32
37
  getModel,
33
38
  getModelCacheCapability,
39
+ getModelThinkingCapabilities,
34
40
  getModels,
35
41
  getProviderEnvVar,
36
42
  getProviders,
37
43
  getResponsesCompat,
44
+ getSupportedThinkingLevels,
38
45
  hasAssistantContent,
39
46
  hasModel,
47
+ isActiveThinkingLevel,
48
+ isDisableWireCompatibleWithApi,
40
49
  isEmptyAssistantContentError,
50
+ isPortableThinkingLevel,
41
51
  isPromptCacheCapability,
42
52
  isSessionStoreCapability,
53
+ isThinkingModeCompatibleWithApi,
54
+ isThinkingSelectionLevel,
43
55
  listAvailableModels,
44
56
  logEmptyAssistantContentError,
45
57
  modelSupportsToolPurpose,
@@ -50,6 +62,8 @@ import {
50
62
  registerModels,
51
63
  registerModelsFromConfig,
52
64
  requiredCapabilityForToolPurpose,
65
+ resolveOutputAllowance,
66
+ resolveThinkingSelection,
53
67
  sortToolModelCandidatesByCapability,
54
68
  stream,
55
69
  streamAnthropic,
@@ -60,17 +74,21 @@ import {
60
74
  streamSimpleOpenAICompletions,
61
75
  streamSimpleResponses,
62
76
  unregisterModel,
77
+ validateExplicitThinkingSelection,
63
78
  validateToolArguments,
64
79
  validateToolCall
65
- } from "./chunk-3W3SXVPB.js";
80
+ } from "./chunk-G2K4GY6N.js";
66
81
  import {
67
82
  Type
68
83
  } from "./chunk-XXGYUYXI.js";
69
84
  import "./chunk-LZQXQOPJ.js";
70
85
  export {
86
+ ACTIVE_THINKING_LEVELS,
87
+ ALL_THINKING_LEVELS,
71
88
  ANTHROPIC_PROMPT_CACHE_CAPABILITY,
72
89
  AssistantMessageEventStream,
73
90
  BUILTIN_MODEL_DEFINITIONS,
91
+ DEFAULT_THINKING_BUDGETS,
74
92
  EMPTY_ASSISTANT_CONTENT_ERROR,
75
93
  EMPTY_ASSISTANT_CONTENT_ERROR_CODE,
76
94
  EmptyAssistantContentError,
@@ -79,6 +97,7 @@ export {
79
97
  NO_CACHE_CAPABILITY,
80
98
  OPENAI_COMPAT_PROTOCOL_ERROR_CODE,
81
99
  OpenAICompatProtocolError,
100
+ PORTABLE_THINKING_LEVELS,
82
101
  RESPONSES_PROTOCOL_ERROR_CODE,
83
102
  ResponsesProtocolError,
84
103
  Type,
@@ -90,6 +109,7 @@ export {
90
109
  completeSimple,
91
110
  createAssistantMessageEventStream,
92
111
  createModel,
112
+ describeThinkingLevel,
93
113
  disposeModelTransports,
94
114
  fileKindForToolModelPurpose,
95
115
  getAllModels,
@@ -100,15 +120,22 @@ export {
100
120
  getEnvApiKey,
101
121
  getModel,
102
122
  getModelCacheCapability,
123
+ getModelThinkingCapabilities,
103
124
  getModels,
104
125
  getProviderEnvVar,
105
126
  getProviders,
106
127
  getResponsesCompat,
128
+ getSupportedThinkingLevels,
107
129
  hasAssistantContent,
108
130
  hasModel,
131
+ isActiveThinkingLevel,
132
+ isDisableWireCompatibleWithApi,
109
133
  isEmptyAssistantContentError,
134
+ isPortableThinkingLevel,
110
135
  isPromptCacheCapability,
111
136
  isSessionStoreCapability,
137
+ isThinkingModeCompatibleWithApi,
138
+ isThinkingSelectionLevel,
112
139
  listAvailableModels,
113
140
  logEmptyAssistantContentError,
114
141
  modelSupportsToolPurpose,
@@ -119,6 +146,8 @@ export {
119
146
  registerModels,
120
147
  registerModelsFromConfig,
121
148
  requiredCapabilityForToolPurpose,
149
+ resolveOutputAllowance,
150
+ resolveThinkingSelection,
122
151
  sortToolModelCandidatesByCapability,
123
152
  stream,
124
153
  streamAnthropic,
@@ -129,6 +158,7 @@ export {
129
158
  streamSimpleOpenAICompletions,
130
159
  streamSimpleResponses,
131
160
  unregisterModel,
161
+ validateExplicitThinkingSelection,
132
162
  validateToolArguments,
133
163
  validateToolCall
134
164
  };
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  EventStream
4
- } from "./chunk-3W3SXVPB.js";
4
+ } from "./chunk-G2K4GY6N.js";
5
5
  import "./chunk-XXGYUYXI.js";
6
6
  import "./chunk-LZQXQOPJ.js";
7
7
 
@@ -93,7 +93,7 @@ function createTestStreamFnFromSequenceEnv(value = process.env.PIE_TEST_MOCK_STR
93
93
  let callIndex = 0;
94
94
  return async (model, context, options) => {
95
95
  const step = steps[Math.min(callIndex, steps.length - 1)];
96
- assertSystemPromptIncludes(context.systemPrompt, callIndex);
96
+ assertSystemPromptIncludes(context.systemPrompt ?? "", callIndex);
97
97
  const capturePath = process.env.PIE_TEST_MOCK_CAPTURE_CONTEXT;
98
98
  if (capturePath) {
99
99
  try {