nolo-cli 0.33.0-alpha.3 → 0.33.0-alpha.30
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-RWPVI3YV.js → _executeModel-G2YBBSYF.js} +53 -53
- package/{action-SMLG6OTB.js → action-4KWNL4XI.js} +10 -10
- package/{addContentAction-SFO244QN.js → addContentAction-SUL5AFLY.js} +8 -8
- package/{addDialogAgentAction-W44ZCEHB.js → addDialogAgentAction-T645TULN.js} +7 -7
- package/{agentDeleteCommand-KU2RXQPP.js → agentDeleteCommand-DZPB57QC.js} +47 -43
- package/{agentEmailCommands-MPCMDENS.js → agentEmailCommands-5UPJMRRT.js} +79 -75
- package/{agentListCommands-EPD4N6FX.js → agentListCommands-FHWEJ56M.js} +47 -42
- package/{agentMachineCommands-AF7C3YRT.js → agentMachineCommands-FNVJTZ3J.js} +44 -40
- package/agentProviderCommands-65ZC2WB4.js +122 -0
- package/{agentPullCommand-YH5GEBK4.js → agentPullCommand-NYHSK6EW.js} +3 -3
- package/{agentRecordCommands-EYE6MZZG.js → agentRecordCommands-JN2L5AMM.js} +70 -66
- package/{agentRunCommand-LL22SGTN.js → agentRunCommand-R57HN7XZ.js} +76 -71
- package/{agentRuntimeLocal-JX34G47Z.js → agentRuntimeLocal-MXIGYCZW.js} +32 -29
- package/{agentSlice-TNMFQQOV.js → agentSlice-L3S542FP.js} +10 -10
- package/{appDeleteCommands-43K5VXQB.js → appDeleteCommands-LF6HKT65.js} +39 -35
- package/{appDeployCommands-FEEJSVDZ.js → appDeployCommands-S5M2FFQS.js} +39 -35
- package/{appDeployStatusCommands-H76CG45R.js → appDeployStatusCommands-AVT2B5LY.js} +39 -35
- package/{appGetCommands-MDZYFTYZ.js → appGetCommands-ACH4E3F4.js} +39 -35
- package/{appListCommands-TUJJXPWG.js → appListCommands-LKI2VES7.js} +39 -35
- package/{authCommand-T7UK4CWS.js → authCommand-AECKBG65.js} +21 -20
- package/{authCommands-EAPFGNHN.js → authCommands-W74NRPA6.js} +6 -6
- package/{chatQueueReduxAdapter-LVQXC4ZY.js → chatQueueReduxAdapter-WJXO2JCG.js} +23 -22
- package/{chunk-HDKRSRYU.js → chunk-326E2B5C.js} +289 -93
- package/{chunk-2UECQ7RE.js → chunk-3AOLVADY.js} +1 -1
- package/{chunk-M2YMQOLC.js → chunk-3CPL3LU2.js} +11 -11
- package/chunk-3Z32AD6X.js +22 -0
- package/{chunk-HUCT7HID.js → chunk-42IF53CR.js} +1 -1
- package/{chunk-5SBK2MTI.js → chunk-64M2WCLT.js} +23 -70
- package/{chunk-LOD75GOS.js → chunk-674FTH5U.js} +3751 -1557
- package/{chunk-AOXVOC6D.js → chunk-6O5DMZOS.js} +3 -3
- package/{chunk-GMXWYXAF.js → chunk-7AXGPKX5.js} +3 -3
- package/{chunk-FMEVI5TG.js → chunk-7CH6U3FL.js} +1 -1
- package/{chunk-OR2HNLVO.js → chunk-7EPNNOL4.js} +6 -6
- package/{chunk-DFUPZE6V.js → chunk-7SLMYTSF.js} +1 -1
- package/{chunk-BQXOGBFN.js → chunk-A2YCVTV6.js} +1 -1
- package/{chunk-UK5JGQVU.js → chunk-A3UZKNUI.js} +13 -18
- package/{chunk-3GZXL6FM.js → chunk-AOWETAXX.js} +1 -1
- package/{chunk-B2BSG6QQ.js → chunk-ASWSPCJH.js} +18 -18
- package/{chunk-CLP2K7U4.js → chunk-BP3FSWKY.js} +6 -6
- package/{chunk-IHEC7VBF.js → chunk-BW7JSRVT.js} +1 -1
- package/{chunk-AAGCMVFT.js → chunk-BYXLXABD.js} +495 -148
- package/{chunk-MPZJVZDC.js → chunk-CDSTQJIJ.js} +27 -27
- package/{chunk-2H3XIBY4.js → chunk-D2CTCWWG.js} +4 -82
- package/{chunk-OIQPORYI.js → chunk-ECHNSF4H.js} +178 -2
- package/{chunk-TFPUAELY.js → chunk-EIWIUEOH.js} +2 -2
- package/{chunk-JTSGWTYZ.js → chunk-EMKX4VZW.js} +2 -2
- package/{chunk-6HYVJV7B.js → chunk-ESHYE7WU.js} +2 -1
- package/{chunk-ZURFOV5J.js → chunk-FS5VNMPF.js} +3 -3
- package/{chunk-U4TRT5V4.js → chunk-GEPHJJW4.js} +1 -1
- package/{chunk-5CS33IBL.js → chunk-GKAQBXBO.js} +11 -12
- package/{chunk-M4NC7NF6.js → chunk-GMSUMWFO.js} +2 -2
- package/{chunk-JMPYDFHY.js → chunk-HLXJXFXN.js} +21 -8
- package/{chunk-I6N2UVVY.js → chunk-JZUS5GOM.js} +1 -1
- package/{chunk-RAZOLMJR.js → chunk-KVRWX6K7.js} +2 -2
- package/{chunk-VH2F7ZB6.js → chunk-L4O5JAIW.js} +1 -1
- package/{chunk-57QJXIB6.js → chunk-L7EJWFAP.js} +9 -9
- package/{chunk-DPMBNHOJ.js → chunk-LAZTMWIU.js} +1 -1
- package/{chunk-ADLYMQB6.js → chunk-MBUNBGBE.js} +127 -0
- package/{chunk-Q5ITEGIN.js → chunk-N4XRDM26.js} +1 -1
- package/{chunk-7E72JMBB.js → chunk-N543Q3VR.js} +57 -16
- package/{chunk-WHD6BG7M.js → chunk-NEG2ROC2.js} +45 -41
- package/{chunk-2IVEXF7P.js → chunk-NMB23CNE.js} +2 -9
- package/{chunk-XCCGU6QB.js → chunk-NQWDSCDT.js} +1 -1
- package/{chunk-FSSX3XRY.js → chunk-NTOLFNU3.js} +1 -1
- package/chunk-OH4Q4VVA.js +38 -0
- package/{chunk-37V5LNEQ.js → chunk-OOG3PQCH.js} +1 -1
- package/{chunk-3WXRAHCG.js → chunk-OPSKBBSX.js} +3 -3
- package/{chunk-AFV4FOT2.js → chunk-OQVRTSZ5.js} +4 -91
- package/{chunk-GTYM4HKV.js → chunk-OXLUSM42.js} +5 -5
- package/{chunk-YDTYDA5W.js → chunk-PAW3XFD3.js} +8 -6
- package/{chunk-PREQU5QV.js → chunk-PECRHVNK.js} +1 -1
- package/{chunk-O6GEBMIY.js → chunk-PVJS353C.js} +8861 -8608
- package/{chunk-JZPBVBIY.js → chunk-QTZD6HBK.js} +18 -8
- package/chunk-TVXJEOU2.js +78 -0
- package/{chunk-3VAQHAXT.js → chunk-UFMFWBSG.js} +26 -26
- package/{chunk-73GINUCW.js → chunk-UGWIRZO6.js} +129 -50
- package/{chunk-NUO3QFWD.js → chunk-UNHKVD2N.js} +1 -1
- package/{chunk-GE6IWA5N.js → chunk-UNZDCI3O.js} +126 -1
- package/chunk-UOLENXLQ.js +1132 -0
- package/{chunk-FXFGNOT2.js → chunk-VFVCYIRQ.js} +1 -1
- package/chunk-VIRTYWWE.js +97 -0
- package/{chunk-6SXC35F4.js → chunk-VMAK5YKS.js} +12 -12
- package/{chunk-ZJMME4DS.js → chunk-W6NT2FW3.js} +6 -6
- package/{chunk-2QTEYCR7.js → chunk-X65PIFJI.js} +17 -7
- package/{chunk-JZ5AMMXU.js → chunk-XBNLE3MR.js} +3 -3
- package/{chunk-WLH5BAKX.js → chunk-YYTTDOWA.js} +2 -2
- package/{chunk-X2DAEZ3X.js → chunk-ZFGAPMSF.js} +1 -1
- package/{chunk-IL545V3E.js → chunk-ZJVSRWOP.js} +7 -7
- package/{cliExecutor-DW3PHGEL.js → cliExecutor-BBUVQU4L.js} +2 -2
- package/{codingSkills-DY5MINPG.js → codingSkills-5VOV3JVB.js} +3 -3
- package/{createAgentAutomationAction-INQT23LX.js → createAgentAutomationAction-RMKFWLA3.js} +24 -23
- package/{createDialogAction-LDCPDI73.js → createDialogAction-BLNYPWJ6.js} +27 -26
- package/{createPageAction-5YXOG2M4.js → createPageAction-MSJTHWS7.js} +28 -27
- package/{dbSlice-3SD5L5H2.js → dbSlice-YBUD2NZB.js} +7 -7
- package/{deleteFile-XQXPBFFB.js → deleteFile-74VF4EAJ.js} +4 -4
- package/{dialogCommands-CHJO47AX.js → dialogCommands-JI6X34PB.js} +38 -34
- package/{dialogSlice-DOWKOILN.js → dialogSlice-MJAX2T2X.js} +23 -22
- package/{docCreateCommands-OVZARUFX.js → docCreateCommands-KNLITDCK.js} +40 -36
- package/{docDeleteCommands-E2XJ62LD.js → docDeleteCommands-6SBOU75S.js} +41 -37
- package/{docReadCommands-I7OSREPJ.js → docReadCommands-NX77P5X4.js} +40 -36
- package/{docStore-UAWSKZ2Y.js → docStore-472FHNNN.js} +25 -24
- package/{docUpdateCommands-X4Z26VJM.js → docUpdateCommands-IHWNHH4O.js} +43 -39
- package/emscripten-module-EDQBMDVK.js +576 -0
- package/emscripten-module-LCBQ7VWY.js +1506 -0
- package/emscripten-module-OFHQ7EL3.js +482 -0
- package/emscripten-module-XM7NDJQA.js +4536 -0
- package/fetchMessages-7QRCCRYK.js +1 -1
- package/ffi-6ZSX3QJ4.js +80 -0
- package/ffi-742Y76PE.js +92 -0
- package/ffi-AEYWSYLM.js +80 -0
- package/ffi-KQC27OUM.js +92 -0
- package/{getPricing-L2ENXWHV.js → getPricing-J4VXWR5B.js} +4 -4
- package/{handleSendMessageAction-C3TSDWKH.js → handleSendMessageAction-V3SKWOOV.js} +26 -25
- package/index.js +78 -74
- package/{localRuntimeAuthority-E3R24J4T.js → localRuntimeAuthority-S77B5QVB.js} +6 -2
- package/{localRuntimeDb-DDZCJFQZ.js → localRuntimeDb-N3H3HQ7G.js} +1 -1
- package/{machineCommands-BUOIYJAD.js → machineCommands-ZDULQKUU.js} +80 -76
- package/{machineInfo-M6KB6HZN.js → machineInfo-66ZFUMLE.js} +1 -1
- package/{machineWsRunDispatch-7CRWAA6O.js → machineWsRunDispatch-XX2LNRJT.js} +68 -64
- package/{models-OX2S5C6Q.js → models-FM7YJ47W.js} +2 -2
- package/module-ES6BEMUI-AFCVSBMS.js +14 -0
- package/module-asyncify-2EFITU5U-DEP2F2QP.js +9 -0
- package/package.json +1 -1
- package/{read-6G73BMEY.js → read-7SIURKBF.js} +5 -5
- package/{readDocTool-DK4EI2GA.js → readDocTool-NWQFQ4IG.js} +1 -1
- package/{readlineWorkspace-ZDWEASJV.js → readlineWorkspace-NXB4IBLM.js} +3886 -3344
- package/{removeDialogAgentAction-E7H557UO.js → removeDialogAgentAction-S3LYHK4M.js} +11 -11
- package/{runAgentClientLoop-U7HYA3O5.js → runAgentClientLoop-TNETRJFJ.js} +50 -49
- package/{runtimeDoctorCommands-KIKM6BIO.js → runtimeDoctorCommands-HT4O2PXL.js} +6 -6
- package/{setDialogExtraReferencesAction-RMMGBR5F.js → setDialogExtraReferencesAction-L5ET3HEX.js} +8 -8
- package/{setPrimaryDialogAgentAction-FWBKKLVA.js → setPrimaryDialogAgentAction-ZZJOZQEM.js} +11 -11
- package/{settingSlice-73PV4KG4.js → settingSlice-ZFOZPBI2.js} +9 -9
- package/{skillDiscovery-KLLKXPUO.js → skillDiscovery-6YSTRCQ7.js} +3 -3
- package/{spaceCommands-GEWZXGHM.js → spaceCommands-CAWUGXJS.js} +44 -40
- package/{spaceSlice-B6MOVY4N.js → spaceSlice-J5D3LTMO.js} +24 -23
- package/{streamAgentChatTurn-T527EQTT.js → streamAgentChatTurn-YI5O3T4X.js} +104 -114
- package/{switchDialogAgentAction-US6QNL3N.js → switchDialogAgentAction-ZWCYLWVK.js} +7 -7
- package/{tableCommands-QE47K72R.js → tableCommands-5OKD2DKN.js} +8 -8
- package/{tools-XMWCVMPM.js → tools-HI4U6J6S.js} +39 -38
- package/{tuiSummaryLlmCaller-NCAJSVSD.js → tuiSummaryLlmCaller-3RC6WWRV.js} +15 -14
- package/{updateCommands-AK2RDOFR.js → updateCommands-MNDUIKN7.js} +2 -2
- package/{updateDialogTitleAction-XPJZRJEL.js → updateDialogTitleAction-V5H4LWFR.js} +30 -29
- package/chunk-6PO2SYCS.js +0 -1800
- package/{agentGrantCommands-2LEZDADN.js → agentGrantCommands-OPIGFRDO.js} +2 -2
- package/{chunk-ZHYK3N56.js → chunk-G7HTVVFL.js} +3 -3
- package/{chunk-SAQQLJZ5.js → chunk-JDSUTNYY.js} +3 -3
- package/{chunk-X664KVEV.js → chunk-QM6EN2ES.js} +3 -3
- package/{offlineMarxistsAgentCommand-GEH6SNNA.js → offlineMarxistsAgentCommand-HDIQVGKN.js} +3 -3
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
// packages/cli/client/profileConfig.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
appendFileSync,
|
|
4
|
+
chmodSync,
|
|
5
|
+
existsSync,
|
|
6
|
+
mkdirSync,
|
|
7
|
+
readFileSync,
|
|
8
|
+
statSync,
|
|
9
|
+
writeFileSync
|
|
10
|
+
} from "node:fs";
|
|
3
11
|
import { dirname, join } from "node:path";
|
|
4
12
|
import { homedir } from "node:os";
|
|
5
13
|
|
|
@@ -27,6 +35,10 @@ function canonicalizeNoloServerUrl(value) {
|
|
|
27
35
|
|
|
28
36
|
// packages/cli/client/profileConfig.ts
|
|
29
37
|
var normalizeProfileServerUrl = canonicalizeNoloServerUrl;
|
|
38
|
+
function isProtectedHomeProfileWrite(path) {
|
|
39
|
+
if (process.env.NODE_ENV !== "test") return false;
|
|
40
|
+
return path === join(homedir(), ".nolo", "config.json");
|
|
41
|
+
}
|
|
30
42
|
function getDefaultProfileConfigPath() {
|
|
31
43
|
const noloHome = process.env.NOLO_HOME?.trim();
|
|
32
44
|
return noloHome ? join(noloHome, "config.json") : join(homedir(), ".nolo", "config.json");
|
|
@@ -43,6 +55,7 @@ function loadProfileConfig(path = getDefaultProfileConfigPath()) {
|
|
|
43
55
|
return parsed;
|
|
44
56
|
}
|
|
45
57
|
function clearProfileAuthToken(path = getDefaultProfileConfigPath()) {
|
|
58
|
+
if (isProtectedHomeProfileWrite(path)) return false;
|
|
46
59
|
const config = loadProfileConfig(path);
|
|
47
60
|
if (!config) return false;
|
|
48
61
|
const profile = config.profiles[config.currentProfile];
|
|
@@ -54,6 +67,11 @@ function clearProfileAuthToken(path = getDefaultProfileConfigPath()) {
|
|
|
54
67
|
return true;
|
|
55
68
|
}
|
|
56
69
|
function saveDefaultProfile(path, profile) {
|
|
70
|
+
if (isProtectedHomeProfileWrite(path)) {
|
|
71
|
+
throw new Error(
|
|
72
|
+
`Refusing to write the developer's real profile from a test process: ${path}. Pass a temp path or set NOLO_HOME.`
|
|
73
|
+
);
|
|
74
|
+
}
|
|
57
75
|
const existing = loadProfileConfig(path);
|
|
58
76
|
const mergedDefault = {
|
|
59
77
|
...existing?.profiles?.default ?? {},
|
|
@@ -89,9 +107,11 @@ function buildCliRuntimeEnv(processEnv, config) {
|
|
|
89
107
|
const profileEnv = buildEnvFromProfile(config);
|
|
90
108
|
const explicitAuthToken = processEnv.AUTH_TOKEN || processEnv.AUTH;
|
|
91
109
|
const explicitServerUrl = processEnv.NOLO_SERVER || processEnv.NOLO_SERVER_URL || processEnv.BASE_URL;
|
|
110
|
+
const agentSource = processEnv.NOLO_AGENT?.trim() ? "env" : profileEnv.NOLO_AGENT ? "profile" : void 0;
|
|
92
111
|
return {
|
|
93
112
|
...profileEnv,
|
|
94
113
|
...processEnv,
|
|
114
|
+
NOLO_AGENT_SOURCE: agentSource,
|
|
95
115
|
...explicitAuthToken ? { AUTH_TOKEN: explicitAuthToken } : {},
|
|
96
116
|
...explicitServerUrl ? {
|
|
97
117
|
NOLO_SERVER: explicitServerUrl,
|
|
@@ -104,6 +124,7 @@ function getCurrentProfile(config) {
|
|
|
104
124
|
return config.profiles[config.currentProfile] ?? null;
|
|
105
125
|
}
|
|
106
126
|
function saveProfileLocale(locale, path = getDefaultProfileConfigPath()) {
|
|
127
|
+
if (isProtectedHomeProfileWrite(path)) return null;
|
|
107
128
|
const config = loadProfileConfig(path);
|
|
108
129
|
if (!config) return null;
|
|
109
130
|
const profile = config.profiles[config.currentProfile];
|
|
@@ -114,13 +135,115 @@ function saveProfileLocale(locale, path = getDefaultProfileConfigPath()) {
|
|
|
114
135
|
`, "utf8");
|
|
115
136
|
return config;
|
|
116
137
|
}
|
|
138
|
+
function getAgentSelectionAuditPath(configPath = getDefaultProfileConfigPath()) {
|
|
139
|
+
return join(dirname(configPath), "agent-selection.log");
|
|
140
|
+
}
|
|
141
|
+
var AGENT_SELECTION_AUDIT_MAX_BYTES = 512 * 1024;
|
|
142
|
+
var AGENT_SELECTION_AUDIT_KEEP_LINES = 200;
|
|
143
|
+
var SECRET_ARGV_FLAGS = /* @__PURE__ */ new Set([
|
|
144
|
+
"--token",
|
|
145
|
+
"--auth",
|
|
146
|
+
"--auth-token",
|
|
147
|
+
"--key",
|
|
148
|
+
"--api-key",
|
|
149
|
+
"--app-key",
|
|
150
|
+
"--machine-key",
|
|
151
|
+
"--provider-api-key",
|
|
152
|
+
"--invite-token",
|
|
153
|
+
"--password",
|
|
154
|
+
"--secret"
|
|
155
|
+
]);
|
|
156
|
+
function redactArgvSecrets(argv) {
|
|
157
|
+
const redacted = [];
|
|
158
|
+
let maskNext = false;
|
|
159
|
+
for (const arg of argv) {
|
|
160
|
+
if (maskNext) {
|
|
161
|
+
maskNext = false;
|
|
162
|
+
redacted.push("[REDACTED]");
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const equals = arg.indexOf("=");
|
|
166
|
+
if (equals > 0 && SECRET_ARGV_FLAGS.has(arg.slice(0, equals))) {
|
|
167
|
+
redacted.push(`${arg.slice(0, equals)}=[REDACTED]`);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
maskNext = SECRET_ARGV_FLAGS.has(arg);
|
|
171
|
+
redacted.push(arg);
|
|
172
|
+
}
|
|
173
|
+
return redacted;
|
|
174
|
+
}
|
|
175
|
+
function appendAgentSelectionAudit(entry, auditPath = getAgentSelectionAuditPath(entry.configPath)) {
|
|
176
|
+
try {
|
|
177
|
+
const stack = (new Error().stack ?? "").split("\n").slice(2, 8).map((line2) => line2.trim()).filter(Boolean);
|
|
178
|
+
const line = `${JSON.stringify({
|
|
179
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
180
|
+
pid: process.pid,
|
|
181
|
+
// Distinguishes repo source / installed binary / bundled desktop build —
|
|
182
|
+
// the field that says whether a stale build is doing the writing.
|
|
183
|
+
execPath: process.execPath,
|
|
184
|
+
argv: redactArgvSecrets(process.argv),
|
|
185
|
+
cwd: process.cwd(),
|
|
186
|
+
previous: entry.previous,
|
|
187
|
+
next: entry.next,
|
|
188
|
+
stack
|
|
189
|
+
})}
|
|
190
|
+
`;
|
|
191
|
+
mkdirSync(dirname(auditPath), { recursive: true });
|
|
192
|
+
const auditMode = 384;
|
|
193
|
+
if (existsSync(auditPath) && statSync(auditPath).size > AGENT_SELECTION_AUDIT_MAX_BYTES) {
|
|
194
|
+
const kept = readFileSync(auditPath, "utf8").split("\n").filter((entry2) => entry2.trim()).slice(-AGENT_SELECTION_AUDIT_KEEP_LINES).join("\n");
|
|
195
|
+
writeFileSync(auditPath, `${kept}
|
|
196
|
+
`, {
|
|
197
|
+
encoding: "utf8",
|
|
198
|
+
mode: auditMode
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
appendFileSync(auditPath, line, { encoding: "utf8", mode: auditMode });
|
|
202
|
+
try {
|
|
203
|
+
chmodSync(auditPath, auditMode);
|
|
204
|
+
} catch {
|
|
205
|
+
}
|
|
206
|
+
} catch {
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function readLastAgentSelectionAudit(auditPath = getAgentSelectionAuditPath()) {
|
|
210
|
+
try {
|
|
211
|
+
if (!existsSync(auditPath)) return { logExists: false, last: null };
|
|
212
|
+
const lines = readFileSync(auditPath, "utf8").trim().split("\n");
|
|
213
|
+
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
214
|
+
const raw = lines[index]?.trim();
|
|
215
|
+
if (!raw) continue;
|
|
216
|
+
const parsed = JSON.parse(raw);
|
|
217
|
+
if (!parsed.next) continue;
|
|
218
|
+
return {
|
|
219
|
+
logExists: true,
|
|
220
|
+
last: {
|
|
221
|
+
agentKey: parsed.next.agentKey ?? "",
|
|
222
|
+
agentName: parsed.next.agentName ?? ""
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
return { logExists: true, last: null };
|
|
227
|
+
} catch {
|
|
228
|
+
return { logExists: false, last: null };
|
|
229
|
+
}
|
|
230
|
+
}
|
|
117
231
|
function saveProfileAgentSelection(selection, path = getDefaultProfileConfigPath()) {
|
|
232
|
+
if (isProtectedHomeProfileWrite(path)) return null;
|
|
118
233
|
const config = loadProfileConfig(path);
|
|
119
234
|
if (!config) return null;
|
|
120
235
|
const profile = config.profiles[config.currentProfile];
|
|
121
236
|
if (!profile) return null;
|
|
122
237
|
const agentKey = selection.agentKey.trim();
|
|
123
238
|
const agentName = selection.agentName.trim();
|
|
239
|
+
appendAgentSelectionAudit({
|
|
240
|
+
previous: {
|
|
241
|
+
...profile.agentKey ? { agentKey: profile.agentKey } : {},
|
|
242
|
+
...profile.agentName ? { agentName: profile.agentName } : {}
|
|
243
|
+
},
|
|
244
|
+
next: { agentKey, agentName },
|
|
245
|
+
configPath: path
|
|
246
|
+
});
|
|
124
247
|
if (!agentKey) {
|
|
125
248
|
delete profile.agentKey;
|
|
126
249
|
delete profile.agentName;
|
|
@@ -143,5 +266,7 @@ export {
|
|
|
143
266
|
buildCliRuntimeEnv,
|
|
144
267
|
getCurrentProfile,
|
|
145
268
|
saveProfileLocale,
|
|
269
|
+
getAgentSelectionAuditPath,
|
|
270
|
+
readLastAgentSelectionAudit,
|
|
146
271
|
saveProfileAgentSelection
|
|
147
272
|
};
|