nolo-cli 0.80.0 → 0.81.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 (61) hide show
  1. package/{_executeModel-UXVEB3GO.js → _executeModel-JIG7MRXQ.js} +14 -14
  2. package/{agentDeleteCommand-OODHSL4K.js → agentDeleteCommand-THAZ5GQS.js} +3 -3
  3. package/{agentEmailCommands-3R73WSCD.js → agentEmailCommands-A7T7AJA4.js} +16 -16
  4. package/{agentListCommands-TBTEXV2E.js → agentListCommands-BRZFEJQM.js} +6 -6
  5. package/{agentMachineCommands-3GKE6ZHG.js → agentMachineCommands-DM4N5PK3.js} +4 -4
  6. package/{agentRecordCommands-3664GLRE.js → agentRecordCommands-TTAEMNHB.js} +16 -16
  7. package/{agentRunCommand-YNSEOBTR.js → agentRunCommand-JVSTGVG2.js} +16 -16
  8. package/{agentRunControl-XLGD3UZ5.js → agentRunControl-WCTKX5VL.js} +2 -2
  9. package/{agentRuntimeLocal-5BX6PI4X.js → agentRuntimeLocal-73CVIWBB.js} +3 -3
  10. package/{agentSlice-KTVOEUDX.js → agentSlice-6X4JL2E3.js} +1 -1
  11. package/{appDeleteCommands-UNTBD55Y.js → appDeleteCommands-S7CK4OYL.js} +3 -3
  12. package/{appDeployCommands-LOF4JNBZ.js → appDeployCommands-U6TMS5GO.js} +3 -3
  13. package/{appDeployStatusCommands-MMLE6BDW.js → appDeployStatusCommands-DTNQJ3LJ.js} +3 -3
  14. package/{appGetCommands-WFJAJK6B.js → appGetCommands-3SHZEQD5.js} +3 -3
  15. package/{appListCommands-NC265RGX.js → appListCommands-E2ZMIUB6.js} +3 -3
  16. package/{chatQueueReduxAdapter-4YQF4NHY.js → chatQueueReduxAdapter-LAQEZQKE.js} +2 -2
  17. package/{chunk-NTW5GWDM.js → chunk-3VNWWVKB.js} +2 -0
  18. package/{chunk-EFVDQUCT.js → chunk-3WD6RUUJ.js} +2 -2
  19. package/{chunk-DWUCB2A3.js → chunk-42V6BK2E.js} +1 -1
  20. package/{chunk-GFD4ALW3.js → chunk-54ADB4W7.js} +1 -1
  21. package/{chunk-D2P6UDPQ.js → chunk-6FVRQBRR.js} +14 -8
  22. package/{chunk-FLLFOP5L.js → chunk-7OLPQSMQ.js} +1 -1
  23. package/{chunk-35EWBHJO.js → chunk-ESWUWEFS.js} +3 -3
  24. package/{chunk-CJCJF5XB.js → chunk-FDTR4QJ6.js} +4 -2
  25. package/{chunk-SQZDZXP5.js → chunk-HWIZU4OL.js} +1 -1
  26. package/{chunk-LIIKM7DD.js → chunk-JCIHVIVG.js} +5 -5
  27. package/{chunk-LBEDNSMY.js → chunk-K4YGZD3P.js} +8 -8
  28. package/{chunk-TRCMIJA7.js → chunk-LXF6XQDT.js} +36 -22
  29. package/{chunk-OA6Q2A4I.js → chunk-LZIWMYX4.js} +78 -18
  30. package/{chunk-NKRYKK7T.js → chunk-R2B3MIZA.js} +2 -2
  31. package/{chunk-IAO6JBYW.js → chunk-RG6JBBX5.js} +5 -1
  32. package/{chunk-H3PIH2EO.js → chunk-SQQVLHMH.js} +3 -3
  33. package/{chunk-DEUUPHOO.js → chunk-TDRTS7QW.js} +1 -1
  34. package/{chunk-4OZYL5FG.js → chunk-TZJJ77KQ.js} +99 -13
  35. package/{chunk-CPH3W5A7.js → chunk-WGR3J4Q6.js} +86 -1
  36. package/{chunk-HMPEO3ZE.js → chunk-Y5HW6GM2.js} +2 -2
  37. package/{chunk-MPV6E6WR.js → chunk-YVIV7WT4.js} +156 -32
  38. package/{chunk-MWAO7TZZ.js → chunk-ZWUOR654.js} +37 -5
  39. package/{contentThunks-2USKJBI4.js → contentThunks-ATLWNC2D.js} +3 -3
  40. package/{cooldownCommands-BSCH2W7P.js → cooldownCommands-REAWYVTY.js} +2 -2
  41. package/{createAgentAutomationAction-NTLU42X2.js → createAgentAutomationAction-QYYWTVUR.js} +3 -3
  42. package/{createDialogAction-UCYF4BUN.js → createDialogAction-7I5VGWCR.js} +4 -4
  43. package/{createPageAction-QFGUGZ5M.js → createPageAction-WNURYCWU.js} +3 -3
  44. package/{dialogCommands-X4OB6SC6.js → dialogCommands-RILHDRQ5.js} +3 -3
  45. package/{dialogSlice-HQFQIQDZ.js → dialogSlice-W5BYELVR.js} +2 -2
  46. package/{docCreateCommands-DFST4PFR.js → docCreateCommands-GSTPU7SG.js} +3 -3
  47. package/{docDeleteCommands-V37JZOSP.js → docDeleteCommands-2FC3LSUT.js} +3 -3
  48. package/{docReadCommands-Z64VDPDQ.js → docReadCommands-27POBA34.js} +3 -3
  49. package/{docStore-GVWEDN5E.js → docStore-7LAHBFP2.js} +1 -1
  50. package/{docUpdateCommands-I6FB6ENK.js → docUpdateCommands-U4II6VCO.js} +3 -3
  51. package/{handleSendMessageAction-TLB2SAU4.js → handleSendMessageAction-SKMJMVRU.js} +2 -2
  52. package/index.js +47 -47
  53. package/{machineCommands-PV5XA7UF.js → machineCommands-S2RNYKVJ.js} +16 -16
  54. package/{machineWsRunDispatch-W2DPC7TZ.js → machineWsRunDispatch-JC44LBLP.js} +16 -16
  55. package/package.json +1 -1
  56. package/{readlineWorkspace-PHZXJKJM.js → readlineWorkspace-VZSBXUH4.js} +17 -17
  57. package/{runAgentClientLoop-26DG6ZEY.js → runAgentClientLoop-ZYENU7GH.js} +12 -12
  58. package/{spaceCommands-3QH2QFNW.js → spaceCommands-QB3NNEMN.js} +3 -3
  59. package/{streamAgentChatTurn-BY7IPY5C.js → streamAgentChatTurn-43GPPQSN.js} +13 -13
  60. package/{tools-4Y2EYH5D.js → tools-SX6Y4STZ.js} +9 -9
  61. package/{updateDialogTitleAction-2S4DCP35.js → updateDialogTitleAction-VAKA4ZNY.js} +3 -3
