nolo-cli 0.32.0 → 0.33.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.
- package/README.md +6 -12
- package/{_executeModel-LTMSIBS4.js → _executeModel-YXWAXPWQ.js} +77 -67
- package/{action-HI3VRQLP.js → action-OQWPNKAH.js} +17 -15
- package/{addContentAction-NCURJ6PK.js → addContentAction-YVINZQTF.js} +14 -13
- package/{addDialogAgentAction-RCY4ECF4.js → addDialogAgentAction-6IOCIEPI.js} +14 -13
- package/{agentDeleteCommand-D3MYZK6E.js → agentDeleteCommand-VGHWJN5T.js} +44 -60
- package/{agentEmailCommands-6BXS574I.js → agentEmailCommands-ZLRF35I3.js} +91 -81
- package/{agentGrantCommands-E7ZZFRHK.js → agentGrantCommands-2LEZDADN.js} +2 -2
- package/{agentListCommands-SF3HEUTT.js → agentListCommands-OHZJ7AFP.js} +75 -79
- package/{agentMachineCommands-YARVXRR6.js → agentMachineCommands-62PHPGTK.js} +43 -59
- package/{agentPullCommand-ARSIDNVC.js → agentPullCommand-TSWAJPS2.js} +5 -5
- package/agentRecordCommands-CW2JWERD.js +113 -0
- package/agentRunCommand-O4HV7YWA.js +131 -0
- package/{agentRuntimeLocal-ATGJY6WC.js → agentRuntimeLocal-4PSBNUOE.js} +37 -51
- package/{agentSlice-4XWW344Y.js → agentSlice-OUTQ5O72.js} +16 -14
- package/{appDeleteCommands-63JO7RXS.js → appDeleteCommands-VTDBVHYR.js} +40 -56
- package/{appDeployCommands-Y7EWYUGM.js → appDeployCommands-WOUP7MDA.js} +40 -56
- package/{appDeployStatusCommands-ZBEY3DWB.js → appDeployStatusCommands-N2NWZKEN.js} +40 -56
- package/{appGetCommands-QSSOSEYL.js → appGetCommands-GYKLWWCA.js} +40 -56
- package/{appListCommands-PH3XWNDX.js → appListCommands-RUWBSEJK.js} +40 -56
- package/{authCommand-BBDHMSO6.js → authCommand-YVXVH25I.js} +21 -20
- package/{authCommands-4UDEKRE6.js → authCommands-WTW6MEYS.js} +10 -10
- package/chatQueueReduxAdapter-2QJAD4KQ.js +181 -0
- package/{chunk-EEF23OOK.js → chunk-266VUBLK.js} +7 -7
- package/{chunk-TEYN42N3.js → chunk-2IVEXF7P.js} +11 -4
- package/{chunk-2HXKAPH7.js → chunk-2QLAVHVK.js} +6 -6
- package/{chunk-WTGCTVJG.js → chunk-2QTEYCR7.js} +3 -6
- package/{chunk-DOISARTV.js → chunk-2UECQ7RE.js} +1 -1
- package/{chunk-E3APEOIM.js → chunk-3GZXL6FM.js} +4 -19
- package/{chunk-KGEVMUMI.js → chunk-3RUW3ONU.js} +11 -11
- package/{chunk-RXVX5LFR.js → chunk-3UG2IIZ3.js} +1 -1
- package/{chunk-O5OMJPPF.js → chunk-3WXRAHCG.js} +6 -5
- package/{chunk-V54H24CQ.js → chunk-4F5M2MW5.js} +3 -3
- package/{chunk-2ZRP5RUG.js → chunk-4OV7DXFJ.js} +12 -11
- package/{chunk-W367V5CH.js → chunk-54BAYVCY.js} +404 -117
- package/{chunk-GAF5X6B7.js → chunk-5QW3O3ET.js} +284 -310
- package/{chunk-DLWCWUNW.js → chunk-64OVNZXE.js} +1197 -757
- package/{chunk-ODS2MVMU.js → chunk-66CWPJK2.js} +19 -303
- package/{chunk-PTHDLIRB.js → chunk-6KOS7ZBZ.js} +1 -1
- package/{chunk-MXFQHRSS.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-ATK5WJOA.js → chunk-6YXDOOSH.js} +4 -4
- package/{chunk-SWYMCHM7.js → chunk-75U775RZ.js} +69 -1
- package/{chunk-UDA3ZYLW.js → chunk-7YYHKBJP.js} +31 -72
- package/chunk-ADLYMQB6.js +642 -0
- package/{chunk-ZWJOGMKH.js → chunk-AETZ7AD6.js} +1 -1
- package/{chunk-43EPBPZ2.js → chunk-ASDXPOJH.js} +2 -2
- package/{chunk-44HACRCK.js → chunk-BANYWEYY.js} +4 -4
- package/chunk-BFPSVRCQ.js +1799 -0
- package/{chunk-TOW4E763.js → chunk-BJIRLHJR.js} +2 -0
- package/{chunk-ZJ2WITOO.js → chunk-BQXOGBFN.js} +2 -2
- package/{chunk-4PNU7W7K.js → chunk-C7H5GMXT.js} +107 -125
- package/chunk-CPYYM4RJ.js +98 -0
- package/{chunk-3GZT3L6F.js → chunk-DDVIBKIB.js} +326 -481
- package/{chunk-2K4NDPT5.js → chunk-DFUPZE6V.js} +20 -12
- package/{chunk-BGTUGS3T.js → chunk-DKMOY3QI.js} +4 -30
- package/chunk-EGRJC4ZN.js +91 -0
- package/{chunk-K6QEHQZ3.js → chunk-EKLRRZIN.js} +1 -1
- package/{chunk-6HYVJV7B.js → chunk-ESHYE7WU.js} +2 -1
- package/{chunk-XFG3BAKN.js → chunk-FMEVI5TG.js} +65 -0
- package/{chunk-U4TRT5V4.js → chunk-GEPHJJW4.js} +1 -1
- package/chunk-GJXRIOLS.js +241 -0
- package/{chunk-VP4WJWKW.js → chunk-GM6PU7B6.js} +431 -345
- package/chunk-HS7MLR74.js +38 -0
- package/{chunk-3AUWC6EM.js → chunk-HUCT7HID.js} +5 -84
- package/chunk-IDAU4UFS.js +437 -0
- package/{chunk-Q76I4SXI.js → chunk-IHEC7VBF.js} +1 -1
- package/{chunk-OWHNFZNW.js → chunk-IKWTTKWG.js} +4 -4
- package/{chunk-3LY4F7SV.js → chunk-INZZJSQF.js} +348 -331
- package/{chunk-ZJH3LKEW.js → chunk-IR6W62Q6.js} +102 -15
- package/{chunk-RH53LMEJ.js → chunk-J44TVX2O.js} +2 -4
- package/{chunk-CF2WZF4N.js → chunk-J6WH4PYZ.js} +0 -8
- package/chunk-KHCLMKZZ.js +3062 -0
- package/{chunk-WHLVPK32.js → chunk-KMSZPTM6.js} +27 -3
- package/{chunk-L3GCUVOH.js → chunk-KSRFVP36.js} +1 -1
- package/{chunk-XDHHF73Q.js → chunk-LUIHOUZC.js} +95 -95
- package/{chunk-UOJRKY5J.js → chunk-M2YMQOLC.js} +44 -53
- package/chunk-M3JEW6N6.js +193 -0
- package/{chunk-MITD7CON.js → chunk-MDIAECHA.js} +1461 -301
- package/{chunk-IXZX5CJK.js → chunk-MQRZ5QUH.js} +1 -1
- package/{chunk-3ASDTTEI.js → chunk-MRWGHF56.js} +2 -0
- package/{chunk-Q3CSL43H.js → chunk-N4XRDM26.js} +1 -1
- package/{chunk-D34RI6NI.js → chunk-NNWHHCVP.js} +75 -1
- package/{chunk-CAENRKNJ.js → chunk-OR2HNLVO.js} +126 -88
- package/chunk-OW765XBU.js +10 -0
- package/{chunk-VMWR7VNI.js → chunk-PRMMCFIN.js} +13 -9
- package/{chunk-JZPBVBIY.js → chunk-QTZD6HBK.js} +18 -8
- package/chunk-RCFIB45Q.js +28 -0
- package/{chunk-7S54ZGF6.js → chunk-RJKIB55Y.js} +256 -12
- package/chunk-RPRRIFXV.js +231 -0
- package/chunk-RQFO3CAF.js +300 -0
- package/chunk-RY57GLGW.js +188 -0
- package/{chunk-YHGHADBQ.js → chunk-SCUETSRP.js} +4 -4
- package/{chunk-TA6EA2A3.js → chunk-TFK3HUNQ.js} +182 -20
- package/{chunk-LAXMH7JY.js → chunk-UM4H3URE.js} +18 -15
- package/{chunk-6YABCOFU.js → chunk-UNHKVD2N.js} +1 -1
- package/{chunk-G5GVZAXF.js → chunk-UNOTBWZZ.js} +15 -19
- package/{chunk-GE6IWA5N.js → chunk-UNZDCI3O.js} +126 -1
- package/chunk-URMS4XY2.js +10 -0
- package/{chunk-SFWZUTCI.js → chunk-VBUQYOX7.js} +2 -2
- package/{chunk-FXFGNOT2.js → chunk-VFVCYIRQ.js} +1 -1
- package/chunk-VIDPVFP3.js +20 -0
- package/{chunk-5RDLGLAP.js → chunk-WJSW43QZ.js} +4 -7
- package/{chunk-CF7S2RYZ.js → chunk-WLH5BAKX.js} +6 -6
- package/{chunk-VVEH6XUE.js → chunk-X2DAEZ3X.js} +1 -1
- package/{chunk-2IJAKBK2.js → chunk-X664KVEV.js} +426 -246
- package/{chunk-3FCNXC2J.js → chunk-XRO5VGQ6.js} +3735 -1394
- package/chunk-Y5GCAMGP.js +9 -0
- package/{chunk-O3JR45Q2.js → chunk-YBMI5JAH.js} +44 -44
- package/{chunk-V42OE5HT.js → chunk-YDTYDA5W.js} +3 -3
- package/chunk-YYLHWIW6.js +48 -0
- package/{chunk-AOS5IN2I.js → chunk-ZHYK3N56.js} +1 -1
- package/{chunk-PJ2DDQQM.js → chunk-ZURFOV5J.js} +2 -2
- package/{chunk-3UGKATZQ.js → chunk-ZWS6DUHX.js} +26 -435
- package/chunk-ZZ2MH7LE.js +84 -0
- package/{cliExecutor-BBUVQU4L.js → cliExecutor-DW3PHGEL.js} +2 -2
- package/{clipboardy-BVE3LVEH.js → clipboardy-MMBYVRLF.js} +166 -372
- package/{codingSkills-V35TRR4Y.js → codingSkills-DY5MINPG.js} +5 -4
- package/{createAgentAutomationAction-WLRNE7C4.js → createAgentAutomationAction-H6ZRPXBR.js} +41 -31
- package/createDialogAction-UJ6LFJYM.js +61 -0
- package/{createPageAction-7YROVZ3W.js → createPageAction-KVPT3IRK.js} +57 -47
- package/{db-6DPSJ6WT.js → db-3H3JECGY.js} +45 -5
- package/{dbSlice-BBL3PEVW.js → dbSlice-UI2VCBLG.js} +13 -12
- package/{deleteFile-RJTEPOT4.js → deleteFile-XQXPBFFB.js} +7 -6
- package/dialogCommands-6ASXJP3H.js +82 -0
- package/{dialogSlice-N4HPG6HM.js → dialogSlice-B7KCGHMY.js} +37 -29
- package/{docCreateCommands-GRA5BHSA.js → docCreateCommands-S4E4MKVC.js} +42 -56
- package/{docDeleteCommands-ONIJM5MD.js → docDeleteCommands-M7XLKWRM.js} +44 -58
- package/{docReadCommands-H55VQ2US.js → docReadCommands-LSCMW2FR.js} +42 -56
- package/{docStore-B5AHDNW5.js → docStore-ZYWZWIRB.js} +40 -30
- package/{docUpdateCommands-ZQIQVGC2.js → docUpdateCommands-OMRBAFOB.js} +45 -59
- package/{fetchMessages-VPPQDDZ4.js → fetchMessages-7QRCCRYK.js} +3 -3
- package/{getPricing-QO5TYNCK.js → getPricing-L2ENXWHV.js} +7 -6
- package/{handleSendMessageAction-IN5XX5U7.js → handleSendMessageAction-Y2XKODRT.js} +39 -31
- package/index.js +74 -74
- package/{lib-FYYBQIXS.js → lib-2ZTNRXR4.js} +432 -183
- package/{localDialogRead-3DBXVYXS.js → localDialogRead-SLMPV5SK.js} +2 -2
- package/{localRuntimeAuthority-NDUA2D7Y.js → localRuntimeAuthority-S77B5QVB.js} +10 -4
- package/{localRuntimeDb-GKYRBWLQ.js → localRuntimeDb-N3H3HQ7G.js} +1 -1
- package/{machineCommands-H3UMKE76.js → machineCommands-62RUZVSW.js} +95 -85
- package/{machineInfo-M6KB6HZN.js → machineInfo-66ZFUMLE.js} +1 -1
- package/machineWsRunDispatch-L3HD3FSF.js +129 -0
- package/{models-WDUTTYFS.js → models-OX2S5C6Q.js} +2 -2
- package/{offlineMarxistsAgentCommand-E6LUG63A.js → offlineMarxistsAgentCommand-GEH6SNNA.js} +1 -1
- package/package.json +1 -4
- package/{read-64OQDO3I.js → read-2VHEHCAN.js} +8 -7
- package/{readDocTool-MXM3T6PE.js → readDocTool-CSWD6NPC.js} +1 -2
- package/{readlineWorkspace-XVJZDCSC.js → readlineWorkspace-3MOJWFM7.js} +3358 -3409
- package/{removeDialogAgentAction-NEKVAMSH.js → removeDialogAgentAction-2T7BPM3T.js} +19 -17
- package/{runAgentClientLoop-H7U53QB6.js → runAgentClientLoop-Y5UW544I.js} +73 -64
- package/{runtimeDoctorCommands-WI2YZUSJ.js → runtimeDoctorCommands-KHGQKT3B.js} +6 -6
- package/{setDialogExtraReferencesAction-WTOHQDIV.js → setDialogExtraReferencesAction-GPT37HTW.js} +15 -14
- package/{setPrimaryDialogAgentAction-LDJOYC4F.js → setPrimaryDialogAgentAction-3746P7IW.js} +19 -17
- package/{settingSlice-4M37TN7V.js → settingSlice-FIFOQ6OR.js} +16 -14
- package/{skillDiscovery-5U6RYAHN.js → skillDiscovery-KLLKXPUO.js} +4 -4
- package/{slateUtils-2M7MUTWX.js → slateUtils-VO2FU36K.js} +1 -1
- package/{spaceCommands-7VVKJBDV.js → spaceCommands-NKSBD5G3.js} +45 -241
- package/{spaceSlice-T6YK6D34.js → spaceSlice-L44CI2QR.js} +39 -61
- package/{streamAgentChatTurn-RQ63QFQ7.js → streamAgentChatTurn-7DU4Z2VJ.js} +1262 -150
- package/{switchDialogAgentAction-XVWGKR2Z.js → switchDialogAgentAction-MQTUTQHL.js} +14 -13
- package/syncMapping-RK2MANUX.js +43 -0
- package/{tableCommands-RJZ3V4TF.js → tableCommands-64FZBAI3.js} +9 -8
- package/{toolApiClient-ARGFDJAG.js → toolApiClient-B2MFXMEG.js} +3 -3
- package/tools-2JI52WJP.js +99 -0
- package/{tuiSummaryLlmCaller-SRZ4QQUP.js → tuiSummaryLlmCaller-EAWQ3IZX.js} +25 -21
- package/{updateCommands-AK2RDOFR.js → updateCommands-MNDUIKN7.js} +2 -2
- package/{updateDialogTitleAction-BBDSWHNG.js → updateDialogTitleAction-HW33OIJI.js} +49 -38
- package/agentRecordCommands-JFZRQJQ4.js +0 -103
- package/agentRunCommand-NOX5FLKO.js +0 -121
- package/chunk-AYMOSAHE.js +0 -3158
- package/chunk-D2BPX6DQ.js +0 -1707
- package/chunk-DCDL3GC4.js +0 -171
- package/chunk-F3MP7CP6.js +0 -73
- package/chunk-WZSRQNQG.js +0 -2587
- package/createDialogAction-Y6YV64QB.js +0 -52
- package/dialogCommands-XLO5CAHZ.js +0 -95
- package/machineWsRunDispatch-HONRUK3R.js +0 -119
- package/tools-KYZX3BGO.js +0 -90
- package/{chunk-Z5MXSEOJ.js → chunk-RQSOAMPJ.js} +2 -2
- package/{chunk-JDSUTNYY.js → chunk-SAQQLJZ5.js} +3 -3
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
applyAgentSecretMigrationUpdates,
|
|
3
|
+
createFileCredentialBroker,
|
|
4
|
+
migrateAgentSecrets,
|
|
5
|
+
normalizeAgentRuntimeToolPolicy
|
|
6
|
+
} from "./chunk-RQFO3CAF.js";
|
|
4
7
|
import {
|
|
5
8
|
asRecordOrEmpty
|
|
6
9
|
} from "./chunk-KX6YBIHG.js";
|
|
@@ -8,28 +11,19 @@ import {
|
|
|
8
11
|
patch,
|
|
9
12
|
remove,
|
|
10
13
|
write
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UM4H3URE.js";
|
|
15
|
+
import {
|
|
16
|
+
createAgentKey,
|
|
17
|
+
toTrimmedString
|
|
18
|
+
} from "./chunk-KMSZPTM6.js";
|
|
12
19
|
import {
|
|
13
20
|
asyncThunkCreator,
|
|
14
21
|
buildCreateSlice,
|
|
15
22
|
getRuntimeServerContext
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import {
|
|
18
|
-
createAgentKey,
|
|
19
|
-
toTrimmedString
|
|
20
|
-
} from "./chunk-WHLVPK32.js";
|
|
23
|
+
} from "./chunk-X664KVEV.js";
|
|
21
24
|
import {
|
|
22
25
|
asTrimmedString
|
|
23
26
|
} from "./chunk-3EUW3WEO.js";
|
|
24
|
-
import {
|
|
25
|
-
asOptionalPositiveFiniteNumber
|
|
26
|
-
} from "./chunk-U6VC4MU4.js";
|
|
27
|
-
import {
|
|
28
|
-
isRecord
|
|
29
|
-
} from "./chunk-KUG52IAP.js";
|
|
30
|
-
import {
|
|
31
|
-
asNonEmptyStringArray
|
|
32
|
-
} from "./chunk-I42VC5KR.js";
|
|
33
27
|
import {
|
|
34
28
|
asOptionalTrimmedString
|
|
35
29
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -89,283 +83,6 @@ var sanitizeOptionalModelString = (value) => {
|
|
|
89
83
|
|
|
90
84
|
// packages/ai/agent/agentSlice.ts
|
|
91
85
|
import { ulid } from "ulid";
|
|
92
|
-
|
|
93
|
-
// packages/agent-runtime/fileCredentialBroker.ts
|
|
94
|
-
import {
|
|
95
|
-
chmodSync,
|
|
96
|
-
existsSync,
|
|
97
|
-
mkdirSync,
|
|
98
|
-
readFileSync,
|
|
99
|
-
unlinkSync,
|
|
100
|
-
writeFileSync
|
|
101
|
-
} from "node:fs";
|
|
102
|
-
import { homedir } from "node:os";
|
|
103
|
-
import { join } from "node:path";
|
|
104
|
-
|
|
105
|
-
// packages/agent-runtime/credentialBroker.ts
|
|
106
|
-
function assertCredentialRef(ref) {
|
|
107
|
-
const trimmed = asTrimmedString(ref);
|
|
108
|
-
if (!trimmed) {
|
|
109
|
-
throw new Error("invalid_ref");
|
|
110
|
-
}
|
|
111
|
-
if (trimmed.includes("..") || trimmed.includes("/") || trimmed.includes("\\")) {
|
|
112
|
-
throw new Error("invalid_ref");
|
|
113
|
-
}
|
|
114
|
-
return trimmed;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// packages/agent-runtime/fileCredentialBroker.ts
|
|
118
|
-
function getApiKeyCredentialsDir(homeDir = homedir()) {
|
|
119
|
-
return join(getCredentialsDir(homeDir), "keys");
|
|
120
|
-
}
|
|
121
|
-
function credentialRefToFileName(ref) {
|
|
122
|
-
const safe = assertCredentialRef(ref).replace(/[^a-zA-Z0-9._-]+/g, "_");
|
|
123
|
-
if (!safe || safe === "." || safe === "..") {
|
|
124
|
-
throw new Error(`Credential ref is not filesystem-safe: ${ref}`);
|
|
125
|
-
}
|
|
126
|
-
return `${safe}.json`;
|
|
127
|
-
}
|
|
128
|
-
function getApiKeyCredentialPath(ref, homeDir = homedir()) {
|
|
129
|
-
return join(getApiKeyCredentialsDir(homeDir), credentialRefToFileName(ref));
|
|
130
|
-
}
|
|
131
|
-
function ensurePrivateDir(dir) {
|
|
132
|
-
mkdirSync(dir, { recursive: true, mode: 448 });
|
|
133
|
-
try {
|
|
134
|
-
chmodSync(dir, 448);
|
|
135
|
-
} catch {
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
function writePrivateFile(path, body) {
|
|
139
|
-
writeFileSync(path, body, { encoding: "utf8", mode: 384 });
|
|
140
|
-
try {
|
|
141
|
-
chmodSync(path, 384);
|
|
142
|
-
} catch {
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function readApiKeyCredential(ref, homeDir = homedir()) {
|
|
146
|
-
const path = getApiKeyCredentialPath(ref, homeDir);
|
|
147
|
-
if (!existsSync(path)) return null;
|
|
148
|
-
try {
|
|
149
|
-
const raw = readFileSync(path, "utf8");
|
|
150
|
-
const parsed = JSON.parse(raw);
|
|
151
|
-
if (typeof parsed?.secret !== "string" || !parsed.secret) return null;
|
|
152
|
-
return parsed.secret;
|
|
153
|
-
} catch {
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function writeApiKeyCredential(ref, secret, homeDir = homedir(), now = Date.now()) {
|
|
158
|
-
const trimmedSecret = secret.trim();
|
|
159
|
-
if (!trimmedSecret) {
|
|
160
|
-
throw new Error("Cannot store an empty credential secret.");
|
|
161
|
-
}
|
|
162
|
-
assertCredentialRef(ref);
|
|
163
|
-
const dir = getApiKeyCredentialsDir(homeDir);
|
|
164
|
-
ensurePrivateDir(dir);
|
|
165
|
-
const path = getApiKeyCredentialPath(ref, homeDir);
|
|
166
|
-
const payload = {
|
|
167
|
-
secret: trimmedSecret,
|
|
168
|
-
updatedAt: now
|
|
169
|
-
};
|
|
170
|
-
writePrivateFile(path, `${JSON.stringify(payload, null, 2)}
|
|
171
|
-
`);
|
|
172
|
-
}
|
|
173
|
-
function removeApiKeyCredential(ref, homeDir = homedir()) {
|
|
174
|
-
assertCredentialRef(ref);
|
|
175
|
-
const path = getApiKeyCredentialPath(ref, homeDir);
|
|
176
|
-
if (!existsSync(path)) return;
|
|
177
|
-
unlinkSync(path);
|
|
178
|
-
}
|
|
179
|
-
function hasApiKeyCredential(ref, homeDir = homedir()) {
|
|
180
|
-
return readApiKeyCredential(ref, homeDir) !== null;
|
|
181
|
-
}
|
|
182
|
-
function createFileCredentialBroker(options = {}) {
|
|
183
|
-
const homeDir = options.homeDir ?? homedir();
|
|
184
|
-
const now = options.now ?? Date.now;
|
|
185
|
-
return {
|
|
186
|
-
get(ref) {
|
|
187
|
-
return readApiKeyCredential(ref, homeDir);
|
|
188
|
-
},
|
|
189
|
-
put(ref, secret) {
|
|
190
|
-
writeApiKeyCredential(ref, secret, homeDir, now());
|
|
191
|
-
},
|
|
192
|
-
delete(ref) {
|
|
193
|
-
removeApiKeyCredential(ref, homeDir);
|
|
194
|
-
},
|
|
195
|
-
has(ref) {
|
|
196
|
-
return hasApiKeyCredential(ref, homeDir);
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// packages/agent-runtime/migrateAgentSecrets.ts
|
|
202
|
-
function buildAgentApiKeyCredentialRef(agentKey) {
|
|
203
|
-
const key = asTrimmedString(agentKey);
|
|
204
|
-
if (!key) throw new Error("agentKey is required to build a credential ref.");
|
|
205
|
-
return `api-key:${key}`;
|
|
206
|
-
}
|
|
207
|
-
function readRawApiKey(agent) {
|
|
208
|
-
return asTrimmedString(agent.apiKey);
|
|
209
|
-
}
|
|
210
|
-
function resolveTargetRef(agent) {
|
|
211
|
-
const fromCredential = asTrimmedString(agent.credentialRef);
|
|
212
|
-
if (fromCredential) return fromCredential;
|
|
213
|
-
const fromApiKeyRef = asTrimmedString(agent.apiKeyRef);
|
|
214
|
-
if (fromApiKeyRef.startsWith("api-key:")) return fromApiKeyRef;
|
|
215
|
-
return buildAgentApiKeyCredentialRef(agent.key);
|
|
216
|
-
}
|
|
217
|
-
async function brokerHas(broker, ref) {
|
|
218
|
-
return Boolean(await broker.has(ref));
|
|
219
|
-
}
|
|
220
|
-
async function brokerPut(broker, ref, secret) {
|
|
221
|
-
await broker.put(ref, secret);
|
|
222
|
-
}
|
|
223
|
-
async function migrateAgentSecrets(args) {
|
|
224
|
-
const { agent, broker } = args;
|
|
225
|
-
const raw = readRawApiKey(agent);
|
|
226
|
-
const migration = asTrimmedString(agent.credentialMigration);
|
|
227
|
-
if (migration === "done" && !raw) {
|
|
228
|
-
const ref = typeof agent.credentialRef === "string" && agent.credentialRef.trim() || (typeof agent.apiKeyRef === "string" && agent.apiKeyRef.startsWith("api-key:") ? agent.apiKeyRef.trim() : "") || void 0;
|
|
229
|
-
return {
|
|
230
|
-
updates: {},
|
|
231
|
-
status: "already-done",
|
|
232
|
-
...ref ? { credentialRef: ref } : {},
|
|
233
|
-
phase: "complete"
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
if (!raw && migration !== "pending") {
|
|
237
|
-
return { updates: {}, status: "noop", phase: "none" };
|
|
238
|
-
}
|
|
239
|
-
const targetRef = resolveTargetRef(agent);
|
|
240
|
-
if (raw) {
|
|
241
|
-
await brokerPut(broker, targetRef, raw);
|
|
242
|
-
const stored2 = await brokerHas(broker, targetRef);
|
|
243
|
-
if (!stored2) {
|
|
244
|
-
return {
|
|
245
|
-
updates: {
|
|
246
|
-
credentialRef: targetRef,
|
|
247
|
-
credentialMigration: "pending"
|
|
248
|
-
},
|
|
249
|
-
status: "resumed-pending",
|
|
250
|
-
credentialRef: targetRef,
|
|
251
|
-
phase: "put"
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
return {
|
|
255
|
-
updates: {
|
|
256
|
-
apiKey: null,
|
|
257
|
-
credentialRef: targetRef,
|
|
258
|
-
// Keep apiKeyRef for resolution if not already an OAuth provider name.
|
|
259
|
-
// Prefer explicit credentialRef; set apiKeyRef only when empty so OAuth agents stay intact.
|
|
260
|
-
...!(typeof agent.apiKeyRef === "string" && agent.apiKeyRef.trim()) ? { apiKeyRef: targetRef } : {},
|
|
261
|
-
credentialMigration: "done"
|
|
262
|
-
},
|
|
263
|
-
status: migration === "pending" ? "resumed-pending" : "migrated",
|
|
264
|
-
credentialRef: targetRef,
|
|
265
|
-
phase: "strip"
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
const stored = await brokerHas(broker, targetRef);
|
|
269
|
-
if (stored) {
|
|
270
|
-
return {
|
|
271
|
-
updates: {
|
|
272
|
-
credentialRef: targetRef,
|
|
273
|
-
credentialMigration: "done",
|
|
274
|
-
...!(typeof agent.apiKeyRef === "string" && agent.apiKeyRef.trim()) ? { apiKeyRef: targetRef } : {}
|
|
275
|
-
},
|
|
276
|
-
status: "resumed-pending",
|
|
277
|
-
credentialRef: targetRef,
|
|
278
|
-
phase: "complete"
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
return {
|
|
282
|
-
updates: {
|
|
283
|
-
credentialRef: targetRef,
|
|
284
|
-
credentialMigration: "pending"
|
|
285
|
-
},
|
|
286
|
-
status: "awaiting-secret",
|
|
287
|
-
credentialRef: targetRef,
|
|
288
|
-
phase: "put"
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
function applyAgentSecretMigrationUpdates(record, updates) {
|
|
292
|
-
const next = { ...record };
|
|
293
|
-
if ("apiKey" in updates) {
|
|
294
|
-
if (updates.apiKey === null || updates.apiKey === "") {
|
|
295
|
-
delete next.apiKey;
|
|
296
|
-
} else if (typeof updates.apiKey === "string") {
|
|
297
|
-
next.apiKey = updates.apiKey;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
if (updates.apiKeyRef !== void 0) next.apiKeyRef = updates.apiKeyRef;
|
|
301
|
-
if (updates.credentialRef !== void 0) next.credentialRef = updates.credentialRef;
|
|
302
|
-
if (updates.credentialMigration !== void 0) {
|
|
303
|
-
next.credentialMigration = updates.credentialMigration;
|
|
304
|
-
}
|
|
305
|
-
return next;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// packages/agent-runtime/runtimeToolPolicy.ts
|
|
309
|
-
function unique(values) {
|
|
310
|
-
return [...new Set(values)];
|
|
311
|
-
}
|
|
312
|
-
function normalizeAgentRuntimeToolPolicy(value) {
|
|
313
|
-
if (!isRecord(value)) return void 0;
|
|
314
|
-
return {
|
|
315
|
-
version: 1,
|
|
316
|
-
...asNonEmptyStringArray(value.agentTools).length ? { agentTools: unique(asNonEmptyStringArray(value.agentTools)) } : {},
|
|
317
|
-
...asNonEmptyStringArray(value.runtimeTools).length ? { runtimeTools: unique(asNonEmptyStringArray(value.runtimeTools)) } : {},
|
|
318
|
-
...isRecord(value.workspace) ? { workspace: { ...value.workspace } } : {},
|
|
319
|
-
...isRecord(value.shell) ? { shell: { ...value.shell } } : {},
|
|
320
|
-
...isRecord(value.isolation) ? { isolation: { ...value.isolation } } : {},
|
|
321
|
-
...isRecord(value.git) ? { git: { ...value.git } } : {},
|
|
322
|
-
...isRecord(value.budget) ? { budget: { ...value.budget } } : {},
|
|
323
|
-
...isRecord(value.audit) ? { audit: { ...value.audit } } : {}
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
function runtimeBindingRecord(runtimeBinding) {
|
|
327
|
-
return isRecord(runtimeBinding) ? runtimeBinding : void 0;
|
|
328
|
-
}
|
|
329
|
-
function runtimeToolNamesFromPolicy(policy) {
|
|
330
|
-
return asNonEmptyStringArray(policy?.runtimeTools);
|
|
331
|
-
}
|
|
332
|
-
function readPositiveNumber(value) {
|
|
333
|
-
return asOptionalPositiveFiniteNumber(Number(value));
|
|
334
|
-
}
|
|
335
|
-
function resolveRequestedRuntimeToolNames(args) {
|
|
336
|
-
const runtimeBinding = runtimeBindingRecord(args.agentConfig.runtimeBinding);
|
|
337
|
-
const bindingPolicy = normalizeAgentRuntimeToolPolicy(
|
|
338
|
-
runtimeBinding?.runtimeToolPolicy
|
|
339
|
-
);
|
|
340
|
-
const bindingSnapshotPolicy = normalizeAgentRuntimeToolPolicy(
|
|
341
|
-
runtimeBinding?.runtimeToolPolicySnapshot
|
|
342
|
-
);
|
|
343
|
-
return unique([
|
|
344
|
-
...asNonEmptyStringArray(args.agentConfig.toolNames),
|
|
345
|
-
...runtimeToolNamesFromPolicy(
|
|
346
|
-
normalizeAgentRuntimeToolPolicy(args.agentConfig.runtimeToolPolicy)
|
|
347
|
-
),
|
|
348
|
-
...runtimeToolNamesFromPolicy(bindingPolicy),
|
|
349
|
-
...runtimeToolNamesFromPolicy(bindingSnapshotPolicy)
|
|
350
|
-
]);
|
|
351
|
-
}
|
|
352
|
-
function resolveCurrentRunRuntimeToolPolicy(agentConfig) {
|
|
353
|
-
const runtimeBinding = runtimeBindingRecord(agentConfig?.runtimeBinding);
|
|
354
|
-
return normalizeAgentRuntimeToolPolicy(
|
|
355
|
-
runtimeBinding?.runtimeToolPolicySnapshot ?? agentConfig?.runtimeToolPolicy ?? runtimeBinding?.runtimeToolPolicy
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
function resolveLocalRuntimeEnvFromPolicy(runtimeEnv, policy) {
|
|
359
|
-
return { ...runtimeEnv };
|
|
360
|
-
}
|
|
361
|
-
function resolveLocalWorkspaceExecutorOptionsFromPolicy(policy) {
|
|
362
|
-
const maxOutputBytes = readPositiveNumber(policy?.shell?.maxOutputBytes);
|
|
363
|
-
return {
|
|
364
|
-
...maxOutputBytes ? { commandOutputLimit: Math.floor(maxOutputBytes) } : {}
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// packages/ai/agent/agentSlice.ts
|
|
369
86
|
var createAgentCredentialBroker = createFileCredentialBroker;
|
|
370
87
|
function setAgentCredentialBrokerFactoryForTests(factory) {
|
|
371
88
|
createAgentCredentialBroker = factory ?? createFileCredentialBroker;
|
|
@@ -445,6 +162,10 @@ var processAgentCreateForm = (formData, userId) => {
|
|
|
445
162
|
if ("provider" in result) {
|
|
446
163
|
result.provider = sanitizeOptionalModelString(result.provider);
|
|
447
164
|
}
|
|
165
|
+
if ("cliProvider" in result) {
|
|
166
|
+
const cp = result.cliProvider;
|
|
167
|
+
result.cliProvider = cp || null;
|
|
168
|
+
}
|
|
448
169
|
return result;
|
|
449
170
|
};
|
|
450
171
|
var processAgentUpdateChanges = (data, userId, previousAgent) => {
|
|
@@ -477,7 +198,7 @@ var processAgentUpdateChanges = (data, userId, previousAgent) => {
|
|
|
477
198
|
changes.apiSource = data.apiSource;
|
|
478
199
|
}
|
|
479
200
|
if ("cliProvider" in data) {
|
|
480
|
-
changes.cliProvider = data.cliProvider ||
|
|
201
|
+
changes.cliProvider = data.cliProvider || null;
|
|
481
202
|
}
|
|
482
203
|
if ("machineId" in data) {
|
|
483
204
|
const machineId = String(data.machineId ?? "").trim();
|
|
@@ -583,7 +304,7 @@ var slice = createSliceWithThunks({
|
|
|
583
304
|
const overrides = {};
|
|
584
305
|
if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
|
|
585
306
|
if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
|
|
586
|
-
const { _executeModel } = await import("./_executeModel-
|
|
307
|
+
const { _executeModel } = await import("./_executeModel-YXWAXPWQ.js");
|
|
587
308
|
return _executeModel(
|
|
588
309
|
{
|
|
589
310
|
isStreaming: args.isStreaming ?? false,
|
|
@@ -604,7 +325,7 @@ var slice = createSliceWithThunks({
|
|
|
604
325
|
* - 循环直到无工具调用或触发其他运行时停止条件
|
|
605
326
|
*/
|
|
606
327
|
runAgent: create.asyncThunk(async (args, thunkApi) => {
|
|
607
|
-
const { runAgentClientLoop } = await import("./runAgentClientLoop-
|
|
328
|
+
const { runAgentClientLoop } = await import("./runAgentClientLoop-Y5UW544I.js");
|
|
608
329
|
const { content: loopContent, toolCallCount } = await runAgentClientLoop(
|
|
609
330
|
{
|
|
610
331
|
agentKey: args.agentKey,
|
|
@@ -620,7 +341,7 @@ var slice = createSliceWithThunks({
|
|
|
620
341
|
* 聊天轮次流式 Agent 调用
|
|
621
342
|
*/
|
|
622
343
|
streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
|
|
623
|
-
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-
|
|
344
|
+
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-7DU4Z2VJ.js");
|
|
624
345
|
return streamAgentChatTurnHandler(args, thunkApi);
|
|
625
346
|
}),
|
|
626
347
|
/**
|
|
@@ -846,11 +567,6 @@ var agentSlice_default = agentReducer;
|
|
|
846
567
|
export {
|
|
847
568
|
fetchServerSyncedCredential,
|
|
848
569
|
deleteServerSyncedCredential,
|
|
849
|
-
createFileCredentialBroker,
|
|
850
|
-
resolveRequestedRuntimeToolNames,
|
|
851
|
-
resolveCurrentRunRuntimeToolPolicy,
|
|
852
|
-
resolveLocalRuntimeEnvFromPolicy,
|
|
853
|
-
resolveLocalWorkspaceExecutorOptionsFromPolicy,
|
|
854
570
|
setAgentCredentialBrokerFactoryForTests,
|
|
855
571
|
slice,
|
|
856
572
|
runLlm,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
selectCurrentServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UNOTBWZZ.js";
|
|
4
4
|
import {
|
|
5
5
|
patch
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UM4H3URE.js";
|
|
7
7
|
import {
|
|
8
8
|
selectIdentityToken
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-X664KVEV.js";
|
|
10
10
|
import {
|
|
11
11
|
getIsDesktopApp
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WJSW43QZ.js";
|
|
13
13
|
|
|
14
14
|
// packages/ai/agent/cliChatClient.ts
|
|
15
15
|
function getCliChatRequestConfig(thunkApi) {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toErrorMessage
|
|
3
|
+
} from "./chunk-HNMXYYJR.js";
|
|
4
|
+
|
|
1
5
|
// packages/create/editor/transforms/slateToSimplifiedMarkdown.ts
|
|
2
6
|
function renderTextNode(node) {
|
|
3
7
|
if (!node || typeof node.text !== "string") return "";
|
|
@@ -148,6 +152,70 @@ function slateToSimplifiedMarkdown(nodes, options = {}) {
|
|
|
148
152
|
return nodes.map((node) => renderNode(node, 0, options)).join("").trim() + "\n";
|
|
149
153
|
}
|
|
150
154
|
|
|
155
|
+
// packages/ai/tools/readDocTool.ts
|
|
156
|
+
var readDocFunctionSchema = {
|
|
157
|
+
name: "readDoc",
|
|
158
|
+
description: [
|
|
159
|
+
"\u8BFB\u53D6\u6307\u5B9A\u9875\u9762\u7684\u5185\u5BB9\uFF0C\u5E76\u5C06\u7ED3\u6784\u5316\u7684\u6570\u636E\u8F6C\u6362\u4E3A Markdown \u683C\u5F0F\u8FD4\u56DE\u3002",
|
|
160
|
+
"\u5982\u679C\u4F60\u62FF\u5230\u4E86\u9875\u9762\u7684 dbKey\uFF08\u5982 page-xxx\uFF09\uFF0C\u8BF7\u4F7F\u7528\u6B64\u5DE5\u5177\u67E5\u770B\u9875\u9762\u5185\u5BB9\u3002"
|
|
161
|
+
].join("\n"),
|
|
162
|
+
parameters: {
|
|
163
|
+
type: "object",
|
|
164
|
+
properties: {
|
|
165
|
+
id: {
|
|
166
|
+
type: "string",
|
|
167
|
+
description: "\u9875\u9762/\u6587\u6863\u7684\u6570\u636E\u5E93\u952E\uFF08dbKey\uFF09\uFF0C\u4F8B\u5982 page-xxx\u3002"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
required: ["id"]
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
var readPageFunctionSchema = {
|
|
174
|
+
...readDocFunctionSchema,
|
|
175
|
+
name: "readPage"
|
|
176
|
+
};
|
|
177
|
+
var buildReadDocResult = (pageData) => {
|
|
178
|
+
const markdownContent = slateToSimplifiedMarkdown(pageData.slateData || []);
|
|
179
|
+
const rawData = {
|
|
180
|
+
success: true,
|
|
181
|
+
id: pageData.dbKey,
|
|
182
|
+
title: pageData.title,
|
|
183
|
+
content: markdownContent,
|
|
184
|
+
metadata: {
|
|
185
|
+
spaceId: pageData.spaceId,
|
|
186
|
+
created: pageData.created
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const displayData = `\u5DF2\u6210\u529F\u8BFB\u53D6\u9875\u9762\u300A${pageData.title}\u300B\u3002
|
|
190
|
+
|
|
191
|
+
\u5185\u5BB9\u5982\u4E0B\uFF1A
|
|
192
|
+
|
|
193
|
+
${markdownContent}`;
|
|
194
|
+
return { rawData, displayData };
|
|
195
|
+
};
|
|
196
|
+
async function readDocFunc(args, thunkApi) {
|
|
197
|
+
const id = args.id ?? args.doc ?? args.docKey ?? args.pageKey ?? args.key;
|
|
198
|
+
if (!id || !id.toLowerCase().startsWith("page-")) {
|
|
199
|
+
throw new Error(`\u65E0\u6548\u7684\u9875\u9762 ID: ${id}\u3002\u9875\u9762 ID \u901A\u5E38\u4EE5 "page-" \u5F00\u5934\u3002`);
|
|
200
|
+
}
|
|
201
|
+
try {
|
|
202
|
+
const { readAction } = await import("./read-2VHEHCAN.js");
|
|
203
|
+
const pageData = await readAction({ dbKey: id }, thunkApi);
|
|
204
|
+
if (!pageData) {
|
|
205
|
+
throw new Error(`\u672A\u627E\u5230 ID \u4E3A ${id} \u7684\u9875\u9762\u3002`);
|
|
206
|
+
}
|
|
207
|
+
return buildReadDocResult(pageData);
|
|
208
|
+
} catch (error) {
|
|
209
|
+
throw new Error(`\u8BFB\u53D6\u9875\u9762\u65F6\u51FA\u9519: ${toErrorMessage(error)}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
var readPageFunc = readDocFunc;
|
|
213
|
+
|
|
151
214
|
export {
|
|
152
|
-
slateToSimplifiedMarkdown
|
|
215
|
+
slateToSimplifiedMarkdown,
|
|
216
|
+
readDocFunctionSchema,
|
|
217
|
+
readPageFunctionSchema,
|
|
218
|
+
buildReadDocResult,
|
|
219
|
+
readDocFunc,
|
|
220
|
+
readPageFunc
|
|
153
221
|
};
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
isPlatformHostedGrokModel
|
|
7
|
-
} from "./chunk-CAENRKNJ.js";
|
|
2
|
+
isOpenAiResponsesModel,
|
|
3
|
+
resolvePlatformChatCompletionsEndpoint,
|
|
4
|
+
resolvePlatformResponsesEndpoint
|
|
5
|
+
} from "./chunk-CPYYM4RJ.js";
|
|
8
6
|
import {
|
|
9
7
|
asTrimmedLowercaseString
|
|
10
8
|
} from "./chunk-QSJ3HFEF.js";
|
|
11
|
-
import {
|
|
12
|
-
normalizeServerOrigin
|
|
13
|
-
} from "./chunk-CF7PE763.js";
|
|
14
9
|
import {
|
|
15
10
|
asTrimmedString
|
|
16
11
|
} from "./chunk-3EUW3WEO.js";
|
|
12
|
+
import {
|
|
13
|
+
normalizeServerOrigin
|
|
14
|
+
} from "./chunk-CF7PE763.js";
|
|
17
15
|
import {
|
|
18
16
|
asOptionalTrimmedString
|
|
19
17
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -30,68 +28,10 @@ function pickAgentRuntimeInferenceOptions(agentConfig) {
|
|
|
30
28
|
};
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
// packages/agent-runtime/platformProviderEndpoints.ts
|
|
34
|
-
var OPENAI_RESPONSES_ENDPOINT = "https://api.openai.com/v1/responses";
|
|
35
|
-
var DEEPSEEK_RESPONSES_ENDPOINT = "https://api.deepseek.com/responses";
|
|
36
|
-
var XAI_CHAT_COMPLETIONS_ENDPOINT = "https://api.x.ai/v1/chat/completions";
|
|
37
|
-
var PLATFORM_CHAT_COMPLETIONS_ENDPOINTS = {
|
|
38
|
-
deepinfra: "https://api.deepinfra.com/v1/openai/chat/completions",
|
|
39
|
-
fireworks: "https://api.fireworks.ai/inference/v1/chat/completions",
|
|
40
|
-
google: "https://generativelanguage.googleapis.com/v1beta/openai/chat/completions",
|
|
41
|
-
openai: "https://api.openai.com/v1/chat/completions",
|
|
42
|
-
openrouter: "https://openrouter.ai/api/v1/chat/completions",
|
|
43
|
-
// 千问 AI 平台 OpenAI 兼容模式
|
|
44
|
-
qwen: "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
|
|
45
|
-
// Moonshot AI(月之暗面)开放平台 OpenAI 兼容模式(按量计费)
|
|
46
|
-
moonshot: "https://api.moonshot.cn/v1/chat/completions",
|
|
47
|
-
// Non-DeepSeek hosted models use Ollama Cloud. DeepSeek Flash is routed
|
|
48
|
-
// separately to the official DeepSeek Responses endpoint.
|
|
49
|
-
nolo: "https://ollama.com/v1/chat/completions"
|
|
50
|
-
};
|
|
51
|
-
function isOpenAiResponsesModel(args) {
|
|
52
|
-
const provider = asTrimmedLowercaseString(args.provider);
|
|
53
|
-
if (provider === "nolo" || provider === "deepseek") {
|
|
54
|
-
const model = args.model?.trim().toLowerCase();
|
|
55
|
-
return model === "deepseek-v4-flash" || model === "deepseek-v4-pro";
|
|
56
|
-
}
|
|
57
|
-
if (provider !== "openai") return false;
|
|
58
|
-
if (args.endpointKey === "responses") return true;
|
|
59
|
-
if (!args.model) return false;
|
|
60
|
-
try {
|
|
61
|
-
return getModelConfig("openai", args.model).endpointKey === "responses";
|
|
62
|
-
} catch {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function resolvePlatformResponsesEndpoint(provider) {
|
|
67
|
-
const normalized = asTrimmedLowercaseString(provider);
|
|
68
|
-
if (normalized === "openai") return OPENAI_RESPONSES_ENDPOINT;
|
|
69
|
-
if (normalized === "nolo" || normalized === "deepseek") {
|
|
70
|
-
return DEEPSEEK_RESPONSES_ENDPOINT;
|
|
71
|
-
}
|
|
72
|
-
return void 0;
|
|
73
|
-
}
|
|
74
|
-
var PLATFORM_PROVIDER_ENDPOINT_ALIASES = {
|
|
75
|
-
"ollama-cloud": "nolo",
|
|
76
|
-
deepseek: "nolo"
|
|
77
|
-
};
|
|
78
|
-
function resolvePlatformChatCompletionsEndpoint(provider, model) {
|
|
79
|
-
const key = asTrimmedLowercaseString(provider);
|
|
80
|
-
if (!key) return void 0;
|
|
81
|
-
const aliased = PLATFORM_PROVIDER_ENDPOINT_ALIASES[key] ?? key;
|
|
82
|
-
if (aliased === "nolo" && isPlatformHostedClaudeModel(model)) {
|
|
83
|
-
return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS.deepinfra;
|
|
84
|
-
}
|
|
85
|
-
if (aliased === "nolo" && isPlatformHostedGrokModel(model)) {
|
|
86
|
-
return XAI_CHAT_COMPLETIONS_ENDPOINT;
|
|
87
|
-
}
|
|
88
|
-
return PLATFORM_CHAT_COMPLETIONS_ENDPOINTS[aliased];
|
|
89
|
-
}
|
|
90
|
-
|
|
91
31
|
// packages/agent-runtime/providerResolution.ts
|
|
92
32
|
function resolvePlatformProviderEndpoint(agentConfig) {
|
|
93
33
|
const customProviderUrl = agentConfig.customProviderUrl?.trim();
|
|
94
|
-
if (customProviderUrl) return
|
|
34
|
+
if (customProviderUrl) return resolveCustomProviderEndpoint(customProviderUrl);
|
|
95
35
|
const provider = asTrimmedLowercaseString(
|
|
96
36
|
agentConfig.provider ?? agentConfig.apiSource ?? "openai"
|
|
97
37
|
);
|
|
@@ -132,6 +72,14 @@ function resolveChatCompletionsEndpoint(value) {
|
|
|
132
72
|
const trimmed = trimTrailingSlash(value);
|
|
133
73
|
return trimmed.endsWith("/chat/completions") ? trimmed : `${trimmed}/chat/completions`;
|
|
134
74
|
}
|
|
75
|
+
function resolveCustomProviderEndpoint(value) {
|
|
76
|
+
const trimmed = trimTrailingSlash(value);
|
|
77
|
+
if (!trimmed) return "";
|
|
78
|
+
if (/\/responses$/i.test(trimmed) || /\/chat\/completions$/i.test(trimmed)) {
|
|
79
|
+
return trimmed;
|
|
80
|
+
}
|
|
81
|
+
return `${trimmed}/chat/completions`;
|
|
82
|
+
}
|
|
135
83
|
function resolveOpenAiCompatibleBaseUrl(env) {
|
|
136
84
|
return env.NOLO_LOCAL_OPENAI_BASE_URL || env.OPENAI_BASE_URL || "https://api.openai.com/v1";
|
|
137
85
|
}
|
|
@@ -232,7 +180,7 @@ async function buildProviderExecutionPlan(args) {
|
|
|
232
180
|
};
|
|
233
181
|
}
|
|
234
182
|
if (mode === "custom") {
|
|
235
|
-
const endpoint2 =
|
|
183
|
+
const endpoint2 = resolveCustomProviderEndpoint(agentConfig.customProviderUrl || resolveOpenAiCompatibleBaseUrl(env));
|
|
236
184
|
let apiKey2 = "";
|
|
237
185
|
const credentialRef2 = agentConfig.credentialRef?.trim();
|
|
238
186
|
const apiKeyRef = agentConfig.apiKeyRef?.trim();
|
|
@@ -263,6 +211,20 @@ async function buildProviderExecutionPlan(args) {
|
|
|
263
211
|
apiKey2 = trimmed;
|
|
264
212
|
}
|
|
265
213
|
}
|
|
214
|
+
if (!apiKey2 && apiKeyRef && apiKeyRef.startsWith("provider-key:") && args.syncFetcher) {
|
|
215
|
+
try {
|
|
216
|
+
const shared = await args.syncFetcher(apiKeyRef);
|
|
217
|
+
const trimmed = asTrimmedString(shared);
|
|
218
|
+
if (trimmed) {
|
|
219
|
+
try {
|
|
220
|
+
await args.credentialBroker?.put(apiKeyRef, trimmed);
|
|
221
|
+
} catch {
|
|
222
|
+
}
|
|
223
|
+
apiKey2 = trimmed;
|
|
224
|
+
}
|
|
225
|
+
} catch {
|
|
226
|
+
}
|
|
227
|
+
}
|
|
266
228
|
if (!apiKey2 && apiKeyRef && args.apiKeyRefResolver) {
|
|
267
229
|
const resolved = await args.apiKeyRefResolver(apiKeyRef);
|
|
268
230
|
if (resolved) {
|
|
@@ -365,9 +327,6 @@ async function buildProviderExecutionPlan(args) {
|
|
|
365
327
|
|
|
366
328
|
export {
|
|
367
329
|
pickAgentRuntimeInferenceOptions,
|
|
368
|
-
isOpenAiResponsesModel,
|
|
369
|
-
resolvePlatformResponsesEndpoint,
|
|
370
|
-
resolvePlatformChatCompletionsEndpoint,
|
|
371
330
|
trimTrailingSlash,
|
|
372
331
|
resolvePlatformServerUrl,
|
|
373
332
|
resolvePlatformAuthToken,
|