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
@@ -5,10 +5,10 @@ import {
5
5
  readSseFrames,
6
6
  throwIfChatCompletionStreamFailed,
7
7
  toOpenAiCompatibleMessages
8
- } from "./chunk-5KLGBAAR.js";
8
+ } from "./chunk-ZPRK73XY.js";
9
9
  import {
10
10
  parseToolArgumentsJson
11
- } from "./chunk-6SLCD4RB.js";
11
+ } from "./chunk-S3GS2PRL.js";
12
12
  import {
13
13
  createThinkParserState,
14
14
  extractThinkContent
@@ -16,15 +16,12 @@ import {
16
16
  import {
17
17
  buildProviderAuthHeaders,
18
18
  buildProviderExecutionPlan
19
- } from "./chunk-JRKKFRAV.js";
19
+ } from "./chunk-YTBMA7NO.js";
20
20
  import {
21
21
  canonicalizeToolName,
22
22
  createGlob,
23
23
  resolveExecutableOnPath
24
- } from "./chunk-AUQ747NZ.js";
25
- import {
26
- toErrorMessage
27
- } from "./chunk-HNMXYYJR.js";
24
+ } from "./chunk-4SOKXIW4.js";
28
25
  import {
29
26
  asRecordOrEmpty
30
27
  } from "./chunk-KX6YBIHG.js";