@@ -21,6 +21,7 @@ import {
21
21
  commitRunRecordClaim,
22
22
  findRunRecord,
23
23
  gcRunRecords,
24
+ isRunTerminalStatus,
24
25
  popAllQueueEntries,
25
26
  queryRunRecords,
26
27
  releaseRunRecordAck,
@@ -29,7 +30,7 @@ import {
29
30
  terminateRunProcess,
30
31
  transitionRunToTerminal,
31
32
  withQueueLock
32
- } from "./chunk-CPH3W5A7.js";
33
+ } from "./chunk-WGR3J4Q6.js";
33
34
  import {
34
35
  clearCredentialAvailability,
35
36
  markCredentialUnavailable,
@@ -37,7 +38,7 @@ import {
37
38
  readCredentialEntry,
38
39
  recordCredentialProbe,
39
40
  resolveCredentialKeyWithFallback
40
- } from "./chunk-DWUCB2A3.js";
41
+ } from "./chunk-42V6BK2E.js";
41
42
  import {
42
43
  buildLocalAgentLookupKeys
43
44
  } from "./chunk-Z77CRGTW.js";
@@ -60,7 +61,7 @@ import {
60
61
  import {
61
62
  inlineImageUrlsForCustomProvider,
62
63
  prepareTools
63
- } from "./chunk-HMPEO3ZE.js";
64
+ } from "./chunk-Y5HW6GM2.js";
64
65
  import {
65
66
  getServerProviderSecret
66
67
  } from "./chunk-HS7MLR74.js";
@@ -69,6 +70,7 @@ import {
69
70
  CONTROL_AGENT_RUN_ACTIONS,
70
71
  buildControlAgentRunFunctionSchema,
71
72
  buildStartAgentRunFunctionSchema,
73
+ checkCredentialFanout,
72
74
  deleteMemoryFunctionSchema,
73
75
  queryMemoryFunctionSchema,
74
76
  readXPostFunc,
@@ -78,7 +80,7 @@ import {
78
80
  rememberMemoryFunctionSchema,
79
81
  resolveAgentRequiredPackIds,
80
82
  setTodoListFunc
81
- } from "./chunk-4OZYL5FG.js";
83
+ } from "./chunk-TZJJ77KQ.js";
82
84
  import {
83
85
  fetchWithTransientRetry,
84
86
  isTransientFetchError
@@ -94,7 +96,10 @@ import {
94
96
  isAgentRunTerminalStatus,
95
97
  resolveRunLabel,
96
98
  shortRunId
97
- } from "./chunk-NTW5GWDM.js";
99
+ } from "./chunk-3VNWWVKB.js";
100
+ import {
101
+ deriveCredentialGroup
102
+ } from "./chunk-RG6JBBX5.js";
98
103
  import {
99
104
  getModelPricing
100
105
  } from "./chunk-EYAQT56M.js";
@@ -104,14 +109,14 @@ import {
104
109
  prepareTokenUsageData,
105
110
  resolveBuiltinPlatformAgentConfig,
106
111
  runKeyed
107
- } from "./chunk-LBEDNSMY.js";
112
+ } from "./chunk-K4YGZD3P.js";
108
113
  import {
109
114
  BUILTIN_DIALOG_LLM_CHAT_FALLBACK_MODEL,
110
115
  BUILTIN_TITLE_LLM_CONFIG
111
116
  } from "./chunk-MC4XLIJ7.js";
112
117
  import {
113
118
  fetchServerSyncedCredential
114
- } from "./chunk-H3PIH2EO.js";
119
+ } from "./chunk-SQQVLHMH.js";
115
120
  import {
116
121
  require_date_fns
117
122
  } from "./chunk-M76ECQRD.js";
@@ -160,11 +165,12 @@ import {
160
165
  parseSseDataLineObject,
161
166
  parseSyncServersEnv,
162
167
  parseUpstreamErrorBody,
168
+ readDevinUpstreamFailure,
163
169
  resolveAntigravityFinishReason,
164
170
  resolveOpenAiCompatibleProviderConfig,
165
171
  shouldUseGeminiNativeToolRoute,
166
172
  summarizeToolArguments
167
- } from "./chunk-MWAO7TZZ.js";
173
+ } from "./chunk-ZWUOR654.js";
168
174
  import {
169
175
  PlatformStreamInterruptedError,
170
176
  buildPlatformChatCompletionRequest,
@@ -199,7 +205,7 @@ import {
199
205
  mergeAvailabilityDeadline,
200
206
  resolveAvailabilityAction,
201
207
  resolveCooldownGate
202
- } from "./chunk-CJCJF5XB.js";
208
+ } from "./chunk-FDTR4QJ6.js";
203
209
  import {
204
210
  isAntigravityOAuthAgent
205
211
  } from "./chunk-UZGQNTVW.js";
