nolo-cli 0.10.0 → 0.11.0

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 (106) hide show
  1. package/{_executeModel-YAXYAUOK.js → _executeModel-ZEDPX6OF.js} +47 -45
  2. package/{action-TLI3V62L.js → action-AA4IJ5K2.js} +9 -9
  3. package/{addContentAction-PLWJSCOZ.js → addContentAction-QYVO4SYP.js} +8 -8
  4. package/{addDialogAgentAction-BJ6SB76X.js → addDialogAgentAction-WVVKT5WQ.js} +10 -10
  5. package/{agentDeleteCommand-2VYX73U5.js → agentDeleteCommand-RDPGYIWF.js} +25 -25
  6. package/{agentEmailCommands-3GDZIX64.js → agentEmailCommands-2HJJKS5F.js} +59 -56
  7. package/{agentListCommands-UWVBT3LH.js → agentListCommands-HFEVV3ZW.js} +30 -29
  8. package/{agentMachineCommands-WOKMUG2Y.js → agentMachineCommands-25ZOENJU.js} +28 -28
  9. package/{agentRecordCommands-MVNZRH3U.js → agentRecordCommands-GTCOAM3L.js} +50 -47
  10. package/{agentRunCommand-K7THIJLA.js → agentRunCommand-YBS3JDLD.js} +57 -53
  11. package/{agentRuntimeLocal-WJIGU24U.js → agentRuntimeLocal-UQBMQI2M.js} +11 -11
  12. package/{agentSlice-LL5TKZEO.js → agentSlice-6EKOBCCS.js} +9 -9
  13. package/{authCommand-TC2SW2CQ.js → authCommand-O2OWACN4.js} +12 -12
  14. package/{authCommands-XPEHTKSM.js → authCommands-H7365TZP.js} +6 -6
  15. package/{chunk-TYSCFY6S.js → chunk-2W2VYVI5.js} +334 -90
  16. package/{chunk-4SIMLBEU.js → chunk-3NSIQZZ6.js} +3 -3
  17. package/{chunk-AUQ747NZ.js → chunk-4SOKXIW4.js} +70 -6
  18. package/{chunk-PIVFPOW6.js → chunk-5MOUAAMK.js} +75 -71
  19. package/{chunk-A67QFHAA.js → chunk-5OIFWVX7.js} +1 -1
  20. package/{chunk-5JGGZCZL.js → chunk-7D3JY6C2.js} +2 -2
  21. package/{chunk-OR2XR25C.js → chunk-AEZAORLG.js} +4 -4
  22. package/chunk-AFON4QUU.js +112 -0
  23. package/{chunk-6KUOUWMP.js → chunk-BX6U3ETE.js} +19 -12
  24. package/{chunk-CDTLMEB3.js → chunk-C2MDQQ4O.js} +1 -1
  25. package/{chunk-SL35K7AH.js → chunk-C4FTUXVF.js} +2 -82
  26. package/{chunk-GAKEBQD6.js → chunk-D6OQHXVG.js} +11 -7
  27. package/{chunk-WPE4F4Z6.js → chunk-DWGAEFJL.js} +1 -1
  28. package/{chunk-HJGEVL7C.js → chunk-E4HNJSHC.js} +19 -19
  29. package/{chunk-TNPIMII7.js → chunk-EVZKZF32.js} +72 -39
  30. package/{chunk-C3RUNRHT.js → chunk-FXXSGWAJ.js} +1 -1
  31. package/{chunk-7KNKFIRO.js → chunk-GBDSZATH.js} +3 -3
  32. package/{chunk-7U44LYTR.js → chunk-IPYUUY4E.js} +1 -1
  33. package/{chunk-QAALPJS7.js → chunk-KJR5KAUQ.js} +2 -2
  34. package/{chunk-OZMMKDBI.js → chunk-KQQVGRA3.js} +23 -23
  35. package/{chunk-AVMKZHBC.js → chunk-L53FGHA4.js} +3 -2
  36. package/{chunk-CL3IOKGK.js → chunk-LAX2JSTX.js} +2 -2
  37. package/{chunk-NPVBXJY2.js → chunk-LP65VRCI.js} +5 -5
  38. package/chunk-LTRXGFMS.js +83 -0
  39. package/{chunk-KBKYAONQ.js → chunk-MQI77IRB.js} +2 -2
  40. package/{chunk-HFASY3WO.js → chunk-NEM67FX7.js} +1 -1
  41. package/{chunk-BE2OOJ5P.js → chunk-O26GI2JP.js} +8 -8
  42. package/{chunk-PAKN26FP.js → chunk-OUI3ZHYD.js} +1 -1
  43. package/{chunk-2O4IZNTG.js → chunk-PXQN7IBQ.js} +2 -2
  44. package/{chunk-4IJYA27C.js → chunk-PXZAAB4L.js} +4 -4
  45. package/{chunk-I5URP43I.js → chunk-Q3UKJVU4.js} +9 -9
  46. package/{chunk-AS4PVWA4.js → chunk-QNMFBBZK.js} +1 -1
  47. package/{chunk-6SLCD4RB.js → chunk-S3GS2PRL.js} +10 -10
  48. package/{chunk-T7R3NGUU.js → chunk-SV5MWASH.js} +16 -16
  49. package/{chunk-6JJWFVZ6.js → chunk-TACHTH5D.js} +15 -15
  50. package/chunk-VC6OZXO5.js +298 -0
  51. package/{chunk-ZQ2UM4KG.js → chunk-WZSRQNQG.js} +1 -292
  52. package/{chunk-EXXFGKF7.js → chunk-X2S7JTIG.js} +222 -45
  53. package/{chunk-DSZUWUYB.js → chunk-XFOLQLDN.js} +1 -1
  54. package/{chunk-YIHFXH5Q.js → chunk-XYZA7S7V.js} +6 -6
  55. package/{chunk-3Y3HW5PX.js → chunk-ZEYDOXHF.js} +105 -126
  56. package/{chunk-5KLGBAAR.js → chunk-ZPRK73XY.js} +1 -1
  57. package/{cliExecutor-DNE7TCC4.js → cliExecutor-K3F7DMRO.js} +2 -2
  58. package/{createAgentAutomationAction-CCE7CWGQ.js → createAgentAutomationAction-LTI5QU35.js} +21 -21
  59. package/{createDialogAction-QTRR4AT7.js → createDialogAction-OJJ7L3L3.js} +23 -22
  60. package/{createPageAction-Y4KQOAJE.js → createPageAction-5MXWVRGY.js} +26 -25
  61. package/{dbSlice-WWNV2SGX.js → dbSlice-RQFQQVHT.js} +7 -7
  62. package/{deleteFile-OW53A6BX.js → deleteFile-7XP5BGC7.js} +5 -5
  63. package/{dialogCommands-SMKIAC3Y.js → dialogCommands-JTJ3RPPW.js} +21 -21
  64. package/{dialogSlice-PT7YBWNE.js → dialogSlice-OWROKURJ.js} +19 -19
  65. package/{docCreateCommands-RFNA4HNM.js → docCreateCommands-WJBEW2V7.js} +22 -21
  66. package/{docDeleteCommands-4YZ325M6.js → docDeleteCommands-BVEHJOY5.js} +24 -23
  67. package/{docReadCommands-RT6VAFFG.js → docReadCommands-NEWOZIJV.js} +22 -21
  68. package/{docStore-QUQZAFZF.js → docStore-3DXRYBMD.js} +20 -20
  69. package/{docUpdateCommands-EKKKNYPW.js → docUpdateCommands-C7WHT7UU.js} +22 -21
  70. package/fetchMessages-KTNM7QAR.js +1 -1
  71. package/{handleSendMessageAction-5NSYAS53.js → handleSendMessageAction-B5PRR7BE.js} +24 -24
  72. package/index.js +58 -58
  73. package/{localDialogRead-2VRI24F4.js → localDialogRead-YSKFFRTT.js} +1 -1
  74. package/{machineCommands-DOOSIUKG.js → machineCommands-IIIREAEK.js} +64 -59
  75. package/{machineWsRunDispatch-PIOIQRBW.js → machineWsRunDispatch-3SIU6ILW.js} +49 -46
  76. package/package.json +1 -1
  77. package/{read-GW7ZEI23.js → read-QJNKRROM.js} +5 -5
  78. package/{readDocTool-HUFU6OCT.js → readDocTool-H6X6KO6X.js} +1 -1
  79. package/{readlineWorkspace-QEAOH5EP.js → readlineWorkspace-HGP3I3OC.js} +80 -67
  80. package/{removeDialogAgentAction-OHMCNSSD.js → removeDialogAgentAction-TCT35SOF.js} +12 -12
  81. package/{runAgentClientLoop-AIGLXC3R.js → runAgentClientLoop-EFM4PTVI.js} +43 -41
  82. package/{setDialogExtraReferencesAction-YJUM5BWQ.js → setDialogExtraReferencesAction-CGYLZMFH.js} +10 -10
  83. package/{setPrimaryDialogAgentAction-EBAREZDM.js → setPrimaryDialogAgentAction-F6BFQDJU.js} +12 -12
  84. package/{settingSlice-UW4IUI5L.js → settingSlice-2I5HMG47.js} +8 -8
  85. package/skillDiscovery-UGSQGX2U.js +16 -0
  86. package/{spaceCommands-BKHSPR73.js → spaceCommands-MT7BWCIL.js} +27 -27
  87. package/{spaceSlice-TYNWE3OC.js → spaceSlice-BS5TSW3W.js} +19 -19
  88. package/{streamAgentChatTurn-HRMFFA7E.js → streamAgentChatTurn-I3VBFNR3.js} +82 -78
  89. package/{tableCommands-O7O2LBEG.js → tableCommands-M3DJUETS.js} +10 -10
  90. package/{toolApiClient-QI3YBNWB.js → toolApiClient-C7P7YSE4.js} +2 -2
  91. package/{tools-3JNDS3WH.js → tools-XSD2BOEN.js} +31 -29
  92. package/{tuiSummaryLlmCaller-RV3THLZF.js → tuiSummaryLlmCaller-32NRHTT2.js} +3 -3
  93. package/{updateDialogTitleAction-OCETSKCP.js → updateDialogTitleAction-7FYNJOGP.js} +22 -22
  94. package/{agentPullCommand-O2MTUAFR.js → agentPullCommand-GOL2S4W2.js} +1 -1
  95. package/{chunk-DZ3XJVET.js → chunk-3QAF2LTL.js} +3 -3
  96. package/{chunk-EHLHSX7R.js → chunk-5MMZUWSG.js} +3 -3
  97. package/{chunk-X7W4TNB4.js → chunk-CMKUBIGW.js} +3 -3
  98. package/{chunk-4CQLVGRV.js → chunk-ID4G2MAR.js} +3 -3
  99. package/{chunk-5MIDPSSK.js → chunk-JK7VW2FN.js} +3 -3
  100. package/{chunk-UTLZINAP.js → chunk-OOM6SJNR.js} +9 -9
  101. package/{chunk-VVX233PH.js → chunk-PNEW2Z3T.js} +9 -9
  102. package/{chunk-TILFE6LV.js → chunk-YOCHZD7D.js} +3 -3
  103. package/{chunk-JRKKFRAV.js → chunk-YTBMA7NO.js} +3 -3
  104. package/{db-HCJ5PRB5.js → db-6QED3ZVO.js} +3 -3
  105. package/{runtimeDoctorCommands-LRHLPDRC.js → runtimeDoctorCommands-ID43Z7VX.js} +3 -3
  106. package/{understanding-3CUQQ6SV.js → understanding-ZOESBLF3.js} +3 -3
