@cydm/pie 4.3.4 → 4.3.6

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.
@@ -18,6 +18,7 @@ import {
18
18
  readLiveConfig,
19
19
  readLiveEnabled,
20
20
  registerDispatchReceiver,
21
+ registerTurnImDriver,
21
22
  resolveConfig,
22
23
  resolveConfigDir,
23
24
  resolveImForwardConfig,
@@ -26,7 +27,7 @@ import {
26
27
  truncateMarkdown,
27
28
  tryClaimConsumer,
28
29
  writeConfig
29
- } from "../../../chunks/chunk-HT6J4QOC.js";
30
+ } from "../../../chunks/chunk-H5G55G3R.js";
30
31
  import {
31
32
  detectImageMime,
32
33
  readImageFormat
@@ -669,7 +670,7 @@ function hashText(input) {
669
670
  function createRuntime(ctx, cfg, connection, liveEnabled, persistEnabled) {
670
671
  const IM_INPUT_PREFIX = connection.sourcePrefix;
671
672
  const key = (id) => JSON.stringify([cfg.provider, id]);
672
- const isConcierge = cfg.unattended === true;
673
+ const isManager = cfg.unattended === true;
673
674
  const scopes = /* @__PURE__ */ new Set();
674
675
  let forwardingEnabled = cfg.enabled === true;
675
676
  let configurationFailed = false;
@@ -874,7 +875,7 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
874
875
  }
875
876
  ctx.on("terminal:input", (event) => {
876
877
  const text = event.text?.trim() ?? "";
877
- if (isConcierge && /^\[pie-ipc\][^\n]*says:\s*\n?\[ipc-done\] requestId=[a-zA-Z0-9:-]+ (?:outcome=\S+ )?user_assigned=true(?:\s|$)/.test(text) && currentSessionId) {
878
+ if (isManager && /^\[pie-ipc\][^\n]*says:\s*\n?\[ipc-done\] requestId=[a-zA-Z0-9:-]+ (?:outcome=\S+ )?user_assigned=true(?:\s|$)/.test(text) && currentSessionId) {
878
879
  const requestTag = /requestId=([a-zA-Z0-9:-]+)/.exec(text)?.[1] ?? "ipc-delivery";
879
880
  stampDeliveryDestination(`ipc-done:${requestTag}`);
880
881
  }
@@ -891,7 +892,7 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
891
892
  return { action: "continue" };
892
893
  });
893
894
  function outboundRoleAllows(attribution) {
894
- if (!isConcierge) return true;
895
+ if (!isManager) return true;
895
896
  if (attribution !== void 0) return true;
896
897
  pruneDeliveryDestinations();
897
898
  const scope = `s:${currentSessionId}:`;
@@ -932,9 +933,10 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
932
933
  return;
933
934
  }
934
935
  }
935
- if (inbound?.role === "user" && isConcierge && currentSessionId) {
936
+ if (inbound?.role === "user" && isManager && currentSessionId) {
936
937
  const userText = typeof inbound.content === "string" ? inbound.content : Array.isArray(inbound.content) ? inbound.content.map((block) => block && typeof block === "object" && typeof block.text === "string" ? block.text : "").join("") : "";
937
- const wrappedNotify = /^\[pie-ipc\][^\n]*says:\s*\n?\[ipc-done\] requestId=[a-zA-Z0-9:-]+ (?:outcome=\S+ )?user_assigned=true(?:\s|$)/.exec(userText);
938
+ const stampedWake = /^\[pie-ipc\][^\n]*says:\s*\n?\[(?:ipc-done|ipc-check|ipc-done-check)\] (?:No completion notification arrived for |The completion notification for )?requestId=[a-zA-Z0-9:-]+ (?:outcome=\S+ )?(?:\([^)]*\) )?user_assigned=true(?:\s|$)/;
939
+ const wrappedNotify = stampedWake.exec(userText);
938
940
  if (wrappedNotify) {
939
941
  const requestTag = /requestId=([a-zA-Z0-9:-]+)/.exec(userText)?.[1] ?? "ipc-delivery";
940
942
  stampDeliveryDestination(`ipc-done:${requestTag}`);
@@ -1014,7 +1016,7 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
1014
1016
  let sessionAnchorThreadId = sessionAnchor.threadId;
1015
1017
  let stakeFlightToken;
1016
1018
  const stakeWanted = () => {
1017
- if (isConcierge) return false;
1019
+ if (isManager) return false;
1018
1020
  const current = resolveSessionAnchor(sessionId);
1019
1021
  sessionAnchorThreadId = current.threadId;
1020
1022
  return !current.messageId || !current.threadId;
@@ -1031,7 +1033,7 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
1031
1033
  };
1032
1034
  const pinnedAnchor = replyTo ?? attributionAnchor;
1033
1035
  let stakeGuard = 8;
1034
- while (stakeGuard-- > 0 && !isConcierge) {
1036
+ while (stakeGuard-- > 0 && !isManager) {
1035
1037
  if (stakeFlightToken) break;
1036
1038
  const refreshed0 = resolveSessionAnchor(sessionId);
1037
1039
  if (refreshed0.threadId) {
@@ -1052,7 +1054,7 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
1052
1054
  sessionAnchorThreadId = refreshed.threadId;
1053
1055
  if (!pinnedAnchor && refreshed.messageId && !refreshed.threadId) anchor = refreshed.messageId;
1054
1056
  }
1055
- if (!isConcierge && !stakeFlightToken && !pinnedAnchor) {
1057
+ if (!isManager && !stakeFlightToken && !pinnedAnchor) {
1056
1058
  const last = resolveSessionAnchor(sessionId);
1057
1059
  if (!last.threadId) {
1058
1060
  ctx.log(`im-forward: topic stake unavailable for ${sessionId}; dropping forward (seq=${sequence})`);
@@ -1067,7 +1069,7 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
1067
1069
  token.release?.();
1068
1070
  anchorStakeFlights.delete(sessionId);
1069
1071
  };
1070
- let threadPlacement = attribution?.threadId ? { replyInThread: true } : !anchor && !isConcierge ? { replyInThread: true } : sessionAnchorThreadId ? { replyInThread: true, topicId: sessionAnchorThreadId } : { replyInThread: false };
1072
+ let threadPlacement = attribution?.threadId ? { replyInThread: true } : !anchor && !isManager ? { replyInThread: true } : sessionAnchorThreadId ? { replyInThread: true, topicId: sessionAnchorThreadId } : { replyInThread: false };
1071
1073
  const sendChunk = async (index) => {
1072
1074
  const key2 = chunkKey(baseKey, index);
1073
1075
  return providerCall(
@@ -1118,7 +1120,7 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
1118
1120
  return;
1119
1121
  }
1120
1122
  registerRoute(sent, sessionId);
1121
- const legacyUpgrade = !isConcierge && anchor !== void 0 && !sessionAnchor.threadId && sent.messageId !== anchor;
1123
+ const legacyUpgrade = !isManager && anchor !== void 0 && !sessionAnchor.threadId && sent.messageId !== anchor;
1122
1124
  const stakeNeeded = stakeFlightToken !== void 0;
1123
1125
  if (stakeNeeded) {
1124
1126
  try {
@@ -1280,6 +1282,30 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
1280
1282
  claimThread: seamClaimThread,
1281
1283
  anchors: sentAnchors
1282
1284
  };
1285
+ registerTurnImDriver(() => {
1286
+ const sid = currentSessionId;
1287
+ if (!sid) return false;
1288
+ const messages = ctx.getMessages?.() ?? [];
1289
+ let lastUserText;
1290
+ for (let i = messages.length - 1; i >= 0; i--) {
1291
+ const message = messages[i];
1292
+ if (!isRecord(message) || message.role !== "user") continue;
1293
+ const joined = (typeof message.content === "string" ? message.content : Array.isArray(message.content) ? message.content.map((block) => isRecord(block) && typeof block.text === "string" ? block.text : "").join("") : "").trim();
1294
+ if (joined) {
1295
+ lastUserText = joined;
1296
+ break;
1297
+ }
1298
+ }
1299
+ if (!lastUserText) return false;
1300
+ for (let j = 0; j < pendingInputs.length; j++) {
1301
+ const pending = pendingInputs[j];
1302
+ if (pending.sessionId !== sid) continue;
1303
+ const expected = (pending.messageId ? `${IM_INPUT_PREFIX}
1304
+ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
1305
+ if (lastUserText === expected) return true;
1306
+ }
1307
+ return false;
1308
+ });
1283
1309
  registerDispatchReceiver((text) => {
1284
1310
  const trimmed = text.trimStart();
1285
1311
  if (!trimmed.startsWith(DISPATCH_PREFIX)) return false;
@@ -1435,7 +1461,7 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
1435
1461
  return;
1436
1462
  }
1437
1463
  const unanchored = !meta.replyTo && !meta.threadId;
1438
- if (isConcierge && unanchored) {
1464
+ if (isManager && unanchored) {
1439
1465
  const residentRoute = {
1440
1466
  messageId: "",
1441
1467
  threadId: meta.threadId ?? null,
@@ -1469,7 +1495,7 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
1469
1495
  ctx.log(`im-forward: thread ownership unreadable for ${messageId}; dropping (fail closed)`);
1470
1496
  return;
1471
1497
  }
1472
- if (isConcierge && event.chatType === "group" && meta.threadId) {
1498
+ if (isManager && event.chatType === "group" && meta.threadId) {
1473
1499
  if (!scope.isCurrent()) {
1474
1500
  releaseInvalidatedEvent();
1475
1501
  return;
@@ -1479,7 +1505,7 @@ ${pending.caption || IM_INPUT_FALLBACK_CAPTION}` : pending.caption).trim();
1479
1505
  ctx.log(`im-forward: unowned-topic takeover lost the claim (${claim.reason}); ${messageId} dropped`);
1480
1506
  return;
1481
1507
  }
1482
- ctx.log(`im-forward: unowned group topic ${meta.threadId} taken by concierge (claimed)`);
1508
+ ctx.log(`im-forward: unowned group topic ${meta.threadId} taken by manager (claimed)`);
1483
1509
  await acceptRoutedMessage(
1484
1510
  { messageId: "", threadId: meta.threadId, sessionId, sentAt: Date.now() },
1485
1511
  event,
@@ -1720,7 +1746,7 @@ ${caption || IM_INPUT_FALLBACK_CAPTION}`;
1720
1746
  }
1721
1747
  let consumerStartupInFlight = false;
1722
1748
  function residentAliveSomewhere() {
1723
- if (isConcierge) return false;
1749
+ if (isManager) return false;
1724
1750
  try {
1725
1751
  const dir = path.join(resolveConfigDir(), "run", "ipc");
1726
1752
  const entries = fs6.readdirSync(dir);
@@ -1759,7 +1785,7 @@ ${caption || IM_INPUT_FALLBACK_CAPTION}`;
1759
1785
  }
1760
1786
  function acquireClaimedSlot(binding) {
1761
1787
  if (consumerLock) return true;
1762
- if (!isConcierge && residentAliveSomewhere()) {
1788
+ if (!isManager && residentAliveSomewhere()) {
1763
1789
  ctx.log("im-forward: a live resident owns the feed class; standing down (dispatch mode)");
1764
1790
  return false;
1765
1791
  }
@@ -1937,6 +1963,7 @@ ${caption || IM_INPUT_FALLBACK_CAPTION}`;
1937
1963
  inputEpoch++;
1938
1964
  terminated = true;
1939
1965
  registerDispatchReceiver(void 0);
1966
+ registerTurnImDriver(void 0);
1940
1967
  consumerLock?.release();
1941
1968
  consumerLock = void 0;
1942
1969
  const resources = [...scopes];
@@ -1979,7 +2006,7 @@ ${caption || IM_INPUT_FALLBACK_CAPTION}`;
1979
2006
  // resident (this runtime, if unattended); anchored routing is
1980
2007
  // table-based and explicit addressing always works. Unconditional:
1981
2008
  // ownership is a capability axis, not route-table state.
1982
- cfg.unattended ? "- note: unanchored DM/@app messages bind to this resident session; reply/thread messages route to their referenced session." : "- note: interactive host \u2014 only reply/thread-attributed or explicitly addressed messages enter (unanchored messages belong to the resident concierge, if running)."
2009
+ cfg.unattended ? "- note: unanchored DM/@app messages bind to this resident session; reply/thread messages route to their referenced session." : "- note: interactive host \u2014 only reply/thread-attributed or explicitly addressed messages enter (unanchored messages belong to the resident manager, if running)."
1983
2010
  );
1984
2011
  if (lastSendError)
1985
2012
  lines.push(
@@ -15,6 +15,7 @@ import {
15
15
  clipBody,
16
16
  foldLifecycleEvent,
17
17
  generateInstanceId,
18
+ isTurnUserImDriven,
18
19
  isValidInstanceId,
19
20
  isWrappedInboundText,
20
21
  parseStatusFile,
@@ -24,7 +25,7 @@ import {
24
25
  takeDispatchFrame,
25
26
  wrapInboundText,
26
27
  wrappedMessageMarker
27
- } from "../../../chunks/chunk-HT6J4QOC.js";
28
+ } from "../../../chunks/chunk-H5G55G3R.js";
28
29
  import {
29
30
  Type
30
31
  } from "../../../chunks/chunk-XXGYUYXI.js";
@@ -1470,7 +1471,10 @@ var Runtime = class {
1470
1471
  return;
1471
1472
  }
1472
1473
  const doneMatch = /^\[ipc-done\] requestId=([a-zA-Z0-9:-]{1,128}) /.exec(envelope.text ?? "");
1473
- if (doneMatch && this.allowPolicy.allows(envelope.from)) this.completeNotify(doneMatch[1]);
1474
+ if (doneMatch && this.allowPolicy.allows(envelope.from)) {
1475
+ const stampedDone = /^\[ipc-done\] requestId=[a-zA-Z0-9:-]{1,128} (?:outcome=\S+ )?(?:\([^)]*\) )?user_assigned=true(?:\s|$)/.test((envelope.text ?? "").split("\n")[0] ?? "");
1476
+ this.completeNotify(doneMatch[1], stampedDone);
1477
+ }
1474
1478
  if (envelope.waitMs && this.awaitingReply.size >= 100) {
1475
1479
  reply("result", "rejected: reply capacity reached");
1476
1480
  return;
@@ -1676,7 +1680,7 @@ ${body}` : ""}`;
1676
1680
  * hint so the model checks ipc_result itself. The wake goes through the
1677
1681
  * normal inbound path (sendUserMessage), which the interactive host queues
1678
1682
  * when busy and the embedded host emits as a user.message event. */
1679
- armNotifyFallback(requestId, fallbackMs, peerName) {
1683
+ armNotifyFallback(requestId, fallbackMs, peerName, userAssigned = false) {
1680
1684
  if (this.completedNotifies.has(requestId)) {
1681
1685
  this.completedNotifies.delete(requestId);
1682
1686
  return true;
@@ -1690,7 +1694,8 @@ ${body}` : ""}`;
1690
1694
  this.notifyFallbacks.delete(requestId);
1691
1695
  this.completedNotifies.delete(requestId);
1692
1696
  if (this.disposed) return;
1693
- const hint = `[ipc-check] No completion notification arrived for requestId=${requestId} (peer ${peerName}) within ${Math.round(fallbackMs / 1e3)}s. Query ipc_result for the authoritative status; accepted/running means the peer is still working \u2014 keep waiting or check again later, and never resend while a result is pending.`;
1697
+ const hintBody = `[ipc-check] No completion notification arrived for requestId=${requestId}${userAssigned ? " user_assigned=true" : ""} (peer ${peerName}) within ${Math.round(fallbackMs / 1e3)}s. Query ipc_result for the authoritative status; accepted/running means the peer is still working \u2014 keep waiting or check again later, and never resend while a result is pending.`;
1698
+ const hint = wrapInboundText(`local-recovery (${peerName})`, hintBody);
1694
1699
  try {
1695
1700
  const scope = this.ctx.beginUserInput?.();
1696
1701
  if (scope) {
@@ -1712,7 +1717,7 @@ ${body}` : ""}`;
1712
1717
  * not observation, so instead of silently cancelling the only wake, the
1713
1718
  * fallback fires IMMEDIATELY as a [ipc-done-check] hint carrying the
1714
1719
  * outcome — every host kind surfaces the completion exactly once. */
1715
- completeNotify(requestId) {
1720
+ completeNotify(requestId, userAssigned = false) {
1716
1721
  const willInject = this.delivery?.willInjectNow() ?? this.ctx.capabilities.editorInjection;
1717
1722
  if (willInject) {
1718
1723
  this.clearNotifyFallback(requestId);
@@ -1727,7 +1732,9 @@ ${body}` : ""}`;
1727
1732
  }
1728
1733
  if (this.disposed) return;
1729
1734
  try {
1730
- this.ctx.sendUserMessage(`[ipc-done-check] The completion notification for requestId=${requestId} is waiting in the ipc inbox (this host is not auto-injecting right now \u2014 muted, degraded, or embedded). Call ipc_poll to read it; the outcome line starts with [ipc-done]. Do not resend.`);
1735
+ const stamped = userAssigned ? " user_assigned=true" : "";
1736
+ const body = `[ipc-done-check] The completion notification for requestId=${requestId}${stamped} is waiting in the ipc inbox (this host is not auto-injecting right now \u2014 muted, degraded, or embedded). Call ipc_poll to read it; the outcome line starts with [ipc-done]. Do not resend.`;
1737
+ this.ctx.sendUserMessage(wrapInboundText("local-inbox-wake", body));
1731
1738
  } catch {
1732
1739
  }
1733
1740
  }
@@ -1864,20 +1871,7 @@ last body (snapshot; may be stale): ${clipBody(target.lastBodyText, 400)}` : ""}
1864
1871
  const sendGeneration = this.notifyGeneration;
1865
1872
  let userAssigned = false;
1866
1873
  if (notifyMode) {
1867
- try {
1868
- const messages = this.ctx.getMessages?.() ?? [];
1869
- for (let i = messages.length - 1; i >= 0; i--) {
1870
- const message = messages[i];
1871
- if (!message || message.role !== "user") continue;
1872
- const content = message.content;
1873
- const text2 = typeof content === "string" ? content : Array.isArray(content) ? content.map((block) => block && typeof block === "object" && "text" in block && typeof block.text === "string" ? block.text : "").join("") : "";
1874
- const trimmed = text2.trim();
1875
- if (!trimmed) continue;
1876
- userAssigned = /^\[(Feishu|Other)\]/.test(trimmed) && !trimmed.startsWith("[ipc-done]") && !trimmed.startsWith("[pie-ipc]");
1877
- break;
1878
- }
1879
- } catch {
1880
- }
1874
+ userAssigned = isTurnUserImDriven();
1881
1875
  }
1882
1876
  const reply = await this.transport.send(target.instanceId, target.port, "message", {
1883
1877
  requestId,
@@ -1897,7 +1891,7 @@ last body (snapshot; may be stale): ${clipBody(target.lastBodyText, 400)}` : ""}
1897
1891
  }
1898
1892
  if (!reply) {
1899
1893
  const peerName2 = peerLabel(target.instanceId, target.displayName);
1900
- const armed2 = this.armNotifyFallback(requestId, fallbackMs, peerName2);
1894
+ const armed2 = this.armNotifyFallback(requestId, fallbackMs, peerName2, userAssigned);
1901
1895
  return {
1902
1896
  content: [{ type: "text", text: `Receipt UNCONFIRMED \u2014 the request may already be accepted by ${peerName2} (accepted work is never cancelled). Query ipc_result with requestId=${requestId} before resending. ${armed2 ? `A fallback check is armed for ${Math.round(fallbackMs / 1e3)}s if the peer's completion push never arrives.` : "No automatic wake is armed (fallback budget exhausted) \u2014 check ipc_result yourself."}` }],
1903
1897
  isError: true,
@@ -1908,7 +1902,7 @@ last body (snapshot; may be stale): ${clipBody(target.lastBodyText, 400)}` : ""}
1908
1902
  return { content: [{ type: "text", text: reply.text ?? "(empty reply)" }], isError: true, details: { requestId } };
1909
1903
  }
1910
1904
  const peerName = peerLabel(target.instanceId, target.displayName);
1911
- const armed = this.armNotifyFallback(requestId, fallbackMs, peerName);
1905
+ const armed = this.armNotifyFallback(requestId, fallbackMs, peerName, userAssigned);
1912
1906
  return { content: [{ type: "text", text: armed ? `Sent to ${peerName} with completion subscription (receipt acked as ${reply.kind}; the peer pushes one [ipc-done] notification when its turn settles). If no notification arrives within ${Math.round(fallbackMs / 1e3)}s, check ipc_result with this requestId; do not resend on a pending result. requestId=${requestId}` : `Sent to ${peerName} with completion subscription (receipt acked). The local fallback-wake budget is exhausted (${this.notifyFallbacks.size} outstanding checks), so NO automatic wake is armed for this request \u2014 check ipc_result yourself when you need its result. requestId=${requestId}` }], details: { requestId } };
1913
1907
  }
1914
1908
  if (!wait) {
@@ -576,7 +576,7 @@ function pieProc(ctx) {
576
576
  ctx.registerTool({
577
577
  name: "pie_proc",
578
578
  label: "Pie worker processes",
579
- description: "Controlled lifecycle for pie worker processes (concierge plan): spawn creates a bounded-shape pie worker \u2014 either a RESIDENT host (--json-events --idle, peer-addressable by worker name via ipc_send_notify) or a ONE-SHOT run (pie -p <task>, process exit is the completion). cwd must resolve inside the allowCwd roots configured in ~/.pie/pie-proc.json (symlinks resolved). Optional idle TTL retires idle RESIDENTS automatically (identity-verified; activity-aware). imForward accepts identity fields ONLY \u2014 executable selection is operator config. kill stops a worker gracefully (SIGTERM, bounded identity-verified escalation) and removes its generation; list shows workers with pid/session/cwd/liveness/last-active. Never use raw shell to start pie processes \u2014 this tool owns the audit trail, caps, and cleanup.",
579
+ description: "Controlled lifecycle for pie worker processes (manager plan): spawn creates a bounded-shape pie worker \u2014 either a RESIDENT host (--json-events --idle, peer-addressable by worker name via ipc_send_notify) or a ONE-SHOT run (pie -p <task>, process exit is the completion). cwd must resolve inside the allowCwd roots configured in ~/.pie/pie-proc.json (symlinks resolved). Optional idle TTL retires idle RESIDENTS automatically (identity-verified; activity-aware). imForward accepts identity fields ONLY \u2014 executable selection is operator config. kill stops a worker gracefully (SIGTERM, bounded identity-verified escalation) and removes its generation; list shows workers with pid/session/cwd/liveness/last-active. Never use raw shell to start pie processes \u2014 this tool owns the audit trail, caps, and cleanup.",
580
580
  parameters: Type.Object({
581
581
  action: Type.Union([Type.Literal("spawn"), Type.Literal("kill"), Type.Literal("list")], { description: "spawn | kill | list" }),
582
582
  name: Type.Optional(Type.String({ description: "Worker name ([a-z0-9-_], unique among alive workers)" })),
@@ -552,6 +552,17 @@ import * as fs2 from "node:fs";
552
552
  import * as path2 from "node:path";
553
553
  var DISPATCH_PREFIX = "[im-forward-dispatch]";
554
554
  var dispatchReceiver;
555
+ var turnImDriverOracle;
556
+ function registerTurnImDriver(oracle) {
557
+ turnImDriverOracle = oracle;
558
+ }
559
+ function isTurnUserImDriven() {
560
+ try {
561
+ return turnImDriverOracle?.() === true;
562
+ } catch {
563
+ return false;
564
+ }
565
+ }
555
566
  function registerDispatchReceiver(receiver) {
556
567
  dispatchReceiver = receiver;
557
568
  }
@@ -1026,6 +1037,8 @@ export {
1026
1037
  readLiveConfig,
1027
1038
  resolveImForwardConfig,
1028
1039
  DISPATCH_PREFIX,
1040
+ registerTurnImDriver,
1041
+ isTurnUserImDriven,
1029
1042
  registerDispatchReceiver,
1030
1043
  takeDispatchFrame,
1031
1044
  tryClaimConsumer,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-ILUHTKF3.js";
8
8
  import "./chunk-LZQXQOPJ.js";
9
9
 
10
- // src/commands/concierge-cli.ts
10
+ // src/commands/manager-cli.ts
11
11
  import { spawn, execFileSync } from "node:child_process";
12
12
  import { createRequire } from "node:module";
13
13
  import * as fs from "node:fs";
@@ -21,7 +21,7 @@ ${CRON_SECTION_MARKER}
21
21
  - \u4F60\u6240\u5728\u7684\u65E0\u503C\u5B88\u5BBF\u4E3B\u53EF\u4EE5\u81EA\u5DF1\u7528 cron_manage\uFF08\u65E0\u4EBA\u503C\u5B88\u4E0A\u81EA\u52A8\u6388\u6743\u5E76\u7559\u75D5\uFF0C\u4E0D\u5FC5\u7B49\u4EBA\u786E\u8BA4\uFF09\u3002\u9002\u5408\u201C\u6BCF\u5929 9 \u70B9\u7ED9\u6211\u7B80\u62A5\u201D\u8FD9\u7C7B\u56FA\u5B9A\u8282\u594F\u7684\u4E8B\uFF1B\u4E0D\u9002\u5408\u62FF\u6765\u4EE3\u66FF worker \u5E72\u6D3B\u3002
22
22
  - \u5BBF\u4E3B\u91CD\u542F\u540E\uFF08\u5C24\u5176\u5D29\u6E83/\u65AD\u7535/OOM \u4E4B\u540E\uFF09\u7684\u7B2C\u4E00\u6B21\u5BF9\u8BDD\uFF0C\u5148\u7528 cron_manage list \u770B\u4E00\u773C\uFF1A\u82E5\u6709 blocked \u7684\u4EFB\u52A1\uFF0C\u8BF4\u660E\u4E0A\u6B21\u6267\u884C\u7ED3\u679C\u4E0D\u786E\u5B9A\uFF0C\u8981\u539F\u6837\u544A\u8BC9\u7528\u6237\u5E76\u7B49\u4ED6\u51B3\u5B9A\u662F\u5426 resume\uFF1B**\u4E0D\u8981\u81EA\u4F5C\u4E3B\u5F20 resume\uFF0C\u4E5F\u4E0D\u8981\u5220\u4E86\u91CD\u5EFA**\uFF08\u91CD\u5EFA\u4F1A\u4E22\u6389\u4E0D\u786E\u5B9A\u6267\u884C\u7684\u8BB0\u5F55\uFF09\u3002
23
23
  `;
24
- var SEED_AGENTS_MD = `# Pie Concierge (manager)
24
+ var SEED_AGENTS_MD = `# Pie Manager (manager)
25
25
 
26
26
  \u4F60\u662F\u7528\u6237\u7684\u5E38\u9A7B manager pie\uFF1A\u7ED1\u5B9A IM\uFF08\u5E73\u53F0\u65E0\u5173\uFF09\uFF0C\u65E0\u4EBA\u503C\u5B88\uFF0C\u901A\u8FC7 IM \u4E0E\u7528\u6237\u5BF9\u8BDD\u3002
27
27
 
@@ -48,12 +48,39 @@ var SEED_AGENTS_MD = `# Pie Concierge (manager)
48
48
  - \u6D88\u606F\u6CA1\u6536\u5230 reaction \u65F6\u4E0D\u8981\u8BA9\u5B83\u60AC\u7740\uFF1A\u540C\u4E00\u4EFD\u6B63\u6587\u518D\u53D1\u4E00\u6B21\u5373\u53EF\uFF08\u4E0D\u5E26\u5F15\u7528\uFF09\uFF0C\u6216\u52A0 \`\u4F1A\u8BDD\u540D:\` \u6307\u5B9A\u76EE\u6807\u3002
49
49
  ${CRON_SECTION}`;
50
50
  function workspaceDir() {
51
- return path.join(os.homedir(), ".pie", "concierge");
51
+ const dir = path.join(os.homedir(), ".pie", "manager");
52
+ migrateLegacyWorkspace(dir);
53
+ return dir;
54
+ }
55
+ var migrationChecked = false;
56
+ function migrateLegacyWorkspace(newDir) {
57
+ if (migrationChecked) return;
58
+ migrationChecked = true;
59
+ const legacy = path.join(os.homedir(), ".pie", "concierge");
60
+ if (!fs.existsSync(legacy)) return;
61
+ if (fs.existsSync(newDir)) {
62
+ console.warn(`Both ~/.pie/manager and the legacy ~/.pie/concierge exist; leaving the legacy directory untouched. Merge manually if needed.`);
63
+ return;
64
+ }
65
+ try {
66
+ fs.mkdirSync(path.dirname(newDir), { recursive: true });
67
+ fs.renameSync(legacy, newDir);
68
+ const legacyState = path.join(newDir, "concierge.json");
69
+ if (fs.existsSync(legacyState)) {
70
+ try {
71
+ fs.renameSync(legacyState, path.join(newDir, "manager.json"));
72
+ } catch {
73
+ }
74
+ }
75
+ console.log(`Migrated the workspace: ~/.pie/concierge \u2192 ~/.pie/manager (history and role card preserved).`);
76
+ } catch (error) {
77
+ console.warn(`Workspace migration failed (${error instanceof Error ? error.message : String(error)}); using a fresh ~/.pie/manager.`);
78
+ }
52
79
  }
53
80
  function ensureSessionToken(dir) {
54
81
  const tokenFile = path.join(dir, "session-token");
55
82
  for (let attempt = 0; attempt < 5; attempt += 1) {
56
- const mine = `concierge-${os.hostname().split(".")[0]}-${Math.random().toString(36).slice(2, 8)}`;
83
+ const mine = `manager-${os.hostname().split(".")[0]}-${Math.random().toString(36).slice(2, 8)}`;
57
84
  const tmp = `${tokenFile}.${process.pid}.${attempt}.tmp`;
58
85
  let tmpKept = false;
59
86
  try {
@@ -112,10 +139,15 @@ function ensureSessionToken(dir) {
112
139
  }
113
140
  }
114
141
  }
115
- throw new Error("cannot establish the concierge workspace token; retry");
142
+ throw new Error("cannot establish the manager workspace token; retry");
116
143
  }
117
144
  function statePath(dir = workspaceDir()) {
118
- return path.join(dir, "concierge.json");
145
+ const current = path.join(dir, "manager.json");
146
+ if (!fs.existsSync(current)) {
147
+ const legacy = path.join(dir, "concierge.json");
148
+ if (fs.existsSync(legacy)) return legacy;
149
+ }
150
+ return current;
119
151
  }
120
152
  function logPath(dir = workspaceDir()) {
121
153
  return path.join(dir, "log.jsonl");
@@ -136,7 +168,7 @@ function writeState(state, dir = workspaceDir()) {
136
168
  fs.writeFileSync(tmp, JSON.stringify(state, null, " "));
137
169
  fs.renameSync(tmp, statePath(dir));
138
170
  }
139
- function conciergeLiveness(pid, state) {
171
+ function managerLiveness(pid, state) {
140
172
  if (!pid || pid <= 0) return "dead";
141
173
  try {
142
174
  process.kill(pid, 0);
@@ -148,14 +180,14 @@ function conciergeLiveness(pid, state) {
148
180
  if (cmd === void 0) {
149
181
  return "unknown";
150
182
  }
151
- const sessionMatch = cmd.includes(state?.sessionId ?? "concierge-");
183
+ const sessionMatch = cmd.includes(state?.sessionId ?? "manager-");
152
184
  return /--idle/.test(cmd) && sessionMatch && /(pie|cli\.(js|ts|mjs))/i.test(cmd) ? "alive" : "dead";
153
185
  } catch {
154
186
  return "unknown";
155
187
  }
156
188
  }
157
189
  function isConciergeAlive(pid, state) {
158
- return conciergeLiveness(pid, state) === "alive";
190
+ return managerLiveness(pid, state) === "alive";
159
191
  }
160
192
  function seedWorkspace(dir) {
161
193
  fs.mkdirSync(path.join(dir, ".pie"), { recursive: true });
@@ -340,14 +372,14 @@ No IM forwarding config found. The first binding needs the interactive wizard (p
340
372
 
341
373
  1) run pie inside a project directory, then Ctrl+R or /tools/im-forward setup to finish the wizard;
342
374
  2) the wizard writes user-layer config (~/.pie/im-forward.json), shared by every pie;
343
- 3) run pie concierge again.
375
+ 3) run pie manager again.
344
376
 
345
- To bind a separate app for the concierge only, put a project-layer config at ~/.pie/concierge/.pie/im-forward.json.
377
+ To bind a separate app for the manager only, put a project-layer config at ~/.pie/manager/.pie/im-forward.json.
346
378
  `);
347
379
  return false;
348
380
  }
349
381
  function platformServiceName() {
350
- return "dev.pie.concierge";
382
+ return "dev.pie.manager";
351
383
  }
352
384
  function xmlEscape(value) {
353
385
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
@@ -410,7 +442,7 @@ function installService(dir, state) {
410
442
  const unitDir = path.join(os.homedir(), ".config", "systemd", "user");
411
443
  fs.mkdirSync(unitDir, { recursive: true });
412
444
  const unit = `[Unit]
413
- Description=Pie concierge (resident im-forward host)
445
+ Description=Pie manager (resident im-forward host)
414
446
  After=network-online.target
415
447
 
416
448
  [Service]
@@ -579,7 +611,7 @@ async function stopConcierge(state) {
579
611
  console.log("No recorded pid; nothing to do.");
580
612
  return 0;
581
613
  }
582
- const liveness0 = conciergeLiveness(state.pid, state);
614
+ const liveness0 = managerLiveness(state.pid, state);
583
615
  if (liveness0 === "dead") {
584
616
  writeState({ sessionId: state.sessionId });
585
617
  console.log("The process is no longer running.");
@@ -603,10 +635,10 @@ async function stopConcierge(state) {
603
635
  if (!isConciergeAlive(state.pid, state)) break;
604
636
  await new Promise((resolve2) => setTimeout(resolve2, 200));
605
637
  }
606
- const finalState = conciergeLiveness(state.pid, state);
638
+ const finalState = managerLiveness(state.pid, state);
607
639
  if (finalState === "alive" || finalState === "unknown") {
608
640
  console.error(
609
- `Shutdown not confirmed (state: ${finalState}); the pid is kept. Retry with pie concierge stop or clean up manually.`
641
+ `Shutdown not confirmed (state: ${finalState}); the pid is kept. Retry with pie manager stop or clean up manually.`
610
642
  );
611
643
  return 1;
612
644
  }
@@ -625,7 +657,7 @@ function withStartLock(dir, fn) {
625
657
  for (; ; ) {
626
658
  if (Date.now() > deadline)
627
659
  throw new Error(
628
- "another pie concierge lifecycle command is in progress; retry shortly"
660
+ "another pie manager lifecycle command is in progress; retry shortly"
629
661
  );
630
662
  let latest = 0;
631
663
  try {
@@ -703,13 +735,13 @@ function withStartLock(dir, fn) {
703
735
  }
704
736
  });
705
737
  }
706
- async function runConciergeCommand(args) {
738
+ async function runManagerCommand(args) {
707
739
  const sub = args[0] ?? "";
708
740
  const dir = workspaceDir();
709
741
  if (sub === "status") {
710
742
  const state = readState();
711
743
  if (!state) {
712
- console.log("Not initialized (run pie concierge first).");
744
+ console.log("Not initialized (run pie manager first).");
713
745
  return;
714
746
  }
715
747
  console.log(`session: ${state.sessionId}`);
@@ -753,7 +785,7 @@ async function runConciergeCommand(args) {
753
785
  `service: ${platformServiceName()} ${running ? "(running)" : "(stopped)"}`
754
786
  );
755
787
  } else {
756
- const liveness = conciergeLiveness(state.pid, state);
788
+ const liveness = managerLiveness(state.pid, state);
757
789
  const label = liveness === "alive" ? "(running)" : liveness === "unknown" ? "(alive, identity unverified)" : "(not running)";
758
790
  console.log(`pid: ${state.pid ?? "-"} ${label}`);
759
791
  }
@@ -868,20 +900,20 @@ async function runConciergeCommand(args) {
868
900
  const state = readState();
869
901
  if (!state) {
870
902
  console.error(
871
- "Run pie concierge once to initialize (a stable session id is required)."
903
+ "Run pie manager once to initialize (a stable session id is required)."
872
904
  );
873
905
  process.exitCode = 2;
874
906
  return;
875
907
  }
876
908
  if (!imForwardConfigured(dir)) {
877
- console.error("No IM config detected; complete the first pie concierge initialization.");
909
+ console.error("No IM config detected; complete the first pie manager initialization.");
878
910
  process.exitCode = 2;
879
911
  return;
880
912
  }
881
- const installLiveness = conciergeLiveness(state.pid, state);
913
+ const installLiveness = managerLiveness(state.pid, state);
882
914
  if (installLiveness === "alive" || installLiveness === "unknown") {
883
915
  console.log(
884
- `A resident process is present (state: ${installLiveness}); run pie concierge stop before installing the service.`
916
+ `A resident process is present (state: ${installLiveness}); run pie manager stop before installing the service.`
885
917
  );
886
918
  process.exitCode = 2;
887
919
  return;
@@ -894,7 +926,7 @@ async function runConciergeCommand(args) {
894
926
  if (sub && sub !== "start") {
895
927
  console.error(`Unknown subcommand: ${sub}`);
896
928
  console.error(
897
- "Usage: pie concierge [status|stop|--install-service|--uninstall-service]"
929
+ "Usage: pie manager [status|stop|--install-service|--uninstall-service]"
898
930
  );
899
931
  process.exitCode = 2;
900
932
  return;
@@ -902,20 +934,20 @@ async function runConciergeCommand(args) {
902
934
  const existing = readState();
903
935
  if (existing?.service) {
904
936
  console.log(
905
- "The concierge is managed by a system service (launchd/systemd/scheduled task). To take over manually, run --uninstall-service first."
937
+ "The manager is managed by a system service (launchd/systemd/scheduled task). To take over manually, run --uninstall-service first."
906
938
  );
907
939
  return;
908
940
  }
909
- const startLiveness = existing ? conciergeLiveness(existing.pid, existing) : "dead";
941
+ const startLiveness = existing ? managerLiveness(existing.pid, existing) : "dead";
910
942
  if (existing && (startLiveness === "alive" || startLiveness === "unknown")) {
911
943
  console.log(
912
- `The concierge may already be running (pid ${existing.pid ?? "-"}, state: ${startLiveness}, session ${existing.sessionId}).`
944
+ `The manager may already be running (pid ${existing.pid ?? "-"}, state: ${startLiveness}, session ${existing.sessionId}).`
913
945
  );
914
946
  return;
915
947
  }
916
948
  if (!imForwardConfigured(dir) && !process.stdin.isTTY) {
917
949
  console.error(
918
- "No IM config found and no terminal for the wizard; run pie concierge in a TTY."
950
+ "No IM config found and no terminal for the wizard; run pie manager in a TTY."
919
951
  );
920
952
  process.exitCode = 2;
921
953
  return;
@@ -941,14 +973,14 @@ async function runConciergeCommand(args) {
941
973
  const lockedState = readState();
942
974
  if (lockedState?.service) {
943
975
  console.log(
944
- "The concierge is managed by a system service (launchd/systemd/scheduled task). To take over manually, run --uninstall-service first."
976
+ "The manager is managed by a system service (launchd/systemd/scheduled task). To take over manually, run --uninstall-service first."
945
977
  );
946
978
  return;
947
979
  }
948
- const lockedLiveness = lockedState ? conciergeLiveness(lockedState.pid, lockedState) : "dead";
980
+ const lockedLiveness = lockedState ? managerLiveness(lockedState.pid, lockedState) : "dead";
949
981
  if (lockedState && (lockedLiveness === "alive" || lockedLiveness === "unknown")) {
950
982
  console.log(
951
- `The concierge may already be running (pid ${lockedState.pid ?? "-"}, state: ${lockedLiveness}, session ${lockedState.sessionId}).`
983
+ `The manager may already be running (pid ${lockedState.pid ?? "-"}, state: ${lockedLiveness}, session ${lockedState.sessionId}).`
952
984
  );
953
985
  return;
954
986
  }
@@ -985,14 +1017,14 @@ async function runConciergeCommand(args) {
985
1017
  const winnerPid = Math.min(...liveRivals);
986
1018
  writeState({ ...state, pid: winnerPid });
987
1019
  console.log(
988
- `The concierge is already running (concurrent starts converged on pid ${winnerPid}); this start's extra instance was terminated.`
1020
+ `The manager is already running (concurrent starts converged on pid ${winnerPid}); this start's extra instance was terminated.`
989
1021
  );
990
1022
  return;
991
1023
  }
992
1024
  } catch {
993
1025
  const winner = readState();
994
1026
  if (winner && winner.pid && winner.pid !== pid && winner.sessionId === state.sessionId) {
995
- const liveness = conciergeLiveness(winner.pid, winner);
1027
+ const liveness = managerLiveness(winner.pid, winner);
996
1028
  if (liveness === "alive" || liveness === "unknown") {
997
1029
  try {
998
1030
  process.kill(pid, "SIGKILL");
@@ -1015,15 +1047,15 @@ async function runConciergeCommand(args) {
1015
1047
  const ready = await waitForAgentReady(dir, 3e4, sinceOffset, sessionId);
1016
1048
  if (ready) {
1017
1049
  const now = readState();
1018
- const stillOurs = now?.pid === pid && now.sessionId === sessionId && conciergeLiveness(pid, now) === "alive";
1050
+ const stillOurs = now?.pid === pid && now.sessionId === sessionId && managerLiveness(pid, now) === "alive";
1019
1051
  if (stillOurs) {
1020
1052
  console.log(`\u2713 Concierge ready \xB7 log ${logPath(dir)}`);
1021
1053
  console.log(
1022
- ` Now just talk to it in your IM app; stop: pie concierge stop; status: pie concierge status`
1054
+ ` Now just talk to it in your IM app; stop: pie manager stop; status: pie manager status`
1023
1055
  );
1024
1056
  } else {
1025
1057
  console.log(
1026
- `\u26A0 agent.ready appeared, but the recorded state is no longer this start (pid ${pid} may have been stopped or replaced); confirm with pie concierge status.`
1058
+ `\u26A0 agent.ready appeared, but the recorded state is no longer this start (pid ${pid} may have been stopped or replaced); confirm with pie manager status.`
1027
1059
  );
1028
1060
  }
1029
1061
  } else {
@@ -1035,5 +1067,5 @@ async function runConciergeCommand(args) {
1035
1067
  }
1036
1068
  export {
1037
1069
  isTooBroadForWorkerSandbox,
1038
- runConciergeCommand
1070
+ runManagerCommand
1039
1071
  };
package/dist/cli.js CHANGED
@@ -84453,7 +84453,7 @@ async function loadJsonModeExtensions(params) {
84453
84453
  // r17 P1: session naming on the resident host — im-forward's explicit
84454
84454
  // addressing escape hatch ("<session name>: text") reads the session
84455
84455
  // name; without these the json-events host returned undefined and a
84456
- // cold-started concierge had NO intake route at all (its route table is
84456
+ // cold-started manager had NO intake route at all (its route table is
84457
84457
  // empty until the first outbound forward, and --idle closes stdin —
84458
84458
  // every inbound IM message hit "no route; ignoring" until something
84459
84459
  // else happened to make the resident speak first).
@@ -86566,7 +86566,7 @@ var STABLE_CLI_COMMANDS = {
86566
86566
  sessions: "sessions",
86567
86567
  extensions: "extensions",
86568
86568
  permissions: "permissions",
86569
- concierge: "concierge"
86569
+ manager: "manager"
86570
86570
  };
86571
86571
  async function runWithJsonEventsConsoleIsolation(fn) {
86572
86572
  const originalLog = console.log;
@@ -86781,10 +86781,10 @@ async function main() {
86781
86781
  await runMemoryCommand(args.slice(1));
86782
86782
  return;
86783
86783
  }
86784
- if (args[0] === STABLE_CLI_COMMANDS.concierge) {
86785
- const { runConciergeCommand } = await import("./chunks/concierge-cli-MCHXTFBA.js");
86784
+ if (args[0] === STABLE_CLI_COMMANDS.manager) {
86785
+ const { runManagerCommand } = await import("./chunks/manager-cli-JWCZEQXT.js");
86786
86786
  try {
86787
- await runConciergeCommand(args.slice(1));
86787
+ await runManagerCommand(args.slice(1));
86788
86788
  } catch (error) {
86789
86789
  console.error(error instanceof Error ? error.message : String(error));
86790
86790
  process.exitCode = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cydm/pie",
3
- "version": "4.3.4",
3
+ "version": "4.3.6",
4
4
  "description": "Pie AI Agent CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  "test:skill-regressions": "node --test --test-force-exit --import tsx test/axi-bridge-lifecycle.test.ts test/bash-lifecycle.test.ts test/bash-powershell-display.test.ts test/skill-creator-runner.test.ts test/tui-use-contract.test.ts test/tui-use-runtime.test.ts test/tui-use-reap.test.ts test/tui-use-kill-escalation.test.ts test/browser-runtime.test.ts test/axi-stop-semantics.test.ts test/axi-page-routing.test.ts test/computer-use-axi.test.ts test/computer-evidence.test.ts test/interactive-lifecycle.test.ts",
21
21
  "test:offline:post": "node --test --test-force-exit --import tsx test/remote-model-catalog.test.ts",
22
22
  "test:offline": "node ../../scripts/run-cli-offline.mjs",
23
- "test:offline:main": "node --test --test-concurrency=2 --test-force-exit --import tsx test/cli-attention.test.ts test/cron.test.ts test/cron-process.test.ts test/cron-poll-gate.test.ts test/memory-distill.test.ts test/memory-injection-freeze.test.ts test/memory-consumption-e2e.test.ts test/memory-frozen-matching.test.ts test/memory-soul-injection.test.ts test/config-dir-fail-closed.test.ts test/cron-concurrency.test.ts test/cron-dogfood.test.ts test/cron.terminal.test.ts test/cron-journey.terminal.test.ts test/builtin-extensions.test.ts test/im-forward.test.ts test/im-forward-cli.test.ts test/im-forward-integration.test.ts test/im-forward-dogfood.terminal.test.ts test/thread-registry.test.ts test/im-forward-event-hub.test.ts test/im-forward-session-anchors.test.ts test/extension-user-input.test.ts test/pie-ipc-pure.test.ts test/pie-ipc-discovery.test.ts test/pie-ipc-transport.test.ts test/pie-ipc-delivery.test.ts test/pie-ipc-extension.test.ts test/pie-ipc-e2e.test.ts test/pie-ipc-security.test.ts test/pie-ipc-dogfood.test.ts test/pie-ipc-resident-dispatch.test.ts test/pie-proc.test.ts test/pie-ipc-host.terminal.test.ts test/core-services.test.ts test/cli.test.ts test/cli-auto-compaction.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/todo-steering-ownership.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-provider.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/auto-compaction-ui.test.ts test/tool-compaction-dogfood.terminal.test.ts test/hierarchical-command-system.test.ts test/mcp-adapter.test.ts test/herdr-agent-state.test.ts test/extensions-enablement.test.ts test/extension-selector-shortcuts.test.ts test/skill-tool-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/json-events-event-sink.test.ts test/json-events-lifecycle-bridge.test.ts test/json-events-self-input.test.ts test/json-events-idle-mode.test.ts test/concierge-cli.test.ts test/json-events-sidechat-diagnostics.test.ts test/json-events-prewarm-shutdown.test.ts test/json-envelope-composition.test.ts test/subagent-session-store.test.ts test/supervisor-anchor-inject.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/retry-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/footer-waiting-for-user.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/package-artifacts.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/skills-agents-discovery.test.ts test/skills-symlink.test.ts test/model-overrides.test.ts test/auth-storage.test.ts test/extension-register-provider.test.ts test/extension-reload.test.ts test/extension-terminal-input.test.ts test/extension-session-before-events.test.ts test/extension-widgets.test.ts test/extension-render-hint.test.ts test/extension-oauth-restore.test.ts test/cross-host-parity.test.ts test/tool-name-rendering.test.ts test/session-selector.test.ts test/tree-selector-pagination.test.ts test/context-report.test.ts test/context-signals.test.ts test/plan-cache-stability.test.ts test/cache-invalidation-trace.test.ts test/cache-retention.test.ts test/trace-report.test.ts test/boot-report.test.ts test/compaction-diff.test.ts test/entry-body-and-usage.test.ts test/session-control.test.ts test/terminal-title.test.ts test/interactive-controller-title.test.ts test/todo-title.terminal.test.ts test/host-envelope-dogfood.terminal.test.ts test/host-envelope-cross-mode.test.ts test/host-envelope-registry-lifecycle.test.ts test/host-envelope-migration-roundtrip.test.ts test/host-envelope-intake-order.test.ts test/plan-mode-extension.test.ts test/extension-interaction-signals.test.ts test/rendered-page-reader.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/bash-yolo.test.ts test/bash-contract.test.ts test/bash-confirm-pending.test.ts test/interaction-status-lifecycle.test.ts test/bash-process-group.test.ts test/bash-artifact-sink.test.ts test/direct-bash.test.ts test/terminal-bell.test.ts test/ctrl-d-exit.test.ts test/session-display-title.test.ts test/calm-mode.test.ts test/stream-render-throttle.test.ts test/assistant-message-performance.test.ts test/streaming-split-parity.test.ts test/message-display-resync.test.ts test/project-root.test.ts test/guard-advisory-context.test.ts test/clear-command-usage.test.ts test/daily-agent-smoke.terminal.test.ts test/slash-menu-toggles.terminal.test.ts test/cli-args.test.ts test/session-resume-cwd.test.ts test/session-resume-restart.test.ts test/session-resume-picker.test.ts test/extensions-configured-paths.test.ts test/extensions-loader-path.test.ts test/file-picker.test.ts test/interrupt-recovery.test.ts test/mention-insert-regression.test.ts test/image-paste.test.ts test/clipboard-read-image.test.ts test/clipboard-races.test.ts test/clipboard-dogfood.terminal.test.ts test/mention-picker-navigation.test.ts test/pie-unity-rpc-skill.test.ts test/skill-creator-scripts.test.ts test/interactive-compact-command.test.ts test/computer-use-broker.test.ts test/computer-use-review-regressions.test.ts test/computer-use-safety.test.ts ../../scripts/node-test-diagnostics.test.js ../../scripts/offline-test-runner.test.js ../../scripts/unity-consumer.test.mjs ../../scripts/owned-process-cleanup.test.mjs",
23
+ "test:offline:main": "node --test --test-concurrency=2 --test-force-exit --import tsx test/cli-attention.test.ts test/cron.test.ts test/cron-process.test.ts test/cron-poll-gate.test.ts test/memory-distill.test.ts test/memory-injection-freeze.test.ts test/memory-consumption-e2e.test.ts test/memory-frozen-matching.test.ts test/memory-soul-injection.test.ts test/config-dir-fail-closed.test.ts test/cron-concurrency.test.ts test/cron-dogfood.test.ts test/cron.terminal.test.ts test/cron-journey.terminal.test.ts test/builtin-extensions.test.ts test/im-forward.test.ts test/im-forward-cli.test.ts test/im-forward-integration.test.ts test/im-forward-dogfood.terminal.test.ts test/thread-registry.test.ts test/im-forward-event-hub.test.ts test/im-forward-session-anchors.test.ts test/extension-user-input.test.ts test/pie-ipc-pure.test.ts test/pie-ipc-discovery.test.ts test/pie-ipc-transport.test.ts test/pie-ipc-delivery.test.ts test/pie-ipc-extension.test.ts test/pie-ipc-e2e.test.ts test/pie-ipc-security.test.ts test/pie-ipc-dogfood.test.ts test/pie-ipc-resident-dispatch.test.ts test/pie-proc.test.ts test/pie-ipc-host.terminal.test.ts test/core-services.test.ts test/cli.test.ts test/cli-auto-compaction.test.ts test/execution-state-manager.test.ts test/queued-steer-execution-state.test.ts test/todo-steering-ownership.test.ts test/architecture-boundaries.test.ts test/attachment-resolver.test.ts test/kimi-attachment-provider.test.ts test/document-attachment-extension.test.ts test/auto-compact-overflow.test.ts test/auto-compaction-ui.test.ts test/tool-compaction-dogfood.terminal.test.ts test/hierarchical-command-system.test.ts test/mcp-adapter.test.ts test/herdr-agent-state.test.ts test/extensions-enablement.test.ts test/extension-selector-shortcuts.test.ts test/skill-tool-enablement.test.ts test/message-queue-unit.test.ts test/evals-harness.test.ts test/session-trace.test.ts test/json-events-event-sink.test.ts test/json-events-lifecycle-bridge.test.ts test/json-events-self-input.test.ts test/json-events-idle-mode.test.ts test/manager-cli.test.ts test/json-events-sidechat-diagnostics.test.ts test/json-events-prewarm-shutdown.test.ts test/json-envelope-composition.test.ts test/subagent-session-store.test.ts test/supervisor-anchor-inject.test.ts test/runtime-mode-context.test.ts test/tool-policy.test.ts test/retry-policy.test.ts test/yolo-command.test.ts test/footer-lifecycle.test.ts test/footer-waiting-for-user.test.ts test/files-utils.test.ts test/source-size-guard.test.ts test/runtime-logger.test.ts test/release-readiness.test.ts test/package-artifacts.test.ts test/init-extension-contract.test.ts test/skills-runtime.test.ts test/skills-agents-discovery.test.ts test/skills-symlink.test.ts test/model-overrides.test.ts test/auth-storage.test.ts test/extension-register-provider.test.ts test/extension-reload.test.ts test/extension-terminal-input.test.ts test/extension-session-before-events.test.ts test/extension-widgets.test.ts test/extension-render-hint.test.ts test/extension-oauth-restore.test.ts test/cross-host-parity.test.ts test/tool-name-rendering.test.ts test/session-selector.test.ts test/tree-selector-pagination.test.ts test/context-report.test.ts test/context-signals.test.ts test/plan-cache-stability.test.ts test/cache-invalidation-trace.test.ts test/cache-retention.test.ts test/trace-report.test.ts test/boot-report.test.ts test/compaction-diff.test.ts test/entry-body-and-usage.test.ts test/session-control.test.ts test/terminal-title.test.ts test/interactive-controller-title.test.ts test/todo-title.terminal.test.ts test/host-envelope-dogfood.terminal.test.ts test/host-envelope-cross-mode.test.ts test/host-envelope-registry-lifecycle.test.ts test/host-envelope-migration-roundtrip.test.ts test/host-envelope-intake-order.test.ts test/plan-mode-extension.test.ts test/extension-interaction-signals.test.ts test/rendered-page-reader.test.ts test/tools-registry.test.ts test/system-prompt-contract.test.ts test/bash-yolo.test.ts test/bash-contract.test.ts test/bash-confirm-pending.test.ts test/interaction-status-lifecycle.test.ts test/bash-process-group.test.ts test/bash-artifact-sink.test.ts test/direct-bash.test.ts test/terminal-bell.test.ts test/ctrl-d-exit.test.ts test/session-display-title.test.ts test/calm-mode.test.ts test/stream-render-throttle.test.ts test/assistant-message-performance.test.ts test/streaming-split-parity.test.ts test/message-display-resync.test.ts test/project-root.test.ts test/guard-advisory-context.test.ts test/clear-command-usage.test.ts test/daily-agent-smoke.terminal.test.ts test/slash-menu-toggles.terminal.test.ts test/cli-args.test.ts test/session-resume-cwd.test.ts test/session-resume-restart.test.ts test/session-resume-picker.test.ts test/extensions-configured-paths.test.ts test/extensions-loader-path.test.ts test/file-picker.test.ts test/interrupt-recovery.test.ts test/mention-insert-regression.test.ts test/image-paste.test.ts test/clipboard-read-image.test.ts test/clipboard-races.test.ts test/clipboard-dogfood.terminal.test.ts test/mention-picker-navigation.test.ts test/pie-unity-rpc-skill.test.ts test/skill-creator-scripts.test.ts test/interactive-compact-command.test.ts test/computer-use-broker.test.ts test/computer-use-review-regressions.test.ts test/computer-use-safety.test.ts ../../scripts/node-test-diagnostics.test.js ../../scripts/offline-test-runner.test.js ../../scripts/unity-consumer.test.mjs ../../scripts/owned-process-cleanup.test.mjs",
24
24
  "test:all": "npm run test:offline && npm run test:terminal:vitest",
25
25
  "test:cron:tui": "node ../../scripts/run-with-env.mjs PIE_REAL_CRON_TUI=1 -- --test --import tsx test/cron.terminal.test.ts test/cron-journey.terminal.test.ts",
26
26
  "test:ipc:tui": "node ../../scripts/run-with-env.mjs PIE_REAL_IPC_TUI=1 -- --test --import tsx test/pie-ipc-host.terminal.test.ts",