nolo-cli 0.33.0-alpha.2 → 0.33.0-alpha.21

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 (118) hide show
  1. package/{_executeModel-RWPVI3YV.js → _executeModel-XKWVTZAY.js} +35 -34
  2. package/{action-SMLG6OTB.js → action-Q4KO7DDW.js} +4 -4
  3. package/{addContentAction-SFO244QN.js → addContentAction-FRXDZKSI.js} +3 -3
  4. package/{addDialogAgentAction-W44ZCEHB.js → addDialogAgentAction-XL5G3LPR.js} +2 -2
  5. package/{agentDeleteCommand-KU2RXQPP.js → agentDeleteCommand-ZU4H6F6M.js} +19 -18
  6. package/{agentEmailCommands-MPCMDENS.js → agentEmailCommands-6ULFXW4A.js} +41 -40
  7. package/{agentListCommands-EPD4N6FX.js → agentListCommands-VN7WCW7Z.js} +21 -20
  8. package/{agentMachineCommands-AF7C3YRT.js → agentMachineCommands-5PALVQBD.js} +21 -20
  9. package/{agentPullCommand-YH5GEBK4.js → agentPullCommand-TSWAJPS2.js} +1 -1
  10. package/{agentRecordCommands-EYE6MZZG.js → agentRecordCommands-XEB66KRX.js} +40 -39
  11. package/{agentRunCommand-LL22SGTN.js → agentRunCommand-OJX27NII.js} +42 -41
  12. package/{agentRuntimeLocal-JX34G47Z.js → agentRuntimeLocal-UWDOE55A.js} +20 -19
  13. package/{agentSlice-TNMFQQOV.js → agentSlice-SZRRJ3ZX.js} +5 -5
  14. package/{appDeleteCommands-43K5VXQB.js → appDeleteCommands-R63PZAY7.js} +20 -19
  15. package/{appDeployCommands-FEEJSVDZ.js → appDeployCommands-VNRT54YO.js} +20 -19
  16. package/{appDeployStatusCommands-H76CG45R.js → appDeployStatusCommands-6IPTKLEM.js} +20 -19
  17. package/{appGetCommands-MDZYFTYZ.js → appGetCommands-JPFVMVAI.js} +20 -19
  18. package/{appListCommands-TUJJXPWG.js → appListCommands-B3SLTPII.js} +20 -19
  19. package/{authCommand-T7UK4CWS.js → authCommand-EX5G5PF4.js} +12 -11
  20. package/{authCommands-EAPFGNHN.js → authCommands-VR6Q6GU2.js} +4 -4
  21. package/{chatQueueReduxAdapter-LVQXC4ZY.js → chatQueueReduxAdapter-IEX32ZVP.js} +15 -14
  22. package/{chunk-2H3XIBY4.js → chunk-2CNX3CJE.js} +4 -82
  23. package/{chunk-MPZJVZDC.js → chunk-2UDMTJOM.js} +9 -9
  24. package/{chunk-WHD6BG7M.js → chunk-37LDAHQN.js} +20 -18
  25. package/{chunk-2UECQ7RE.js → chunk-3AOLVADY.js} +1 -1
  26. package/{chunk-HUCT7HID.js → chunk-42IF53CR.js} +1 -1
  27. package/{chunk-AAGCMVFT.js → chunk-46JSKTPF.js} +189 -38
  28. package/{chunk-3WXRAHCG.js → chunk-6MSSX7FI.js} +1 -1
  29. package/{chunk-57QJXIB6.js → chunk-6YH4UR3E.js} +3 -3
  30. package/{chunk-HDKRSRYU.js → chunk-7BNPRRDS.js} +150 -29
  31. package/{chunk-FMEVI5TG.js → chunk-7CH6U3FL.js} +1 -1
  32. package/{chunk-OR2HNLVO.js → chunk-7EPNNOL4.js} +6 -6
  33. package/{chunk-PREQU5QV.js → chunk-7OGIWPNK.js} +1 -1
  34. package/{chunk-DFUPZE6V.js → chunk-7SLMYTSF.js} +1 -1
  35. package/{chunk-3GZXL6FM.js → chunk-AOWETAXX.js} +1 -1
  36. package/{chunk-2IVEXF7P.js → chunk-BHILFABL.js} +1 -1
  37. package/{chunk-TFPUAELY.js → chunk-DDET6246.js} +1 -1
  38. package/{chunk-ZURFOV5J.js → chunk-DMT4NJXR.js} +1 -1
  39. package/{chunk-RAZOLMJR.js → chunk-EQ6HOWEJ.js} +2 -2
  40. package/{chunk-6HYVJV7B.js → chunk-ESHYE7WU.js} +2 -1
  41. package/{chunk-JZ5AMMXU.js → chunk-FH7VUJN5.js} +2 -2
  42. package/{chunk-I6N2UVVY.js → chunk-FV63ICZC.js} +1 -1
  43. package/{chunk-U4TRT5V4.js → chunk-GEPHJJW4.js} +1 -1
  44. package/{chunk-VH2F7ZB6.js → chunk-GTEHJWXU.js} +1 -1
  45. package/{chunk-AOXVOC6D.js → chunk-HCOIKLSH.js} +2 -2
  46. package/{chunk-GTYM4HKV.js → chunk-IEHZHWN7.js} +2 -2
  47. package/{chunk-2QTEYCR7.js → chunk-JFUW3UTO.js} +1 -1
  48. package/{chunk-73GINUCW.js → chunk-JL2PUYVS.js} +102 -23
  49. package/{chunk-37V5LNEQ.js → chunk-KIL7V27H.js} +1 -1
  50. package/{chunk-JTSGWTYZ.js → chunk-KMMQFY5O.js} +1 -1
  51. package/{chunk-UK5JGQVU.js → chunk-KZB5SNYH.js} +9 -14
  52. package/{chunk-XCCGU6QB.js → chunk-L5XKDBSH.js} +1 -1
  53. package/{chunk-DPMBNHOJ.js → chunk-LAZTMWIU.js} +1 -1
  54. package/{chunk-M4NC7NF6.js → chunk-LJGEEYGC.js} +2 -2
  55. package/{chunk-B2BSG6QQ.js → chunk-LLKHGZME.js} +4 -4
  56. package/{chunk-7E72JMBB.js → chunk-N2WDGMD5.js} +45 -4
  57. package/{chunk-Q5ITEGIN.js → chunk-N4XRDM26.js} +1 -1
  58. package/{chunk-AFV4FOT2.js → chunk-OQVRTSZ5.js} +4 -91
  59. package/{chunk-3VAQHAXT.js → chunk-PU47HKTF.js} +11 -11
  60. package/{chunk-CLP2K7U4.js → chunk-QKCMP3LU.js} +2 -2
  61. package/{chunk-JZPBVBIY.js → chunk-QTZD6HBK.js} +18 -8
  62. package/{chunk-LOD75GOS.js → chunk-REOW4YJX.js} +80 -1099
  63. package/{chunk-6SXC35F4.js → chunk-RO3AEN3L.js} +5 -5
  64. package/{chunk-5CS33IBL.js → chunk-RQFO3CAF.js} +8 -9
  65. package/{chunk-GMXWYXAF.js → chunk-SBPGB6TF.js} +3 -3
  66. package/{chunk-FSSX3XRY.js → chunk-U2FRXKC7.js} +1 -1
  67. package/{chunk-NUO3QFWD.js → chunk-UNHKVD2N.js} +1 -1
  68. package/{chunk-GE6IWA5N.js → chunk-UNZDCI3O.js} +126 -1
  69. package/{chunk-JMPYDFHY.js → chunk-V44VE7R4.js} +2 -2
  70. package/{chunk-IL545V3E.js → chunk-V4MT7AEN.js} +1 -1
  71. package/{chunk-FXFGNOT2.js → chunk-VFVCYIRQ.js} +1 -1
  72. package/chunk-VIRTYWWE.js +97 -0
  73. package/{chunk-ZJMME4DS.js → chunk-XS543SNR.js} +5 -5
  74. package/{chunk-O6GEBMIY.js → chunk-XTSVOICC.js} +195 -47
  75. package/{chunk-6PO2SYCS.js → chunk-YH3FPBG6.js} +1569 -204
  76. package/{chunk-WLH5BAKX.js → chunk-YYTTDOWA.js} +2 -2
  77. package/{chunk-5SBK2MTI.js → chunk-ZKUATCEY.js} +20 -69
  78. package/{codingSkills-DY5MINPG.js → codingSkills-5VOV3JVB.js} +2 -2
  79. package/{createAgentAutomationAction-INQT23LX.js → createAgentAutomationAction-72NNXELT.js} +16 -15
  80. package/{createDialogAction-LDCPDI73.js → createDialogAction-3CJ2GXNO.js} +18 -17
  81. package/{createPageAction-5YXOG2M4.js → createPageAction-HZHQGQO6.js} +16 -15
  82. package/{dbSlice-3SD5L5H2.js → dbSlice-2YD2PZER.js} +2 -2
  83. package/{dialogCommands-CHJO47AX.js → dialogCommands-2BF4ZSWH.js} +18 -17
  84. package/{dialogSlice-DOWKOILN.js → dialogSlice-5R4O4377.js} +15 -14
  85. package/{docCreateCommands-OVZARUFX.js → docCreateCommands-HMZUBFGL.js} +19 -18
  86. package/{docDeleteCommands-E2XJ62LD.js → docDeleteCommands-DFR7GCOR.js} +19 -18
  87. package/{docReadCommands-I7OSREPJ.js → docReadCommands-YM7RDUAZ.js} +19 -18
  88. package/{docStore-UAWSKZ2Y.js → docStore-A4SRW2DJ.js} +17 -16
  89. package/{docUpdateCommands-X4Z26VJM.js → docUpdateCommands-TTQBD7IU.js} +19 -18
  90. package/{getPricing-L2ENXWHV.js → getPricing-J4VXWR5B.js} +3 -3
  91. package/{handleSendMessageAction-C3TSDWKH.js → handleSendMessageAction-CIFBZCI2.js} +15 -14
  92. package/index.js +70 -70
  93. package/{localRuntimeAuthority-E3R24J4T.js → localRuntimeAuthority-S77B5QVB.js} +6 -2
  94. package/{localRuntimeDb-DDZCJFQZ.js → localRuntimeDb-N3H3HQ7G.js} +1 -1
  95. package/{machineCommands-BUOIYJAD.js → machineCommands-QSW4JKR2.js} +40 -39
  96. package/{machineInfo-M6KB6HZN.js → machineInfo-66ZFUMLE.js} +1 -1
  97. package/{machineWsRunDispatch-7CRWAA6O.js → machineWsRunDispatch-X3ZC7DZJ.js} +39 -38
  98. package/{models-OX2S5C6Q.js → models-SQFOI4FI.js} +2 -2
  99. package/package.json +1 -1
  100. package/{read-6G73BMEY.js → read-526GJR3R.js} +1 -1
  101. package/{readDocTool-DK4EI2GA.js → readDocTool-JNEZUOSM.js} +1 -1
  102. package/{readlineWorkspace-ZDWEASJV.js → readlineWorkspace-J2ARMEUC.js} +2701 -2083
  103. package/{removeDialogAgentAction-E7H557UO.js → removeDialogAgentAction-NPMEFEJW.js} +4 -4
  104. package/{runAgentClientLoop-U7HYA3O5.js → runAgentClientLoop-5I2R74NR.js} +31 -30
  105. package/{runtimeDoctorCommands-KIKM6BIO.js → runtimeDoctorCommands-KHGQKT3B.js} +3 -3
  106. package/{setDialogExtraReferencesAction-RMMGBR5F.js → setDialogExtraReferencesAction-ZZ6QWAG2.js} +3 -3
  107. package/{setPrimaryDialogAgentAction-FWBKKLVA.js → setPrimaryDialogAgentAction-BG72QA6S.js} +4 -4
  108. package/{settingSlice-73PV4KG4.js → settingSlice-JCCLCXZB.js} +3 -3
  109. package/{skillDiscovery-KLLKXPUO.js → skillDiscovery-AYBKAG6X.js} +3 -3
  110. package/{spaceCommands-GEWZXGHM.js → spaceCommands-EZYMMJJH.js} +18 -17
  111. package/{spaceSlice-B6MOVY4N.js → spaceSlice-TL2FR4AF.js} +16 -15
  112. package/{streamAgentChatTurn-T527EQTT.js → streamAgentChatTurn-UDYSE2ES.js} +45 -54
  113. package/{switchDialogAgentAction-US6QNL3N.js → switchDialogAgentAction-YPGPM2LL.js} +2 -2
  114. package/{tableCommands-QE47K72R.js → tableCommands-64FZBAI3.js} +1 -1
  115. package/{tools-XMWCVMPM.js → tools-KWYWDJ77.js} +25 -24
  116. package/{tuiSummaryLlmCaller-NCAJSVSD.js → tuiSummaryLlmCaller-WUVAOIYU.js} +9 -8
  117. package/{updateCommands-AK2RDOFR.js → updateCommands-MNDUIKN7.js} +2 -2
  118. package/{updateDialogTitleAction-XPJZRJEL.js → updateDialogTitleAction-NQCOEOLF.js} +16 -15
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-MPZJVZDC.js";
3
+ } from "./chunk-2UDMTJOM.js";
4
4
  import {
5
5
  prepareAndPersistMessage,
6
6
  uiAskChoiceFunc,
7
7
  uiAskChoiceFunctionSchema
8
- } from "./chunk-73GINUCW.js";
8
+ } from "./chunk-JL2PUYVS.js";
9
9
  import {
10
10
  require_date_fns
11
11
  } from "./chunk-M76ECQRD.js";
