nolo-cli 0.164.0-alpha.2 → 0.164.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/{_executeModel-LFPW52TC.js → _executeModel-M5PGAD3Z.js} +12 -12
  2. package/{agentDeleteCommand-IMM5JJOZ.js → agentDeleteCommand-E3FXV4KL.js} +10 -10
  3. package/{agentEmailCommands-7ILQ4X4X.js → agentEmailCommands-7TEXFJMP.js} +12 -12
  4. package/{agentMachineCommands-2EOGVRMN.js → agentMachineCommands-HCMAADXH.js} +1 -1
  5. package/{agentRecordCommands-5ECAWMGW.js → agentRecordCommands-S4XDFB4H.js} +11 -11
  6. package/{agentRunCommand-DE4WN2TT.js → agentRunCommand-SENMZRW7.js} +12 -12
  7. package/{agentRunControl-NQR3GB6H.js → agentRunControl-QWFFIAQY.js} +3 -1
  8. package/{agentSlice-YDRAYF3Z.js → agentSlice-JOVX3KY3.js} +1 -1
  9. package/{chunk-FKBWA3NN.js → chunk-3N5VQFR7.js} +2 -2
  10. package/{chunk-VVRYD7UL.js → chunk-647HBTHJ.js} +2 -2
  11. package/{chunk-CAWIORRR.js → chunk-DE3RG4GV.js} +2 -2
  12. package/{chunk-WBRBIRDG.js → chunk-EFGBXVOC.js} +2 -2
  13. package/{chunk-RYM5SWKD.js → chunk-F3FISQL2.js} +23 -24
  14. package/{chunk-JGFVMK3S.js → chunk-IPQ3W3CZ.js} +7 -7
  15. package/{chunk-VNPUBOKQ.js → chunk-JGXBS3CI.js} +5 -5
  16. package/{chunk-ONA4OKNI.js → chunk-LCKCG5TK.js} +7 -7
  17. package/{chunk-WJJL7RMW.js → chunk-LPO6AMQU.js} +20 -14
  18. package/{chunk-NOFLIR3Z.js → chunk-MLEANT7D.js} +1 -1
  19. package/{chunk-S53PIA3G.js → chunk-N665S3Z2.js} +1 -1
  20. package/{chunk-3WTD7IIQ.js → chunk-OC72ZET2.js} +8 -8
  21. package/{chunk-HXFIFEBA.js → chunk-RBMYJSZF.js} +2 -2
  22. package/{chunk-6WNJ2XSC.js → chunk-TMVVCQCX.js} +1 -1
  23. package/{chunk-DRZCUIYC.js → chunk-VQOQH3DR.js} +2 -2
  24. package/{chunk-4BLKVQBS.js → chunk-Y2UYLA5L.js} +2 -2
  25. package/{chunk-ZEOGFBR3.js → chunk-YTWGTCVW.js} +19 -12
  26. package/{chunk-AOVELMYY.js → chunk-ZKBZLQTG.js} +3 -3
  27. package/{chunk-KVDB4IIT.js → chunk-ZMVXHANW.js} +1 -1
  28. package/{chunk-QKBEFLMA.js → chunk-ZU4J4GRW.js} +2 -2
  29. package/{commandRegistry-TNRRYS6G.js → commandRegistry-YRHEZ67B.js} +26 -26
  30. package/{contentThunks-FXRH3TBV.js → contentThunks-7JLGMPNX.js} +3 -3
  31. package/{createAgentAutomationAction-6M64V55C.js → createAgentAutomationAction-WSQ3VZ3X.js} +3 -3
  32. package/{createDialogAction-LTK2YJ7I.js → createDialogAction-4SHMWQYD.js} +4 -4
  33. package/{createPageAction-IKFGJRKB.js → createPageAction-GHYKDASE.js} +3 -3
  34. package/{dialogCommands-7FZEZ5DV.js → dialogCommands-3W6AIUXT.js} +2 -2
  35. package/{dialogSlice-TTJ74TZ2.js → dialogSlice-YXRGO7UV.js} +2 -2
  36. package/{docStore-GZW6PV6J.js → docStore-2U6GZMDG.js} +1 -1
  37. package/{handleSendMessageAction-YICSRGEU.js → handleSendMessageAction-SK6Q2N7Z.js} +7 -7
  38. package/index.js +3 -3
  39. package/{localRuntimeAdapter-MTZVCQW6.js → localRuntimeAdapter-GNVO5DGA.js} +10 -10
  40. package/{machineCommands-4P6O4WJD.js → machineCommands-LDK57YET.js} +11 -11
  41. package/{machineWsRunDispatch-2OQB3YA3.js → machineWsRunDispatch-PFYI3ZDF.js} +11 -11
  42. package/package.json +1 -1
  43. package/{readlineWorkspace-EB5D4MF6.js → readlineWorkspace-NLHSBWBK.js} +13 -13
  44. package/{runAgentClientLoop-DROGF2SZ.js → runAgentClientLoop-FR7N5TID.js} +10 -10
  45. package/{streamAgentChatTurn-PJ2L3P25.js → streamAgentChatTurn-YHZNWDWS.js} +12 -12
  46. package/{tools-2MFN4Z5Y.js → tools-AEPUZOZ2.js} +7 -7
  47. package/{updateDialogTitleAction-VQFUSGRH.js → updateDialogTitleAction-QERIYNOM.js} +3 -3