@@ -3,12 +3,16 @@ import {
3
3
  refreshAntigravityOAuthToken,
4
4
  refreshOpenAiCodexToken,
5
5
  refreshXaiOAuthToken
6
- } from "./chunk-EHLHSX7R.js";
6
+ } from "./chunk-5MMZUWSG.js";
7
+ import {
8
+ CliProviderQuotaError,
9
+ executeCli
10
+ } from "./chunk-CMKUBIGW.js";
7
11
  import {
8
12
  buildLocalAgentLookupKeys,
9
13
  normalizeAgentHandle,
10
14
  shouldReadAgentKeyRemotely
11
- } from "./chunk-CDTLMEB3.js";
15
+ } from "./chunk-C2MDQQ4O.js";
12
16
  import {
13
17
  LOCAL_CODEX_AGENT_ID,
14
18
  LOCAL_CODEX_AGENT_KEY,
@@ -17,23 +21,19 @@ import {
17
21
  } from "./chunk-VHBWHNVT.js";
18
22
  import {
19
23
  inferCaptureIntent
20
- } from "./chunk-A67QFHAA.js";
21
- import {
22
- CliProviderQuotaError,
23
- executeCli
24
- } from "./chunk-X7W4TNB4.js";
24
+ } from "./chunk-5OIFWVX7.js";
25
25
  import {
26
26
  buildCliPrompt
27
27
  } from "./chunk-ATNTHIZI.js";
