nolo-cli 0.16.0-alpha.1 → 0.16.0-alpha.11

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 (97) hide show
  1. package/{_executeModel-QAUS6B7J.js → _executeModel-LGHYA5XS.js} +29 -28
  2. package/{action-GUOZYYGN.js → action-F5JACQBG.js} +4 -4
  3. package/{addContentAction-QDGHGUBH.js → addContentAction-AQXEYRBE.js} +3 -3
  4. package/{addDialogAgentAction-Z4YCYZIV.js → addDialogAgentAction-EJHHJZWW.js} +2 -2
  5. package/{agentDeleteCommand-365DMKHW.js → agentDeleteCommand-PBIUC4FT.js} +18 -17
  6. package/{agentEmailCommands-TQMXL36I.js → agentEmailCommands-KC2QCPQV.js} +35 -34
  7. package/{agentListCommands-6B5X4RC6.js → agentListCommands-N64PHBXM.js} +20 -19
  8. package/{agentMachineCommands-LOEARB6V.js → agentMachineCommands-P7S5WAVA.js} +18 -17
  9. package/{agentRecordCommands-DCH2WBL2.js → agentRecordCommands-JKZR2TZJ.js} +34 -33
  10. package/{agentRunCommand-SGMH67WT.js → agentRunCommand-2ELKCBWR.js} +34 -33
  11. package/{agentRuntimeLocal-YSYZ33ER.js → agentRuntimeLocal-T6YECTNF.js} +15 -16
  12. package/{agentSlice-IVE735EV.js → agentSlice-NXLMDKR7.js} +3 -3
  13. package/{appDeleteCommands-6QYOO3JB.js → appDeleteCommands-D6B6Z4ZQ.js} +19 -18
  14. package/{appDeployCommands-WTCT6XO6.js → appDeployCommands-YMO5FK4T.js} +19 -18
  15. package/{appDeployStatusCommands-CGWGZJKB.js → appDeployStatusCommands-EO5DWWPQ.js} +19 -18
  16. package/{appGetCommands-O4OCAMRW.js → appGetCommands-6SMZ3URQ.js} +19 -18
  17. package/{appListCommands-UENFP4XY.js → appListCommands-RZXSWR2G.js} +19 -18
  18. package/{authCommand-YFTR3347.js → authCommand-MSSBXCQ6.js} +8 -2
  19. package/{chunk-EMXI3N3Z.js → chunk-22NGXGN3.js} +2 -2
  20. package/{chunk-WPN6RMDF.js → chunk-2WXMU64E.js} +3 -3
  21. package/{chunk-SFXYKGK2.js → chunk-3S2VOMIF.js} +3 -3
  22. package/{chunk-WRN5EQT7.js → chunk-47QUPRHO.js} +3 -3
  23. package/{chunk-YNHQIXX5.js → chunk-4LXOVZ4W.js} +21 -21
  24. package/{chunk-O53CP2QR.js → chunk-6CRACQXW.js} +3 -3
  25. package/{chunk-E237VE6U.js → chunk-6KBBMW4D.js} +2 -2
  26. package/{chunk-U7LEGLEB.js → chunk-6N4KODMN.js} +1 -1
  27. package/{chunk-GRTFNYLR.js → chunk-A7O4KKLZ.js} +3 -3
  28. package/{chunk-WA6KZL5V.js → chunk-AAODAAUQ.js} +23 -20
  29. package/{chunk-Z24FGIU2.js → chunk-BXXECNBU.js} +3 -3
  30. package/{chunk-4NLUNENX.js → chunk-C4MMO7W4.js} +1 -1
  31. package/{chunk-JKWWVF2I.js → chunk-D3HVJJIA.js} +1 -1
  32. package/{chunk-VE6XMVKG.js → chunk-D4NCEGGR.js} +167 -53
  33. package/{chunk-TTGAVETO.js → chunk-EABWT43X.js} +2 -2
  34. package/{chunk-YYIRR6QC.js → chunk-EQTZPEID.js} +140 -175
  35. package/{chunk-RSYUDGGZ.js → chunk-F3UOACU4.js} +1 -1
  36. package/{chunk-RKM3K52F.js → chunk-GPELDE6I.js} +2 -2
  37. package/{chunk-OGGHETUE.js → chunk-HQPG2PIV.js} +62 -19
  38. package/{chunk-BFRVXJJJ.js → chunk-HSASSW4L.js} +27 -11
  39. package/{chunk-XVP3C2KY.js → chunk-IWLUTMYX.js} +1 -1
  40. package/{chunk-B4KT7RN2.js → chunk-JTMNCCWF.js} +2 -2
  41. package/chunk-KFEVY3ST.js +255 -0
  42. package/{chunk-WNLPAOIT.js → chunk-KFHN5NGJ.js} +1 -1
  43. package/{chunk-ISYE6GZB.js → chunk-L6NVTGI7.js} +1 -1
  44. package/{chunk-J55UHASN.js → chunk-MSA4JAOZ.js} +1 -1
  45. package/{chunk-HRQCKQA5.js → chunk-MUCU6ATG.js} +8 -257
  46. package/{chunk-524BDL33.js → chunk-O6W2O2DA.js} +1 -15
  47. package/{chunk-4QQFLN5C.js → chunk-OVBVEXZ7.js} +4 -4
  48. package/{chunk-QZVGMD5F.js → chunk-PU4LXVAC.js} +1 -1
  49. package/{chunk-4IJYA27C.js → chunk-RG2U2MTJ.js} +1 -1
  50. package/{chunk-6MHDWKOT.js → chunk-RIF3XLXK.js} +9 -5
  51. package/{chunk-IKXL2HZ3.js → chunk-RK5NYQEL.js} +1 -1
  52. package/{chunk-JS33TCQ3.js → chunk-RPDGJO4D.js} +2 -2
  53. package/{chunk-EHLHSX7R.js → chunk-UB4RYYNQ.js} +9 -2
  54. package/{chunk-YC3DJILJ.js → chunk-VHXXRWNL.js} +22 -8
  55. package/{chunk-G2MKOQCB.js → chunk-WBA6SIBB.js} +1 -1
  56. package/{chunk-6565R2TI.js → chunk-XEWUC53Z.js} +38 -20
  57. package/{chunk-OOIN7HSO.js → chunk-XJITGCTM.js} +10 -1
  58. package/{chunk-V2J635L5.js → chunk-XOIF2TNF.js} +2 -2
  59. package/{chunk-VPTJB4HM.js → chunk-XPC5C7BK.js} +0 -3
  60. package/{chunk-I66RU7P7.js → chunk-XRSPI6CP.js} +1 -1
  61. package/{chunk-N5424GSW.js → chunk-YJKXGHJ6.js} +1 -1
  62. package/{chunk-QLFCNUVQ.js → chunk-ZH62XNZE.js} +877 -172
  63. package/chunk-ZHXJ6M7T.js +27 -0
  64. package/{chunk-OQMPU2ML.js → chunk-ZXQ52OY2.js} +4 -4
  65. package/{createAgentAutomationAction-TS6NNZ4X.js → createAgentAutomationAction-RKWIMKHW.js} +13 -13
  66. package/{createDialogAction-5HVQ33EX.js → createDialogAction-VN7MEBS3.js} +14 -14
  67. package/{createPageAction-4F3ZGQJD.js → createPageAction-JBUWBHHC.js} +13 -13
  68. package/{dbSlice-OP6UPXKA.js → dbSlice-7KQH6GOU.js} +2 -2
  69. package/{dialogCommands-ZL6L24BS.js → dialogCommands-DFY5HJ6M.js} +19 -18
  70. package/{dialogSlice-FAWUQDJW.js → dialogSlice-NNYBU35K.js} +13 -13
  71. package/{docCreateCommands-LYROQTFH.js → docCreateCommands-5L76YTI2.js} +18 -17
  72. package/{docDeleteCommands-6TWGTZNR.js → docDeleteCommands-3GASP3VR.js} +19 -18
  73. package/{docReadCommands-PRULNF26.js → docReadCommands-ALA77AZM.js} +18 -17
  74. package/{docStore-2UHVWLTV.js → docStore-DR22GGF3.js} +14 -14
  75. package/{docUpdateCommands-NNYYWJBI.js → docUpdateCommands-6AZGXE5M.js} +18 -17
  76. package/{getPricing-UGDJHI7M.js → getPricing-RYY6OBA4.js} +4 -4
  77. package/{handleSendMessageAction-LJPUYNOH.js → handleSendMessageAction-FHITDM7H.js} +201 -15
  78. package/index.js +47 -47
  79. package/{machineCommands-JQPEQFSE.js → machineCommands-3B4IHHVK.js} +33 -32
  80. package/{machineWsRunDispatch-FFFNWVEW.js → machineWsRunDispatch-AXZ6OL3V.js} +33 -32
  81. package/{models-LSCRJJ6P.js → models-5K5G2CZI.js} +2 -2
  82. package/package.json +1 -1
  83. package/{read-HXHAZBKH.js → read-CN3TNXIP.js} +1 -1
  84. package/{readDocTool-VPBDTO4G.js → readDocTool-WF3675ED.js} +1 -1
  85. package/{readlineWorkspace-QSXHSBHA.js → readlineWorkspace-DBZCXS7Y.js} +145 -92
  86. package/{removeDialogAgentAction-HUFVN35S.js → removeDialogAgentAction-YDHBFEGI.js} +5 -5
  87. package/{runAgentClientLoop-A75BUU6D.js → runAgentClientLoop-AB7PQ3TB.js} +26 -25
  88. package/{setDialogExtraReferencesAction-2VLGWQKG.js → setDialogExtraReferencesAction-LR6MSIXO.js} +2 -2
  89. package/{setPrimaryDialogAgentAction-VB4UV2CC.js → setPrimaryDialogAgentAction-IIVDCY5C.js} +5 -5
  90. package/{settingSlice-7JYPQNAC.js → settingSlice-O23YDK2O.js} +3 -3
  91. package/{spaceCommands-4LE45GB7.js → spaceCommands-AB2D7A2R.js} +18 -17
  92. package/{spaceSlice-444MFUP6.js → spaceSlice-TEJDCU6A.js} +13 -13
  93. package/{streamAgentChatTurn-DJAE7USZ.js → streamAgentChatTurn-NZ3HLAXS.js} +30 -32
  94. package/{tools-YB6LXSVN.js → tools-M4USUF3R.js} +20 -20
  95. package/{tuiSummaryLlmCaller-QQL3JA5I.js → tuiSummaryLlmCaller-VUNVBRX3.js} +7 -6
  96. package/{updateDialogTitleAction-6HGFBM64.js → updateDialogTitleAction-SMPQVKWT.js} +13 -13
  97. package/chunk-BYXBJQAS.js +0 -0
