nolo-cli 0.105.0 → 0.106.1

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 (115) hide show
  1. package/{_executeModel-JXG5TLPE.js → _executeModel-EP6HAX3W.js} +38 -37
  2. package/{addContentAction-J3DLDV64.js → addContentAction-NZZNAVCB.js} +4 -4
  3. package/{addDialogAgentAction-PHIXJCF2.js → addDialogAgentAction-5HVGEIXI.js} +4 -4
  4. package/{agentDeleteCommand-2AWJGHXG.js → agentDeleteCommand-M25A6UGB.js} +45 -45
  5. package/{agentEmailCommands-VV5OSILE.js → agentEmailCommands-RUL4NL64.js} +46 -46
  6. package/{agentListCommands-OQMRBDWP.js → agentListCommands-KSPFKHFO.js} +23 -24
  7. package/{agentMachineCommands-3VLLR6RL.js → agentMachineCommands-IHBB6PHD.js} +20 -21
  8. package/{agentProviderCommands-XPJYZSCE.js → agentProviderCommands-ND4S2Q6Q.js} +1 -1
  9. package/{agentRecordCommands-GPIARVOW.js → agentRecordCommands-7OKIBN6H.js} +45 -45
  10. package/{agentRunCommand-LRJTZ7IM.js → agentRunCommand-GBKJTQQU.js} +45 -45
  11. package/{agentRuntimeLocal-PV6AZOEU.js → agentRuntimeLocal-E5HXZNXZ.js} +18 -19
  12. package/{agentSlice-6R3JKS6I.js → agentSlice-7T3ZLYET.js} +4 -4
  13. package/{appDeleteCommands-WEX73P5R.js → appDeleteCommands-TTJUYTQN.js} +21 -22
  14. package/{appDeployCommands-7BAXWA4M.js → appDeployCommands-65WYK2TQ.js} +21 -22
  15. package/{appDeployStatusCommands-EJ6A2U4X.js → appDeployStatusCommands-U4XESYYG.js} +21 -22
  16. package/{appGetCommands-SB355OEX.js → appGetCommands-VNHZZC4D.js} +21 -22
  17. package/{appListCommands-TSZDPIKJ.js → appListCommands-O667ZEU6.js} +21 -22
  18. package/{authCommand-5PB3YRVV.js → authCommand-SUHHTVHA.js} +8 -8
  19. package/{builtinSkillRegistry-SBBWTANC.js → builtinSkillRegistry-PUGT65WS.js} +5 -5
  20. package/{chunk-Z5NGE5DH.js → chunk-2NGKYC3L.js} +3 -3
  21. package/{chunk-S2NSK7AZ.js → chunk-3SXZ6SUC.js} +4 -4
  22. package/{chunk-NSBID7PR.js → chunk-3VKDWQMJ.js} +2 -2
  23. package/{chunk-QKTESDWK.js → chunk-4VDS344D.js} +3 -3
  24. package/{chunk-7KVZ5LDQ.js → chunk-5F7UKMLN.js} +8 -4
  25. package/{chunk-BB7LVBTS.js → chunk-6AIURTE7.js} +3 -3
  26. package/{chunk-HP57OUJO.js → chunk-7I25CBT5.js} +31 -5
  27. package/{chunk-NSAFG343.js → chunk-AM4G3LDJ.js} +59 -47
  28. package/{chunk-NTR4SD3P.js → chunk-AZB6HR4I.js} +13 -48
  29. package/{chunk-AFH5QC6R.js → chunk-BIH7KCDJ.js} +3 -3
  30. package/{chunk-UA324D4O.js → chunk-BPLIXNC6.js} +1 -1
  31. package/{chunk-YK5MHOWM.js → chunk-CEQ75WPL.js} +1 -1
  32. package/{chunk-K6U4NKFJ.js → chunk-DBKRC5O2.js} +1 -1
  33. package/{chunk-UWXDA7L5.js → chunk-DJ3JABG5.js} +22 -37
  34. package/{chunk-HYXABXCZ.js → chunk-DSXRVBTA.js} +98 -21
  35. package/{chunk-3Q7NEHAR.js → chunk-EBS4FKW4.js} +1 -1
  36. package/{chunk-ZBHR642M.js → chunk-EHGIEGLI.js} +161 -43
  37. package/{chunk-YVU4XVJD.js → chunk-FJKZSR5P.js} +1 -1
  38. package/{chunk-54VPQTOA.js → chunk-GMP3NBAA.js} +5 -7
  39. package/{chunk-3BXNTXYI.js → chunk-GU7DC2TD.js} +2 -1
  40. package/{chunk-FGSJ3YMD.js → chunk-HNA5KV37.js} +5 -5
  41. package/{chunk-CYSYR67N.js → chunk-I5YMDACN.js} +1 -1
  42. package/{chunk-WJ3B6FX6.js → chunk-IXH3HKY2.js} +0 -8
  43. package/{chunk-Y3PMXGLH.js → chunk-IYIXAIEB.js} +197 -92
  44. package/{chunk-RWX7AY7J.js → chunk-JWNBEIME.js} +1 -1
  45. package/{chunk-VVJ2ENLY.js → chunk-LGWABBTZ.js} +4 -4
  46. package/{chunk-QYUBY3OZ.js → chunk-LOPP5VT6.js} +1 -1
  47. package/{chunk-GSKPJIHY.js → chunk-LUBFABMJ.js} +2 -6
  48. package/{chunk-BNGW5ASC.js → chunk-LYLO5U3H.js} +15 -2
  49. package/{chunk-L5WOICCV.js → chunk-MJ3CRU77.js} +22 -6
  50. package/{chunk-AWVP7PPG.js → chunk-NTNKA5VL.js} +1 -1
  51. package/{chunk-EP7BWZ4B.js → chunk-OAXBDMT7.js} +1 -1
  52. package/{chunk-4DPP773Q.js → chunk-ODTBO4W6.js} +9 -6
  53. package/{chunk-B7APRSPS.js → chunk-OQ5IVGCV.js} +3 -3
  54. package/{chunk-EKPKW6RM.js → chunk-OYTWDOQV.js} +3 -3
  55. package/{chunk-P5GCTVGV.js → chunk-OZ2IIIRP.js} +2 -2
  56. package/{chunk-D2GQE6AF.js → chunk-PFLF4R4E.js} +1 -1
  57. package/{chunk-RILRSUGC.js → chunk-QDH32WF5.js} +1 -1
  58. package/{chunk-VCAQFMVN.js → chunk-QVAWUJAJ.js} +1 -1
  59. package/{chunk-27ONFIEY.js → chunk-SJ7CUF65.js} +2 -2
  60. package/{chunk-CNA27EMD.js → chunk-SYEBIZOF.js} +1 -1
  61. package/{chunk-ZSUDOTPL.js → chunk-TLKXNTQJ.js} +3 -3
  62. package/{chunk-A4SQRTZ6.js → chunk-TLYSGGPG.js} +1 -1
  63. package/chunk-UM7TA3K4.js +1008 -0
  64. package/{chunk-BZ7NPA6G.js → chunk-VBG7GWWR.js} +218 -6
  65. package/{chunk-DZ7R5V3Y.js → chunk-VBQGO5NX.js} +1 -1
  66. package/{chunk-44CU7CKA.js → chunk-VYKXIHRP.js} +181 -34
  67. package/chunk-VZLO4XJD.js +17 -0
  68. package/{chunk-IEJ5YDA4.js → chunk-WMWYWYK2.js} +2 -2
  69. package/{chunk-LWXE6IFU.js → chunk-XDQ7PHU3.js} +31 -196
  70. package/{chunk-AFSY3ZMB.js → chunk-XGOHDYM2.js} +1 -1
  71. package/{chunk-2WJ57RJA.js → chunk-XLWMNFBZ.js} +1 -1
  72. package/{chunk-3F424ASC.js → chunk-YFU5EELM.js} +1 -1
  73. package/{chunk-QMXJ5KDJ.js → chunk-YQFLBS6A.js} +13 -13
  74. package/{chunk-CFHWVEUJ.js → chunk-ZVGXD7UJ.js} +2 -2
  75. package/{chunk-4WMMIL66.js → chunk-ZYM73IHG.js} +3 -2
  76. package/{commandRegistry-QU62WJQX.js → commandRegistry-6QIAUQDS.js} +49 -49
  77. package/{contentThunks-VGV3JJVB.js → contentThunks-5DDMUQ7B.js} +17 -16
  78. package/{createAgentAutomationAction-ZNVLI4WV.js → createAgentAutomationAction-NQ6AZM42.js} +17 -16
  79. package/{createDialogAction-TTUA46DT.js → createDialogAction-QZ6X4A7O.js} +20 -19
  80. package/{createPageAction-KUFSC5XW.js → createPageAction-NCGEJBVK.js} +17 -16
  81. package/{dbSlice-MYEETO73.js → dbSlice-RCZ7NRAF.js} +3 -3
  82. package/{dialogCommands-DRDPEOTL.js → dialogCommands-OGQLEF63.js} +21 -22
  83. package/{dialogSlice-V2SVSTIV.js → dialogSlice-GIKNUHNW.js} +30 -17
  84. package/{docCreateCommands-M26CFDDQ.js → docCreateCommands-RW6LNYT6.js} +20 -21
  85. package/{docDeleteCommands-LRZHCKVX.js → docDeleteCommands-Z742TRNY.js} +21 -22
  86. package/{docReadCommands-6QJSISHK.js → docReadCommands-5DIGA42Y.js} +20 -21
  87. package/{docStore-4RWAFNDM.js → docStore-6GUOZH52.js} +4 -4
  88. package/{docUpdateCommands-W4KU4U5T.js → docUpdateCommands-ZFZ2QEVK.js} +20 -21
  89. package/{getPricing-NMMFT3YI.js → getPricing-QVSNUFZ6.js} +3 -3
  90. package/{handleSendMessageAction-VEWLGB5Z.js → handleSendMessageAction-B2VXOLMM.js} +16 -15
  91. package/index.js +3 -3
  92. package/{machineCommands-AEHHCJEW.js → machineCommands-AI3N7JHQ.js} +44 -44
  93. package/{machineWsRunDispatch-MY2KHS36.js → machineWsRunDispatch-RPF2D6VV.js} +44 -44
  94. package/{memberThunks-EE6TI3TV.js → memberThunks-YICJI4IS.js} +4 -4
  95. package/{models-ZPU5EDF4.js → models-FTNFVO3D.js} +2 -2
  96. package/package.json +1 -1
  97. package/{providerPresetApply-TEBH7FDX.js → providerPresetApply-OJJXQ7NM.js} +6 -6
  98. package/{providerRegistry-CBJLNCET.js → providerRegistry-DXFBDCGQ.js} +6 -6
  99. package/{read-PJIT2YEJ.js → read-XMBM52Y4.js} +2 -2
  100. package/{readDocTool-DRSXHGNL.js → readDocTool-LAQHKCVT.js} +1 -1
  101. package/{readlineWorkspace-7Q6MITLV.js → readlineWorkspace-EPUCVZ73.js} +48 -48
  102. package/{removeDialogAgentAction-IN4WUKJJ.js → removeDialogAgentAction-HDUI2MU3.js} +5 -5
  103. package/{runAgentClientLoop-H2JALUVD.js → runAgentClientLoop-OXQMDGAN.js} +36 -35
  104. package/{setDialogExtraReferencesAction-VDRF7LPK.js → setDialogExtraReferencesAction-ADBVOP4O.js} +5 -5
  105. package/{setPrimaryDialogAgentAction-RO6LIWJ4.js → setPrimaryDialogAgentAction-PXVXQJ62.js} +5 -5
  106. package/{settingThunks-3OPOLOIA.js → settingThunks-G2MJRKUE.js} +6 -6
  107. package/{spaceCommands-UBLL5EF2.js → spaceCommands-Z662QYY6.js} +20 -21
  108. package/{streamAgentChatTurn-FFJWW3FD.js → streamAgentChatTurn-YJYEJHP7.js} +40 -46
  109. package/{switchDialogAgentAction-MVF2JNE7.js → switchDialogAgentAction-Z3RZACGF.js} +4 -4
  110. package/{toolApiClient-EJT6TMFG.js → toolApiClient-AD7CXTA4.js} +3 -2
  111. package/{tools-AZRYLYNK.js → tools-GHI3WBEI.js} +32 -31
  112. package/{tuiSummaryLlmCaller-7S5HJ3MT.js → tuiSummaryLlmCaller-WTC6GCQC.js} +11 -12
  113. package/{updateDialogTitleAction-5WXTRUJM.js → updateDialogTitleAction-GJCNWTPY.js} +17 -16
  114. package/chunk-M7VLQGQP.js +0 -405
  115. package/chunk-NKWIS6G2.js +0 -442