28
28
  import {
29
29
  prepareTools
30
- } from "./chunk-2O4IZNTG.js";
30
+ } from "./chunk-PXQN7IBQ.js";
31
31
  import {
32
32
  getAntigravityUserAgent,
33
33
  isAntigravityOAuthAgent,
34
34
  readAntigravityProjectId,
35
35
  resolveAntigravityCloudCodeBaseUrl
36
- } from "./chunk-C3RUNRHT.js";
36
+ } from "./chunk-FXXSGWAJ.js";
37
37
  import {
38
38
  FORCED_TOOLS,
39
39
  addDefaultLightWebToolsForConfiguredAgents,
@@ -43,7 +43,10 @@ import {
43
43
  readXPostFunctionSchema,
44
44
  readXhsProfileFunc,
45
45
  readXhsProfileFunctionSchema
46
- } from "./chunk-TYSCFY6S.js";
46
+ } from "./chunk-2W2VYVI5.js";
47
+ import {
48
+ CORE_DRAIN_REASON
49
+ } from "./chunk-D6OQHXVG.js";
47
50
  import {
48
51
  normalizeDialogTitle
49
52
  } from "./chunk-OWOHNGCN.js";
@@ -52,14 +55,7 @@ import {
52
55
  } from "./chunk-4ZDM73SD.js";