@@ -15,7 +15,7 @@ import {
15
15
  platformHostedModels,
16
16
  xaiModels,
17
17
  zaiModels
18
- } from "./chunk-524BDL33.js";
18
+ } from "./chunk-O6W2O2DA.js";
19
19
  import {
20
20
  __export
21
21
  } from "./chunk-4VNS5WPM.js";
@@ -78,6 +78,45 @@ var anthropicModels = [
78
78
  }
79
79
  ];
80
80
 
81
+ // packages/integrations/anthropic/anthropicOAuthModels.ts
82
+ var oauthModel = ({ name, displayName, contextWindow, thinkingMode, maxOutputTokens }) => ({
83
+ name,
84
+ displayName,
85
+ hasVision: true,
86
+ description: `OAuth \u8BA2\u9605\u6A21\u578B\uFF08${displayName}\uFF0C${thinkingMode === "adaptive" ? "Adaptive thinking" : "Extended thinking"}\uFF09`,
87
+ contextWindow,
88
+ ...maxOutputTokens ? { maxOutputTokens } : {},
89
+ supportsReasoningEffort: true,
90
+ price: { input: 0, output: 0 }
91
+ });
92
+ var anthropicOAuthModels = [
93
+ // 5 代(1M + Adaptive thinking always-on;官方 max output 128k)
94
+ oauthModel({ name: "claude-fable-5", displayName: "Claude Fable 5", contextWindow: 1e6, thinkingMode: "adaptive", maxOutputTokens: 128e3 }),
95
+ oauthModel({ name: "claude-opus-5", displayName: "Claude Opus 5", contextWindow: 1e6, thinkingMode: "adaptive", maxOutputTokens: 128e3 }),
96
+ oauthModel({ name: "claude-sonnet-5", displayName: "Claude Sonnet 5", contextWindow: 1e6, thinkingMode: "adaptive", maxOutputTokens: 128e3 }),
97
+ // 4.6/4.7/4.8 系(Adaptive thinking;context 官方未单列,参照 fuzzy claude-4.6→1M)
98
+ oauthModel({ name: "claude-opus-4-8", displayName: "Claude Opus 4.8", contextWindow: 1e6, thinkingMode: "adaptive" }),
99
+ oauthModel({ name: "claude-opus-4-7", displayName: "Claude Opus 4.7", contextWindow: 1e6, thinkingMode: "adaptive" }),
100
+ oauthModel({ name: "claude-sonnet-4-6", displayName: "Claude Sonnet 4.6", contextWindow: 1e6, thinkingMode: "adaptive" }),
101
+ oauthModel({ name: "claude-opus-4-6", displayName: "Claude Opus 4.6", contextWindow: 1e6, thinkingMode: "adaptive" }),
102
+ // 4.5 系(Extended thinking;官方发布规格 1M)
103
+ oauthModel({ name: "claude-opus-4-5-20251101", displayName: "Claude Opus 4.5", contextWindow: 1e6, thinkingMode: "extended" }),
104
+ oauthModel({ name: "claude-sonnet-4-5-20250929", displayName: "Claude Sonnet 4.5", contextWindow: 1e6, thinkingMode: "extended" }),
105
+ // haiku-4-5(官方明确 context=200k + Extended thinking)
106
+ oauthModel({ name: "claude-haiku-4-5-20251001", displayName: "Claude Haiku 4.5", contextWindow: 2e5, thinkingMode: "extended" })
107
+ ];
108
+ var OAUTH_MODEL_THINKING_MODE = new Map(
109
+ anthropicOAuthModels.map((m) => [m.name, m.thinkingMode])
110
+ );
111
+ function isAdaptiveThinkingModelId(model) {
112
+ if (!model) return false;
113
+ const tableMode = OAUTH_MODEL_THINKING_MODE.get(model);
114
+ if (tableMode === "adaptive") return true;
115
+ if (tableMode === "extended") return false;
116
+ const n = model.toLowerCase();
117
+ return n.includes("fable-5") || n.includes("opus-5") || n.includes("sonnet-5") || n.includes("opus-4-8") || n.includes("opus-4-7") || n.includes("sonnet-4-6") || n.includes("opus-4-6");
118
+ }
119
+
81
120
  // packages/integrations/qwen/models.ts