@@ -8079,6 +8085,37 @@ function processCursorServerMessage(msg, state, onTextDelta, onReasoningDelta) {
8079
8085
  state.outputTokens += tokens;
8080
8086
  }
8081
8087
  }
8088
+ function attachCursorUpstreamFailure(error, failure) {
8089
+ if (failure) {
8090
+ error.cursorUpstreamFailure = failure;
8091
+ }
8092
+ return error;
8093
+ }
8094
+ function readCursorUpstreamFailure(error) {
8095
+ if (!error || typeof error !== "object") return void 0;
8096
+ const failure = error.cursorUpstreamFailure;
8097
+ if (!failure || typeof failure !== "object") return void 0;
8098
+ if (typeof failure.status !== "number" || !Number.isFinite(failure.status)) {
8099
+ return void 0;
8100
+ }
8101
+ return failure;
8102
+ }
8103
+ function buildCursorGrpcTrailerError(trailers) {
8104
+ const status = trailers["grpc-status"];
8105
+ if (!status || String(status) === "0") return null;
8106
+ const rawMessage = String(trailers["grpc-message"] || "");
8107
+ let message;
8108
+ try {
8109
+ message = decodeURIComponent(rawMessage);
8110
+ } catch {
8111
+ message = rawMessage;
8112
+ }
8113
+ const statusText = String(status);
8114
+ return attachCursorUpstreamFailure(
8115
+ new Error(`Cursor gRPC error ${statusText}: ${message}`),
8116
+ statusText === "8" || statusText.toLowerCase() === "resource_exhausted" ? { status: 429, body: { code: "resource_exhausted", message } } : void 0
8117
+ );
8118
+ }
8082
8119
  async function streamCursorChat(messages, options) {
8083
8120
  const baseUrl = options.baseUrl || CURSOR_API_URL;
8084
8121
  const clientVersion = options.clientVersion || CURSOR_CLIENT_VERSION;
@@ -8176,14 +8213,9 @@ async function streamCursorChat(messages, options) {
8176
8213
  }
8177
8214
  });