@@ -5,14 +5,14 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-NSAFG343.js";
8
+ } from "./chunk-AM4G3LDJ.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-QMXJ5KDJ.js";
15
+ } from "./chunk-YQFLBS6A.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-LWXE6IFU.js";
26
+ } from "./chunk-XDQ7PHU3.js";
27
27
  import {
28
28
  getPublicImageAgentMode
29
29
  } from "./chunk-VIDPVFP3.js";
@@ -37,16 +37,17 @@ import {
37
37
  addToolMessage,
38
38
  messageStreamEnd,
39
39
  messageStreaming,
40
+ toolResultNeedsUserConfirmation,
40
41
  updateToolMessage
41
- } from "./chunk-44CU7CKA.js";
42
+ } from "./chunk-VYKXIHRP.js";
42
43
  import {
43
44
  streamAgentChatTurn
44
- } from "./chunk-S2NSK7AZ.js";
45
+ } from "./chunk-3SXZ6SUC.js";
45
46
  import {
46
47
  addActiveController,
47
48
  removeActiveController,
48
49
  tokenUsageLiveUpdate
49
- } from "./chunk-BZ7NPA6G.js";
50
+ } from "./chunk-VBG7GWWR.js";
50
51
  import {
51
52
  accumulateToolCallDelta,
52
53
  createThinkParserState,
@@ -59,13 +60,13 @@ import {
59
60
  import {
60
61
  EMPTY_ASSISTANT_REPAIR_PROMPT,
61
62
  getModelInfo
62
- } from "./chunk-L5WOICCV.js";
63
+ } from "./chunk-MJ3CRU77.js";
63
64
  import {
64
65
  write
65
- } from "./chunk-4WMMIL66.js";
66
+ } from "./chunk-ZYM73IHG.js";
66
67
  import {
67
68
  getApiEndpoint
68
- } from "./chunk-3BXNTXYI.js";
69
+ } from "./chunk-GU7DC2TD.js";
69
70
  import {
70
71
  toErrorMessage
71
72
  } from "./chunk-HNMXYYJR.js";