12
12
  import {
13
13
  TOOL_PACKS
14
- } from "./chunk-WLH5BAKX.js";
14
+ } from "./chunk-YYTTDOWA.js";
15
15
  import {
16
16
  buildSkillDocMarkdown
17
17
  } from "./chunk-AETZ7AD6.js";
@@ -19,14 +19,14 @@ import {
19
19
  PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
20
20
  PLATFORM_HOSTED_DEEPSEEK_FLASH_PEAK_PRICE,
21
21
  PLATFORM_HOSTED_KIMI_PROVIDER
22
- } from "./chunk-OR2HNLVO.js";
22
+ } from "./chunk-7EPNNOL4.js";
23
23
  import {
24
24
  read,
25
25
  readAndWait,
26
26
  removeCachedEntity,
27
27
  upsertSSREntity,
28
28
  write
29
- } from "./chunk-57QJXIB6.js";
29
+ } from "./chunk-6YH4UR3E.js";
30
30
  import {
31
31
  createAgentKey,
32
32
  createDialogKey,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getCredentialsDir
3
- } from "./chunk-JZPBVBIY.js";
3
+ } from "./chunk-QTZD6HBK.js";
4
4
  import {
5
5
  asNonEmptyStringArray
6
6
  } from "./chunk-I42VC5KR.js";
