@linzumi/cli 0.0.70-beta → 0.0.71-beta

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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +598 -219
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -987,7 +987,7 @@ function codexOutputMessagesForItem(item, index) {
987
987
  }
988
988
  }
989
989
  function codexOutputMessagesForItems(items) {
990
- const consumedCallOutputIds = /* @__PURE__ */ new Set();
990
+ const consumedCallOutputKeys = /* @__PURE__ */ new Set();
991
991
  return items.flatMap((item, index) => {
992
992
  const itemType = stringValue(item.type);
993
993
  switch (itemType) {
@@ -997,9 +997,9 @@ function codexOutputMessagesForItems(items) {
997
997
  "function_call_output",
998
998
  stringValue(item.call_id)
999
999
  );
1000
- const outputId = stringValue(output?.id);
1001
- if (outputId !== void 0) {
1002
- consumedCallOutputIds.add(outputId);
1000
+ const outputKey = callOutputConsumeKey(output);
1001
+ if (outputKey !== void 0) {
1002
+ consumedCallOutputKeys.add(outputKey);
1003
1003
  }
1004
1004
  return commandMessageForFunctionCall(item, output, index);
1005
1005
  }
@@ -1009,22 +1009,33 @@ function codexOutputMessagesForItems(items) {
1009
1009
  "custom_tool_call_output",
1010
1010
  stringValue(item.call_id)
1011
1011
  );
1012
- const outputId = stringValue(output?.id);
1013
- if (outputId !== void 0) {
1014
- consumedCallOutputIds.add(outputId);
1012
+ const outputKey = callOutputConsumeKey(output);
1013
+ if (outputKey !== void 0) {
1014
+ consumedCallOutputKeys.add(outputKey);
1015
1015
  }
1016
1016
  return messageForCustomToolCall(item, output, index);
1017
1017
  }
1018
1018
  case "function_call_output":
1019
1019
  case "custom_tool_call_output": {
1020
- const outputId = stringValue(item.id);
1021
- return outputId !== void 0 && consumedCallOutputIds.has(outputId) ? [] : commandMessageForUnpairedToolOutput(item, index);
1020
+ const outputKey = callOutputConsumeKey(item);
1021
+ return outputKey !== void 0 && consumedCallOutputKeys.has(outputKey) ? [] : commandMessageForUnpairedToolOutput(item, index);
1022
1022
  }
1023
1023
  default:
1024
1024
  return codexOutputMessagesForItem(item, index);
1025
1025
  }
1026
1026
  });
1027
1027
  }