@@ -394,6 +395,49 @@ function applyResponsesUsageFields(target, chunk) {
394
395
  }
395
396
  }
396
397
 
398
+ // packages/ai/tools/stripModelConfirmationFlags.ts
399
+ var CONFIRMATION_INPUT_KEYS = {
400
+ self_evolution_requires_confirmation: "__confirmedSelfEvolution",
401
+ agent_update_requires_confirmation: "__confirmedSelfEvolution",
402
+ media_job_start_requires_confirmation: "__confirmedMediaJobStart"
403
+ };
404
+ function stripModelConfirmationFlags(value) {
405
+ if (!value || typeof value !== "object" || Array.isArray(value)) return value;
406
+ return Object.fromEntries(
407
+ Object.entries(value).filter(
408
+ ([key]) => !key.startsWith("__confirmed")
409
+ )
410
+ );
411
+ }
412
+ var MODEL_DIALOG_BINDING_STRIPPED_TOOLS = /* @__PURE__ */ new Set([
413
+ "mediaJobTool",
414
+ "transcribe",
415
+ "translate",
416
+ "exportDocument",
417
+ "readArtifact"
418
+ ]);
419
+ var TRUSTED_ONLY_MODEL_INPUT_KEYS = /* @__PURE__ */ new Set(["confirmationToken", "expectedExecutionRevision"]);
420
+ function stripModelToolArgs(canonicalToolName, value) {
421
+ const base = stripModelConfirmationFlags(value);
422
+ if (!base || typeof base !== "object" || Array.isArray(base)) return base;
423
+ const withoutTrustedOnlyKeys = Object.fromEntries(
424
+ Object.entries(base).filter(
425
+ ([key]) => !TRUSTED_ONLY_MODEL_INPUT_KEYS.has(key)
426
+ )
427
+ );
428
+ if (!MODEL_DIALOG_BINDING_STRIPPED_TOOLS.has(canonicalToolName)) {
429
+ return withoutTrustedOnlyKeys;
430
+ }
431
+ if (!withoutTrustedOnlyKeys || typeof withoutTrustedOnlyKeys !== "object" || Array.isArray(withoutTrustedOnlyKeys)) {
432
+ return withoutTrustedOnlyKeys;
433
+ }
434
+ return Object.fromEntries(
435
+ Object.entries(withoutTrustedOnlyKeys).filter(
436
+ ([key]) => key !== "dialogId" && key !== "autoApproveCredits"
437
+ )
438
+ );
439
+ }
440
+
397
441
  // packages/chat/messages/toolThunks.ts