82
121
  var qwenModels = [
83
122
  // ── Qwen3 旗舰 ──
@@ -402,21 +441,6 @@ var moonshotModels = [
402
441
  price: { input: 0.6 * 7, output: 2.4 * 7 },
403
442
  provider: "moonshot",
404
443
  description: "Moonshot \u9AD8\u6027\u80FD\u901A\u7528\u6A21\u578B\u3002"
405
- },
406
- // ── 编程 ──
407
- {
408
- name: "kimi-k2.7-code",
409
- displayName: "Kimi K2.7 Code",
410
- hasVision: false,
411
- contextWindow: 262144,
412
- maxOutputTokens: 262144,
413
- jsonOutput: true,
414
- fnCall: true,
415
- supportsTool: true,
416
- supportsReasoningEffort: true,
417
- price: { input: 1.2 * 7, output: 4.8 * 7 },
418
- provider: "moonshot",
419
- description: "Moonshot \u7F16\u7A0B\u4F18\u5316\u6A21\u578B\uFF0C\u9002\u5408\u4EE3\u7801\u751F\u6210\u4E0E Agent \u7F16\u7A0B\u3002"
420
444
  }
421
445
  ];
422
446
  var kimiCodeModels = [
@@ -4545,6 +4569,9 @@ var NEVER = INVALID;
4545
4569
  var PROVIDER_REASONING_EFFORT_VALUES = {
4546
4570
  openai: ["none", "minimal", "low", "medium", "high", "xhigh", "max"],
4547
4571
  deepseek: ["low", "high", "max"],
4572
+ // nolo (Ollama Cloud) 支持 DeepSeek/Kimi/GLM 等 thinking 模型,
4573
+ // reasoning_effort 通过 OpenAI 兼容端点透传到 Ollama Cloud。
4574
+ nolo: ["low", "high", "max"],
4548
4575
  xai: ["low", "medium", "high"],
4549
4576
  grok: ["low", "medium", "high"],
4550
4577
  // none:关闭思考;必须保留,否则上游 clamp 会把 none 抬成 low,
@@ -4695,7 +4722,7 @@ var MODEL_MAP = {
4695
4722
  moonshot: moonshotAllModels
4696
4723
  };
4697
4724
  var MODEL_LOOKUP_MAP = {
4698
- anthropic: anthropicModels,
4725
+ anthropic: [...anthropicModels, ...anthropicOAuthModels],
4699
4726
  xai: xaiModels,
4700
4727
  ...MODEL_MAP
4701
4728
  };
@@ -4789,8 +4816,9 @@ var API_ENDPOINTS = {
4789
4816
  default: "https://api.x.ai/v1/chat/completions"
4790
4817
  },
4791
4818
  deepseek: {
4792
- default: "https://api.deepseek.com/chat/completions",
4793
- responses: "https://api.deepseek.com/v1/responses"
4819
+ // No `responses` entry: the official DeepSeek provider was retired and no
4820
+ // deepseek model declares endpointKey "responses", so it was unreachable.
4821
+ default: "https://api.deepseek.com/chat/completions"
4794
4822
  },
4795
4823
  deepinfra: {
4796
4824
  default: "https://api.deepinfra.com/v1/openai/chat/completions"
@@ -4861,10 +4889,24 @@ function getApiEndpoint(agent) {
4861
4889
  }
4862
4890
  return url;
4863
4891
  }
4892
+ const OAUTH_API_KEY_REFS = /* @__PURE__ */ new Set([
4893
+ "chatgpt",
4894
+ "xai",
4895
+ "antigravity",
4896
+ "claude",
4897
+ "cursor"
4898
+ ]);
4864
4899
  if (!effectiveProvider || effectiveProvider.toLowerCase() === "custom" || agent.apiSource === "custom") {
4865
4900
  if (agent.useServerProxy) {
4866
4901
  return "";
4867
4902
  }
4903
+ const apiKeyRef = agent.apiKeyRef;
4904
+ if (apiKeyRef && OAUTH_API_KEY_REFS.has(apiKeyRef)) {
4905
+ return "";
4906
+ }
4907
+ if (effectiveProvider && API_ENDPOINTS[effectiveProvider]) {
4908
+ return "";
4909
+ }
4868
4910
  throw new Error(
4869
4911
  "Custom provider URL is required when apiSource is 'custom'."
4870
4912
  );
@@ -4889,6 +4931,7 @@ function getApiEndpoint(agent) {
4889
4931
  }
4890
4932
 
4891
4933
  export {
4934
+ isAdaptiveThinkingModelId,
4892
4935
  isModelSupportReasoningEffort,
4893
4936
  clampReasoningEffort,
4894
4937
  MODEL_LOOKUP_MAP,
@@ -5,10 +5,10 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-WRN5EQT7.js";
8
+ } from "./chunk-47QUPRHO.js";
9
9
  import {
10
10
  performFetchRequest
11
- } from "./chunk-6565R2TI.js";
11
+ } from "./chunk-XEWUC53Z.js";
12
12
  import {
13
13
  createSSEParser,
14
14
  createToolRunId,
@@ -19,7 +19,7 @@ import {
19
19
  toolRunSetPending,
20
20
  toolRunStarted,
21
21
  toolRunSucceeded
22
- } from "./chunk-VE6XMVKG.js";
22
+ } from "./chunk-D4NCEGGR.js";
23
23
  import {
24
24
  getPublicImageAgentMode
25
25
  } from "./chunk-VIDPVFP3.js";
@@ -29,13 +29,13 @@ import {
29
29
  messageStreaming,
30
30
  selectCurrentSpaceId,
31
31
  updateToolMessage
32
- } from "./chunk-YNHQIXX5.js";
32
+ } from "./chunk-4LXOVZ4W.js";
33
33
  import {
34
34
  streamAgentChatTurn
35
- } from "./chunk-OQMPU2ML.js";
35
+ } from "./chunk-ZXQ52OY2.js";
36
36
  import {
37
37
  EMPTY_ASSISTANT_REPAIR_PROMPT
38
- } from "./chunk-6MHDWKOT.js";
38
+ } from "./chunk-RIF3XLXK.js";
39
39
  import {
40
40
  accumulateToolCallDelta,
41
41
  createThinkParserState,
@@ -47,10 +47,10 @@ import {
47
47
  } from "./chunk-LSFAWXKC.js";
48
48
  import {
49
49
  getModelInfo
50
- } from "./chunk-4QQFLN5C.js";
50
+ } from "./chunk-OVBVEXZ7.js";
51
51
  import {
52
52
  getApiEndpoint
53
- } from "./chunk-OGGHETUE.js";
53
+ } from "./chunk-HQPG2PIV.js";
54
54
  import {
55
55
  extractCustomId
56
56
  } from "./chunk-DFFIZ25G.js";