@@ -40,21 +37,24 @@ import {
40
37
  import {
41
38
  asTrimmedLowercaseString
42
39
  } from "./chunk-QSJ3HFEF.js";
40
+ import {
41
+ toErrorMessage
42
+ } from "./chunk-HNMXYYJR.js";
43
43
  import {
44
44
  asTrimmedString
45
45
  } from "./chunk-3EUW3WEO.js";
46
46
  import {
47
47
  asOptionalPositiveFiniteNumber
48
48
  } from "./chunk-U6VC4MU4.js";
49
+ import {
50
+ isRecord
51
+ } from "./chunk-KUG52IAP.js";
49
52
  import {
50
53
  normalizeServerOrigin
51
54
  } from "./chunk-CF7PE763.js";
52
55
  import {
53
56
  asOptionalTrimmedString
54
57
  } from "./chunk-G3SUCT4W.js";
55
- import {
56
- isRecord
57
- } from "./chunk-KUG52IAP.js";
58
58
 
59
59
  // packages/agent-runtime/kimiUserAgent.ts
60
60
  var KIMI_CODE_CLI_VERSION = "0.29.2";
@@ -878,7 +878,14 @@ var DEFAULT_LOCAL_TOOLS = /* @__PURE__ */ new Set([
878
878
  "searchFiles",
879
879
  "execShell",
880
880
  "launchProcess",
881
- "listProcesses"
881
+ "listProcesses",
882
+ // Scheduling tools: forking/observing sub-agents is a declared capability
883
+ // of capable agents, and the blast radius is strictly narrower than
884
+ // execShell (already default-enabled). Requiring an env allowlist for these
885
+ // while execShell is open by default inverted the risk model and forced every
886
+ // new local user to hand-edit .env files before sub-agent tasks worked.
887
+ "startAgentRun",
888
+ "controlAgentRun"
882
889
  ]);
883
890
  function parseToolAllowlist(value) {
884
891
  return (value ?? "").split(",").flatMap((item) => {
@@ -951,7 +958,7 @@ function resolveLocalToolPolicy(args) {
951
958
  return {
952
959
  allowed: false,
953
960
  toolName,
954
- reason: `${toolName} is not enabled for local runtime runs. Set NOLO_LOCAL_ALLOWED_TOOLS and make sure the agent declares the tool before using it locally.`
961
+ reason: `${toolName} is not enabled for local runtime runs. The agent must declare the tool in its manifest; in restricted mode (NOLO_LOCAL_TOOL_MODE=restricted) non-default tools also require adding to NOLO_LOCAL_ALLOWED_TOOLS (e.g. NOLO_LOCAL_ALLOWED_TOOLS=someCustomTool) and restarting the session so the env var loads.`
955
962
  };
956
963
  }
957
964
  async function executeLocalToolWithPolicy(args) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildAgentRuntimeAgentLookupKeys,
3
3
  shouldFetchAgentRuntimeRecordRemotely
4
- } from "./chunk-6KUOUWMP.js";
4
+ } from "./chunk-BX6U3ETE.js";
5
5
 
6
6
  // packages/cli/client/localAgentRecords.ts
7
7
  var buildLocalAgentLookupKeys = buildAgentRuntimeAgentLookupKeys;
@@ -2,85 +2,6 @@ import {
2
2
  MEMORY_USE_GUIDANCE
3
3
  } from "./chunk-KKY4B2Q2.js";
4
4
 
5
- // packages/agent-runtime/modelLayerOverride.ts
6
- var MODEL_LAYER_KEYS = [
7
- "provider",
8
- "model",
9
- "apiSource",
10
- "cliProvider",
11
- "useServerProxy",
12
- "apiKey",
13
- "apiKeyRef",
14
- "apiKeyHeader",
15
- "customProviderUrl",
16
- "credentialRef",
17
- "credentialSynced",
18
- "temperature",
19
- "top_p",
20
- "frequency_penalty",
21
- "presence_penalty",
22
- "max_tokens",
23
- "reasoning_effort",
24
- "enableThinking",
25
- "thinkingBudget"
26
- ];
27
- function mergeReferences(base, extra) {
28
- const safeBase = Array.isArray(base) ? base : [];
29
- const safeExtra = Array.isArray(extra) ? extra : [];
30
- const seen = /* @__PURE__ */ new Set();
31
- const merged = [];
32
- for (const item of [...safeBase, ...safeExtra]) {
33
- const key = item?.dbKey;
34
- if (key && seen.has(key)) continue;
35
- if (key) seen.add(key);
36
- if (item) merged.push(item);
37
- }
38
- return merged;
39
- }
40
- var asNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0;
41
- function buildModelLayerOverride(agent) {
42
- if (!agent || !asNonEmptyString(agent.provider) || !asNonEmptyString(agent.model)) {
43
- return null;
44
- }
45
- const override = {
46
- provider: agent.provider,
47
- model: agent.model
48
- };
49
- for (const key of MODEL_LAYER_KEYS) {
50
- if (key === "provider" || key === "model") continue;
51
- const value = agent[key];
52
- if (value !== void 0) {
53
- override[key] = value;
54
- }
55
- }
56
- if (Array.isArray(agent.references) && agent.references.length > 0) {
57
- override.references = agent.references;
58
- }
59
- return override;
60
- }
61
- function applyModelLayerOverride(base, override) {
62
- const next = { ...base };
63
- for (const key of MODEL_LAYER_KEYS) {
64
- delete next[key];
65
- }
66
- for (const key of MODEL_LAYER_KEYS) {
67
- const value = override[key];
68
- if (value !== void 0) {
69
- next[key] = value;
70
- }
71
- }
72
- const merged = mergeReferences(
73
- base.references,
74
- override.references
75
- );
76
- if (merged.length > 0) {
77
- next.references = merged;
78
- } else {
79
- delete next.references;
80
- }
81
- return next;
82
- }
83
-
84
5
  // packages/agent-runtime/turnContext.ts
85
6
  var DEFAULT_RECENT_CONTENT_LIMIT = 10;
86
7
  var asTrimmed = (value) => typeof value === "string" ? value.trim() : "";
@@ -160,7 +81,8 @@ var buildSkillDiscoveryLayer = (skills, boundFolder) => {
160
81
  const lines = [
161
82
  "--- \u53EF\u7528\u6280\u80FD\uFF08Skills\uFF09---",
162
83
  `\u5DE5\u4F5C\u533A ${boundFolder} \u4E2D\u53D1\u73B0\u4E86 ${skills.length} \u4E2A\u6280\u80FD\uFF08SKILL.md\uFF09\uFF1A`,
163
- "\u6A21\u578B\u53EF\u6309\u9700\u7528 readFile \u8BFB\u53D6\u4EE5\u4E0B\u6587\u4EF6\u83B7\u53D6\u8BE6\u7EC6\u6307\u4EE4\uFF1A",
84
+ "\u6A21\u578B\u53EF\u6309\u9700\u7528 loadSkill \u5DE5\u5177\u6309\u540D\u52A0\u8F7D\uFF0C\u628A SKILL.md \u5168\u6587\u62C9\u8FDB\u4E0A\u4E0B\u6587\u540E\u9075\u5FAA\u5176\u6307\u4EE4\uFF1B",
85
+ "\u5982 loadSkill \u4E0D\u53EF\u7528\u6216\u60F3\u76F4\u63A5\u8BFB\u53D6\u6587\u4EF6\uFF0C\u4E0B\u65B9 path \u4ECD\u53EF\u7528 readFile \u4F5C\u4E3A fallback\uFF1A",
164
86
  "",
165
87
  ...skills.map(
166
88
  (s) => `- ${s.name}: ${s.description}
@@ -216,8 +138,6 @@ var buildMemoryUseGuidanceLayer = (args) => {
216
138
  };
217
139
 
218
140
  export {
219
- buildModelLayerOverride,
220
- applyModelLayerOverride,
221
141
  buildSpaceContextLayer,
222
142
  buildSkillDiscoveryLayer,
223
143
  buildLinkedSpacesSection,
@@ -1,3 +1,11 @@
1
+ // packages/core/drainReason.ts
2
+ var CORE_DRAIN_REASON = "core_draining";
3
+
4
+ // packages/core/gatewayHttpStatus.ts
5
+ function isGatewayHttpStatus(status) {
6
+ return status === 502 || status === 503 || status === 504;
7
+ }
8
+
1
9
  // packages/core/retryAfterMs.ts
2
10
  function normalizeNonNegativeMs(value, fallbackMs) {
3
11
  const parsed = Number(value);
@@ -18,13 +26,9 @@ function parseRetryAfterHeaderMs(value, nowMs = Date.now()) {
18
26
  return null;
19
27
  }
20
28
 
21
- // packages/core/gatewayHttpStatus.ts
22
- function isGatewayHttpStatus(status) {
23
- return status === 502 || status === 503 || status === 504;
24
- }
25
-
26
29
  export {
30
+ CORE_DRAIN_REASON,
31
+ isGatewayHttpStatus,
27
32
  normalizeNonNegativeMs,
28
- parseRetryAfterHeaderMs,
29
- isGatewayHttpStatus
33
+ parseRetryAfterHeaderMs
30
34
  };
@@ -2,7 +2,7 @@ import {
2
2
  deleteDbRecord,
3
3
  queryUserRecords,
4
4
  readDbRecord
5
- } from "./chunk-OR2XR25C.js";
5
+ } from "./chunk-AEZAORLG.js";
6
6
  import {
7
7
  mergeAndDedupUserData
8
8
  } from "./chunk-KQHGZWSV.js";
@@ -1,16 +1,23 @@
1
- import {
2
- chooseMemoryOwners,
3
- loadMemoryCandidatesFromDb
4
- } from "./chunk-XENYHRUE.js";
5
1
  import {
6
2
  addContentToSpace,
7
3
  prepareAndPersistMessage,
8
4
  uiAskChoiceFunc,
9
5
  uiAskChoiceFunctionSchema
10
- } from "./chunk-PIVFPOW6.js";
6
+ } from "./chunk-5MOUAAMK.js";
11
7
  import {
12
8
  require_date_fns
13
9
  } from "./chunk-M76ECQRD.js";
10
+ import {
11
+ read,
12
+ readAndWait,
13
+ removeCachedEntity,
14
+ upsertSSREntity,
15
+ write
16
+ } from "./chunk-O26GI2JP.js";
17
+ import {
18
+ chooseMemoryOwners,
19
+ loadMemoryCandidatesFromDb
20
+ } from "./chunk-XENYHRUE.js";
14
21
  import {
15
22
  PLATFORM_HOSTED_GLM_52_MODEL,
16
23
  PLATFORM_HOSTED_GLM_PRICE
@@ -18,37 +25,30 @@ import {
18
25
  import {
19
26
  PLATFORM_HOSTED_KIMI_PROVIDER
20
27
  } from "./chunk-IWX4UW2E.js";
21
- import {
22
- extractCustomId
23
- } from "./chunk-DFFIZ25G.js";
24
- import {
25
- read,
26
- readAndWait,
27
- removeCachedEntity,
28
- upsertSSREntity,
29
- write
30
- } from "./chunk-BE2OOJ5P.js";
31
28
  import {
32
29
  createAgentKey,
33
30
  createDialogKey,
34
31
  createKey,
35
32
  dialogMessageRange
36
33
  } from "./chunk-O4BU24WZ.js";
34
+ import {
35
+ extractCustomId
36
+ } from "./chunk-DFFIZ25G.js";
37
37
  import {
38
38
  selectIdentityUserId
39
- } from "./chunk-UTLZINAP.js";
39
+ } from "./chunk-OOM6SJNR.js";
40
40
  import {
41
41
  asTrimmedString
42
42
  } from "./chunk-3EUW3WEO.js";
43
43
  import {
44
44
  asOptionalPositiveFiniteNumber
45
45
  } from "./chunk-U6VC4MU4.js";
46
- import {
47
- asOptionalTrimmedString
48
- } from "./chunk-G3SUCT4W.js";
49
46
  import {
50
47
  isRecord
51
48
  } from "./chunk-KUG52IAP.js";
49
+ import {
50
+ asOptionalTrimmedString
51
+ } from "./chunk-G3SUCT4W.js";
52
52
  import {
53
53
  __toESM
54
54
  } from "./chunk-4VNS5WPM.js";
@@ -1,54 +1,59 @@
1
- import {
2
- MEMORY_USE_GUIDANCE,
3
- wrapHistoricalSummaryWithReplayGuard
4
- } from "./chunk-KKY4B2Q2.js";
5
1
  import {
6
2
  ANTIGRAVITY_CLOUD_CODE_BASE_URL,
7
3
  isAntigravityOAuthAgent
8
- } from "./chunk-C3RUNRHT.js";
4
+ } from "./chunk-FXXSGWAJ.js";
9
5
  import {
10
6
  clipMultilineText,
11
7
  fetchAndSerializeTable
12
- } from "./chunk-TYSCFY6S.js";
8
+ } from "./chunk-2W2VYVI5.js";
13
9
  import {
10
+ CORE_DRAIN_REASON,
11
+ isGatewayHttpStatus,
14
12
  normalizeNonNegativeMs,
15
13
  parseRetryAfterHeaderMs
16
- } from "./chunk-GAKEBQD6.js";
14
+ } from "./chunk-D6OQHXVG.js";
17
15
  import {
18
16
  slateToSimplifiedMarkdown
19
- } from "./chunk-AS4PVWA4.js";
17
+ } from "./chunk-QNMFBBZK.js";
20
18
  import {
21
19
  extractCategorizedMentions
22
20
  } from "./chunk-VP4WJWKW.js";
23
21
  import {
24
22
  resolvePageSkillMetadata
25
- } from "./chunk-ZQ2UM4KG.js";
23
+ } from "./chunk-VC6OZXO5.js";
26
24
  import {
27
25
  estimateTokenCount,
28
26
  fetchAndCacheMessages,
29
27
  shouldUseServerProxy
30
- } from "./chunk-PIVFPOW6.js";
28
+ } from "./chunk-5MOUAAMK.js";
31
29
  import {
32
30
  fetchServerSyncedCredential
33
- } from "./chunk-I5URP43I.js";
31
+ } from "./chunk-Q3UKJVU4.js";
34
32
  import {
35
33
  createSpaceKey
36
34
  } from "./chunk-UAD2WT54.js";
35
+ import {
36
+ read
37
+ } from "./chunk-O26GI2JP.js";
38
+ import {
39
+ MEMORY_USE_GUIDANCE,
40
+ wrapHistoricalSummaryWithReplayGuard
41
+ } from "./chunk-KKY4B2Q2.js";
37
42
  import {
38
43
  buildCurrentTimeBlock,
39
44
  buildIdentityBlock,
40
45
  buildRuntimeGuidanceBlocks
41
- } from "./chunk-PAKN26FP.js";
46
+ } from "./chunk-OUI3ZHYD.js";
42
47
  import {
43
48
  OPENAI_RESPONSES_ENDPOINT,
44
49
  buildProviderAuthHeaders,
45
50
  convertMessagesToResponsesInput,
46
51
  isOpenAiResponsesModel,
47
52
  resolvePlatformChatCompletionsEndpoint
48
- } from "./chunk-JRKKFRAV.js";
53
+ } from "./chunk-YTBMA7NO.js";
49
54
  import {
50
55
  canonicalizeToolNames
51
- } from "./chunk-AUQ747NZ.js";
56
+ } from "./chunk-4SOKXIW4.js";
52
57
  import {
53
58
  getModelConfig,
54
59
  isModelSupportReasoningEffort
@@ -61,36 +66,33 @@ import {
61
66
  isFireworksKimiModel,
62
67
  resolveFireworksKimiModel
63
68
  } from "./chunk-IWX4UW2E.js";
64
- import {
65
- extractCustomId
66
- } from "./chunk-DFFIZ25G.js";
67
- import {
68
- toErrorMessage
69
- } from "./chunk-HNMXYYJR.js";
70
- import {
71
- read
72
- } from "./chunk-BE2OOJ5P.js";
73
69
  import {
74
70
  asNonEmptyStringArray
75
71
  } from "./chunk-I42VC5KR.js";
72
+ import {
73
+ extractCustomId
74
+ } from "./chunk-DFFIZ25G.js";
76
75
  import {
77
76
  asTrimmedLowercaseString
78
77
  } from "./chunk-QSJ3HFEF.js";
78
+ import {
79
+ toErrorMessage
80
+ } from "./chunk-HNMXYYJR.js";
79
81
  import {
80
82
  getRuntimeServerContext
81
- } from "./chunk-UTLZINAP.js";
83
+ } from "./chunk-OOM6SJNR.js";
82
84
  import {
83
85
  isAbortError
84
86
  } from "./chunk-OOSFSFMA.js";
87
+ import {
88
+ asTrimmedString
89
+ } from "./chunk-3EUW3WEO.js";
85
90
  import {
86
91
  isLoopbackUrl
87
92
  } from "./chunk-4SN6J65J.js";
88
93
  import {
89
94
  API_ENDPOINTS
90
95
  } from "./chunk-LCBAMY2M.js";
91
- import {
92
- asTrimmedString
93
- } from "./chunk-3EUW3WEO.js";
94
96
  import {
95
97
  asOptionalTrimmedString
96
98
  } from "./chunk-G3SUCT4W.js";
@@ -707,6 +709,12 @@ var CONTEXT_USAGE_INSTRUCTIONS = `\u53C2\u8003\u8D44\u6599\u4F7F\u7528\u8BF4\u66
707
709
  - \u5982\u679C\u8D44\u6599\u4E2D\u6CA1\u6709\u5305\u542B\u7B54\u6848\uFF0C\u5E94\u8BF4\u660E\u8FD9\u4E00\u70B9\uFF0C\u7136\u540E\u518D\u4F7F\u7528\u4F60\u7684\u901A\u7528\u77E5\u8BC6\u8FDB\u884C\u56DE\u7B54\u3002
708
710
  - \u5982\u679C\u4F60\u5728\u8D44\u6599\u4E2D\u53D1\u73B0\u76F8\u4E92\u77DB\u76FE\u7684\u4FE1\u606F\uFF0C\u4E5F\u8981\u5728\u56DE\u7B54\u4E2D\u6307\u51FA\u8FD9\u4E00\u70B9\u3002
709
711
  - \u5F53\u901A\u7528\u6307\u4EE4\u4E0E\u66F4\u5177\u4F53\u7684"\u6309 Agent / \u6309\u6587\u6863"\u7684\u89C4\u5219\u53D1\u751F\u51B2\u7A81\u65F6\uFF0C\u5FC5\u987B\u4F18\u5148\u9075\u5B88\u66F4\u5177\u4F53\u3001\u4F18\u5148\u7EA7\u66F4\u9AD8\u7684\u89C4\u5219\u3002`;
712
+ var AGENT_ORCHESTRATION_RUN_INSTRUCTIONS = `--- \u591A Agent \u7F16\u6392\uFF08\u540E\u53F0 Run\uFF09 ---
713
+ \u4F60\u53EF\u7528 startAgentRun \u540E\u53F0\u542F\u52A8\u5B50 Agent\uFF08fork+exec\uFF0C\u8FD4\u56DE runId\uFF09\uFF0C\u7528 controlAgentRun \u89C2\u5BDF/\u505C\u6B62\uFF08wait+signal+proc\uFF09\u3002\u6838\u5FC3\u7EAA\u5F8B\uFF08\u53CD\u9762\u6559\u6750\uFF1A\u5B50\u4EE3\u7406\u5D29\u6E83/\u6302\u8D77\u800C\u7F16\u6392\u5668\u6BEB\u65E0\u5BDF\u89C9\uFF09\uFF1A
714
+ 1. \u6D3E\u53D1\u540E\u5FC5\u987B\u8F6E\u8BE2\u3002startAgentRun \u62FF\u5230 runId \u540E\uFF0C\u7528 controlAgentRun(action:"status", runId, tailLines:30) \u8F6E\u8BE2\uFF08\u5EFA\u8BAE 5\u201310s \u4E00\u6B21\uFF09\uFF0C\u4E0D\u8981\u53EA\u9760\u804A\u5929\u590D\u8FF0\u7ED3\u679C\u3002\u4E0D\u8F6E\u8BE2 = \u6CA1\u7F16\u6392\u3002
715
+ 2. \u8BFB\u65E5\u5FD7\u786E\u8BA4\u8FDB\u5C55\u3002tailLines>0 \u8BFB\u5B9E\u9645\u8F93\u51FA/\u5DE5\u5177\u8C03\u7528\uFF0C\u4E0D\u53EA\u770B status=running\u2014\u2014\u540E\u53F0\u76D1\u89C6\u5668\u53EF\u80FD\u7A7A\u8F6C\u3002
716
+ 3. stop \u524D\u5148\u770B\u65E5\u5FD7\u3002\u7528 status \u5224\u65AD\u662F\u771F\u5361\u6B7B\u8FD8\u662F\u6B63\u5E38\u8DD1\uFF0C\u786E\u8BA4\u9700\u8981\u53EB\u505C\u518D controlAgentRun(action:"stop", runId)\uFF1B\u7528 list/status \u786E\u8BA4 run \u771F\u5B9E\u5B58\u5728\u4E14\u975E\u7EC8\u6001\uFF0C\u522B\u5047\u8BBE"\u6D3E\u53D1\u4E86\u5C31\u5728\u8DD1"\u3002
717
+ \u5DE5\u5177\u9009\u62E9\uFF1A\u5B50\u4EFB\u52A1 <100s \u4E14\u8981\u7ACB\u5373\u62FF\u7ED3\u679C \u2192 callAgent\uFF08\u540C\u6B65\uFF09\uFF1B\u957F\u4EFB\u52A1 / \u5E76\u884C / \u9700\u8981\u89C2\u5BDF\u6216\u53EB\u505C \u2192 startAgentRun\uFF08\u672C\u6BB5\uFF09\u3002`;
710
718
  var MENU_USAGE_INSTRUCTIONS = `--- \u4EA4\u4E92\u8BF4\u660E ---
711
719
  \u6240\u6709\u7528\u6237\u8F93\u5165\u5747\u4E3A\u7EAF\u6587\u672C\u6D88\u606F\uFF0C\u76F4\u63A5\u7406\u89E3\u5373\u53EF\uFF0C\u4E0D\u8981\u5728\u56DE\u590D\u4E2D\u63D0\u53CA\u6309\u94AE\u3001\u83DC\u5355\u3001\u754C\u9762\u7B49 UI \u5143\u7D20\u3002
712
720
 
@@ -797,10 +805,16 @@ var isBrowser = typeof window !== "undefined";
797
805
  var TOOL_GUIDED_SECTIONS = [
798
806
  {
799
807
  id: "agentOrchestration",
800
- triggerTools: ["callAgent", "runStreamingAgent"],
808
+ triggerTools: [
809
+ "callAgent",
810
+ "runStreamingAgent",
811
+ "startAgentRun",
812
+ "controlAgentRun"
813
+ ],
801
814
  build: (tools) => [
802
815
  AGENT_ORCHESTRATION_INSTRUCTIONS,
803
- tools.includes("runStreamingAgent") ? PAGE_BUILDER_HANDOFF_INSTRUCTIONS : ""
816
+ tools.includes("runStreamingAgent") ? PAGE_BUILDER_HANDOFF_INSTRUCTIONS : "",
817
+ tools.includes("startAgentRun") || tools.includes("controlAgentRun") ? AGENT_ORCHESTRATION_RUN_INSTRUCTIONS : ""
804
818
  ].filter(Boolean).join("\n\n")
805
819
  },
806
820
  { id: "menuUsage", triggerTools: ["ui_ask_choice"], build: () => MENU_USAGE_INSTRUCTIONS },
@@ -1348,11 +1362,21 @@ var generateRequestBody = ({
1348
1362
  };
1349
1363
 
1350
1364
  // packages/ai/chat/serverProxyRetry.ts
1351
- var RETRYABLE_SERVER_PROXY_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
1352
1365
  var DEFAULT_SERVER_PROXY_RETRY_AFTER_MS = 1500;
1353
1366
  var MAX_SERVER_PROXY_RETRIES = 2;
1354
1367
  var MAX_STATUS_RETRIES = 1;
1355
- var resolveServerProxyRetryAfterMs = (response) => parseRetryAfterHeaderMs(response.headers.get("Retry-After")) ?? DEFAULT_SERVER_PROXY_RETRY_AFTER_MS;
1368
+ var MAX_SERVER_DRAIN_STATUS_RETRIES = 30;
1369
+ var readRetryableResponseBody = async (response) => {
1370
+ try {
1371
+ return await response.clone().json();
1372
+ } catch {
1373
+ return null;
1374
+ }
1375
+ };
1376
+ var resolveServerProxyRetryAfterMs = (response, body) => parseRetryAfterHeaderMs(response.headers.get("Retry-After")) ?? normalizeNonNegativeMs(
1377
+ body?.retryAfterMs,
1378
+ DEFAULT_SERVER_PROXY_RETRY_AFTER_MS
1379
+ );
1356
1380
  var isRetryableServerProxyFetchError = (error) => {
1357
1381
  if (!error || isAbortError(error)) return false;
1358
1382
  const message = typeof error?.message === "string" ? error.message : String(error);
@@ -1387,23 +1411,33 @@ var performServerProxyFetchWithRetry = async ({
1387
1411
  signal,
1388
1412
  logPrefix = "[fetchWithServerProxy]"
1389
1413
  }) => {
1390
- for (let attempt = 0; attempt <= MAX_SERVER_PROXY_RETRIES; attempt += 1) {
1414
+ let networkRetries = 0;
1415
+ let statusRetries = 0;
1416
+ while (true) {
1391
1417
  try {
1392
1418
  const response = await execute();
1393
- if (attempt < MAX_STATUS_RETRIES && RETRYABLE_SERVER_PROXY_STATUSES.has(response.status)) {
1394
- const retryAfterMs = resolveServerProxyRetryAfterMs(response);
1419
+ const responseBody = response.status === 503 ? await readRetryableResponseBody(response) : null;
1420
+ const isCoreDraining = response.status === 503 && responseBody?.reason === CORE_DRAIN_REASON;
1421
+ const maxStatusRetries = isCoreDraining ? MAX_SERVER_DRAIN_STATUS_RETRIES : MAX_STATUS_RETRIES;
1422
+ if (statusRetries < maxStatusRetries && isGatewayHttpStatus(response.status)) {
1423
+ statusRetries += 1;
1424
+ const retryAfterMs = resolveServerProxyRetryAfterMs(
1425
+ response,
1426
+ responseBody
1427
+ );
1395
1428
  console.warn(
1396
- `${logPrefix} \u68C0\u6D4B\u5230${response.status}\u72B6\u6001\uFF0C${retryAfterMs}ms\u540E\u91CD\u8BD5\u4E00\u6B21...`
1429
+ `${logPrefix} \u68C0\u6D4B\u5230${response.status}\u72B6\u6001\uFF0C${retryAfterMs}ms\u540E\u91CD\u8BD5...`
1397
1430
  );
1398
1431
  await waitForServerProxyRetry(retryAfterMs, signal);
1399
1432
  continue;
1400
1433
  }
1401
1434
  return response;
1402
1435
  } catch (error) {
1403
- if (attempt < MAX_SERVER_PROXY_RETRIES && isRetryableServerProxyFetchError(error)) {
1404
- const retryDelay = (attempt + 1) * 1e3;
1436
+ if (networkRetries < MAX_SERVER_PROXY_RETRIES && isRetryableServerProxyFetchError(error)) {
1437
+ networkRetries += 1;
1438
+ const retryDelay = networkRetries * 1e3;
1405
1439
  console.warn(
1406
- `${logPrefix} \u68C0\u6D4B\u5230\u7F51\u7EDC\u77AC\u65AD\uFF0C${retryDelay}ms\u540E\u91CD\u8BD5(\u7B2C${attempt + 1}\u6B21)...`,
1440
+ `${logPrefix} \u68C0\u6D4B\u5230\u7F51\u7EDC\u77AC\u65AD\uFF0C${retryDelay}ms\u540E\u91CD\u8BD5(\u7B2C${networkRetries}\u6B21)...`,
1407
1441
  error
1408
1442
  );
1409
1443
  await waitForServerProxyRetry(retryDelay, signal);
@@ -1412,7 +1446,6 @@ var performServerProxyFetchWithRetry = async ({
1412
1446
  throw error;
1413
1447
  }
1414
1448
  }
1415
- throw new Error("server proxy retry exhausted unexpectedly");
1416
1449
  };
1417
1450
 
1418
1451
  // packages/ai/chat/resolveDirectRequestApiKey.ts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  trimTrailingSlash
3
- } from "./chunk-JRKKFRAV.js";
3
+ } from "./chunk-YTBMA7NO.js";
4
4
  import {
5
5
  asTrimmedLowercaseString
6
6
  } from "./chunk-QSJ3HFEF.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  selectCurrentServer
3
- } from "./chunk-4SIMLBEU.js";
3
+ } from "./chunk-3NSIQZZ6.js";
4
4
  import {
5
5
  patch
6
- } from "./chunk-BE2OOJ5P.js";
6
+ } from "./chunk-O26GI2JP.js";
7
7
  import {
8
8
  selectIdentityToken
9
- } from "./chunk-UTLZINAP.js";
9
+ } from "./chunk-OOM6SJNR.js";
10
10
  import {
11
11
  getIsDesktopApp
12
12
  } from "./chunk-OOSFSFMA.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getRuntimeServerContext,
3
3
  scheduleDeleteReplication
4
- } from "./chunk-UTLZINAP.js";
4
+ } from "./chunk-OOM6SJNR.js";
5
5
  import {
6
6
  fetchFromClientDb
7
7
  } from "./chunk-OOSFSFMA.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clearCliLocalRuntimePreparedAgentCache
3
- } from "./chunk-EXXFGKF7.js";
3
+ } from "./chunk-X2S7JTIG.js";
4
4
  import {
5
5
  getReadableCliDb
6
6
  } from "./chunk-W4NVOSFF.js";
@@ -12,7 +12,7 @@ import {
12
12
  resolveAgentRecordFromHybridStore,
13
13
  sanitizeAgentRecordForCliOutput,
14
14
  writeAgentRecord
15
- } from "./chunk-OR2XR25C.js";
15
+ } from "./chunk-AEZAORLG.js";
16
16
  import {
17
17
  resolveCliAgentKeyInput
18
18
  } from "./chunk-VHBWHNVT.js";
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-JEXVIMYZ.js";
4
4
  import {
5
5
  prepareTools
6
- } from "./chunk-2O4IZNTG.js";
6
+ } from "./chunk-PXQN7IBQ.js";
7
+ import {
8
+ performFetchRequest
9
+ } from "./chunk-EVZKZF32.js";
7
10
  import {
8
11
  getPublicImageAgentMode
9
12
  } from "./chunk-VIDPVFP3.js";
10
- import {
11
- performFetchRequest
12
- } from "./chunk-TNPIMII7.js";
13
13
  import {
14
14
  createSSEParser,
15
15
  createToolRunId,
@@ -20,7 +20,7 @@ import {
20
20
  toolRunSetPending,
21
21
  toolRunStarted,
22
22
  toolRunSucceeded
23
- } from "./chunk-TYSCFY6S.js";
23
+ } from "./chunk-2W2VYVI5.js";
24
24
  import {
25
25
  addToolMessage,
26
26
  getModelInfo,
@@ -28,13 +28,19 @@ import {
28
28
  messageStreaming,
29
29
  selectCurrentSpaceId,
30
30
  updateToolMessage
31
- } from "./chunk-PIVFPOW6.js";
31
+ } from "./chunk-5MOUAAMK.js";
32
32
  import {
33
33
  streamAgentChatTurn
34
- } from "./chunk-I5URP43I.js";
34
+ } from "./chunk-Q3UKJVU4.js";
35
+ import {
36
+ selectCurrentServer
37
+ } from "./chunk-3NSIQZZ6.js";
38
+ import {
39
+ write
40
+ } from "./chunk-O26GI2JP.js";
35
41
  import {
36
42
  EMPTY_ASSISTANT_REPAIR_PROMPT
37
- } from "./chunk-6SLCD4RB.js";
43
+ } from "./chunk-S3GS2PRL.js";
38
44
  import {
39
45
  createThinkParserState,
40
46
  flushThinkParser,
@@ -46,6 +52,11 @@ import {
46
52
  import {
47
53
  isNoloHostedProvider
48
54
  } from "./chunk-IWX4UW2E.js";
55
+ import {
56
+ createDialogMessageKeyAndId,
57
+ dialogMessageKey,
58
+ toTrimmedString
59
+ } from "./chunk-O4BU24WZ.js";
49
60
  import {
50
61
  extractCustomId
51
62
  } from "./chunk-DFFIZ25G.js";
@@ -57,33 +68,22 @@ import {
57
68
  import {
58
69
  toErrorMessage
59
70
  } from "./chunk-HNMXYYJR.js";
60
- import {
61
- selectCurrentServer
62
- } from "./chunk-4SIMLBEU.js";
63
- import {
64
- write
65
- } from "./chunk-BE2OOJ5P.js";
66
- import {
67
- createDialogMessageKeyAndId,
68
- dialogMessageKey,
69
- toTrimmedString
70
- } from "./chunk-O4BU24WZ.js";
71
71
  import {
72
72
  createAsyncThunk,
73
73
  selectIdentityToken
74
- } from "./chunk-UTLZINAP.js";
74
+ } from "./chunk-OOM6SJNR.js";
75
75
  import {
76
76
  isAbortError
77
77
  } from "./chunk-OOSFSFMA.js";
78
78
  import {
79
79
  asTrimmedString
80
80
  } from "./chunk-3EUW3WEO.js";
81
- import {
82
- asOptionalTrimmedString
83
- } from "./chunk-G3SUCT4W.js";
84
81
  import {
85
82
  isRecord
86
83
  } from "./chunk-KUG52IAP.js";
84
+ import {
85
+ asOptionalTrimmedString
86
+ } from "./chunk-G3SUCT4W.js";
87
87
 
88
88
  // packages/integrations/openai/filterAndCleanMessages.ts
89
89
  var isValidMessagePart = (part) => {