@@ -23,7 +23,6 @@ import {
23
23
  unlinkSync,
24
24
  writeFileSync
25
25
  } from "node:fs";
26
- import { homedir } from "node:os";
27
26
  import { join } from "node:path";
28
27
 
29
28
  // packages/agent-runtime/credentialBroker.ts
@@ -39,7 +38,7 @@ function assertCredentialRef(ref) {
39
38
  }
40
39
 
41
40
  // packages/agent-runtime/fileCredentialBroker.ts
42
- function getApiKeyCredentialsDir(homeDir = homedir()) {
41
+ function getApiKeyCredentialsDir(homeDir) {
43
42
  return join(getCredentialsDir(homeDir), "keys");
44
43
  }
45
44
  function credentialRefToFileName(ref) {
@@ -49,7 +48,7 @@ function credentialRefToFileName(ref) {
49
48
  }
50
49
  return `${safe}.json`;
51
50
  }
52
- function getApiKeyCredentialPath(ref, homeDir = homedir()) {
51
+ function getApiKeyCredentialPath(ref, homeDir) {
53
52
  return join(getApiKeyCredentialsDir(homeDir), credentialRefToFileName(ref));
54
53
  }
55
54
  function ensurePrivateDir(dir) {
@@ -66,7 +65,7 @@ function writePrivateFile(path, body) {
66
65
  } catch {
67
66
  }
68
67
  }
69
- function readApiKeyCredential(ref, homeDir = homedir()) {
68
+ function readApiKeyCredential(ref, homeDir) {
70
69
  const path = getApiKeyCredentialPath(ref, homeDir);
71
70
  if (!existsSync(path)) return null;
72
71
  try {
@@ -78,7 +77,7 @@ function readApiKeyCredential(ref, homeDir = homedir()) {
78
77
  return null;
79
78
  }
80
79
  }
81
- function writeApiKeyCredential(ref, secret, homeDir = homedir(), now = Date.now()) {
80
+ function writeApiKeyCredential(ref, secret, homeDir, now = Date.now()) {
82
81
  const trimmedSecret = secret.trim();
83
82
  if (!trimmedSecret) {
84
83
  throw new Error("Cannot store an empty credential secret.");
@@ -94,17 +93,17 @@ function writeApiKeyCredential(ref, secret, homeDir = homedir(), now = Date.now(
94
93
  writePrivateFile(path, `${JSON.stringify(payload, null, 2)}
95
94
  `);
96
95
  }
97
- function removeApiKeyCredential(ref, homeDir = homedir()) {
96
+ function removeApiKeyCredential(ref, homeDir) {
98
97
  assertCredentialRef(ref);
99
98
  const path = getApiKeyCredentialPath(ref, homeDir);
100
99
  if (!existsSync(path)) return;
101
100
  unlinkSync(path);
102
101
  }
103
- function hasApiKeyCredential(ref, homeDir = homedir()) {
102
+ function hasApiKeyCredential(ref, homeDir) {
104
103
  return readApiKeyCredential(ref, homeDir) !== null;
105
104
  }
106
105
  function createFileCredentialBroker(options = {}) {
107
- const homeDir = options.homeDir ?? homedir();
106
+ const homeDir = options.homeDir;
108
107
  const now = options.now ?? Date.now;
109
108
  return {
110
109
  get(ref) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  updateContentTitle
3
- } from "./chunk-MPZJVZDC.js";
3
+ } from "./chunk-2UDMTJOM.js";
4
4
  import {
5
5
  require_date_fns
6
6
  } from "./chunk-M76ECQRD.js";
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  patch,
15
15
  readAndWait
16
- } from "./chunk-57QJXIB6.js";
16
+ } from "./chunk-6YH4UR3E.js";
17
17
  import {
18
18
  asOptionalTrimmedString
19
19
  } from "./chunk-G3SUCT4W.js";
@@ -367,7 +367,7 @@ async function saveDocState(arg, { dispatch, getState }) {
367
367
  }
368
368
  }
369
369
  async function createDocState(args, thunkApi) {
370
- const { createPageAction } = await import("./createPageAction-5YXOG2M4.js");
370
+ const { createPageAction } = await import("./createPageAction-HZHQGQO6.js");
371
371
  return createPageAction(args, thunkApi);
372
372
  }
373
373
  function subscribe(listener) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-WHD6BG7M.js";
4
+ } from "./chunk-37LDAHQN.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {
@@ -4,7 +4,7 @@ import {
4
4
 
5
5
  // packages/cli/agentCommandSupport.ts
6
6
  async function getDefaultCliDb() {
7
- const { getDefaultCliLocalRuntimeDb } = await import("./localRuntimeDb-DDZCJFQZ.js");
7
+ const { getDefaultCliLocalRuntimeDb } = await import("./localRuntimeDb-N3H3HQ7G.js");
8
8
  return getDefaultCliLocalRuntimeDb();
9
9
  }
10
10
  function createNullCliDb() {
@@ -1,5 +1,13 @@
1
1
  // packages/cli/client/profileConfig.ts
2
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import {
3
+ appendFileSync,
4
+ chmodSync,
5
+ existsSync,
6
+ mkdirSync,
7
+ readFileSync,
8
+ statSync,
9
+ writeFileSync
10
+ } from "node:fs";
3
11
  import { dirname, join } from "node:path";
4
12
  import { homedir } from "node:os";
5
13
 
@@ -27,6 +35,10 @@ function canonicalizeNoloServerUrl(value) {
27
35
 
28
36
  // packages/cli/client/profileConfig.ts
29
37
  var normalizeProfileServerUrl = canonicalizeNoloServerUrl;
38
+ function isProtectedHomeProfileWrite(path) {
39
+ if (process.env.NODE_ENV !== "test") return false;
40
+ return path === join(homedir(), ".nolo", "config.json");
41
+ }
30
42
  function getDefaultProfileConfigPath() {
31
43
  const noloHome = process.env.NOLO_HOME?.trim();
32
44
  return noloHome ? join(noloHome, "config.json") : join(homedir(), ".nolo", "config.json");
@@ -43,6 +55,7 @@ function loadProfileConfig(path = getDefaultProfileConfigPath()) {
43
55
  return parsed;
44
56
  }
45
57
  function clearProfileAuthToken(path = getDefaultProfileConfigPath()) {
58
+ if (isProtectedHomeProfileWrite(path)) return false;
46
59
  const config = loadProfileConfig(path);
47
60
  if (!config) return false;
48
61
  const profile = config.profiles[config.currentProfile];
@@ -54,6 +67,11 @@ function clearProfileAuthToken(path = getDefaultProfileConfigPath()) {
54
67
  return true;
55
68
  }
56
69
  function saveDefaultProfile(path, profile) {
70
+ if (isProtectedHomeProfileWrite(path)) {
71
+ throw new Error(
72
+ `Refusing to write the developer's real profile from a test process: ${path}. Pass a temp path or set NOLO_HOME.`
73
+ );
74
+ }
57
75
  const existing = loadProfileConfig(path);
58
76
  const mergedDefault = {
59
77
  ...existing?.profiles?.default ?? {},
@@ -89,9 +107,11 @@ function buildCliRuntimeEnv(processEnv, config) {
89
107
  const profileEnv = buildEnvFromProfile(config);
90
108
  const explicitAuthToken = processEnv.AUTH_TOKEN || processEnv.AUTH;
91
109
  const explicitServerUrl = processEnv.NOLO_SERVER || processEnv.NOLO_SERVER_URL || processEnv.BASE_URL;
110
+ const agentSource = processEnv.NOLO_AGENT?.trim() ? "env" : profileEnv.NOLO_AGENT ? "profile" : void 0;
92
111
  return {
93
112
  ...profileEnv,
94
113
  ...processEnv,
114
+ NOLO_AGENT_SOURCE: agentSource,
95
115
  ...explicitAuthToken ? { AUTH_TOKEN: explicitAuthToken } : {},
96
116
  ...explicitServerUrl ? {
97
117
  NOLO_SERVER: explicitServerUrl,
@@ -104,6 +124,7 @@ function getCurrentProfile(config) {
104
124
  return config.profiles[config.currentProfile] ?? null;
105
125
  }
106
126
  function saveProfileLocale(locale, path = getDefaultProfileConfigPath()) {
127
+ if (isProtectedHomeProfileWrite(path)) return null;
107
128
  const config = loadProfileConfig(path);
108
129
  if (!config) return null;
109
130
  const profile = config.profiles[config.currentProfile];
@@ -114,13 +135,115 @@ function saveProfileLocale(locale, path = getDefaultProfileConfigPath()) {
114
135
  `, "utf8");
115
136
  return config;
116
137
  }
138
+ function getAgentSelectionAuditPath(configPath = getDefaultProfileConfigPath()) {
139
+ return join(dirname(configPath), "agent-selection.log");
140
+ }
141
+ var AGENT_SELECTION_AUDIT_MAX_BYTES = 512 * 1024;
142
+ var AGENT_SELECTION_AUDIT_KEEP_LINES = 200;
143
+ var SECRET_ARGV_FLAGS = /* @__PURE__ */ new Set([
144
+ "--token",
145
+ "--auth",
146
+ "--auth-token",
147
+ "--key",
148
+ "--api-key",
149
+ "--app-key",
150
+ "--machine-key",
151
+ "--provider-api-key",
152
+ "--invite-token",
153
+ "--password",
154
+ "--secret"
155
+ ]);
156
+ function redactArgvSecrets(argv) {
157
+ const redacted = [];
158
+ let maskNext = false;
159
+ for (const arg of argv) {
160
+ if (maskNext) {
161
+ maskNext = false;
162
+ redacted.push("[REDACTED]");
163
+ continue;
164
+ }
165
+ const equals = arg.indexOf("=");
166
+ if (equals > 0 && SECRET_ARGV_FLAGS.has(arg.slice(0, equals))) {
167
+ redacted.push(`${arg.slice(0, equals)}=[REDACTED]`);
168
+ continue;
169
+ }
170
+ maskNext = SECRET_ARGV_FLAGS.has(arg);
171
+ redacted.push(arg);
172
+ }
173
+ return redacted;
174
+ }
175
+ function appendAgentSelectionAudit(entry, auditPath = getAgentSelectionAuditPath(entry.configPath)) {
176
+ try {
177
+ const stack = (new Error().stack ?? "").split("\n").slice(2, 8).map((line2) => line2.trim()).filter(Boolean);
178
+ const line = `${JSON.stringify({
179
+ at: (/* @__PURE__ */ new Date()).toISOString(),
180
+ pid: process.pid,
181
+ // Distinguishes repo source / installed binary / bundled desktop build —
182
+ // the field that says whether a stale build is doing the writing.
183
+ execPath: process.execPath,
184
+ argv: redactArgvSecrets(process.argv),
185
+ cwd: process.cwd(),
186
+ previous: entry.previous,
187
+ next: entry.next,
188
+ stack
189
+ })}
190
+ `;
191
+ mkdirSync(dirname(auditPath), { recursive: true });
192
+ const auditMode = 384;
193
+ if (existsSync(auditPath) && statSync(auditPath).size > AGENT_SELECTION_AUDIT_MAX_BYTES) {
194
+ const kept = readFileSync(auditPath, "utf8").split("\n").filter((entry2) => entry2.trim()).slice(-AGENT_SELECTION_AUDIT_KEEP_LINES).join("\n");
195
+ writeFileSync(auditPath, `${kept}
196
+ `, {
197
+ encoding: "utf8",
198
+ mode: auditMode
199
+ });
200
+ }
201
+ appendFileSync(auditPath, line, { encoding: "utf8", mode: auditMode });
202
+ try {
203
+ chmodSync(auditPath, auditMode);
204
+ } catch {
205
+ }
206
+ } catch {
207
+ }
208
+ }
209
+ function readLastAgentSelectionAudit(auditPath = getAgentSelectionAuditPath()) {
210
+ try {
211
+ if (!existsSync(auditPath)) return { logExists: false, last: null };
212
+ const lines = readFileSync(auditPath, "utf8").trim().split("\n");
213
+ for (let index = lines.length - 1; index >= 0; index -= 1) {
214
+ const raw = lines[index]?.trim();
215
+ if (!raw) continue;
216
+ const parsed = JSON.parse(raw);
217
+ if (!parsed.next) continue;
218
+ return {
219
+ logExists: true,
220
+ last: {
221
+ agentKey: parsed.next.agentKey ?? "",
222
+ agentName: parsed.next.agentName ?? ""
223
+ }
224
+ };
225
+ }
226
+ return { logExists: true, last: null };
227
+ } catch {
228
+ return { logExists: false, last: null };
229
+ }
230
+ }
117
231
  function saveProfileAgentSelection(selection, path = getDefaultProfileConfigPath()) {
232
+ if (isProtectedHomeProfileWrite(path)) return null;
118
233
  const config = loadProfileConfig(path);
119
234
  if (!config) return null;
120
235
  const profile = config.profiles[config.currentProfile];
121
236
  if (!profile) return null;
122
237
  const agentKey = selection.agentKey.trim();
123
238
  const agentName = selection.agentName.trim();
239
+ appendAgentSelectionAudit({
240
+ previous: {
241
+ ...profile.agentKey ? { agentKey: profile.agentKey } : {},
242
+ ...profile.agentName ? { agentName: profile.agentName } : {}
243
+ },
244
+ next: { agentKey, agentName },
245
+ configPath: path
246
+ });
124
247
  if (!agentKey) {
125
248
  delete profile.agentKey;
126
249
  delete profile.agentName;
@@ -143,5 +266,7 @@ export {
143
266
  buildCliRuntimeEnv,
144
267
  getCurrentProfile,
145
268
  saveProfileLocale,
269
+ getAgentSelectionAuditPath,
270
+ readLastAgentSelectionAudit,
146
271
  saveProfileAgentSelection
147
272
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getReadableCliDb
3
- } from "./chunk-NUO3QFWD.js";
3
+ } from "./chunk-UNHKVD2N.js";
4
4
  import {
5
5
  buildCreatedAgentRecord,
6
6
  buildUpdatedAgentRecord,
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-YDTYDA5W.js";
13
13
  import {
14
14
  clearCliLocalRuntimePreparedAgentCache
15
- } from "./chunk-O6GEBMIY.js";
15
+ } from "./chunk-XTSVOICC.js";
16
16
  import {
17
17
  resolveCliAgentKeyInput
18
18
  } from "./chunk-EKLRRZIN.js";
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-A7GB5UGH.js";
14
14
  import {
15
15
  createSpaceKey
16
- } from "./chunk-JTSGWTYZ.js";
16
+ } from "./chunk-KMMQFY5O.js";
17
17
  import {
18
18
  asTrimmedLowercaseString
19
19
  } from "./chunk-QSJ3HFEF.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadProfileConfig
3
- } from "./chunk-GE6IWA5N.js";
3
+ } from "./chunk-UNZDCI3O.js";
4
4
  import {
5
5
  resolveDefaultSpawn
6
6
  } from "./chunk-IDZTNRP2.js";
@@ -0,0 +1,97 @@
1
+ import {
2
+ getModelConfig
3
+ } from "./chunk-7SLMYTSF.js";
4
+ import {
5
+ PLATFORM_HOSTED_KIMI_K3_MODEL,
6
+ isPlatformHostedClaudeModel,
7
+ isPlatformHostedDeepseekModel,
8
+ isPlatformHostedGeminiModel,
9
+ isPlatformHostedGlmModel,
10
+ isPlatformHostedGrokModel,
11
+ isPlatformHostedKimiK26Model
12
+ } from "./chunk-7EPNNOL4.js";
13
+ import {
14
+ asTrimmedLowercaseString
15
+ } from "./chunk-QSJ3HFEF.js";
16
+
17
+ // packages/agent-runtime/platformProviderEndpoints.ts
18
+ var OPENAI_RESPONSES_ENDPOINT = "https://api.openai.com/v1/responses";
19
+ var DEEPSEEK_RESPONSES_ENDPOINT = "https://api.deepseek.com/responses";
20
+ var XAI_CHAT_COMPLETIONS_ENDPOINT = "https://api.x.ai/v1/chat/completions";
21
+ var PLATFORM_CHAT_COMPLETIONS_ENDPOINTS = {
22
+ deepinfra: "https://api.deepinfra.com/v1/openai/chat/completions",
23
+ fireworks: "https://api.fireworks.ai/inference/v1/chat/completions",
24
+ google: "https://generativelanguage.googleapis.com/v1beta/openai/chat/completions",
25
+ openai: "https://api.openai.com/v1/chat/completions",
26
+ openrouter: "https://openrouter.ai/api/v1/chat/completions",
27
+ // 千问 AI 平台 OpenAI 兼容模式
28
+ qwen: "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
29
+ // Moonshot AI(月之暗面)开放平台 OpenAI 兼容模式(按量计费)
30
+ moonshot: "https://api.moonshot.cn/v1/chat/completions",
31
+ // 平台托管 Kimi K3 的实际上游
32
+ crof: "https://crof.ai/v1/chat/completions"
33
+ // 无 nolo 默认上游:平台托管模型全部显式分流,未识别模型返回 undefined
34
+ };
35
+ function isOpenAiResponsesModel(args) {
36
+ const provider = asTrimmedLowercaseString(args.provider);
37
+ if (provider === "openai") {
38
+ if (args.endpointKey === "responses") return true;
39
+ if (!args.model) return false;
40
+ try {
41
+ return getModelConfig("openai", args.model).endpointKey === "responses";
42
+ } catch {
43
+ return false;
44
+ }
45
+ }
46
+ if (provider === "deepseek" || provider === "nolo" || provider === "ollama-cloud") {
47
+ if (isPlatformHostedDeepseekModel(args.model)) return true;
48
+ }
49
+ return false;
50
+ }
51
+ function resolvePlatformResponsesEndpoint(provider, model) {
52
+ const normalized = asTrimmedLowercaseString(provider);
53
+ if (normalized === "openai") return OPENAI_RESPONSES_ENDPOINT;
54
+ if (normalized === "deepseek" || normalized === "nolo" || normalized === "ollama-cloud") {
55
+ if (!model || isPlatformHostedDeepseekModel(model)) {
56
+ return DEEPSEEK_RESPONSES_ENDPOINT;
57
+ }
58
+ }
59
+ return void 0;
60
+ }
61
+ var PLATFORM_PROVIDER_ENDPOINT_ALIASES = {
62
+ "ollama-cloud": "nolo",
63
+ deepseek: "nolo"
64
+ };
65
+ function resolvePlatformChatCompletionsEndpoint(provider, model) {
66
+ const key = asTrimmedLowercaseString(provider);
67
+ if (!key) return void 0;
68
+ const aliased = PLATFORM_PROVIDER_ENDPOINT_ALIASES[key] ?? key;
69
+ if (aliased === "nolo" && isPlatformHostedClaudeModel(model)) {
70
+ return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.deepinfra;
71
+ }
72
+ if (aliased === "nolo" && isPlatformHostedGrokModel(model)) {
73
+ return XAI_CHAT_COMPLETIONS_ENDPOINT;
74
+ }
75
+ if (aliased === "nolo" && (isPlatformHostedKimiK26Model(model) || isPlatformHostedGlmModel(model))) {
76
+ return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.openrouter;
77
+ }
78
+ if (aliased === "nolo" && asTrimmedLowercaseString(model) === PLATFORM_HOSTED_KIMI_K3_MODEL) {
79
+ return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.crof;
80
+ }
81
+ if (aliased === "nolo" && isPlatformHostedGeminiModel(model)) {
82
+ return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.google;
83
+ }
84
+ if (aliased === "nolo" && isPlatformHostedDeepseekModel(model)) {
85
+ return void 0;
86
+ }
87
+ if (aliased === "nolo") {
88
+ return void 0;
89
+ }
90
+ return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS[aliased];
91
+ }
92
+
93
+ export {
94
+ isOpenAiResponsesModel,
95
+ resolvePlatformResponsesEndpoint,
96
+ resolvePlatformChatCompletionsEndpoint
97
+ };
@@ -3,7 +3,7 @@ import {
3
3
  createFileCredentialBroker,
4
4
  migrateAgentSecrets,
5
5
  normalizeAgentRuntimeToolPolicy
6
- } from "./chunk-5CS33IBL.js";
6
+ } from "./chunk-RQFO3CAF.js";
7
7
  import {
8
8
  asRecordOrEmpty
9
9
  } from "./chunk-KX6YBIHG.js";
@@ -11,7 +11,7 @@ import {
11
11
  patch,
12
12
  remove,
13
13
  write
14
- } from "./chunk-57QJXIB6.js";
14
+ } from "./chunk-6YH4UR3E.js";
15
15
  import {
16
16
  createAgentKey,
17
17
  toTrimmedString
@@ -304,7 +304,7 @@ var slice = createSliceWithThunks({
304
304
  const overrides = {};
305
305
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
306
306
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
307
- const { _executeModel } = await import("./_executeModel-RWPVI3YV.js");
307
+ const { _executeModel } = await import("./_executeModel-XKWVTZAY.js");
308
308
  return _executeModel(
309
309
  {
310
310
  isStreaming: args.isStreaming ?? false,
@@ -325,7 +325,7 @@ var slice = createSliceWithThunks({
325
325
  * - 循环直到无工具调用或触发其他运行时停止条件
326
326
  */
327
327
  runAgent: create.asyncThunk(async (args, thunkApi) => {
328
- const { runAgentClientLoop } = await import("./runAgentClientLoop-U7HYA3O5.js");
328
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-5I2R74NR.js");
329
329
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
330
330
  {
331
331
  agentKey: args.agentKey,
@@ -341,7 +341,7 @@ var slice = createSliceWithThunks({
341
341
  * 聊天轮次流式 Agent 调用
342
342
  */
343
343
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
344
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-T527EQTT.js");
344
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-UDYSE2ES.js");
345
345
  return streamAgentChatTurnHandler(args, thunkApi);
346
346
  }),
347
347
  /**