nolo-cli 0.30.1 → 0.31.0-alpha.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 (108) hide show
  1. package/{_executeModel-FYUR7PQU.js → _executeModel-K47XKKPU.js} +32 -31
  2. package/{action-FENWPT3C.js → action-HI3VRQLP.js} +7 -7
  3. package/{addContentAction-Z5S5ZQ7I.js → addContentAction-NCURJ6PK.js} +6 -6
  4. package/{addDialogAgentAction-VUNVD2XR.js → addDialogAgentAction-RCY4ECF4.js} +5 -5
  5. package/{agentDeleteCommand-HHP47ZB2.js → agentDeleteCommand-7BBZCONG.js} +26 -25
  6. package/{agentEmailCommands-H6KRDTQW.js → agentEmailCommands-D6FAT5HM.js} +38 -37
  7. package/{agentListCommands-GNVFOTB4.js → agentListCommands-YPNNMGSJ.js} +28 -27
  8. package/{agentMachineCommands-4HJHI26F.js → agentMachineCommands-VYRVSKUC.js} +26 -25
  9. package/{agentRecordCommands-W6ITUONM.js → agentRecordCommands-4J52H5NK.js} +37 -36
  10. package/{agentRunCommand-VDLU4VKR.js → agentRunCommand-LH4RA6FA.js} +38 -37
  11. package/{agentRunControl-AKBN2366.js → agentRunControl-SCIVRZWX.js} +9 -1
  12. package/{agentRuntimeLocal-3X3ZTFT2.js → agentRuntimeLocal-G7GK545E.js} +23 -22
  13. package/{agentSlice-5HYCSSTE.js → agentSlice-4ZLEPC3M.js} +6 -6
  14. package/{appDeleteCommands-WFUF34TE.js → appDeleteCommands-AOZED7QJ.js} +27 -26
  15. package/{appDeployCommands-J2EAE53G.js → appDeployCommands-XJY27BDS.js} +27 -26
  16. package/{appDeployStatusCommands-RLXDEHTV.js → appDeployStatusCommands-HKZYAPB2.js} +27 -26
  17. package/{appGetCommands-ZGV3CKCM.js → appGetCommands-VXJLPRYI.js} +27 -26
  18. package/{appListCommands-3VRX3EJI.js → appListCommands-3LU6AB4G.js} +27 -26
  19. package/{authCommand-RR5LAYSW.js → authCommand-3GQR43KB.js} +5 -5
  20. package/{chunk-ZFTCLBEX.js → chunk-2IJAKBK2.js} +3 -1
  21. package/chunk-2K4NDPT5.js +1524 -0
  22. package/{chunk-6QP7LEI6.js → chunk-2MSOY7A5.js} +49 -33
  23. package/{chunk-3IPBZISR.js → chunk-2YT3KLHX.js} +1 -1
  24. package/{chunk-GABCPUMC.js → chunk-3IU7WEJD.js} +1 -1
  25. package/{chunk-Q24P6TUS.js → chunk-43EPBPZ2.js} +1 -1
  26. package/{chunk-5NPAOURO.js → chunk-4URO6HMS.js} +1 -1
  27. package/{chunk-S342XWCB.js → chunk-5EDVWWE3.js} +1 -1
  28. package/{chunk-CTLXD6HB.js → chunk-5JQRISUS.js} +3 -3
  29. package/{chunk-4ZMTXQFB.js → chunk-5MVFYKBL.js} +5 -5
  30. package/{chunk-R5V5G73M.js → chunk-5RDLGLAP.js} +0 -1
  31. package/{chunk-4SAV7BD7.js → chunk-7KNERA53.js} +53 -15
  32. package/{chunk-XORE26Z4.js → chunk-7S54ZGF6.js} +2 -2
  33. package/{chunk-IZ3CBMD5.js → chunk-ATK5WJOA.js} +4 -4
  34. package/chunk-BGTUGS3T.js +702 -0
  35. package/{chunk-YX26YZL4.js → chunk-C3NYMZTQ.js} +16 -14
  36. package/{chunk-R2JHVPHL.js → chunk-CPUZW54L.js} +4 -4
  37. package/{chunk-PJY5AH5A.js → chunk-DPR66GY6.js} +1 -1
  38. package/{chunk-3Z6SPX5X.js → chunk-E2CFIWQR.js} +31 -23
  39. package/{chunk-PACNSC37.js → chunk-E3APEOIM.js} +1 -1
  40. package/{chunk-7QW64TCG.js → chunk-EATVNXFX.js} +7 -7
  41. package/{chunk-G5JHHUAK.js → chunk-F3MP7CP6.js} +1 -1
  42. package/{chunk-YK2QRWTO.js → chunk-FLYQAMF4.js} +3 -3
  43. package/{chunk-446VANPP.js → chunk-G5GVZAXF.js} +4 -4
  44. package/{chunk-KH3JS4D5.js → chunk-H6COXALE.js} +78 -27
  45. package/{chunk-MNUJETMH.js → chunk-K76HYM3O.js} +1 -1
  46. package/{chunk-DKRT67FG.js → chunk-KGEVMUMI.js} +3 -3
  47. package/{chunk-A4JDTA5T.js → chunk-LAXMH7JY.js} +6 -6
  48. package/{chunk-TAS3THIF.js → chunk-LBEWOWVL.js} +4 -4
  49. package/{chunk-72NVMKWA.js → chunk-NEGMZP6Q.js} +1 -1
  50. package/{chunk-QDNVDGLN.js → chunk-NMK2JHKM.js} +9 -7
  51. package/{chunk-JRI2BRJY.js → chunk-OT2AXEQD.js} +26 -5
  52. package/{chunk-LWP3HB56.js → chunk-PTHDLIRB.js} +1 -1
  53. package/{chunk-V5BWE46D.js → chunk-Q6L3O67D.js} +2 -2
  54. package/{chunk-LWYIHJKD.js → chunk-QHWPAW5M.js} +2 -2
  55. package/{chunk-KWCLUYGQ.js → chunk-QL6ELRVS.js} +1 -1
  56. package/chunk-RJ7KLCWY.js +5134 -0
  57. package/{chunk-WJD5RNVB.js → chunk-SFWZUTCI.js} +1 -1
  58. package/{chunk-WTPC3XD4.js → chunk-UDA3ZYLW.js} +1 -1
  59. package/{chunk-YLADSPDU.js → chunk-V54H24CQ.js} +2 -2
  60. package/{chunk-F3A5IZSX.js → chunk-WEID4JLC.js} +2 -2
  61. package/{chunk-IUA36RS4.js → chunk-WMH2G6XJ.js} +58 -124
  62. package/{chunk-4PWB7JRR.js → chunk-XFG3BAKN.js} +1 -0
  63. package/chunk-XGJ75KN2.js +7889 -0
  64. package/{chunk-2TZP235J.js → chunk-XPML3KYZ.js} +6 -6
  65. package/{chunk-2NYIVLAY.js → chunk-YHGHADBQ.js} +2 -2
  66. package/{chunk-MV6UZXZU.js → chunk-YJZGAAVX.js} +14 -12
  67. package/{chunk-BOL2D2JW.js → chunk-ZJ2WITOO.js} +2 -2
  68. package/{chunk-DWQNDGO7.js → chunk-ZJH3LKEW.js} +2 -2
  69. package/{createAgentAutomationAction-EKABYSSA.js → createAgentAutomationAction-AECD5YCU.js} +13 -12
  70. package/{createDialogAction-HLP6TV4H.js → createDialogAction-MZUC37CA.js} +14 -13
  71. package/{createPageAction-4NEEWW6S.js → createPageAction-KRTBWM2S.js} +13 -12
  72. package/{db-IPCJ43PW.js → db-6DPSJ6WT.js} +4 -2
  73. package/{dbSlice-OBV7VFCF.js → dbSlice-BBL3PEVW.js} +5 -5
  74. package/{deleteFile-AC45HYSM.js → deleteFile-RJTEPOT4.js} +3 -3
  75. package/{dialogCommands-XB3ZNSP3.js → dialogCommands-RFADXVV6.js} +27 -26
  76. package/{dialogSlice-4IWM2WIY.js → dialogSlice-EWNZ2HFD.js} +12 -12
  77. package/{docCreateCommands-QSPTTAN7.js → docCreateCommands-ZHX6SX5M.js} +26 -25
  78. package/{docDeleteCommands-2E6JZXCP.js → docDeleteCommands-3EEM7ITO.js} +27 -26
  79. package/{docReadCommands-N2DQVLLT.js → docReadCommands-JOMLMZTC.js} +26 -25
  80. package/{docStore-PFZCPHPC.js → docStore-YKTKKH3N.js} +14 -13
  81. package/{docUpdateCommands-53KFSYEP.js → docUpdateCommands-PGAYLKLC.js} +26 -25
  82. package/{getPricing-67TQVKFV.js → getPricing-QO5TYNCK.js} +2 -2
  83. package/{handleSendMessageAction-4IYJTQAL.js → handleSendMessageAction-VX4CGWAJ.js} +12 -12
  84. package/index.js +63 -63
  85. package/{localDialogRead-P72W2U2R.js → localDialogRead-3DBXVYXS.js} +1 -1
  86. package/{machineCommands-CR34SD5W.js → machineCommands-A2WFB37F.js} +36 -35
  87. package/{machineWsRunDispatch-G4O3NQ3I.js → machineWsRunDispatch-E5R54UWZ.js} +36 -35
  88. package/package.json +1 -1
  89. package/{read-QK7ZRX6G.js → read-64OQDO3I.js} +3 -3
  90. package/{readDocTool-EYDMVRBL.js → readDocTool-MXM3T6PE.js} +1 -1
  91. package/{readlineWorkspace-UAF5D7TC.js → readlineWorkspace-S4A6UYVJ.js} +125 -79
  92. package/{removeDialogAgentAction-TBW3UZJW.js → removeDialogAgentAction-NEKVAMSH.js} +7 -7
  93. package/{runAgentClientLoop-R5WNOWHI.js → runAgentClientLoop-C6IIUQ36.js} +27 -26
  94. package/{setDialogExtraReferencesAction-Q3ANF2NR.js → setDialogExtraReferencesAction-WTOHQDIV.js} +6 -6
  95. package/{setPrimaryDialogAgentAction-FQ5R3EFJ.js → setPrimaryDialogAgentAction-LDJOYC4F.js} +7 -7
  96. package/{settingSlice-JKKV2T7O.js → settingSlice-4M37TN7V.js} +6 -6
  97. package/{skillDiscovery-I3QRA7NE.js → skillDiscovery-Y3HALY2U.js} +3 -3
  98. package/{spaceCommands-RZN5K5ND.js → spaceCommands-SKCMLOC6.js} +210 -28
  99. package/{spaceSlice-3BVGRL3V.js → spaceSlice-6VOPELQN.js} +13 -12
  100. package/{streamAgentChatTurn-RVOJZ2HO.js → streamAgentChatTurn-623CNKWF.js} +35 -32
  101. package/{switchDialogAgentAction-QQGVE4SL.js → switchDialogAgentAction-XVWGKR2Z.js} +5 -5
  102. package/{tableCommands-PRJNWN6Q.js → tableCommands-RJZ3V4TF.js} +1 -1
  103. package/{tools-QAKUH2P6.js → tools-IN4B36PN.js} +21 -20
  104. package/{tuiSummaryLlmCaller-YQBN5IMG.js → tuiSummaryLlmCaller-SRZ4QQUP.js} +19 -5
  105. package/{updateDialogTitleAction-4O5PZVQR.js → updateDialogTitleAction-4ABIVEYY.js} +18 -16
  106. package/chunk-EIQDGAAE.js +0 -5083
  107. package/chunk-O6YCGBJB.js +0 -16338
  108. package/chunk-OB6FBSH3.js +0 -47
