nolo-cli 0.96.0-alpha.1 → 0.97.0-alpha.2

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 (63) hide show
  1. package/{_executeModel-AUQRMRWL.js → _executeModel-G2MRKK2K.js} +15 -15
  2. package/{agentDeleteCommand-4BAHJRU3.js → agentDeleteCommand-4427YKQF.js} +6 -6
  3. package/{agentEmailCommands-QISOY7Y6.js → agentEmailCommands-RNBKKO7Q.js} +18 -18
  4. package/{agentListCommands-U46ODMQU.js → agentListCommands-O4AEMQVV.js} +8 -8
  5. package/{agentMachineCommands-EHV2KM2C.js → agentMachineCommands-FOFX5S2Q.js} +7 -7
  6. package/{agentRecordCommands-SIPURU2S.js → agentRecordCommands-6QK7AMXQ.js} +18 -18
  7. package/{agentRunCommand-K4CLMA6B.js → agentRunCommand-2W3Q3A7M.js} +18 -18
  8. package/{agentRunControl-XLGD3UZ5.js → agentRunControl-WCTKX5VL.js} +2 -2
  9. package/{agentRuntimeLocal-O4HPUJA4.js → agentRuntimeLocal-IW3IM5P6.js} +6 -6
  10. package/{agentSlice-ZYT2OUR3.js → agentSlice-SK47GTN7.js} +1 -1
  11. package/{appDeleteCommands-R5BBTKQK.js → appDeleteCommands-ZXLXNRHF.js} +6 -6
  12. package/{appDeployCommands-ZJIXOJWD.js → appDeployCommands-PWB4YERK.js} +6 -6
  13. package/{appDeployStatusCommands-B3R2ZTBF.js → appDeployStatusCommands-2EZKZP7Y.js} +6 -6
  14. package/{appGetCommands-2AQSOV2A.js → appGetCommands-JNUKOWHO.js} +6 -6
  15. package/{appListCommands-HCIJGZFY.js → appListCommands-6X3H67SS.js} +6 -6
  16. package/{chatQueueReduxAdapter-Q5V4YJVI.js → chatQueueReduxAdapter-ZJ555AT2.js} +4 -4
  17. package/{chunk-OF7AQZUG.js → chunk-2YMRWISD.js} +1 -1
  18. package/{chunk-JOHSKZQX.js → chunk-3SK4LEIH.js} +27 -13
  19. package/{chunk-NTW5GWDM.js → chunk-3VNWWVKB.js} +2 -0
  20. package/{chunk-3IIEFNGY.js → chunk-4EZHSKTB.js} +1 -1
  21. package/{chunk-BGSLKVCP.js → chunk-7D6Z6AA4.js} +2 -2
  22. package/{chunk-LLT642J4.js → chunk-ADTY7BWR.js} +1 -1
  23. package/{chunk-WADCY6G6.js → chunk-ASQYTZTR.js} +43 -6
  24. package/{chunk-ZXKVPF4K.js → chunk-B4ZH7KVO.js} +1 -1
  25. package/{chunk-EGSKXKR5.js → chunk-EHKBVWKL.js} +1 -1
  26. package/{chunk-OA6Q2A4I.js → chunk-L7I247DF.js} +79 -19
  27. package/{chunk-JAXOVNM4.js → chunk-NEDZDG3M.js} +1 -1
  28. package/{chunk-3SJQXXGY.js → chunk-NUVMWYJM.js} +92 -13
  29. package/{chunk-BZWBEHGD.js → chunk-O35EJJVP.js} +14 -8
  30. package/{chunk-XRWZB6CF.js → chunk-OIMN34NA.js} +6 -6
  31. package/{chunk-AFDS2CVM.js → chunk-OZPMVBJI.js} +2 -2
  32. package/{chunk-XOVEWFLK.js → chunk-QLNJRTKI.js} +2 -2
  33. package/{chunk-A6G32FNX.js → chunk-R7N5TMTV.js} +3 -3
  34. package/{chunk-IAO6JBYW.js → chunk-RG6JBBX5.js} +5 -1
  35. package/{chunk-ZLR5JN3E.js → chunk-RSJECD7I.js} +3 -3
  36. package/{chunk-4MY4GLIW.js → chunk-SDTTBMBU.js} +115 -37
  37. package/{chunk-DEUUPHOO.js → chunk-TDRTS7QW.js} +1 -1
  38. package/{chunk-CPH3W5A7.js → chunk-WGR3J4Q6.js} +86 -1
  39. package/{chunk-FOWEGIMF.js → chunk-WRFW73PB.js} +10 -10
  40. package/{chunk-MMPXJXHT.js → chunk-X4QAVDFE.js} +99 -13
  41. package/{contentThunks-PT23JWJX.js → contentThunks-YLWTUILV.js} +5 -5
  42. package/{createAgentAutomationAction-N27SYTLU.js → createAgentAutomationAction-HFLPOBWQ.js} +5 -5
  43. package/{createDialogAction-XZPLHD5G.js → createDialogAction-4H52MURR.js} +6 -6
  44. package/{createPageAction-KHVJQ3CS.js → createPageAction-5YDRMJOS.js} +5 -5
  45. package/{dialogCommands-ZUWW5UT6.js → dialogCommands-KFK2FF5B.js} +6 -6
  46. package/{dialogSlice-3YH242HS.js → dialogSlice-TMSHUGEM.js} +4 -4
  47. package/{docCreateCommands-Q6FADDSJ.js → docCreateCommands-V777WOZ7.js} +6 -6
  48. package/{docDeleteCommands-ZKIH54PZ.js → docDeleteCommands-5KHT7Z5Q.js} +6 -6
  49. package/{docReadCommands-7BZT2QTW.js → docReadCommands-BLROGWP3.js} +6 -6
  50. package/{docStore-YSZRNUUD.js → docStore-OBC5QOW7.js} +1 -1
  51. package/{docUpdateCommands-WJXWTRL7.js → docUpdateCommands-QXOZHQ5H.js} +6 -6
  52. package/{handleSendMessageAction-KJO2QDBM.js → handleSendMessageAction-4LGNXH6T.js} +4 -4
  53. package/index.js +47 -47
  54. package/{machineCommands-QC4TD7GJ.js → machineCommands-SNLCRHQK.js} +18 -18
  55. package/{machineWsRunDispatch-XUOIAXO7.js → machineWsRunDispatch-ZGZVDQSO.js} +18 -18
  56. package/package.json +1 -1
  57. package/{readlineWorkspace-74TXXSLO.js → readlineWorkspace-OUL7ZN7D.js} +22 -19
  58. package/{runAgentClientLoop-37BXJD62.js → runAgentClientLoop-GD3APV7V.js} +13 -13
  59. package/{spaceCommands-P3ONT6LL.js → spaceCommands-TIDVUPDV.js} +6 -6
  60. package/{streamAgentChatTurn-FGXQXALU.js → streamAgentChatTurn-M73KWCCU.js} +15 -15
  61. package/{tools-R5UF2KZO.js → tools-DXXDQ2CP.js} +10 -10
  62. package/{tuiSummaryLlmCaller-T2SHYMDZ.js → tuiSummaryLlmCaller-VJY3YD2Q.js} +2 -2
  63. package/{updateDialogTitleAction-RTADGV7A.js → updateDialogTitleAction-XI73NQMU.js} +5 -5