53
56
  import {
54
57
  fetchServerSyncedCredential
55
- } from "./chunk-I5URP43I.js";
56
- import {
57
- isCompiledBinary,
58
- parseUserIdFromAuthToken
59
- } from "./chunk-ISNCLGUZ.js";
60
- import {
61
- DEFAULT_NOLO_SERVER_URL
62
- } from "./chunk-OLZBQWZU.js";
58
+ } from "./chunk-Q3UKJVU4.js";
63
59
  import {
64
60
  buildAgentRuntimeDialogWritePlan,
65
61
  buildLocalWorkspaceOpenAiTools,
@@ -73,7 +69,7 @@ import {
73
69
  parseSseDataLineJson,
74
70
  readOpenAiCompatibleSseCompletion,
75
71
  resolveOpenAiCompatibleProviderConfig
76
- } from "./chunk-6KUOUWMP.js";
72
+ } from "./chunk-BX6U3ETE.js";
77
73
  import {
78
74
  buildPlatformChatCompletionRequest,
79
75
  canUsePlatformChatProvider,
@@ -82,22 +78,23 @@ import {
82
78
  readSseDataValues,
83
79
  resolvePlatformChatProviderConfig,
84
80
  shouldUsePlatformChatProvider
85
- } from "./chunk-5KLGBAAR.js";
81
+ } from "./chunk-ZPRK73XY.js";
86
82
  import {
87
83
  resolveAgentRuntimeConfigFromRecord
88
- } from "./chunk-TILFE6LV.js";
84
+ } from "./chunk-YOCHZD7D.js";
89
85
  import {
90
86
  parseToolArgumentsJson,
91
87
  summarizeToolArguments
92
- } from "./chunk-6SLCD4RB.js";
88
+ } from "./chunk-S3GS2PRL.js";
93
89
  import {
90
+ buildLoadSkillExecutor,
94
91
  buildNoloWorkspaceCliToolExecutors,
95
92
  buildNoloWorkspaceOpenAiTools,
96
93
  canonicalizeToolNames,
97
94
  filterNoloWorkspaceToolNames,
98
95
  parseNoloWorkspaceToolArguments,
99
96
  resolveRuntimeToolSurfaceForAgent
100
- } from "./chunk-AUQ747NZ.js";
97
+ } from "./chunk-4SOKXIW4.js";
101
98
  import {
102
99
  clipCompactText
103
100
  } from "./chunk-5MMAK75Q.js";
@@ -113,12 +110,6 @@ import {
113
110
  readOAuthCredential,
114
111
  resolveFreshAccessToken
115
112
  } from "./chunk-JZPBVBIY.js";
116
- import {
117
- toErrorMessage
118
- } from "./chunk-HNMXYYJR.js";
119
- import {
120
- getDefaultCliLocalRuntimeDb
121
- } from "./chunk-H33743XH.js";
122
113
  import {
123
114
  asRecordOrEmpty
124
115
  } from "./chunk-KX6YBIHG.js";