@@ -64,10 +64,10 @@ import {
64
64
  } from "./chunk-HNMXYYJR.js";
65
65
  import {
66
66
  selectCurrentServer
67
- } from "./chunk-TTGAVETO.js";
67
+ } from "./chunk-EABWT43X.js";
68
68
  import {
69
69
  write
70
- } from "./chunk-SFXYKGK2.js";
70
+ } from "./chunk-3S2VOMIF.js";
71
71
  import {
72
72
  createDialogMessageKeyAndId,
73
73
  dialogMessageKey,
@@ -1595,7 +1595,23 @@ var sendOpenAICompletionsRequest = async ({
1595
1595
  currentServer: selectCurrentServer(getState()),
1596
1596
  signal,
1597
1597
  token,
1598
- dialogId
1598
+ dialogId,
1599
+ onRetry: (info) => {
1600
+ dispatch(
1601
+ messageStreaming({
1602
+ id: messageId,
1603
+ dialogId,
1604
+ dbKey: msgKey,
1605
+ content: "",
1606
+ role: "assistant",
1607
+ agentKey: agentConfig.dbKey,
1608
+ cybotKey: agentConfig.dbKey,
1609
+ ...activeMessageMetadata ?? {},
1610
+ isStreaming: true,
1611
+ retryProgress: info
1612
+ })
1613
+ );
1614
+ }
1599
1615
  });
1600
1616
  logQuickChatPerfStage(quickChatPerfStartedAt, "openai-completions-fetch-response", {
1601
1617
  ok: response.ok,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  patch,
3
3
  read
4
- } from "./chunk-SFXYKGK2.js";
4
+ } from "./chunk-3S2VOMIF.js";
5
5
  import {
6
6
  DEVICE_LOCAL_OWNER_ID,
7
7
  isDeviceLocalSpaceBody,
@@ -462,8 +462,8 @@ function buildNoloWorkspaceOpenAiTools(args) {
462
462
  // listAgentsFunc 另有 limit(默认 100,最大 500)。如后续对齐需在
463
463
  // parseAgentListArgs / agentListCommands 增加 --limit 透传。
464
464
  });
465
- add("readAgent", "Read one agent config in the Nolo workspace.", {
466
- agent: stringToolParam("Agent key, id, alias, or URL.")
465
+ add("readAgent", "Read one agent's full config from the Nolo workspace. Accepts an agent dbKey (agent-xxx), plain id, alias, or agent URL; resolves it (including public agents via agent-pub-<id>; the server runtime also falls back to handle lookup) and returns the runnable agentKey plus a redacted record with fields such as model, provider, apiSource, tools, prompt, inputPrice, outputPrice, and isPublic. Use it before delegation to confirm an agent's identity and capabilities, or to resolve the agentKey that startAgentRun requires.", {
466
+ agent: stringToolParam("Agent dbKey (e.g. agent-xxx), agent id, alias, or agent URL.")
467
467
  }, ["agent"]);
468
468
  add("listSpaces", "List joined spaces in the Nolo workspace.", {});
469
469
  add("readSpace", "Read one space in the Nolo workspace.", {
@@ -0,0 +1,255 @@
1
+ import {
2
+ isRecord
3
+ } from "./chunk-KUG52IAP.js";
4
+ import {
5
+ asOptionalTrimmedString
6
+ } from "./chunk-G3SUCT4W.js";
7
+
8
+ // packages/agent-runtime/openAiCompatibleMessages.ts
9
+ function preserveAgentStateFields(source, target, options) {
10
+ const mutableTarget = target;
11
+ if (source.role === "assistant") {
12
+ if (!options?.stripReasoningContent && typeof source.reasoning_content === "string") {
13
+ mutableTarget.reasoning_content = source.reasoning_content;
14
+ }
15
+ if (Array.isArray(source.tool_calls)) {
16
+ mutableTarget.tool_calls = source.tool_calls;
17
+ }
18
+ }
19
+ if (source.role === "tool") {
20
+ const toolCallId = typeof source.tool_call_id === "string" ? source.tool_call_id.trim() : typeof source.toolCallId === "string" ? source.toolCallId.trim() : "";
21
+ if (toolCallId) mutableTarget.tool_call_id = toolCallId;
22
+ }
23
+ return target;
24
+ }
25
+ function toOpenAiCompatibleMessages(messages, options) {
26
+ return messages.map(
27
+ (message) => preserveAgentStateFields(message, {
28
+ role: message.role,
29
+ content: message.content ?? ""
30
+ }, options)
31
+ );
32
+ }
33
+ function shouldStripReasoningContentForOutbound(provider, model) {
34
+ const p = provider?.trim().toLowerCase();
35
+ const m = model?.trim().toLowerCase();
36
+ if (!p || !m) return false;
37
+ if (p === "deepseek" || p === "nolo") return m === "deepseek-v4-flash";
38
+ return false;
39
+ }
40
+
41
+ // packages/integrations/openai/responsesHelpers.ts
42
+ var RESPONSES_TOP_LEVEL_SCHEMA_KEYS = ["anyOf", "oneOf", "allOf", "enum", "not"];
43
+ var sanitizeResponsesParameters = (parameters) => {
44
+ if (!isRecord(parameters)) {
45
+ return parameters;
46
+ }
47
+ const next = { ...parameters };
48
+ for (const key of RESPONSES_TOP_LEVEL_SCHEMA_KEYS) {
49
+ delete next[key];
50
+ }
51
+ return next;
52
+ };
53
+ var appendTextPart = (parts, text, role) => {
54
+ if (!text) return;
55
+ const last = parts.at(-1);
56
+ const textType = role === "assistant" ? "output_text" : "input_text";
57
+ if (last?.type === textType) {
58
+ last.text += text;
59
+ return;
60
+ }
61
+ parts.push({ type: textType, text });
62
+ };
63
+ var normalizeMessageParts = (content, role) => {
64
+ if (typeof content === "string") {
65
+ if (!content) return [];
66
+ return [
67
+ {
68
+ type: role === "assistant" ? "output_text" : "input_text",
69
+ text: content
70
+ }
71
+ ];
72
+ }
73
+ const parts = [];
74
+ for (const part of content ?? []) {
75
+ const typedPart = part;
76
+ if (typedPart?.type === "text" && typeof typedPart.text === "string") {
77
+ appendTextPart(parts, typedPart.text, role);
78
+ continue;
79
+ }
80
+ if (typedPart?.type === "image_url" && typeof typedPart.image_url?.url === "string" && typedPart.image_url.url) {
81
+ if (role === "assistant") continue;
82
+ parts.push({
83
+ type: "input_image",
84
+ image_url: typedPart.image_url.url,
85
+ detail: typedPart.image_url.detail
86
+ });
87
+ }
88
+ }
89
+ return parts;
90
+ };
91
+ var normalizeToolOutput = (content) => {
92
+ if (typeof content === "string") return content;
93
+ return JSON.stringify(content ?? "");
94
+ };
95
+ var toResponsesTools = (tools) => {
96
+ if (!Array.isArray(tools) || tools.length === 0) return void 0;
97
+ return tools.map((tool) => {
98
+ const fn = tool?.function;
99
+ if (!fn?.name) return null;
100
+ return {
101
+ type: "function",
102
+ name: fn.name,
103
+ description: fn.description,
104
+ parameters: sanitizeResponsesParameters(fn.parameters),
105
+ strict: fn.strict
106
+ };
107
+ }).filter(Boolean);
108
+ };
109
+ var convertMessagesToResponsesInput = (messages, options) => {
110
+ const input = [];
111
+ for (const message of messages) {
112
+ if (!message?.role) continue;
113
+ if (message.role === "tool") {
114
+ if (!message.tool_call_id) continue;
115
+ input.push({
116
+ type: "function_call_output",
117
+ call_id: message.tool_call_id,
118
+ output: normalizeToolOutput(message.content)
119
+ });
120
+ continue;
121
+ }
122
+ const role = message.role;
123
+ if (role === "assistant" && !options?.stripReasoningContent && typeof message.reasoning_content === "string" && message.reasoning_content) {
124
+ input.push({ type: "reasoning", content: message.reasoning_content });
125
+ }
126
+ const contentParts = normalizeMessageParts(message.content, role);
127
+ if (contentParts.length > 0) {
128
+ input.push({
129
+ type: "message",
130
+ role,
131
+ content: contentParts
132
+ });
133
+ }
134
+ if (role === "assistant" && Array.isArray(message.content)) {
135
+ const replayImages = message.content.map((part) => part).filter(
136
+ (part) => part?.type === "image_url" && typeof part.image_url?.url === "string" && Boolean(part.image_url.url)
137
+ ).map((part) => ({
138
+ type: "input_image",
139
+ image_url: part.image_url.url,
140
+ detail: part.image_url.detail
141
+ }));
142
+ if (replayImages.length > 0) {
143
+ input.push({
144
+ type: "message",
145
+ role: "user",
146
+ content: replayImages
147
+ });
148
+ }
149
+ }
150
+ if (role === "assistant" && Array.isArray(message.tool_calls)) {
151
+ for (const toolCall of message.tool_calls) {
152
+ if (!toolCall?.id || !toolCall.function?.name) continue;
153
+ input.push({
154
+ type: "function_call",
155
+ call_id: toolCall.id,
156
+ name: toolCall.function.name,
157
+ arguments: typeof toolCall.function.arguments === "string" ? toolCall.function.arguments : JSON.stringify(toolCall.function.arguments ?? {})
158
+ });
159
+ }
160
+ }
161
+ }
162
+ return input;
163
+ };
164
+ var extractTextFromResponseOutput = (response) => {
165
+ const parts = [];
166
+ for (const item of response?.output ?? []) {
167
+ if (item?.type !== "message") continue;
168
+ for (const content of item.content ?? []) {
169
+ if (content?.type === "output_text" && typeof content.text === "string") {
170
+ parts.push(content.text);
171
+ }
172
+ }
173
+ }
174
+ return parts.join("");
175
+ };
176
+ var toDataUrl = (base64Data, mimeType) => {
177
+ const normalizedMimeType = asOptionalTrimmedString(mimeType) ?? "image/png";
178
+ return `data:${normalizedMimeType};base64,${base64Data}`;
179
+ };
180
+ var extractImagePartsFromResponseOutput = (response) => {
181
+ const images = [];
182
+ for (const item of response?.output ?? []) {
183
+ if (item?.type === "image_generation_call") {
184
+ const result = asOptionalTrimmedString(item.result);
185
+ if (result) {
186
+ const outputFormat = asOptionalTrimmedString(item.output_format);
187
+ images.push({
188
+ type: "image_url",
189
+ image_url: {
190
+ url: toDataUrl(
191
+ result,
192
+ outputFormat ? `image/${outputFormat}` : void 0
193
+ )
194
+ }
195
+ });
196
+ }
197
+ continue;
198
+ }
199
+ if (item?.type !== "message") continue;
200
+ for (const content of item.content ?? []) {
201
+ const result = asOptionalTrimmedString(content?.result);
202
+ if (content?.type === "output_image" && result) {
203
+ images.push({
204
+ type: "image_url",
205
+ image_url: {
206
+ url: toDataUrl(
207
+ result,
208
+ content.mime_type ?? content.mimeType ?? null
209
+ )
210
+ }
211
+ });
212
+ }
213
+ }
214
+ }
215
+ return images;
216
+ };
217
+ var extractToolCallsFromResponseOutput = (response) => {
218
+ const calls = [];
219
+ for (const item of response?.output ?? []) {
220
+ if (item?.type !== "function_call") continue;
221
+ if (!item.call_id || !item.name) continue;
222
+ calls.push({
223
+ id: item.call_id,
224
+ type: "function",
225
+ function: {
226
+ name: item.name,
227
+ arguments: typeof item.arguments === "string" ? item.arguments : JSON.stringify(item.arguments ?? {})
228
+ }
229
+ });
230
+ }
231
+ return calls;
232
+ };
233
+
234
+ // packages/core/chat/imageParts.ts
235
+ function isImageUrlPart(part) {
236
+ return isRecord(part) && part.type === "image_url";
237
+ }
238
+ function hasImageParts(messages) {
239
+ return messages.some(
240
+ (message) => Array.isArray(message.content) && message.content.some(isImageUrlPart)
241
+ );
242
+ }
243
+
244
+ export {
245
+ isImageUrlPart,
246
+ hasImageParts,
247
+ preserveAgentStateFields,
248
+ toOpenAiCompatibleMessages,
249
+ shouldStripReasoningContentForOutbound,
250
+ toResponsesTools,
251
+ convertMessagesToResponsesInput,
252
+ extractTextFromResponseOutput,
253
+ extractImagePartsFromResponseOutput,
254
+ extractToolCallsFromResponseOutput
255
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_AGENT_BASE_POLICY,
3
3
  DEFAULT_USER_PREFERENCE_PROFILE
4
- } from "./chunk-TTGAVETO.js";
4
+ } from "./chunk-EABWT43X.js";
5
5
 
6
6
  // packages/ai/policy/runtimePolicy.ts
7
7
  var clampLevel = (value, fallback) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  trimTrailingSlash
3
- } from "./chunk-HRQCKQA5.js";
3
+ } from "./chunk-MUCU6ATG.js";
4
4
  import {
5
5
  asTrimmedLowercaseString
6
6
  } from "./chunk-QSJ3HFEF.js";
@@ -2,7 +2,7 @@ import {
2
2
  deleteDbRecord,
3
3
  queryUserRecords,
4
4
  readDbRecord
5
- } from "./chunk-4NLUNENX.js";
5
+ } from "./chunk-C4MMO7W4.js";
6
6
  import {
7
7
  mergeAndDedupUserData
8
8
  } from "./chunk-KQHGZWSV.js";