@@ -0,0 +1,1524 @@
1
+ import {
2
+ GMI_CHAT_COMPLETIONS_URL,
3
+ PLATFORM_HOSTED_CHAT_COMPLETIONS_URL,
4
+ PLATFORM_HOSTED_KIMI_K26_MODEL,
5
+ PLATFORM_HOSTED_KIMI_PROVIDER,
6
+ cloudflareModels,
7
+ deepinfraModels,
8
+ fireworksModels,
9
+ getCloudflareWorkersAiChatCompletionsUrl,
10
+ gmiModels,
11
+ googleModels,
12
+ openAIModels,
13
+ openrouterModels,
14
+ platformHostedModels,
15
+ xaiModels,
16
+ zaiModels
17
+ } from "./chunk-CAENRKNJ.js";
18
+
19
+ // packages/integrations/anthropic/anthropicModels.ts
20
+ var anthropicModels = [
21
+ {
22
+ name: "claude-3-5-sonnet-latest",
23
+ displayName: "Claude 3.5 Sonnet",
24
+ hasVision: true,
25
+ description: "Our most intelligent model to date",
26
+ contextWindow: 2e5,
27
+ maxOutputTokens: 8192,
28
+ price: {
29
+ input: 27,
30
+ // $3/MTok * 9
31
+ output: 135,
32
+ // $15/MTok * 9
33
+ cachingWrite: 33.75,
34
+ // $3.75/MTok * 9
35
+ cachingRead: 2.7
36
+ // $0.30/MTok * 9
37
+ }
38
+ },
39
+ {
40
+ name: "claude-3-7-sonnet-latest",
41
+ displayName: "Claude 3.7 Sonnet",
42
+ hasVision: true,
43
+ description: "Our most intelligent model to date",
44
+ contextWindow: 2e5,
45
+ maxOutputTokens: 8192,
46
+ price: {
47
+ input: 27,
48
+ // $3/MTok * 9
49
+ output: 135,
50
+ // $15/MTok * 9
51
+ cachingWrite: 33.75,
52
+ // $3.75/MTok * 9
53
+ cachingRead: 2.7
54
+ // $0.30/MTok * 9
55
+ }
56
+ },
57
+ {
58
+ name: "claude-3-5-haiku-20241022",
59
+ displayName: "Claude 3.5 Haiku",
60
+ hasVision: false,
61
+ description: "Fastest, most cost-effective model",
62
+ contextWindow: 2e5,
63
+ maxOutputTokens: 8192,
64
+ price: {
65
+ input: 7.2,
66
+ // $0.80/MTok * 9
67
+ output: 36,
68
+ // $4/MTok * 9
69
+ cachingWrite: 9,
70
+ // $1/MTok * 9
71
+ cachingRead: 0.72
72
+ // $0.08/MTok * 9
73
+ }
74
+ }
75
+ ];
76
+
77
+ // packages/integrations/anthropic/anthropicOAuthModels.ts
78
+ var oauthModel = ({ name, displayName, contextWindow, thinkingMode, maxOutputTokens }) => ({
79
+ name,
80
+ displayName,
81
+ hasVision: true,
82
+ description: `OAuth \u8BA2\u9605\u6A21\u578B\uFF08${displayName}\uFF0C${thinkingMode === "adaptive" ? "Adaptive thinking" : "Extended thinking"}\uFF09`,
83
+ contextWindow,
84
+ ...maxOutputTokens ? { maxOutputTokens } : {},
85
+ supportsReasoningEffort: true,
86
+ price: { input: 0, output: 0 }
87
+ });
88
+ var anthropicOAuthModels = [
89
+ // 5 代(1M + Adaptive thinking always-on;官方 max output 128k)
90
+ oauthModel({ name: "claude-fable-5", displayName: "Claude Fable 5", contextWindow: 1e6, thinkingMode: "adaptive", maxOutputTokens: 128e3 }),
91
+ oauthModel({ name: "claude-opus-5", displayName: "Claude Opus 5", contextWindow: 1e6, thinkingMode: "adaptive", maxOutputTokens: 128e3 }),
92
+ oauthModel({ name: "claude-sonnet-5", displayName: "Claude Sonnet 5", contextWindow: 1e6, thinkingMode: "adaptive", maxOutputTokens: 128e3 }),
93
+ // 4.6/4.7/4.8 系(Adaptive thinking;context 官方未单列,参照 fuzzy claude-4.6→1M)
94
+ oauthModel({ name: "claude-opus-4-8", displayName: "Claude Opus 4.8", contextWindow: 1e6, thinkingMode: "adaptive" }),
95
+ oauthModel({ name: "claude-opus-4-7", displayName: "Claude Opus 4.7", contextWindow: 1e6, thinkingMode: "adaptive" }),
96
+ oauthModel({ name: "claude-sonnet-4-6", displayName: "Claude Sonnet 4.6", contextWindow: 1e6, thinkingMode: "adaptive" }),
97
+ oauthModel({ name: "claude-opus-4-6", displayName: "Claude Opus 4.6", contextWindow: 1e6, thinkingMode: "adaptive" }),
98
+ // 4.5 系(Extended thinking;官方发布规格 1M)
99
+ oauthModel({ name: "claude-opus-4-5-20251101", displayName: "Claude Opus 4.5", contextWindow: 1e6, thinkingMode: "extended" }),
100
+ oauthModel({ name: "claude-sonnet-4-5-20250929", displayName: "Claude Sonnet 4.5", contextWindow: 1e6, thinkingMode: "extended" }),
101
+ // haiku-4-5(官方明确 context=200k + Extended thinking)
102
+ oauthModel({ name: "claude-haiku-4-5-20251001", displayName: "Claude Haiku 4.5", contextWindow: 2e5, thinkingMode: "extended" })
103
+ ];
104
+ var OAUTH_MODEL_THINKING_MODE = new Map(
105
+ anthropicOAuthModels.map((m) => [m.name, m.thinkingMode])
106
+ );
107
+ function isAdaptiveThinkingModelId(model) {
108
+ if (!model) return false;
109
+ const tableMode = OAUTH_MODEL_THINKING_MODE.get(model);
110
+ if (tableMode === "adaptive") return true;
111
+ if (tableMode === "extended") return false;
112
+ const n = model.toLowerCase();
113
+ 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");
114
+ }
115
+
116
+ // packages/integrations/qwen/models.ts
117
+ var qwenModels = [
118
+ // ── Qwen3 旗舰 ──
119
+ {
120
+ name: "qwen3.8-max",
121
+ displayName: "Qwen3.8 Max",
122
+ hasVision: true,
123
+ contextWindow: 1e6,
124
+ maxOutputTokens: 131072,
125
+ jsonOutput: true,
126
+ fnCall: true,
127
+ supportsTool: true,
128
+ supportsReasoningEffort: true,
129
+ // 官方价:输入 ¥12/M、输出 ¥36/M;缓存命中 ¥1.5/M、显式缓存创建 ¥15/M、显式缓存命中 ¥1/M。
130
+ price: { input: 12, output: 36 },
131
+ provider: "qwen",
132
+ description: "2.4\u4E07\u4EBF\u53C2\u6570 MoE \u65D7\u8230\uFF0C1M \u4E0A\u4E0B\u6587\uFF08\u8F93\u5165 991K / \u8F93\u51FA 131K / \u601D\u7EF4\u94FE 262K\uFF09\uFF0C\u539F\u751F\u89C6\u89C9\u7406\u89E3\u8D2F\u7A7F\u89C4\u5212-\u6267\u884C-\u9A8C\u8BC1\uFF0C\u81EA\u4E3B\u7F16\u7A0B\u53EF\u4EA4\u4ED8\u5B8C\u6574\u9879\u76EE\u3002"
133
+ },
134
+ {
135
+ name: "qwen3-max",
136
+ displayName: "Qwen3 Max",
137
+ hasVision: true,
138
+ contextWindow: 262144,
139
+ maxOutputTokens: 32768,
140
+ jsonOutput: true,
141
+ fnCall: true,
142
+ supportsTool: true,
143
+ supportsReasoningEffort: true,
144
+ price: { input: 6, output: 24 },
145
+ provider: "qwen",
146
+ description: "\u5343\u95EE3 \u65D7\u8230\u6A21\u578B\uFF0C\u652F\u6301\u601D\u8003\u6A21\u5F0F\u3001\u51FD\u6570\u8C03\u7528\u3001\u7ED3\u6784\u5316\u8F93\u51FA\u3002"
147
+ },
148
+ {
149
+ name: "qwen3-max-preview",
150
+ displayName: "Qwen3 Max Preview",
151
+ hasVision: true,
152
+ contextWindow: 81920,
153
+ maxOutputTokens: 32768,
154
+ jsonOutput: true,
155
+ fnCall: true,
156
+ supportsTool: true,
157
+ supportsReasoningEffort: true,
158
+ price: { input: 6, output: 24 },
159
+ provider: "qwen"
160
+ },
161
+ {
162
+ name: "qwen3-235b-a22b-instruct-2507",
163
+ displayName: "Qwen3 235B A22B Instruct",
164
+ hasVision: true,
165
+ contextWindow: 262144,
166
+ maxOutputTokens: 32768,
167
+ jsonOutput: true,
168
+ fnCall: true,
169
+ supportsTool: true,
170
+ supportsReasoningEffort: true,
171
+ price: { input: 4, output: 12 },
172
+ provider: "qwen"
173
+ },
174
+ {
175
+ name: "qwen3-next-80b-a3b-instruct",
176
+ displayName: "Qwen3 Next 80B A3B Instruct",
177
+ hasVision: true,
178
+ contextWindow: 81920,
179
+ maxOutputTokens: 32768,
180
+ jsonOutput: true,
181
+ fnCall: true,
182
+ supportsTool: true,
183
+ supportsReasoningEffort: true,
184
+ price: { input: 2, output: 6 },
185
+ provider: "qwen"
186
+ },
187
+ // ── Qwen3-Coder 编程系列 ──
188
+ {
189
+ name: "qwen3-coder-plus",
190
+ displayName: "Qwen3 Coder Plus",
191
+ hasVision: false,
192
+ contextWindow: 1048576,
193
+ maxOutputTokens: 65536,
194
+ jsonOutput: true,
195
+ fnCall: true,
196
+ supportsTool: true,
197
+ supportsReasoningEffort: true,
198
+ price: { input: 3, output: 9 },
199
+ provider: "qwen",
200
+ description: "\u5343\u95EE3 \u7F16\u7A0B\u65D7\u8230\uFF0C1M \u957F\u4E0A\u4E0B\u6587\uFF0C\u9002\u5408\u4EE3\u7801\u751F\u6210\u4E0E Agent \u7F16\u7A0B\u3002"
201
+ },
202
+ {
203
+ name: "qwen3-coder-flash",
204
+ displayName: "Qwen3 Coder Flash",
205
+ hasVision: false,
206
+ contextWindow: 1048576,
207
+ maxOutputTokens: 65536,
208
+ jsonOutput: true,
209
+ fnCall: true,
210
+ supportsTool: true,
211
+ supportsReasoningEffort: true,
212
+ price: { input: 1, output: 3 },
213
+ provider: "qwen"
214
+ },
215
+ {
216
+ name: "qwen3-coder-480b-a35b-instruct",
217
+ displayName: "Qwen3 Coder 480B A35B Instruct",
218
+ hasVision: false,
219
+ contextWindow: 1048576,
220
+ maxOutputTokens: 65536,
221
+ jsonOutput: true,
222
+ fnCall: true,
223
+ supportsTool: true,
224
+ supportsReasoningEffort: true,
225
+ price: { input: 5, output: 15 },
226
+ provider: "qwen"
227
+ },
228
+ // ── 长上下文 ──
229
+ {
230
+ name: "qwen-long",
231
+ displayName: "Qwen Long",
232
+ hasVision: false,
233
+ contextWindow: 10485760,
234
+ maxOutputTokens: 8192,
235
+ jsonOutput: true,
236
+ fnCall: false,
237
+ supportsTool: false,
238
+ price: { input: 0.5, output: 2 },
239
+ provider: "qwen",
240
+ description: "10M \u8D85\u957F\u4E0A\u4E0B\u6587\uFF0C\u9002\u5408\u957F\u6587\u6863\u5904\u7406\u3002"
241
+ },
242
+ // ── 旧版主力(仍常用) ──
243
+ {
244
+ name: "qwen-plus",
245
+ displayName: "Qwen Plus",
246
+ hasVision: true,
247
+ contextWindow: 1048576,
248
+ maxOutputTokens: 32768,
249
+ jsonOutput: true,
250
+ fnCall: true,
251
+ supportsTool: true,
252
+ supportsReasoningEffort: true,
253
+ price: { input: 0.8, output: 2 },
254
+ provider: "qwen"
255
+ },
256
+ {
257
+ name: "qwen-turbo",
258
+ displayName: "Qwen Turbo",
259
+ hasVision: false,
260
+ contextWindow: 131072,
261
+ maxOutputTokens: 8192,
262
+ jsonOutput: true,
263
+ fnCall: true,
264
+ supportsTool: true,
265
+ price: { input: 0.3, output: 0.6 },
266
+ provider: "qwen"
267
+ },
268
+ {
269
+ name: "qwen-flash",
270
+ displayName: "Qwen Flash",
271
+ hasVision: false,
272
+ contextWindow: 131072,
273
+ maxOutputTokens: 8192,
274
+ jsonOutput: true,
275
+ fnCall: true,
276
+ supportsTool: true,
277
+ price: { input: 0.1, output: 0.3 },
278
+ provider: "qwen"
279
+ },
280
+ // ── 推理(QwQ) ──
281
+ {
282
+ name: "qwq-plus",
283
+ displayName: "QwQ Plus",
284
+ hasVision: false,
285
+ contextWindow: 131072,
286
+ maxOutputTokens: 32768,
287
+ jsonOutput: true,
288
+ fnCall: true,
289
+ supportsTool: true,
290
+ supportsReasoningEffort: true,
291
+ price: { input: 2, output: 8 },
292
+ provider: "qwen",
293
+ description: "\u6DF1\u5EA6\u601D\u8003\u63A8\u7406\u6A21\u578B\u3002"
294
+ }
295
+ ];
296
+ var qwenTokenPlanModels = [
297
+ // ── 千问 ──
298
+ {
299
+ name: "qwen3.8-max",
300
+ displayName: "Qwen3.8 Max",
301
+ hasVision: true,
302
+ contextWindow: 1e6,
303
+ maxOutputTokens: 131072,
304
+ jsonOutput: true,
305
+ fnCall: true,
306
+ supportsTool: true,
307
+ supportsReasoningEffort: true,
308
+ price: { input: 0, output: 0 },
309
+ provider: "qwen",
310
+ description: "2.4\u4E07\u4EBF\u53C2\u6570 MoE \u65D7\u8230\uFF0C\u63A8\u7406\u3001\u89C6\u89C9\u7406\u89E3\u3001\u6587\u672C\u751F\u6210\uFF1B1M \u4E0A\u4E0B\u6587\u3001131K \u8F93\u51FA\u3001262K \u601D\u7EF4\u94FE\u3002"
311
+ },
312
+ {
313
+ name: "qwen3.7-max",
314
+ displayName: "Qwen3.7 Max",
315
+ hasVision: false,
316
+ contextWindow: 262144,
317
+ maxOutputTokens: 32768,
318
+ jsonOutput: true,
319
+ fnCall: true,
320
+ supportsTool: true,
321
+ supportsReasoningEffort: true,
322
+ price: { input: 0, output: 0 },
323
+ provider: "qwen",
324
+ description: "\u63A8\u7406\u6A21\u578B\u3001\u6587\u672C\u751F\u6210\u3002"
325
+ },
326
+ {
327
+ name: "qwen3.7-plus",
328
+ displayName: "Qwen3.7 Plus",
329
+ hasVision: true,
330
+ contextWindow: 262144,
331
+ maxOutputTokens: 32768,
332
+ jsonOutput: true,
333
+ fnCall: true,
334
+ supportsTool: true,
335
+ supportsReasoningEffort: true,
336
+ price: { input: 0, output: 0 },
337
+ provider: "qwen",
338
+ description: "\u63A8\u7406\u6A21\u578B\u3001\u89C6\u89C9\u7406\u89E3\u3001\u6587\u672C\u751F\u6210\u3002"
339
+ },
340
+ {
341
+ name: "qwen3.6-flash",
342
+ displayName: "Qwen3.6 Flash",
343
+ hasVision: true,
344
+ contextWindow: 262144,
345
+ maxOutputTokens: 32768,
346
+ jsonOutput: true,
347
+ fnCall: true,
348
+ supportsTool: true,
349
+ supportsReasoningEffort: true,
350
+ price: { input: 0, output: 0 },
351
+ provider: "qwen",
352
+ description: "\u63A8\u7406\u6A21\u578B\u3001\u89C6\u89C9\u7406\u89E3\u3001\u6587\u672C\u751F\u6210\uFF08\u8F7B\u91CF\u5FEB\u901F\uFF09\u3002"
353
+ },
354
+ // ── 智谱 AI ──
355
+ {
356
+ name: "glm-5.2",
357
+ displayName: "GLM 5.2",
358
+ hasVision: false,
359
+ contextWindow: 1e6,
360
+ maxOutputTokens: 16384,
361
+ jsonOutput: true,
362
+ fnCall: true,
363
+ supportsTool: true,
364
+ supportsReasoningEffort: true,
365
+ price: { input: 0, output: 0 },
366
+ provider: "qwen",
367
+ description: "\u667A\u8C31 AI \u63A8\u7406\u6A21\u578B\u3001\u6587\u672C\u751F\u6210\u3002"
368
+ },
369
+ // ── DeepSeek ──
370
+ {
371
+ name: "deepseek-v4-pro",
372
+ displayName: "DeepSeek V4 Pro",
373
+ hasVision: false,
374
+ contextWindow: 1e6,
375
+ maxOutputTokens: 384e3,
376
+ jsonOutput: true,
377
+ fnCall: true,
378
+ supportsTool: true,
379
+ supportsReasoningEffort: true,
380
+ price: { input: 0, output: 0 },
381
+ provider: "qwen",
382
+ description: "DeepSeek \u63A8\u7406\u6A21\u578B\u3001\u6587\u672C\u751F\u6210\u3002"
383
+ },
384
+ // ── 万相(图片生成)──
385
+ {
386
+ name: "wan2.7-image",
387
+ displayName: "Wan2.7 Image",
388
+ hasVision: false,
389
+ hasImageOutput: true,
390
+ contextWindow: 0,
391
+ maxOutputTokens: 0,
392
+ price: { input: 0, output: 0 },
393
+ provider: "qwen",
394
+ description: "\u4E07\u76F8\u56FE\u7247\u751F\u6210\u3002"
395
+ },
396
+ {
397
+ name: "wan2.7-image-pro",
398
+ displayName: "Wan2.7 Image Pro",
399
+ hasVision: false,
400
+ hasImageOutput: true,
401
+ contextWindow: 0,
402
+ maxOutputTokens: 0,
403
+ price: { input: 0, output: 0 },
404
+ provider: "qwen",
405
+ description: "\u4E07\u76F8\u56FE\u7247\u751F\u6210\uFF08Pro\uFF09\u3002"
406
+ }
407
+ ];
408
+
409
+ // packages/integrations/moonshot/models.ts
410
+ var moonshotModels = [
411
+ // ── 旗舰 ──
412
+ {
413
+ name: "kimi-k3",
414
+ displayName: "Kimi K3",
415
+ hasVision: true,
416
+ contextWindow: 1e6,
417
+ maxOutputTokens: 262144,
418
+ jsonOutput: true,
419
+ fnCall: true,
420
+ supportsTool: true,
421
+ supportsReasoningEffort: true,
422
+ price: { input: 3 * 7, output: 15 * 7 },
423
+ provider: "moonshot",
424
+ description: "Moonshot \u65D7\u8230\u6A21\u578B\uFF0C\u539F\u751F\u591A\u6A21\u6001\uFF0C1M \u4E0A\u4E0B\u6587\uFF0C\u957F\u7A0B\u7F16\u7A0B\u4E0E\u6DF1\u5EA6\u63A8\u7406\u3002"
425
+ },
426
+ // ── 通用 ──
427
+ {
428
+ name: "kimi-k2.6",
429
+ displayName: "Kimi K2.6",
430
+ hasVision: true,
431
+ contextWindow: 262144,
432
+ maxOutputTokens: 262144,
433
+ jsonOutput: true,
434
+ fnCall: true,
435
+ supportsTool: true,
436
+ supportsReasoningEffort: true,
437
+ price: { input: 0.6 * 7, output: 2.4 * 7 },
438
+ provider: "moonshot",
439
+ description: "Moonshot \u9AD8\u6027\u80FD\u901A\u7528\u6A21\u578B\u3002"
440
+ }
441
+ ];
442
+ var kimiCodeModels = [
443
+ // ── 旗舰编程 ──
444
+ {
445
+ name: "k3",
446
+ displayName: "Kimi K3",
447
+ hasVision: false,
448
+ contextWindow: 1e6,
449
+ maxOutputTokens: 262144,
450
+ jsonOutput: true,
451
+ fnCall: true,
452
+ supportsTool: true,
453
+ supportsReasoningEffort: true,
454
+ price: { input: 0, output: 0 },
455
+ provider: "moonshot",
456
+ description: "Kimi \u6700\u5F3A\u65D7\u8230\u7F16\u7A0B\u6A21\u578B\uFF0C2.8T \u53C2\u6570\uFF0C1M \u4E0A\u4E0B\u6587\uFF0Clow/high/max \u4E09\u6863\u601D\u8003\u6DF1\u5EA6\uFF0C\u64C5\u957F\u590D\u6742\u5DE5\u7A0B\u4E0E\u957F\u7A0B\u63A8\u7406\u3002Moderato \u53CA\u4EE5\u4E0A\u53EF\u7528\u3002"
457
+ },
458
+ // ── 旗舰编程(256K 上下文版)──
459
+ {
460
+ name: "k3-256k",
461
+ displayName: "Kimi K3 256K",
462
+ hasVision: false,
463
+ contextWindow: 262144,
464
+ maxOutputTokens: 262144,
465
+ jsonOutput: true,
466
+ fnCall: true,
467
+ supportsTool: true,
468
+ supportsReasoningEffort: true,
469
+ price: { input: 0, output: 0 },
470
+ provider: "moonshot",
471
+ description: "K3 \u7684 256K \u4E0A\u4E0B\u6587\u7248\uFF0C\u6D88\u8017\u7EA6\u4E3A k3 \u7684\u4E00\u534A\uFF0C\u9002\u5408\u65E5\u5E38\u95EE\u7B54\u4E0E\u4EE3\u7801\u8865\u5168\u3002\u4E0D\u652F\u6301\u89C6\u9891\u8F93\u5165\u3002Moderato \u53CA\u4EE5\u4E0A\u53EF\u7528\u3002"
472
+ },
473
+ // ── 成熟编程 ──
474
+ {
475
+ name: "kimi-for-coding",
476
+ displayName: "Kimi K2.7 Code",
477
+ hasVision: false,
478
+ contextWindow: 262144,
479
+ maxOutputTokens: 262144,
480
+ jsonOutput: true,
481
+ fnCall: true,
482
+ supportsTool: true,
483
+ supportsReasoningEffort: true,
484
+ price: { input: 0, output: 0 },
485
+ provider: "moonshot",
486
+ description: "\u6210\u719F\u7A33\u5B9A\u7684 Coding \u6A21\u578B\uFF0CThinking \u5F00\u542F\u4E0B\u53EF\u9760\u9075\u5FAA\u6307\u4EE4\uFF0C\u7F16\u7A0B\u4EFB\u52A1\u6210\u529F\u7387\u9AD8\u3002\u6240\u6709\u4F1A\u5458\u53EF\u7528\u3002"
487
+ },
488
+ // ── 高速编程 ──
489
+ {
490
+ name: "kimi-for-coding-highspeed",
491
+ displayName: "Kimi K2.7 Code \u9AD8\u901F\u7248",
492
+ hasVision: false,
493
+ contextWindow: 262144,
494
+ maxOutputTokens: 262144,
495
+ jsonOutput: true,
496
+ fnCall: true,
497
+ supportsTool: true,
498
+ supportsReasoningEffort: true,
499
+ price: { input: 0, output: 0 },
500
+ provider: "moonshot",
501
+ description: "K2.7 Code \u9AD8\u901F\u7248\uFF0C\u7F16\u7801\u80FD\u529B\u4E00\u81F4\uFF0C\u8F93\u51FA\u901F\u5EA6\u7EA6 6 \u500D\u3001\u6D88\u8017\u7EA6 3 \u500D\u3002Allegretto \u53CA\u4EE5\u4E0A\u53EF\u7528\u3002"
502
+ }
503
+ ];
504
+
505
+ // packages/integrations/opencode/models.ts
506
+ var opencodeGoModels = [
507
+ // ── OpenAI ──
508
+ {
509
+ name: "gpt-5.6-luna",
510
+ displayName: "GPT-5.6 Luna (Fast)",
511
+ hasVision: true,
512
+ contextWindow: 272e3,
513
+ maxOutputTokens: 128e3,
514
+ jsonOutput: true,
515
+ fnCall: true,
516
+ supportsTool: true,
517
+ price: { input: 0, output: 0 },
518
+ provider: "opencode-go",
519
+ description: "OpenAI GPT-5.6 Luna \u5FEB\u901F\u6A21\u578B\uFF0COpenCode Go \u8BA2\u9605\u542B\u3002"
520
+ },
521
+ // gpt-5.6-sol 不在 Go 订阅内:GET /models 不返回它,直接调用返回
522
+ // 401 "Model gpt-5.6-sol is not supported"(实测 2026-08-03)。
523
+ // ── Grok ──
524
+ {
525
+ name: "grok-4.5",
526
+ displayName: "Grok 4.5",
527
+ hasVision: true,
528
+ contextWindow: 5e5,
529
+ maxOutputTokens: 262144,
530
+ jsonOutput: true,
531
+ fnCall: true,
532
+ supportsTool: true,
533
+ price: { input: 0, output: 0 },
534
+ provider: "opencode-go",
535
+ description: "xAI Grok 4.5\uFF0COpenCode Go \u8BA2\u9605\u542B\u3002"
536
+ },
537
+ // ── Kimi ──
538
+ {
539
+ name: "kimi-k3",
540
+ displayName: "Kimi K3",
541
+ hasVision: true,
542
+ contextWindow: 1e6,
543
+ maxOutputTokens: 262144,
544
+ jsonOutput: true,
545
+ fnCall: true,
546
+ supportsTool: true,
547
+ price: { input: 0, output: 0 },
548
+ provider: "opencode-go",
549
+ description: "Kimi K3 \u65D7\u8230\uFF0COpenCode Go \u8BA2\u9605\u542B\u3002"
550
+ },
551
+ // ── Qwen ──
552
+ {
553
+ name: "qwen3.8-max",
554
+ displayName: "Qwen3.8 Max",
555
+ hasVision: true,
556
+ contextWindow: 262144,
557
+ maxOutputTokens: 32768,
558
+ jsonOutput: true,
559
+ fnCall: true,
560
+ supportsTool: true,
561
+ price: { input: 0, output: 0 },
562
+ provider: "opencode-go",
563
+ description: "\u5343\u95EE 3.8 Max \u65D7\u8230\uFF0COpenCode Go \u8BA2\u9605\u542B\u3002"
564
+ },
565
+ {
566
+ name: "qwen3.7-max",
567
+ displayName: "Qwen3.7 Max",
568
+ hasVision: false,
569
+ contextWindow: 262144,
570
+ maxOutputTokens: 32768,
571
+ jsonOutput: true,
572
+ fnCall: true,
573
+ supportsTool: true,
574
+ price: { input: 0, output: 0 },
575
+ provider: "opencode-go",
576
+ description: "\u5343\u95EE 3.7 Max\uFF0COpenCode Go \u8BA2\u9605\u542B\u3002"
577
+ },
578
+ // ── GLM ──
579
+ {
580
+ name: "glm-5.2",
581
+ displayName: "GLM 5.2",
582
+ hasVision: false,
583
+ contextWindow: 1e6,
584
+ maxOutputTokens: 16384,
585
+ jsonOutput: true,
586
+ fnCall: true,
587
+ supportsTool: true,
588
+ price: { input: 0, output: 0 },
589
+ provider: "opencode-go",
590
+ description: "\u667A\u8C31 GLM 5.2\uFF0COpenCode Go \u8BA2\u9605\u542B\u3002"
591
+ },
592
+ // ── MiMo ──
593
+ {
594
+ name: "mimo-v2.5-pro",
595
+ displayName: "MiMo V2.5 Pro",
596
+ hasVision: false,
597
+ contextWindow: 131072,
598
+ maxOutputTokens: 16384,
599
+ jsonOutput: true,
600
+ fnCall: true,
601
+ supportsTool: true,
602
+ price: { input: 0, output: 0 },
603
+ provider: "opencode-go",
604
+ description: "\u5C0F\u7C73 MiMo V2.5 Pro\uFF0COpenCode Go \u8BA2\u9605\u542B\u3002"
605
+ },
606
+ // ── MiniMax ──
607
+ {
608
+ name: "minimax-m3",
609
+ displayName: "MiniMax M3",
610
+ hasVision: true,
611
+ contextWindow: 1e6,
612
+ maxOutputTokens: 262144,
613
+ jsonOutput: true,
614
+ fnCall: true,
615
+ supportsTool: true,
616
+ price: { input: 0, output: 0 },
617
+ provider: "opencode-go",
618
+ description: "MiniMax M3\uFF0COpenCode Go \u8BA2\u9605\u542B\u3002"
619
+ },
620
+ // ── DeepSeek ──
621
+ {
622
+ name: "deepseek-v4-pro",
623
+ displayName: "DeepSeek V4 Pro",
624
+ hasVision: false,
625
+ contextWindow: 1e6,
626
+ maxOutputTokens: 384e3,
627
+ jsonOutput: true,
628
+ fnCall: true,
629
+ supportsTool: true,
630
+ price: { input: 0, output: 0 },
631
+ provider: "opencode-go",
632
+ description: "DeepSeek V4 Pro\uFF0COpenCode Go \u8BA2\u9605\u542B\u3002"
633
+ },
634
+ {
635
+ name: "deepseek-v4-flash",
636
+ displayName: "DeepSeek V4 Flash",
637
+ hasVision: false,
638
+ contextWindow: 1e6,
639
+ maxOutputTokens: 384e3,
640
+ jsonOutput: true,
641
+ fnCall: true,
642
+ supportsTool: true,
643
+ price: { input: 0, output: 0 },
644
+ provider: "opencode-go",
645
+ description: "DeepSeek V4 Flash\uFF0COpenCode Go \u8BA2\u9605\u542B\u3002"
646
+ }
647
+ ];
648
+
649
+ // node_modules/valibot/dist/index.mjs
650
+ var store$4;
651
+ var DEFAULT_CONFIG = {
652
+ lang: void 0,
653
+ message: void 0,
654
+ abortEarly: void 0,
655
+ abortPipeEarly: void 0
656
+ };
657
+ // @__NO_SIDE_EFFECTS__
658
+ function getGlobalConfig(config$1) {
659
+ if (!config$1 && !store$4) return DEFAULT_CONFIG;
660
+ return {
661
+ lang: config$1?.lang ?? store$4?.lang,
662
+ message: config$1?.message,
663
+ abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
664
+ abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
665
+ };
666
+ }
667
+ var store$3;
668
+ // @__NO_SIDE_EFFECTS__
669
+ function getGlobalMessage(lang) {
670
+ return store$3?.get(lang);
671
+ }
672
+ var store$2;
673
+ // @__NO_SIDE_EFFECTS__
674
+ function getSchemaMessage(lang) {
675
+ return store$2?.get(lang);
676
+ }
677
+ var store$1;
678
+ // @__NO_SIDE_EFFECTS__
679
+ function getSpecificMessage(reference, lang) {
680
+ return store$1?.get(reference)?.get(lang);
681
+ }
682
+ // @__NO_SIDE_EFFECTS__
683
+ function _stringify(input) {
684
+ const type = typeof input;
685
+ if (type === "string") return `"${input}"`;
686
+ if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
687
+ if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
688
+ return type;
689
+ }
690
+ function _addIssue(context, label, dataset, config$1, other) {
691
+ const input = other && "input" in other ? other.input : dataset.value;
692
+ const expected = other?.expected ?? context.expects ?? null;
693
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
694
+ const issue = {
695
+ kind: context.kind,
696
+ type: context.type,
697
+ input,
698
+ expected,
699
+ received,
700
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
701
+ requirement: context.requirement,
702
+ path: other?.path,
703
+ issues: other?.issues,
704
+ lang: config$1.lang,
705
+ abortEarly: config$1.abortEarly,
706
+ abortPipeEarly: config$1.abortPipeEarly
707
+ };
708
+ const isSchema = context.kind === "schema";
709
+ const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
710
+ if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
711
+ if (isSchema) dataset.typed = false;
712
+ if (dataset.issues) dataset.issues.push(issue);
713
+ else dataset.issues = [issue];
714
+ }
715
+ var _standardCache = /* @__PURE__ */ new WeakMap();
716
+ // @__NO_SIDE_EFFECTS__
717
+ function _getStandardProps(context) {
718
+ let cached = _standardCache.get(context);
719
+ if (!cached) {
720
+ cached = {
721
+ version: 1,
722
+ vendor: "valibot",
723
+ validate(value$1) {
724
+ return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
725
+ }
726
+ };
727
+ _standardCache.set(context, cached);
728
+ }
729
+ return cached;
730
+ }
731
+ // @__NO_SIDE_EFFECTS__
732
+ function _isValidObjectKey(object$1, key) {
733
+ return Object.prototype.hasOwnProperty.call(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
734
+ }
735
+ // @__NO_SIDE_EFFECTS__
736
+ function _joinExpects(values$1, separator) {
737
+ const list = [...new Set(values$1)];
738
+ if (list.length > 1) return `(${list.join(` ${separator} `)})`;
739
+ return list[0] ?? "never";
740
+ }
741
+ var EMOJI_REGEX = new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$", "u");
742
+ // @__NO_SIDE_EFFECTS__
743
+ function minLength(requirement, message$1) {
744
+ return {
745
+ kind: "validation",
746
+ type: "min_length",
747
+ reference: minLength,
748
+ async: false,
749
+ expects: `>=${requirement}`,
750
+ requirement,
751
+ message: message$1,
752
+ "~run"(dataset, config$1) {
753
+ if (dataset.typed && dataset.value.length < this.requirement) _addIssue(this, "length", dataset, config$1, { received: `${dataset.value.length}` });
754
+ return dataset;
755
+ }
756
+ };
757
+ }
758
+ // @__NO_SIDE_EFFECTS__
759
+ function transform(operation) {
760
+ return {
761
+ kind: "transformation",
762
+ type: "transform",
763
+ reference: transform,
764
+ async: false,
765
+ operation,
766
+ "~run"(dataset) {
767
+ dataset.value = this.operation(dataset.value);
768
+ return dataset;
769
+ }
770
+ };
771
+ }
772
+ // @__NO_SIDE_EFFECTS__
773
+ function trim() {
774
+ return {
775
+ kind: "transformation",
776
+ type: "trim",
777
+ reference: trim,
778
+ async: false,
779
+ "~run"(dataset) {
780
+ dataset.value = dataset.value.trim();
781
+ return dataset;
782
+ }
783
+ };
784
+ }
785
+ // @__NO_SIDE_EFFECTS__
786
+ function getFallback(schema, dataset, config$1) {
787
+ return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
788
+ }
789
+ // @__NO_SIDE_EFFECTS__
790
+ function getDefault(schema, dataset, config$1) {
791
+ return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
792
+ }
793
+ // @__NO_SIDE_EFFECTS__
794
+ function array(item, message$1) {
795
+ return {
796
+ kind: "schema",
797
+ type: "array",
798
+ reference: array,
799
+ expects: "Array",
800
+ async: false,
801
+ item,
802
+ message: message$1,
803
+ get "~standard"() {
804
+ return /* @__PURE__ */ _getStandardProps(this);
805
+ },
806
+ "~run"(dataset, config$1) {
807
+ const input = dataset.value;
808
+ if (Array.isArray(input)) {
809
+ dataset.typed = true;
810
+ dataset.value = [];
811
+ for (let key = 0; key < input.length; key++) {
812
+ const value$1 = input[key];
813
+ const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
814
+ if (itemDataset.issues) {
815
+ const pathItem = {
816
+ type: "array",
817
+ origin: "value",
818
+ input,
819
+ key,
820
+ value: value$1
821
+ };
822
+ for (const issue of itemDataset.issues) {
823
+ if (issue.path) issue.path.unshift(pathItem);
824
+ else issue.path = [pathItem];
825
+ dataset.issues?.push(issue);
826
+ }
827
+ if (!dataset.issues) dataset.issues = itemDataset.issues;
828
+ if (config$1.abortEarly) {
829
+ dataset.typed = false;
830
+ break;
831
+ }
832
+ }
833
+ if (!itemDataset.typed) dataset.typed = false;
834
+ dataset.value.push(itemDataset.value);
835
+ }
836
+ } else _addIssue(this, "type", dataset, config$1);
837
+ return dataset;
838
+ }
839
+ };
840
+ }
841
+ // @__NO_SIDE_EFFECTS__
842
+ function literal(literal_, message$1) {
843
+ return {
844
+ kind: "schema",
845
+ type: "literal",
846
+ reference: literal,
847
+ expects: /* @__PURE__ */ _stringify(literal_),
848
+ async: false,
849
+ literal: literal_,
850
+ message: message$1,
851
+ get "~standard"() {
852
+ return /* @__PURE__ */ _getStandardProps(this);
853
+ },
854
+ "~run"(dataset, config$1) {
855
+ if (dataset.value === this.literal) dataset.typed = true;
856
+ else _addIssue(this, "type", dataset, config$1);
857
+ return dataset;
858
+ }
859
+ };
860
+ }
861
+ // @__NO_SIDE_EFFECTS__
862
+ function looseObject(entries$1, message$1) {
863
+ return {
864
+ kind: "schema",
865
+ type: "loose_object",
866
+ reference: looseObject,
867
+ expects: "Object",
868
+ async: false,
869
+ entries: entries$1,
870
+ message: message$1,
871
+ get "~standard"() {
872
+ return /* @__PURE__ */ _getStandardProps(this);
873
+ },
874
+ "~run"(dataset, config$1) {
875
+ const input = dataset.value;
876
+ if (input && typeof input === "object") {
877
+ dataset.typed = true;
878
+ dataset.value = {};
879
+ for (const key in this.entries) {
880
+ const valueSchema = this.entries[key];
881
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
882
+ const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
883
+ const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
884
+ if (valueDataset.issues) {
885
+ const pathItem = {
886
+ type: "object",
887
+ origin: "value",
888
+ input,
889
+ key,
890
+ value: value$1
891
+ };
892
+ for (const issue of valueDataset.issues) {
893
+ if (issue.path) issue.path.unshift(pathItem);
894
+ else issue.path = [pathItem];
895
+ dataset.issues?.push(issue);
896
+ }
897
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
898
+ if (config$1.abortEarly) {
899
+ dataset.typed = false;
900
+ break;
901
+ }
902
+ }
903
+ if (!valueDataset.typed) dataset.typed = false;
904
+ dataset.value[key] = valueDataset.value;
905
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
906
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
907
+ _addIssue(this, "key", dataset, config$1, {
908
+ input: void 0,
909
+ expected: `"${key}"`,
910
+ path: [{
911
+ type: "object",
912
+ origin: "key",
913
+ input,
914
+ key,
915
+ value: input[key]
916
+ }]
917
+ });
918
+ if (config$1.abortEarly) break;
919
+ }
920
+ }
921
+ if (!dataset.issues || !config$1.abortEarly) {
922
+ for (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
923
+ }
924
+ } else _addIssue(this, "type", dataset, config$1);
925
+ return dataset;
926
+ }
927
+ };
928
+ }
929
+ // @__NO_SIDE_EFFECTS__
930
+ function object(entries$1, message$1) {
931
+ return {
932
+ kind: "schema",
933
+ type: "object",
934
+ reference: object,
935
+ expects: "Object",
936
+ async: false,
937
+ entries: entries$1,
938
+ message: message$1,
939
+ get "~standard"() {
940
+ return /* @__PURE__ */ _getStandardProps(this);
941
+ },
942
+ "~run"(dataset, config$1) {
943
+ const input = dataset.value;
944
+ if (input && typeof input === "object") {
945
+ dataset.typed = true;
946
+ dataset.value = {};
947
+ for (const key in this.entries) {
948
+ const valueSchema = this.entries[key];
949
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
950
+ const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
951
+ const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
952
+ if (valueDataset.issues) {
953
+ const pathItem = {
954
+ type: "object",
955
+ origin: "value",
956
+ input,
957
+ key,
958
+ value: value$1
959
+ };
960
+ for (const issue of valueDataset.issues) {
961
+ if (issue.path) issue.path.unshift(pathItem);
962
+ else issue.path = [pathItem];
963
+ dataset.issues?.push(issue);
964
+ }
965
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
966
+ if (config$1.abortEarly) {
967
+ dataset.typed = false;
968
+ break;
969
+ }
970
+ }
971
+ if (!valueDataset.typed) dataset.typed = false;
972
+ dataset.value[key] = valueDataset.value;
973
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
974
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
975
+ _addIssue(this, "key", dataset, config$1, {
976
+ input: void 0,
977
+ expected: `"${key}"`,
978
+ path: [{
979
+ type: "object",
980
+ origin: "key",
981
+ input,
982
+ key,
983
+ value: input[key]
984
+ }]
985
+ });
986
+ if (config$1.abortEarly) break;
987
+ }
988
+ }
989
+ } else _addIssue(this, "type", dataset, config$1);
990
+ return dataset;
991
+ }
992
+ };
993
+ }
994
+ // @__NO_SIDE_EFFECTS__
995
+ function optional(wrapped, default_) {
996
+ return {
997
+ kind: "schema",
998
+ type: "optional",
999
+ reference: optional,
1000
+ expects: `(${wrapped.expects} | undefined)`,
1001
+ async: false,
1002
+ wrapped,
1003
+ default: default_,
1004
+ get "~standard"() {
1005
+ return /* @__PURE__ */ _getStandardProps(this);
1006
+ },
1007
+ "~run"(dataset, config$1) {
1008
+ if (dataset.value === void 0) {
1009
+ if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
1010
+ if (dataset.value === void 0) {
1011
+ dataset.typed = true;
1012
+ return dataset;
1013
+ }
1014
+ }
1015
+ return this.wrapped["~run"](dataset, config$1);
1016
+ }
1017
+ };
1018
+ }
1019
+ // @__NO_SIDE_EFFECTS__
1020
+ function picklist(options, message$1) {
1021
+ return {
1022
+ kind: "schema",
1023
+ type: "picklist",
1024
+ reference: picklist,
1025
+ expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
1026
+ async: false,
1027
+ options,
1028
+ message: message$1,
1029
+ get "~standard"() {
1030
+ return /* @__PURE__ */ _getStandardProps(this);
1031
+ },
1032
+ "~run"(dataset, config$1) {
1033
+ if (this.options.includes(dataset.value)) dataset.typed = true;
1034
+ else _addIssue(this, "type", dataset, config$1);
1035
+ return dataset;
1036
+ }
1037
+ };
1038
+ }
1039
+ // @__NO_SIDE_EFFECTS__
1040
+ function record(key, value$1, message$1) {
1041
+ return {
1042
+ kind: "schema",
1043
+ type: "record",
1044
+ reference: record,
1045
+ expects: "Object",
1046
+ async: false,
1047
+ key,
1048
+ value: value$1,
1049
+ message: message$1,
1050
+ get "~standard"() {
1051
+ return /* @__PURE__ */ _getStandardProps(this);
1052
+ },
1053
+ "~run"(dataset, config$1) {
1054
+ const input = dataset.value;
1055
+ if (input && typeof input === "object") {
1056
+ dataset.typed = true;
1057
+ dataset.value = {};
1058
+ for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
1059
+ const entryValue = input[entryKey];
1060
+ const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
1061
+ if (keyDataset.issues) {
1062
+ const pathItem = {
1063
+ type: "object",
1064
+ origin: "key",
1065
+ input,
1066
+ key: entryKey,
1067
+ value: entryValue
1068
+ };
1069
+ for (const issue of keyDataset.issues) {
1070
+ issue.path = [pathItem];
1071
+ dataset.issues?.push(issue);
1072
+ }
1073
+ if (!dataset.issues) dataset.issues = keyDataset.issues;
1074
+ if (config$1.abortEarly) {
1075
+ dataset.typed = false;
1076
+ break;
1077
+ }
1078
+ }
1079
+ const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
1080
+ if (valueDataset.issues) {
1081
+ const pathItem = {
1082
+ type: "object",
1083
+ origin: "value",
1084
+ input,
1085
+ key: entryKey,
1086
+ value: entryValue
1087
+ };
1088
+ for (const issue of valueDataset.issues) {
1089
+ if (issue.path) issue.path.unshift(pathItem);
1090
+ else issue.path = [pathItem];
1091
+ dataset.issues?.push(issue);
1092
+ }
1093
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1094
+ if (config$1.abortEarly) {
1095
+ dataset.typed = false;
1096
+ break;
1097
+ }
1098
+ }
1099
+ if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
1100
+ if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
1101
+ }
1102
+ } else _addIssue(this, "type", dataset, config$1);
1103
+ return dataset;
1104
+ }
1105
+ };
1106
+ }
1107
+ // @__NO_SIDE_EFFECTS__
1108
+ function string(message$1) {
1109
+ return {
1110
+ kind: "schema",
1111
+ type: "string",
1112
+ reference: string,
1113
+ expects: "string",
1114
+ async: false,
1115
+ message: message$1,
1116
+ get "~standard"() {
1117
+ return /* @__PURE__ */ _getStandardProps(this);
1118
+ },
1119
+ "~run"(dataset, config$1) {
1120
+ if (typeof dataset.value === "string") dataset.typed = true;
1121
+ else _addIssue(this, "type", dataset, config$1);
1122
+ return dataset;
1123
+ }
1124
+ };
1125
+ }
1126
+ // @__NO_SIDE_EFFECTS__
1127
+ function pipe(...pipe$1) {
1128
+ return {
1129
+ ...pipe$1[0],
1130
+ pipe: pipe$1,
1131
+ get "~standard"() {
1132
+ return /* @__PURE__ */ _getStandardProps(this);
1133
+ },
1134
+ "~run"(dataset, config$1) {
1135
+ for (const item of pipe$1) if (item.kind !== "metadata") {
1136
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
1137
+ dataset.typed = false;
1138
+ break;
1139
+ }
1140
+ if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
1141
+ }
1142
+ return dataset;
1143
+ }
1144
+ };
1145
+ }
1146
+
1147
+ // packages/ai/agent/createAgentSchema.ts
1148
+ var PROVIDER_REASONING_EFFORT_VALUES = {
1149
+ openai: ["none", "minimal", "low", "medium", "high", "xhigh", "max"],
1150
+ deepseek: ["low", "high", "max"],
1151
+ // nolo (Ollama Cloud) 支持 DeepSeek/Kimi/GLM 等 thinking 模型,
1152
+ // reasoning_effort 通过 OpenAI 兼容端点透传到 Ollama Cloud。
1153
+ nolo: ["low", "high", "max"],
1154
+ xai: ["low", "medium", "high"],
1155
+ grok: ["low", "medium", "high"],
1156
+ // none:关闭思考;必须保留,否则上游 clamp 会把 none 抬成 low,
1157
+ // kimi-code proxy 的 none/off → thinking.disabled 分支永远接不到。
1158
+ kimi: ["none", "low", "high", "max"],
1159
+ moonshot: ["none", "low", "high", "max"],
1160
+ // Qwen 用 enable_thinking (bool) 而非 reasoning_effort → 隐藏下拉
1161
+ qwen: [],
1162
+ // MiniMax M3: 接受这些值但所有非 none 效果相同
1163
+ minimax: ["none", "low", "medium", "high"],
1164
+ // Cursor: 推理强度在模型名后缀 (如 -high),不走独立参数
1165
+ cursor: [],
1166
+ // MiMo: 保守默认
1167
+ mimo: ["low", "medium", "high"]
1168
+ };
1169
+ var greetingMenuItemSchema = object({
1170
+ id: pipe(string(), minLength(1)),
1171
+ label: pipe(string(), minLength(1)),
1172
+ userMessage: optional(string())
1173
+ });
1174
+ var greetingConfigSchema = object({
1175
+ text: optional(pipe(string(), trim())),
1176
+ menu: optional(array(greetingMenuItemSchema))
1177
+ });
1178
+ var runtimeToolPolicySchema = looseObject({
1179
+ version: optional(literal(1)),
1180
+ agentTools: optional(array(string())),
1181
+ runtimeTools: optional(array(string())),
1182
+ workspace: optional(
1183
+ object({
1184
+ mode: optional(picklist(["none", "current", "lease"])),
1185
+ writableRoots: optional(array(string())),
1186
+ cwd: optional(string())
1187
+ })
1188
+ ),
1189
+ shell: optional(record(string(), string())),
1190
+ isolation: optional(record(string(), string())),
1191
+ git: optional(record(string(), string())),
1192
+ budget: optional(record(string(), string())),
1193
+ audit: optional(record(string(), string()))
1194
+ });
1195
+ var referenceItemSchema = pipe(
1196
+ object({
1197
+ dbKey: string(),
1198
+ title: string(),
1199
+ type: picklist(["knowledge", "instruction", "page"])
1200
+ }),
1201
+ transform((data) => ({
1202
+ ...data,
1203
+ type: data.type === "page" ? "knowledge" : data.type
1204
+ }))
1205
+ );
1206
+
1207
+ // packages/ai/llm/reasoningModels.ts
1208
+ var REASONING_MODEL_NAMES = /* @__PURE__ */ new Set([
1209
+ "deepseek-v4-flash",
1210
+ "deepseek-v4-pro",
1211
+ "gemini-3.7-flash",
1212
+ "gemini-3.6-flash",
1213
+ // Legacy Gemini ids — 已从模型注册表下线,保留只为存量 agent 的 reasoning UI。
1214
+ "gemini-3.5-flash",
1215
+ "gemini-3-flash-preview",
1216
+ "gemini-3-pro-preview",
1217
+ "gemini-3.1-pro-preview",
1218
+ "gpt-5.5-pro",
1219
+ "gpt-5.6-sol",
1220
+ "gpt-5.6-terra",
1221
+ "gpt-5.6-luna",
1222
+ "glm-5.2",
1223
+ "kimi-k3",
1224
+ // Legacy OpenAI catalog ids — still support reasoning UI for agents that
1225
+ // were never re-seeded after GPT-5.4 / GPT-5 were retired from the picker.
1226
+ "gpt-5.4",
1227
+ "gpt-5.4-mini",
1228
+ "gpt-5.4-nano",
1229
+ "gpt-5.4-pro",
1230
+ "gpt-5",
1231
+ "gpt-5-mini",
1232
+ // Legacy model ids from retired Fireworks/DeepInfra/GMI/CF/Z.AI catalog rows
1233
+ "@cf/zai-org/glm-5.2",
1234
+ "zai-org/GLM-5.2",
1235
+ "accounts/fireworks/models/glm-5p2",
1236
+ "zai-org/GLM-5.2-FP8"
1237
+ ]);
1238
+ var isModelSupportReasoningEffort = (model) => REASONING_MODEL_NAMES.has(model);
1239
+ var supportedReasoningModels = Array.from(REASONING_MODEL_NAMES);
1240
+ var EFFORT_ORDER = [
1241
+ "none",
1242
+ "minimal",
1243
+ "low",
1244
+ "medium",
1245
+ "high",
1246
+ "xhigh",
1247
+ "max"
1248
+ ];
1249
+ function nearestSupportedEffort(effort, supported) {
1250
+ const effortIdx = EFFORT_ORDER.indexOf(effort);
1251
+ if (effortIdx === -1) return void 0;
1252
+ const supportedIdxs = supported.map((s) => EFFORT_ORDER.indexOf(s)).filter((idx) => idx >= 0).sort((a, b) => a - b);
1253
+ if (supportedIdxs.length === 0) return void 0;
1254
+ let best = supportedIdxs[0];
1255
+ let bestDist = Math.abs(best - effortIdx);
1256
+ for (const idx of supportedIdxs) {
1257
+ const dist = Math.abs(idx - effortIdx);
1258
+ if (dist < bestDist || dist === bestDist && idx > best) {
1259
+ best = idx;
1260
+ bestDist = dist;
1261
+ }
1262
+ }
1263
+ return EFFORT_ORDER[best];
1264
+ }
1265
+ function clampReasoningEffort(effort, provider) {
1266
+ if (!effort) return void 0;
1267
+ const normalized = effort === "off" ? "none" : effort;
1268
+ const providerLower = (provider ?? "").toLowerCase();
1269
+ if (providerLower === "anthropic" || providerLower === "google") {
1270
+ return void 0;
1271
+ }
1272
+ const supported = PROVIDER_REASONING_EFFORT_VALUES[providerLower];
1273
+ if (!supported || supported.length === 0) {
1274
+ if (normalized === "low" || normalized === "medium" || normalized === "high") {
1275
+ return normalized;
1276
+ }
1277
+ const effortIdx = EFFORT_ORDER.indexOf(
1278
+ normalized
1279
+ );
1280
+ const highIdx = EFFORT_ORDER.indexOf("high");
1281
+ const lowIdx = EFFORT_ORDER.indexOf("low");
1282
+ if (effortIdx === -1) return void 0;
1283
+ if (effortIdx > highIdx) return "high";
1284
+ if (effortIdx < lowIdx) return "low";
1285
+ return normalized;
1286
+ }
1287
+ if (supported.includes(normalized)) return normalized;
1288
+ return nearestSupportedEffort(normalized, supported);
1289
+ }
1290
+
1291
+ // packages/ai/llm/providers.ts
1292
+ var moonshotAllModels = [...moonshotModels, ...kimiCodeModels];
1293
+ var qwenAllModels = [...qwenModels, ...qwenTokenPlanModels];
1294
+ var MODEL_MAP = {
1295
+ // anthropic: anthropicModels,
1296
+ google: googleModels,
1297
+ openai: openAIModels,
1298
+ deepinfra: deepinfraModels,
1299
+ openrouter: openrouterModels,
1300
+ fireworks: fireworksModels,
1301
+ nolo: platformHostedModels,
1302
+ cloudflare: cloudflareModels,
1303
+ gmi: gmiModels,
1304
+ zai: zaiModels,
1305
+ qwen: qwenAllModels,
1306
+ moonshot: moonshotAllModels
1307
+ };
1308
+ var MODEL_LOOKUP_MAP = {
1309
+ anthropic: [...anthropicModels, ...anthropicOAuthModels],
1310
+ xai: xaiModels,
1311
+ "opencode-go": opencodeGoModels,
1312
+ opencode: opencodeGoModels,
1313
+ ...MODEL_MAP
1314
+ };
1315
+ var ANTHROPIC_MODEL_ALIASES = {
1316
+ "claude-sonnet-4.6": "claude-3-7-sonnet-latest",
1317
+ "claude-sonnet-4.5": "claude-3-5-sonnet-latest"
1318
+ };
1319
+ var normalizeLookupProvider = (provider) => {
1320
+ if (!provider) return null;
1321
+ const normalized = provider.toLowerCase();
1322
+ if (normalized === "ollama-cloud") {
1323
+ return "nolo";
1324
+ }
1325
+ if (normalized in MODEL_LOOKUP_MAP) {
1326
+ return normalized;
1327
+ }
1328
+ return null;
1329
+ };
1330
+ var normalizeLookupModelName = (provider, name) => {
1331
+ if (provider === "anthropic") {
1332
+ return ANTHROPIC_MODEL_ALIASES[name] ?? name;
1333
+ }
1334
+ return name;
1335
+ };
1336
+ var toModel = (candidate) => ({
1337
+ name: typeof candidate.id === "string" && candidate.id.trim() ? candidate.id : candidate.name,
1338
+ displayName: candidate.displayName ?? (typeof candidate.id === "string" && candidate.id !== candidate.name ? candidate.name : void 0),
1339
+ hasVision: typeof candidate.hasVision === "boolean" ? candidate.hasVision : !!candidate.supportVision,
1340
+ contextWindow: candidate.contextWindow,
1341
+ price: candidate.price ?? candidate.pricing ?? { input: 0, output: 0 },
1342
+ pricingStrategy: candidate.pricingStrategy,
1343
+ serviceTierPriceMultipliers: candidate.serviceTierPriceMultipliers,
1344
+ maxOutputTokens: candidate.maxOutputTokens ?? candidate.maxTokens,
1345
+ jsonOutput: candidate.jsonOutput,
1346
+ fnCall: typeof candidate.fnCall === "boolean" ? candidate.fnCall : candidate.supportTool,
1347
+ provider: candidate.provider,
1348
+ description: candidate.description,
1349
+ hasAudio: candidate.hasAudio,
1350
+ maxImageResolution: candidate.maxImageResolution,
1351
+ canFineTune: candidate.canFineTune,
1352
+ hasImageOutput: candidate.hasImageOutput,
1353
+ supportsImageOutput: candidate.supportsImageOutput,
1354
+ supportsTool: typeof candidate.supportsTool === "boolean" ? candidate.supportsTool : candidate.supportTool,
1355
+ supportsImageConfig: candidate.supportsImageConfig,
1356
+ requiresImageModalities: candidate.requiresImageModalities,
1357
+ defaultModalities: candidate.defaultModalities,
1358
+ supportedAspectRatios: candidate.supportedAspectRatios,
1359
+ supportedImageSizes: candidate.supportedImageSizes,
1360
+ pricePerImage: candidate.pricePerImage,
1361
+ imagePricingNote: candidate.imagePricingNote,
1362
+ imageTokenPricePerMillion: candidate.imageTokenPricePerMillion,
1363
+ imageOutputTokenEstimateBySize: candidate.imageOutputTokenEstimateBySize,
1364
+ imageGenerationWaitTimeSeconds: candidate.imageGenerationWaitTimeSeconds,
1365
+ imageGenerationProfiles: candidate.imageGenerationProfiles,
1366
+ supportsReasoningEffort: typeof candidate.supportsReasoningEffort === "boolean" ? candidate.supportsReasoningEffort : candidate.supportReasoning,
1367
+ endpointKey: candidate.endpointKey
1368
+ });
1369
+ var findCandidateInProvider = (provider, name) => {
1370
+ const normalizedName = normalizeLookupModelName(provider, name);
1371
+ const list = MODEL_LOOKUP_MAP[provider];
1372
+ const candidate = list.find(
1373
+ (item) => item.name === normalizedName || item.displayName === normalizedName || item.id === normalizedName
1374
+ );
1375
+ return candidate ? toModel(candidate) : null;
1376
+ };
1377
+ var findOpenRouterUpstreamModel = (name) => {
1378
+ const slash = name.indexOf("/");
1379
+ if (slash <= 0) return null;
1380
+ const upstreamProvider = normalizeLookupProvider(name.slice(0, slash));
1381
+ if (!upstreamProvider) return null;
1382
+ const upstreamModelName = name.slice(slash + 1);
1383
+ return findCandidateInProvider(upstreamProvider, upstreamModelName);
1384
+ };
1385
+ function findModelConfig(provider, name) {
1386
+ const normalizedProvider = normalizeLookupProvider(provider);
1387
+ if (!normalizedProvider) return null;
1388
+ const direct = findCandidateInProvider(normalizedProvider, name);
1389
+ if (direct) return direct;
1390
+ if (normalizedProvider === "openrouter") {
1391
+ return findOpenRouterUpstreamModel(name);
1392
+ }
1393
+ return null;
1394
+ }
1395
+ var availableProviderOptions = Object.keys(MODEL_MAP);
1396
+ var API_ENDPOINTS = {
1397
+ openai: {
1398
+ completions: "https://api.openai.com/v1/chat/completions",
1399
+ responses: "https://api.openai.com/v1/responses"
1400
+ },
1401
+ xai: {
1402
+ default: "https://api.x.ai/v1/chat/completions"
1403
+ },
1404
+ deepinfra: {
1405
+ default: "https://api.deepinfra.com/v1/openai/chat/completions"
1406
+ },
1407
+ google: {
1408
+ default: "https://generativelanguage.googleapis.com/v1beta/openai/chat/completions"
1409
+ },
1410
+ openrouter: {
1411
+ default: "https://openrouter.ai/api/v1/chat/completions"
1412
+ },
1413
+ fireworks: {
1414
+ default: "https://api.fireworks.ai/inference/v1/chat/completions"
1415
+ },
1416
+ nolo: {
1417
+ default: PLATFORM_HOSTED_CHAT_COMPLETIONS_URL
1418
+ },
1419
+ // Legacy agent records may still store provider=ollama-cloud
1420
+ "ollama-cloud": {
1421
+ default: PLATFORM_HOSTED_CHAT_COMPLETIONS_URL
1422
+ },
1423
+ cloudflare: {
1424
+ default: "__cloudflare_workers_ai_chat_completions__"
1425
+ },
1426
+ gmi: {
1427
+ default: GMI_CHAT_COMPLETIONS_URL
1428
+ },
1429
+ qwen: {
1430
+ // 千问 AI 平台 OpenAI 兼容模式
1431
+ default: "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"
1432
+ },
1433
+ moonshot: {
1434
+ // Moonshot AI(月之暗面)开放平台 OpenAI 兼容模式(按量计费)
1435
+ default: "https://api.moonshot.cn/v1/chat/completions"
1436
+ }
1437
+ };
1438
+ function getModelConfig(provider, name) {
1439
+ const model = findModelConfig(provider, name);
1440
+ if (!model) {
1441
+ throw new Error(`Model ${name} not found for provider ${provider}`);
1442
+ }
1443
+ return model;
1444
+ }
1445
+ function getProviderByModelName(modelName) {
1446
+ for (const [provider, models] of Object.entries(MODEL_LOOKUP_MAP)) {
1447
+ if (models.some((m) => m.name === modelName)) {
1448
+ return provider;
1449
+ }
1450
+ }
1451
+ return void 0;
1452
+ }
1453
+ var DEFAULT_MODEL = {
1454
+ provider: PLATFORM_HOSTED_KIMI_PROVIDER,
1455
+ name: PLATFORM_HOSTED_KIMI_K26_MODEL
1456
+ };
1457
+ function getApiEndpoint(agent) {
1458
+ const { provider, customProviderUrl, endpointKey, model } = agent;
1459
+ const effectiveProvider = provider;
1460
+ const effectiveModel = model;
1461
+ if (agent.apiSource === "cli") {
1462
+ throw new Error(
1463
+ "Routing error: CLI agent should not call getApiEndpoint. Check streamAgentChatTurn."
1464
+ );
1465
+ }
1466
+ if (customProviderUrl) {
1467
+ const url = customProviderUrl.trim().replace(/\/$/, "");
1468
+ if (/\/v\d+(beta\d*)?$/.test(url)) {
1469
+ return `${url}/chat/completions`;
1470
+ }
1471
+ return url;
1472
+ }
1473
+ const OAUTH_API_KEY_REFS = /* @__PURE__ */ new Set([
1474
+ "chatgpt",
1475
+ "xai",
1476
+ "antigravity",
1477
+ "claude",
1478
+ "cursor"
1479
+ ]);
1480
+ if (!effectiveProvider || effectiveProvider.toLowerCase() === "custom" || agent.apiSource === "custom") {
1481
+ if (agent.useServerProxy) {
1482
+ return "";
1483
+ }
1484
+ const apiKeyRef = agent.apiKeyRef;
1485
+ if (apiKeyRef && OAUTH_API_KEY_REFS.has(apiKeyRef)) {
1486
+ return "";
1487
+ }
1488
+ if (effectiveProvider && API_ENDPOINTS[effectiveProvider]) {
1489
+ return "";
1490
+ }
1491
+ throw new Error(
1492
+ "Custom provider URL is required when apiSource is 'custom'."
1493
+ );
1494
+ }
1495
+ if (effectiveProvider === "cloudflare") {
1496
+ return getCloudflareWorkersAiChatCompletionsUrl();
1497
+ }
1498
+ const endpoints = API_ENDPOINTS[effectiveProvider];
1499
+ if (!endpoints) throw new Error(`Unsupported provider: ${provider}`);
1500
+ let key = endpointKey;
1501
+ if (!key && effectiveModel) {
1502
+ try {
1503
+ key = getModelConfig(effectiveProvider, effectiveModel).endpointKey;
1504
+ } catch {
1505
+ }
1506
+ }
1507
+ if (key && endpoints[key]) return endpoints[key];
1508
+ if (endpoints.default) return endpoints.default;
1509
+ const first = Object.values(endpoints)[0];
1510
+ if (first) return first;
1511
+ throw new Error(`No endpoint found for provider ${provider}`);
1512
+ }
1513
+
1514
+ export {
1515
+ isAdaptiveThinkingModelId,
1516
+ isModelSupportReasoningEffort,
1517
+ clampReasoningEffort,
1518
+ MODEL_LOOKUP_MAP,
1519
+ findModelConfig,
1520
+ getModelConfig,
1521
+ getProviderByModelName,
1522
+ DEFAULT_MODEL,
1523
+ getApiEndpoint
1524
+ };