@cydm/pie 4.11.0 → 4.12.1

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 (39) hide show
  1. package/dist/builtin/extensions/ask-user/index.js +2 -2
  2. package/dist/builtin/extensions/cron/index.js +1 -1
  3. package/dist/builtin/extensions/im-forward/index.js +8724 -7393
  4. package/dist/builtin/extensions/mcp-adapter/index.js +1 -1
  5. package/dist/builtin/extensions/memory/index.js +171 -66
  6. package/dist/builtin/extensions/pie-ipc/index.js +1 -1
  7. package/dist/builtin/extensions/pie-proc/index.js +533 -50
  8. package/dist/builtin/extensions/plan-mode/index.js +2 -2
  9. package/dist/builtin/extensions/subagent/README.md +1 -1
  10. package/dist/builtin/extensions/subagent/index.js +3 -3
  11. package/dist/builtin/extensions/todo/index.js +2 -2
  12. package/dist/chunks/{auth-storage-C3FZMT7J.js → auth-storage-IJEJ2TGE.js} +1 -1
  13. package/dist/chunks/chunk-26ILLZKQ.js +400 -0
  14. package/dist/chunks/{chunk-OU33ROFD.js → chunk-3GG342QY.js} +78 -78
  15. package/dist/chunks/{chunk-IZKHSUNQ.js → chunk-CAPBTMLI.js} +18 -1
  16. package/dist/chunks/{chunk-B5GKDXVG.js → chunk-IZ4DYCJ7.js} +246 -80
  17. package/dist/chunks/{chunk-HK3FHIAH.js → chunk-KW46ND3S.js} +1999 -767
  18. package/dist/chunks/{chunk-SW2E33UL.js → chunk-LMDWWT43.js} +123 -4
  19. package/dist/chunks/{chunk-EWPPGYBU.js → chunk-OGGL6LUN.js} +55 -16
  20. package/dist/chunks/chunk-Q4NJEPIZ.js +210 -0
  21. package/dist/chunks/{chunk-KWK7KTSZ.js → chunk-Q5PSWX3B.js} +3 -3
  22. package/dist/chunks/{chunk-BTUMBUDU.js → chunk-QSXBPTOA.js} +1 -1
  23. package/dist/chunks/{chunk-5QMS6RQC.js → chunk-SXBX2P5R.js} +160 -5
  24. package/dist/chunks/{chunk-7LICWWUE.js → chunk-W37NAT3N.js} +2 -2
  25. package/dist/chunks/chunk-WTBLV6F5.js +476 -0
  26. package/dist/chunks/{chunk-BB7ETSJK.js → chunk-Y6AVNVOD.js} +150 -4
  27. package/dist/chunks/chunk-ZB5FVHI7.js +618 -0
  28. package/dist/chunks/{host-image-fallback-3TEMOQM5.js → host-image-fallback-NXY36VO2.js} +1 -1
  29. package/dist/chunks/{manager-cli-BXI4UFTJ.js → manager-cli-OTIMAWO6.js} +280 -299
  30. package/dist/chunks/{manager-upgrade-XPFXKO7A.js → manager-upgrade-DYRQ7YZ5.js} +101 -69
  31. package/dist/chunks/memory-git-C3S276QJ.js +19 -0
  32. package/dist/chunks/{model-registry-MGZO2RBN.js → model-registry-QNEPISBJ.js} +11 -3
  33. package/dist/chunks/{read-file-understanding-N2ZZQLTZ.js → read-file-understanding-ZCBNCQHG.js} +3 -3
  34. package/dist/chunks/{src-F5N6O2HR.js → src-7CU7OTQS.js} +36 -36
  35. package/dist/chunks/{src-3PSR2AAX.js → src-7MZZJVOG.js} +1 -1
  36. package/dist/cli.js +740 -512
  37. package/package.json +2 -2
  38. package/dist/chunks/chunk-L7XXKNZW.js +0 -386
  39. package/dist/chunks/chunk-ZPJ3BNQB.js +0 -126
