nolo-cli 0.29.1 → 0.30.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.
- package/{_executeModel-TN7FW73L.js → _executeModel-VBHHG7LT.js} +62 -68
- package/{action-6BM26ZYM.js → action-FENWPT3C.js} +14 -15
- package/{addContentAction-HLTFX56O.js → addContentAction-Z5S5ZQ7I.js} +12 -12
- package/{addDialogAgentAction-Q2TYWDO6.js → addDialogAgentAction-VUNVD2XR.js} +11 -11
- package/{agentDeleteCommand-VP4VLCMG.js → agentDeleteCommand-LLGZXUYJ.js} +60 -39
- package/{agentEmailCommands-N32KWVCX.js → agentEmailCommands-LC2FPN6G.js} +76 -81
- package/{agentGrantCommands-JNDE4RWR.js → agentGrantCommands-E7ZZFRHK.js} +2 -1
- package/{agentListCommands-MXITEBUS.js → agentListCommands-A6OBQ3QX.js} +57 -40
- package/{agentMachineCommands-47Y2XEZZ.js → agentMachineCommands-4O4Q5B5X.js} +53 -35
- package/{agentPullCommand-ZZGU5KOY.js → agentPullCommand-4V36XNGV.js} +4 -3
- package/{agentRecordCommands-AK6ZRJLD.js → agentRecordCommands-W22RIQRV.js} +73 -78
- package/{agentRunCommand-24SNVDNC.js → agentRunCommand-V4OBU4FB.js} +77 -82
- package/{agentRunControl-SNUKXN6J.js → agentRunControl-AKBN2366.js} +13 -1
- package/{agentRuntimeLocal-VI3NHLDU.js → agentRuntimeLocal-I57YSGH4.js} +52 -34
- package/{agentSlice-D666DABC.js → agentSlice-3ZHY7RAO.js} +12 -13
- package/{appDeleteCommands-SF2V6QYZ.js → appDeleteCommands-DJJF466K.js} +53 -35
- package/{appDeployCommands-3EPVR545.js → appDeployCommands-WJZGIOEZ.js} +53 -35
- package/{appDeployStatusCommands-O65Y747J.js → appDeployStatusCommands-ICYXUJNO.js} +53 -35
- package/{appGetCommands-AHDOF4SS.js → appGetCommands-UOCWYJPV.js} +53 -35
- package/{appListCommands-Y7YCXODU.js → appListCommands-EOKWTXPW.js} +53 -35
- package/{authCommand-XMQHBK5L.js → authCommand-H5KE7K7K.js} +16 -16
- package/{authCommands-JSOG2H4E.js → authCommands-CXJ6PI2O.js} +7 -7
- package/{chunk-SNMJPH7J.js → chunk-2XM5KUNE.js} +4 -2
- package/{chunk-7H3UTGPM.js → chunk-3AUWC6EM.js} +82 -3
- package/{chunk-FVY6KI5A.js → chunk-3RIWR23B.js} +1 -1
- package/{chunk-ENUJPSZN.js → chunk-446VANPP.js} +18 -14
- package/{chunk-PB7G5MAM.js → chunk-44HACRCK.js} +4 -4
- package/{chunk-RZNYL4LW.js → chunk-4SAV7BD7.js} +65 -1
- package/{chunk-I5TJCJQP.js → chunk-56IUA7RU.js} +3 -3
- package/{chunk-STOUEEBU.js → chunk-66O5MZYH.js} +1 -1
- package/{chunk-PSK2RUHV.js → chunk-7CD24PU4.js} +360 -2
- package/{chunk-JYSXE6LE.js → chunk-A4JDTA5T.js} +13 -13
- package/{chunk-DZ3XJVET.js → chunk-AOS5IN2I.js} +1 -1
- package/{chunk-SKDNBYZK.js → chunk-BOL2D2JW.js} +1 -1
- package/{chunk-YTA2QOEE.js → chunk-CAENRKNJ.js} +15 -0
- package/{chunk-2TYLTEAH.js → chunk-CV6I4HBA.js} +1 -1
- package/chunk-DCDL3GC4.js +171 -0
- package/{chunk-WNENLKKI.js → chunk-DCWBP2O7.js} +42 -393
- package/{chunk-Y52E3TIS.js → chunk-DI6MXJK5.js} +37 -37
- package/{chunk-Z3LLUGD5.js → chunk-DKRT67FG.js} +11 -11
- package/{chunk-NWT2WUCY.js → chunk-DWQNDGO7.js} +20 -8
- package/{chunk-BPZSJH5X.js → chunk-FS5TTXPS.js} +6 -6
- package/chunk-G5JHHUAK.js +73 -0
- package/{chunk-GFVFYNL7.js → chunk-G6VITLCZ.js} +3 -3
- package/{chunk-MUI34IA2.js → chunk-GAGUBI42.js} +302 -14
- package/{chunk-YBHJZVWO.js → chunk-GVKTKT3O.js} +15 -8
- package/{chunk-GVYU3EVI.js → chunk-HI7QZNWX.js} +17 -10
- package/{chunk-MHHYH3JA.js → chunk-HLG6GAUD.js} +1 -1
- package/{chunk-MQRZ5QUH.js → chunk-IXZX5CJK.js} +1 -1
- package/{chunk-INWBJPQC.js → chunk-IZ3CBMD5.js} +3 -3
- package/{chunk-VHBWHNVT.js → chunk-K6QEHQZ3.js} +8 -4
- package/chunk-KW47OSRJ.js +3246 -0
- package/{chunk-F7S2SH5C.js → chunk-KWKD3BCC.js} +189 -122
- package/{chunk-L65QKSVJ.js → chunk-L3GCUVOH.js} +1 -1
- package/{chunk-XISENOC2.js → chunk-L3VQOVKK.js} +8 -8
- package/{chunk-HALKDXKP.js → chunk-MEUZFIAJ.js} +8 -4
- package/{chunk-XMAMUPXU.js → chunk-MMCVBEAD.js} +174 -149
- package/{chunk-XOIF2TNF.js → chunk-OB6FBSH3.js} +13 -0
- package/chunk-OYK7PA5U.js +1707 -0
- package/{chunk-WPRSBZYN.js → chunk-Q24P6TUS.js} +1 -1
- package/{chunk-7CP4UOUV.js → chunk-QLV2GKU5.js} +16 -178
- package/{chunk-2AX4ZWSG.js → chunk-SWOTB2TX.js} +135 -1166
- package/{chunk-BOPFLKHA.js → chunk-SWYMCHM7.js} +1 -69
- package/{chunk-YRMUYZ5H.js → chunk-SZ5CBYMZ.js} +4 -4
- package/chunk-T27IEBNQ.js +149 -0
- package/{chunk-WX3ZOSTL.js → chunk-T3Y5EMJS.js} +24 -26
- package/{chunk-RD6AOXQI.js → chunk-THTAR67C.js} +1056 -137
- package/{chunk-2FX23RGA.js → chunk-TJYWZ3LO.js} +4 -4
- package/{chunk-SLOGKB7M.js → chunk-TOW4E763.js} +9 -1
- package/{chunk-33K2M3AU.js → chunk-UKC5HU2C.js} +33 -40
- package/{chunk-STRCGEC6.js → chunk-UTQZ73QQ.js} +13 -9
- package/{chunk-GT3GG2H7.js → chunk-VSTUQGLT.js} +1 -1
- package/{chunk-4MCHUZUI.js → chunk-W2YKDXT7.js} +95 -95
- package/{chunk-L3QFIBZG.js → chunk-WTGCTVJG.js} +1 -1
- package/{chunk-XS7UPVR7.js → chunk-XD5NQEOH.js} +5 -5
- package/{chunk-WSQLK2KR.js → chunk-XFGM5PJP.js} +6 -6
- package/{chunk-DBUNOYLF.js → chunk-YLADSPDU.js} +3 -3
- package/{chunk-FRN5QOKN.js → chunk-YWGSCF37.js} +19 -4
- package/{codingSkills-EN6Z6G6U.js → codingSkills-V35TRR4Y.js} +1 -2
- package/{createAgentAutomationAction-VK3N263U.js → createAgentAutomationAction-3GMH6ORX.js} +30 -37
- package/{createDialogAction-KWZ74S2G.js → createDialogAction-R5MCL4RE.js} +32 -38
- package/{createPageAction-3CIZL5ZL.js → createPageAction-QYTG656R.js} +43 -50
- package/{db-W5UHK4P3.js → db-IPCJ43PW.js} +10 -6
- package/{dbSlice-GOKRGQ47.js → dbSlice-OBV7VFCF.js} +11 -11
- package/{deleteFile-WDZ3VM7B.js → deleteFile-AC45HYSM.js} +5 -5
- package/{dialogCommands-N4XKI6ZU.js → dialogCommands-NUQGIXVZ.js} +53 -37
- package/{dialogSlice-TKYB6VLO.js → dialogSlice-CFDECXEU.js} +27 -34
- package/{docCreateCommands-DTDKANXX.js → docCreateCommands-UNFCXB5N.js} +52 -36
- package/{docDeleteCommands-U4NB6OHK.js → docDeleteCommands-NG5IVKE5.js} +54 -38
- package/{docReadCommands-SDVQM3BH.js → docReadCommands-6J7MUUX6.js} +52 -36
- package/{docStore-E5QAM75M.js → docStore-MZZWJM4F.js} +28 -35
- package/{docUpdateCommands-O2O644FV.js → docUpdateCommands-6AW3VZOX.js} +55 -39
- package/{fetchMessages-W4IKHPCS.js → fetchMessages-VPPQDDZ4.js} +3 -3
- package/{getPricing-X6I23RN6.js → getPricing-XQYSSVV6.js} +6 -7
- package/{handleSendMessageAction-7OVC2SVU.js → handleSendMessageAction-IU2QNTLM.js} +30 -37
- package/index.js +72 -72
- package/localDialogRead-P72W2U2R.js +38 -0
- package/{machineCommands-6GNFKAVC.js → machineCommands-Z2QEWTHZ.js} +76 -81
- package/{machineWsRunDispatch-2DCHVG3U.js → machineWsRunDispatch-SJTYHZHN.js} +71 -76
- package/{models-YT32CTT5.js → models-WDUTTYFS.js} +2 -2
- package/{offlineMarxistsAgentCommand-5OOWZLJI.js → offlineMarxistsAgentCommand-E6LUG63A.js} +6 -2
- package/package.json +1 -1
- package/{read-A23NKT3O.js → read-QK7ZRX6G.js} +6 -6
- package/{readDocTool-JAM5BI5Q.js → readDocTool-EYDMVRBL.js} +2 -1
- package/{readlineWorkspace-KELDMUNZ.js → readlineWorkspace-EY3BPXIU.js} +151 -163
- package/{removeDialogAgentAction-K4HOWFHO.js → removeDialogAgentAction-TBW3UZJW.js} +15 -16
- package/{runAgentClientLoop-R3S7YN6Z.js → runAgentClientLoop-N3YDLTMS.js} +61 -66
- package/{setDialogExtraReferencesAction-JD7J7JM4.js → setDialogExtraReferencesAction-Q3ANF2NR.js} +12 -12
- package/{setPrimaryDialogAgentAction-YWSA5XEU.js → setPrimaryDialogAgentAction-FQ5R3EFJ.js} +15 -16
- package/{settingSlice-22GTX6CA.js → settingSlice-JKKV2T7O.js} +13 -14
- package/{skillDiscovery-ITA7BI7A.js → skillDiscovery-I3QRA7NE.js} +2 -2
- package/{spaceCommands-WM6W3WMQ.js → spaceCommands-R6AEQNLG.js} +57 -40
- package/{spaceSlice-RC2APBOD.js → spaceSlice-MCH7RLLP.js} +27 -34
- package/{streamAgentChatTurn-Q655CCVP.js → streamAgentChatTurn-Q4U2CVMI.js} +130 -1300
- package/{switchDialogAgentAction-6JKFBJVR.js → switchDialogAgentAction-QQGVE4SL.js} +11 -11
- package/{toolApiClient-ISM4ZQX4.js → toolApiClient-ARGFDJAG.js} +3 -3
- package/{tools-A6MUIA3Q.js → tools-Y3UBLLYW.js} +50 -56
- package/{tuiSummaryLlmCaller-GCUPULOV.js → tuiSummaryLlmCaller-4474IBTI.js} +12 -12
- package/{updateDialogTitleAction-DQYY564Y.js → updateDialogTitleAction-3J7GH67I.js} +35 -43
- package/chunk-3LJ4RSSF.js +0 -231
- package/chunk-5CS33IBL.js +0 -301
- package/chunk-5MMAK75Q.js +0 -15
- package/chunk-MRC4Q34M.js +0 -188
- package/chunk-P6TB7JIA.js +0 -1791
- package/chunk-PFTK5SEB.js +0 -620
- package/chunk-PMSG3OGF.js +0 -669
- package/chunk-SIZQB7BD.js +0 -91
- package/chunk-VIDPVFP3.js +0 -20
- package/chunk-Y5GCAMGP.js +0 -9
- package/chunk-YYLHWIW6.js +0 -48
- package/chunk-ZZ2MH7LE.js +0 -84
- package/localDialogRead-JXTAHW2E.js +0 -26
- package/{chunk-ZVZMT3EA.js → chunk-KWCLUYGQ.js} +3 -3
- package/{chunk-NRY4GCKJ.js → chunk-WHLVPK32.js} +3 -3
- package/{chunk-RQSOAMPJ.js → chunk-Z5MXSEOJ.js} +2 -2
- package/{chunk-XMLRJUU5.js → chunk-ZFTCLBEX.js} +9 -9
- package/{runtimeDoctorCommands-HSU632DY.js → runtimeDoctorCommands-E2OUORHK.js} +3 -3
- package/{tableCommands-QSZILI7I.js → tableCommands-PRJNWN6Q.js} +6 -6
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
migrateAgentSecrets,
|
|
5
|
-
normalizeAgentRuntimeToolPolicy
|
|
6
|
-
} from "./chunk-5CS33IBL.js";
|
|
2
|
+
getCredentialsDir
|
|
3
|
+
} from "./chunk-JZPBVBIY.js";
|
|
7
4
|
import {
|
|
8
5
|
asRecordOrEmpty
|
|
9
6
|
} from "./chunk-KX6YBIHG.js";
|
|
@@ -11,19 +8,28 @@ import {
|
|
|
11
8
|
patch,
|
|
12
9
|
remove,
|
|
13
10
|
write
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import {
|
|
16
|
-
createAgentKey,
|
|
17
|
-
toTrimmedString
|
|
18
|
-
} from "./chunk-NRY4GCKJ.js";
|
|
11
|
+
} from "./chunk-A4JDTA5T.js";
|
|
19
12
|
import {
|
|
20
13
|
asyncThunkCreator,
|
|
21
14
|
buildCreateSlice,
|
|
22
15
|
getRuntimeServerContext
|
|
23
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZFTCLBEX.js";
|
|
17
|
+
import {
|
|
18
|
+
createAgentKey,
|
|
19
|
+
toTrimmedString
|
|
20
|
+
} from "./chunk-WHLVPK32.js";
|
|
24
21
|
import {
|
|
25
22
|
asTrimmedString
|
|
26
23
|
} 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";
|
|
27
33
|
import {
|
|
28
34
|
asOptionalTrimmedString
|
|
29
35
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -83,6 +89,283 @@ var sanitizeOptionalModelString = (value) => {
|
|
|
83
89
|
|
|
84
90
|
// packages/ai/agent/agentSlice.ts
|
|
85
91
|
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
|
|
86
369
|
var createAgentCredentialBroker = createFileCredentialBroker;
|
|
87
370
|
function setAgentCredentialBrokerFactoryForTests(factory) {
|
|
88
371
|
createAgentCredentialBroker = factory ?? createFileCredentialBroker;
|
|
@@ -300,7 +583,7 @@ var slice = createSliceWithThunks({
|
|
|
300
583
|
const overrides = {};
|
|
301
584
|
if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
|
|
302
585
|
if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
|
|
303
|
-
const { _executeModel } = await import("./_executeModel-
|
|
586
|
+
const { _executeModel } = await import("./_executeModel-VBHHG7LT.js");
|
|
304
587
|
return _executeModel(
|
|
305
588
|
{
|
|
306
589
|
isStreaming: args.isStreaming ?? false,
|
|
@@ -321,7 +604,7 @@ var slice = createSliceWithThunks({
|
|
|
321
604
|
* - 循环直到无工具调用或触发其他运行时停止条件
|
|
322
605
|
*/
|
|
323
606
|
runAgent: create.asyncThunk(async (args, thunkApi) => {
|
|
324
|
-
const { runAgentClientLoop } = await import("./runAgentClientLoop-
|
|
607
|
+
const { runAgentClientLoop } = await import("./runAgentClientLoop-N3YDLTMS.js");
|
|
325
608
|
const { content: loopContent, toolCallCount } = await runAgentClientLoop(
|
|
326
609
|
{
|
|
327
610
|
agentKey: args.agentKey,
|
|
@@ -337,7 +620,7 @@ var slice = createSliceWithThunks({
|
|
|
337
620
|
* 聊天轮次流式 Agent 调用
|
|
338
621
|
*/
|
|
339
622
|
streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
|
|
340
|
-
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-
|
|
623
|
+
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-Q4U2CVMI.js");
|
|
341
624
|
return streamAgentChatTurnHandler(args, thunkApi);
|
|
342
625
|
}),
|
|
343
626
|
/**
|
|
@@ -563,6 +846,11 @@ var agentSlice_default = agentReducer;
|
|
|
563
846
|
export {
|
|
564
847
|
fetchServerSyncedCredential,
|
|
565
848
|
deleteServerSyncedCredential,
|
|
849
|
+
createFileCredentialBroker,
|
|
850
|
+
resolveRequestedRuntimeToolNames,
|
|
851
|
+
resolveCurrentRunRuntimeToolPolicy,
|
|
852
|
+
resolveLocalRuntimeEnvFromPolicy,
|
|
853
|
+
resolveLocalWorkspaceExecutorOptionsFromPolicy,
|
|
566
854
|
setAgentCredentialBrokerFactoryForTests,
|
|
567
855
|
slice,
|
|
568
856
|
runLlm,
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HLG6GAUD.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-56IUA7RU.js";
|
|
8
8
|
import {
|
|
9
9
|
toSafeAgentSummary
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UTQZ73QQ.js";
|
|
11
|
+
import {
|
|
12
|
+
PUBLIC_AGENT_KEY_PREFIX,
|
|
13
|
+
isOwnedAgentKey,
|
|
14
|
+
ownedAgentKey,
|
|
15
|
+
parseOwnedAgentId,
|
|
16
|
+
publicAgentKey
|
|
17
|
+
} from "./chunk-TOW4E763.js";
|
|
11
18
|
|
|
12
19
|
// packages/cli/agentListHelpers.ts
|
|
13
20
|
function parseAgentRecordId(privateKey, explicitId) {
|
|
@@ -17,15 +24,15 @@ function parseAgentRecordId(privateKey, explicitId) {
|
|
|
17
24
|
}
|
|
18
25
|
function buildCompanionKeys(rawId, userId) {
|
|
19
26
|
return {
|
|
20
|
-
privateKey:
|
|
21
|
-
publicKey:
|
|
27
|
+
privateKey: ownedAgentKey(userId, rawId),
|
|
28
|
+
publicKey: publicAgentKey(rawId)
|
|
22
29
|
};
|
|
23
30
|
}
|
|
24
31
|
function normalizeListedAgent(record) {
|
|
25
32
|
const privateKey = typeof record?.dbKey === "string" ? record.dbKey : "";
|
|
26
33
|
const explicitId = typeof record?.id === "string" && record.id ? record.id : void 0;
|
|
27
34
|
const ownerUserId = typeof record?.userId === "string" ? record.userId : "";
|
|
28
|
-
const rawId = explicitId || (ownerUserId
|
|
35
|
+
const rawId = explicitId || (ownerUserId ? parseOwnedAgentId(privateKey, ownerUserId) : null) || parseAgentRecordId(privateKey, explicitId);
|
|
29
36
|
if (!privateKey || !rawId || !ownerUserId) return null;
|
|
30
37
|
const keys = buildCompanionKeys(rawId, ownerUserId);
|
|
31
38
|
const credentialConfigured = agentRecordHasConfiguredCredential(record);
|
|
@@ -83,11 +90,11 @@ async function listLocalCachedAgents(args) {
|
|
|
83
90
|
const publicKeys = /* @__PURE__ */ new Set();
|
|
84
91
|
for await (const [key, value] of args.db.iterator({ gte: "", lte: "\uFFFF" })) {
|
|
85
92
|
if (typeof key !== "string" || !value || typeof value !== "object") continue;
|
|
86
|
-
if (key
|
|
93
|
+
if (isOwnedAgentKey(key, args.userId)) {
|
|
87
94
|
privateRecords.set(key, { ...value, dbKey: key });
|
|
88
95
|
continue;
|
|
89
96
|
}
|
|
90
|
-
if (key.startsWith(
|
|
97
|
+
if (key.startsWith(PUBLIC_AGENT_KEY_PREFIX)) {
|
|
91
98
|
publicKeys.add(key);
|
|
92
99
|
}
|
|
93
100
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCliLocalRuntimeAdapter,
|
|
3
3
|
summarizeEndpoint
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
clipMultilineText
|
|
7
|
-
} from "./chunk-2AX4ZWSG.js";
|
|
4
|
+
} from "./chunk-MMCVBEAD.js";
|
|
8
5
|
import {
|
|
9
6
|
runLocalAgentTurn
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KW47OSRJ.js";
|
|
8
|
+
import {
|
|
9
|
+
clipMultilineText
|
|
10
|
+
} from "./chunk-OYK7PA5U.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveLocalRuntimeEnvFromPolicy
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GAGUBI42.js";
|
|
14
14
|
import {
|
|
15
15
|
toErrorMessage
|
|
16
16
|
} from "./chunk-HNMXYYJR.js";
|
|
@@ -28,8 +28,8 @@ import {
|
|
|
28
28
|
asRecordOrEmpty
|
|
29
29
|
} from "./chunk-KX6YBIHG.js";
|
|
30
30
|
import {
|
|
31
|
-
|
|
32
|
-
} from "./chunk-
|
|
31
|
+
ownedAgentKey
|
|
32
|
+
} from "./chunk-TOW4E763.js";
|
|
33
33
|
import {
|
|
34
34
|
asTrimmedString
|
|
35
35
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -39,6 +39,9 @@ import {
|
|
|
39
39
|
import {
|
|
40
40
|
isRecord
|
|
41
41
|
} from "./chunk-KUG52IAP.js";
|
|
42
|
+
import {
|
|
43
|
+
asTrimmedNonEmptyStringArray
|
|
44
|
+
} from "./chunk-I42VC5KR.js";
|
|
42
45
|
import {
|
|
43
46
|
asOptionalTrimmedString
|
|
44
47
|
} from "./chunk-G3SUCT4W.js";
|
|
@@ -446,10 +449,14 @@ async function defaultRunConnectorLocalRuntimeAgent(args) {
|
|
|
446
449
|
toolNames,
|
|
447
450
|
...policy ? { runtimeToolPolicy: policy } : {}
|
|
448
451
|
};
|
|
452
|
+
const dispatchUserId = String(args.runtimeEnv.NOLO_USER_ID || "local");
|
|
453
|
+
const localUserId = String(
|
|
454
|
+
args.runtimeEnv.NOLO_LOCAL_USER_ID || args.runtimeEnv.NOLO_USER_ID || "local"
|
|
455
|
+
);
|
|
449
456
|
const store = /* @__PURE__ */ new Map([
|
|
450
457
|
[agentKey, agentRecord],
|
|
451
|
-
[
|
|
452
|
-
[
|
|
458
|
+
[ownedAgentKey(dispatchUserId, agentKey), agentRecord],
|
|
459
|
+
[ownedAgentKey(localUserId, agentKey), agentRecord]
|
|
453
460
|
]);
|
|
454
461
|
const env = localRuntimeEnvFromPolicy(
|
|
455
462
|
withForwardedUserAuthToken(args.runtimeEnv, args.parsed),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
selectCurrentServer
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-446VANPP.js";
|
|
4
4
|
import {
|
|
5
5
|
patch
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-A4JDTA5T.js";
|
|
7
7
|
import {
|
|
8
8
|
selectIdentityToken
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZFTCLBEX.js";
|
|
10
10
|
import {
|
|
11
11
|
getIsDesktopApp
|
|
12
12
|
} from "./chunk-R5V5G73M.js";
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
asTrimmedLowercaseString
|
|
3
3
|
} from "./chunk-QSJ3HFEF.js";
|
|
4
|
+
import {
|
|
5
|
+
ownedAgentKey,
|
|
6
|
+
publicAgentKey
|
|
7
|
+
} from "./chunk-TOW4E763.js";
|
|
4
8
|
|
|
5
9
|
// packages/cli/agentAliases.ts
|
|
6
10
|
var CURRENT_OPERATOR_USER_ID = "0e95801d90";
|
|
7
11
|
var NOLO_DEFAULT_AGENT_ID = "01NOLOAPPBLD000000019KCKT0";
|
|
8
|
-
var NOLO_DEFAULT_AGENT_KEY =
|
|
12
|
+
var NOLO_DEFAULT_AGENT_KEY = publicAgentKey(NOLO_DEFAULT_AGENT_ID);
|
|
9
13
|
var NOLO_PROJECT_MANAGER_AGENT_ID = "01NOLOPROJMGR00000000MSVGG";
|
|
10
|
-
var NOLO_PROJECT_MANAGER_AGENT_KEY =
|
|
14
|
+
var NOLO_PROJECT_MANAGER_AGENT_KEY = ownedAgentKey(CURRENT_OPERATOR_USER_ID, NOLO_PROJECT_MANAGER_AGENT_ID);
|
|
11
15
|
var NOLO_FRONTEND_AGENT_ID = "01FRONTENDAG0000000115N4E1";
|
|
12
|
-
var NOLO_FRONTEND_AGENT_KEY =
|
|
16
|
+
var NOLO_FRONTEND_AGENT_KEY = ownedAgentKey(CURRENT_OPERATOR_USER_ID, NOLO_FRONTEND_AGENT_ID);
|
|
13
17
|
var LOCAL_CODEX_AGENT_ID = "01LOCALCODEXCLI000000NEW";
|
|
14
|
-
var LOCAL_CODEX_AGENT_KEY =
|
|
18
|
+
var LOCAL_CODEX_AGENT_KEY = ownedAgentKey(CURRENT_OPERATOR_USER_ID, LOCAL_CODEX_AGENT_ID);
|
|
15
19
|
var AGENT_ALIAS_TO_KEY = {
|
|
16
20
|
nolo: NOLO_DEFAULT_AGENT_KEY,
|
|
17
21
|
default: NOLO_DEFAULT_AGENT_KEY,
|