@@ -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,
@@ -60,7 +61,7 @@ import {
60
61
  import {
61
62
  inlineImageUrlsForCustomProvider,
62
63
  prepareTools
63
- } from "./chunk-XOVEWFLK.js";
64
+ } from "./chunk-QLNJRTKI.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-MMPXJXHT.js";
83
+ } from "./chunk-X4QAVDFE.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-FOWEGIMF.js";
112
+ } from "./chunk-WRFW73PB.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-ZLR5JN3E.js";
119
+ } from "./chunk-RSJECD7I.js";
115
120
  import {
116
121
  require_date_fns
117
122
  } from "./chunk-M76ECQRD.js";
@@ -165,7 +170,7 @@ import {
165
170
  resolveOpenAiCompatibleProviderConfig,
166
171
  shouldUseGeminiNativeToolRoute,
167
172
  summarizeToolArguments
168
- } from "./chunk-4MY4GLIW.js";
173
+ } from "./chunk-SDTTBMBU.js";
169
174
  import {
170
175
  PlatformStreamInterruptedError,
171
176
  buildPlatformChatCompletionRequest,
@@ -177,11 +182,11 @@ import {
177
182
  readSseDataValues,
178
183
  resolvePlatformChatProviderConfig,
179
184
  shouldUsePlatformChatProvider
180
- } from "./chunk-OF7AQZUG.js";
185
+ } from "./chunk-2YMRWISD.js";
181
186
  import {
182
187
  resolveAgentRuntimeConfigFromRecord,
183
188
  resolveHistoricalToolContentCap
184
- } from "./chunk-3IIEFNGY.js";
189
+ } from "./chunk-4EZHSKTB.js";
185
190
  import {
186
191
  isDevinOAuthAgent
187
192
  } from "./chunk-5ZUL4CUO.js";