@@ -1,13 +1,24 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+ import {
3
+ acquireUpgradeLock,
4
+ parseLaunchctlServiceState,
5
+ parseSystemctlServiceState,
6
+ queryPlatformServiceState,
7
+ scanLinuxServiceBlockingWorkers,
8
+ stopAndRefreshWindowsServiceForUpgrade
9
+ } from "./chunk-ZB5FVHI7.js";
2
10
  import {
3
11
  normalizePreInstallStopOutcome,
12
+ parseWindowsTaskNumericState,
13
+ queryWindowsServiceTaskState,
4
14
  resolveDefaultTuiUsePidFile,
5
15
  runWindowsPreInstallStop,
6
16
  scanBlockingWindowsPeers
7
- } from "./chunk-BB7ETSJK.js";
17
+ } from "./chunk-Y6AVNVOD.js";
8
18
  import {
9
19
  readProcessCommandLine
10
20
  } from "./chunk-7RJXKN7N.js";
21
+ import "./chunk-Q4NJEPIZ.js";
11
22
  import {
12
23
  VERSION
13
24
  } from "./chunk-CBDQJMUI.js";
@@ -128,8 +139,8 @@ function scanWorkers(discoveryDir) {
128
139
  if (parsed.unattended !== true || parsed.isManager === true) continue;
129
140
  try {
130
141
  process.kill(parsed.pid, 0);
131
- } catch {
132
- continue;
142
+ } catch (error) {
143
+ if (error.code === "ESRCH") continue;
133
144
  }
134
145
  out.push({
135
146
  pid: parsed.pid,
@@ -231,12 +242,28 @@ async function performUpgrade(paths, effects, options) {
231
242
  if (busy.busy) {
232
243
  return finish(build("guard", `refused: the manager is ${busy.state ?? "busy"} (an active turn would be cancelled); retry when idle`));
233
244
  }
245
+ if (state.service === true && effects.serviceRestartWorkersBusy) {
246
+ const workersBusy = effects.serviceRestartWorkersBusy();
247
+ if (workersBusy.busy) {
248
+ return finish(build("guard", `refused: service restart could terminate active/unverified worker(s) (${workersBusy.detail ?? "unknown"}); retry when workers are idle`));
249
+ }
250
+ }
234
251
  stage = "install";
235
252
  const view = options.target === "latest" ? effects.npmViewLatest() : { version: options.target, tail: "" };
236
253
  const toVersion = view.version;
237
254
  if (!toVersion) {
238
255
  return finish(build("install", `could not resolve the target version (${options.target}): ${view.tail || "npm view returned nothing usable"}`));
239
256
  }
257
+ const busyAfterView = effects.managerBusy();
258
+ if (busyAfterView.busy) {
259
+ return finish(build("guard", `refused: the manager became ${busyAfterView.state ?? "busy"} while resolving version (an active turn would be cancelled); retry when idle`));
260
+ }
261
+ if (state.service === true && effects.serviceRestartWorkersBusy) {
262
+ const workersBusyAfterView = effects.serviceRestartWorkersBusy();
263
+ if (workersBusyAfterView.busy) {
264
+ return finish(build("guard", `refused: service restart could terminate active/unverified worker(s) (${workersBusyAfterView.detail ?? "unknown"}); retry when workers are idle`));
265
+ }
266
+ }
240
267
  const differs = versionDiffers(fromVersion, toVersion);
241
268
  const residency = effects.residentStatus(state);
242
269
  if (!differs && !options.force) {
@@ -283,8 +310,24 @@ ${target.detail}${recovery}`));
283
310
  }
284
311
  async function restartAndRecycle(effects, paths, state, fromVersion, toVersion, setStage, build) {
285
312
  setStage("restart");
313
+ const busyBeforeRestart = effects.managerBusy();
314
+ if (busyBeforeRestart.busy) {
315
+ return build(
316
+ "restart",
317
+ `refused: @cydm/pie@${toVersion} is installed, but the manager became ${busyBeforeRestart.state ?? "busy"} before restart (an active turn would be cancelled); restart deferred \u2014 restart the manager once idle (pie manager stop && pie manager start, or pie manager upgrade --force).`
318
+ );
319
+ }
286
320
  let successorPid;
287
321
  if (state.service === true) {
322
+ if (effects.serviceRestartWorkersBusy) {
323
+ const workersBusy = effects.serviceRestartWorkersBusy();
324
+ if (workersBusy.busy) {
325
+ return build(
326
+ "restart",
327
+ `refused: @cydm/pie@${toVersion} is installed, but service restart could terminate active/unverified worker(s) (${workersBusy.detail ?? "unknown"}); restart deferred \u2014 retry once workers are idle.`
328
+ );
329
+ }
330
+ }
288
331
  const restarted = effects.serviceRestart(state, toVersion);
289
332
  if (!restarted.ok) {
290
333
  return build("restart", `service restart not verified: ${restarted.detail ?? "unknown"}. The install succeeded; run pie manager upgrade again (repair) or restart the service manually.`);
@@ -349,63 +392,6 @@ function writeResultAtomic(resultFile, result, log) {
349
392
  log(`upgrade: could not write the result file: ${error instanceof Error ? error.message : String(error)}`);
350
393
  }
351
394
  }
352
- function tryLockWithReclamation(lockFile) {
353
- const attempt = () => {
354
- try {
355
- fs.mkdirSync(path.dirname(lockFile), { recursive: true });
356
- const tmp = `${lockFile}.${process.pid}.tmp`;
357
- fs.writeFileSync(tmp, JSON.stringify({ pid: process.pid, at: Date.now() }));
358
- fs.linkSync(tmp, lockFile);
359
- try {
360
- fs.rmSync(tmp, { force: true });
361
- } catch {
362
- }
363
- return true;
364
- } catch {
365
- try {
366
- fs.rmSync(`${lockFile}.${process.pid}.tmp`, { force: true });
367
- } catch {
368
- }
369
- return false;
370
- }
371
- };
372
- if (attempt()) return true;
373
- let holderPid;
374
- try {
375
- const holder = JSON.parse(fs.readFileSync(lockFile, "utf8"));
376
- if (typeof holder.pid === "number" && Number.isInteger(holder.pid) && holder.pid > 0) holderPid = holder.pid;
377
- } catch {
378
- }
379
- if (holderPid === void 0) return false;
380
- try {
381
- process.kill(holderPid, 0);
382
- return false;
383
- } catch (error) {
384
- if (error.code !== "ESRCH") return false;
385
- }
386
- try {
387
- fs.rmSync(lockFile, { force: true });
388
- } catch {
389
- }
390
- if (!attempt()) return false;
391
- try {
392
- const verify = JSON.parse(fs.readFileSync(lockFile, "utf8"));
393
- return verify.pid === process.pid;
394
- } catch {
395
- return false;
396
- }
397
- }
398
- function unlockOwned(lockFile) {
399
- try {
400
- const holder = JSON.parse(fs.readFileSync(lockFile, "utf8"));
401
- if (holder.pid !== process.pid) return;
402
- } catch {
403
- }
404
- try {
405
- fs.rmSync(lockFile, { force: true });
406
- } catch {
407
- }
408
- }
409
395
  function insideServiceCgroup() {
410
396
  if (process.platform !== "linux") return false;
411
397
  try {
@@ -416,6 +402,7 @@ function insideServiceCgroup() {
416
402
  }
417
403
  function cliEffects(paths, log) {
418
404
  const npm = resolveNpm(process.execPath);
405
+ let activeLock = null;
419
406
  const effects = {
420
407
  npmInstall: (target) => runNpm(npm, ["install", "-g", `@cydm/pie@${target}`], 5 * 6e4),
421
408
  installTargetCheck: () => {
@@ -476,14 +463,30 @@ function cliEffects(paths, log) {
476
463
  return residentCommandLineLooksLikePie(state.pid, state.sessionId) !== void 0 ? "alive" : "foreign";
477
464
  }
478
465
  const resident = findManagerResident(paths.discoveryDir, state.sessionId);
479
- if (!resident) return "dead";
466
+ if (!resident) {
467
+ if (state.service === true) {
468
+ return queryPlatformServiceState() === "stopped" ? "dead" : "unknown";
469
+ }
470
+ return "dead";
471
+ }
480
472
  return residentCommandLineLooksLikePie(resident.pid, state.sessionId) !== void 0 ? "alive" : "unknown";
481
473
  },
482
474
  managerBusy: () => {
483
475
  const state = effects.readState();
484
476
  const resident = findManagerResident(paths.discoveryDir, state?.sessionId);
485
- if (!resident) return { busy: false };
486
- if (resident.state === "working" || resident.state === "blocked") return { busy: true, state: resident.state };
477
+ if (!resident) {
478
+ if (state && typeof state.pid === "number" && state.pid > 0 && effects.residentStatus(state) === "alive") {
479
+ return { busy: true, state: "unknown (discovery unavailable)" };
480
+ }
481
+ if (state?.service === true) {
482
+ const svcState = queryPlatformServiceState();
483
+ if (svcState !== "stopped") {
484
+ return { busy: true, state: `unknown (service ${svcState} without discovery)` };
485
+ }
486
+ }
487
+ return { busy: false };
488
+ }
489
+ if (resident.state !== "idle") return { busy: true, state: resident.state ?? "unknown" };
487
490
  return { busy: false };
488
491
  },
489
492
  terminateResident: (state) => {
@@ -571,15 +574,29 @@ function cliEffects(paths, log) {
571
574
  const r = spawnSync("launchctl", ["kickstart", "-k", `gui/${uid}/dev.pie.manager`], { encoding: "utf8", timeout: 2e4 });
572
575
  restartDetail = `${r.stdout ?? ""}${r.stderr ?? ""}`.trim();
573
576
  restartFailed = r.status !== 0;
577
+ if (restartFailed && /Could not find service/i.test(restartDetail)) {
578
+ const plist = path.join(os.homedir(), "Library", "LaunchAgents", "dev.pie.manager.plist");
579
+ if (fs.existsSync(plist)) {
580
+ const loaded = spawnSync("launchctl", ["load", plist], { encoding: "utf8", timeout: 2e4 });
581
+ restartDetail = `${loaded.stdout ?? ""}${loaded.stderr ?? ""}`.trim();
582
+ restartFailed = loaded.status !== 0;
583
+ }
584
+ }
574
585
  } else if (process.platform === "linux") {
575
586
  const r = spawnSync("systemctl", ["--user", "restart", "dev.pie.manager"], { encoding: "utf8", timeout: 2e4 });
576
587
  restartDetail = `${r.stdout ?? ""}${r.stderr ?? ""}`.trim();
577
588
  restartFailed = r.status !== 0;
578
589
  } else if (process.platform === "win32") {
579
- spawnSync("schtasks", ["/End", "/TN", "dev.pie.manager"], { encoding: "utf8", timeout: 2e4, windowsHide: true });
580
- const r = spawnSync("schtasks", ["/Run", "/TN", "dev.pie.manager"], { encoding: "utf8", timeout: 2e4, windowsHide: true });
581
- restartDetail = `${r.stdout ?? ""}${r.stderr ?? ""}`.trim();
582
- restartFailed = r.status !== 0;
590
+ const prep = stopAndRefreshWindowsServiceForUpgrade({ taskName: "dev.pie.manager", workingDir: paths.workspaceDir, nodePath: process.execPath, entryPath: paths.entryPath, sessionId: state.sessionId, env: process.env });
591
+ if (!prep.ok) {
592
+ restartDetail = prep.detail ?? "Windows service stop before refresh failed";
593
+ restartFailed = true;
594
+ } else {
595
+ if (!prep.refreshed && prep.refreshDetail) log(`[manager-upgrade] service launcher refresh not applied: ${prep.refreshDetail}`);
596
+ const r = spawnSync("schtasks", ["/Run", "/TN", "dev.pie.manager"], { encoding: "utf8", timeout: 2e4, windowsHide: true });
597
+ restartDetail = `${r.stdout ?? ""}${r.stderr ?? ""}`.trim();
598
+ restartFailed = r.status !== 0;
599
+ }
583
600
  } else {
584
601
  return { ok: false, detail: `unsupported platform ${process.platform}` };
585
602
  }
@@ -627,8 +644,15 @@ function cliEffects(paths, log) {
627
644
  }
628
645
  },
629
646
  writeResult: (result) => writeResultAtomic(paths.resultFile, result, log),
630
- tryLock: () => tryLockWithReclamation(paths.lockFile),
631
- unlock: () => unlockOwned(paths.lockFile),
647
+ tryLock: () => {
648
+ activeLock = acquireUpgradeLock(paths.lockFile);
649
+ return activeLock !== null;
650
+ },
651
+ unlock: () => {
652
+ activeLock?.release();
653
+ activeLock = null;
654
+ },
655
+ ...process.platform === "linux" || process.platform === "win32" ? { serviceRestartWorkersBusy: () => scanLinuxServiceBlockingWorkers(paths.discoveryDir) } : {},
632
656
  ...process.platform === "win32" ? {
633
657
  preInstallStop: (state) => runWindowsPreInstallStop(state, {
634
658
  scanBlockingPeers: (s) => scanBlockingWindowsPeers(paths.discoveryDir, s.sessionId, s.pid, {
@@ -647,6 +671,7 @@ function cliEffects(paths, log) {
647
671
  ...r.error ? { spawnError: r.error.message } : {}
648
672
  };
649
673
  },
674
+ isServiceTaskRunning: () => queryWindowsServiceTaskState(),
650
675
  waitExit: (pid, timeoutMs) => effects.waitExit(pid, timeoutMs),
651
676
  isPidAlive: (pid) => {
652
677
  try {
@@ -672,18 +697,25 @@ function parseTarget(raw) {
672
697
  return /^\d+\.\d+\.\d+(-[\w.-]+)?$/.test(raw.trim()) ? raw.trim() : void 0;
673
698
  }
674
699
  export {
700
+ acquireUpgradeLock,
675
701
  cliEffects,
676
702
  findManagerResident,
677
703
  isDistInstall,
704
+ parseLaunchctlServiceState,
705
+ parseSystemctlServiceState,
678
706
  parseTarget,
679
707
  parseViewVersion,
708
+ parseWindowsTaskNumericState,
680
709
  partitionWorkers,
681
710
  performUpgrade,
682
711
  processStartedAt,
712
+ queryPlatformServiceState,
713
+ queryWindowsServiceTaskState,
683
714
  readUpgradeResult,
684
715
  residentCommandLineLooksLikePie,
685
716
  resolveNpm,
686
717
  runNpm,
718
+ scanLinuxServiceBlockingWorkers,
687
719
  scanWorkers,
688
720
  upgradePaths,
689
721
  versionDiffers
@@ -0,0 +1,19 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+ import {
3
+ commitCuratedMemoryBestEffort,
4
+ ensureMemoryGitIgnore,
5
+ isMemoryGitInitialized,
6
+ readCuratedMemoryGitLog
7
+ } from "./chunk-26ILLZKQ.js";
8
+ import "./chunk-KW46ND3S.js";
9
+ import "./chunk-SXBX2P5R.js";
10
+ import "./chunk-BQWHLYYZ.js";
11
+ import "./chunk-G2K4GY6N.js";
12
+ import "./chunk-XXGYUYXI.js";
13
+ import "./chunk-LZQXQOPJ.js";
14
+ export {
15
+ commitCuratedMemoryBestEffort,
16
+ ensureMemoryGitIgnore,
17
+ isMemoryGitInitialized,
18
+ readCuratedMemoryGitLog
19
+ };
@@ -3,8 +3,12 @@ import {
3
3
  ModelRegistry,
4
4
  assertNoSecretSubstrings,
5
5
  configuredRemoteCredentialValues,
6
- loadResolvedModelsConfig
7
- } from "./chunk-B5GKDXVG.js";
6
+ loadResolvedModelsConfig,
7
+ resolveProfileRoute,
8
+ validateModelsDocumentShape,
9
+ validateProfileConfig,
10
+ validatedRemoteCatalogs
11
+ } from "./chunk-IZ4DYCJ7.js";
8
12
  import "./chunk-CBDQJMUI.js";
9
13
  import "./chunk-G2K4GY6N.js";
10
14
  import "./chunk-XXGYUYXI.js";
@@ -13,5 +17,9 @@ export {
13
17
  ModelRegistry,
14
18
  assertNoSecretSubstrings,
15
19
  configuredRemoteCredentialValues,
16
- loadResolvedModelsConfig
20
+ loadResolvedModelsConfig,
21
+ resolveProfileRoute,
22
+ validateModelsDocumentShape,
23
+ validateProfileConfig,
24
+ validatedRemoteCatalogs
17
25
  };
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  understandReadFile
4
- } from "./chunk-BTUMBUDU.js";
5
- import "./chunk-HK3FHIAH.js";
6
- import "./chunk-5QMS6RQC.js";
4
+ } from "./chunk-QSXBPTOA.js";
5
+ import "./chunk-KW46ND3S.js";
6
+ import "./chunk-SXBX2P5R.js";
7
7
  import "./chunk-BQWHLYYZ.js";
8
8
  import "./chunk-F7EBZTZO.js";
9
9
  import "./chunk-G2K4GY6N.js";
@@ -13,7 +13,7 @@ import {
13
13
  DEFAULT_SESSION_STORE_MAX_AGE_MS,
14
14
  DEFAULT_SESSION_STORE_MAX_RECORDS,
15
15
  DEFAULT_SUBAGENT_THINKING_LEVEL,
16
- DISTILL_SYSTEM,
16
+ DEFAULT_WIKI_LIMITS,
17
17
  GREP_MAX_LINE_LENGTH,
18
18
  MANAGE_TODO_LIST_TOOL_DESCRIPTION,
19
19
  MAX_DIFF_EDIT_LENGTH,
@@ -35,21 +35,17 @@ import {
35
35
  SESSION_RECORD_MAX_CHARS,
36
36
  SESSION_TRANSCRIPT_WARN_CHARS,
37
37
  SUBAGENT_SESSION_RECORD_VERSION,
38
- SYNTHESIZE_SYSTEM,
39
38
  SearchContextSchema,
40
39
  TodoInputItemSchema,
40
+ WikiStore,
41
41
  abortExecutionState,
42
- appendRetireSection,
43
- applyNextGatedPatch,
44
42
  assertBoundedGlobPattern,
43
+ authenticateDreamSignals,
45
44
  boundEditOutput,
46
45
  buildDirectImageUnderstandingContent,
47
- buildDistillPrompt,
48
46
  buildExecutionReminder,
49
47
  buildPathResolutionDescription,
50
48
  buildReadFileUnderstandingPrompt,
51
- buildRetentionOps,
52
- buildRetireSuggestions,
53
49
  buildRootParameterSchema,
54
50
  buildTodoClosureContinuePrompt,
55
51
  buildTodoSuccessMessage,
@@ -60,7 +56,6 @@ import {
60
56
  clearExecutionState,
61
57
  cloneExecutionState,
62
58
  cloneTodos,
63
- clusterCandidates,
64
59
  collectFilesForGrep,
65
60
  collectLastAssistantText,
66
61
  collectProjectKeyAliases,
@@ -110,15 +105,14 @@ import {
110
105
  defineSharedCapability,
111
106
  describeClosestRegion,
112
107
  describeToolPolicyDecision,
113
- detectLanguage,
114
108
  detectLineEnding,
115
109
  detectTextOnlyBinary,
116
110
  detectUnderstandingKind,
117
111
  differentSubjects,
118
- distillSession,
119
112
  entryConsumedIn,
120
113
  equivalentAssertions,
121
114
  estimateTranscriptChars,
115
+ estimateWikiTokens,
122
116
  evaluateTodoClosureAfterAbort,
123
117
  evaluateTodoClosureAfterCompletedTurn,
124
118
  evaluateTodoClosureAfterFailedTurn,
@@ -126,15 +120,17 @@ import {
126
120
  executeManageTodoList,
127
121
  executionStateToTodos,
128
122
  extractDoneSteps,
123
+ extractDreamSignalsForSession,
129
124
  extractPlanTodoItems,
130
125
  extractVerifiedSteps,
126
+ extractWikiSessionIds,
131
127
  findEditMatch,
128
+ findExpiredDateAnchors,
132
129
  formatCapabilityPolicySummary,
133
130
  formatSize,
134
131
  formatSkillSummariesForPrompt,
135
132
  formatSkillsForPrompt,
136
133
  fuzzyFindText,
137
- gateClusters,
138
134
  generateDiffString,
139
135
  getAvailableRoots,
140
136
  getDefaultRootName,
@@ -157,8 +153,8 @@ import {
157
153
  isRetired,
158
154
  isToolAllowedInPlanMode,
159
155
  legacyProjectKeyFor,
160
- listGatedPatches,
161
156
  looksLikeSecretPresent,
157
+ lookupSessionEvidence,
162
158
  markCompletedPlanSteps,
163
159
  materialConsumedIn,
164
160
  maybeAdvanceTodoExecutionState,
@@ -171,7 +167,9 @@ import {
171
167
  normalizeStatus,
172
168
  normalizeToLF,
173
169
  normalizeTodos,
174
- parseDistillResponse,
170
+ normalizeWikiRelPath,
171
+ parseWikiDreamOutput,
172
+ parseWikiFrontmatter,
175
173
  pauseExecutionState,
176
174
  planWebResearchQueries,
177
175
  polarity,
@@ -195,34 +193,36 @@ import {
195
193
  restoreTodoState,
196
194
  restoreTodosFromMessages,
197
195
  retainLiveSession,
198
- runCatchUp,
199
- runDistillation,
196
+ runWikiBootstrap,
197
+ runWikiDream,
198
+ runWikiGc,
200
199
  saveAttestedEntry,
201
200
  scoreWebResearchSource,
202
201
  searchMemory,
203
202
  selectToolsForRuntimePolicy,
204
203
  shouldPreserveExecutionStateForUserText,
204
+ slugifyWikiName,
205
205
  snapshotFromStatAndContent,
206
206
  snapshotFromStatAndHash,
207
207
  snapshotsHaveSameContent,
208
208
  stripBom,
209
209
  subagentOutputBudget,
210
210
  supersedeExecutionState,
211
- synthesizePatch,
212
211
  toSessionRecord,
213
212
  todayKey,
214
213
  tokenJaccard,
215
214
  tokenizeCasePreserving,
216
215
  touchLiveSession,
217
216
  transplantMessages,
217
+ trimHarvestedSession,
218
218
  truncateHead,
219
219
  truncateLine,
220
220
  truncateTail,
221
221
  understandFileWithModel,
222
222
  validateTodos,
223
- writeJournalNarrative
224
- } from "./chunk-HK3FHIAH.js";
225
- import "./chunk-5QMS6RQC.js";
223
+ validateWikiPageContent
224
+ } from "./chunk-KW46ND3S.js";
225
+ import "./chunk-SXBX2P5R.js";
226
226
  import "./chunk-BQWHLYYZ.js";
227
227
  import {
228
228
  hashText
@@ -243,7 +243,7 @@ export {
243
243
  DEFAULT_SESSION_STORE_MAX_AGE_MS,
244
244
  DEFAULT_SESSION_STORE_MAX_RECORDS,
245
245
  DEFAULT_SUBAGENT_THINKING_LEVEL,
246
- DISTILL_SYSTEM,
246
+ DEFAULT_WIKI_LIMITS,
247
247
  GREP_MAX_LINE_LENGTH,
248
248
  MANAGE_TODO_LIST_TOOL_DESCRIPTION,
249
249
  MAX_DIFF_EDIT_LENGTH,
@@ -265,21 +265,17 @@ export {
265
265
  SESSION_RECORD_MAX_CHARS,
266
266
  SESSION_TRANSCRIPT_WARN_CHARS,
267
267
  SUBAGENT_SESSION_RECORD_VERSION,
268
- SYNTHESIZE_SYSTEM,
269
268
  SearchContextSchema,
270
269
  TodoInputItemSchema,
270
+ WikiStore,
271
271
  abortExecutionState,
272
- appendRetireSection,
273
- applyNextGatedPatch,
274
272
  assertBoundedGlobPattern,
273
+ authenticateDreamSignals,
275
274
  boundEditOutput,
276
275
  buildDirectImageUnderstandingContent,
277
- buildDistillPrompt,
278
276
  buildExecutionReminder,
279
277
  buildPathResolutionDescription,
280
278
  buildReadFileUnderstandingPrompt,
281
- buildRetentionOps,
282
- buildRetireSuggestions,
283
279
  buildRootParameterSchema,
284
280
  buildTodoClosureContinuePrompt,
285
281
  buildTodoSuccessMessage,
@@ -290,7 +286,6 @@ export {
290
286
  clearExecutionState,
291
287
  cloneExecutionState,
292
288
  cloneTodos,
293
- clusterCandidates,
294
289
  collectFilesForGrep,
295
290
  collectLastAssistantText,
296
291
  collectProjectKeyAliases,
@@ -340,15 +335,14 @@ export {
340
335
  defineSharedCapability,
341
336
  describeClosestRegion,
342
337
  describeToolPolicyDecision,
343
- detectLanguage,
344
338
  detectLineEnding,
345
339
  detectTextOnlyBinary,
346
340
  detectUnderstandingKind,
347
341
  differentSubjects,
348
- distillSession,
349
342
  entryConsumedIn,
350
343
  equivalentAssertions,
351
344
  estimateTranscriptChars,
345
+ estimateWikiTokens,
352
346
  evaluateTodoClosureAfterAbort,
353
347
  evaluateTodoClosureAfterCompletedTurn,
354
348
  evaluateTodoClosureAfterFailedTurn,
@@ -356,15 +350,17 @@ export {
356
350
  executeManageTodoList,
357
351
  executionStateToTodos,
358
352
  extractDoneSteps,
353
+ extractDreamSignalsForSession,
359
354
  extractPlanTodoItems,
360
355
  extractVerifiedSteps,
356
+ extractWikiSessionIds,
361
357
  findEditMatch,
358
+ findExpiredDateAnchors,
362
359
  formatCapabilityPolicySummary,
363
360
  formatSize,
364
361
  formatSkillSummariesForPrompt,
365
362
  formatSkillsForPrompt,
366
363
  fuzzyFindText,
367
- gateClusters,
368
364
  generateDiffString,
369
365
  getAvailableRoots,
370
366
  getDefaultRootName,
@@ -388,8 +384,8 @@ export {
388
384
  isRetired,
389
385
  isToolAllowedInPlanMode,
390
386
  legacyProjectKeyFor,
391
- listGatedPatches,
392
387
  looksLikeSecretPresent,
388
+ lookupSessionEvidence,
393
389
  markCompletedPlanSteps,
394
390
  materialConsumedIn,
395
391
  maybeAdvanceTodoExecutionState,
@@ -402,7 +398,9 @@ export {
402
398
  normalizeStatus,
403
399
  normalizeToLF,
404
400
  normalizeTodos,
405
- parseDistillResponse,
401
+ normalizeWikiRelPath,
402
+ parseWikiDreamOutput,
403
+ parseWikiFrontmatter,
406
404
  pauseExecutionState,
407
405
  planWebResearchQueries,
408
406
  polarity,
@@ -426,30 +424,32 @@ export {
426
424
  restoreTodoState,
427
425
  restoreTodosFromMessages,
428
426
  retainLiveSession,
429
- runCatchUp,
430
- runDistillation,
427
+ runWikiBootstrap,
428
+ runWikiDream,
429
+ runWikiGc,
431
430
  saveAttestedEntry,
432
431
  scoreWebResearchSource,
433
432
  searchMemory,
434
433
  selectToolsForRuntimePolicy,
435
434
  shouldPreserveExecutionStateForUserText,
435
+ slugifyWikiName,
436
436
  snapshotFromStatAndContent,
437
437
  snapshotFromStatAndHash,
438
438
  snapshotsHaveSameContent,
439
439
  stripBom,
440
440
  subagentOutputBudget,
441
441
  supersedeExecutionState,
442
- synthesizePatch,
443
442
  toSessionRecord,
444
443
  todayKey,
445
444
  tokenJaccard,
446
445
  tokenizeCasePreserving,
447
446
  touchLiveSession,
448
447
  transplantMessages,
448
+ trimHarvestedSession,
449
449
  truncateHead,
450
450
  truncateLine,
451
451
  truncateTail,
452
452
  understandFileWithModel,
453
453
  validateTodos,
454
- writeJournalNarrative
454
+ validateWikiPageContent
455
455
  };
@@ -142,7 +142,7 @@ import {
142
142
  substituteArgs,
143
143
  validateRetainedTailEntries,
144
144
  verifyPreparedCompactionCommit
145
- } from "./chunk-5QMS6RQC.js";
145
+ } from "./chunk-SXBX2P5R.js";
146
146
  import "./chunk-BQWHLYYZ.js";
147
147
  import "./chunk-G2K4GY6N.js";
148
148
  import "./chunk-XXGYUYXI.js";