398
442
  var TOOL_ARGS_SENTINELS = [
399
443
  "<|tool_calls_section_end|>",
@@ -417,6 +461,23 @@ var defaultSummary = (toolName, status) => {
417
461
  if (status === "failed") return `\u274C ${toolName} \u6267\u884C\u5931\u8D25`;
418
462
  return `\u2705 ${toolName} \u6267\u884C\u5B8C\u6210`;
419
463
  };
464
+ var RAW_DATA_FALLBACK_MAX_TOTAL_BYTES = 4e3;
465
+ var RAW_DATA_FALLBACK_MAX_HEAD_BYTES = 1e3;
466
+ var RAW_DATA_FALLBACK_MAX_TAIL_BYTES = 2500;
467
+ var buildRawDataLlmContextFallback = (rawData, toolCallId) => {
468
+ const serialized = typeof rawData === "string" ? rawData.trim() : rawData === void 0 ? "" : JSON.stringify(rawData);
469
+ if (!serialized) return void 0;
470
+ const clipped = clipHeadAndTail(serialized, {
471
+ maxHeadBytes: RAW_DATA_FALLBACK_MAX_HEAD_BYTES,
472
+ maxTailBytes: RAW_DATA_FALLBACK_MAX_TAIL_BYTES,
473
+ maxTotalBytes: RAW_DATA_FALLBACK_MAX_TOTAL_BYTES,
474
+ // 完整 rawData 已随 tool message content 原样落盘,无需另写临时日志;
475
+ // 浏览器 stub 本就忽略该选项。
476
+ saveTempLog: false,
477
+ ...toolCallId ? { toolCallId } : {}
478
+ });
479
+ return asOptionalTrimmedString(clipped.content);
480
+ };
420
481
  var processToolData = createAsyncThunk(
421
482
  "message/processToolData",
422
483
  async (args, thunkApi) => {
@@ -449,7 +510,8 @@ var processToolData = createAsyncThunk(
449
510
  }
450
511
  }
451
512
  const activity = isRecord(toolArgs) && isRecord(toolArgs._activity) ? toolArgs._activity : void 0;
452
- const executionToolArgs = isRecord(toolArgs) && Object.prototype.hasOwnProperty.call(toolArgs, "_activity") ? (({ _activity: _ignored, ...rest }) => rest)(toolArgs) : toolArgs;
513
+ const withoutActivity = isRecord(toolArgs) && Object.prototype.hasOwnProperty.call(toolArgs, "_activity") ? (({ _activity: _ignored, ...rest }) => rest)(toolArgs) : toolArgs;
514
+ const executionToolArgs = stripModelToolArgs(canonicalName, withoutActivity);
453
515
  const inputSummary = JSON.stringify(executionToolArgs).slice(0, 400);
454
516
  toolRunStarted({
455
517
  id: toolRunId,
@@ -476,6 +538,7 @@ var processToolData = createAsyncThunk(
476
538
  const toolPayload = {
477
539
  toolName: canonicalName,
478
540
  status: "pending",
541
+ interaction,
479
542
  input: executionToolArgs,
480
543
  rawToolCall: toolCall,
481
544
  toolRunId,
@@ -537,19 +600,28 @@ var processToolData = createAsyncThunk(
537
600
  });
538
601
  const rawData = toolResult?.rawData ?? toolResult;
539
602
  const llmContext = asOptionalTrimmedString(toolResult?.llmContext);
540
- const summary = asOptionalTrimmedString(toolResult?.displayData) || defaultSummary(canonicalName, "succeeded");
541
- toolRunSucceeded({
542
- id: toolRunId,
543
- outputSummary: summary
544
- });
603
+ const displayData = asOptionalTrimmedString(toolResult?.displayData);
604
+ const awaitingUserConfirmation = toolResultNeedsUserConfirmation(canonicalName, rawData);
605
+ const summary = displayData || defaultSummary(canonicalName, awaitingUserConfirmation ? "pending" : "succeeded");
606
+ const llmContextFallback = llmContext || displayData || awaitingUserConfirmation ? void 0 : buildRawDataLlmContextFallback(rawData, toolCallId);
607
+ const effectiveLlmContext = llmContext ?? llmContextFallback;
608
+ if (!awaitingUserConfirmation) {
609
+ toolRunSucceeded({
610
+ id: toolRunId,
611
+ outputSummary: summary
612
+ });
613
+ } else {
614
+ toolRunSetPending({ id: toolRunId });
615
+ }
545
616
  const toolPayload = {
546
617
  toolName: canonicalName,
547
- status: "succeeded",
618
+ status: awaitingUserConfirmation ? "pending" : "succeeded",
619
+ interaction,
548
620
  input: executionToolArgs,
549
621
  rawToolCall: toolCall,
550
622
  toolRunId,
551
623
  summary,
552
- ...llmContext ? { llmContext } : {},
624
+ ...effectiveLlmContext ? { llmContext: effectiveLlmContext } : {},
553
625
  ...activity ? { activity } : {}
554
626
  };
555
627
  const isUiAskChoice = canonicalName === "ask_user";
@@ -567,11 +639,11 @@ var processToolData = createAsyncThunk(
567
639
  } catch (e) {
568
640
  const errorMessage = toErrorMessage(e);
569
641
  const structured = getToolResultErrorData(e);
570
- const requiresConfirmation = structured?.code === "self_evolution_requires_confirmation" || structured?.code === "agent_update_requires_confirmation";
571
- if (requiresConfirmation) {
642
+ const confirmationKey = structured?.code ? CONFIRMATION_INPUT_KEYS[structured.code] : void 0;
643
+ if (confirmationKey) {
572
644
  const confirmedInput = {
573
645
  ...executionToolArgs ?? {},
574
- __confirmedSelfEvolution: true
646
+ [confirmationKey]: true
575
647
  };
576
648
  const summary2 = typeof structured?.displayData === "string" && structured.displayData.trim() || `\u26A0\uFE0F ${canonicalName} \u9700\u8981\u786E\u8BA4\u540E\u6267\u884C`;
577
649
  toolRunStarted({
@@ -587,6 +659,7 @@ var processToolData = createAsyncThunk(
587
659
  const toolPayload2 = {
588
660
  toolName: canonicalName,
589
661
  status: "pending",
662
+ interaction: "confirm",
590
663
  input: confirmedInput,
591
664
  rawToolCall: toolCall,
592
665
  toolRunId,
@@ -595,7 +668,11 @@ var processToolData = createAsyncThunk(
595
668
  };
596
669
  return {
597
670
  toolCallId,
598
- rawResult: structured?.rawData !== void 0 ? structured.rawData : { error: "self_evolution_requires_confirmation" },
671
+ rawResult: structured?.rawData !== void 0 ? structured.rawData : (
672
+ // 按实际确认码回填(此分支内 code 必在 CONFIRMATION_INPUT_KEYS 中),
673
+ // 不再对所有工具写死 self_evolution 文案。
674
+ { error: structured?.code }
675
+ ),
599
676
  summary: summary2,
600
677
  toolName: canonicalName,
601
678
  toolRunId,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-UAD2WT54.js";
8
8
  import {
9
9
  toTimestampMs
10
- } from "./chunk-4WMMIL66.js";
10
+ } from "./chunk-ZYM73IHG.js";
11
11
  import {
12
12
  isTombstoneRecord
13
13
  } from "./chunk-D2MDMY2M.js";
@@ -2,7 +2,7 @@ import {
2
2
  DEVIN_CONNECT_URL,
3
3
  parseSseDataLineJson,
4
4
  parseSseDataLineObject
5
- } from "./chunk-YK5MHOWM.js";
5
+ } from "./chunk-CEQ75WPL.js";
6
6
  import {
7
7
  applyChatCompletionDelta,
8
8
  applyResponsesToolEvent,
@@ -11,7 +11,7 @@ import {
11
11
  flushChatCompletionStream,
12
12
  providerHttpFailure,
13
13
  throwIfChatCompletionStreamFailed
14
- } from "./chunk-54VPQTOA.js";
14
+ } from "./chunk-GMP3NBAA.js";
15
15
  import {
16
16
  readSseFrames
17
17
  } from "./chunk-GMZLP5DV.js";
@@ -27,13 +27,7 @@ import {
27
27
  resolveHistoricalToolContentCap,
28
28
  resolveToolOutputProfile,
29
29
  stripImagePartsFromMessages
30
- } from "./chunk-CFHWVEUJ.js";
31
- import {
32
- downgradeUnparsableToolCalls,
33
- hasParsableObjectArguments,
34
- repairTruncatedToolArguments,
35
- sanitizeForOutbound
36
- } from "./chunk-NKWIS6G2.js";
30
+ } from "./chunk-ZVGXD7UJ.js";
37
31
  import {
38
32
  createThinkParserState,
39
33
  createToolCallAccumulator,
@@ -54,18 +48,22 @@ import {
54
48
  requiresBareImageUrl,
55
49
  resolveToolGuidedSections,
56
50
  toBareImageUrlMessages
57
- } from "./chunk-AFH5QC6R.js";
51
+ } from "./chunk-BIH7KCDJ.js";
58
52
  import {
59
53
  convertMessagesToResponsesInput,
54
+ downgradeUnparsableToolCalls,
60
55
  extractReasoningFromResponseOutput,
61
56
  extractTextFromResponseOutput,
62
57
  extractToolCallsFromResponseOutput,
63
58
  getUsageRequestOptions,
59
+ hasParsableObjectArguments,
60
+ repairTruncatedToolArguments,
61
+ sanitizeForOutbound,
64
62
  shouldReplayReasoningContentForOutbound,
65
63
  shouldStripReasoningContentForOutbound,
66
64
  toOpenAiCompatibleMessages,
67
65
  toResponsesTools
68
- } from "./chunk-M7VLQGQP.js";
66
+ } from "./chunk-UM7TA3K4.js";
69
67
  import {
70
68
  BRIDGE_STREAM_MAX_CHARS,
71
69
  DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
@@ -94,7 +92,7 @@ import {
94
92
  resolveEmptyAssistantFallbackMessage,
95
93
  resolveEmptyAssistantOutcome,
96
94
  resolveTruncatedReasoningTailLog
97
- } from "./chunk-L5WOICCV.js";
95
+ } from "./chunk-MJ3CRU77.js";
98
96
  import {
99
97
  COMPACTION_SUMMARY_SCHEMA_VERSION,
100
98
  COMPACTION_SUMMARY_SYSTEM_PROMPT,
@@ -112,7 +110,7 @@ import {
112
110
  resolveCompressionTriggerRatio,
113
111
  truncateToolOutputForContext,
114
112
  withProviderCallTimingFields
115
- } from "./chunk-IEJ5YDA4.js";
113
+ } from "./chunk-WMWYWYK2.js";
116
114
  import {
117
115
  clipCompactText
118
116
  } from "./chunk-5MMAK75Q.js";
@@ -138,7 +136,7 @@ import {
138
136
  import {
139
137
  buildProviderAuthHeaders,
140
138
  buildProviderExecutionPlan
141
- } from "./chunk-27ONFIEY.js";
139
+ } from "./chunk-SJ7CUF65.js";
142
140
  import {
143
141
  toErrorMessage
144
142
  } from "./chunk-HNMXYYJR.js";
@@ -14490,6 +14488,18 @@ function responsesStreamFailureStatus(failure) {
14490
14488
  return 502;
14491
14489
  }
14492
14490
  var codexStreamFailureStatus = responsesStreamFailureStatus;
14491
+ function extractOutputTextFromItem(item) {
14492
+ const parts2 = item.content;
14493
+ if (!Array.isArray(parts2)) return "";
14494
+ return parts2.filter(
14495
+ (part) => !!part && typeof part === "object" && part.type === "output_text" && typeof part.text === "string"
14496
+ ).map((part) => String(part.text)).join("");
14497
+ }
14498
+ function hasNumericTokenCount(u) {
14499
+ return ["input_tokens", "output_tokens", "prompt_tokens", "completion_tokens", "total_tokens"].some(
14500
+ (key) => typeof u[key] === "number" && Number.isFinite(u[key])
14501
+ );
14502
+ }
14493
14503
  function createResponsesStreamCollector(callbacks) {
14494
14504
  let content = "";
14495
14505
  let reasoning = "";
@@ -14497,6 +14507,11 @@ function createResponsesStreamCollector(callbacks) {
14497
14507
  let usage;
14498
14508
  let failure;
14499
14509
  let completedResponse;
14510
+ const requireResponseCompleted = callbacks?.requireResponseCompleted === true;
14511
+ const authoritativeCompletedTools = callbacks?.authoritativeCompletedTools === true;
14512
+ const failurePrefix = callbacks?.fallbackPrefix ?? "Responses";
14513
+ let sawTerminalSuccess = false;
14514
+ let sawTerminalEvent = false;
14500
14515
  let sawMeaningfulDelta = false;
14501
14516
  const observeMeaningfulOnce = () => {
14502
14517
  if (sawMeaningfulDelta) return;
@@ -14504,18 +14519,38 @@ function createResponsesStreamCollector(callbacks) {
14504
14519
  callbacks?.onMeaningfulDelta?.();
14505
14520
  };
14506
14521
  const processEvent = (ev) => {
14522
+ callbacks?.onEvent?.(ev);
14507
14523
  if (isMeaningfulResponsesOutput(ev)) observeMeaningfulOnce();
14508
14524
  const type = String(ev.type ?? "");
14509
14525
  if (type === "error") {
14510
- failure = failure ?? toResponsesStreamFailure(ev.error, callbacks?.fallbackPrefix);
14526
+ sawTerminalEvent = true;
14527
+ failure = failure ?? toResponsesStreamFailure(ev.error, callbacks?.fallbackPrefix) ?? {
14528
+ code: "response_error",
14529
+ message: `${callbacks?.fallbackPrefix ?? "Responses"} upstream emitted an error event.`
14530
+ };
14511
14531
  return;
14512
14532
  }
14513
14533
  if (type === "response.failed" || type === "response.incomplete") {
14534
+ sawTerminalEvent = true;
14514
14535
  const response = ev.response;
14515
14536
  failure = failure ?? toResponsesStreamFailure(response?.error, callbacks?.fallbackPrefix) ?? toResponsesStreamFailure(response?.incomplete_details, callbacks?.fallbackPrefix) ?? {
14516
14537
  code: type === "response.incomplete" ? "response_incomplete" : "response_failed",
14517
14538
  message: `${callbacks?.fallbackPrefix ?? "Responses"} upstream ended with ${type}.`
14518
14539
  };
14540
+ {
14541
+ const u = response?.usage;
14542
+ if (u && hasNumericTokenCount(u)) {
14543
+ const prompt = typeof u.input_tokens === "number" ? u.input_tokens : typeof u.prompt_tokens === "number" ? u.prompt_tokens : 0;
14544
+ const completion = typeof u.output_tokens === "number" ? u.output_tokens : typeof u.completion_tokens === "number" ? u.completion_tokens : 0;
14545
+ usage = {
14546
+ prompt_tokens: prompt,
14547
+ completion_tokens: completion,
14548
+ total_tokens: typeof u.total_tokens === "number" ? u.total_tokens : prompt + completion,
14549
+ ...u.input_tokens_details && typeof u.input_tokens_details === "object" ? { input_tokens_details: u.input_tokens_details } : {},
14550
+ ...u.output_tokens_details && typeof u.output_tokens_details === "object" ? { output_tokens_details: u.output_tokens_details } : {}
14551
+ };
14552
+ }
14553
+ }
14519
14554
  return;
14520
14555
  }
14521
14556
  if (type === "response.output_text.delta" && typeof ev.delta === "string") {
@@ -14528,16 +14563,38 @@ function createResponsesStreamCollector(callbacks) {
14528
14563
  callbacks?.onReasoningDelta?.(ev.delta);
14529
14564
  return;
14530
14565
  }
14531
- if (type === "response.output_item.added" || type === "response.output_item.done" || type === "response.function_call_arguments.delta" || type === "response.function_call_arguments.done") {
14566
+ if (type === "response.output_item.added" || type === "response.output_item.done") {
14567
+ const item = ev.item;
14568
+ if (item?.type === "message" && !content) {
14569
+ const itemText = extractOutputTextFromItem(item);
14570
+ if (itemText) {
14571
+ content = itemText;
14572
+ callbacks?.onTextDelta?.(itemText);
14573
+ }
14574
+ }
14575
+ applyResponsesToolEvent(toolCallsAcc, ev);
14576
+ return;
14577
+ }
14578
+ if (type === "response.function_call_arguments.delta" || type === "response.function_call_arguments.done") {
14532
14579
  applyResponsesToolEvent(toolCallsAcc, ev);
14533
14580
  return;
14534
14581
  }
14535
14582
  if (type === "response.completed") {
14583
+ sawTerminalEvent = true;
14536
14584
  const response = ev.response;
14585
+ const envelopeStatus = response && typeof response.status === "string" ? response.status : void 0;
14586
+ if (requireResponseCompleted && envelopeStatus !== void 0 && envelopeStatus !== "completed") {
14587
+ failure = failure ?? {
14588
+ code: "response_not_completed",
14589
+ message: `${failurePrefix} emitted response.completed with status "${envelopeStatus}".`
14590
+ };
14591
+ return;
14592
+ }
14593
+ sawTerminalSuccess = true;
14537
14594
  if (response) {
14538
14595
  completedResponse = response;
14539
14596
  const u = response.usage;
14540
- if (u) {
14597
+ if (u && hasNumericTokenCount(u)) {
14541
14598
  const prompt = typeof u.input_tokens === "number" ? u.input_tokens : typeof u.prompt_tokens === "number" ? u.prompt_tokens : 0;
14542
14599
  const completion = typeof u.output_tokens === "number" ? u.output_tokens : typeof u.completion_tokens === "number" ? u.completion_tokens : 0;
14543
14600
  const total = typeof u.total_tokens === "number" ? u.total_tokens : prompt + completion;
@@ -14558,29 +14615,58 @@ function createResponsesStreamCollector(callbacks) {
14558
14615
  let finalToolCalls = finalizeResponsesToolCalls(toolCallsAcc);
14559
14616
  if (completedResponse) {
14560
14617
  const completedToolCalls = extractToolCallsFromResponseOutput(completedResponse);
14561
- const completedById = new Map(completedToolCalls.map((call) => [call.id, call]));
14562
- finalToolCalls = finalToolCalls.map((call) => {
14563
- const completed = completedById.get(call.id);
14564
- if (!completed) return call;
14565
- let accumulatedParses = false;
14566
- let completedParses = false;
14567
- try {
14568
- JSON.parse(call.function.arguments);
14569
- accumulatedParses = true;
14570
- } catch {
14618
+ if (authoritativeCompletedTools) {
14619
+ for (const call of completedToolCalls) {
14620
+ const name = call.function?.name;
14621
+ if (typeof name !== "string" || !name.trim()) {
14622
+ failure = failure ?? {
14623
+ code: "tool_name_missing",
14624
+ message: `${failurePrefix} response.completed contained a tool call without a name.`
14625
+ };
14626
+ break;
14627
+ }
14628
+ const args2 = call.function?.arguments;
14629
+ if (typeof args2 === "string" && args2.trim()) {
14630
+ try {
14631
+ JSON.parse(args2);
14632
+ } catch {
14633
+ failure = failure ?? {
14634
+ code: "tool_arguments_malformed",
14635
+ message: `${failurePrefix} response.completed contained malformed tool arguments for "${name}".`
14636
+ };
14637
+ break;
14638
+ }
14639
+ }
14571
14640
  }
14572
- try {
14573
- JSON.parse(completed.function.arguments);
14574
- completedParses = true;
14575
- } catch {
14641
+ finalToolCalls = completedToolCalls;
14642
+ } else {
14643
+ const completedById = new Map(completedToolCalls.map((call) => [call.id, call]));
14644
+ finalToolCalls = finalToolCalls.map((call) => {
14645
+ const completed = completedById.get(call.id);
14646
+ if (!completed) return call;
14647
+ let accumulatedParses = false;
14648
+ let completedParses = false;
14649
+ try {
14650
+ JSON.parse(call.function.arguments);
14651
+ accumulatedParses = true;
14652
+ } catch {
14653
+ }
14654
+ try {
14655
+ JSON.parse(completed.function.arguments);
14656
+ completedParses = true;
14657
+ } catch {
14658
+ return call;
14659
+ }
14660
+ if (completedParses && (!accumulatedParses || completed.function.arguments.startsWith(call.function.arguments))) {
14661
+ return { ...call, function: { ...call.function, arguments: completed.function.arguments } };
14662
+ }
14576
14663
  return call;
14577
- }
14578
- if (completedParses && (!accumulatedParses || completed.function.arguments.startsWith(call.function.arguments))) {
14579
- return { ...call, function: { ...call.function, arguments: completed.function.arguments } };
14580
- }
14581
- return call;
14582
- });
14583
- if (finalToolCalls.length === 0) finalToolCalls = completedToolCalls;
14664
+ });
14665
+ if (finalToolCalls.length === 0) finalToolCalls = completedToolCalls;
14666
+ }
14667
+ }
14668
+ if (authoritativeCompletedTools && failure) {
14669
+ finalToolCalls = [];
14584
14670
  }
14585
14671
  if (!content && completedResponse) {
14586
14672
  content = extractTextFromResponseOutput(completedResponse);
@@ -14588,19 +14674,42 @@ function createResponsesStreamCollector(callbacks) {
14588
14674
  if (!reasoning && completedResponse) {
14589
14675
  reasoning = extractReasoningFromResponseOutput(completedResponse);
14590
14676
  }
14677
+ const streamComplete = sawTerminalSuccess;
14678
+ const streamTruncated = !sawTerminalEvent;
14591
14679
  return {
14592
14680
  content,
14593
14681
  ...reasoning ? { reasoning_content: reasoning } : {},
14594
14682
  ...finalToolCalls.length > 0 ? { tool_calls: finalToolCalls } : {},
14595
14683
  ...usage ? { usage } : {},
14596
- finish_reason: finalToolCalls.length > 0 ? "tool_calls" : "stop",
14597
- stream_complete: true,
14684
+ ...streamComplete ? { finish_reason: finalToolCalls.length > 0 ? "tool_calls" : "stop" } : {},
14685
+ ...streamComplete ? { stream_complete: true } : {},
14686
+ ...streamTruncated ? { stream_truncated: true } : {},
14687
+ ...completedResponse ? { completed_response: completedResponse } : {},
14688
+ ...completedResponse && typeof completedResponse.id === "string" ? { response_id: completedResponse.id } : {},
14598
14689
  ...failure ? { failure } : {}
14599
14690
  };
14600
14691
  };
14601
14692
  return {
14602
14693
  processEvent,
14603
- finalize: finalize2
14694
+ finalize: finalize2,
14695
+ /**
14696
+ * legacy 非标准 provider 可能沿用 chat wire 的 `[DONE]` 收尾哨兵。
14697
+ * 原生 Responses(含 CF)的权威终局仍是 response.completed —— 认这个哨兵
14698
+ * 不为 CF 开豁免:CF 被截断时既没有 completed 也没有 [DONE]。
14699
+ */
14700
+ markLegacyDone: () => {
14701
+ sawTerminalEvent = true;
14702
+ if (requireResponseCompleted) {
14703
+ if (!sawTerminalSuccess) {
14704
+ failure = failure ?? {
14705
+ code: "response_completed_missing",
14706
+ message: `${failurePrefix} upstream ended with a legacy [DONE] sentinel without response.completed.`
14707
+ };
14708
+ }
14709
+ return;
14710
+ }
14711
+ sawTerminalSuccess = true;
14712
+ }
14604
14713
  };
14605
14714
  }
14606
14715
  function aggregateResponsesStream(events, options) {
@@ -14624,10 +14733,18 @@ async function readResponsesSseCompletion(args2) {
14624
14733
  onTextDelta: args2.onTextDelta,
14625
14734
  onReasoningDelta: args2.onReasoningDelta,
14626
14735
  ...args2.onMeaningfulDelta ? { onMeaningfulDelta: args2.onMeaningfulDelta } : {},
14627
- fallbackPrefix: args2.fallbackPrefix ?? "Responses"
14736
+ ...args2.onEvent ? { onEvent: args2.onEvent } : {},
14737
+ fallbackPrefix: args2.fallbackPrefix ?? "Responses",
14738
+ ...args2.requireResponseCompleted === true ? { requireResponseCompleted: true } : {},
14739
+ ...args2.authoritativeCompletedTools === true ? { authoritativeCompletedTools: true } : {}
14628
14740
  });
14629
14741
  for await (const frame of readSseFrames(args2.response)) {
14630
14742
  for (const line of frame.split("\n")) {
14743
+ const trimmedLine = line.trim();
14744
+ if (trimmedLine === "[DONE]" || trimmedLine === "data: [DONE]") {
14745
+ collector.markLegacyDone();
14746
+ continue;
14747
+ }
14631
14748
  const parsed = parseSseDataLineObject(line);
14632
14749
  if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
14633
14750
  collector.processEvent(parsed);
@@ -14641,6 +14758,7 @@ async function readResponsesSseCompletion(args2) {
14641
14758
  err.status = status;
14642
14759
  err.code = result4.failure.code;
14643
14760
  err.type = result4.failure.type;
14761
+ if (result4.usage) err.usage = result4.usage;
14644
14762
  throw err;
14645
14763
  }
14646
14764
  return result4;
@@ -20069,7 +20187,7 @@ function buildLoadSkillExecutor(args2) {
20069
20187
  const { resolveSkillByName } = await import("./skillDiscovery-ZBU76COE.js");
20070
20188
  const resolved = resolveSkillByName(args2.cwd, name);
20071
20189
  if (!resolved) {
20072
- const { resolveBuiltinSkillByName } = await import("./builtinSkillRegistry-SBBWTANC.js");
20190
+ const { resolveBuiltinSkillByName } = await import("./builtinSkillRegistry-PUGT65WS.js");
20073
20191
  const builtin = resolveBuiltinSkillByName(name);
20074
20192
  if (builtin) {
20075
20193
  return {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  patch
3
- } from "./chunk-4WMMIL66.js";
3
+ } from "./chunk-ZYM73IHG.js";
4
4
  import {
5
5
  selectCurrentServer
6
6
  } from "./chunk-NWENLDMM.js";
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  readSseFrames
3
3
  } from "./chunk-GMZLP5DV.js";
4
- import {
5
- sanitizeForOutbound
6
- } from "./chunk-NKWIS6G2.js";
7
4
  import {
8
5
  accumulateToolCallDelta,
9
6
  createThinkParserState,
@@ -24,15 +21,16 @@ import {
24
21
  extractToolCallsFromResponseOutput,
25
22
  getUsageRequestOptions,
26
23
  hasImageParts,
24
+ sanitizeForOutbound,
27
25
  shouldStripReasoningContentForOutbound,
28
26
  stablePromptCacheKey,
29
27
  toOpenAiCompatibleMessages,
30
28
  toResponsesTools
31
- } from "./chunk-M7VLQGQP.js";
29
+ } from "./chunk-UM7TA3K4.js";
32
30
  import {
33
31
  isMeaningfulChatCompletionOutput,
34
32
  isMeaningfulResponsesOutput
35
- } from "./chunk-IEJ5YDA4.js";
33
+ } from "./chunk-WMWYWYK2.js";
36
34
  import {
37
35
  clipCompactText
38
36
  } from "./chunk-5MMAK75Q.js";
@@ -45,11 +43,11 @@ import {
45
43
  resolvePlatformAuthToken,
46
44
  resolvePlatformServerUrl,
47
45
  resolveProviderTransportDecision
48
- } from "./chunk-27ONFIEY.js";
46
+ } from "./chunk-SJ7CUF65.js";
49
47
  import {
50
48
  NOLO_CLIENT_VERSION_HEADER,
51
49
  isPlatformMimoProviderModel
52
- } from "./chunk-Y3PMXGLH.js";
50
+ } from "./chunk-IYIXAIEB.js";
53
51
  import {
54
52
  isRecord
55
53
  } from "./chunk-KUG52IAP.js";
@@ -9,7 +9,7 @@ import {
9
9
  platformHostedModels,
10
10
  toCnyCredits,
11
11
  zaiModels
12
- } from "./chunk-Y3PMXGLH.js";
12
+ } from "./chunk-IYIXAIEB.js";
13
13
 
14
14
  // packages/integrations/qwen/models.ts
15
15
  var qwenModels = [
@@ -2175,6 +2175,7 @@ var MODEL_LOOKUP_MAP = {
2175
2175
  var ANTHROPIC_MODEL_ALIASES = {
2176
2176
  "claude-opus-5.5": "claude-opus-5-5",
2177
2177
  "claude-sonnet-5.5": "claude-sonnet-5-5",
2178
+ "claude-haiku-5.5": "claude-haiku-5-5",
2178
2179
  "claude-sonnet-4.6": "claude-3-7-sonnet-latest",
2179
2180
  "claude-sonnet-4.5": "claude-3-5-sonnet-latest"
2180
2181
  };