nolo-cli 0.163.0-alpha.1 → 0.164.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-3FMHTHSS.js → _executeModel-LFPW52TC.js} +12 -12
- package/{agentDeleteCommand-VRHLJZKX.js → agentDeleteCommand-E5RWD5AM.js} +10 -10
- package/{agentEmailCommands-YGBQXOL3.js → agentEmailCommands-VTUCQASB.js} +12 -12
- package/{agentMachineCommands-FBAWZYHI.js → agentMachineCommands-CJ53NRUB.js} +1 -1
- package/{agentRecordCommands-KAK2G56H.js → agentRecordCommands-OL73UQE5.js} +11 -11
- package/{agentRunCommand-62P3AGJA.js → agentRunCommand-O6RR6VM2.js} +12 -12
- package/{agentRunControl-XBSNHHZE.js → agentRunControl-NQR3GB6H.js} +1 -1
- package/{agentSlice-IZFU3WWH.js → agentSlice-YDRAYF3Z.js} +1 -1
- package/{chunk-2QQ7D3P5.js → chunk-3WTD7IIQ.js} +8 -8
- package/{chunk-7YQQXP42.js → chunk-4BLKVQBS.js} +2 -2
- package/{chunk-EDJND3FK.js → chunk-AOVELMYY.js} +3 -3
- package/{chunk-Q5LVXPGT.js → chunk-CAWIORRR.js} +2 -2
- package/{chunk-K3N2DWLT.js → chunk-FKBWA3NN.js} +2 -2
- package/{chunk-6QIBWOPT.js → chunk-HXFIFEBA.js} +2 -2
- package/{chunk-CI6YDDL2.js → chunk-IG3DNKWC.js} +2 -2
- package/{chunk-V67W64OY.js → chunk-JGFVMK3S.js} +7 -7
- package/{chunk-PNACBSRF.js → chunk-KTFQFGMZ.js} +194 -31
- package/{chunk-FTHF2P2I.js → chunk-KVDB4IIT.js} +1 -1
- package/{chunk-UUPXTEZA.js → chunk-NOFLIR3Z.js} +1 -1
- package/{chunk-HRZW3SQN.js → chunk-Q2RZKBUU.js} +1 -1
- package/{chunk-7PDNSQZC.js → chunk-QKBEFLMA.js} +2 -2
- package/{chunk-U5U4WAFS.js → chunk-S53PIA3G.js} +36 -3
- package/{chunk-36IWXF25.js → chunk-VNPUBOKQ.js} +5 -5
- package/{chunk-JIAZK434.js → chunk-VVRYD7UL.js} +2 -2
- package/{chunk-4FDDVVCE.js → chunk-WBRBIRDG.js} +2 -2
- package/{chunk-GXZZOTDM.js → chunk-WBTXES5L.js} +4547 -3343
- package/{chunk-SNAWGDXT.js → chunk-WJJL7RMW.js} +518 -67
- package/{chunk-QFL42TMV.js → chunk-ZEOGFBR3.js} +90 -15
- package/{commandRegistry-2DDDET7G.js → commandRegistry-CZLHZ3XM.js} +26 -26
- package/{contentThunks-5DNEHJ2Z.js → contentThunks-FXRH3TBV.js} +3 -3
- package/{createAgentAutomationAction-4SUS2EFX.js → createAgentAutomationAction-6M64V55C.js} +3 -3
- package/{createDialogAction-JSFXX6JE.js → createDialogAction-LTK2YJ7I.js} +4 -4
- package/{createPageAction-37HHOXZ2.js → createPageAction-IKFGJRKB.js} +3 -3
- package/{dialogCommands-ZJRMCP4S.js → dialogCommands-7FZEZ5DV.js} +2 -2
- package/{dialogSlice-2Z66AWEW.js → dialogSlice-TTJ74TZ2.js} +2 -2
- package/{docStore-XMTUF3GX.js → docStore-GZW6PV6J.js} +1 -1
- package/{handleSendMessageAction-4VFVXTF2.js → handleSendMessageAction-YICSRGEU.js} +7 -7
- package/index.js +3 -3
- package/{localRuntimeAdapter-KKIVRYVN.js → localRuntimeAdapter-3ZJ3BHOU.js} +10 -10
- package/{machineCommands-UHQVCOD3.js → machineCommands-4RVMGZDN.js} +11 -11
- package/{machineWsRunDispatch-TX4X7TOJ.js → machineWsRunDispatch-CPKXENCS.js} +11 -11
- package/package.json +1 -1
- package/{readlineWorkspace-BFVB2ON5.js → readlineWorkspace-DPO4JJQ2.js} +13 -13
- package/{runAgentClientLoop-HHLHNMBE.js → runAgentClientLoop-DROGF2SZ.js} +10 -10
- package/{streamAgentChatTurn-KNPOLET7.js → streamAgentChatTurn-PJ2L3P25.js} +12 -12
- package/{tools-ULA7XJQT.js → tools-2MFN4Z5Y.js} +7 -7
- package/{updateDialogTitleAction-VUIVBDAS.js → updateDialogTitleAction-VQFUSGRH.js} +3 -3
|
@@ -9,16 +9,19 @@ import {
|
|
|
9
9
|
resolveRawAgentInput,
|
|
10
10
|
resolveServerUrl,
|
|
11
11
|
writeUsage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-S53PIA3G.js";
|
|
13
13
|
import {
|
|
14
14
|
getReadableCliDb
|
|
15
15
|
} from "./chunk-62TBKWTV.js";
|
|
16
16
|
import {
|
|
17
|
+
INSTABOX_RUN_CONFIG_ENV,
|
|
17
18
|
createCliLocalRuntimeAdapter,
|
|
18
19
|
detectCurrentMachineId,
|
|
20
|
+
hashInstaboxDeliveryManifest,
|
|
19
21
|
isBuiltinNoloAgentRef,
|
|
20
22
|
isCliProviderAgentConfig,
|
|
21
23
|
isDockerRuntimeKey,
|
|
24
|
+
isInstaboxBillingPolicy,
|
|
22
25
|
isLiveAgentRunObservation,
|
|
23
26
|
isMachineBoundLocalhostCustomProvider,
|
|
24
27
|
isSubtaskRun,
|
|
@@ -26,8 +29,9 @@ import {
|
|
|
26
29
|
resolveAuthToken as resolveAuthToken2,
|
|
27
30
|
resolveBoundMachineId,
|
|
28
31
|
resolveFileWriteGateEnabled,
|
|
29
|
-
resolveLocalUserId
|
|
30
|
-
|
|
32
|
+
resolveLocalUserId,
|
|
33
|
+
validateInstaboxWorkspaceSelection
|
|
34
|
+
} from "./chunk-WBTXES5L.js";
|
|
31
35
|
import {
|
|
32
36
|
clearCredentialAvailability,
|
|
33
37
|
readCredentialEntry,
|
|
@@ -75,14 +79,14 @@ import {
|
|
|
75
79
|
} from "./chunk-BMQ2MJUK.js";
|
|
76
80
|
import {
|
|
77
81
|
resolveCliLocalRuntimeKeyCapability
|
|
78
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-ZEOGFBR3.js";
|
|
79
83
|
import {
|
|
80
84
|
isTransientFetchError
|
|
81
85
|
} from "./chunk-KFHREHUQ.js";
|
|
82
86
|
import {
|
|
83
87
|
parseUiCard,
|
|
84
88
|
uiCardFallback
|
|
85
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-HXFIFEBA.js";
|
|
86
90
|
import {
|
|
87
91
|
isGatewayHttpStatus
|
|
88
92
|
} from "./chunk-NF64D32W.js";
|
|
@@ -91,7 +95,7 @@ import {
|
|
|
91
95
|
chooseMemoryOwners,
|
|
92
96
|
loadMemoryCandidatesFromDb,
|
|
93
97
|
resolveAgentMemoryPolicy
|
|
94
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-WBRBIRDG.js";
|
|
95
99
|
import {
|
|
96
100
|
API_REPORTED_COST_MULTIPLIER,
|
|
97
101
|
estimateMessagesTokens,
|
|
@@ -99,7 +103,7 @@ import {
|
|
|
99
103
|
resolveAgentContextWindow,
|
|
100
104
|
resolveOccupancy,
|
|
101
105
|
resolveOccupancyWindow
|
|
102
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-3WTD7IIQ.js";
|
|
103
107
|
import {
|
|
104
108
|
buildSkillDiscoveryContextLayer
|
|
105
109
|
} from "./chunk-AU7AXHUL.js";
|
|
@@ -178,10 +182,11 @@ import {
|
|
|
178
182
|
recordRunResultHeaderMeta,
|
|
179
183
|
resolveResultServerMeta,
|
|
180
184
|
resolveRunQueuePath,
|
|
185
|
+
resolveRunsDir,
|
|
181
186
|
serverOriginForDialog,
|
|
182
187
|
settleRunTerminalAuthoritatively,
|
|
183
188
|
spawnLocalBackgroundRun
|
|
184
|
-
} from "./chunk-
|
|
189
|
+
} from "./chunk-WJJL7RMW.js";
|
|
185
190
|
import {
|
|
186
191
|
formatAgentListCard,
|
|
187
192
|
formatFinishedRunCard,
|
|
@@ -238,6 +243,148 @@ import {
|
|
|
238
243
|
asTrimmedLowercaseString
|
|
239
244
|
} from "./chunk-QSJ3HFEF.js";
|
|
240
245
|
|
|
246
|
+
// packages/cli/client/instaboxRunConfigWrite.ts
|
|
247
|
+
import { randomUUID } from "node:crypto";
|
|
248
|
+
import { lstatSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
249
|
+
import { isAbsolute, join, normalize, resolve } from "node:path";
|
|
250
|
+
var InstaboxRunConfigWriteError = class extends Error {
|
|
251
|
+
code;
|
|
252
|
+
constructor(code, message) {
|
|
253
|
+
super(`instabox_run_config_write:${code}: ${message}`);
|
|
254
|
+
this.name = "InstaboxRunConfigWriteError";
|
|
255
|
+
this.code = `instabox_run_config_write:${code}`;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
var fail = (code, msg) => {
|
|
259
|
+
throw new InstaboxRunConfigWriteError(code, msg);
|
|
260
|
+
};
|
|
261
|
+
function writeInstaboxRunConfig(options) {
|
|
262
|
+
const { workspaceMode, artifactDir, manifestPath, allowRemoteRelease } = options;
|
|
263
|
+
if (workspaceMode !== "empty" && workspaceMode !== "snapshot") {
|
|
264
|
+
fail("invalid_workspace_mode", 'workspaceMode \u5FC5\u987B\u662F "empty" \u6216 "snapshot"');
|
|
265
|
+
}
|
|
266
|
+
const trimmedArtifactDir = artifactDir?.trim();
|
|
267
|
+
if (!trimmedArtifactDir) {
|
|
268
|
+
fail("missing_artifact_dir", "artifactDir \u5FC5\u987B\u662F\u975E\u7A7A\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u672A\u914D\u7F6E\u6216\u9ED8\u8BA4\u5747\u88AB\u62D2\u7EDD");
|
|
269
|
+
}
|
|
270
|
+
if (!isAbsolute(trimmedArtifactDir) || trimmedArtifactDir.includes("\0") || trimmedArtifactDir.split("/").includes("..")) {
|
|
271
|
+
fail("invalid_artifact_dir", `artifactDir \u5FC5\u987B\u4E3A\u5408\u6CD5\u7684\u7EDD\u5BF9\u8DEF\u5F84\u4E14\u4E0D\u80FD\u5305\u542B .. \u6216\u7A7A\u5B57\u7B26: "${trimmedArtifactDir}"`);
|
|
272
|
+
}
|
|
273
|
+
const approvalId = `appr-${randomUUID()}`;
|
|
274
|
+
const bindingId = `bind-${randomUUID()}`;
|
|
275
|
+
const freeCreateEvidenceId = `fce-${randomUUID()}`;
|
|
276
|
+
const workspaceAuthorizationId = `wauth-${randomUUID()}`;
|
|
277
|
+
const recoverySupportId = `rcv-${randomUUID()}`;
|
|
278
|
+
let manifest = null;
|
|
279
|
+
let manifestSha256 = null;
|
|
280
|
+
let allowedPaths = [];
|
|
281
|
+
if (workspaceMode === "snapshot") {
|
|
282
|
+
const rawPath = manifestPath ? manifestPath.trim() : "";
|
|
283
|
+
if (!rawPath) {
|
|
284
|
+
fail("missing_manifest_path", 'workspaceMode \u4E3A "snapshot" \u65F6\u5FC5\u987B\u63D0\u4F9B manifest \u6587\u4EF6\u8DEF\u5F84');
|
|
285
|
+
}
|
|
286
|
+
const resolvedManifestPath = resolve(rawPath);
|
|
287
|
+
let rawText = "";
|
|
288
|
+
try {
|
|
289
|
+
const reader = options.readTextFile ?? ((p) => readFileSync(p, "utf8"));
|
|
290
|
+
rawText = reader(resolvedManifestPath);
|
|
291
|
+
} catch (err) {
|
|
292
|
+
fail(
|
|
293
|
+
"manifest_read_failed",
|
|
294
|
+
`\u8BFB\u53D6 manifest \u6587\u4EF6\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
let parsedManifest;
|
|
298
|
+
try {
|
|
299
|
+
parsedManifest = JSON.parse(rawText);
|
|
300
|
+
} catch (err) {
|
|
301
|
+
fail(
|
|
302
|
+
"invalid_manifest_json",
|
|
303
|
+
`manifest \u6587\u4EF6 JSON \u89E3\u6790\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
manifestSha256 = hashInstaboxDeliveryManifest(parsedManifest);
|
|
308
|
+
validateInstaboxWorkspaceSelection({
|
|
309
|
+
workspaceMode: "approved-snapshot",
|
|
310
|
+
manifest: parsedManifest,
|
|
311
|
+
approval: {
|
|
312
|
+
id: approvalId,
|
|
313
|
+
manifestSha256
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
} catch (err) {
|
|
317
|
+
fail(
|
|
318
|
+
"invalid_manifest_selection",
|
|
319
|
+
`manifest \u6821\u9A8C\u672A\u901A\u8FC7: ${err instanceof Error ? err.message : String(err)}`
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
manifest = parsedManifest;
|
|
323
|
+
allowedPaths = parsedManifest.files.map((f) => f.path);
|
|
324
|
+
} else {
|
|
325
|
+
if (manifestPath && manifestPath.trim()) {
|
|
326
|
+
fail("unexpected_manifest", 'workspaceMode \u4E3A "empty" \u65F6\u4E0D\u5F97\u63D0\u4F9B manifest');
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const rawBillingPolicy = options.billingPolicy ?? (options.allowPaid ? "allow-paid" : "free-only");
|
|
330
|
+
if (!isInstaboxBillingPolicy(rawBillingPolicy)) {
|
|
331
|
+
fail("invalid_billing_policy", `billingPolicy \u5FC5\u987B\u4E3A "free-only" \u6216 "allow-paid"\uFF0C\u6536\u5230 "${rawBillingPolicy}"`);
|
|
332
|
+
}
|
|
333
|
+
const billingPolicy = rawBillingPolicy;
|
|
334
|
+
const env = options.env ?? process.env;
|
|
335
|
+
const isPaid = options.isPaidAccount === true || options.account?.isPaid === true || options.account?.kind === "paid" || options.account?.accountKind === "paid" || env?.INSTABOX_ACCOUNT_KIND === "paid" || env?.INSTABOX_ACCOUNT_TYPE === "paid" || env?.INSTABOX_PAID_ACCOUNT === "true" || env?.INSTABOX_PAID_ACCOUNT === "1";
|
|
336
|
+
if (isPaid && billingPolicy !== "allow-paid") {
|
|
337
|
+
fail("paid_account_disallowed", "\u4ED8\u8D39 Instabox \u8D26\u53F7\u9700\u663E\u5F0F --instabox-allow-paid");
|
|
338
|
+
}
|
|
339
|
+
const config = {
|
|
340
|
+
bindingId,
|
|
341
|
+
freeCreateEvidenceId,
|
|
342
|
+
workspaceAuthorizationId,
|
|
343
|
+
recoverySupportId,
|
|
344
|
+
workspaceMode: workspaceMode === "snapshot" ? "approved-snapshot" : "empty",
|
|
345
|
+
billingPolicy,
|
|
346
|
+
approvalId,
|
|
347
|
+
artifactRoot: trimmedArtifactDir,
|
|
348
|
+
allowRemoteRelease: Boolean(allowRemoteRelease),
|
|
349
|
+
allowedPaths
|
|
350
|
+
};
|
|
351
|
+
if (workspaceMode === "snapshot" && manifest && manifestSha256) {
|
|
352
|
+
config.manifest = manifest;
|
|
353
|
+
config.manifestSha256 = manifestSha256;
|
|
354
|
+
}
|
|
355
|
+
const runsDir = options.runsDir ?? resolveRunsDir(env);
|
|
356
|
+
const normalizedRunsDir = normalize(resolve(runsDir));
|
|
357
|
+
try {
|
|
358
|
+
mkdirSync(normalizedRunsDir, { recursive: true, mode: 448 });
|
|
359
|
+
} catch (err) {
|
|
360
|
+
fail("mkdir_failed", `\u521B\u5EFA runs \u76EE\u5F55\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
|
|
361
|
+
}
|
|
362
|
+
const fileName = `instabox-run-${randomUUID()}.json`;
|
|
363
|
+
const targetPath = join(normalizedRunsDir, fileName);
|
|
364
|
+
try {
|
|
365
|
+
writeFileSync(targetPath, JSON.stringify(config, null, 2), {
|
|
366
|
+
flag: "wx",
|
|
367
|
+
mode: 384
|
|
368
|
+
});
|
|
369
|
+
} catch (err) {
|
|
370
|
+
fail("file_write_failed", `\u72EC\u5360\u521B\u5EFA\u53D7\u63A7\u914D\u7F6E\u6587\u4EF6\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
|
|
371
|
+
}
|
|
372
|
+
try {
|
|
373
|
+
const stats = lstatSync(targetPath);
|
|
374
|
+
if (stats.isSymbolicLink() || !stats.isFile()) {
|
|
375
|
+
fail("symlink_rejected", `\u914D\u7F6E\u6587\u4EF6\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\u6216\u975E\u5E38\u89C4\u6587\u4EF6: ${targetPath}`);
|
|
376
|
+
}
|
|
377
|
+
} catch (err) {
|
|
378
|
+
if (err instanceof InstaboxRunConfigWriteError) throw err;
|
|
379
|
+
fail("file_stat_failed", `\u68C0\u9A8C\u914D\u7F6E\u6587\u4EF6\u72B6\u6001\u5931\u8D25: ${err instanceof Error ? err.message : String(err)}`);
|
|
380
|
+
}
|
|
381
|
+
process.env[INSTABOX_RUN_CONFIG_ENV] = targetPath;
|
|
382
|
+
if (options.env) {
|
|
383
|
+
options.env[INSTABOX_RUN_CONFIG_ENV] = targetPath;
|
|
384
|
+
}
|
|
385
|
+
return { configPath: targetPath, config };
|
|
386
|
+
}
|
|
387
|
+
|
|
241
388
|
// packages/agent-runtime/modelLayerOverride.ts
|
|
242
389
|
var MODEL_LAYER_KEYS = [
|
|
243
390
|
"provider",
|
|
@@ -12728,7 +12875,7 @@ import * as nodeFs from "node:fs";
|
|
|
12728
12875
|
var CLI_AUTO_ROUTE_AGENT_KEY = BUILTIN_NOLO_AGENT_KEY;
|
|
12729
12876
|
|
|
12730
12877
|
// packages/agent-runtime/hostEnvironment.ts
|
|
12731
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
12878
|
+
import { existsSync, readFileSync as readFileSync2 } from "node:fs";
|
|
12732
12879
|
import os from "node:os";
|
|
12733
12880
|
function parseLinuxOsRelease(content) {
|
|
12734
12881
|
let prettyName;
|
|
@@ -12767,9 +12914,9 @@ function probeHostEnvironment(options) {
|
|
|
12767
12914
|
if (osReleaseText === void 0) {
|
|
12768
12915
|
try {
|
|
12769
12916
|
if (existsSync("/etc/os-release")) {
|
|
12770
|
-
osReleaseText =
|
|
12917
|
+
osReleaseText = readFileSync2("/etc/os-release", "utf8");
|
|
12771
12918
|
} else if (existsSync("/usr/lib/os-release")) {
|
|
12772
|
-
osReleaseText =
|
|
12919
|
+
osReleaseText = readFileSync2("/usr/lib/os-release", "utf8");
|
|
12773
12920
|
}
|
|
12774
12921
|
} catch {
|
|
12775
12922
|
}
|
|
@@ -12835,16 +12982,16 @@ function buildHostEnvironmentLayer(options) {
|
|
|
12835
12982
|
}
|
|
12836
12983
|
|
|
12837
12984
|
// packages/agent-runtime/agentsMd.ts
|
|
12838
|
-
import { existsSync as existsSync2, readFileSync as
|
|
12839
|
-
import { join } from "node:path";
|
|
12985
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
|
|
12986
|
+
import { join as join2 } from "node:path";
|
|
12840
12987
|
var AGENTS_MD_MAX_BYTES = 8192;
|
|
12841
12988
|
var AGENTS_MD_CANDIDATES = ["AGENTS.md", "CLAUDE.md"];
|
|
12842
12989
|
function readAgentsMdLayerFromDisk(cwd) {
|
|
12843
12990
|
for (const name of AGENTS_MD_CANDIDATES) {
|
|
12844
|
-
const filePath =
|
|
12991
|
+
const filePath = join2(cwd, name);
|
|
12845
12992
|
if (!existsSync2(filePath)) continue;
|
|
12846
12993
|
try {
|
|
12847
|
-
let content =
|
|
12994
|
+
let content = readFileSync3(filePath, "utf8").trim();
|
|
12848
12995
|
if (!content) continue;
|
|
12849
12996
|
if (Buffer.byteLength(content, "utf8") > AGENTS_MD_MAX_BYTES) {
|
|
12850
12997
|
content = Buffer.from(content, "utf8").subarray(0, AGENTS_MD_MAX_BYTES).toString("utf8") + "\n\n<!-- AGENTS.md truncated -->";
|
|
@@ -12914,17 +13061,17 @@ function runDoDCommands(commands, cwd, deps = {}) {
|
|
|
12914
13061
|
}
|
|
12915
13062
|
|
|
12916
13063
|
// packages/cli/agentRunPrompts.ts
|
|
12917
|
-
import { existsSync as existsSync3, readFileSync as
|
|
12918
|
-
import { dirname, extname, isAbsolute, join as
|
|
13064
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4, readdirSync, statSync as statSync2 } from "node:fs";
|
|
13065
|
+
import { dirname, extname, isAbsolute as isAbsolute2, join as join3, relative as relativePath, resolve as resolve2, sep } from "node:path";
|
|
12919
13066
|
function workflowRefToCandidatePath(cwd, ref) {
|
|
12920
13067
|
const normalized = ref.trim();
|
|
12921
13068
|
if (!normalized) return "";
|
|
12922
13069
|
if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
|
|
12923
|
-
const directPath =
|
|
13070
|
+
const directPath = resolve2(cwd, normalized);
|
|
12924
13071
|
if (existsSync3(directPath)) return directPath;
|
|
12925
13072
|
}
|
|
12926
13073
|
const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
|
|
12927
|
-
return
|
|
13074
|
+
return resolve2(cwd, "docs", "workflows", `${fileName}.md`);
|
|
12928
13075
|
}
|
|
12929
13076
|
var SKILL_SEARCH_DIRS = [
|
|
12930
13077
|
".agents/skills"
|
|
@@ -12933,22 +13080,22 @@ function skillRefToCandidatePath(cwd, ref) {
|
|
|
12933
13080
|
const normalized = ref.trim();
|
|
12934
13081
|
if (!normalized) return "";
|
|
12935
13082
|
if (normalized.endsWith(".md") || normalized.includes("/") || normalized.includes("\\")) {
|
|
12936
|
-
const directPath =
|
|
13083
|
+
const directPath = resolve2(cwd, normalized);
|
|
12937
13084
|
if (existsSync3(directPath)) return directPath;
|
|
12938
13085
|
}
|
|
12939
13086
|
const fileName = normalized.replace(/[^a-zA-Z0-9一-鿿]+/g, "-").replace(/^-+|-+$/g, "");
|
|
12940
13087
|
for (const dir of SKILL_SEARCH_DIRS) {
|
|
12941
|
-
const skillMdPath =
|
|
13088
|
+
const skillMdPath = resolve2(cwd, dir, fileName, "SKILL.md");
|
|
12942
13089
|
if (existsSync3(skillMdPath)) return skillMdPath;
|
|
12943
13090
|
}
|
|
12944
|
-
return
|
|
13091
|
+
return resolve2(cwd, ".agents", "skills", fileName, "SKILL.md");
|
|
12945
13092
|
}
|
|
12946
13093
|
async function resolveWorkflowReference(ref, cwd = process.cwd()) {
|
|
12947
13094
|
const path2 = workflowRefToCandidatePath(cwd, ref);
|
|
12948
13095
|
if (!path2 || !existsSync3(path2)) {
|
|
12949
13096
|
throw new Error(`Workflow reference not found: ${ref}`);
|
|
12950
13097
|
}
|
|
12951
|
-
const markdown =
|
|
13098
|
+
const markdown = readFileSync4(path2, "utf8");
|
|
12952
13099
|
const parsed = parseSkillDocProtocol(markdown);
|
|
12953
13100
|
return {
|
|
12954
13101
|
ref,
|
|
@@ -12958,15 +13105,15 @@ async function resolveWorkflowReference(ref, cwd = process.cwd()) {
|
|
|
12958
13105
|
}
|
|
12959
13106
|
function inlineRelativeRefs(body, skillDir) {
|
|
12960
13107
|
const refPattern = /\[([^\]]+)\]\((\.\/[^)]+|[^)]+\/[^)]+)\)/g;
|
|
12961
|
-
const normalizedSkillDir =
|
|
13108
|
+
const normalizedSkillDir = resolve2(skillDir) + sep;
|
|
12962
13109
|
return body.replace(refPattern, (match, label, relPath) => {
|
|
12963
13110
|
const cleaned = relPath.trim();
|
|
12964
13111
|
if (!cleaned.startsWith("./") && !cleaned.startsWith("../")) return match;
|
|
12965
|
-
const absPath =
|
|
13112
|
+
const absPath = resolve2(skillDir, cleaned);
|
|
12966
13113
|
const relative = relativePath(normalizedSkillDir, absPath);
|
|
12967
|
-
if (relative.startsWith("..") ||
|
|
13114
|
+
if (relative.startsWith("..") || isAbsolute2(relative)) return match;
|
|
12968
13115
|
if (!existsSync3(absPath) || !absPath.endsWith(".md")) return match;
|
|
12969
|
-
const refContent =
|
|
13116
|
+
const refContent = readFileSync4(absPath, "utf8");
|
|
12970
13117
|
return `
|
|
12971
13118
|
|
|
12972
13119
|
### ${label}
|
|
@@ -12977,7 +13124,7 @@ ${refContent}
|
|
|
12977
13124
|
});
|
|
12978
13125
|
}
|
|
12979
13126
|
function listSkillScripts(skillDir) {
|
|
12980
|
-
const scriptsDir =
|
|
13127
|
+
const scriptsDir = join3(skillDir, "scripts");
|
|
12981
13128
|
if (!existsSync3(scriptsDir) || !statSync2(scriptsDir).isDirectory()) return null;
|
|
12982
13129
|
const entries = readdirSync(scriptsDir).filter((e) => !e.startsWith("."));
|
|
12983
13130
|
if (entries.length === 0) return null;
|
|
@@ -13008,7 +13155,7 @@ async function resolveSkillReference(ref, options = {}) {
|
|
|
13008
13155
|
if (!path2 || !existsSync3(path2)) {
|
|
13009
13156
|
throw new Error(`Skill reference not found: ${ref}`);
|
|
13010
13157
|
}
|
|
13011
|
-
markdown =
|
|
13158
|
+
markdown = readFileSync4(path2, "utf8");
|
|
13012
13159
|
filePath = path2;
|
|
13013
13160
|
skillDir = dirname(path2);
|
|
13014
13161
|
}
|
|
@@ -13112,9 +13259,9 @@ function prependSubjectDialogMarker(message, subjectDialogKey) {
|
|
|
13112
13259
|
}
|
|
13113
13260
|
function normalizeCliImageInput(input) {
|
|
13114
13261
|
if (/^(https?:|data:|file:)/i.test(input)) return input;
|
|
13115
|
-
const absolutePath =
|
|
13262
|
+
const absolutePath = resolve2(input);
|
|
13116
13263
|
if (!existsSync3(absolutePath)) return input;
|
|
13117
|
-
const base64 =
|
|
13264
|
+
const base64 = readFileSync4(absolutePath).toString("base64");
|
|
13118
13265
|
return `data:${imageMimeTypeForPath(absolutePath)};base64,${base64}`;
|
|
13119
13266
|
}
|
|
13120
13267
|
function imageMimeTypeForPath(path2) {
|
|
@@ -15658,6 +15805,22 @@ async function runAgentRunCommand(args, deps) {
|
|
|
15658
15805
|
if (!localRuntimeCwd && (parsed.runtimeMode === "local" || hostRuntimeLocal)) {
|
|
15659
15806
|
localRuntimeCwd = process.cwd();
|
|
15660
15807
|
}
|
|
15808
|
+
if (parsed.runtimeKey === "instabox") {
|
|
15809
|
+
try {
|
|
15810
|
+
writeInstaboxRunConfig({
|
|
15811
|
+
workspaceMode: parsed.instaboxWorkspace,
|
|
15812
|
+
artifactDir: parsed.instaboxArtifactDir,
|
|
15813
|
+
manifestPath: parsed.instaboxManifestPath,
|
|
15814
|
+
allowRemoteRelease: parsed.instaboxAllowRemoteRelease,
|
|
15815
|
+
allowPaid: parsed.instaboxAllowPaid,
|
|
15816
|
+
env
|
|
15817
|
+
});
|
|
15818
|
+
} catch (err) {
|
|
15819
|
+
output.write(`[nolo] instabox \u914D\u7F6E\u751F\u6210\u5931\u8D25: ${toErrorMessage(err)}
|
|
15820
|
+
`);
|
|
15821
|
+
return 1;
|
|
15822
|
+
}
|
|
15823
|
+
}
|
|
15661
15824
|
const runEnv = buildLocalRunEnv({
|
|
15662
15825
|
env,
|
|
15663
15826
|
allowShell: parsed.allowShell
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchReferenceContents,
|
|
3
3
|
resolveReferenceAssets
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VVRYD7UL.js";
|
|
5
5
|
import {
|
|
6
6
|
updateTokensAction
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3WTD7IIQ.js";
|
|
8
8
|
import {
|
|
9
9
|
applyUpdateTokensFulfilled
|
|
10
10
|
} from "./chunk-OWYYDMGJ.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-NBTY7YJF.js";
|
|
6
6
|
import {
|
|
7
7
|
resolveCliLocalRuntimeKeyCapability
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZEOGFBR3.js";
|
|
9
9
|
import {
|
|
10
10
|
HIGH_RISK_MUTATION_TOOL_NAMES
|
|
11
11
|
} from "./chunk-3M52COK5.js";
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
|
|
22
22
|
// packages/cli/agentRunArgs.ts
|
|
23
23
|
import { readFileSync } from "node:fs";
|
|
24
|
+
import { isAbsolute } from "node:path";
|
|
24
25
|
function readFlagValue(args, flag) {
|
|
25
26
|
const index = args.indexOf(flag);
|
|
26
27
|
if (index < 0) return void 0;
|
|
@@ -78,7 +79,8 @@ var VALUELESS_FLAGS = {
|
|
|
78
79
|
"--ephemeral": true,
|
|
79
80
|
"--memory-only": true,
|
|
80
81
|
"--read-only": true,
|
|
81
|
-
"--machine-shell": true
|
|
82
|
+
"--machine-shell": true,
|
|
83
|
+
"--instabox-allow-remote-release": true
|
|
82
84
|
};
|
|
83
85
|
function isValuelessFlag(arg) {
|
|
84
86
|
return Object.prototype.hasOwnProperty.call(VALUELESS_FLAGS, arg);
|
|
@@ -150,7 +152,7 @@ function writeUsage(output, commandPath) {
|
|
|
150
152
|
return;
|
|
151
153
|
}
|
|
152
154
|
output.write(
|
|
153
|
-
"Usage: nolo agent run <agent> <message> [--local|--server|--auto] [--runtime-key <key>] [--docker-workspace-mode git|empty] [--ephemeral|--memory-only] [--continue <dialogId>] [--cwd <path>]\n nolo agent run --agent <agent> (--msg <message>|--msg-file <path>) [--image <url-or-path>] [--space <spaceId>] [--category <name>] [--inherit-from-dialog <dialog>] [--parent-dialog <dialog>] [--subject-dialog <dialog>] [--subject-ref <kind:id[:role]>] [--task-row-dbkey <key>] [--fallback-agent <agent>] (suggestions for agent to decide on quota) [--allowed-tool <tool>] [--blocked-tool <tool>] [--read-only] [--runtime-key <key>] [--docker-workspace-mode git|empty] [--machine-shell] [--dod <cmd>] [--bg] [--timeout-ms <n>] [--events jsonl] [--no-stream] [--skill <dbKey-or-md-path>]\n"
|
|
155
|
+
"Usage: nolo agent run <agent> <message> [--local|--server|--auto] [--runtime-key <key>] [--docker-workspace-mode git|empty] [--instabox-workspace empty|snapshot] [--instabox-manifest <path>] [--instabox-artifact-dir <path>] [--instabox-allow-remote-release] [--instabox-allow-paid] [--ephemeral|--memory-only] [--continue <dialogId>] [--cwd <path>]\n nolo agent run --agent <agent> (--msg <message>|--msg-file <path>) [--image <url-or-path>] [--space <spaceId>] [--category <name>] [--inherit-from-dialog <dialog>] [--parent-dialog <dialog>] [--subject-dialog <dialog>] [--subject-ref <kind:id[:role]>] [--task-row-dbkey <key>] [--fallback-agent <agent>] (suggestions for agent to decide on quota) [--allowed-tool <tool>] [--blocked-tool <tool>] [--read-only] [--runtime-key <key>] [--docker-workspace-mode git|empty] [--instabox-workspace empty|snapshot] [--instabox-manifest <path>] [--instabox-artifact-dir <path>] [--instabox-allow-remote-release] [--instabox-allow-paid] [--machine-shell] [--dod <cmd>] [--bg] [--timeout-ms <n>] [--events jsonl] [--no-stream] [--skill <dbKey-or-md-path>]\n"
|
|
154
156
|
);
|
|
155
157
|
}
|
|
156
158
|
function parseAgentRunArgs(args, options = {}) {
|
|
@@ -205,6 +207,32 @@ function parseAgentRunArgs(args, options = {}) {
|
|
|
205
207
|
"\u4E0D\u80FD\u540C\u65F6\u6307\u5B9A --machine-shell \u4E0E --runtime-key\uFF1A--machine-shell \u5DF2\u628A\u6D3E\u53D1\u9501\u5230\u7ED1\u5B9A\u673A\u5668\u7684 server \u901A\u9053\uFF0CruntimeKey \u4F1A\u5931\u6548\uFF0C\u8BF7\u53EA\u4FDD\u7559\u5176\u4E2D\u4E00\u4E2A"
|
|
206
208
|
);
|
|
207
209
|
}
|
|
210
|
+
const rawInstaboxWorkspace = readFlagValue(args, "--instabox-workspace")?.trim();
|
|
211
|
+
const rawInstaboxManifest = readFlagValue(args, "--instabox-manifest")?.trim();
|
|
212
|
+
const rawInstaboxArtifactDir = readFlagValue(args, "--instabox-artifact-dir")?.trim();
|
|
213
|
+
const instaboxAllowRemoteRelease = args.includes("--instabox-allow-remote-release");
|
|
214
|
+
const instaboxAllowPaid = args.includes("--instabox-allow-paid");
|
|
215
|
+
const hasInstaboxFlags = args.includes("--instabox-workspace") || args.includes("--instabox-manifest") || args.includes("--instabox-artifact-dir") || instaboxAllowRemoteRelease || instaboxAllowPaid;
|
|
216
|
+
if (hasInstaboxFlags && runtimeKey !== "instabox") {
|
|
217
|
+
throw new Error("--instabox-* \u53C2\u6570\u4EC5\u9002\u7528\u4E8E --runtime-key instabox");
|
|
218
|
+
}
|
|
219
|
+
if (runtimeKey === "instabox") {
|
|
220
|
+
if (!rawInstaboxWorkspace || rawInstaboxWorkspace !== "empty" && rawInstaboxWorkspace !== "snapshot") {
|
|
221
|
+
throw new Error("--runtime-key instabox \u5FC5\u987B\u6307\u5B9A --instabox-workspace empty|snapshot");
|
|
222
|
+
}
|
|
223
|
+
if (!rawInstaboxArtifactDir) {
|
|
224
|
+
throw new Error("--runtime-key instabox \u5FC5\u987B\u6307\u5B9A --instabox-artifact-dir <\u7EDD\u5BF9\u8DEF\u5F84>");
|
|
225
|
+
}
|
|
226
|
+
if (!isAbsolute(rawInstaboxArtifactDir) || rawInstaboxArtifactDir.includes("\0") || rawInstaboxArtifactDir.split("/").includes("..")) {
|
|
227
|
+
throw new Error(`--instabox-artifact-dir \u5FC5\u987B\u4E3A\u5408\u6CD5\u7EDD\u5BF9\u8DEF\u5F84\uFF0C\u4E14\u4E0D\u80FD\u5305\u542B .. \u6216\u7A7A\u5B57\u7B26: "${rawInstaboxArtifactDir}"`);
|
|
228
|
+
}
|
|
229
|
+
if (rawInstaboxWorkspace === "snapshot" && !rawInstaboxManifest) {
|
|
230
|
+
throw new Error("--instabox-workspace snapshot \u5FC5\u987B\u6307\u5B9A --instabox-manifest <\u6587\u4EF6\u8DEF\u5F84>");
|
|
231
|
+
}
|
|
232
|
+
if (rawInstaboxWorkspace === "empty" && args.includes("--instabox-manifest")) {
|
|
233
|
+
throw new Error("--instabox-workspace empty \u4E0D\u5F97\u6307\u5B9A --instabox-manifest");
|
|
234
|
+
}
|
|
235
|
+
}
|
|
208
236
|
const runtimeMode = runtimeModeFromArgs(args);
|
|
209
237
|
const continueDialogId = readFlagValue(args, "--continue") ?? readFlagValue(args, "--dialog");
|
|
210
238
|
const spaceId = readFlagValue(args, "--space");
|
|
@@ -260,6 +288,11 @@ function parseAgentRunArgs(args, options = {}) {
|
|
|
260
288
|
...runtimeMode ? { runtimeMode } : !runtimeKey && (fullstackLocalWorkspaceDefault || explicitLocalCliAgentDefault || args.includes("--dangerously-allow-shell")) ? { runtimeMode: "local" } : {},
|
|
261
289
|
...runtimeKey ? { runtimeKey } : {},
|
|
262
290
|
...dockerWorkspaceMode ? { dockerWorkspaceMode } : {},
|
|
291
|
+
...rawInstaboxWorkspace ? { instaboxWorkspace: rawInstaboxWorkspace } : {},
|
|
292
|
+
...rawInstaboxManifest ? { instaboxManifestPath: rawInstaboxManifest } : {},
|
|
293
|
+
...rawInstaboxArtifactDir ? { instaboxArtifactDir: rawInstaboxArtifactDir } : {},
|
|
294
|
+
...instaboxAllowRemoteRelease ? { instaboxAllowRemoteRelease: true } : {},
|
|
295
|
+
...instaboxAllowPaid ? { instaboxAllowPaid: true } : {},
|
|
263
296
|
background: args.includes("--bg"),
|
|
264
297
|
noStream: args.includes("--no-stream"),
|
|
265
298
|
machineShell: args.includes("--machine-shell"),
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
mergeReferences,
|
|
8
8
|
resolveReferenceAssets,
|
|
9
9
|
resolveToolsFromKeys
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VVRYD7UL.js";
|
|
11
11
|
import {
|
|
12
12
|
UI_CARD_ENVELOPE_MAX_BYTES,
|
|
13
13
|
getAllToolRuns,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
selectSpaceContextLevel,
|
|
21
21
|
selectUserTonePreset,
|
|
22
22
|
uiCardFallback
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-HXFIFEBA.js";
|
|
24
24
|
import {
|
|
25
25
|
resolveToolBaseUrl
|
|
26
26
|
} from "./chunk-MYOH447Z.js";
|
|
@@ -32,15 +32,15 @@ import {
|
|
|
32
32
|
} from "./chunk-ZPKUJROL.js";
|
|
33
33
|
import {
|
|
34
34
|
getDocState
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-FKBWA3NN.js";
|
|
36
36
|
import {
|
|
37
37
|
getTableState
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-KVDB4IIT.js";
|
|
39
39
|
import {
|
|
40
40
|
PERSONALIZATION_DIALOG_CATEGORY,
|
|
41
41
|
buildPersonalizationDialogPolicyContext,
|
|
42
42
|
selectAllMsgs
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-3WTD7IIQ.js";
|
|
44
44
|
import {
|
|
45
45
|
getCurrentSpaceIdRaw,
|
|
46
46
|
getViewMode
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
clipMultilineText,
|
|
3
3
|
fetchAndSerializeTable,
|
|
4
4
|
waitForAbortableDelay
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HXFIFEBA.js";
|
|
6
6
|
import {
|
|
7
7
|
isGatewayHttpStatus
|
|
8
8
|
} from "./chunk-NF64D32W.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "./chunk-AGIM7IMJ.js";
|
|
22
22
|
import {
|
|
23
23
|
fetchAndCacheMessages
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-3WTD7IIQ.js";
|
|
25
25
|
import {
|
|
26
26
|
createSpaceKey
|
|
27
27
|
} from "./chunk-UAD2WT54.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addContentToSpace
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KVDB4IIT.js";
|
|
4
4
|
import {
|
|
5
5
|
format,
|
|
6
6
|
prepareAndPersistMessage,
|
|
7
7
|
uiAskChoiceFunc,
|
|
8
8
|
uiAskChoiceFunctionSchema
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3WTD7IIQ.js";
|
|
10
10
|
import {
|
|
11
11
|
formatISO
|
|
12
12
|
} from "./chunk-ZRAU6T47.js";
|