1028
+ function callOutputConsumeKey(item) {
1029
+ if (item === void 0) {
1030
+ return void 0;
1031
+ }
1032
+ const id = stringValue(item.id);
1033
+ if (id !== void 0) {
1034
+ return `id:${id}`;
1035
+ }
1036
+ const callId = stringValue(item.call_id);
1037
+ return callId === void 0 ? void 0 : `call_id:${callId}`;
1038
+ }
1028
1039
  function codexAssistantDeltaFromNotification(params) {
1029
1040
  const delta = assistantDeltaText(params);
1030
1041
  if (delta === void 0 || delta === "") {
@@ -1078,10 +1089,13 @@ function codexCommandOutputDeltaFromNotification(params) {
1078
1089
  return void 0;
1079
1090
  }
1080
1091
  const processId = stringValue(params.processId) ?? stringValue(params.process_id);
1092
+ const item = objectValue(params.item);
1093
+ const command = nonBlankStringValue(params.command) ?? nonBlankStringValue(params.cmd) ?? nonBlankStringValue(item?.command) ?? nonBlankStringValue(item?.cmd);
1081
1094
  return {
1082
- itemKey: stringValue(params.itemId) ?? stringValue(params.item_id) ?? stringValue(objectValue(params.item)?.id) ?? processId ?? "command-output",
1095
+ itemKey: stringValue(params.itemId) ?? stringValue(params.item_id) ?? stringValue(item?.id) ?? processId ?? "command-output",
1083
1096
  turnId: stringValue(params.turnId) ?? stringValue(params.turn_id) ?? stringValue(objectValue(params.turn)?.id),
1084
1097
  processId,
1098
+ command,
1085
1099
  stream: stringValue(params.stream) ?? "stdout",
1086
1100
  delta
1087
1101
  };
@@ -1658,6 +1672,131 @@ var init_codexOutput = __esm({
1658
1672
  }
1659
1673
  });
1660
1674
 
1675
+ // src/codexSessionLog.ts
1676
+ import { readdirSync, readFileSync } from "node:fs";
1677
+ import { homedir as homedir2 } from "node:os";
1678
+ import { join as join2 } from "node:path";
1679
+ function codexSessionLogOutputMessagesForTurn(args) {
1680
+ const path2 = codexSessionLogPath(args.codexThreadId, args.codexHome);
1681
+ if (path2 === void 0) {
1682
+ return [];
1683
+ }
1684
+ const content = readFileSync(path2, "utf8");
1685
+ const items = codexSessionLogResponseItemsForTurn(content, args.turnId);
1686
+ if (items.length === 0) {
1687
+ return [];
1688
+ }
1689
+ const response = {
1690
+ jsonrpc: "2.0",
1691
+ id: 1,
1692
+ result: {
1693
+ thread: {
1694
+ turns: [
1695
+ {
1696
+ id: args.turnId,
1697
+ items
1698
+ }
1699
+ ]
1700
+ }
1701
+ }
1702
+ };
1703
+ return codexOutputMessagesForTurn(response, args.turnId);
1704
+ }
1705
+ function codexSessionLogPath(codexThreadId, codexHome) {
1706
+ const root = codexHome ?? process.env.CODEX_HOME ?? join2(homedir2(), ".codex");
1707
+ const sessionsRoot = join2(root, "sessions");
1708
+ const candidateDirectories = recentCodexSessionDateDirectories(sessionsRoot);
1709
+ for (const directory of candidateDirectories) {
1710
+ const match = findCodexSessionLogPath(directory, codexThreadId);
1711
+ if (match !== void 0) {
1712
+ return match;
1713
+ }
1714
+ }
1715
+ return void 0;
1716
+ }
1717
+ function findCodexSessionLogPath(directory, codexThreadId) {
1718
+ let entries;
1719
+ try {
1720
+ entries = readdirSync(directory, { withFileTypes: true });
1721
+ } catch {
1722
+ return void 0;
1723
+ }
1724
+ const directMatch = entries.filter((entry) => entry.isFile()).map((entry) => entry.name).filter((name) => name.endsWith(".jsonl") && name.includes(codexThreadId)).sort().at(-1);
1725
+ if (directMatch !== void 0) {
1726
+ return join2(directory, directMatch);
1727
+ }
1728
+ const directories = entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().reverse();
1729
+ for (const name of directories) {
1730
+ const match = findCodexSessionLogPath(join2(directory, name), codexThreadId);
1731
+ if (match !== void 0) {
1732
+ return match;
1733
+ }
1734
+ }
1735
+ return void 0;
1736
+ }
1737
+ function recentCodexSessionDateDirectories(sessionsRoot) {
1738
+ const now = /* @__PURE__ */ new Date();
1739
+ const today = codexSessionDateDirectory(sessionsRoot, now);
1740
+ const yesterday = codexSessionDateDirectory(
1741
+ sessionsRoot,
1742
+ new Date(now.getTime() - 24 * 60 * 60 * 1e3)
1743
+ );
1744
+ return today === yesterday ? [today] : [today, yesterday];
1745
+ }
1746
+ function codexSessionDateDirectory(sessionsRoot, date) {
1747
+ const year = String(date.getFullYear());
1748
+ const month = String(date.getMonth() + 1).padStart(2, "0");
1749
+ const day = String(date.getDate()).padStart(2, "0");
1750
+ return join2(sessionsRoot, year, month, day);
1751
+ }
1752
+ function codexSessionLogResponseItemsForTurn(content, targetTurnId) {
1753
+ let activeTurnId2;
1754
+ const items = [];
1755
+ for (const line of content.split("\n")) {
1756
+ if (line.trim() === "") {
1757
+ continue;
1758
+ }
1759
+ const record = parseJsonObject(line);
1760
+ if (record === void 0) {
1761
+ continue;
1762
+ }
1763
+ const payload = objectPayload(record);
1764
+ const recordType3 = stringValue(record.type);
1765
+ const payloadType = stringValue(payload?.type);
1766
+ const nextTurnId = recordType3 === "turn_context" ? stringValue(payload?.turn_id) : payloadType === "task_started" ? stringValue(payload?.turn_id) : void 0;
1767
+ if (nextTurnId !== void 0) {
1768
+ activeTurnId2 = nextTurnId;
1769
+ }
1770
+ if (recordType3 === "response_item" && activeTurnId2 === targetTurnId && payload !== void 0) {
1771
+ items.push(payload);
1772
+ }
1773
+ if (payloadType === "task_complete" && stringValue(payload?.turn_id) === targetTurnId) {
1774
+ activeTurnId2 = void 0;
1775
+ }
1776
+ }
1777
+ return items;
1778
+ }
1779
+ function parseJsonObject(line) {
1780
+ try {
1781
+ const parsed = JSON.parse(line);
1782
+ return isJsonObject(parsed) ? parsed : void 0;
1783
+ } catch {
1784
+ return void 0;
1785
+ }
1786
+ }
1787
+ function objectPayload(record) {
1788
+ const payload = record.payload;
1789
+ return isJsonObject(payload) ? payload : void 0;
1790
+ }
1791
+ var init_codexSessionLog = __esm({
1792
+ "src/codexSessionLog.ts"() {
1793
+ "use strict";
1794
+ init_codexOutput();
1795
+ init_protocol();
1796
+ init_json();
1797
+ }
1798
+ });
1799
+
1661
1800
  // src/kandanQueue.ts
1662
1801
  function formatQueuedKandanMessage(message) {
1663
1802
  const sender2 = message.actorSlug === void 0 || message.actorSlug.trim() === "" ? "unknown" : message.actorSlug.trim();
@@ -2236,6 +2375,7 @@ function coalesceCommandOutputDeltas(deltas) {
2236
2375
  coalesced.set(key, {
2237
2376
  ...delta,
2238
2377
  processId: delta.processId ?? existing.processId,
2378
+ command: delta.command ?? existing.command,
2239
2379
  delta: `${existing.delta}${delta.delta}`
2240
2380
  });
2241
2381
  }
@@ -3724,6 +3864,8 @@ function initialChannelSessionState(cursor, rootSeq, kandanThreadId, codexThread
3724
3864
  streamingAssistantOutputs: createBoundedCache(maxForwardedTurnIds),
3725
3865
  streamingReasoningOutputs: createBoundedCache(maxForwardedTurnIds),
3726
3866
  streamingCommandOutputs: createBoundedCache(maxForwardedTurnIds),
3867
+ pendingCommandOutputs: createBoundedCache(maxForwardedTurnIds),
3868
+ observedCommandOutputCommands: createBoundedCache(maxForwardedTurnIds * 3),
3727
3869
  streamingFileChangeOutputs: createBoundedCache(maxForwardedTurnIds),
3728
3870
  assistantDeltaQueue: createStreamDeltaQueue(),
3729
3871
  reasoningDeltaQueue: createStreamDeltaQueue(),
@@ -5216,6 +5358,7 @@ async function handleCodexServerRequest(args, state, payloadContext, request) {
5216
5358
  return void 0;
5217
5359
  }
5218
5360
  if (codexApprovalRequestCanAutoAccept(state.runtimeSettings, request.method)) {
5361
+ rememberObservedCommandFromApprovalRequest(state, request, turnId);
5219
5362
  args.log("codex.server_request_auto_accepted", {
5220
5363
  method: request.method,
5221
5364
  turn_id: turnId ?? null
@@ -5255,7 +5398,20 @@ function codexApprovalRequestCanAutoAccept(settings, method) {
5255
5398
  function codexApprovalRequestCanSurface(method) {
5256
5399
  return method === "item/commandExecution/requestApproval" || method === "item/fileChange/requestApproval";
5257
5400
  }
5401
+ function rememberObservedCommandFromApprovalRequest(state, request, turnId) {
5402
+ if (request.method !== "item/commandExecution/requestApproval") {
5403
+ return;
5404
+ }
5405
+ const params = objectValue(request.params) ?? {};
5406
+ rememberObservedCommandOutputCommand(state, {
5407
+ turnId,
5408
+ itemKey: stringValue(params.itemId) ?? stringValue(params.item_id) ?? stringValue(objectValue(params.item)?.id),
5409
+ processId: stringValue(params.processId) ?? stringValue(params.process_id),
5410
+ command: stringValue(params.command) ?? stringValue(params.cmd)
5411
+ });
5412
+ }
5258
5413
  async function requestKandanApproval(args, state, request, turnId, payloadContext) {
5414
+ rememberObservedCommandFromApprovalRequest(state, request, turnId);
5259
5415
  const approvalResult = state.approvalPromptChain.then(async () => {
5260
5416
  const sourceSeq = activeQueuedSeqForTurn(state.turn, turnId);
5261
5417
  if (sourceSeq === void 0 || state.kandanThreadId === void 0) {
@@ -5362,11 +5518,22 @@ async function forwardCompletedCodexTurn(args, state, turnId, payloadContext) {
5362
5518
  return;
5363
5519
  }
5364
5520
  const tuiInputMessages = isLocalTuiTurn(state, turnId) ? codexUserInputMessagesForTurn(read, turnId) : [];
5365
- const messages = codexOutputMessagesForTurn(read, turnId);
5521
+ const readMessages = codexOutputMessagesForTurn(read, turnId);
5522
+ const sessionLogMessages = await sessionLogOutputMessagesForTurn(
5523
+ args,
5524
+ state.codexThreadId,
5525
+ turnId
5526
+ );
5527
+ const messages = completedMessagesWithSessionLog(
5528
+ readMessages,
5529
+ sessionLogMessages
5530
+ );
5366
5531
  args.log("codex.turn_completed", {
5367
5532
  turn_id: turnId,
5368
5533
  tui_input_count: tuiInputMessages.length,
5369
- output_count: messages.length
5534
+ output_count: messages.length,
5535
+ thread_read_output_count: readMessages.length,
5536
+ session_log_output_count: sessionLogMessages.length
5370
5537
  });
5371
5538
  if (isLocalTuiTurn(state, turnId)) {
5372
5539
  ensureKandanThreadForLocalTuiTurn(state);
@@ -5573,6 +5740,85 @@ function completedOutputProjectionsForTurn(state, turnId, messages) {
5573
5740
  compareCompletedOutputProjection
5574
5741
  );
5575
5742
  }
5743
+ async function sessionLogOutputMessagesForTurn(args, codexThreadId, turnId) {
5744
+ try {
5745
+ return await codexSessionLogOutputMessagesForTurn({
5746
+ codexThreadId,
5747
+ turnId
5748
+ });
5749
+ } catch (error) {
5750
+ args.log("codex.session_log_read_failed", {
5751
+ codex_thread_id: codexThreadId,
5752
+ turn_id: turnId,
5753
+ message: error instanceof Error ? error.message : String(error)
5754
+ });
5755
+ return [];
5756
+ }
5757
+ }
5758
+ function completedMessagesWithSessionLog(readMessages, sessionLogMessages) {
5759
+ const readExactKeys = new Set(readMessages.map(completedMessageExactKey));
5760
+ const readSemanticCounts = completedMessageSemanticCounts(readMessages);
5761
+ const missingSessionStructuredMessages = [];
5762
+ for (const message of sessionLogMessages) {
5763
+ if (stringValue(message.structured.kind) === "codex_assistant_message") {
5764
+ continue;
5765
+ }
5766
+ if (readExactKeys.has(completedMessageExactKey(message))) {
5767
+ continue;
5768
+ }
5769
+ const semanticKey = completedMessageSemanticKey(message);
5770
+ const remainingReadCount = readSemanticCounts.get(semanticKey) ?? 0;
5771
+ if (remainingReadCount > 0) {
5772
+ readSemanticCounts.set(semanticKey, remainingReadCount - 1);
5773
+ continue;
5774
+ }
5775
+ missingSessionStructuredMessages.push(message);
5776
+ }
5777
+ if (missingSessionStructuredMessages.length === 0) {
5778
+ return [...readMessages];
5779
+ }
5780
+ return [...missingSessionStructuredMessages, ...readMessages];
5781
+ }
5782
+ function completedMessageExactKey(message) {
5783
+ return `${stringValue(message.structured.kind) ?? ""}:${message.itemKey}`;
5784
+ }
5785
+ function completedMessageSemanticCounts(messages) {
5786
+ const counts = /* @__PURE__ */ new Map();
5787
+ for (const message of messages) {
5788
+ const key = completedMessageSemanticKey(message);
5789
+ counts.set(key, (counts.get(key) ?? 0) + 1);
5790
+ }
5791
+ return counts;
5792
+ }
5793
+ function completedMessageSemanticKey(message) {
5794
+ const kind = stringValue(message.structured.kind) ?? "";
5795
+ switch (kind) {
5796
+ case "codex_command_execution":
5797
+ return JSON.stringify([
5798
+ kind,
5799
+ stringValue(message.structured.command) ?? "",
5800
+ stringValue(message.structured.cwd) ?? "",
5801
+ stringValue(message.structured.output) ?? message.body
5802
+ ]);
5803
+ case "codex_file_change":
5804
+ return JSON.stringify([
5805
+ kind,
5806
+ stringValue(message.structured.patch_text) ?? message.body
5807
+ ]);
5808
+ case "codex_reasoning":
5809
+ return JSON.stringify([
5810
+ kind,
5811
+ stringValue(message.structured.content) ?? message.body
5812
+ ]);
5813
+ case "codex_terminal_input":
5814
+ return JSON.stringify([
5815
+ kind,
5816
+ stringValue(message.structured.input_text) ?? message.body
5817
+ ]);
5818
+ default:
5819
+ return JSON.stringify([kind, message.body]);
5820
+ }
5821
+ }
5576
5822
  function completedSnapshotOutputProjection(state, turnId, message, snapshotIndex) {
5577
5823
  const streamedStructured = resolveStreamingStructuredOutputForCompletedMessage(
5578
5824
  state,
@@ -5700,11 +5946,11 @@ async function postCompletedOutputProjection(args, state, payloadContext, params
5700
5946
  const output = params.output.output;
5701
5947
  const message = {
5702
5948
  itemKey: output.itemKey,
5703
- body: codexCommandOutputBody("command output", output.output),
5949
+ body: codexCommandOutputBody(output.command, output.output),
5704
5950
  structured: codexCommandExecutionStructuredMessage(
5705
5951
  output.itemKey,
5706
5952
  {
5707
- command: "command output",
5953
+ command: output.command,
5708
5954
  output: output.output,
5709
5955
  processId: output.processId,
5710
5956
  stream: output.stream
@@ -6235,6 +6481,59 @@ async function forwardReasoningDeltaPayload(args, state, delta, payloadContext)
6235
6481
  content_length: nextContent.length
6236
6482
  });
6237
6483
  }
6484
+ async function resolveCommandForCommandOutputDelta(args, state, turnId, delta, existing) {
6485
+ const observed = delta.command ?? existing?.command ?? findObservedCommandOutputCommand(state, {
6486
+ turnId,
6487
+ itemKey: delta.itemKey,
6488
+ processId: delta.processId
6489
+ });
6490
+ if (observed !== void 0 && observed.trim() !== "") {
6491
+ rememberObservedCommandOutputCommand(state, {
6492
+ turnId,
6493
+ itemKey: delta.itemKey,
6494
+ processId: delta.processId,
6495
+ command: observed
6496
+ });
6497
+ return observed;
6498
+ }
6499
+ if (state.codexThreadId !== void 0) {
6500
+ const read = await args.codex.request("thread/read", {
6501
+ threadId: state.codexThreadId,
6502
+ includeTurns: true
6503
+ });
6504
+ const command = commandOutputCommandFromThreadRead(read, turnId, delta);
6505
+ if (command !== void 0) {
6506
+ rememberObservedCommandOutputCommand(state, {
6507
+ turnId,
6508
+ itemKey: delta.itemKey,
6509
+ processId: delta.processId,
6510
+ command
6511
+ });
6512
+ return command;
6513
+ }
6514
+ }
6515
+ throw new LogicalProjectionError(
6516
+ `Cannot forward command output for item ${delta.itemKey} without the actual command`
6517
+ );
6518
+ }
6519
+ function commandOutputCommandFromThreadRead(response, turnId, delta) {
6520
+ if ("error" in response) {
6521
+ return void 0;
6522
+ }
6523
+ const thread = objectValue(objectValue(response.result)?.thread);
6524
+ const turns = arrayValue(thread?.turns) ?? [];
6525
+ const turn = turns.filter(isJsonObject).find((candidate) => candidate.id === turnId);
6526
+ const items = (arrayValue(turn?.items) ?? []).filter(isJsonObject);
6527
+ for (const item of items) {
6528
+ const itemId = stringValue(item.id);
6529
+ const processId = stringValue(item.processId) ?? stringValue(item.process_id);
6530
+ const command = stringValue(item.command) ?? stringValue(item.cmd);
6531
+ if (command !== void 0 && command.trim() !== "" && stringValue(item.type) === "commandExecution" && (itemId === delta.itemKey || delta.processId !== void 0 && processId === delta.processId)) {
6532
+ return command;
6533
+ }
6534
+ }
6535
+ return void 0;
6536
+ }
6238
6537
  async function forwardCommandOutputDeltaPayload(args, state, delta, payloadContext) {
6239
6538
  if (state.kandanThreadId === void 0 || state.codexThreadId === void 0) {
6240
6539
  return;
@@ -6252,19 +6551,50 @@ async function forwardCommandOutputDeltaPayload(args, state, delta, payloadConte
6252
6551
  return;
6253
6552
  }
6254
6553
  const existing = findStreamingCommandOutput(state, delta.itemKey);
6255
- const output = `${existing?.output ?? ""}${delta.delta}`;
6554
+ const pending = findPendingCommandOutput(state, delta.itemKey);
6555
+ const output = `${existing?.output ?? pending?.output ?? ""}${delta.delta}`;
6556
+ let command;
6557
+ try {
6558
+ command = await resolveCommandForCommandOutputDelta(
6559
+ args,
6560
+ state,
6561
+ turnId,
6562
+ delta,
6563
+ existing
6564
+ );
6565
+ } catch (error) {
6566
+ if (error instanceof LogicalProjectionError) {
6567
+ rememberPendingCommandOutput(state, {
6568
+ itemKey: delta.itemKey,
6569
+ turnId,
6570
+ output,
6571
+ processId: delta.processId ?? pending?.processId,
6572
+ stream: delta.stream
6573
+ });
6574
+ args.log("codex.command_output_waiting_for_command", {
6575
+ turn_id: turnId,
6576
+ item_key: delta.itemKey,
6577
+ process_id: delta.processId ?? pending?.processId ?? null,
6578
+ output_length: output.length,
6579
+ message: error.message
6580
+ });
6581
+ return;
6582
+ }
6583
+ throw error;
6584
+ }
6585
+ forgetPendingCommandOutput(state, delta.itemKey);
6256
6586
  const structured = codexCommandExecutionStructuredMessage(
6257
6587
  delta.itemKey,
6258
6588
  {
6259
- command: "command output",
6589
+ command,
6260
6590
  output,
6261
- processId: delta.processId,
6591
+ processId: delta.processId ?? pending?.processId,
6262
6592
  stream: delta.stream
6263
6593
  },
6264
6594
  "streaming"
6265
6595
  );
6266
6596
  const persistedOutput = typeof structured.output === "string" ? structured.output : output;
6267
- const body = codexCommandOutputBody("command output", output);
6597
+ const body = codexCommandOutputBody(command, output);
6268
6598
  if (structured.output_truncated === true) {
6269
6599
  args.log("codex.command_output_truncated", {
6270
6600
  item_key: delta.itemKey,
@@ -6311,8 +6641,9 @@ async function forwardCommandOutputDeltaPayload(args, state, delta, payloadConte
6311
6641
  itemKey: delta.itemKey,
6312
6642
  turnId,
6313
6643
  seq,
6644
+ command,
6314
6645
  output: persistedOutput,
6315
- processId: delta.processId,
6646
+ processId: delta.processId ?? pending?.processId,
6316
6647
  stream: delta.stream
6317
6648
  });
6318
6649
  }
@@ -6326,6 +6657,7 @@ async function forwardCommandOutputDeltaPayload(args, state, delta, payloadConte
6326
6657
  );
6327
6658
  rememberStreamingCommandOutput(state, {
6328
6659
  ...existing,
6660
+ command,
6329
6661
  output: persistedOutput,
6330
6662
  processId: delta.processId ?? existing.processId,
6331
6663
  stream: delta.stream
@@ -6933,6 +7265,9 @@ function findStreamingReasoningOutput(state, itemKey) {
6933
7265
  function findStreamingCommandOutput(state, itemKey) {
6934
7266
  return getBoundedCacheValue(state.streamingCommandOutputs, itemKey);
6935
7267
  }
7268
+ function findPendingCommandOutput(state, itemKey) {
7269
+ return getBoundedCacheValue(state.pendingCommandOutputs, itemKey);
7270
+ }
6936
7271
  function findStreamingFileChangeOutput(state, itemKey) {
6937
7272
  return getBoundedCacheValue(state.streamingFileChangeOutputs, itemKey);
6938
7273
  }
@@ -6967,6 +7302,39 @@ function forgetStreamingStructuredOutput(state, itemKey, structured) {
6967
7302
  break;
6968
7303
  }
6969
7304
  }
7305
+ function observedCommandCacheKeys(input) {
7306
+ return [
7307
+ input.itemKey === void 0 ? void 0 : `item:${input.itemKey}`,
7308
+ input.processId === void 0 ? void 0 : `process:${input.processId}`
7309
+ ].filter((key) => key !== void 0);
7310
+ }
7311
+ function rememberObservedCommandOutputCommand(state, input) {
7312
+ const command = input.command?.trim();
7313
+ if (command === void 0 || command === "") {
7314
+ return;
7315
+ }
7316
+ for (const cacheKey of observedCommandCacheKeys(input)) {
7317
+ rememberBoundedCacheValue(state.observedCommandOutputCommands, cacheKey, {
7318
+ cacheKey,
7319
+ turnId: input.turnId,
7320
+ itemKey: input.itemKey,
7321
+ processId: input.processId,
7322
+ command
7323
+ });
7324
+ }
7325
+ }
7326
+ function findObservedCommandOutputCommand(state, input) {
7327
+ for (const cacheKey of observedCommandCacheKeys(input)) {
7328
+ const command = getBoundedCacheValue(
7329
+ state.observedCommandOutputCommands,
7330
+ cacheKey
7331
+ )?.command;
7332
+ if (command !== void 0 && command.trim() !== "") {
7333
+ return command;
7334
+ }
7335
+ }
7336
+ return void 0;
7337
+ }
6970
7338
  function resolveStreamingAssistantOutputForCompletedMessage(state, turnId, itemKey, body, structured) {
6971
7339
  const exact = findStreamingAssistantOutput(state, itemKey);
6972
7340
  if (exact !== void 0) {
@@ -7064,6 +7432,16 @@ function rememberStreamingCommandOutput(state, output) {
7064
7432
  output
7065
7433
  );
7066
7434
  }
7435
+ function rememberPendingCommandOutput(state, output) {
7436
+ rememberBoundedCacheValue(
7437
+ state.pendingCommandOutputs,
7438
+ output.itemKey,
7439
+ output
7440
+ );
7441
+ }
7442
+ function forgetPendingCommandOutput(state, itemKey) {
7443
+ forgetBoundedCacheValue(state.pendingCommandOutputs, itemKey);
7444
+ }
7067
7445
  function forgetStreamingCommandOutput(state, itemKey) {
7068
7446
  forgetBoundedCacheValue(state.streamingCommandOutputs, itemKey);
7069
7447
  }
@@ -7730,6 +8108,7 @@ var init_channelSession = __esm({
7730
8108
  init_commanderAttachments();
7731
8109
  init_codexRuntimeOptions();
7732
8110
  init_codexOutput();
8111
+ init_codexSessionLog();
7733
8112
  init_json();
7734
8113
  init_kandanQueue();
7735
8114
  init_linzumiContext();
@@ -7760,16 +8139,16 @@ var init_channelSession = __esm({
7760
8139
  });
7761
8140
 
7762
8141
  // src/claudeCodeSession.ts
7763
- import { existsSync, readFileSync } from "node:fs";
7764
- import { homedir as homedir2 } from "node:os";
7765
- import { join as join2 } from "node:path";
8142
+ import { existsSync, readFileSync as readFileSync2 } from "node:fs";
8143
+ import { homedir as homedir3 } from "node:os";
8144
+ import { join as join3 } from "node:path";
7766
8145
  function claudeCodeSettingSources() {
7767
8146
  return ["user", "project", "local"];
7768
8147
  }
7769
8148
  async function probeClaudeCodeAvailability(args) {
7770
8149
  if (!hasClaudeCodeAuthHint(process.env, {
7771
8150
  cwd: args.cwd,
7772
- homeDir: homedir2(),
8151
+ homeDir: homedir3(),
7773
8152
  platform: process.platform,
7774
8153
  fileExists: existsSync,
7775
8154
  readTextFile: readTextFileIfPresent
@@ -7794,7 +8173,7 @@ async function probeClaudeCodeAvailability(args) {
7794
8173
  }
7795
8174
  }
7796
8175
  function hasClaudeCodeAuthHint(env, deps) {
7797
- const configDir = env.CLAUDE_CONFIG_DIR ?? join2(deps.homeDir, ".claude");
8176
+ const configDir = env.CLAUDE_CONFIG_DIR ?? join3(deps.homeDir, ".claude");
7798
8177
  return hasAnthropicCredentialEnv(env) || hasClaudeCloudProviderEnv(env) || hasClaudeCodeFileCredential(configDir, deps) || hasClaudeCodeApiKeyHelper(configDir, deps) || hasMacClaudeCodeKeychainAnchor(deps);
7799
8178
  }
7800
8179
  function claudeCodePolicyDeferHooks() {
@@ -7829,14 +8208,14 @@ function hasClaudeCloudProviderEnv(env) {
7829
8208
  return trueishEnv(env.CLAUDE_CODE_USE_BEDROCK) || trueishEnv(env.CLAUDE_CODE_USE_VERTEX) || trueishEnv(env.CLAUDE_CODE_USE_FOUNDRY) || trueishEnv(env.CLAUDE_CODE_USE_ANTHROPIC_AWS) || trueishEnv(env.CLAUDE_CODE_USE_MANTLE);
7830
8209
  }
7831
8210
  function hasClaudeCodeFileCredential(configDir, deps) {
7832
- return deps.fileExists(join2(configDir, ".credentials.json")) || deps.fileExists(join2(configDir, ".claude.json")) || deps.fileExists(join2(deps.homeDir, ".claude.json"));
8211
+ return deps.fileExists(join3(configDir, ".credentials.json")) || deps.fileExists(join3(configDir, ".claude.json")) || deps.fileExists(join3(deps.homeDir, ".claude.json"));
7833
8212
  }
7834
8213
  function hasClaudeCodeApiKeyHelper(configDir, deps) {
7835
8214
  return [
7836
- join2(configDir, "settings.json"),
7837
- join2(configDir, "settings.local.json"),
7838
- join2(deps.cwd, ".claude", "settings.json"),
7839
- join2(deps.cwd, ".claude", "settings.local.json")
8215
+ join3(configDir, "settings.json"),
8216
+ join3(configDir, "settings.local.json"),
8217
+ join3(deps.cwd, ".claude", "settings.json"),
8218
+ join3(deps.cwd, ".claude", "settings.local.json")
7840
8219
  ].some((path2) => settingsFileHasApiKeyHelper(path2, deps));
7841
8220
  }
7842
8221
  function settingsFileHasApiKeyHelper(path2, deps) {
@@ -7856,14 +8235,14 @@ function hasMacClaudeCodeKeychainAnchor(deps) {
7856
8235
  return false;
7857
8236
  }
7858
8237
  return [
7859
- join2(deps.homeDir, "Library", "Application Support", "claude-cli-nodejs"),
7860
- join2(deps.homeDir, "Library", "Application Support", "Claude"),
7861
- join2(deps.homeDir, "Library", "Preferences", "claude-cli-nodejs")
8238
+ join3(deps.homeDir, "Library", "Application Support", "claude-cli-nodejs"),
8239
+ join3(deps.homeDir, "Library", "Application Support", "Claude"),
8240
+ join3(deps.homeDir, "Library", "Preferences", "claude-cli-nodejs")
7862
8241
  ].some((path2) => deps.fileExists(path2));
7863
8242
  }
7864
8243
  function readTextFileIfPresent(path2) {
7865
8244
  try {
7866
- return readFileSync(path2, "utf8");
8245
+ return readFileSync2(path2, "utf8");
7867
8246
  } catch (_error) {
7868
8247
  return void 0;
7869
8248
  }
@@ -8434,8 +8813,8 @@ var init_claudeCodeSession = __esm({
8434
8813
  // src/runnerLogger.ts
8435
8814
  import { appendFileSync, openSync } from "node:fs";
8436
8815
  import { createWriteStream } from "node:fs";
8437
- import { homedir as homedir3 } from "node:os";
8438
- import { dirname, join as join3 } from "node:path";
8816
+ import { homedir as homedir4 } from "node:os";
8817
+ import { dirname, join as join4 } from "node:path";
8439
8818
  import { mkdirSync } from "node:fs";
8440
8819
  function createRunnerLogger(logFile, consoleReporter) {
8441
8820
  mkdirSync(dirname(logFile), { recursive: true });
@@ -8476,10 +8855,10 @@ function writeCliAuditEvent(event, payload, options = {}) {
8476
8855
  }
8477
8856
  function defaultCliAuditLogFile() {
8478
8857
  const override = process.env.LINZUMI_CLI_AUDIT_LOG?.trim();
8479
- return override === void 0 || override === "" ? join3(homedir3(), ".linzumi", "logs", "command-events.jsonl") : override;
8858
+ return override === void 0 || override === "" ? join4(homedir4(), ".linzumi", "logs", "command-events.jsonl") : override;
8480
8859
  }
8481
8860
  function defaultRunnerLogFile() {
8482
- return join3(homedir3(), ".linzumi", "logs", "runner-events.jsonl");
8861
+ return join4(homedir4(), ".linzumi", "logs", "runner-events.jsonl");
8483
8862
  }
8484
8863
  function redactForCliLog(value) {
8485
8864
  return redactObject(value);
@@ -9137,17 +9516,17 @@ var init_codexAppServer = __esm({
9137
9516
  import {
9138
9517
  existsSync as existsSync2,
9139
9518
  mkdirSync as mkdirSync2,
9140
- readFileSync as readFileSync2,
9519
+ readFileSync as readFileSync3,
9141
9520
  realpathSync,
9142
9521
  writeFileSync
9143
9522
  } from "node:fs";
9144
- import { homedir as homedir4 } from "node:os";
9145
- import { join as join4, resolve as resolve2 } from "node:path";
9523
+ import { homedir as homedir5 } from "node:os";
9524
+ import { join as join5, resolve as resolve2 } from "node:path";
9146
9525
  function ensureCodexProjectTrusted(projectPath, options = {}) {
9147
9526
  const trustedPath = realpathSync(resolve2(projectPath));
9148
- const configHome = options.configHome ?? process.env.CODEX_HOME ?? join4(homedir4(), ".codex");
9149
- const configPath = join4(configHome, "config.toml");
9150
- const currentConfig = existsSync2(configPath) ? readFileSync2(configPath, "utf8") : "";
9527
+ const configHome = options.configHome ?? process.env.CODEX_HOME ?? join5(homedir5(), ".codex");
9528
+ const configPath = join5(configHome, "config.toml");
9529
+ const currentConfig = existsSync2(configPath) ? readFileSync3(configPath, "utf8") : "";
9151
9530
  const nextConfig = codexConfigWithTrustedProject(currentConfig, trustedPath);
9152
9531
  if (nextConfig !== currentConfig) {
9153
9532
  mkdirSync2(configHome, { recursive: true });
@@ -9200,7 +9579,7 @@ var init_codexProjectTrust = __esm({
9200
9579
 
9201
9580
  // src/localCapabilities.ts
9202
9581
  import { realpathSync as realpathSync2 } from "node:fs";
9203
- import { homedir as homedir5 } from "node:os";
9582
+ import { homedir as homedir6 } from "node:os";
9204
9583
  import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve3 } from "node:path";
9205
9584
  function parseAllowedCwdList(value) {
9206
9585
  if (value === void 0) {
@@ -9240,10 +9619,10 @@ function assertConfiguredAllowedCwds(paths) {
9240
9619
  }
9241
9620
  function expandUserPath(pathValue) {
9242
9621
  if (pathValue === "~") {
9243
- return homedir5();
9622
+ return homedir6();
9244
9623
  }
9245
9624
  if (pathValue.startsWith("~/")) {
9246
- return resolve3(homedir5(), pathValue.slice(2));
9625
+ return resolve3(homedir6(), pathValue.slice(2));
9247
9626
  }
9248
9627
  return pathValue;
9249
9628
  }
@@ -9624,16 +10003,16 @@ import {
9624
10003
  existsSync as existsSync3,
9625
10004
  linkSync,
9626
10005
  mkdirSync as mkdirSync3,
9627
- readFileSync as readFileSync3,
10006
+ readFileSync as readFileSync4,
9628
10007
  realpathSync as realpathSync3,
9629
10008
  unlinkSync,
9630
10009
  writeFileSync as writeFileSync2
9631
10010
  } from "node:fs";
9632
- import { homedir as homedir6 } from "node:os";
9633
- import { basename as basename3, dirname as dirname2, join as join5, resolve as resolve4 } from "node:path";
10011
+ import { homedir as homedir7 } from "node:os";
10012
+ import { basename as basename3, dirname as dirname2, join as join6, resolve as resolve4 } from "node:path";
9634
10013
  function localConfigPath(env = process.env) {
9635
10014
  const override = env.LINZUMI_CONFIG_FILE;
9636
- return override !== void 0 && override.trim() !== "" ? resolve4(expandUserPath(override)) : resolve4(homedir6(), ".linzumi", "config.json");
10015
+ return override !== void 0 && override.trim() !== "" ? resolve4(expandUserPath(override)) : resolve4(homedir7(), ".linzumi", "config.json");
9637
10016
  }
9638
10017
  function localConfigScopeKey(linzumiUrl) {
9639
10018
  const normalizedUrl = kandanHttpBaseUrl(linzumiUrl);
@@ -9714,21 +10093,21 @@ function ensureLocalRunnerId(path2 = localConfigPath(), createRunnerId = default
9714
10093
  }
9715
10094
  function localMachineIdSeedPath(configPath = localConfigPath(), linzumiUrl) {
9716
10095
  if (linzumiUrl !== void 0 && localConfigScopeKey(linzumiUrl) !== prodConfigScope) {
9717
- return join5(
10096
+ return join6(
9718
10097
  dirname2(configPath),
9719
10098
  `${basename3(configPath)}.${localConfigScopeFileStem(linzumiUrl)}.machine-id`
9720
10099
  );
9721
10100
  }
9722
- return join5(dirname2(configPath), `${basename3(configPath)}.machine-id`);
10101
+ return join6(dirname2(configPath), `${basename3(configPath)}.machine-id`);
9723
10102
  }
9724
10103
  function localRunnerIdSeedPath(configPath = localConfigPath(), linzumiUrl) {
9725
10104
  if (linzumiUrl !== void 0 && localConfigScopeKey(linzumiUrl) !== prodConfigScope) {
9726
- return join5(
10105
+ return join6(
9727
10106
  dirname2(configPath),
9728
10107
  `${basename3(configPath)}.${localConfigScopeFileStem(linzumiUrl)}.runner-id`
9729
10108
  );
9730
10109
  }
9731
- return join5(dirname2(configPath), `${basename3(configPath)}.runner-id`);
10110
+ return join6(dirname2(configPath), `${basename3(configPath)}.runner-id`);
9732
10111
  }
9733
10112
  function readConfiguredAllowedCwdDetailsForLinzumiUrl(linzumiUrl, path2 = localConfigPath()) {
9734
10113
  return readConfiguredAllowedCwdDetailsFromConfig(
@@ -9893,7 +10272,7 @@ function readLocalConfigFile(path2) {
9893
10272
  if (!existsSync3(path2)) {
9894
10273
  return { version: 1, allowedCwds: [] };
9895
10274
  }
9896
- const parsed = JSON.parse(readFileSync3(path2, "utf8"));
10275
+ const parsed = JSON.parse(readFileSync4(path2, "utf8"));
9897
10276
  if (!isConfigPayload(parsed)) {
9898
10277
  throw new Error(`invalid Linzumi config: ${path2}`);
9899
10278
  }
@@ -9998,7 +10377,7 @@ function ensureLocalMachineIdSeed(configPath, createMachineId, linzumiUrl) {
9998
10377
  throw new Error(`invalid generated Linzumi machine id: ${machineId}`);
9999
10378
  }
10000
10379
  mkdirSync3(dirname2(seedPath), { recursive: true });
10001
- const tempPath = join5(
10380
+ const tempPath = join6(
10002
10381
  dirname2(seedPath),
10003
10382
  `.${basename3(seedPath)}.${process.pid}.${randomUUID2()}.tmp`
10004
10383
  );
@@ -10026,7 +10405,7 @@ function ensureLocalRunnerIdSeed(configPath, createRunnerId, linzumiUrl) {
10026
10405
  throw new Error(`invalid generated Linzumi runner id: ${runnerId}`);
10027
10406
  }
10028
10407
  mkdirSync3(dirname2(seedPath), { recursive: true });
10029
- const tempPath = join5(
10408
+ const tempPath = join6(
10030
10409
  dirname2(seedPath),
10031
10410
  `.${basename3(seedPath)}.${process.pid}.${randomUUID2()}.tmp`
10032
10411
  );
@@ -10045,14 +10424,14 @@ function ensureLocalRunnerIdSeed(configPath, createRunnerId, linzumiUrl) {
10045
10424
  }
10046
10425
  }
10047
10426
  function readMachineIdSeed(seedPath) {
10048
- const machineId = readFileSync3(seedPath, "utf8").trim();
10427
+ const machineId = readFileSync4(seedPath, "utf8").trim();
10049
10428
  if (!machineIdValid(machineId)) {
10050
10429
  throw new Error(`invalid Linzumi machine id seed: ${seedPath}`);
10051
10430
  }
10052
10431
  return machineId;
10053
10432
  }
10054
10433
  function readRunnerIdSeed(seedPath) {
10055
- const runnerId = readFileSync3(seedPath, "utf8").trim();
10434
+ const runnerId = readFileSync4(seedPath, "utf8").trim();
10056
10435
  if (!runnerIdValid(runnerId)) {
10057
10436
  throw new Error(`invalid Linzumi runner id seed: ${seedPath}`);
10058
10437
  }
@@ -10094,8 +10473,8 @@ var init_localConfig = __esm({
10094
10473
  });
10095
10474
 
10096
10475
  // src/helloLinzumiProject.ts
10097
- import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync4, rmSync, writeFileSync as writeFileSync3 } from "node:fs";
10098
- import { dirname as dirname3, join as join6, resolve as resolve5 } from "node:path";
10476
+ import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync5, rmSync, writeFileSync as writeFileSync3 } from "node:fs";
10477
+ import { dirname as dirname3, join as join7, resolve as resolve5 } from "node:path";
10099
10478
  import { fileURLToPath as fileURLToPath2 } from "node:url";
10100
10479
  function createHelloLinzumiProject(input = {}) {
10101
10480
  const options = typeof input === "string" ? { rootPath: input } : input;
@@ -10104,9 +10483,9 @@ function createHelloLinzumiProject(input = {}) {
10104
10483
  const host = normalizeHost(options.host);
10105
10484
  assertTcpPort(port);
10106
10485
  assertWritableDemoRoot(root, options.reset === true);
10107
- mkdirSync4(join6(root, "src"), { recursive: true });
10486
+ mkdirSync4(join7(root, "src"), { recursive: true });
10108
10487
  for (const file of demoFiles({ root, port, host })) {
10109
- writeFileSync3(join6(root, file.path), file.content, "utf8");
10488
+ writeFileSync3(join7(root, file.path), file.content, "utf8");
10110
10489
  }
10111
10490
  return {
10112
10491
  root,
@@ -10150,8 +10529,8 @@ function assertWritableDemoRoot(root, reset) {
10150
10529
  if (!existsSync4(root)) {
10151
10530
  return;
10152
10531
  }
10153
- const markerPath = join6(root, markerFile);
10154
- const isDemoRoot = existsSync4(markerPath) && readFileSync4(markerPath, "utf8").trim() === "hello-linzumi";
10532
+ const markerPath = join7(root, markerFile);
10533
+ const isDemoRoot = existsSync4(markerPath) && readFileSync5(markerPath, "utf8").trim() === "hello-linzumi";
10155
10534
  if (isDemoRoot && reset) {
10156
10535
  rmSync(root, { recursive: true, force: true });
10157
10536
  return;
@@ -10186,7 +10565,7 @@ var init_helloLinzumiProject = __esm({
10186
10565
  defaultHelloLinzumiHost = "0.0.0.0";
10187
10566
  markerFile = ".linzumi-demo-project";
10188
10567
  moduleDir = dirname3(fileURLToPath2(import.meta.url));
10189
- linzumiLogoSvg = readFileSync4(join6(moduleDir, "assets", "linzumi-logo.svg"), "utf8");
10568
+ linzumiLogoSvg = readFileSync5(join7(moduleDir, "assets", "linzumi-logo.svg"), "utf8");
10190
10569
  packageJson = `${JSON.stringify(
10191
10570
  {
10192
10571
  name: "hello-linzumi",
@@ -10990,12 +11369,12 @@ import {
10990
11369
  existsSync as existsSync5,
10991
11370
  mkdirSync as mkdirSync5,
10992
11371
  mkdtempSync,
10993
- readFileSync as readFileSync5,
11372
+ readFileSync as readFileSync6,
10994
11373
  realpathSync as realpathSync4,
10995
11374
  writeFileSync as writeFileSync4
10996
11375
  } from "node:fs";
10997
11376
  import { tmpdir } from "node:os";
10998
- import { basename as basename4, delimiter, dirname as dirname4, join as join7 } from "node:path";
11377
+ import { basename as basename4, delimiter, dirname as dirname4, join as join8 } from "node:path";
10999
11378
  function isStartLocalEditorControl(control) {
11000
11379
  return control.type === "start_local_editor";
11001
11380
  }
@@ -11213,11 +11592,11 @@ function codeServerArgs(port, cwd, userDataDir, extensionsDir) {
11213
11592
  }
11214
11593
  function prepareCodeServerProfile(collaboration, editorRuntime) {
11215
11594
  try {
11216
- const userDataDir = mkdtempSync(join7(tmpdir(), "kandan-local-editor-"));
11217
- const extensionsDir = join7(userDataDir, "extensions");
11218
- const collaborationServerDir = join7(userDataDir, "collaboration-server");
11219
- const tempDir = join7(userDataDir, "tmp");
11220
- const userSettingsDir = join7(userDataDir, "User");
11595
+ const userDataDir = mkdtempSync(join8(tmpdir(), "kandan-local-editor-"));
11596
+ const extensionsDir = join8(userDataDir, "extensions");
11597
+ const collaborationServerDir = join8(userDataDir, "collaboration-server");
11598
+ const tempDir = join8(userDataDir, "tmp");
11599
+ const userSettingsDir = join8(userDataDir, "User");
11221
11600
  mkdirSync5(userSettingsDir, { recursive: true });
11222
11601
  mkdirSync5(extensionsDir, { recursive: true });
11223
11602
  mkdirSync5(collaborationServerDir, { recursive: true });
@@ -11226,11 +11605,11 @@ function prepareCodeServerProfile(collaboration, editorRuntime) {
11226
11605
  ensureCodeServerBrowserExtensionAssets(editorRuntime);
11227
11606
  installDirectory(
11228
11607
  editorRuntime.assets.documentStateExtensionDir,
11229
- join7(extensionsDir, "kandan.document-state-telemetry")
11608
+ join8(extensionsDir, "kandan.document-state-telemetry")
11230
11609
  );
11231
11610
  }
11232
11611
  writeFileSync4(
11233
- join7(userSettingsDir, "settings.json"),
11612
+ join8(userSettingsDir, "settings.json"),
11234
11613
  JSON.stringify(codeServerSettings(collaboration), null, 2)
11235
11614
  );
11236
11615
  return { ok: true, userDataDir, extensionsDir, collaborationServerDir };
@@ -11242,14 +11621,14 @@ function ensureCodeServerBrowserExtensionAssets(runtime) {
11242
11621
  const vscodeRoot = codeServerVscodeRoot(runtime);
11243
11622
  const repairs = [
11244
11623
  {
11245
- source: join7(
11624
+ source: join8(
11246
11625
  vscodeRoot,
11247
11626
  "extensions",
11248
11627
  "git-base",
11249
11628
  "dist",
11250
11629
  "extension.js"
11251
11630
  ),
11252
- target: join7(
11631
+ target: join8(
11253
11632
  vscodeRoot,
11254
11633
  "extensions",
11255
11634
  "git-base",
@@ -11260,14 +11639,14 @@ function ensureCodeServerBrowserExtensionAssets(runtime) {
11260
11639
  required: true
11261
11640
  },
11262
11641
  {
11263
- source: join7(
11642
+ source: join8(
11264
11643
  vscodeRoot,
11265
11644
  "extensions",
11266
11645
  "git-base",
11267
11646
  "dist",
11268
11647
  "extension.js.map"
11269
11648
  ),
11270
- target: join7(
11649
+ target: join8(
11271
11650
  vscodeRoot,
11272
11651
  "extensions",
11273
11652
  "git-base",
@@ -11278,14 +11657,14 @@ function ensureCodeServerBrowserExtensionAssets(runtime) {
11278
11657
  required: false
11279
11658
  },
11280
11659
  {
11281
- source: join7(
11660
+ source: join8(
11282
11661
  vscodeRoot,
11283
11662
  "extensions",
11284
11663
  "merge-conflict",
11285
11664
  "dist",
11286
11665
  "mergeConflictMain.js"
11287
11666
  ),
11288
- target: join7(
11667
+ target: join8(
11289
11668
  vscodeRoot,
11290
11669
  "extensions",
11291
11670
  "merge-conflict",
@@ -11296,14 +11675,14 @@ function ensureCodeServerBrowserExtensionAssets(runtime) {
11296
11675
  required: true
11297
11676
  },
11298
11677
  {
11299
- source: join7(
11678
+ source: join8(
11300
11679
  vscodeRoot,
11301
11680
  "extensions",
11302
11681
  "merge-conflict",
11303
11682
  "dist",
11304
11683
  "mergeConflictMain.js.map"
11305
11684
  ),
11306
- target: join7(
11685
+ target: join8(
11307
11686
  vscodeRoot,
11308
11687
  "extensions",
11309
11688
  "merge-conflict",
@@ -11329,10 +11708,10 @@ function ensureCodeServerBrowserExtensionAssets(runtime) {
11329
11708
  }
11330
11709
  function codeServerVscodeRoot(runtime) {
11331
11710
  const roots = uniquePaths([
11332
- join7(runtime.root, "lib", "vscode"),
11333
- join7(dirname4(dirname4(runtime.codeServerBin)), "lib", "vscode"),
11711
+ join8(runtime.root, "lib", "vscode"),
11712
+ join8(dirname4(dirname4(runtime.codeServerBin)), "lib", "vscode"),
11334
11713
  ...wrappedCodeServerBin(runtime.codeServerBin).map(
11335
- (codeServerBin) => join7(dirname4(dirname4(codeServerBin)), "lib", "vscode")
11714
+ (codeServerBin) => join8(dirname4(dirname4(codeServerBin)), "lib", "vscode")
11336
11715
  )
11337
11716
  ]);
11338
11717
  const rootWithRequiredAssets = roots.find(
@@ -11348,7 +11727,7 @@ function codeServerVscodeRoot(runtime) {
11348
11727
  }
11349
11728
  function wrappedCodeServerBin(codeServerBin) {
11350
11729
  try {
11351
- const script = readFileSync5(codeServerBin, "utf8");
11730
+ const script = readFileSync6(codeServerBin, "utf8");
11352
11731
  const match = script.match(
11353
11732
  /exec\s+(?:"([^"]+)"|'([^']+)'|([^\s]+))\s+"\$@"/u
11354
11733
  );
@@ -11360,8 +11739,8 @@ function wrappedCodeServerBin(codeServerBin) {
11360
11739
  }
11361
11740
  function codeServerBrowserAssetSources(vscodeRoot) {
11362
11741
  return [
11363
- join7(vscodeRoot, "extensions", "git-base", "dist", "extension.js"),
11364
- join7(
11742
+ join8(vscodeRoot, "extensions", "git-base", "dist", "extension.js"),
11743
+ join8(
11365
11744
  vscodeRoot,
11366
11745
  "extensions",
11367
11746
  "merge-conflict",
@@ -11440,10 +11819,10 @@ function prepareLinuxCodeServerLaunch(options) {
11440
11819
  options.cwd,
11441
11820
  "--setenv",
11442
11821
  "XDG_DATA_HOME",
11443
- join7(options.userDataDir, "data"),
11822
+ join8(options.userDataDir, "data"),
11444
11823
  "--setenv",
11445
11824
  "XDG_CONFIG_HOME",
11446
- join7(options.userDataDir, "config"),
11825
+ join8(options.userDataDir, "config"),
11447
11826
  ...readOnlyRoots.flatMap((path2) => ["--ro-bind-try", path2, path2]),
11448
11827
  "--bind",
11449
11828
  options.cwd,
@@ -11484,7 +11863,7 @@ function resolveCodeServerExecutable(command, envPath) {
11484
11863
  if (directory.trim() === "") {
11485
11864
  continue;
11486
11865
  }
11487
- const candidate = join7(directory, command);
11866
+ const candidate = join8(directory, command);
11488
11867
  if (!existsSync5(candidate)) {
11489
11868
  continue;
11490
11869
  }
@@ -11570,7 +11949,7 @@ async function startCollaborationSidecar(collaboration, profile, editorRuntime,
11570
11949
  ]);
11571
11950
  const command = nodeRuntimeExecutable();
11572
11951
  const args = [
11573
- join7(
11952
+ join8(
11574
11953
  profile.collaborationServerDir,
11575
11954
  "open-collaboration-server",
11576
11955
  "bundle",
@@ -11687,7 +12066,7 @@ function codeServerEnv(env, cwd, userDataDir, collaboration) {
11687
12066
  KANDAN_EDITOR_COLLABORATION_ENTRY_MODE: "kandan_auto_host_or_join",
11688
12067
  KANDAN_EDITOR_COLLABORATION_ROOM_ID: collaboration.roomId,
11689
12068
  KANDAN_EDITOR_COLLABORATION_SERVER_URL: collaboration.bootstrapServerUrl,
11690
- KANDAN_EDITOR_COLLABORATION_AUTO_HOST_CLAIM_PATH: join7(
12069
+ KANDAN_EDITOR_COLLABORATION_AUTO_HOST_CLAIM_PATH: join8(
11691
12070
  userDataDir,
11692
12071
  "kandan-oct-auto-host.lock"
11693
12072
  )
@@ -11898,13 +12277,13 @@ import {
11898
12277
  existsSync as existsSync6,
11899
12278
  mkdirSync as mkdirSync6,
11900
12279
  mkdtempSync as mkdtempSync2,
11901
- readFileSync as readFileSync6,
12280
+ readFileSync as readFileSync7,
11902
12281
  renameSync,
11903
12282
  rmSync as rmSync2,
11904
12283
  writeFileSync as writeFileSync5
11905
12284
  } from "node:fs";
11906
- import { homedir as homedir7 } from "node:os";
11907
- import { dirname as dirname5, join as join8, resolve as resolve6 } from "node:path";
12285
+ import { homedir as homedir8 } from "node:os";
12286
+ import { dirname as dirname5, join as join9, resolve as resolve6 } from "node:path";
11908
12287
  import { Readable } from "node:stream";
11909
12288
  import { pipeline } from "node:stream/promises";
11910
12289
  async function resolveEditorRuntime(options) {
@@ -12088,14 +12467,14 @@ function normalizeRuntimeAssets(value) {
12088
12467
  }
12089
12468
  function installedRuntime(cacheRoot, manifest) {
12090
12469
  const runtimeRoot = runtimeInstallRoot(cacheRoot, manifest);
12091
- const manifestPath = join8(runtimeRoot, manifest.manifestPath);
12092
- const codeServerBin = join8(runtimeRoot, manifest.codeServerBinPath);
12470
+ const manifestPath = join9(runtimeRoot, manifest.manifestPath);
12471
+ const codeServerBin = join9(runtimeRoot, manifest.codeServerBinPath);
12093
12472
  const assets = verifiedRuntimeAssetPaths(runtimeRoot, manifest);
12094
12473
  if (!existsSync6(manifestPath) || !existsSync6(codeServerBin) || assets === void 0) {
12095
12474
  return { ok: false };
12096
12475
  }
12097
12476
  try {
12098
- const installed = JSON.parse(readFileSync6(manifestPath, "utf8"));
12477
+ const installed = JSON.parse(readFileSync7(manifestPath, "utf8"));
12099
12478
  if (isJsonObject(installed) && installed.version === manifest.version && installed.platform === manifest.platform && (installed.archiveSha256 === void 0 || installed.archiveSha256 === manifest.archiveSha256)) {
12100
12479
  return {
12101
12480
  ok: true,
@@ -12114,9 +12493,9 @@ function installedRuntime(cacheRoot, manifest) {
12114
12493
  }
12115
12494
  async function installRuntime(args) {
12116
12495
  mkdirSync6(args.cacheRoot, { recursive: true });
12117
- const tempRoot = mkdtempSync2(join8(args.cacheRoot, ".install-"));
12118
- const archivePath = join8(tempRoot, "runtime.tar.gz");
12119
- const extractRoot = join8(tempRoot, "runtime");
12496
+ const tempRoot = mkdtempSync2(join9(args.cacheRoot, ".install-"));
12497
+ const archivePath = join9(tempRoot, "runtime.tar.gz");
12498
+ const extractRoot = join9(tempRoot, "runtime");
12120
12499
  try {
12121
12500
  const downloaded = await downloadArchive({
12122
12501
  kandanUrl: args.kandanUrl,
@@ -12141,8 +12520,8 @@ async function installRuntime(args) {
12141
12520
  if (!assetsInstalled) {
12142
12521
  return { ok: false, reason: "install_failed" };
12143
12522
  }
12144
- const manifestPath = join8(extractRoot, args.manifest.manifestPath);
12145
- const codeServerBin = join8(extractRoot, args.manifest.codeServerBinPath);
12523
+ const manifestPath = join9(extractRoot, args.manifest.manifestPath);
12524
+ const codeServerBin = join9(extractRoot, args.manifest.codeServerBinPath);
12146
12525
  const assets = verifiedRuntimeAssetPaths(extractRoot, args.manifest);
12147
12526
  if (!existsSync6(codeServerBin) || assets === void 0) {
12148
12527
  return { ok: false, reason: "invalid_archive" };
@@ -12173,21 +12552,21 @@ async function installRuntime(args) {
12173
12552
  runtime: {
12174
12553
  mode: "server_managed",
12175
12554
  root: targetRoot,
12176
- codeServerBin: join8(targetRoot, args.manifest.codeServerBinPath),
12555
+ codeServerBin: join9(targetRoot, args.manifest.codeServerBinPath),
12177
12556
  assets: {
12178
- collaborationExtensionTarball: join8(
12557
+ collaborationExtensionTarball: join9(
12179
12558
  targetRoot,
12180
12559
  "kandan",
12181
12560
  "editor_extensions",
12182
12561
  "typefox.open-collaboration-tools.tar.gz"
12183
12562
  ),
12184
- collaborationServerTarball: join8(
12563
+ collaborationServerTarball: join9(
12185
12564
  targetRoot,
12186
12565
  "kandan",
12187
12566
  "editor_servers",
12188
12567
  "open-collaboration-server.tar.gz"
12189
12568
  ),
12190
- documentStateExtensionDir: join8(
12569
+ documentStateExtensionDir: join9(
12191
12570
  targetRoot,
12192
12571
  "kandan",
12193
12572
  "editor_extensions",
@@ -12204,7 +12583,7 @@ async function installRuntime(args) {
12204
12583
  }
12205
12584
  async function materializeRuntimeAssets(args) {
12206
12585
  for (const asset of args.manifest.assets) {
12207
- const targetPath = join8(args.runtimeRoot, asset.path);
12586
+ const targetPath = join9(args.runtimeRoot, asset.path);
12208
12587
  try {
12209
12588
  const bytes = await runtimeAssetBytes({
12210
12589
  kandanUrl: args.kandanUrl,
@@ -12305,19 +12684,19 @@ function runtimeInstallRoot(cacheRoot, manifest) {
12305
12684
  return resolve6(cacheRoot, manifest.platform, manifest.archiveSha256);
12306
12685
  }
12307
12686
  function verifiedRuntimeAssetPaths(runtimeRoot, manifest) {
12308
- const collaborationExtensionTarball = join8(
12687
+ const collaborationExtensionTarball = join9(
12309
12688
  runtimeRoot,
12310
12689
  "kandan",
12311
12690
  "editor_extensions",
12312
12691
  "typefox.open-collaboration-tools.tar.gz"
12313
12692
  );
12314
- const collaborationServerTarball = join8(
12693
+ const collaborationServerTarball = join9(
12315
12694
  runtimeRoot,
12316
12695
  "kandan",
12317
12696
  "editor_servers",
12318
12697
  "open-collaboration-server.tar.gz"
12319
12698
  );
12320
- const documentStateExtensionDir = join8(
12699
+ const documentStateExtensionDir = join9(
12321
12700
  runtimeRoot,
12322
12701
  "kandan",
12323
12702
  "editor_extensions",
@@ -12326,7 +12705,7 @@ function verifiedRuntimeAssetPaths(runtimeRoot, manifest) {
12326
12705
  const codeServerRoot = codeServerRuntimeRoot(manifest.codeServerBinPath);
12327
12706
  const requiredPaths = [
12328
12707
  manifest.codeServerBinPath,
12329
- join8(
12708
+ join9(
12330
12709
  codeServerRoot,
12331
12710
  "lib",
12332
12711
  "vscode",
@@ -12336,7 +12715,7 @@ function verifiedRuntimeAssetPaths(runtimeRoot, manifest) {
12336
12715
  "web",
12337
12716
  "vsda.js"
12338
12717
  ),
12339
- join8(
12718
+ join9(
12340
12719
  codeServerRoot,
12341
12720
  "lib",
12342
12721
  "vscode",
@@ -12357,7 +12736,7 @@ function verifiedRuntimeAssetPaths(runtimeRoot, manifest) {
12357
12736
  if (expectedSha256 === void 0 && relativePath !== manifest.codeServerBinPath) {
12358
12737
  return void 0;
12359
12738
  }
12360
- const absolutePath = join8(runtimeRoot, relativePath);
12739
+ const absolutePath = join9(runtimeRoot, relativePath);
12361
12740
  if (!existsSync6(absolutePath)) {
12362
12741
  return void 0;
12363
12742
  }
@@ -12386,10 +12765,10 @@ function manifestAssetChecksums(assets) {
12386
12765
  return checksums;
12387
12766
  }
12388
12767
  function fileSha256Sync(path2) {
12389
- return createHash2("sha256").update(readFileSync6(path2)).digest("hex");
12768
+ return createHash2("sha256").update(readFileSync7(path2)).digest("hex");
12390
12769
  }
12391
12770
  function defaultEditorRuntimeCacheRoot() {
12392
- return join8(homedir7(), ".linzumi", "editor-runtimes");
12771
+ return join9(homedir8(), ".linzumi", "editor-runtimes");
12393
12772
  }
12394
12773
  function nonEmptyString(value) {
12395
12774
  return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
@@ -12409,7 +12788,7 @@ var init_localEditorRuntime = __esm({
12409
12788
 
12410
12789
  // src/dependencyStatus.ts
12411
12790
  import { spawn as spawn5, spawnSync as spawnSync3 } from "node:child_process";
12412
- import { delimiter as delimiter2, dirname as dirname6, join as join9 } from "node:path";
12791
+ import { delimiter as delimiter2, dirname as dirname6, join as join10 } from "node:path";
12413
12792
  function probeTool(command, cwd) {
12414
12793
  return new Promise((resolve11) => {
12415
12794
  const args = ["--version"];
@@ -12566,8 +12945,8 @@ function voltaCommandCandidates(args) {
12566
12945
  new Set(
12567
12946
  [
12568
12947
  voltaBinBesideCodexShim(args.codexBin),
12569
- env.VOLTA_HOME === void 0 ? void 0 : join9(env.VOLTA_HOME, "bin", "volta"),
12570
- env.HOME === void 0 ? void 0 : join9(env.HOME, ".volta", "bin", "volta"),
12948
+ env.VOLTA_HOME === void 0 ? void 0 : join10(env.VOLTA_HOME, "bin", "volta"),
12949
+ env.HOME === void 0 ? void 0 : join10(env.HOME, ".volta", "bin", "volta"),
12571
12950
  ...pathVoltaCandidates(env.PATH)
12572
12951
  ].filter((candidate) => candidate !== void 0)
12573
12952
  )
@@ -12575,10 +12954,10 @@ function voltaCommandCandidates(args) {
12575
12954
  }
12576
12955
  function voltaBinBesideCodexShim(codexBin) {
12577
12956
  const normalizedCodexBin = codexBin.replaceAll("\\", "/");
12578
- return normalizedCodexBin.endsWith("/.volta/bin/codex") ? join9(dirname6(codexBin), "volta") : void 0;
12957
+ return normalizedCodexBin.endsWith("/.volta/bin/codex") ? join10(dirname6(codexBin), "volta") : void 0;
12579
12958
  }
12580
12959
  function pathVoltaCandidates(pathValue) {
12581
- return pathValue === void 0 ? [] : pathValue.split(delimiter2).filter((entry) => entry !== "").map((entry) => join9(entry, "volta"));
12960
+ return pathValue === void 0 ? [] : pathValue.split(delimiter2).filter((entry) => entry !== "").map((entry) => join10(entry, "volta"));
12582
12961
  }
12583
12962
  function codeServerDependencyStatus(args) {
12584
12963
  switch (args.editorRuntime?.status) {
@@ -12972,7 +13351,7 @@ var linzumiCliVersion, linzumiCliVersionText;
12972
13351
  var init_version = __esm({
12973
13352
  "src/version.ts"() {
12974
13353
  "use strict";
12975
- linzumiCliVersion = "0.0.70-beta";
13354
+ linzumiCliVersion = "0.0.71-beta";
12976
13355
  linzumiCliVersionText = `linzumi ${linzumiCliVersion}`;
12977
13356
  }
12978
13357
  });
@@ -12983,14 +13362,14 @@ import {
12983
13362
  existsSync as existsSync7,
12984
13363
  mkdirSync as mkdirSync7,
12985
13364
  openSync as openSync2,
12986
- readFileSync as readFileSync7,
13365
+ readFileSync as readFileSync8,
12987
13366
  unlinkSync as unlinkSync2,
12988
13367
  writeSync
12989
13368
  } from "node:fs";
12990
- import { dirname as dirname7, join as join10 } from "node:path";
13369
+ import { dirname as dirname7, join as join11 } from "node:path";
12991
13370
  function runnerLockPath(machineId, configPath = localConfigPath(), linzumiUrl) {
12992
13371
  const lockName = linzumiUrl === void 0 ? encodeURIComponent(machineId) : localConfigScopeFileStem(linzumiUrl);
12993
- return join10(
13372
+ return join11(
12994
13373
  dirname7(configPath),
12995
13374
  "runners",
12996
13375
  `${lockName}.lock`
@@ -13145,7 +13524,7 @@ function withStaleReplacementLock(path2, isPidAlive, callback) {
13145
13524
  function readReplacementLockPidIfPresent(path2) {
13146
13525
  let value;
13147
13526
  try {
13148
- value = readFileSync7(path2, "utf8").trim();
13527
+ value = readFileSync8(path2, "utf8").trim();
13149
13528
  } catch (error) {
13150
13529
  if (isNodeErrorCode2(error, "ENOENT")) {
13151
13530
  return void 0;
@@ -13185,7 +13564,7 @@ function readRunnerLockIfPresent(path2) {
13185
13564
  }
13186
13565
  }
13187
13566
  function readRunnerLock(path2) {
13188
- const parsed = JSON.parse(readFileSync7(path2, "utf8"));
13567
+ const parsed = JSON.parse(readFileSync8(path2, "utf8"));
13189
13568
  if (!isRunnerLockRecord(parsed)) {
13190
13569
  throw new Error(`invalid Linzumi runner lock: ${path2}`);
13191
13570
  }
@@ -13400,18 +13779,18 @@ var init_runnerConsoleReporter = __esm({
13400
13779
  });
13401
13780
 
13402
13781
  // src/authCache.ts
13403
- import { existsSync as existsSync8, mkdirSync as mkdirSync8, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "node:fs";
13404
- import { homedir as homedir8 } from "node:os";
13405
- import { dirname as dirname8, join as join11 } from "node:path";
13782
+ import { existsSync as existsSync8, mkdirSync as mkdirSync8, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "node:fs";
13783
+ import { homedir as homedir9 } from "node:os";
13784
+ import { dirname as dirname8, join as join12 } from "node:path";
13406
13785
  function defaultAuthFilePath() {
13407
- const base = process.env.KANDAN_HOME ?? join11(homedir8(), ".kandan");
13408
- return join11(base, "auth.json");
13786
+ const base = process.env.KANDAN_HOME ?? join12(homedir9(), ".kandan");
13787
+ return join12(base, "auth.json");
13409
13788
  }
13410
13789
  function readCachedLocalRunnerToken(kandanUrl, authFilePath = defaultAuthFilePath()) {
13411
13790
  if (!existsSync8(authFilePath)) {
13412
13791
  return void 0;
13413
13792
  }
13414
- const authFile = parseAuthFile(readFileSync8(authFilePath, "utf8"));
13793
+ const authFile = parseAuthFile(readFileSync9(authFilePath, "utf8"));
13415
13794
  const kandanBaseUrl = kandanHttpBaseUrl(kandanUrl);
13416
13795
  const entry = authFile.local_codex_runner?.[kandanBaseUrl];
13417
13796
  if (entry === void 0 || entry.access_token.trim() === "") {
@@ -13433,7 +13812,7 @@ function readPersonalAgentDelegationToken(authFilePath) {
13433
13812
  `missing personal-agent delegation auth file: ${authFilePath}`
13434
13813
  );
13435
13814
  }
13436
- const authFile = parseAuthFile(readFileSync8(authFilePath, "utf8"));
13815
+ const authFile = parseAuthFile(readFileSync9(authFilePath, "utf8"));
13437
13816
  const entry = authFile.personal_agent_delegation;
13438
13817
  if (entry === void 0 || entry.access_token.trim() === "") {
13439
13818
  throw new Error(
@@ -13451,7 +13830,7 @@ function readPersonalAgentDelegationToken(authFilePath) {
13451
13830
  }
13452
13831
  function writeCachedLocalRunnerToken(args) {
13453
13832
  const authFilePath = args.authFilePath ?? defaultAuthFilePath();
13454
- const existing = existsSync8(authFilePath) ? parseAuthFile(readFileSync8(authFilePath, "utf8")) : { version: 1 };
13833
+ const existing = existsSync8(authFilePath) ? parseAuthFile(readFileSync9(authFilePath, "utf8")) : { version: 1 };
13455
13834
  const kandanBaseUrl = kandanHttpBaseUrl(args.kandanUrl);
13456
13835
  const issuedAt = /* @__PURE__ */ new Date();
13457
13836
  const expiresAt = args.expiresInSeconds === void 0 ? void 0 : new Date(
@@ -13888,9 +14267,9 @@ var init_threadCodexWorkerIpc = __esm({
13888
14267
 
13889
14268
  // src/signupTaskSuggestions.ts
13890
14269
  import { spawn as spawn6 } from "node:child_process";
13891
- import { mkdtempSync as mkdtempSync3, readFileSync as readFileSync9, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "node:fs";
14270
+ import { mkdtempSync as mkdtempSync3, readFileSync as readFileSync10, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "node:fs";
13892
14271
  import { tmpdir as tmpdir2 } from "node:os";
13893
- import { join as join12 } from "node:path";
14272
+ import { join as join13 } from "node:path";
13894
14273
  async function suggestSignupTasksWithCodex(args) {
13895
14274
  const attempts = 2;
13896
14275
  let previousResponse;
@@ -13912,9 +14291,9 @@ async function suggestSignupTasksWithCodex(args) {
13912
14291
  );
13913
14292
  }
13914
14293
  async function runCodexTaskSuggestion(args) {
13915
- const tempRoot = mkdtempSync3(join12(tmpdir2(), "linzumi-signup-codex-tasks-"));
13916
- const schemaPath = join12(tempRoot, "task-suggestions.schema.json");
13917
- const outputPath = join12(tempRoot, "task-suggestions.json");
14294
+ const tempRoot = mkdtempSync3(join13(tmpdir2(), "linzumi-signup-codex-tasks-"));
14295
+ const schemaPath = join13(tempRoot, "task-suggestions.schema.json");
14296
+ const outputPath = join13(tempRoot, "task-suggestions.json");
13918
14297
  const prompt = taskSuggestionPrompt(args.previousResponse);
13919
14298
  writeFileSync7(
13920
14299
  schemaPath,
@@ -13933,7 +14312,7 @@ async function runCodexTaskSuggestion(args) {
13933
14312
  prompt
13934
14313
  })
13935
14314
  );
13936
- return readFileSync9(outputPath, "utf8");
14315
+ return readFileSync10(outputPath, "utf8");
13937
14316
  } finally {
13938
14317
  rmSync3(tempRoot, { recursive: true, force: true });
13939
14318
  }
@@ -14101,14 +14480,14 @@ import {
14101
14480
  lstatSync,
14102
14481
  mkdirSync as mkdirSync9,
14103
14482
  mkdtempSync as mkdtempSync4,
14104
- readdirSync,
14483
+ readdirSync as readdirSync2,
14105
14484
  realpathSync as realpathSync5,
14106
14485
  rmSync as rmSync4,
14107
14486
  statSync
14108
14487
  } from "node:fs";
14109
14488
  import { createServer as createServer3 } from "node:http";
14110
- import { homedir as homedir9, hostname as hostname2, tmpdir as tmpdir3 } from "node:os";
14111
- import { dirname as dirname9, join as join13, resolve as resolve7 } from "node:path";
14489
+ import { homedir as homedir10, hostname as hostname2, tmpdir as tmpdir3 } from "node:os";
14490
+ import { dirname as dirname9, join as join14, resolve as resolve7 } from "node:path";
14112
14491
  async function runLocalCodexRunner(options) {
14113
14492
  const log = makeRunnerLogger(options);
14114
14493
  const cleanup = {
@@ -18639,9 +19018,9 @@ function mcpOwnerUsername(options) {
18639
19018
  return options.channelSession?.listenUser ?? identityFromAccessToken(options.token).actorUsername;
18640
19019
  }
18641
19020
  function writeEphemeralMcpAuthFile(options) {
18642
- const directory = mkdtempSync4(join13(tmpdir3(), "linzumi-mcp-auth-"));
19021
+ const directory = mkdtempSync4(join14(tmpdir3(), "linzumi-mcp-auth-"));
18643
19022
  chmodSync2(directory, 448);
18644
- const path2 = join13(directory, "auth.json");
19023
+ const path2 = join14(directory, "auth.json");
18645
19024
  writeCachedLocalRunnerToken({
18646
19025
  kandanUrl: options.kandanUrl,
18647
19026
  accessToken: options.token,
@@ -18754,7 +19133,7 @@ function allowedCwdProjects(allowedCwds) {
18754
19133
  });
18755
19134
  }
18756
19135
  function isGitProjectDirectory(cwd) {
18757
- const gitPath = join13(cwd, ".git");
19136
+ const gitPath = join14(cwd, ".git");
18758
19137
  try {
18759
19138
  const gitPathStats = statSync(gitPath);
18760
19139
  return gitPathStats.isDirectory() || gitPathStats.isFile();
@@ -18764,7 +19143,7 @@ function isGitProjectDirectory(cwd) {
18764
19143
  }
18765
19144
  function browseRunnerDirectory(control, options) {
18766
19145
  const requestId = stringValue(control.requestId) ?? null;
18767
- const requestedPath = stringValue(control.path) ?? homedir9();
19146
+ const requestedPath = stringValue(control.path) ?? homedir10();
18768
19147
  try {
18769
19148
  const currentPath = realpathSync5(resolve7(expandUserPath(requestedPath)));
18770
19149
  const stats = statSync(currentPath);
@@ -18778,8 +19157,8 @@ function browseRunnerDirectory(control, options) {
18778
19157
  };
18779
19158
  }
18780
19159
  const parent = dirname9(currentPath);
18781
- const entries = readdirSync(currentPath, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => visibleRunnerDirectoryEntryName(entry.name)).map((entry) => {
18782
- const path2 = join13(currentPath, entry.name);
19160
+ const entries = readdirSync2(currentPath, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => visibleRunnerDirectoryEntryName(entry.name)).map((entry) => {
19161
+ const path2 = join14(currentPath, entry.name);
18783
19162
  return {
18784
19163
  name: entry.name,
18785
19164
  path: path2,
@@ -18795,7 +19174,7 @@ function browseRunnerDirectory(control, options) {
18795
19174
  ok: true,
18796
19175
  currentPath,
18797
19176
  parentPath: parent === currentPath ? null : parent,
18798
- homePath: homedir9(),
19177
+ homePath: homedir10(),
18799
19178
  runnerCwd: resolve7(options.cwd),
18800
19179
  entries,
18801
19180
  isGit: isGitProjectDirectory(currentPath)
@@ -18820,7 +19199,7 @@ function projectDirectoryName(name) {
18820
19199
  function availableProjectDirectoryName(projectsRoot, baseName, suffix = 0) {
18821
19200
  for (let nextSuffix = suffix; ; nextSuffix += 1) {
18822
19201
  const candidate = nextSuffix === 0 ? baseName : `${baseName}-${nextSuffix}`;
18823
- if (!projectPathExists(join13(projectsRoot, candidate))) {
19202
+ if (!projectPathExists(join14(projectsRoot, candidate))) {
18824
19203
  return candidate;
18825
19204
  }
18826
19205
  }
@@ -18848,9 +19227,9 @@ function createRunnerProject(control, options, allowedCwds) {
18848
19227
  error: "invalid_project_template"
18849
19228
  };
18850
19229
  }
18851
- const projectsRoot = join13(homedir9(), "linzumi");
19230
+ const projectsRoot = join14(homedir10(), "linzumi");
18852
19231
  const resolvedProjectDirName = template === "hello_linzumi_demo" ? availableProjectDirectoryName(projectsRoot, projectDirName) : projectDirName;
18853
- const projectPath = join13(projectsRoot, resolvedProjectDirName);
19232
+ const projectPath = join14(projectsRoot, resolvedProjectDirName);
18854
19233
  let createdProjectPath = false;
18855
19234
  try {
18856
19235
  if (template !== "hello_linzumi_demo" && projectPathExists(projectPath)) {
@@ -19026,7 +19405,7 @@ var init_runner = __esm({
19026
19405
  });
19027
19406
 
19028
19407
  // src/kandanTls.ts
19029
- import { existsSync as existsSync9, readFileSync as readFileSync10 } from "node:fs";
19408
+ import { existsSync as existsSync9, readFileSync as readFileSync11 } from "node:fs";
19030
19409
  import { Agent } from "undici";
19031
19410
  import { WebSocket as WsWebSocket } from "ws";
19032
19411
  function kandanTlsTrustFromEnv() {
@@ -19040,7 +19419,7 @@ function kandanTlsTrustFromCaFile(caFile) {
19040
19419
  if (!existsSync9(trimmed)) {
19041
19420
  throw new Error(`KANDAN_TLS_CA_FILE does not exist: ${trimmed}`);
19042
19421
  }
19043
- const ca = readFileSync10(trimmed, "utf8");
19422
+ const ca = readFileSync11(trimmed, "utf8");
19044
19423
  return {
19045
19424
  caFile: trimmed,
19046
19425
  ca,
@@ -37821,7 +38200,7 @@ var init_RemoveFileError = __esm({
37821
38200
 
37822
38201
  // ../../node_modules/@inquirer/external-editor/dist/esm/index.js
37823
38202
  import { spawn as spawn9, spawnSync as spawnSync5 } from "child_process";
37824
- import { readFileSync as readFileSync13, unlinkSync as unlinkSync3, writeFileSync as writeFileSync10 } from "fs";
38203
+ import { readFileSync as readFileSync14, unlinkSync as unlinkSync3, writeFileSync as writeFileSync10 } from "fs";
37825
38204
  import path from "node:path";
37826
38205
  import os from "node:os";
37827
38206
  import { randomUUID as randomUUID4 } from "node:crypto";
@@ -37945,7 +38324,7 @@ var init_esm5 = __esm({
37945
38324
  }
37946
38325
  readTemporaryFile() {
37947
38326
  try {
37948
- const tempFileBuffer = readFileSync13(this.tempFile);
38327
+ const tempFileBuffer = readFileSync14(this.tempFile);
37949
38328
  if (tempFileBuffer.length === 0) {
37950
38329
  this.text = "";
37951
38330
  } else {
@@ -39315,15 +39694,15 @@ import {
39315
39694
  constants as fsConstants,
39316
39695
  mkdirSync as mkdirSync12,
39317
39696
  mkdtempSync as mkdtempSync5,
39318
- readFileSync as readFileSync14,
39319
- readdirSync as readdirSync2,
39697
+ readFileSync as readFileSync15,
39698
+ readdirSync as readdirSync3,
39320
39699
  rmSync as rmSync5,
39321
39700
  statSync as statSync2,
39322
39701
  writeFileSync as writeFileSync11
39323
39702
  } from "node:fs";
39324
39703
  import { access } from "node:fs/promises";
39325
- import { homedir as homedir12, tmpdir as tmpdir4 } from "node:os";
39326
- import { delimiter as delimiter3, dirname as dirname12, join as join16, resolve as resolve9 } from "node:path";
39704
+ import { homedir as homedir13, tmpdir as tmpdir4 } from "node:os";
39705
+ import { delimiter as delimiter3, dirname as dirname12, join as join17, resolve as resolve9 } from "node:path";
39327
39706
  import { stdin as defaultStdin, stdout as defaultStdout } from "node:process";
39328
39707
  import { emitKeypressEvents } from "node:readline";
39329
39708
  function signupHelpText() {
@@ -39427,7 +39806,7 @@ function defaultSignupDraftStore(serviceUrl) {
39427
39806
  }
39428
39807
  let parsed;
39429
39808
  try {
39430
- parsed = JSON.parse(readFileSync14(path2, "utf8"));
39809
+ parsed = JSON.parse(readFileSync15(path2, "utf8"));
39431
39810
  } catch (_error) {
39432
39811
  return void 0;
39433
39812
  }
@@ -39450,7 +39829,7 @@ function defaultSignupDraftStore(serviceUrl) {
39450
39829
  };
39451
39830
  }
39452
39831
  function defaultSignupDraftPath(serviceUrl) {
39453
- return join16(
39832
+ return join17(
39454
39833
  dirname12(localConfigPath()),
39455
39834
  `signup-draft.${localConfigScopeFileStem(serviceUrl)}.json`
39456
39835
  );
@@ -39495,7 +39874,7 @@ function defaultSignupTaskCacheStore(serviceUrl) {
39495
39874
  };
39496
39875
  }
39497
39876
  function defaultSignupTaskCachePath(serviceUrl) {
39498
- return join16(
39877
+ return join17(
39499
39878
  dirname12(localConfigPath()),
39500
39879
  `signup-task-cache.${localConfigScopeFileStem(serviceUrl)}.json`
39501
39880
  );
@@ -39506,7 +39885,7 @@ function readSignupTaskCache(path2) {
39506
39885
  }
39507
39886
  let parsed;
39508
39887
  try {
39509
- parsed = JSON.parse(readFileSync14(path2, "utf8"));
39888
+ parsed = JSON.parse(readFileSync15(path2, "utf8"));
39510
39889
  } catch (_error) {
39511
39890
  return { version: 1, entries: {} };
39512
39891
  }
@@ -41379,7 +41758,7 @@ function autocompletePathSuggestions(pathInput) {
41379
41758
  try {
41380
41759
  const showHidden = prefix.startsWith(".");
41381
41760
  const currentPath = directoryExists(normalizedInput) ? [normalizedInput.replace(/\/$/, "") || "/"] : [];
41382
- const childPaths = readdirSync2(directoryPath, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => showHidden || !entry.name.startsWith(".")).map((entry) => join16(directoryPath, entry.name)).map((path2) => ({
41761
+ const childPaths = readdirSync3(directoryPath, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => showHidden || !entry.name.startsWith(".")).map((entry) => join17(directoryPath, entry.name)).map((path2) => ({
41383
41762
  path: path2,
41384
41763
  score: fuzzyPathSegmentScore(path2.split("/").at(-1) ?? path2, prefix)
41385
41764
  })).filter((candidate) => candidate.score !== void 0).sort((left, right) => {
@@ -41625,7 +42004,7 @@ async function runSignupPreflights(runtime) {
41625
42004
  function defaultPreflightRuntime() {
41626
42005
  return {
41627
42006
  cwd: process.cwd(),
41628
- homeDir: homedir12(),
42007
+ homeDir: homedir13(),
41629
42008
  probeTool,
41630
42009
  readGitEmail,
41631
42010
  discoverCodeRoots,
@@ -41770,9 +42149,9 @@ async function suggestTasksWithCodex(projectPath, retryPolicy) {
41770
42149
  );
41771
42150
  }
41772
42151
  async function runCodexTaskSuggestion2(projectPath, previousResponse, retryPolicy) {
41773
- const tempRoot = mkdtempSync5(join16(tmpdir4(), "linzumi-signup-codex-tasks-"));
41774
- const schemaPath = join16(tempRoot, "task-suggestions.schema.json");
41775
- const outputPath = join16(tempRoot, "task-suggestions.json");
42152
+ const tempRoot = mkdtempSync5(join17(tmpdir4(), "linzumi-signup-codex-tasks-"));
42153
+ const schemaPath = join17(tempRoot, "task-suggestions.schema.json");
42154
+ const outputPath = join17(tempRoot, "task-suggestions.json");
41776
42155
  const model = process.env.LINZUMI_SIGNUP_TASK_MODEL ?? "gpt-5.4-mini";
41777
42156
  const prompt = taskSuggestionPrompt2(previousResponse);
41778
42157
  const codexCommand = await resolveSignupCodexCommand();
@@ -41797,7 +42176,7 @@ async function runCodexTaskSuggestion2(projectPath, previousResponse, retryPolic
41797
42176
  ),
41798
42177
  retryPolicy
41799
42178
  );
41800
- return readFileSync14(outputPath, "utf8");
42179
+ return readFileSync15(outputPath, "utf8");
41801
42180
  } finally {
41802
42181
  rmSync5(tempRoot, { recursive: true, force: true });
41803
42182
  }
@@ -41834,7 +42213,7 @@ function codexTaskSuggestionProcess2(args) {
41834
42213
  function signupCodexTaskSuggestionProcessForTest(args) {
41835
42214
  return codexTaskSuggestionProcess2(args);
41836
42215
  }
41837
- async function resolveSignupCodexCommand(env = process.env, homeDir = homedir12(), executableExists = fileIsExecutable) {
42216
+ async function resolveSignupCodexCommand(env = process.env, homeDir = homedir13(), executableExists = fileIsExecutable) {
41838
42217
  const override = firstConfiguredValue([
41839
42218
  env.LINZUMI_SIGNUP_CODEX_BIN,
41840
42219
  env.LINZUMI_CODEX_BIN
@@ -41889,7 +42268,7 @@ function resolveHomePath(path2, homeDir) {
41889
42268
  return homeDir;
41890
42269
  }
41891
42270
  if (path2.startsWith("~/")) {
41892
- return join16(homeDir, path2.slice(2));
42271
+ return join17(homeDir, path2.slice(2));
41893
42272
  }
41894
42273
  return resolve9(path2);
41895
42274
  }
@@ -41902,9 +42281,9 @@ function commandLooksPathLike(command) {
41902
42281
  }
41903
42282
  function homeManagedCodexCandidates(homeDir) {
41904
42283
  return [
41905
- join16(homeDir, ".volta", "bin", "codex"),
41906
- join16(homeDir, ".local", "bin", "codex"),
41907
- join16(homeDir, "bin", "codex")
42284
+ join17(homeDir, ".volta", "bin", "codex"),
42285
+ join17(homeDir, ".local", "bin", "codex"),
42286
+ join17(homeDir, "bin", "codex")
41908
42287
  ];
41909
42288
  }
41910
42289
  async function firstExecutablePath(paths, executableExists) {
@@ -41919,7 +42298,7 @@ function commandPathCandidates(path2) {
41919
42298
  if (path2 === void 0 || path2.trim() === "") {
41920
42299
  return [];
41921
42300
  }
41922
- return path2.split(delimiter3).filter((entry) => entry.trim() !== "").map((entry) => join16(entry, "codex"));
42301
+ return path2.split(delimiter3).filter((entry) => entry.trim() !== "").map((entry) => join17(entry, "codex"));
41923
42302
  }
41924
42303
  async function fileIsExecutable(path2) {
41925
42304
  try {
@@ -42144,11 +42523,11 @@ function codexPreflightLocation(command, homeDir) {
42144
42523
  switch (command) {
42145
42524
  case "codex":
42146
42525
  return "on PATH";
42147
- case join16(homeDir, ".volta", "bin", "codex"):
42526
+ case join17(homeDir, ".volta", "bin", "codex"):
42148
42527
  return "via Volta";
42149
- case join16(homeDir, ".local", "bin", "codex"):
42528
+ case join17(homeDir, ".local", "bin", "codex"):
42150
42529
  return "via ~/.local/bin";
42151
- case join16(homeDir, "bin", "codex"):
42530
+ case join17(homeDir, "bin", "codex"):
42152
42531
  return "via ~/bin";
42153
42532
  default:
42154
42533
  return "from configured path";
@@ -42303,13 +42682,13 @@ function probeToolWithArgs(command, args, cwd) {
42303
42682
  }
42304
42683
  async function discoverCodeRoots(homeDir) {
42305
42684
  const candidates = ["src", "code", "projects"].map(
42306
- (name) => join16(homeDir, name)
42685
+ (name) => join17(homeDir, name)
42307
42686
  );
42308
42687
  return candidates.filter((path2) => existsSync12(path2)).flatMap((path2) => discoveredProjectNames(path2));
42309
42688
  }
42310
42689
  function discoveredProjectNames(root) {
42311
42690
  try {
42312
- return readdirSync2(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).slice(0, 3).map((entry) => `~/${root.split("/").at(-1)}/${entry.name}`);
42691
+ return readdirSync3(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).slice(0, 3).map((entry) => `~/${root.split("/").at(-1)}/${entry.name}`);
42313
42692
  } catch {
42314
42693
  return [];
42315
42694
  }
@@ -42357,7 +42736,7 @@ function discoverProjectsFromCurrentDirectory(cwd) {
42357
42736
  }
42358
42737
  function discoverProjectsFromGuessedRoots(homeDir) {
42359
42738
  const guessedRoots = ["src", "code", "projects"].map(
42360
- (name) => join16(homeDir, name)
42739
+ (name) => join17(homeDir, name)
42361
42740
  );
42362
42741
  const projects = guessedRoots.flatMap(
42363
42742
  (root) => discoverProjectsUnderRoot(root)
@@ -42409,25 +42788,25 @@ function looksLikeProject(path2) {
42409
42788
  "pnpm-lock.yaml",
42410
42789
  "yarn.lock",
42411
42790
  "package-lock.json"
42412
- ].some((name) => existsSync12(join16(path2, name)));
42791
+ ].some((name) => existsSync12(join17(path2, name)));
42413
42792
  }
42414
42793
  function detectProjectLanguage(path2) {
42415
- if (existsSync12(join16(path2, "pyproject.toml")) || existsSync12(join16(path2, "requirements.txt"))) {
42794
+ if (existsSync12(join17(path2, "pyproject.toml")) || existsSync12(join17(path2, "requirements.txt"))) {
42416
42795
  return "Python";
42417
42796
  }
42418
- if (existsSync12(join16(path2, "Cargo.toml"))) {
42797
+ if (existsSync12(join17(path2, "Cargo.toml"))) {
42419
42798
  return "Rust";
42420
42799
  }
42421
- if (existsSync12(join16(path2, "go.mod"))) {
42800
+ if (existsSync12(join17(path2, "go.mod"))) {
42422
42801
  return "Go";
42423
42802
  }
42424
- if (existsSync12(join16(path2, "mix.exs"))) {
42803
+ if (existsSync12(join17(path2, "mix.exs"))) {
42425
42804
  return "Elixir";
42426
42805
  }
42427
- if (existsSync12(join16(path2, "tsconfig.json")) || packageJsonMentionsTypeScript(path2)) {
42806
+ if (existsSync12(join17(path2, "tsconfig.json")) || packageJsonMentionsTypeScript(path2)) {
42428
42807
  return "TypeScript";
42429
42808
  }
42430
- if (existsSync12(join16(path2, "package.json"))) {
42809
+ if (existsSync12(join17(path2, "package.json"))) {
42431
42810
  return "JavaScript";
42432
42811
  }
42433
42812
  return "Project";
@@ -42435,7 +42814,7 @@ function detectProjectLanguage(path2) {
42435
42814
  function packageJsonMentionsTypeScript(path2) {
42436
42815
  try {
42437
42816
  const packageJson2 = JSON.parse(
42438
- readFileSync14(join16(path2, "package.json"), "utf8")
42817
+ readFileSync15(join17(path2, "package.json"), "utf8")
42439
42818
  );
42440
42819
  return packageJson2.dependencies?.typescript !== void 0 || packageJson2.devDependencies?.typescript !== void 0;
42441
42820
  } catch {
@@ -42443,11 +42822,11 @@ function packageJsonMentionsTypeScript(path2) {
42443
42822
  }
42444
42823
  }
42445
42824
  function hasGitMetadata(path2) {
42446
- return existsSync12(join16(path2, ".git"));
42825
+ return existsSync12(join17(path2, ".git"));
42447
42826
  }
42448
42827
  function childDirectories(root) {
42449
42828
  try {
42450
- return readdirSync2(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join16(root, entry.name));
42829
+ return readdirSync3(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => join17(root, entry.name));
42451
42830
  } catch {
42452
42831
  return [];
42453
42832
  }
@@ -42473,10 +42852,10 @@ function directoryExists(path2) {
42473
42852
  }
42474
42853
  function expandHomePath(path2) {
42475
42854
  if (path2 === "~") {
42476
- return homedir12();
42855
+ return homedir13();
42477
42856
  }
42478
42857
  if (path2.startsWith("~/")) {
42479
- return join16(homedir12(), path2.slice(2));
42858
+ return join17(homedir13(), path2.slice(2));
42480
42859
  }
42481
42860
  return resolve9(path2);
42482
42861
  }
@@ -42564,8 +42943,8 @@ secure mission control for all your agents on your computers
42564
42943
  init_runner();
42565
42944
  init_claudeCodeSession();
42566
42945
  init_authCache();
42567
- import { existsSync as existsSync13, readFileSync as readFileSync15, realpathSync as realpathSync6 } from "node:fs";
42568
- import { homedir as homedir13 } from "node:os";
42946
+ import { existsSync as existsSync13, readFileSync as readFileSync16, realpathSync as realpathSync6 } from "node:fs";
42947
+ import { homedir as homedir14 } from "node:os";
42569
42948
  import { resolve as resolve10 } from "node:path";
42570
42949
  import { fileURLToPath as fileURLToPath4 } from "node:url";
42571
42950
 
@@ -42626,9 +43005,9 @@ init_kandanTls();
42626
43005
  init_protocol();
42627
43006
  init_json();
42628
43007
  init_defaultUrls();
42629
- import { existsSync as existsSync10, mkdirSync as mkdirSync10, readFileSync as readFileSync11, writeFileSync as writeFileSync8 } from "node:fs";
42630
- import { dirname as dirname10, join as join14 } from "node:path";
42631
- import { homedir as homedir10 } from "node:os";
43008
+ import { existsSync as existsSync10, mkdirSync as mkdirSync10, readFileSync as readFileSync12, writeFileSync as writeFileSync8 } from "node:fs";
43009
+ import { dirname as dirname10, join as join15 } from "node:path";
43010
+ import { homedir as homedir11 } from "node:os";
42632
43011
  async function runAgentCliCommand(args, deps = {
42633
43012
  fetchImpl: fetch,
42634
43013
  stdout: process.stdout,
@@ -43273,7 +43652,7 @@ async function postJson(apiUrl, path2, body, token, fetchImpl) {
43273
43652
  async function fetchJson(url, init, fetchImpl) {
43274
43653
  const response = await fetchImpl(url, init);
43275
43654
  const text2 = await response.text();
43276
- const payload = parseJsonObject(text2);
43655
+ const payload = parseJsonObject2(text2);
43277
43656
  if (!response.ok) {
43278
43657
  const error = objectValue(payload.error);
43279
43658
  const code = stringValue(error?.code) ?? `http_${response.status}`;
@@ -43282,7 +43661,7 @@ async function fetchJson(url, init, fetchImpl) {
43282
43661
  }
43283
43662
  return payload;
43284
43663
  }
43285
- function parseJsonObject(text2) {
43664
+ function parseJsonObject2(text2) {
43286
43665
  try {
43287
43666
  const parsed = JSON.parse(text2);
43288
43667
  if (isJsonObject(parsed)) {
@@ -43336,7 +43715,7 @@ function agentTokenFile(flags) {
43336
43715
  return flags.get("agent-token-file") ?? defaultAgentTokenFilePath();
43337
43716
  }
43338
43717
  function defaultAgentTokenFilePath() {
43339
- return join14(homedir10(), ".linzumi", "agent-token.json");
43718
+ return join15(homedir11(), ".linzumi", "agent-token.json");
43340
43719
  }
43341
43720
  function normalizedApiUrl(apiUrl) {
43342
43721
  return apiUrl.endsWith("/") ? apiUrl : `${apiUrl}/`;
@@ -43345,7 +43724,7 @@ function authorizationHeaders(token) {
43345
43724
  return { authorization: `Bearer ${token}` };
43346
43725
  }
43347
43726
  function readOptionalTextFile(path2) {
43348
- return existsSync10(path2) ? readFileSync11(path2, "utf8") : void 0;
43727
+ return existsSync10(path2) ? readFileSync12(path2, "utf8") : void 0;
43349
43728
  }
43350
43729
  function writeTextFile(path2, content) {
43351
43730
  mkdirSync10(dirname10(path2), { recursive: true });
@@ -43356,7 +43735,7 @@ function readStoredAgentTokenFile(path2, readTextFile = readOptionalTextFile) {
43356
43735
  if (content === void 0) {
43357
43736
  throw new Error(`missing agent token file: ${path2}`);
43358
43737
  }
43359
- const parsed = parseJsonObject(content);
43738
+ const parsed = parseJsonObject2(content);
43360
43739
  const cursorsValue = objectValue(parsed.cursors);
43361
43740
  const cursors = cursorsValue === void 0 ? {} : Object.fromEntries(
43362
43741
  Object.entries(cursorsValue).flatMap(([key, value]) => {
@@ -43440,23 +43819,23 @@ import {
43440
43819
  closeSync as closeSync2,
43441
43820
  mkdirSync as mkdirSync11,
43442
43821
  openSync as openSync3,
43443
- readFileSync as readFileSync12,
43822
+ readFileSync as readFileSync13,
43444
43823
  watch,
43445
43824
  writeFileSync as writeFileSync9
43446
43825
  } from "node:fs";
43447
- import { homedir as homedir11 } from "node:os";
43448
- import { dirname as dirname11, join as join15, resolve as resolve8 } from "node:path";
43826
+ import { homedir as homedir12 } from "node:os";
43827
+ import { dirname as dirname11, join as join16, resolve as resolve8 } from "node:path";
43449
43828
  import { execFileSync, spawn as spawn8 } from "node:child_process";
43450
43829
  import { fileURLToPath as fileURLToPath3 } from "node:url";
43451
43830
  var connectedMarkers = ["Connected to Linzumi", "Runner connected:"];
43452
43831
  function commanderStatusDir() {
43453
- return join15(homedir11(), ".linzumi", "commanders");
43832
+ return join16(homedir12(), ".linzumi", "commanders");
43454
43833
  }
43455
43834
  function commanderStatusFile(runnerId, statusDir = commanderStatusDir()) {
43456
- return join15(statusDir, `${safeRunnerId(runnerId)}.json`);
43835
+ return join16(statusDir, `${safeRunnerId(runnerId)}.json`);
43457
43836
  }
43458
43837
  function defaultCommanderLogFile(runnerId, statusDir = commanderStatusDir()) {
43459
- return join15(statusDir, `${safeRunnerId(runnerId)}.log`);
43838
+ return join16(statusDir, `${safeRunnerId(runnerId)}.log`);
43460
43839
  }
43461
43840
  function commanderLogIsConnected(log) {
43462
43841
  return connectedMarkers.some((marker) => log.includes(marker));
@@ -43533,12 +43912,12 @@ function commanderDaemonStatus(runnerId, statusDir = commanderStatusDir(), proce
43533
43912
  if (!existsSync11(statusFile)) {
43534
43913
  return { status: "missing", runnerId, statusFile };
43535
43914
  }
43536
- const record = parseRecord(readFileSync12(statusFile, "utf8"));
43915
+ const record = parseRecord(readFileSync13(statusFile, "utf8"));
43537
43916
  return processIsRunning(record.pid) && processMatchesRecord(record, processIdentityReader) ? { status: "running", record } : { status: "stopped", record };
43538
43917
  }
43539
43918
  async function waitForCommanderDaemon(options) {
43540
43919
  const now = options.now ?? (() => Date.now());
43541
- const readTextFile = options.readTextFile ?? ((path2) => existsSync11(path2) ? readFileSync12(path2, "utf8") : void 0);
43920
+ const readTextFile = options.readTextFile ?? ((path2) => existsSync11(path2) ? readFileSync13(path2, "utf8") : void 0);
43542
43921
  const statusImpl = options.statusImpl ?? commanderDaemonStatus;
43543
43922
  const deadline = now() + options.timeoutMs;
43544
43923
  while (now() <= deadline) {
@@ -56648,7 +57027,7 @@ async function parseAgentRunnerArgs(args, deps = {
56648
57027
  };
56649
57028
  }
56650
57029
  function readAgentTokenTextFile(path2) {
56651
- return existsSync13(path2) ? readFileSync15(path2, "utf8") : void 0;
57030
+ return existsSync13(path2) ? readFileSync16(path2, "utf8") : void 0;
56652
57031
  }
56653
57032
  function rejectAgentRunnerTargetingFlags(values) {
56654
57033
  const unsupportedFlags = [
@@ -56942,10 +57321,10 @@ function rejectStartTargetingFlags(values) {
56942
57321
  }
56943
57322
  function resolveUserPath(pathValue) {
56944
57323
  if (pathValue === "~") {
56945
- return homedir13();
57324
+ return homedir14();
56946
57325
  }
56947
57326
  if (pathValue.startsWith("~/")) {
56948
- return resolve10(homedir13(), pathValue.slice(2));
57327
+ return resolve10(homedir14(), pathValue.slice(2));
56949
57328
  }
56950
57329
  return resolve10(pathValue);
56951
57330
  }