@@ -213,14 +218,14 @@ import {
213
218
  } from "./chunk-2MBTWINN.js";
214
219
  import {
215
220
  normalizeUsage
216
- } from "./chunk-JAXOVNM4.js";
221
+ } from "./chunk-NEDZDG3M.js";
217
222
  import {
218
223
  clipCompactText,
219
224
  createProviderCallTimingTracker,
220
225
  finalizeProviderCallTiming,
221
226
  observeMeaningfulProviderResponseAt,
222
227
  withProviderCallTimingFields
223
- } from "./chunk-WADCY6G6.js";
228
+ } from "./chunk-ASQYTZTR.js";
224
229
  import {
225
230
  estimateTokenCount
226
231
  } from "./chunk-PSCNXBYA.js";
@@ -11034,6 +11039,7 @@ function waitForRunTerminal(args) {
11034
11039
  };
11035
11040
  const loop = Effect_exports.gen(function* () {
11036
11041
  token = args.claim?.acquire() ?? null;
11042
+ const deadline = Date.now() + args.timeoutMs;
11037
11043
  while (true) {
11038
11044
  const state = yield* readEffect(args.read);
11039
11045
  lastState = state;
@@ -11044,6 +11050,9 @@ function waitForRunTerminal(args) {
11044
11050
  }
11045
11051
  return { kind: "terminal", state };
11046
11052
  }
11053
+ if (Date.now() >= deadline) {
11054
+ return { kind: "timeout", waitedMs: args.timeoutMs, lastState };
11055
+ }
11047
11056
  const slept = yield* sleep(args.pollIntervalMs);
11048
11057
  if (slept === "aborted") return { kind: "aborted" };
11049
11058
  }
@@ -11468,6 +11477,12 @@ function buildRunStatusPayload(reconciled, deps, opts = {}) {
11468
11477
  endedAt: reconciled.endedAt ?? null,
11469
11478
  exitCode: reconciled.exitCode ?? null,
11470
11479
  ...reconciled.failureReason ? { failureReason: reconciled.failureReason } : {},
11480
+ // 结构化失败分类 + 可重试性:编排者据此决策,不再肉读 logTail。
11481
+ ...reconciled.failureClass ? { failureClass: reconciled.failureClass } : {},
11482
+ ...typeof reconciled.retryable === "boolean" ? { retryable: reconciled.retryable } : {},
11483
+ // 日志落盘路径始终暴露:stalled/failed 且 dialogId 缺失(如 ephemeral)
11484
+ // 时 logTail 只能靠它读,不能只留在进程内存。
11485
+ ...reconciled.logPath ? { logPath: reconciled.logPath } : {},
11471
11486
  ...typeof reconciled.toolCallCount === "number" ? { toolCallCount: reconciled.toolCallCount } : {},
11472
11487
  ...reconciled.lastAssistantText ? { lastAssistantText: reconciled.lastAssistantText } : {},
11473
11488
  // Non-ephemeral runs expose dialogId so the caller can read the
@@ -11502,6 +11517,39 @@ function buildRunStatusPayload(reconciled, deps, opts = {}) {
11502
11517
  }
11503
11518
  };
11504
11519
  }