@@ -131,6 +122,26 @@ import {
131
122
  import {
132
123
  asOptionalFiniteNumber
133
124
  } from "./chunk-WWC7I6TA.js";
125
+ import {
126
+ checkStaleRun,
127
+ finalizeRunRecord,
128
+ findRunRecord,
129
+ listRunRecords,
130
+ spawnLocalBackgroundRun
131
+ } from "./chunk-2FTTDCD4.js";
132
+ import {
133
+ isCompiledBinary,
134
+ parseUserIdFromAuthToken
135
+ } from "./chunk-ISNCLGUZ.js";
136
+ import {
137
+ DEFAULT_NOLO_SERVER_URL
138
+ } from "./chunk-OLZBQWZU.js";
139
+ import {
140
+ toErrorMessage
141
+ } from "./chunk-HNMXYYJR.js";
142
+ import {
143
+ getDefaultCliLocalRuntimeDb
144
+ } from "./chunk-H33743XH.js";
134
145
  import {
135
146
  BUILTIN_NOLO_AGENT_KEY,
136
147
  PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
@@ -138,25 +149,25 @@ import {
138
149
  PUBLIC_GLM_52_AGENT_KEY,
139
150
  PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
140
151
  PUBLIC_KIMI_K27_CODING_AGENT_KEY
141
- } from "./chunk-DSZUWUYB.js";
152
+ } from "./chunk-XFOLQLDN.js";
153
+ import {
154
+ asTrimmedString
155
+ } from "./chunk-3EUW3WEO.js";
156
+ import {
157
+ isRecord
158
+ } from "./chunk-KUG52IAP.js";
142
159
  import {
143
160
  isLoopbackHostname
144
161
  } from "./chunk-4SN6J65J.js";
145
162
  import {
146
163
  NOLO_CLUSTER_SERVERS
147
164
  } from "./chunk-LCBAMY2M.js";
148
- import {
149
- asTrimmedString
150
- } from "./chunk-3EUW3WEO.js";
151
165
  import {
152
166
  normalizeServerOrigin
153
167
  } from "./chunk-CF7PE763.js";
154
168
  import {
155
169
  asOptionalTrimmedString
156
170
  } from "./chunk-G3SUCT4W.js";
157
- import {
158
- isRecord
159
- } from "./chunk-KUG52IAP.js";
160
171
 
161
172
  // packages/cli/client/localRuntimeAdapter.ts
162
173
  import { dirname, extname, join } from "node:path";
@@ -191,6 +202,7 @@ import { request as httpRequest } from "node:http";
191
202
  import { request as httpsRequest } from "node:https";
192
203
  var TRANSIENT_FETCH_MAX_ATTEMPTS = 3;
193
204
  var TRANSIENT_FETCH_RETRY_BASE_DELAY_MS = 250;
205
+ var CORE_DRAINING_MAX_ATTEMPTS = 30;
194
206
  var RETRYABLE_HTTP_STATUSES = /* @__PURE__ */ new Set([429, 503]);
195
207
  function isTransientFetchError(error) {
196
208
  const message = toErrorMessage(error);
@@ -281,26 +293,44 @@ async function defaultLoopbackRequest(input, init) {
281
293
  req.end();
282
294
  });
283
295
  }