8178
8215
  h2Request.on("trailers", (trailers) => {
8179
- const status = trailers["grpc-status"];
8180
- const msg = trailers["grpc-message"];
8181
- if (status && status !== "0") {
8182
- h2Completion.reject(
8183
- new Error(
8184
- `Cursor gRPC error ${status}: ${decodeURIComponent(String(msg || ""))}`
8185
- )
8186
- );
8216
+ const error = buildCursorGrpcTrailerError(trailers);
8217
+ if (error) {
8218
+ h2Completion.reject(error);
8187
8219
  }
8188
8220
  });
8189
8221
  h2Request.on("end", () => {
@@ -9254,7 +9286,7 @@ function assertWithinLocalToolBudget(args) {
9254
9286
 
9255
9287
  // packages/cli/client/providerResolution/cursorTransport.ts
9256
9288
  var resolveCursorTransport = async (ctx) => {
9257
- const { agentConfig, deps, workspaceRoot, additionalToolNames, buildProviderOpenAiTools, apiKeyRefResolver, activeAgentToolNames, localToolExecutors } = ctx;
9289
+ const { agentConfig, deps, workspaceRoot, additionalToolNames, buildProviderOpenAiTools, apiKeyRefResolver, activeAgentToolNames, localToolExecutors, recordLocalAvailability } = ctx;
9258
9290
  if (isCursorOAuthAgent(agentConfig)) {
9259
9291
  const accessToken = await apiKeyRefResolver("cursor");
9260
9292
  if (!accessToken) {
@@ -9330,15 +9362,24 @@ var resolveCursorTransport = async (ctx) => {
9330
9362
  toolCount: tools.length,
9331
9363
  requestedToolNames
9332
9364
  });
9333
- const result = await cursorProvider.complete(messages, options);
9334
- logLocalRuntimeDiagnostic("provider.request.result", {
9335
- agentKey: agentConfig.key,
9336
- transport: "cursor-connect",
9337
- ok: true,
9338
- contentChars: (result.content ?? "").length,
9339
- toolCallCount: result.tool_calls?.length ?? 0
9340
- });
9341
- return result;
9365
+ try {
9366
+ const result = await cursorProvider.complete(messages, options);
9367
+ await recordLocalAvailability(200);
9368
+ logLocalRuntimeDiagnostic("provider.request.result", {
9369
+ agentKey: agentConfig.key,
9370
+ transport: "cursor-connect",
9371
+ ok: true,
9372
+ contentChars: (result.content ?? "").length,
9373
+ toolCallCount: result.tool_calls?.length ?? 0
9374
+ });
9375
+ return result;
9376
+ } catch (error) {
9377
+ const failure = readCursorUpstreamFailure(error);
9378
+ if (failure) {
9379
+ await recordLocalAvailability(failure.status, failure.body);
9380
+ }
9381
+ throw error;
9382
+ }
9342
9383
  }
9343
9384
  };
9344
9385
  }
@@ -9352,7 +9393,8 @@ var resolveDevinTransport = async (ctx) => {
9352
9393
  apiKeyRefResolver,
9353
9394
  deps,
9354
9395
  buildProviderOpenAiTools,
9355
- additionalToolNames
9396
+ additionalToolNames,
9397
+ recordLocalAvailability
9356
9398
  } = ctx;
9357
9399
  if (isDevinOAuthAgent(agentConfig)) {
9358
9400
  const accessToken = await apiKeyRefResolver("devin");
@@ -9391,7 +9433,17 @@ var resolveDevinTransport = async (ctx) => {
9391
9433
  return {
9392
9434
  model,
9393
9435
  complete: async (messages, options) => {
9394
- return devinProvider.complete(messages, options);
9436
+ try {
9437
+ const result = await devinProvider.complete(messages, options);
9438
+ await recordLocalAvailability(200);
9439
+ return result;
9440
+ } catch (error) {
9441
+ const failure = readDevinUpstreamFailure(error);
9442
+ if (failure) {
9443
+ await recordLocalAvailability(failure.status, failure.body);
9444
+ }
9445
+ throw error;
9446
+ }
9395
9447
  }
9396
9448
  };
9397
9449
  }
@@ -9498,7 +9550,7 @@ var resolveDirectOpenAiCompatibleTransport = async (ctx) => {
9498
9550
 
9499
9551
  // packages/cli/client/providerResolution/geminiNativeToolTransport.ts
9500
9552
  var resolveGeminiNativeToolTransport = async (ctx) => {
9501
- const { agentConfig, deps, fetchImpl, additionalToolNames, buildProviderOpenAiTools, apiKeyRefResolver, credentialBroker, syncFetcher } = ctx;
9553
+ const { agentConfig, deps, fetchImpl, additionalToolNames, buildProviderOpenAiTools, apiKeyRefResolver, credentialBroker, syncFetcher, recordLocalAvailability } = ctx;
9502
9554
  if (shouldUsePlatformChatProvider(deps.env, agentConfig) && isGemini3Model(agentConfig.model ?? "") && agentConfig.provider === "google") {
9503
9555
  const providerConfig = await resolvePlatformChatProviderConfig({
9504
9556
  agentConfig,
@@ -9565,6 +9617,7 @@ var resolveGeminiNativeToolTransport = async (ctx) => {
9565
9617
  status: res.status,
9566
9618
  error: errText.slice(0, 200)
9567
9619
  });
9620
+ await recordLocalAvailability(res.status, errText);
9568
9621
  throw new Error(
9569
9622
  `gemini native tool provider failed: HTTP ${res.status} ${errText.slice(0, 500)}`
9570
9623
  );
@@ -9590,6 +9643,7 @@ var resolveGeminiNativeToolTransport = async (ctx) => {
9590
9643
  contentChars: text.length,
9591
9644
  toolCallCount: toolCalls.length
9592
9645
  });
9646
+ await recordLocalAvailability(200);
9593
9647
  return result;
9594
9648
  }
9595
9649
  };
@@ -11419,6 +11473,12 @@ function buildRunStatusPayload(reconciled, deps, opts = {}) {
11419
11473
  endedAt: reconciled.endedAt ?? null,
11420
11474
  exitCode: reconciled.exitCode ?? null,
11421
11475
  ...reconciled.failureReason ? { failureReason: reconciled.failureReason } : {},
11476
+ // 结构化失败分类 + 可重试性:编排者据此决策,不再肉读 logTail。
11477
+ ...reconciled.failureClass ? { failureClass: reconciled.failureClass } : {},
11478
+ ...typeof reconciled.retryable === "boolean" ? { retryable: reconciled.retryable } : {},
11479
+ // 日志落盘路径始终暴露:stalled/failed 且 dialogId 缺失(如 ephemeral)
11480
+ // 时 logTail 只能靠它读,不能只留在进程内存。
11481
+ ...reconciled.logPath ? { logPath: reconciled.logPath } : {},
11422
11482
  ...typeof reconciled.toolCallCount === "number" ? { toolCallCount: reconciled.toolCallCount } : {},
11423
11483
  ...reconciled.lastAssistantText ? { lastAssistantText: reconciled.lastAssistantText } : {},
11424
11484
  // Non-ephemeral runs expose dialogId so the caller can read the
@@ -11453,6 +11513,39 @@ function buildRunStatusPayload(reconciled, deps, opts = {}) {
11453
11513
  }
11454
11514
  };
11455
11515
  }
11516
+ async function assertCredentialFanoutAllowed(deps, args) {
11517
+ let candidateGroup;
11518
+ if (deps.resolveAgentCredentialGroup) {
11519
+ try {
11520
+ candidateGroup = await deps.resolveAgentCredentialGroup(args.agentKey);
11521
+ } catch {
11522
+ candidateGroup = void 0;
11523
+ }
11524
+ }
11525
+ if (!candidateGroup && typeof args.credentialGroup === "string" && args.credentialGroup.trim()) {
11526
+ candidateGroup = args.credentialGroup.trim();
11527
+ }
11528
+ const { batchId, parentDialogId } = args;
11529
+ if (!batchId && !parentDialogId) return candidateGroup;
11530
+ const active = queryRunRecords({ limit: 500 }, deps).runs.filter((record) => {
11531
+ if (isRunTerminalStatus(record.status)) return false;
11532
+ if (batchId && record.batchId === batchId) return true;
11533
+ if (parentDialogId && record.parentDialogId === parentDialogId) return true;
11534
+ return false;
11535
+ }).map((record) => ({
11536
+ runId: record.runId,
11537
+ agentKey: record.agentKey,
11538
+ credentialGroup: record.credentialGroup
11539
+ }));
11540
+ if (active.length === 0) return candidateGroup;
11541
+ const verdict = checkCredentialFanout({
11542
+ active,
11543
+ candidate: { agentKey: args.agentKey, credentialGroup: candidateGroup },
11544
+ allowUnknownCredential: args.allowUnknownCredential === true
11545
+ });
11546
+ if (!verdict.allowed) throw new Error(verdict.message);
11547
+ return candidateGroup;
11548
+ }
11456
11549
  function createCliStartAgentRunExecutor(deps = {}) {
11457
11550
  return async (call) => {
11458
11551
  const args = parseCallArgs(call);
@@ -11475,6 +11568,14 @@ function createCliStartAgentRunExecutor(deps = {}) {
11475
11568
  ];
11476
11569
  const agentName = typeof args.agentName === "string" && args.agentName.trim() ? args.agentName.trim() : typeof args.name === "string" && args.name.trim() ? args.name.trim() : void 0;
11477
11570
  const batchId = typeof args.batchId === "string" && args.batchId.trim() ? args.batchId.trim() : void 0;
11571
+ const parentDialogId = typeof args.parentDialogId === "string" && args.parentDialogId.trim() ? args.parentDialogId.trim() : void 0;
11572
+ const credentialGroup = await assertCredentialFanoutAllowed(deps, {
11573
+ agentKey,
11574
+ ...batchId ? { batchId } : {},
11575
+ ...parentDialogId ? { parentDialogId } : {},
11576
+ ...typeof args.credentialGroup === "string" && args.credentialGroup.trim() ? { credentialGroup: args.credentialGroup.trim() } : {},
11577
+ allowUnknownCredential: args.allowUnknownCredential === true
11578
+ });
11478
11579
  const dodCommands = Array.isArray(args.dodCommands) ? args.dodCommands.filter((c) => typeof c === "string" && c.trim().length > 0).map((c) => c.trim()) : typeof args.dod === "string" && args.dod.trim().length > 0 ? [args.dod.trim()] : Array.isArray(args.dod) ? args.dod.filter((c) => typeof c === "string" && c.trim().length > 0).map((c) => c.trim()) : void 0;
11479
11580
  const { runId, batchId: resolvedBatchId } = await spawnLocalBackgroundRun(
11480
11581
  {
@@ -11484,7 +11585,8 @@ function createCliStartAgentRunExecutor(deps = {}) {
11484
11585
  agentKey,
11485
11586
  ...agentName ? { agentName } : {},
11486
11587
  ...batchId ? { batchId } : {},
11487
- ...typeof args.parentDialogId === "string" && args.parentDialogId.trim() ? { parentDialogId: args.parentDialogId.trim() } : {},
11588
+ ...credentialGroup ? { credentialGroup } : {},
11589
+ ...parentDialogId ? { parentDialogId } : {},
11488
11590
  ...dodCommands && dodCommands.length > 0 ? { dodCommands } : {},
11489
11591
  cwd: deps.cwd ?? process.cwd(),
11490
11592
  message,
@@ -11570,6 +11672,8 @@ async function spawnContinuationRun(reconciled, userInput, deps) {
11570
11672
  ...agentName ? { agentName } : {},
11571
11673
  ...reconciled.batchId ? { batchId: reconciled.batchId } : {},
11572
11674
  ...reconciled.parentDialogId ? { parentDialogId: reconciled.parentDialogId } : {},
11675
+ // 续跑继承原 run 的凭证组(同一 agent),供并发扇出守卫判定。
11676
+ ...reconciled.credentialGroup ? { credentialGroup: reconciled.credentialGroup } : {},
11573
11677
  cwd: reconciled.cwd ?? deps.cwd ?? process.cwd(),
11574
11678
  message: userInput,
11575
11679
  ...reconciled.ephemeral ? { ephemeral: true } : {},
@@ -12168,7 +12272,8 @@ function buildLocalToolExecutors(args) {
12168
12272
  startAgentRun: createCliStartAgentRunExecutor({
12169
12273
  env: args.env,
12170
12274
  cliEntrypoint: args.cliEntrypoint,
12171
- cwd: args.workspaceRoot
12275
+ cwd: args.workspaceRoot,
12276
+ ...args.resolveAgentCredentialGroup ? { resolveAgentCredentialGroup: args.resolveAgentCredentialGroup } : {}
12172
12277
  }),
12173
12278
  controlAgentRun: createCliControlAgentRunExecutor({
12174
12279
  env: args.env
@@ -13029,6 +13134,23 @@ function createCliLocalRuntimeAdapter(deps) {
13029
13134
  const localToolUsage = /* @__PURE__ */ new Map();
13030
13135
  const buildProviderOpenAiTools = deps.buildProviderOpenAiTools ?? buildOpenAiTools;
13031
13136
  const additionalToolNames = deps.pastedTextStore ? ["readPastedText"] : [];
13137
+ const resolveAgentCredentialGroup = async (agentRef) => {
13138
+ try {
13139
+ const record = await readAgentFromStore({
13140
+ agentRef,
13141
+ store: await getOrCreateSharedStore(deps),
13142
+ userId
13143
+ });
13144
+ if (!record || typeof record !== "object") return void 0;
13145
+ const rec = record;
13146
+ const existing = typeof rec.credentialGroup === "string" && rec.credentialGroup.trim() ? rec.credentialGroup.trim() : void 0;
13147
+ if (existing) return existing;
13148
+ const ref = typeof rec.apiKeyRef === "string" && rec.apiKeyRef.trim() ? rec.apiKeyRef : typeof rec.credentialRef === "string" && rec.credentialRef.trim() ? rec.credentialRef : void 0;
13149
+ return deriveCredentialGroup(ref)?.credentialGroup;
13150
+ } catch {
13151
+ return void 0;
13152
+ }
13153
+ };
13032
13154
  let activeAgentToolNames = [];
13033
13155
  const workspaceRoot = deps.cwd ?? process.cwd();
13034
13156
  let runtimeToolExecutionLimits = {};
@@ -13041,6 +13163,7 @@ function createCliLocalRuntimeAdapter(deps) {
13041
13163
  readXPost: deps.readXPost,
13042
13164
  readXhsProfile: deps.readXhsProfile,
13043
13165
  cliEntrypoint: CLI_ENTRYPOINT,
13166
+ resolveAgentCredentialGroup,
13044
13167
  ...deps.confirmDestructiveAction ? { confirmDestructiveAction: deps.confirmDestructiveAction } : {},
13045
13168
  ...deps.requestUserChoice ? { requestUserChoice: deps.requestUserChoice } : {},
13046
13169
  ...deps.pastedTextStore ? { pastedTextStore: deps.pastedTextStore } : {},
@@ -13118,6 +13241,7 @@ function createCliLocalRuntimeAdapter(deps) {
13118
13241
  readXPost: deps.readXPost,
13119
13242
  readXhsProfile: deps.readXhsProfile,
13120
13243
  cliEntrypoint: CLI_ENTRYPOINT,
13244
+ resolveAgentCredentialGroup,
13121
13245
  ...deps.confirmDestructiveAction ? { confirmDestructiveAction: deps.confirmDestructiveAction } : {},
13122
13246
  ...deps.requestUserChoice ? { requestUserChoice: deps.requestUserChoice } : {},
13123
13247
  ...deps.pastedTextStore ? { pastedTextStore: deps.pastedTextStore } : {},
@@ -38,13 +38,15 @@ import {
38
38
  TOOL_GUIDED_SECTION_ORDER,
39
39
  buildIdentityBlock,
40
40
  buildRuntimeGuidanceBlocks,
41
+ detectDispatchIntent,
42
+ detectDispatchIntentFromMessages,
41
43
  estimateContextTokens,
42
44
  hashStablePrefixContent,
43
45
  normalizeChatCompletionsBodyForProvider,
44
46
  requiresBareImageUrl,
45
47
  resolveToolGuidedSections,
46
48
  toBareImageUrlMessages
47
- } from "./chunk-OA6Q2A4I.js";
49
+ } from "./chunk-LZIWMYX4.js";
48
50
  import {
49
51
  convertMessagesToResponsesInput,
50
52
  extractReasoningFromResponseOutput,
@@ -13529,7 +13531,14 @@ async function runLocalAgentTurn(input) {
13529
13531
  agentConfig.exposedToolNames ?? agentConfig.toolNames ?? []
13530
13532
  );
13531
13533
  const guidanceBlocks = buildRuntimeGuidanceBlocks(agentTools);
13532
- const toolGuidedSections = resolveToolGuidedSections(agentTools);
13534
+ const toolGuidedSections = resolveToolGuidedSections(agentTools, {
13535
+ // 单调锁定:历史里任一 user 消息命中派发关键词、或已出现过
13536
+ // startAgentRun/controlAgentRun 的 tool_calls,后续每轮都保持 true,
13537
+ // 防止 session-scope 的 agentCollaboration 段逐轮翻转击穿前缀缓存。
13538
+ dispatchIntent: detectDispatchIntentFromMessages(history) || detectDispatchIntent(
13539
+ typeof input.input === "string" ? input.input : void 0
13540
+ )
13541
+ });
13533
13542
  const guidanceScopes = [
13534
13543
  ...input.userLanguage?.trim() ? [buildUserResponseLanguageContext({ language: input.userLanguage })] : [],
13535
13544
  guidanceBlocks.startupProtocol,
@@ -20408,6 +20417,21 @@ function parseDevinMetadataUsage(metaBytes) {
20408
20417
  }
20409
20418
  return sawAny ? { prompt, completion, cacheRead, cacheWrite } : null;
20410
20419
  }
20420
+ function attachDevinUpstreamFailure(error, failure) {
20421
+ if (failure) {
20422
+ error.devinUpstreamFailure = failure;
20423
+ }
20424
+ return error;
20425
+ }
20426
+ function readDevinUpstreamFailure(error) {
20427
+ if (!error || typeof error !== "object") return void 0;
20428
+ const failure = error.devinUpstreamFailure;
20429
+ if (!failure || typeof failure !== "object") return void 0;
20430
+ if (typeof failure.status !== "number" || !Number.isFinite(failure.status)) {
20431
+ return void 0;
20432
+ }
20433
+ return failure;
20434
+ }
20411
20435
  function parseDevinConnectTrailer(payload) {
20412
20436
  const text = payload.toString("utf8").trim();
20413
20437
  if (!text || text === "{}") return null;
@@ -20418,7 +20442,11 @@ function parseDevinConnectTrailer(payload) {
20418
20442
  }
20419
20443
  const code = typeof parsed.error.code === "string" ? parsed.error.code : "unknown";
20420
20444
  const message = typeof parsed.error.message === "string" ? parsed.error.message : "Unknown error";
20421
- return new Error(`Devin Connect upstream error ${code}: ${message}`);
20445
+ return attachDevinUpstreamFailure(
20446
+ new Error(`Devin Connect upstream error ${code}: ${message}`),
20447
+ // Connect/gRPC 的 resource_exhausted 与 HTTP 429 同义(限流/配额耗尽)。
20448
+ code === "resource_exhausted" ? { status: 429, body: parsed.error } : void 0
20449
+ );
20422
20450
  } catch {
20423
20451
  return new Error(`Devin Connect invalid terminal trailer: ${text}`);
20424
20452
  }
@@ -20545,8 +20573,11 @@ function createDevinProvider(options) {
20545
20573
  });
20546
20574
  if (!response.ok) {
20547
20575
  const errText = await response.text().catch(() => "");
20548
- throw new Error(
20549
- `Devin Connect upstream returned error ${response.status}: ${errText}`
20576
+ throw attachDevinUpstreamFailure(
20577
+ new Error(
20578
+ `Devin Connect upstream returned error ${response.status}: ${errText}`
20579
+ ),
20580
+ { status: response.status, body: errText }
20550
20581
  );
20551
20582
  }
20552
20583
  if (!response.body) {
@@ -20715,5 +20746,6 @@ export {
20715
20746
  buildGeminiGenerateContentRequest,
20716
20747
  resolveAntigravityFinishReason,
20717
20748
  fetchAntigravityCloudCodeCompletion,
20749
+ readDevinUpstreamFailure,
20718
20750
  createDevinProvider
20719
20751
  };
@@ -7,14 +7,14 @@ import {
7
7
  updateContentPinned,
8
8
  updateContentTitle,
9
9
  uploadAndAddFileToSpace
10
- } from "./chunk-SQZDZXP5.js";
10
+ } from "./chunk-HWIZU4OL.js";
11
11
  import "./chunk-ZJ7UHBJS.js";
12
- import "./chunk-LBEDNSMY.js";
12
+ import "./chunk-K4YGZD3P.js";
13
13
  import "./chunk-MC4XLIJ7.js";
14
14
  import "./chunk-3BMYXEUW.js";
15
15
  import "./chunk-YYLHWIW6.js";
16
16
  import "./chunk-AGGIDPCZ.js";
17
- import "./chunk-H3PIH2EO.js";
17
+ import "./chunk-SQQVLHMH.js";
18
18
  import "./chunk-TOP2VXOR.js";
19
19
  import "./chunk-5RGU3J7P.js";
20
20
  import "./chunk-6YTOJY35.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clearCredentialAvailability,
3
3
  readCredentialAvailability
4
- } from "./chunk-DWUCB2A3.js";
5
- import "./chunk-CJCJF5XB.js";
4
+ } from "./chunk-42V6BK2E.js";
5
+ import "./chunk-FDTR4QJ6.js";
6
6
  import "./chunk-4VNS5WPM.js";
7
7
 
8
8
  // packages/cli/cooldownCommands.ts
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-SQZDZXP5.js";
3
+ } from "./chunk-HWIZU4OL.js";
4
4
  import "./chunk-ZJ7UHBJS.js";
5
- import "./chunk-LBEDNSMY.js";
5
+ import "./chunk-K4YGZD3P.js";
6
6
  import "./chunk-MC4XLIJ7.js";
7
7
  import "./chunk-3BMYXEUW.js";
8
8
  import "./chunk-YYLHWIW6.js";
9
9
  import "./chunk-AGGIDPCZ.js";
10
- import "./chunk-H3PIH2EO.js";
10
+ import "./chunk-SQQVLHMH.js";
11
11
  import "./chunk-TOP2VXOR.js";
12
12
  import "./chunk-5RGU3J7P.js";
13
13
  import "./chunk-6YTOJY35.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  createDialogAction,
3
3
  isLocalOwnerDialogAgents
4
- } from "./chunk-EFVDQUCT.js";
5
- import "./chunk-SQZDZXP5.js";
4
+ } from "./chunk-3WD6RUUJ.js";
5
+ import "./chunk-HWIZU4OL.js";
6
6
  import "./chunk-ZJ7UHBJS.js";
7
- import "./chunk-LBEDNSMY.js";
7
+ import "./chunk-K4YGZD3P.js";
8
8
  import "./chunk-MC4XLIJ7.js";
9
9
  import "./chunk-3BMYXEUW.js";
10
10
  import "./chunk-YYLHWIW6.js";
11
11
  import "./chunk-AGGIDPCZ.js";
12
- import "./chunk-H3PIH2EO.js";
12
+ import "./chunk-SQQVLHMH.js";
13
13
  import "./chunk-TOP2VXOR.js";
14
14
  import "./chunk-5RGU3J7P.js";
15
15
  import "./chunk-6YTOJY35.js";
@@ -14,16 +14,16 @@ import {
14
14
  import {
15
15
  addContentToSpace,
16
16
  client_default
17
- } from "./chunk-SQZDZXP5.js";
17
+ } from "./chunk-HWIZU4OL.js";
18
18
  import {
19
19
  getCurrentSpaceId
20
20
  } from "./chunk-ZJ7UHBJS.js";
21
- import "./chunk-LBEDNSMY.js";
21
+ import "./chunk-K4YGZD3P.js";
22
22
  import "./chunk-MC4XLIJ7.js";
23
23
  import "./chunk-3BMYXEUW.js";
24
24
  import "./chunk-YYLHWIW6.js";
25
25
  import "./chunk-AGGIDPCZ.js";
26
- import "./chunk-H3PIH2EO.js";
26
+ import "./chunk-SQQVLHMH.js";
27
27
  import "./chunk-TOP2VXOR.js";
28
28
  import "./chunk-5RGU3J7P.js";
29
29
  import "./chunk-6YTOJY35.js";
@@ -24,7 +24,7 @@ import "./chunk-KQHGZWSV.js";
24
24
  import "./chunk-3BMYXEUW.js";
25
25
  import "./chunk-URMS4XY2.js";
26
26
  import "./chunk-GLKOYSRU.js";
27
- import "./chunk-MWAO7TZZ.js";
27
+ import "./chunk-ZWUOR654.js";
28
28
  import "./chunk-OF7AQZUG.js";
29
29
  import "./chunk-Q5FJJ6XI.js";
30
30
  import "./chunk-ZNFJWEN4.js";
@@ -32,10 +32,10 @@ import "./chunk-3IIEFNGY.js";
32
32
  import "./chunk-CQ3WA2NE.js";
33
33
  import "./chunk-5ZUL4CUO.js";
34
34
  import "./chunk-N7J63Q6C.js";
35
- import "./chunk-OA6Q2A4I.js";
35
+ import "./chunk-LZIWMYX4.js";
36
36
  import "./chunk-PUOC4YRO.js";
37
37
  import "./chunk-IIVGDG4I.js";
38
- import "./chunk-CJCJF5XB.js";
38
+ import "./chunk-FDTR4QJ6.js";
39
39
  import "./chunk-UZGQNTVW.js";
40
40
  import "./chunk-6OZ36FXI.js";
41
41
  import "./chunk-2MBTWINN.js";
@@ -20,12 +20,12 @@ import {
20
20
  switchDialogAgent,
21
21
  updateDialogTitle,
22
22
  updateTokens
23
- } from "./chunk-LBEDNSMY.js";
23
+ } from "./chunk-K4YGZD3P.js";
24
24
  import "./chunk-MC4XLIJ7.js";
25
25
  import "./chunk-3BMYXEUW.js";
26
26
  import "./chunk-YYLHWIW6.js";
27
27
  import "./chunk-AGGIDPCZ.js";
28
- import "./chunk-H3PIH2EO.js";
28
+ import "./chunk-SQQVLHMH.js";
29
29
  import "./chunk-TOP2VXOR.js";
30
30
  import {
31
31
  getActiveDialogAgentId
@@ -28,7 +28,7 @@ import "./chunk-SV5IJK6K.js";
28
28
  import "./chunk-VF4K2QE6.js";
29
29
  import "./chunk-Q554LLSI.js";
30
30
  import "./chunk-KHCLMKZZ.js";
31
- import "./chunk-MWAO7TZZ.js";
31
+ import "./chunk-ZWUOR654.js";
32
32
  import "./chunk-OF7AQZUG.js";
33
33
  import "./chunk-Q5FJJ6XI.js";
34
34
  import "./chunk-ZNFJWEN4.js";
@@ -36,10 +36,10 @@ import "./chunk-3IIEFNGY.js";
36
36
  import "./chunk-CQ3WA2NE.js";
37
37
  import "./chunk-5ZUL4CUO.js";
38
38
  import "./chunk-N7J63Q6C.js";
39
- import "./chunk-OA6Q2A4I.js";
39
+ import "./chunk-LZIWMYX4.js";
40
40
  import "./chunk-PUOC4YRO.js";
41
41
  import "./chunk-IIVGDG4I.js";
42
- import "./chunk-CJCJF5XB.js";
42
+ import "./chunk-FDTR4QJ6.js";
43
43
  import "./chunk-UZGQNTVW.js";
44
44
  import "./chunk-6OZ36FXI.js";
45
45
  import "./chunk-2MBTWINN.js";
@@ -21,7 +21,7 @@ import "./chunk-KQHGZWSV.js";
21
21
  import "./chunk-VF4K2QE6.js";
22
22
  import "./chunk-Q554LLSI.js";
23
23
  import "./chunk-KHCLMKZZ.js";
24
- import "./chunk-MWAO7TZZ.js";
24
+ import "./chunk-ZWUOR654.js";
25
25
  import "./chunk-OF7AQZUG.js";
26
26
  import "./chunk-Q5FJJ6XI.js";
27
27
  import "./chunk-ZNFJWEN4.js";
@@ -29,10 +29,10 @@ import "./chunk-3IIEFNGY.js";
29
29
  import "./chunk-CQ3WA2NE.js";
30
30
  import "./chunk-5ZUL4CUO.js";
31
31
  import "./chunk-N7J63Q6C.js";
32
- import "./chunk-OA6Q2A4I.js";
32
+ import "./chunk-LZIWMYX4.js";
33
33
  import "./chunk-PUOC4YRO.js";
34
34
  import "./chunk-IIVGDG4I.js";
35
- import "./chunk-CJCJF5XB.js";
35
+ import "./chunk-FDTR4QJ6.js";
36
36
  import "./chunk-UZGQNTVW.js";
37
37
  import "./chunk-6OZ36FXI.js";
38
38
  import "./chunk-2MBTWINN.js";
@@ -16,7 +16,7 @@ import "./chunk-SV5IJK6K.js";
16
16
  import "./chunk-VF4K2QE6.js";
17
17
  import "./chunk-Q554LLSI.js";
18
18
  import "./chunk-KHCLMKZZ.js";
19
- import "./chunk-MWAO7TZZ.js";
19
+ import "./chunk-ZWUOR654.js";
20
20
  import "./chunk-OF7AQZUG.js";
21
21
  import "./chunk-Q5FJJ6XI.js";
22
22
  import "./chunk-ZNFJWEN4.js";
@@ -24,10 +24,10 @@ import "./chunk-3IIEFNGY.js";
24
24
  import "./chunk-CQ3WA2NE.js";
25
25
  import "./chunk-5ZUL4CUO.js";
26
26
  import "./chunk-N7J63Q6C.js";
27
- import "./chunk-OA6Q2A4I.js";
27
+ import "./chunk-LZIWMYX4.js";
28
28
  import "./chunk-PUOC4YRO.js";
29
29
  import "./chunk-IIVGDG4I.js";
30
- import "./chunk-CJCJF5XB.js";
30
+ import "./chunk-FDTR4QJ6.js";
31
31
  import "./chunk-UZGQNTVW.js";
32
32
  import "./chunk-6OZ36FXI.js";
33
33
  import "./chunk-2MBTWINN.js";