@@ -9,7 +9,7 @@ import {
9
9
  resolveRawAgentInput,
10
10
  resolveServerUrl,
11
11
  writeUsage
12
- } from "./chunk-S53PIA3G.js";
12
+ } from "./chunk-N665S3Z2.js";
13
13
  import {
14
14
  getReadableCliDb
15
15
  } from "./chunk-62TBKWTV.js";
@@ -31,7 +31,7 @@ import {
31
31
  resolveFileWriteGateEnabled,
32
32
  resolveLocalUserId,
33
33
  validateInstaboxWorkspaceSelection
34
- } from "./chunk-RYM5SWKD.js";
34
+ } from "./chunk-F3FISQL2.js";
35
35
  import {
36
36
  clearCredentialAvailability,
37
37
  readCredentialEntry,
@@ -79,14 +79,14 @@ import {
79
79
  } from "./chunk-BMQ2MJUK.js";
80
80
  import {
81
81
  resolveCliLocalRuntimeKeyCapability
82
- } from "./chunk-ZEOGFBR3.js";
82
+ } from "./chunk-YTWGTCVW.js";
83
83
  import {
84
84
  isTransientFetchError
85
85
  } from "./chunk-KFHREHUQ.js";
86
86
  import {
87
87
  parseUiCard,
88
88
  uiCardFallback
89
- } from "./chunk-HXFIFEBA.js";
89
+ } from "./chunk-RBMYJSZF.js";
90
90
  import {
91
91
  isGatewayHttpStatus
92
92
  } from "./chunk-NF64D32W.js";
@@ -95,7 +95,7 @@ import {
95
95
  chooseMemoryOwners,
96
96
  loadMemoryCandidatesFromDb,
97
97
  resolveAgentMemoryPolicy
98
- } from "./chunk-WBRBIRDG.js";
98
+ } from "./chunk-EFGBXVOC.js";
99
99
  import {
100
100
  API_REPORTED_COST_MULTIPLIER,
101
101
  estimateMessagesTokens,
@@ -103,7 +103,7 @@ import {
103
103
  resolveAgentContextWindow,
104
104
  resolveOccupancy,
105
105
  resolveOccupancyWindow
106
- } from "./chunk-3WTD7IIQ.js";
106
+ } from "./chunk-OC72ZET2.js";
107
107
  import {
108
108
  buildSkillDiscoveryContextLayer
109
109
  } from "./chunk-AU7AXHUL.js";
@@ -186,7 +186,7 @@ import {
186
186
  serverOriginForDialog,
187
187
  settleRunTerminalAuthoritatively,
188
188
  spawnLocalBackgroundRun
189
- } from "./chunk-WJJL7RMW.js";
189
+ } from "./chunk-LPO6AMQU.js";
190
190
  import {
191
191
  formatAgentListCard,
192
192
  formatFinishedRunCard,
@@ -1422,10 +1422,14 @@ function withRunRecordLock(runId, deps, fn, opts = {}) {
1422
1422
  const lockPath = `${resolveRunRecordPath(runId, deps.env, deps.homedir)}.lock`;
1423
1423
  let held = false;
1424
1424
  try {
1425
+ fs.mkdirSync(dirname(lockPath), { recursive: true });
1425
1426
  try {
1426
1427
  fs.writeFileSync(lockPath, String(process.pid), { flag: "wx" });
1427
1428
  held = true;
1428
- } catch {
1429
+ } catch (err) {
1430
+ if (err?.code !== "EEXIST") {
1431
+ throw err;
1432
+ }
1429
1433
  try {
1430
1434
  const stat = fs.statSync?.(lockPath);
1431
1435
  const ageMs = stat ? now().getTime() - stat.mtimeMs : Number.POSITIVE_INFINITY;
@@ -1825,8 +1829,9 @@ function emitHostMemoryNotice(mem, output) {
1825
1829
  return notice;
1826
1830
  }
1827
1831
  async function spawnLocalBackgroundRun(input, deps = {}) {
1828
- const env = deps.env ?? process.env;
1829
1832
  const homedir = deps.homedir ?? nodeHomedir;
1833
+ const env = deps.env ?? (deps.homedir ? { ...process.env, NOLO_HOME: join2(homedir(), ".nolo") } : process.env);
1834
+ const resolvedDeps = { ...deps, env, homedir };
1830
1835
  const fs = deps.fs ?? nodeFs2;
1831
1836
  const spawn = deps.spawn ?? nodeSpawn;
1832
1837
  const generateRunId = deps.generateRunId ?? defaultGenerateRunId;
@@ -1925,10 +1930,10 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
1925
1930
  runsDir,
1926
1931
  runId,
1927
1932
  fs: reservationFs,
1928
- now: deps.now,
1929
- readHostMemory: () => hostMemory = (deps.readHostMemory ?? readHostMemory)(),
1930
- getProcessStartTime: deps.getProcessStartTime ?? defaultGetProcessStartTime,
1931
- withLock: (id, fn, opts) => withRunRecordLock(id, deps, fn, opts)
1933
+ now: resolvedDeps.now,
1934
+ readHostMemory: () => hostMemory = (resolvedDeps.readHostMemory ?? readHostMemory)(),
1935
+ getProcessStartTime: resolvedDeps.getProcessStartTime ?? defaultGetProcessStartTime,
1936
+ withLock: (id, fn, opts) => withRunRecordLock(id, resolvedDeps, fn, opts)
1932
1937
  });
1933
1938
  proc = spawn(execPath, childArgs, {
1934
1939
  cwd: input.cwd,
@@ -1940,7 +1945,7 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
1940
1945
  try {
1941
1946
  reservation?.release("spawn_sync_failed");
1942
1947
  } finally {
1943
- finalizeRunRecord(runId, { status: "failed", exitCode: 1, note: String(error) }, deps);
1948
+ finalizeRunRecord(runId, { status: "failed", exitCode: 1, note: String(error) }, resolvedDeps);
1944
1949
  }
1945
1950
  throw error;
1946
1951
  } finally {
@@ -1954,29 +1959,29 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
1954
1959
  status: "failed",
1955
1960
  exitCode: 1,
1956
1961
  note: `${error}; reservation release failed: ${releaseError}`
1957
- }, deps);
1962
+ }, resolvedDeps);
1958
1963
  return;
1959
1964
  }
1960
- finalizeRunRecord(runId, { status: "failed", exitCode: 1, note: String(error) }, deps);
1965
+ finalizeRunRecord(runId, { status: "failed", exitCode: 1, note: String(error) }, resolvedDeps);
1961
1966
  });