296
+ async function isCoreDrainingResponse(response) {
297
+ if (response.status !== 503) return false;
298
+ try {
299
+ const body = await response.clone().json();
300
+ return body?.reason === CORE_DRAIN_REASON;
301
+ } catch {
302
+ return false;
303
+ }
304
+ }
284
305
  async function fetchWithTransientRetry(fetchImpl, input, init, options = {}) {
285
306
  const retryableStatuses = options.retryableStatuses ?? RETRYABLE_HTTP_STATUSES;
307
+ const requestedMaxAttempts = Number(options.maxAttempts);
308
+ const maxAttempts = Number.isFinite(requestedMaxAttempts) ? Math.min(100, Math.max(1, Math.floor(requestedMaxAttempts))) : TRANSIENT_FETCH_MAX_ATTEMPTS;
309
+ const requestedCoreDrainingMaxAttempts = Number(options.coreDrainingMaxAttempts);
310
+ const coreDrainingMaxAttempts = Number.isFinite(requestedCoreDrainingMaxAttempts) ? Math.min(100, Math.max(1, Math.floor(requestedCoreDrainingMaxAttempts))) : CORE_DRAINING_MAX_ATTEMPTS;
311
+ const loopMaxAttempts = Math.max(maxAttempts, coreDrainingMaxAttempts);
286
312
  let lastError;
287
- for (let attempt = 1; attempt <= TRANSIENT_FETCH_MAX_ATTEMPTS; attempt += 1) {
313
+ for (let attempt = 1; attempt <= loopMaxAttempts; attempt += 1) {
288
314
  try {
289
315
  if (options.loopbackRequest && isLoopbackUrl(input)) {
290
316
  return await options.loopbackRequest(input, init);
291
317
  }
292
318
  const response = await fetchImpl(input, init);
293
- if (retryableStatuses.has(response.status) && attempt < TRANSIENT_FETCH_MAX_ATTEMPTS && !init?.signal?.aborted) {
294
- const delayMs = await resolveRetryAfterMs(response, attempt);
295
- await (options.sleep ?? defaultSleep)(delayMs);
296
- continue;
319
+ if (retryableStatuses.has(response.status) && !init?.signal?.aborted) {
320
+ const coreDraining = await isCoreDrainingResponse(response);
321
+ const attemptBudget = coreDraining ? coreDrainingMaxAttempts : maxAttempts;
322
+ if (attempt < attemptBudget) {
323
+ const delayMs = await resolveRetryAfterMs(response, attempt);
324
+ await (options.sleep ?? defaultSleep)(delayMs);
325
+ continue;
326
+ }
297
327
  }
298
328
  return response;
299
329
  } catch (error) {
300
330
  if (init?.signal?.aborted) throw error;
301
331
  if (!isTransientFetchError(error)) throw error;
302
332
  lastError = error;
303
- if (attempt < TRANSIENT_FETCH_MAX_ATTEMPTS) {
333
+ if (attempt < maxAttempts) {
304
334
  await (options.sleep ?? defaultSleep)(transientFetchRetryDelayMs(attempt));
305
335
  }
306
336
  }
@@ -1142,6 +1172,132 @@ function buildServerPlatformToolExecutors(args) {
1142
1172
  return { ...tableExecutors, ...webExecutors };
1143
1173
  }
1144
1174
 
1175
+ // packages/cli/client/cliAgentRunToolExecutors.ts
1176
+ import { existsSync, readFileSync } from "node:fs";
1177
+ var noopOutput = { write: () => {
1178
+ } };
1179
+ var parseCallArgs = (call) => {
1180
+ try {
1181
+ return JSON.parse(call?.arguments || "{}");
1182
+ } catch {
1183
+ return {};
1184
+ }
1185
+ };
1186
+ var resolveFs = (deps) => deps.fs ?? { existsSync, readFileSync };
1187
+ var tailFile = (logPath, tailLines, fs) => {
1188
+ if (!fs.existsSync(logPath)) return void 0;
1189
+ try {
1190
+ const content = fs.readFileSync(logPath, "utf8");
1191
+ const lines = String(content).split(/\r?\n/);
1192
+ if (lines.length > 0 && lines[lines.length - 1] === "") lines.pop();
1193
+ return lines.slice(Math.max(0, lines.length - tailLines)).join("\n");
1194
+ } catch {
1195
+ return void 0;
1196
+ }
1197
+ };
1198
+ function createCliStartAgentRunExecutor(deps = {}) {
1199
+ return async (call) => {
1200
+ const args = parseCallArgs(call);
1201
+ const agentKey = typeof args.agentKey === "string" ? args.agentKey.trim() : "";
1202
+ const task = typeof args.task === "string" ? args.task.trim() : "";
1203
+ if (!agentKey) throw new Error("startAgentRun: \u7F3A\u5C11 agentKey \u53C2\u6570\u3002");
1204
+ if (!task) throw new Error("startAgentRun: \u7F3A\u5C11\u6709\u6548\u7684 task \u6587\u672C\u63CF\u8FF0\u3002");
1205
+ const message = typeof args.input === "undefined" ? task : `${task}
1206
+
1207
+ --- \u9644\u52A0\u8F93\u5165 ---
1208
+ ${JSON.stringify(args.input)}`;
1209
+ const rawArgs = ["--agent", agentKey, "--msg-file", "PLACEHOLDER", "--bg"];
1210
+ const { runId, pid } = await spawnLocalBackgroundRun(
1211
+ {
1212
+ rawArgs,
1213
+ commandPath: ["agent", "run"],
1214
+ cliEntrypointPath: deps.cliEntrypoint,
1215
+ agentKey,
1216
+ cwd: deps.cwd ?? process.cwd(),
1217
+ message,
1218
+ output: noopOutput
1219
+ },
1220
+ deps
1221
+ );
1222
+ return {
1223
+ content: JSON.stringify({ runId, status: "running" }),
1224
+ metadata: {
1225
+ displayData: `\u23F3 \u540E\u53F0 run \u5DF2\u542F\u52A8\uFF0CrunId: ${runId}\uFF08pid ${pid ?? "-"}\uFF09\u3002\u7528 controlAgentRun(action:"status", runId:"${runId}") \u67E5\u8FDB\u5EA6\u3002`
1226
+ }
1227
+ };
1228
+ };
1229
+ }
1230
+ function createCliControlAgentRunExecutor(deps = {}) {
1231
+ return async (call) => {
1232
+ const args = parseCallArgs(call);
1233
+ const action = typeof args.action === "string" ? args.action : "";
1234
+ const tailLines = typeof args.tailLines === "number" ? args.tailLines : 0;
1235
+ if (action === "list") {
1236
+ const runs = listRunRecords(deps).map((record2) => ({
1237
+ runId: record2.runId,
1238
+ status: record2.status,
1239
+ agentKey: record2.agentKey,
1240
+ pid: record2.pid ?? null,
1241
+ startedAt: record2.startedAt
1242
+ }));
1243
+ return {
1244
+ content: JSON.stringify({ runs, count: runs.length }),
1245
+ metadata: {
1246
+ displayData: runs.length > 0 ? `\u{1F4CB} \u627E\u5230 ${runs.length} \u4E2A run\uFF1A
1247
+ ${runs.map((r) => `${r.runId} [${r.status}] ${r.agentKey}`).join("\n")}` : "\u{1F4CB} \u6CA1\u6709\u627E\u5230 run\u3002"
1248
+ }
1249
+ };
1250
+ }
1251
+ if (action !== "status" && action !== "stop") {
1252
+ throw new Error(`controlAgentRun: \u672A\u77E5 action "${action}"\u3002`);
1253
+ }
1254
+ if (!args.runId) throw new Error(`controlAgentRun(action:"${action}"): \u7F3A\u5C11 runId\u3002`);
1255
+ const record = findRunRecord(String(args.runId), deps);
1256
+ if (!record) {
1257
+ return {
1258
+ content: JSON.stringify({ runId: args.runId, found: false }),
1259
+ metadata: { displayData: `\u2753 run ${args.runId} \u672A\u627E\u5230\u3002\u53EF\u80FD\u5DF2\u5B8C\u6210\u5E76\u88AB\u6E05\u7406\uFF0C\u6216 ID \u9519\u8BEF\u3002` }
1260
+ };
1261
+ }
1262
+ if (action === "status") {
1263
+ const reconciled = checkStaleRun(record.runId, deps) ?? record;
1264
+ const logTail = tailLines > 0 ? tailFile(record.logPath, tailLines, resolveFs(deps)) : void 0;
1265
+ return {
1266
+ content: JSON.stringify({
1267
+ runId: reconciled.runId,
1268
+ found: true,
1269
+ status: reconciled.status,
1270
+ pid: reconciled.pid ?? null,
1271
+ agentKey: reconciled.agentKey,
1272
+ startedAt: reconciled.startedAt,
1273
+ endedAt: reconciled.endedAt ?? null,
1274
+ exitCode: reconciled.exitCode ?? null,
1275
+ ...logTail !== void 0 ? { logTail } : {}
1276
+ }),
1277
+ metadata: {
1278
+ displayData: `\u{1F4CC} run ${reconciled.runId} status=${reconciled.status}` + (logTail ? `
1279
+ --- \u65E5\u5FD7\uFF08\u672B ${tailLines} \u884C\uFF09---
1280
+ ${logTail}` : "")
1281
+ }
1282
+ };
1283
+ }
1284
+ if (typeof record.pid === "number") {
1285
+ try {
1286
+ (deps.kill ?? ((pid, signal) => process.kill(pid, signal)))(
1287
+ record.pid,
1288
+ "SIGTERM"
1289
+ );
1290
+ } catch {
1291
+ }
1292
+ }
1293
+ finalizeRunRecord(record.runId, { status: "killed" }, deps);
1294
+ return {
1295
+ content: JSON.stringify({ runId: record.runId, found: true, status: "killed" }),
1296
+ metadata: { displayData: `\u{1F6D1} run ${record.runId} \u5DF2\u505C\u6B62\uFF08killed\uFF09\u3002` }
1297
+ };
1298
+ };
1299
+ }
1300
+
1145
1301
  // packages/cli/client/cliLocalToolExecutors.ts
1146
1302
  function buildCliWorkspaceToolExecutors(args) {
1147
1303
  return buildNoloWorkspaceCliToolExecutors({
@@ -1166,6 +1322,10 @@ function buildLocalToolExecutors(args) {
1166
1322
  env: args.env,
1167
1323
  cliEntrypoint: args.cliEntrypoint
1168
1324
  }),
1325
+ // loadSkill resolves SKILL.md from the agent's workspace root (local-fs,
1326
+ // no `nolo` CLI subcommand), so it is wired here instead of inside
1327
+ // buildCliWorkspaceToolExecutors.
1328
+ loadSkill: buildLoadSkillExecutor({ cwd: args.workspaceRoot }),
1169
1329
  read_x_post: async (call) => {
1170
1330
  const parsedArgs = (() => {
1171
1331
  try {
@@ -1292,6 +1452,16 @@ function buildLocalToolExecutors(args) {
1292
1452
  metadata: { uiAskChoice: true }
1293
1453
  };
1294
1454
  },
1455
+ // agent-orchestration 能力包:startAgentRun / controlAgentRun 本地 --bg 执行器
1456
+ // (复用 ~/.nolo/runs/ 注册表,MED-1 修复)。
1457
+ startAgentRun: createCliStartAgentRunExecutor({
1458
+ env: args.env,
1459
+ cliEntrypoint: args.cliEntrypoint,
1460
+ cwd: args.workspaceRoot
1461
+ }),
1462
+ controlAgentRun: createCliControlAgentRunExecutor({
1463
+ env: args.env
1464
+ }),
1295
1465
  ...args.localToolExecutors ?? {}
1296
1466
  };
1297
1467
  }
@@ -8083,7 +8253,13 @@ function buildOpenAiTools(args) {
8083
8253
  searchFilesParameterVariant: resolveSearchFilesParameterVariant(args.env)
8084
8254
  }),
8085
8255
  ...buildServerPlatformOpenAiTools({ toolNames: args.toolNames }),
8086
- ...buildNoloWorkspaceOpenAiTools({ toolNames: args.toolNames })
8256
+ ...buildNoloWorkspaceOpenAiTools({ toolNames: args.toolNames }),
8257
+ // startAgentRun/controlAgentRun:CLI 本地 --bg 执行器已就绪(MED-1 修复,
8258
+ // cliAgentRunToolExecutors),只要 agent 声明(agent-orchestration 包展开)
8259
+ // 就注入 schema。
8260
+ ...prepareTools(
8261
+ ["startAgentRun", "controlAgentRun"].filter((name) => toolNameSet.has(name))
8262
+ )
8087
8263
  ];
8088
8264
  }
8089
8265
  var CLI_DEFAULT_TOOLS = ["exa_search", "fetchWebpage"];
@@ -8098,9 +8274,10 @@ function resolveCliEffectiveEnabledPacks(args) {
8098
8274
  }
8099
8275
  const base = args.enabledPacks ?? [];
8100
8276
  if (base.length === 0) {
8101
- return ["code"];
8277
+ return ["code", "agent-orchestration", "skills"];
8102
8278
  }
8103
- return base;
8279
+ const withOrchestration = base.includes("agent-orchestration") ? base : [...base, "agent-orchestration"];
8280
+ return withOrchestration.includes("skills") ? withOrchestration : [...withOrchestration, "skills"];
8104
8281
  }
8105
8282
  function resolveCliRequestedToolNames(agentConfig, env) {
8106
8283
  const declaredOnly = shouldUseDeclaredOnlyLocalWorkspaceTools(env);
@@ -7,7 +7,7 @@ import {
7
7
  scheduleExistingRecordReplication,
8
8
  shouldReplaceLocalWithRemoteRecord,
9
9
  shouldReplicateLocalRecord
10
- } from "./chunk-UTLZINAP.js";
10
+ } from "./chunk-OOM6SJNR.js";
11
11
  import {
12
12
  fetchFromClientDb,
13
13
  fetchFromServer,
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  updateContentTitle
3
- } from "./chunk-PIVFPOW6.js";
3
+ } from "./chunk-5MOUAAMK.js";
4
4
  import {
5
5
  require_date_fns
6
6
  } from "./chunk-M76ECQRD.js";
7
+ import {
8
+ patch,
9
+ readAndWait
10
+ } from "./chunk-O26GI2JP.js";
7
11
  import {
8
12
  require_react
9
13
  } from "./chunk-3ASDTTEI.js";
10
14
  import {
11
15
  toErrorMessage
12
16
  } from "./chunk-HNMXYYJR.js";
13
- import {
14
- patch,
15
- readAndWait
16
- } from "./chunk-BE2OOJ5P.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-Y4KQOAJE.js");
370
+ const { createPageAction } = await import("./createPageAction-5MXWVRGY.js");
371
371
  return createPageAction(args, thunkApi);
372
372
  }
373
373
  function subscribe(listener) {