11520
+ async function assertCredentialFanoutAllowed(deps, args) {
11521
+ let candidateGroup;
11522
+ if (deps.resolveAgentCredentialGroup) {
11523
+ try {
11524
+ candidateGroup = await deps.resolveAgentCredentialGroup(args.agentKey);
11525
+ } catch {
11526
+ candidateGroup = void 0;
11527
+ }
11528
+ }
11529
+ if (!candidateGroup && typeof args.credentialGroup === "string" && args.credentialGroup.trim()) {
11530
+ candidateGroup = args.credentialGroup.trim();
11531
+ }
11532
+ const { batchId, parentDialogId } = args;
11533
+ if (!batchId && !parentDialogId) return candidateGroup;
11534
+ const active = queryRunRecords({ limit: 500 }, deps).runs.filter((record) => {
11535
+ if (isRunTerminalStatus(record.status)) return false;
11536
+ if (batchId && record.batchId === batchId) return true;
11537
+ if (parentDialogId && record.parentDialogId === parentDialogId) return true;
11538
+ return false;
11539
+ }).map((record) => ({
11540
+ runId: record.runId,
11541
+ agentKey: record.agentKey,
11542
+ credentialGroup: record.credentialGroup
11543
+ }));
11544
+ if (active.length === 0) return candidateGroup;
11545
+ const verdict = checkCredentialFanout({
11546
+ active,
11547
+ candidate: { agentKey: args.agentKey, credentialGroup: candidateGroup },
11548
+ allowUnknownCredential: args.allowUnknownCredential === true
11549
+ });
11550
+ if (!verdict.allowed) throw new Error(verdict.message);
11551
+ return candidateGroup;
11552
+ }
11505
11553
  function createCliStartAgentRunExecutor(deps = {}) {
11506
11554
  return async (call) => {
11507
11555
  const args = parseCallArgs(call);
@@ -11524,6 +11572,14 @@ function createCliStartAgentRunExecutor(deps = {}) {
11524
11572
  ];
11525
11573
  const agentName = typeof args.agentName === "string" && args.agentName.trim() ? args.agentName.trim() : typeof args.name === "string" && args.name.trim() ? args.name.trim() : void 0;
11526
11574
  const batchId = typeof args.batchId === "string" && args.batchId.trim() ? args.batchId.trim() : void 0;
11575
+ const parentDialogId = typeof args.parentDialogId === "string" && args.parentDialogId.trim() ? args.parentDialogId.trim() : void 0;
11576
+ const credentialGroup = await assertCredentialFanoutAllowed(deps, {
11577
+ agentKey,
11578
+ ...batchId ? { batchId } : {},
11579
+ ...parentDialogId ? { parentDialogId } : {},
11580
+ ...typeof args.credentialGroup === "string" && args.credentialGroup.trim() ? { credentialGroup: args.credentialGroup.trim() } : {},
11581
+ allowUnknownCredential: args.allowUnknownCredential === true
11582
+ });
11527
11583
  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;
11528
11584
  const { runId, batchId: resolvedBatchId } = await spawnLocalBackgroundRun(
11529
11585
  {
@@ -11533,7 +11589,8 @@ function createCliStartAgentRunExecutor(deps = {}) {
11533
11589
  agentKey,
11534
11590
  ...agentName ? { agentName } : {},
11535
11591
  ...batchId ? { batchId } : {},
11536
- ...typeof args.parentDialogId === "string" && args.parentDialogId.trim() ? { parentDialogId: args.parentDialogId.trim() } : {},
11592
+ ...credentialGroup ? { credentialGroup } : {},
11593
+ ...parentDialogId ? { parentDialogId } : {},
11537
11594
  ...dodCommands && dodCommands.length > 0 ? { dodCommands } : {},
11538
11595
  cwd: deps.cwd ?? process.cwd(),
11539
11596
  message,
@@ -11619,6 +11676,8 @@ async function spawnContinuationRun(reconciled, userInput, deps) {
11619
11676
  ...agentName ? { agentName } : {},
11620
11677
  ...reconciled.batchId ? { batchId: reconciled.batchId } : {},
11621
11678
  ...reconciled.parentDialogId ? { parentDialogId: reconciled.parentDialogId } : {},
11679
+ // 续跑继承原 run 的凭证组(同一 agent),供并发扇出守卫判定。
11680
+ ...reconciled.credentialGroup ? { credentialGroup: reconciled.credentialGroup } : {},
11622
11681
  cwd: reconciled.cwd ?? deps.cwd ?? process.cwd(),
11623
11682
  message: userInput,
11624
11683
  ...reconciled.ephemeral ? { ephemeral: true } : {},
@@ -12217,7 +12276,8 @@ function buildLocalToolExecutors(args) {
12217
12276
  startAgentRun: createCliStartAgentRunExecutor({
12218
12277
  env: args.env,
12219
12278
  cliEntrypoint: args.cliEntrypoint,
12220
- cwd: args.workspaceRoot
12279
+ cwd: args.workspaceRoot,
12280
+ ...args.resolveAgentCredentialGroup ? { resolveAgentCredentialGroup: args.resolveAgentCredentialGroup } : {}
12221
12281
  }),
12222
12282
  controlAgentRun: createCliControlAgentRunExecutor({
12223
12283
  env: args.env
@@ -13078,6 +13138,23 @@ function createCliLocalRuntimeAdapter(deps) {
13078
13138
  const localToolUsage = /* @__PURE__ */ new Map();
13079
13139
  const buildProviderOpenAiTools = deps.buildProviderOpenAiTools ?? buildOpenAiTools;
13080
13140
  const additionalToolNames = deps.pastedTextStore ? ["readPastedText"] : [];
13141
+ const resolveAgentCredentialGroup = async (agentRef) => {
13142
+ try {
13143
+ const record = await readAgentFromStore({
13144
+ agentRef,
13145
+ store: await getOrCreateSharedStore(deps),
13146
+ userId
13147
+ });
13148
+ if (!record || typeof record !== "object") return void 0;
13149
+ const rec = record;
13150
+ const existing = typeof rec.credentialGroup === "string" && rec.credentialGroup.trim() ? rec.credentialGroup.trim() : void 0;
13151
+ if (existing) return existing;
13152
+ const ref = typeof rec.apiKeyRef === "string" && rec.apiKeyRef.trim() ? rec.apiKeyRef : typeof rec.credentialRef === "string" && rec.credentialRef.trim() ? rec.credentialRef : void 0;
13153
+ return deriveCredentialGroup(ref)?.credentialGroup;
13154
+ } catch {
13155
+ return void 0;
13156
+ }
13157
+ };
13081
13158
  let activeAgentToolNames = [];
13082
13159
  const workspaceRoot = deps.cwd ?? process.cwd();
13083
13160
  let runtimeToolExecutionLimits = {};
@@ -13090,6 +13167,7 @@ function createCliLocalRuntimeAdapter(deps) {
13090
13167
  readXPost: deps.readXPost,
13091
13168
  readXhsProfile: deps.readXhsProfile,
13092
13169
  cliEntrypoint: CLI_ENTRYPOINT,
13170
+ resolveAgentCredentialGroup,
13093
13171
  ...deps.confirmDestructiveAction ? { confirmDestructiveAction: deps.confirmDestructiveAction } : {},
13094
13172
  ...deps.requestUserChoice ? { requestUserChoice: deps.requestUserChoice } : {},
13095
13173
  ...deps.pastedTextStore ? { pastedTextStore: deps.pastedTextStore } : {},
@@ -13167,6 +13245,7 @@ function createCliLocalRuntimeAdapter(deps) {
13167
13245
  readXPost: deps.readXPost,
13168
13246
  readXhsProfile: deps.readXhsProfile,
13169
13247
  cliEntrypoint: CLI_ENTRYPOINT,
13248
+ resolveAgentCredentialGroup,
13170
13249
  ...deps.confirmDestructiveAction ? { confirmDestructiveAction: deps.confirmDestructiveAction } : {},
13171
13250
  ...deps.requestUserChoice ? { requestUserChoice: deps.requestUserChoice } : {},
13172
13251
  ...deps.pastedTextStore ? { pastedTextStore: deps.pastedTextStore } : {},
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  clipMultilineText,
9
9
  fetchAndSerializeTable
10
- } from "./chunk-MMPXJXHT.js";
10
+ } from "./chunk-X4QAVDFE.js";
11
11
  import {
12
12
  isGatewayHttpStatus
13
13
  } from "./chunk-NF64D32W.js";
@@ -28,13 +28,13 @@ import {
28
28
  } from "./chunk-MEYIRKDN.js";
29
29
  import {
30
30
  fetchAndCacheMessages
31
- } from "./chunk-FOWEGIMF.js";
31
+ } from "./chunk-WRFW73PB.js";
32
32
  import {
33
33
  shouldUseServerProxy
34
34
  } from "./chunk-YYLHWIW6.js";
35
35
  import {
36
36
  fetchServerSyncedCredential
37
- } from "./chunk-ZLR5JN3E.js";
37
+ } from "./chunk-RSJECD7I.js";
38
38
  import {
39
39
  buildSkillGuidancePromptBlock,
40
40
  extractRuntimePageCapabilities,
@@ -45,9 +45,10 @@ import {
45
45
  buildIdentityBlock,
46
46
  buildRuntimeGuidanceBlocks,
47
47
  compileContextLayers,
48
+ detectDispatchIntentFromMessages,
48
49
  normalizeChatCompletionsBodyForProvider,
49
50
  resolveToolGuidedSections
50
- } from "./chunk-OA6Q2A4I.js";
51
+ } from "./chunk-L7I247DF.js";
51
52
  import {
52
53
  convertMessagesToResponsesInput,
53
54
  getUsageRequestOptions,
@@ -619,7 +620,9 @@ var buildSystemPromptContext = (options) => {
619
620
  ${mainPrompt}` : "";
620
621
  const agentTools = canonicalizeToolNames(agentConfig.tools ?? []);
621
622
  const hasAskTool = agentTools.includes("ask_user");
622
- const toolSections = resolveToolGuidedSections(agentTools);
623
+ const toolSections = resolveToolGuidedSections(agentTools, {
624
+ dispatchIntent: options.dispatchIntent === true
625
+ });
623
626
  const {
624
627
  startupProtocol,
625
628
  contextLayerContract,
@@ -699,8 +702,9 @@ var applyClaudeCache = (stableContent, dynamicContent) => {
699
702
  var prependPromptMessage = (messages, agentConfig, resolvedModel, language, contexts, prependSystemPrompt = true) => {
700
703
  if (!prependSystemPrompt) return messages;
701
704
  if (!contexts && !agentConfig.prompt) return messages;
705
+ const dispatchIntent = detectDispatchIntentFromMessages(messages);
702
706
  if (isClaudeModel(resolvedModel)) {
703
- const compiled = buildSystemPromptContext({ agentConfig, language, contexts });
707
+ const compiled = buildSystemPromptContext({ agentConfig, language, contexts, dispatchIntent });
704
708
  if (!compiled.content.trim()) return messages;
705
709
  const content = applyClaudeCache(
706
710
  compiled.stablePrefixContent,
@@ -709,7 +713,7 @@ var prependPromptMessage = (messages, agentConfig, resolvedModel, language, cont
709
713
  const systemMessage2 = { role: "system", content };
710
714
  return [systemMessage2, ...messages];
711
715
  }
712
- const promptContent = buildSystemPrompt({ agentConfig, language, contexts });
716
+ const promptContent = buildSystemPrompt({ agentConfig, language, contexts, dispatchIntent });
713
717
  if (!promptContent.trim()) return messages;
714
718
  const systemMessage = { role: "system", content: promptContent };
715
719
  return [systemMessage, ...messages];
@@ -892,7 +896,9 @@ function generateResponseRequestBody(agentConfig, msgs, contexts, prependSystemP
892
896
  const promptContent = buildSystemPrompt({
893
897
  agentConfig,
894
898
  language,
895
- contexts
899
+ contexts,
900
+ // 按当前用户输入检测派发意图:无意图只注入最小派发协议(安全硬门常在)。
901
+ dispatchIntent: detectDispatchIntentFromMessages(msgs)
896
902
  });
897
903
  body.instructions = promptContent;
898
904
  }
@@ -5,14 +5,14 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-XOVEWFLK.js";
8
+ } from "./chunk-QLNJRTKI.js";
9
9
  import {
10
10
  INVALID_TOOL_ARGS_REPLACEMENT,
11
11
  buildInvalidToolCallSelfHealResult,
12
12
  parseToolCallArguments,
13
13
  performFetchRequest,
14
14
  sanitizeOutboundMessages
15
- } from "./chunk-BZWBEHGD.js";
15
+ } from "./chunk-O35EJJVP.js";
16
16
  import {
17
17
  createSSEParser,
18
18
  createToolRunId,
@@ -23,7 +23,7 @@ import {
23
23
  toolRunSetPending,
24
24
  toolRunStarted,
25
25
  toolRunSucceeded
26
- } from "./chunk-MMPXJXHT.js";
26
+ } from "./chunk-X4QAVDFE.js";
27
27
  import {
28
28
  getPublicImageAgentMode
29
29
  } from "./chunk-VIDPVFP3.js";
@@ -35,10 +35,10 @@ import {
35
35
  messageStreamEnd,
36
36
  messageStreaming,
37
37
  updateToolMessage
38
- } from "./chunk-FOWEGIMF.js";
38
+ } from "./chunk-WRFW73PB.js";
39
39
  import {
40
40
  streamAgentChatTurn
41
- } from "./chunk-ZLR5JN3E.js";
41
+ } from "./chunk-RSJECD7I.js";
42
42
  import {
43
43
  addActiveController,
44
44
  removeActiveController,
@@ -56,7 +56,7 @@ import {
56
56
  import {
57
57
  EMPTY_ASSISTANT_REPAIR_PROMPT,
58
58
  getModelInfo
59
- } from "./chunk-JAXOVNM4.js";
59
+ } from "./chunk-NEDZDG3M.js";
60
60
  import {
61
61
  getApiEndpoint
62
62
  } from "./chunk-OIVSQH2O.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  addContentToSpace
3
- } from "./chunk-ZXKVPF4K.js";
3
+ } from "./chunk-B4ZH7KVO.js";
4
4
  import {
5
5
  prepareAndPersistMessage,
6
6
  uiAskChoiceFunc,
7
7
  uiAskChoiceFunctionSchema
8
- } from "./chunk-FOWEGIMF.js";
8
+ } from "./chunk-WRFW73PB.js";
9
9
  import {
10
10
  require_date_fns
11
11
  } from "./chunk-M76ECQRD.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-MMPXJXHT.js";
3
+ } from "./chunk-X4QAVDFE.js";
4
4
  import {
5
5
  i18n_default
6
- } from "./chunk-FOWEGIMF.js";
6
+ } from "./chunk-WRFW73PB.js";
7
7
  import {
8
8
  canonicalizeToolNames
9
9
  } from "./chunk-O6OSWFZQ.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-3SJQXXGY.js";
4
+ } from "./chunk-NUVMWYJM.js";
5
5
  import {
6
6
  clipMultilineText
7
- } from "./chunk-MMPXJXHT.js";
7
+ } from "./chunk-X4QAVDFE.js";
8
8
  import {
9
9
  runLocalAgentTurn
10
- } from "./chunk-4MY4GLIW.js";
10
+ } from "./chunk-SDTTBMBU.js";
11
11
  import {
12
12
  applyToolSurfaceConstraints
13
13
  } from "./chunk-IIVGDG4I.js";
@@ -420,6 +420,9 @@ function toSafeAgentSummary(record, options) {
420
420
  ...nextAvailableAt !== void 0 ? { nextAvailableAt } : {},
421
421
  ...credentialGroup !== void 0 ? { credentialGroup } : {},
422
422
  ...credentialKind !== void 0 ? { credentialKind } : {},
423
+ // 「未知 ≠ 独立」:无 credentialGroup 时显式 credentialed:false,调用方
424
+ // 不得把缺失解读成独立凭证(并发扇出守卫依赖这个区分)。
425
+ credentialed: credentialGroup !== void 0,
423
426
  updatedAt
424
427
  };
425
428
  }
@@ -446,7 +449,8 @@ var COMPACT_AGENT_SUMMARY_FIELDS = [
446
449
  // 所以通常根本不占字节。
447
450
  "nextAvailableAt",
448
451
  "credentialGroup",
449
- "credentialKind"
452
+ "credentialKind",
453
+ "credentialed"
450
454
  ];
451
455
  function omitNullishAgentSummaryFields(summary) {
452
456
  const result = {};
@@ -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-AUQRMRWL.js");
307
+ const { _executeModel } = await import("./_executeModel-G2MRKK2K.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-37BXJD62.js");
328
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-GD3APV7V.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-FGXQXALU.js");
344
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-M73KWCCU.js");
345
345
  return streamAgentChatTurnHandler(args, thunkApi);
346
346
  }),
347
347
  /**