1962
1967
  const hostMemoryNotice = emitHostMemoryNotice(hostMemory, input.output);
1963
1968
  if (typeof proc.pid === "number") {
1964
1969
  let processStartedAt;
1965
1970
  try {
1966
- processStartedAt = (deps.getProcessStartTime ?? defaultGetProcessStartTime)(proc.pid);
1971
+ processStartedAt = (resolvedDeps.getProcessStartTime ?? defaultGetProcessStartTime)(proc.pid);
1967
1972
  if (processStartedAt && !Number.isFinite(processStartedAt.getTime())) processStartedAt = null;
1968
1973
  } catch {
1969
1974
  processStartedAt = null;
1970
1975
  }
1971
- withRunRecordLock(runId, deps, () => {
1972
- const latest = readRunRecord(runId, deps) ?? record;
1976
+ withRunRecordLock(runId, resolvedDeps, () => {
1977
+ const latest = readRunRecord(runId, resolvedDeps) ?? record;
1973
1978
  latest.pid = proc.pid;
1974
1979
  if (processStartedAt) latest.processStartedAt = processStartedAt.toISOString();
1975
- writeRunRecord(latest, deps);
1980
+ writeRunRecord(latest, resolvedDeps);
1976
1981
  return true;
1977
1982
  }, { strict: true });
1978
1983
  try {
1979
- const persisted = readRunRecord(runId, deps);
1984
+ const persisted = readRunRecord(runId, resolvedDeps);
1980
1985
  reservation.associate({ runId, pid: proc.pid, processStartedAt: processStartedAt?.toISOString() });
1981
1986
  if (persisted?.pid !== proc.pid || !persisted.processStartedAt) throw new Error("Child identity persistence failed");
1982
1987
  } catch (error) {
@@ -2718,6 +2723,7 @@ export {
2718
2723
  popQueueMessages,
2719
2724
  defaultGenerateRunId,
2720
2725
  defaultGenerateBatchId,
2726
+ withRunRecordLock,
2721
2727
  writeRunRecord,
2722
2728
  createRunActivityTracker,
2723
2729
  readRunRecord,
@@ -42,7 +42,7 @@ import {
42
42
  } from "./chunk-I42VC5KR.js";
43
43
  import {
44
44
  resolveRunsDir
45
- } from "./chunk-WJJL7RMW.js";
45
+ } from "./chunk-LPO6AMQU.js";
46
46
  import {
47
47
  getDefaultCliLocalRuntimeDb
48
48
  } from "./chunk-GAGGEA7D.js";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-NBTY7YJF.js";
6
6
  import {
7
7
  resolveCliLocalRuntimeKeyCapability
8
- } from "./chunk-ZEOGFBR3.js";
8
+ } from "./chunk-YTWGTCVW.js";
9
9
  import {
10
10
  HIGH_RISK_MUTATION_TOOL_NAMES
11
11
  } from "./chunk-3M52COK5.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-QYPE3TS3.js";
12
12
  import {
13
13
  runLlm
14
- } from "./chunk-AOVELMYY.js";
14
+ } from "./chunk-ZKBZLQTG.js";
15
15
  import {
16
16
  getApproxPricePerImage
17
17
  } from "./chunk-4JH2UMJR.js";
@@ -11062,7 +11062,7 @@ var messageSlice = createSliceWithThunks({
11062
11062
  runtimeOptions: args.runtimeOptions
11063
11063
  });
11064
11064
  if (agentKeyToUse) {
11065
- const { streamAgentChatTurn } = await import("./agentSlice-YDRAYF3Z.js");
11065
+ const { streamAgentChatTurn } = await import("./agentSlice-JOVX3KY3.js");
11066
11066
  await dispatch(
11067
11067
  streamAgentChatTurn({
11068
11068
  agentKey: agentKeyToUse,
@@ -13879,7 +13879,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
13879
13879
  }
13880
13880
  if (isCurrentDialog) {
13881
13881
  await thunkApi.dispatch(resetMsgs());
13882
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-TTJ74TZ2.js");
13882
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-YXRGO7UV.js");
13883
13883
  dispatch(clearPendingAttachments2());
13884
13884
  }
13885
13885
  return { dialogKey, isCurrentDialog, attachmentPlan };
@@ -13887,15 +13887,15 @@ var deleteDialogThunk = async (payload, thunkApi) => {
13887
13887
 
13888
13888
  // packages/chat/dialog/dialogSlice.ts
13889
13889
  var runCreateDialogAction = async (args, thunkApi) => {
13890
- const { createDialogAction } = await import("./createDialogAction-LTK2YJ7I.js");
13890
+ const { createDialogAction } = await import("./createDialogAction-4SHMWQYD.js");
13891
13891
  return createDialogAction(args, thunkApi);
13892
13892
  };
13893
13893
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
13894
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-6M64V55C.js");
13894
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-WSQ3VZ3X.js");
13895
13895
  return createAgentAutomationAction(args, thunkApi);
13896
13896
  };
13897
13897
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
13898
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-VQFUSGRH.js");
13898
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-QERIYNOM.js");
13899
13899
  return updateDialogTitleAction(args, thunkApi);
13900
13900
  };
13901
13901
  var runAddDialogAgentAction = async (args, thunkApi) => {
@@ -13919,7 +13919,7 @@ var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
13919
13919
  return setDialogExtraReferencesAction(args, thunkApi);
13920
13920
  };
13921
13921
  var runHandleSendMessageAction = async (args, thunkApi) => {
13922
- const { handleSendMessageAction } = await import("./handleSendMessageAction-YICSRGEU.js");
13922
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-SK6Q2N7Z.js");
13923
13923
  return handleSendMessageAction(args, thunkApi);
13924
13924
  };
13925
13925
  function clearDialogState() {
@@ -13932,7 +13932,7 @@ var createPageAndAddReference = createAsyncThunk(
13932
13932
  async (payload, { dispatch, getState, rejectWithValue }) => {
13933
13933
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
13934
13934
  try {
13935
- const { createDocState } = await import("./docStore-GZW6PV6J.js");
13935
+ const { createDocState } = await import("./docStore-2U6GZMDG.js");
13936
13936
  const pageKey = await createDocState(
13937
13937
  { slateData, title },
13938
13938
  { dispatch, getState }
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VYNMQ6HW.js";
9
9
  import {
10
10
  fetchAndCacheTableRows
11
- } from "./chunk-KVDB4IIT.js";
11
+ } from "./chunk-ZMVXHANW.js";
12
12
  import {
13
13
  require_react
14
14
  } from "./chunk-YDH3FDFQ.js";
@@ -521,7 +521,7 @@ var executeToolRun = createAsyncThunk(
521
521
  if (!executionInput) {
522
522
  throw new Error(`ToolRun ${id} has no input to execute with.`);
523
523
  }
524
- const { findToolExecutor } = await import("./tools-2MFN4Z5Y.js");
524
+ const { findToolExecutor } = await import("./tools-AEPUZOZ2.js");
525
525
  const { executor } = findToolExecutor(run.toolName);
526
526
  toolRunStarted({
527
527
  id: run.id,
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-62TBKWTV.js";
7
7
  import {
8
8
  clearCliLocalRuntimePreparedAgentCache
9
- } from "./chunk-RYM5SWKD.js";
9
+ } from "./chunk-F3FISQL2.js";
10
10
  import {
11
11
  readCredentialAvailability
12
12
  } from "./chunk-6MXDOUMH.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-RYM5SWKD.js";
4
+ } from "./chunk-F3FISQL2.js";
5
5
  import {
6
6
  t
7
7
  } from "./chunk-2AB2HA4M.js";
8
8
  import {
9
9
  clipMultilineText
10
- } from "./chunk-HXFIFEBA.js";
10
+ } from "./chunk-RBMYJSZF.js";
11
11
  import {
12
12
  runLocalAgentTurn
13
13
  } from "./chunk-5E5VB7PS.js";
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-HS7MLR74.js";
4
4
  import {
5
5
  performServerProxyFetchWithRetry
6
- } from "./chunk-VVRYD7UL.js";
6
+ } from "./chunk-647HBTHJ.js";
7
7
  import {
8
8
  fetchServerSyncedCredential
9
- } from "./chunk-AOVELMYY.js";
9
+ } from "./chunk-ZKBZLQTG.js";
10
10
  import {
11
11
  buildSkillGuidancePromptBlock
12
12
  } from "./chunk-SH3XD4E2.js";
@@ -20,7 +20,7 @@ import {
20
20
  toolRunUpdated,
21
21
  uiCardFallback,
22
22
  waitForAbortableDelay
23
- } from "./chunk-HXFIFEBA.js";
23
+ } from "./chunk-RBMYJSZF.js";
24
24
  import {
25
25
  isGatewayHttpStatus
26
26
  } from "./chunk-NF64D32W.js";
@@ -64,7 +64,7 @@ import {
64
64
  } from "./chunk-VF4K2QE6.js";
65
65
  import {
66
66
  createDocState
67
- } from "./chunk-FKBWA3NN.js";
67
+ } from "./chunk-3N5VQFR7.js";
68
68
  import {
69
69
  addMemberSpace,
70
70
  fetchAuthoritativeRemoteSpace,
@@ -79,7 +79,7 @@ import {
79
79
  } from "./chunk-BAWAKW7X.js";
80
80
  import {
81
81
  createDialogAction
82
- } from "./chunk-WBRBIRDG.js";
82
+ } from "./chunk-EFGBXVOC.js";
83
83
  import {
84
84
  setDialogExtraReferencesAction
85
85
  } from "./chunk-IF7V3CBU.js";
@@ -102,7 +102,7 @@ import {
102
102
  updateContentCategory,
103
103
  updateContentTitle,
104
104
  writeStoredCollapsedCategories
105
- } from "./chunk-KVDB4IIT.js";
105
+ } from "./chunk-ZMVXHANW.js";
106
106
  import {
107
107
  buildDatabaseFileContentUrl,
108
108
  deleteDialog,
@@ -115,7 +115,7 @@ import {
115
115
  selectMsgById,
116
116
  uiAskChoiceFunc,
117
117
  uiAskChoiceFunctionSchema
118
- } from "./chunk-3WTD7IIQ.js";
118
+ } from "./chunk-OC72ZET2.js";
119
119
  import {
120
120
  buildMediaToolConfirmation,
121
121
  normalizeMediaConfirmExecutionRevision
@@ -126,7 +126,7 @@ import {
126
126
  runLlm,
127
127
  streamAgentChatTurn,
128
128
  updateAgent
129
- } from "./chunk-AOVELMYY.js";
129
+ } from "./chunk-ZKBZLQTG.js";
130
130
  import {
131
131
  getCurrentSpaceId,
132
132
  getCurrentSpaceIdRaw,
@@ -3882,7 +3882,7 @@ async function deleteDialogsFunc(args, thunkApi) {
3882
3882
  const deletedDialogIds = [];
3883
3883
  const deletedDialogKeys = [];
3884
3884
  const failures = [];
3885
- const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-TTJ74TZ2.js");
3885
+ const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-YXRGO7UV.js");
3886
3886
  for (const target of targets) {
3887
3887
  try {
3888
3888
  await thunkApi.dispatch(deleteDialog2(target.dbKey)).unwrap();
@@ -14937,10 +14937,17 @@ async function resolveTrustedInstaboxReadiness(callerUserId, thunkApi, trustedCo
14937
14937
  return void 0;
14938
14938
  }
14939
14939
  function resolveTrustedCallerUserId(thunkApi, trustedContext) {
14940
- const bound = trustedContext?.callerUserId;
14941
- if (bound !== void 0 && bound !== null) return bound;
14942
- const fromStore = selectIdentityUserId(thunkApi?.getState?.());
14943
- if (fromStore) return fromStore;
14940
+ if (trustedContext && "callerUserId" in trustedContext) {
14941
+ const bound = trustedContext.callerUserId;
14942
+ return typeof bound === "string" ? bound : "";
14943
+ }
14944
+ if (typeof thunkApi?.getState === "function") {
14945
+ const state2 = thunkApi.getState();
14946
+ if (state2 != null) {
14947
+ const fromStore = selectIdentityUserId(state2);
14948
+ if (fromStore) return fromStore;
14949
+ }
14950
+ }
14944
14951
  const fromExtra = thunkApi?.extra?.userId;
14945
14952
  return typeof fromExtra === "string" ? fromExtra : void 0;
14946
14953
  }
@@ -18556,7 +18563,7 @@ async function updateDocFunc(args, thunkApi) {
18556
18563
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
18557
18564
  };
18558
18565
  await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
18559
- const { getDocState, applyExternalDocUpdate } = await import("./docStore-GZW6PV6J.js");
18566
+ const { getDocState, applyExternalDocUpdate } = await import("./docStore-2U6GZMDG.js");
18560
18567
  if (getDocState().pageKey === id) {
18561
18568
  applyExternalDocUpdate({
18562
18569
  slateData: finalSlateData,
@@ -308,7 +308,7 @@ var slice = createSliceWithThunks({
308
308
  const overrides = {};
309
309
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
310
310
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
311
- const { _executeModel } = await import("./_executeModel-LFPW52TC.js");
311
+ const { _executeModel } = await import("./_executeModel-M5PGAD3Z.js");
312
312
  return _executeModel(
313
313
  {
314
314
  isStreaming: args.isStreaming ?? false,
@@ -329,7 +329,7 @@ var slice = createSliceWithThunks({
329
329
  * - 循环直到无工具调用或触发其他运行时停止条件
330
330
  */
331
331
  runAgent: create.asyncThunk(async (args, thunkApi) => {
332
- const { runAgentClientLoop } = await import("./runAgentClientLoop-DROGF2SZ.js");
332
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-FR7N5TID.js");
333
333
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
334
334
  {
335
335
  agentKey: args.agentKey,
@@ -345,7 +345,7 @@ var slice = createSliceWithThunks({
345
345
  * 聊天轮次流式 Agent 调用
346
346
  */
347
347
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
348
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-PJ2L3P25.js");
348
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-YHZNWDWS.js");
349
349
  return streamAgentChatTurnHandler(args, thunkApi);
350
350
  }),
351
351
  /**
@@ -2,7 +2,7 @@ import {
2
2
  deleteDialog,
3
3
  runtime_default,
4
4
  toast
5
- } from "./chunk-3WTD7IIQ.js";
5
+ } from "./chunk-OC72ZET2.js";
6
6
  import {
7
7
  getCurrentSpaceId,
8
8
  getCurrentSpaceIdRaw,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-VVRYD7UL.js";
4
+ } from "./chunk-647HBTHJ.js";
5
5
  import {
6
6
  updateTokensAction
7
- } from "./chunk-3WTD7IIQ.js";
7
+ } from "./chunk-OC72ZET2.js";
8
8
  import {
9
9
  applyUpdateTokensFulfilled
10
10
  } from "./chunk-OWYYDMGJ.js";
@@ -110,7 +110,7 @@ function createDaemonShortcutCommand(path, description, command) {
110
110
  // packages/cli/agentInternalCommandEntries.ts
111
111
  function getAgentInternalCommandEntries() {
112
112
  const createAgentRunCommand = (path, description) => createContextCommand(path, description, async (args, ctx) => {
113
- const { runAgentRunCommand } = await import("./agentRunCommand-DE4WN2TT.js");
113
+ const { runAgentRunCommand } = await import("./agentRunCommand-SENMZRW7.js");
114
114
  return runAgentRunCommand(args, {
115
115
  env: ctx.env,
116
116
  scriptDir: ctx.scriptDir,
@@ -126,7 +126,7 @@ function getAgentInternalCommandEntries() {
126
126
  return runAgentListCommand(args, deps);
127
127
  }),
128
128
  createEnvCommand(["agent", "create"], "Create a new agent", async (args, deps) => {
129
- const { runAgentCreateCommand } = await import("./agentRecordCommands-5ECAWMGW.js");
129
+ const { runAgentCreateCommand } = await import("./agentRecordCommands-S4XDFB4H.js");
130
130
  return runAgentCreateCommand(args, deps);
131
131
  }),
132
132
  createEnvCommand(["agent", "models"], "List models: --preset <id> (server discovery, exit 1 on static fallback) or --url <base> --api-key <key> (OpenAI-compatible /models)", async (args, deps) => {
@@ -142,28 +142,28 @@ function getAgentInternalCommandEntries() {
142
142
  return runAgentPullCommand(args, deps);
143
143
  }),
144
144
  createEnvCommand(["agent", "read"], "Read a single agent", async (args, deps) => {
145
- const { runAgentReadCommand } = await import("./agentRecordCommands-5ECAWMGW.js");
145
+ const { runAgentReadCommand } = await import("./agentRecordCommands-S4XDFB4H.js");
146
146
  return runAgentReadCommand(args, deps);
147
147
  }),
148
148
  createAgentRunCommand(["agent", "run"], "Run an agent"),
149
149
  createEnvCommand(["agent", "ps"], "List active and recent local agent runs (--json for machine-readable output)", async (_args, deps) => {
150
- const { runAgentPsCommand } = await import("./agentRunControl-NQR3GB6H.js");
150
+ const { runAgentPsCommand } = await import("./agentRunControl-QWFFIAQY.js");
151
151
  return runAgentPsCommand(_args, { ...deps, output: process.stdout });
152
152
  }),
153
153
  createEnvCommand(["agent", "status"], "Show status of a local agent run (--json, --watch, --interval-ms N)", async (args, deps) => {
154
- const { runAgentStatusCommand } = await import("./agentRunControl-NQR3GB6H.js");
154
+ const { runAgentStatusCommand } = await import("./agentRunControl-QWFFIAQY.js");
155
155
  return runAgentStatusCommand(args, { ...deps, output: process.stdout });
156
156
  }),
157
157
  createEnvCommand(["agent", "logs"], "Show logs of a local agent run", async (args, deps) => {
158
- const { runAgentLogsCommand } = await import("./agentRunControl-NQR3GB6H.js");
158
+ const { runAgentLogsCommand } = await import("./agentRunControl-QWFFIAQY.js");
159
159
  return runAgentLogsCommand(args, { ...deps, output: process.stdout });
160
160
  }),
161
161
  createEnvCommand(["agent", "stop"], "Stop a local agent run", async (args, deps) => {
162
- const { runAgentStopCommand } = await import("./agentRunControl-NQR3GB6H.js");
162
+ const { runAgentStopCommand } = await import("./agentRunControl-QWFFIAQY.js");
163
163
  return runAgentStopCommand(args, { ...deps, output: process.stdout });
164
164
  }),
165
165
  createEnvCommand(["agent", "kill"], "Kill a local agent run", async (args, deps) => {
166
- const { runAgentKillCommand } = await import("./agentRunControl-NQR3GB6H.js");
166
+ const { runAgentKillCommand } = await import("./agentRunControl-QWFFIAQY.js");
167
167
  return runAgentKillCommand(args, { ...deps, output: process.stdout });
168
168
  }),
169
169
  createEnvCommand(["agent", "setup-offline-marxists"], "Create or update the Marxists.org offline book agent", async (args, deps) => {
@@ -171,31 +171,31 @@ function getAgentInternalCommandEntries() {
171
171
  return runSetupOfflineMarxistsAgentCommand(args, deps);
172
172
  }),
173
173
  createEnvCommand(["agent", "update"], "Update agent fields", async (args, deps) => {
174
- const { runAgentUpdateCommand } = await import("./agentRecordCommands-5ECAWMGW.js");
174
+ const { runAgentUpdateCommand } = await import("./agentRecordCommands-S4XDFB4H.js");
175
175
  return runAgentUpdateCommand(args, deps);
176
176
  }),
177
177
  createEnvCommand(["agent", "email", "provision"], "Provision a controlled inbox for an agent", async (args, deps) => {
178
- const { runAgentEmailProvisionCommand } = await import("./agentEmailCommands-7ILQ4X4X.js");
178
+ const { runAgentEmailProvisionCommand } = await import("./agentEmailCommands-7TEXFJMP.js");
179
179
  return runAgentEmailProvisionCommand(args, deps);
180
180
  }),
181
181
  createEnvCommand(["agent", "email", "bind"], "Bind an existing email address to an agent", async (args, deps) => {
182
- const { runAgentEmailBindCommand } = await import("./agentEmailCommands-7ILQ4X4X.js");
182
+ const { runAgentEmailBindCommand } = await import("./agentEmailCommands-7TEXFJMP.js");
183
183
  return runAgentEmailBindCommand(args, deps);
184
184
  }),
185
185
  createEnvCommand(["agent", "email", "transfer"], "Transfer an email identity from one agent to another (cross-account)", async (args, deps) => {
186
- const { runAgentEmailTransferCommand } = await import("./agentEmailCommands-7ILQ4X4X.js");
186
+ const { runAgentEmailTransferCommand } = await import("./agentEmailCommands-7TEXFJMP.js");
187
187
  return runAgentEmailTransferCommand(args, deps);
188
188
  }),
189
189
  createEnvCommand(
190
190
  ["agent", "email", "create-and-provision"],
191
191
  "Create an agent and provision its controlled inbox",
192
192
  async (args, deps) => {
193
- const { runAgentEmailCreateAndProvisionCommand } = await import("./agentEmailCommands-7ILQ4X4X.js");
193
+ const { runAgentEmailCreateAndProvisionCommand } = await import("./agentEmailCommands-7TEXFJMP.js");
194
194
  return runAgentEmailCreateAndProvisionCommand(args, deps);
195
195
  }
196
196
  ),
197
197
  createEnvCommand(["agent", "delete"], "Hard-delete an agent's private and public records", async (args, deps) => {
198
- const { runAgentDeleteCommand } = await import("./agentDeleteCommand-IMM5JJOZ.js");
198
+ const { runAgentDeleteCommand } = await import("./agentDeleteCommand-E3FXV4KL.js");
199
199
  return runAgentDeleteCommand(args, deps);
200
200
  }),
201
201
  createEnvCommand(["agent", "grant"], "Grant another user access to this agent's owner credentials", async (args, deps) => {
@@ -211,15 +211,15 @@ function getAgentInternalCommandEntries() {
211
211
  return runAgentRevokeGrantCommand(args, deps);
212
212
  }),
213
213
  createEnvCommand(["agent", "bind-current"], "Bind an agent to this machine", async (args, deps) => {
214
- const { runAgentBindCurrentCommand } = await import("./agentMachineCommands-2EOGVRMN.js");
214
+ const { runAgentBindCurrentCommand } = await import("./agentMachineCommands-HCMAADXH.js");
215
215
  return runAgentBindCurrentCommand(args, deps);
216
216
  }),
217
217
  createEnvCommand(["agent", "smoke-current"], "Smoke test a bound agent through this machine", async (args, deps) => {
218
- const { runAgentSmokeCurrentCommand } = await import("./agentMachineCommands-2EOGVRMN.js");
218
+ const { runAgentSmokeCurrentCommand } = await import("./agentMachineCommands-HCMAADXH.js");
219
219
  return runAgentSmokeCurrentCommand(args, deps);
220
220
  }),
221
221
  createEnvCommand(["agent", "runtime-doctor"], "Diagnose current machine runtime compatibility", async (args, deps) => {
222
- const { runAgentRuntimeDoctorCommand } = await import("./agentMachineCommands-2EOGVRMN.js");
222
+ const { runAgentRuntimeDoctorCommand } = await import("./agentMachineCommands-HCMAADXH.js");
223
223
  return runAgentRuntimeDoctorCommand(args, deps);
224
224
  }),
225
225
  createAgentRunCommand(["agent", "chat"], "Chat with an agent")
@@ -374,27 +374,27 @@ function getCiInternalCommandEntries() {
374
374
  function getDialogInternalCommandEntries() {
375
375
  return [
376
376
  createEnvCommand(["dialog", "search"], "Search dialog messages across dialogs", async (args, deps) => {
377
- const { runDialogSearchCommand } = await import("./dialogCommands-7FZEZ5DV.js");
377
+ const { runDialogSearchCommand } = await import("./dialogCommands-3W6AIUXT.js");
378
378
  return runDialogSearchCommand(args, deps);
379
379
  }),
380
380
  createEnvCommand(["dialog", "list"], "List dialogs (default --limit 50; --all/--limit 0 full; --jsonl streams)", async (args, deps) => {
381
- const { runDialogListCommand } = await import("./dialogCommands-7FZEZ5DV.js");
381
+ const { runDialogListCommand } = await import("./dialogCommands-3W6AIUXT.js");
382
382
  return runDialogListCommand(args, deps);
383
383
  }),
384
384
  createEnvCommand(["dialog", "delete"], "Delete one or more dialogs", async (args, deps) => {
385
- const { runDialogDeleteCommand } = await import("./dialogCommands-7FZEZ5DV.js");
385
+ const { runDialogDeleteCommand } = await import("./dialogCommands-3W6AIUXT.js");
386
386
  return runDialogDeleteCommand(args, deps);
387
387
  }),
388
388
  createEnvCommand(["dialog", "query"], "Query dialogs by subject refs (default --limit 50; --all full; --jsonl streams)", async (args, deps) => {
389
- const { runDialogQueryCommand } = await import("./dialogCommands-7FZEZ5DV.js");
389
+ const { runDialogQueryCommand } = await import("./dialogCommands-3W6AIUXT.js");
390
390
  return runDialogQueryCommand(args, deps);
391
391
  }),
392
392
  createEnvCommand(["dialog", "read"], "Read a dialog", async (args, deps) => {
393
- const { runDialogReadCommand } = await import("./dialogCommands-7FZEZ5DV.js");
393
+ const { runDialogReadCommand } = await import("./dialogCommands-3W6AIUXT.js");
394
394
  return runDialogReadCommand(args, deps);
395
395
  }),
396
396
  createEnvCommand(["dialog", "status"], "Read compact dialog status", async (args, deps) => {
397
- const { runDialogStatusCommand } = await import("./dialogCommands-7FZEZ5DV.js");
397
+ const { runDialogStatusCommand } = await import("./dialogCommands-3W6AIUXT.js");
398
398
  return runDialogStatusCommand(args, deps);
399
399
  })
400
400
  ];
@@ -530,15 +530,15 @@ function getSystemInternalCommandEntries(renderHelpText2) {
530
530
  return runWhoamiCommand({ args, env: ctx.env });
531
531
  }),
532
532
  createEntrypointEnvCommand(["connect"], "Send machine heartbeats or hold a connector websocket", async (args, deps) => {
533
- const { runMachineConnectCommand } = await import("./machineCommands-4P6O4WJD.js");
533
+ const { runMachineConnectCommand } = await import("./machineCommands-LDK57YET.js");
534
534
  return runMachineConnectCommand(args, deps);
535
535
  }),
536
536
  createDaemonShortcutCommand(["daemon"], "Run the connector daemon shortcut", async (args, deps) => {
537
- const { runMachineConnectCommand } = await import("./machineCommands-4P6O4WJD.js");
537
+ const { runMachineConnectCommand } = await import("./machineCommands-LDK57YET.js");
538
538
  return runMachineConnectCommand(args, deps);
539
539
  }),
540
540
  createEnvCommand(["machine", "status"], "List machines registered to the current profile", async (args, deps) => {
541
- const { runMachineStatusCommand } = await import("./machineCommands-4P6O4WJD.js");
541
+ const { runMachineStatusCommand } = await import("./machineCommands-LDK57YET.js");
542
542
  return runMachineStatusCommand(args, deps);
543
543
  }),
544
544
  createEnvCommand(["doctor", "runtime"], "Diagnose local-first agent runtime selection", async (args, deps) => {
@@ -8,12 +8,12 @@ import {
8
8
  updateContentPinned,
9
9
  updateContentTitle,
10
10
  uploadAndAddFileToSpace
11
- } from "./chunk-KVDB4IIT.js";
12
- import "./chunk-3WTD7IIQ.js";
11
+ } from "./chunk-ZMVXHANW.js";
12
+ import "./chunk-OC72ZET2.js";
13
13
  import "./chunk-OFFL4DCR.js";
14
14
  import "./chunk-523DITKR.js";
15
15
  import "./chunk-QYPE3TS3.js";
16
- import "./chunk-AOVELMYY.js";
16
+ import "./chunk-ZKBZLQTG.js";
17
17
  import "./chunk-4JH2UMJR.js";
18
18
  import "./chunk-ZJ7UHBJS.js";
19
19
  import "./chunk-BYXBJQAS.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-KVDB4IIT.js";
4
- import "./chunk-3WTD7IIQ.js";
3
+ } from "./chunk-ZMVXHANW.js";
4
+ import "./chunk-OC72ZET2.js";
5
5
  import "./chunk-OFFL4DCR.js";
6
6
  import "./chunk-523DITKR.js";
7
7
  import "./chunk-QYPE3TS3.js";
8
- import "./chunk-AOVELMYY.js";
8
+ import "./chunk-ZKBZLQTG.js";
9
9
  import "./chunk-4JH2UMJR.js";
10
10
  import "./chunk-ZJ7UHBJS.js";
11
11
  import "./chunk-BYXBJQAS.js";