replicas-cli 0.3.640 → 0.3.641
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/dist/index.cjs +415 -260
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -214,6 +214,9 @@ function getWorkspaceDashboardUrl(workspaceId, options = {}) {
|
|
|
214
214
|
const query = params.length > 0 ? `?${params.join("&")}` : "";
|
|
215
215
|
return `${webAppUrl2}${WEB_APP_PATHS.fullscreenWorkspaces}/${workspaceIdValue}${query}`;
|
|
216
216
|
}
|
|
217
|
+
function getArtifactUrl(artifactId, webAppUrl2 = DEFAULT_WEB_APP_URL) {
|
|
218
|
+
return `${webAppUrl2}${WEB_APP_PATHS.artifacts}/${encodeURIComponent(artifactId)}`;
|
|
219
|
+
}
|
|
217
220
|
function getOrganizationMediaPath(organizationId, mediaId) {
|
|
218
221
|
return `/organizations/${encodeURIComponent(organizationId)}/media/${encodeURIComponent(mediaId)}`;
|
|
219
222
|
}
|
|
@@ -235,6 +238,7 @@ var init_urls = __esm({
|
|
|
235
238
|
workspaces: "/workspace",
|
|
236
239
|
environmentSetup: "/workspace/setup",
|
|
237
240
|
automations: "/automations",
|
|
241
|
+
artifacts: "/artifacts",
|
|
238
242
|
environment: "/environment",
|
|
239
243
|
analytics: "/analytics",
|
|
240
244
|
review: "/review",
|
|
@@ -270,7 +274,7 @@ var init_urls = __esm({
|
|
|
270
274
|
WEB_APP_PATHS.automations,
|
|
271
275
|
`${WEB_APP_PATHS.automations}/${UUID_PATTERN}`
|
|
272
276
|
];
|
|
273
|
-
APP_LINK_PATTERNS = APP_LINK_PATHS.map((
|
|
277
|
+
APP_LINK_PATTERNS = APP_LINK_PATHS.map((path14) => new RegExp(`^${path14.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\?/g, ".").replace(/\*/g, ".*")}$`));
|
|
274
278
|
LEGACY_WEB_APP_PATHS = {
|
|
275
279
|
app: "/app",
|
|
276
280
|
home: "/home",
|
|
@@ -664,10 +668,10 @@ function mergeDefs(...defs) {
|
|
|
664
668
|
function cloneDef(schema) {
|
|
665
669
|
return mergeDefs(schema._zod.def);
|
|
666
670
|
}
|
|
667
|
-
function getElementAtPath(obj,
|
|
668
|
-
if (!
|
|
671
|
+
function getElementAtPath(obj, path14) {
|
|
672
|
+
if (!path14)
|
|
669
673
|
return obj;
|
|
670
|
-
return
|
|
674
|
+
return path14.reduce((acc, key2) => acc?.[key2], obj);
|
|
671
675
|
}
|
|
672
676
|
function promiseAllObject(promisesObj) {
|
|
673
677
|
const keys = Object.keys(promisesObj);
|
|
@@ -926,11 +930,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
926
930
|
}
|
|
927
931
|
return false;
|
|
928
932
|
}
|
|
929
|
-
function prefixIssues(
|
|
933
|
+
function prefixIssues(path14, issues) {
|
|
930
934
|
return issues.map((iss) => {
|
|
931
935
|
var _a3;
|
|
932
936
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
933
|
-
iss.path.unshift(
|
|
937
|
+
iss.path.unshift(path14);
|
|
934
938
|
return iss;
|
|
935
939
|
});
|
|
936
940
|
}
|
|
@@ -1465,16 +1469,16 @@ function flattenError(error62, mapper = (issue3) => issue3.message) {
|
|
|
1465
1469
|
}
|
|
1466
1470
|
function formatError(error62, mapper = (issue3) => issue3.message) {
|
|
1467
1471
|
const fieldErrors = { _errors: [] };
|
|
1468
|
-
const processError = (error63,
|
|
1472
|
+
const processError = (error63, path14 = []) => {
|
|
1469
1473
|
for (const issue3 of error63.issues) {
|
|
1470
1474
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
1471
|
-
issue3.errors.map((issues) => processError({ issues }, [...
|
|
1475
|
+
issue3.errors.map((issues) => processError({ issues }, [...path14, ...issue3.path]));
|
|
1472
1476
|
} else if (issue3.code === "invalid_key") {
|
|
1473
|
-
processError({ issues: issue3.issues }, [...
|
|
1477
|
+
processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
|
|
1474
1478
|
} else if (issue3.code === "invalid_element") {
|
|
1475
|
-
processError({ issues: issue3.issues }, [...
|
|
1479
|
+
processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
|
|
1476
1480
|
} else {
|
|
1477
|
-
const fullpath = [...
|
|
1481
|
+
const fullpath = [...path14, ...issue3.path];
|
|
1478
1482
|
if (fullpath.length === 0) {
|
|
1479
1483
|
fieldErrors._errors.push(mapper(issue3));
|
|
1480
1484
|
} else {
|
|
@@ -1513,17 +1517,17 @@ function formatError(error62, mapper = (issue3) => issue3.message) {
|
|
|
1513
1517
|
}
|
|
1514
1518
|
function treeifyError(error62, mapper = (issue3) => issue3.message) {
|
|
1515
1519
|
const result = { errors: [] };
|
|
1516
|
-
const processError = (error63,
|
|
1520
|
+
const processError = (error63, path14 = []) => {
|
|
1517
1521
|
var _a3;
|
|
1518
1522
|
for (const issue3 of error63.issues) {
|
|
1519
1523
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
1520
|
-
issue3.errors.map((issues) => processError({ issues }, [...
|
|
1524
|
+
issue3.errors.map((issues) => processError({ issues }, [...path14, ...issue3.path]));
|
|
1521
1525
|
} else if (issue3.code === "invalid_key") {
|
|
1522
|
-
processError({ issues: issue3.issues }, [...
|
|
1526
|
+
processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
|
|
1523
1527
|
} else if (issue3.code === "invalid_element") {
|
|
1524
|
-
processError({ issues: issue3.issues }, [...
|
|
1528
|
+
processError({ issues: issue3.issues }, [...path14, ...issue3.path]);
|
|
1525
1529
|
} else {
|
|
1526
|
-
const fullpath = [...
|
|
1530
|
+
const fullpath = [...path14, ...issue3.path];
|
|
1527
1531
|
if (fullpath.length === 0) {
|
|
1528
1532
|
result.errors.push(mapper(issue3));
|
|
1529
1533
|
continue;
|
|
@@ -1562,8 +1566,8 @@ function treeifyError(error62, mapper = (issue3) => issue3.message) {
|
|
|
1562
1566
|
}
|
|
1563
1567
|
function toDotPath(_path) {
|
|
1564
1568
|
const segs = [];
|
|
1565
|
-
const
|
|
1566
|
-
for (const seg of
|
|
1569
|
+
const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1570
|
+
for (const seg of path14) {
|
|
1567
1571
|
if (typeof seg === "number")
|
|
1568
1572
|
segs.push(`[${seg}]`);
|
|
1569
1573
|
else if (typeof seg === "symbol")
|
|
@@ -19681,13 +19685,13 @@ function resolveRef(ref, ctx) {
|
|
|
19681
19685
|
if (!ref.startsWith("#")) {
|
|
19682
19686
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19683
19687
|
}
|
|
19684
|
-
const
|
|
19685
|
-
if (
|
|
19688
|
+
const path14 = ref.slice(1).split("/").filter(Boolean);
|
|
19689
|
+
if (path14.length === 0) {
|
|
19686
19690
|
return ctx.rootSchema;
|
|
19687
19691
|
}
|
|
19688
19692
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19689
|
-
if (
|
|
19690
|
-
const key2 =
|
|
19693
|
+
if (path14[0] === defsKey) {
|
|
19694
|
+
const key2 = path14[1] === void 0 ? void 0 : decodeJSONPointerSegment(path14[1]);
|
|
19691
19695
|
if (!key2 || !ctx.defs[key2]) {
|
|
19692
19696
|
throw new Error(`Reference not found: ${ref}`);
|
|
19693
19697
|
}
|
|
@@ -21355,6 +21359,15 @@ var init_trigger_schemas = __esm({
|
|
|
21355
21359
|
});
|
|
21356
21360
|
|
|
21357
21361
|
// ../shared/src/format.ts
|
|
21362
|
+
function formatBytes(n, opts = {}) {
|
|
21363
|
+
const { baseUnit = "B", mbDigits = 1, gbDigits } = opts;
|
|
21364
|
+
if (n < 1024) return `${n} ${baseUnit}`;
|
|
21365
|
+
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|
|
21366
|
+
if (gbDigits === void 0 || n < 1024 * 1024 * 1024) {
|
|
21367
|
+
return `${(n / (1024 * 1024)).toFixed(mbDigits)} MB`;
|
|
21368
|
+
}
|
|
21369
|
+
return `${(n / (1024 * 1024 * 1024)).toFixed(gbDigits)} GB`;
|
|
21370
|
+
}
|
|
21358
21371
|
function relativeParts(input2, now = Date.now()) {
|
|
21359
21372
|
const then = new Date(input2).getTime();
|
|
21360
21373
|
if (Number.isNaN(then)) return null;
|
|
@@ -21646,7 +21659,7 @@ var init_repository_path = __esm({
|
|
|
21646
21659
|
"use strict";
|
|
21647
21660
|
init_zod();
|
|
21648
21661
|
repositoryPathSchema = external_exports.string().trim().min(1).max(1e3).refine(
|
|
21649
|
-
(
|
|
21662
|
+
(path14) => !path14.startsWith("/") && path14.split("/").every((part) => part !== "" && part !== "." && part !== ".."),
|
|
21650
21663
|
"path is relative to the repository root, with no empty, . or .. parts"
|
|
21651
21664
|
);
|
|
21652
21665
|
}
|
|
@@ -21985,7 +21998,7 @@ function jsonStrings(raw) {
|
|
|
21985
21998
|
} catch {
|
|
21986
21999
|
return null;
|
|
21987
22000
|
}
|
|
21988
|
-
const strings = [],
|
|
22001
|
+
const strings = [], path14 = [], inObject = [];
|
|
21989
22002
|
let expectKey = false;
|
|
21990
22003
|
for (let index = 0; index < raw.length; index++) {
|
|
21991
22004
|
const char = raw[index];
|
|
@@ -21993,22 +22006,22 @@ function jsonStrings(raw) {
|
|
|
21993
22006
|
let end = index + 1;
|
|
21994
22007
|
while (raw[end] !== '"') end += raw[end] === "\\" ? 2 : 1;
|
|
21995
22008
|
const key2 = inObject.at(-1) === true && expectKey;
|
|
21996
|
-
if (key2)
|
|
21997
|
-
strings.push({ start: index, end: end + 1, path: key2 ?
|
|
22009
|
+
if (key2) path14[path14.length - 1] = parseJsonString(raw.slice(index, end + 1));
|
|
22010
|
+
strings.push({ start: index, end: end + 1, path: key2 ? path14.slice(0, -1) : [...path14], key: key2 });
|
|
21998
22011
|
expectKey = false;
|
|
21999
22012
|
index = end;
|
|
22000
22013
|
} else if (char === "{" || char === "[") {
|
|
22001
22014
|
inObject.push(char === "{");
|
|
22002
|
-
|
|
22015
|
+
path14.push(char === "{" ? "" : 0);
|
|
22003
22016
|
expectKey = char === "{";
|
|
22004
22017
|
} else if (char === "}" || char === "]") {
|
|
22005
22018
|
inObject.pop();
|
|
22006
|
-
|
|
22019
|
+
path14.pop();
|
|
22007
22020
|
} else if (char === ",") {
|
|
22008
22021
|
if (inObject.at(-1)) expectKey = true;
|
|
22009
22022
|
else {
|
|
22010
|
-
const last =
|
|
22011
|
-
if (typeof last === "number")
|
|
22023
|
+
const last = path14[path14.length - 1];
|
|
22024
|
+
if (typeof last === "number") path14[path14.length - 1] = last + 1;
|
|
22012
22025
|
}
|
|
22013
22026
|
}
|
|
22014
22027
|
}
|
|
@@ -22152,8 +22165,8 @@ function proofValues(content, known, allowCommitted) {
|
|
|
22152
22165
|
else high = middle - 1;
|
|
22153
22166
|
}
|
|
22154
22167
|
if (strings && (!string4 || start >= string4.end)) return { label: "the JSON outside any string", kept: false };
|
|
22155
|
-
const
|
|
22156
|
-
if (string4?.key) return { label: `a JSON key${
|
|
22168
|
+
const path14 = string4 ? fieldPath(string4.path, known) : "";
|
|
22169
|
+
if (string4?.key) return { label: `a JSON key${path14 ? ` in ${path14}` : ""}`, kept: false };
|
|
22157
22170
|
let body2, from = start, to = end;
|
|
22158
22171
|
if (string4) {
|
|
22159
22172
|
let own2 = read.get(string4.start);
|
|
@@ -22161,7 +22174,7 @@ function proofValues(content, known, allowCommitted) {
|
|
|
22161
22174
|
body2 = own2;
|
|
22162
22175
|
[from, to] = [own2.at[start - string4.start], own2.at[Math.min(end, string4.end - 1) - string4.start]];
|
|
22163
22176
|
} else body2 = whole ?? (whole = readText(content, null));
|
|
22164
|
-
const field2 =
|
|
22177
|
+
const field2 = path14 || "content", line = lineAt(body2.lineStarts, from);
|
|
22165
22178
|
if (!body2.diff) return { label: body2.text.includes("\n") ? `${field2}, line ${line + 1}` : field2, kept: false };
|
|
22166
22179
|
const kind = body2.diff.kinds[line], file2 = body2.diff.files[line];
|
|
22167
22180
|
const where = file2 === null ? "" : containsProofSecret(file2, known) ? ", in a file whose path holds the value" : `, in ${file2}`;
|
|
@@ -22418,7 +22431,7 @@ var init_secrets = __esm({
|
|
|
22418
22431
|
[STANDALONE_TOKEN, "a token"]
|
|
22419
22432
|
]);
|
|
22420
22433
|
POSITIONAL = /* @__PURE__ */ new Set([...BY_NAME, ...SECRET_PATTERNS.slice(1, 5)]);
|
|
22421
|
-
fieldPath = (
|
|
22434
|
+
fieldPath = (path14, known) => path14.map((part) => typeof part === "number" ? `[${part}]` : containsProofSecret(part, known) ? ".<key>" : `.${part}`).join("").replace(/^\./, "");
|
|
22422
22435
|
DIFF = /^(?:diff --git |--- \S|\+\+\+ \S|@@ -\d)/m;
|
|
22423
22436
|
HUNK = /^@@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? @@/;
|
|
22424
22437
|
SIDES = [/* @__PURE__ */ new Set(["removed", "context"]), /* @__PURE__ */ new Set(["added", "context"])];
|
|
@@ -23557,7 +23570,7 @@ var init_security = __esm({
|
|
|
23557
23570
|
FIRST_VALUE_PLACEHOLDER = "{first.value}";
|
|
23558
23571
|
declaredReplayRequestSchema = (placeholders) => external_exports.strictObject({
|
|
23559
23572
|
method: external_exports.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]),
|
|
23560
|
-
path: external_exports.string().startsWith("/", 'path must start with "/"').max(2e3).refine((
|
|
23573
|
+
path: external_exports.string().startsWith("/", 'path must start with "/"').max(2e3).refine((path14) => !/[{}]/.test(placeholders.reduce((rest, placeholder) => rest.replaceAll(placeholder, ""), path14)), `the only placeholders in path are ${placeholders.join(" and ")}`),
|
|
23561
23574
|
body: external_exports.json().optional()
|
|
23562
23575
|
});
|
|
23563
23576
|
usesFirstValue = (request2) => `${request2.path}${JSON.stringify(request2.body ?? null)}`.includes(FIRST_VALUE_PLACEHOLDER);
|
|
@@ -26708,8 +26721,8 @@ function parseIssueContractRecord(schema, value, at, report) {
|
|
|
26708
26721
|
return result.data;
|
|
26709
26722
|
}
|
|
26710
26723
|
for (const issue3 of result.error.issues) {
|
|
26711
|
-
const
|
|
26712
|
-
report.problems.add(`${
|
|
26724
|
+
const path14 = [at, ...issue3.path.map((key2) => typeof key2 === "number" || UUID_RE.test(String(key2)) ? "*" : String(key2))].filter(Boolean).join(".");
|
|
26725
|
+
report.problems.add(`${path14} ${issue3.code}${issue3.code === "invalid_value" ? ` ${String(issue3.input).slice(0, 40)}` : ""}`);
|
|
26713
26726
|
}
|
|
26714
26727
|
report.dropped++;
|
|
26715
26728
|
return void 0;
|
|
@@ -29131,8 +29144,8 @@ var init_preferences = __esm({
|
|
|
29131
29144
|
});
|
|
29132
29145
|
|
|
29133
29146
|
// ../shared/src/environment-files.ts
|
|
29134
|
-
function validateEnvironmentFilePath(
|
|
29135
|
-
const trimmedPath =
|
|
29147
|
+
function validateEnvironmentFilePath(path14) {
|
|
29148
|
+
const trimmedPath = path14.trim();
|
|
29136
29149
|
if (!trimmedPath) {
|
|
29137
29150
|
return "Path is required.";
|
|
29138
29151
|
}
|
|
@@ -29565,7 +29578,7 @@ var init_environment_config = __esm({
|
|
|
29565
29578
|
}).nullable().optional(),
|
|
29566
29579
|
repositories: external_exports.array(external_exports.string().trim().min(1)).optional(),
|
|
29567
29580
|
workspaceSize: external_exports.enum(WORKSPACE_SIZE_OPTIONS).optional(),
|
|
29568
|
-
files: external_exports.record(external_exports.string().trim().refine((
|
|
29581
|
+
files: external_exports.record(external_exports.string().trim().refine((path14) => !validateEnvironmentFilePath(path14), "must be a file path starting with ~/"), external_exports.strictObject({
|
|
29569
29582
|
name: external_exports.string().trim().min(1).optional(),
|
|
29570
29583
|
content: external_exports.string().max(65536)
|
|
29571
29584
|
})).optional(),
|
|
@@ -30376,11 +30389,11 @@ function parseShellScript(script, cwd) {
|
|
|
30376
30389
|
parseUntil(scope, 0, false);
|
|
30377
30390
|
return scope.commands;
|
|
30378
30391
|
}
|
|
30379
|
-
function resolveShellPath(dir,
|
|
30380
|
-
if (
|
|
30381
|
-
if (!
|
|
30392
|
+
function resolveShellPath(dir, path14) {
|
|
30393
|
+
if (path14.includes(SHELL_OPAQUE)) return null;
|
|
30394
|
+
if (!path14.startsWith("/") && dir === null) return null;
|
|
30382
30395
|
const parts = [];
|
|
30383
|
-
for (const part of (
|
|
30396
|
+
for (const part of (path14.startsWith("/") ? path14 : `${dir}/${path14}`).split("/")) {
|
|
30384
30397
|
if (part === "..") parts.pop();
|
|
30385
30398
|
else if (part && part !== ".") parts.push(part);
|
|
30386
30399
|
}
|
|
@@ -30841,8 +30854,8 @@ function parseSkillName(tool, input2) {
|
|
|
30841
30854
|
const skillName = parsedInput.skill ?? parsedInput.name;
|
|
30842
30855
|
return typeof skillName === "string" && skillName ? skillName : null;
|
|
30843
30856
|
}
|
|
30844
|
-
function skillNameFromFilePath(
|
|
30845
|
-
const parts =
|
|
30857
|
+
function skillNameFromFilePath(path14) {
|
|
30858
|
+
const parts = path14.split(/[\\/]+/).filter(Boolean);
|
|
30846
30859
|
if (parts.length < 2 || parts[parts.length - 1].toLowerCase() !== "skill.md") return null;
|
|
30847
30860
|
const skillName = parts[parts.length - 2];
|
|
30848
30861
|
return /[*?[\]{}…$]/.test(skillName) || ["skills", ".system"].includes(skillName.toLowerCase()) ? null : skillName;
|
|
@@ -30851,19 +30864,19 @@ function skillFilePath(tool, input2) {
|
|
|
30851
30864
|
if (!READ_TOOL_NAMES.has(tool.toLowerCase())) return null;
|
|
30852
30865
|
const parsedInput = typeof input2 === "string" ? safeJsonParse(input2, null) : input2;
|
|
30853
30866
|
if (!isRecord(parsedInput)) return null;
|
|
30854
|
-
const
|
|
30855
|
-
return
|
|
30867
|
+
const path14 = [parsedInput.path, parsedInput.filePath, parsedInput.file_path].find((value) => typeof value === "string" && value.length > 0);
|
|
30868
|
+
return path14 && skillNameFromFilePath(path14) ? path14 : null;
|
|
30856
30869
|
}
|
|
30857
30870
|
function createCallDisplayMessage(message2) {
|
|
30858
30871
|
if (message2.inputRequest) return { ...message2, type: "tool_call" };
|
|
30859
|
-
const
|
|
30860
|
-
const skillName = message2.server.toLowerCase() === "skills" ? message2.tool :
|
|
30872
|
+
const path14 = skillFilePath(message2.tool, message2.input);
|
|
30873
|
+
const skillName = message2.server.toLowerCase() === "skills" ? message2.tool : path14 ? skillNameFromFilePath(path14) : parseSkillName(message2.tool, message2.input);
|
|
30861
30874
|
if (skillName === null) return { ...message2, type: "tool_call" };
|
|
30862
30875
|
return {
|
|
30863
30876
|
id: message2.id,
|
|
30864
30877
|
type: "skill",
|
|
30865
30878
|
skillName,
|
|
30866
|
-
...
|
|
30879
|
+
...path14 ? { path: path14 } : {},
|
|
30867
30880
|
status: message2.status,
|
|
30868
30881
|
timestamp: message2.timestamp
|
|
30869
30882
|
};
|
|
@@ -30895,11 +30908,11 @@ function userMessageText(message2) {
|
|
|
30895
30908
|
|
|
30896
30909
|
${message2.content}` : message2.content;
|
|
30897
30910
|
}
|
|
30898
|
-
function fileContentDiff(
|
|
30911
|
+
function fileContentDiff(path14, content, action) {
|
|
30899
30912
|
const lines = content.replace(/\n$/, "").split("\n");
|
|
30900
30913
|
return [
|
|
30901
|
-
`--- ${action === "add" ? "/dev/null" : `a/${
|
|
30902
|
-
`+++ ${action === "add" ? `b/${
|
|
30914
|
+
`--- ${action === "add" ? "/dev/null" : `a/${path14}`}`,
|
|
30915
|
+
`+++ ${action === "add" ? `b/${path14}` : "/dev/null"}`,
|
|
30903
30916
|
action === "add" ? `@@ -0,0 +1,${lines.length} @@` : `@@ -1,${lines.length} +0,0 @@`,
|
|
30904
30917
|
...lines.map((line) => `${action === "add" ? "+" : "-"}${line}`)
|
|
30905
30918
|
].join("\n");
|
|
@@ -30914,8 +30927,8 @@ function skillNamesFromCommand(command) {
|
|
|
30914
30927
|
if (!SKILL_READ_COMMANDS.has(name) || writesFiles(name, argv) || fileWrites(shellCommand).length > 0) return [];
|
|
30915
30928
|
const paths = readCommandPaths(name, argv);
|
|
30916
30929
|
const stdinTarget = shellCommand.stdinTarget?.replaceAll(SHELL_OPAQUE, "\u2026");
|
|
30917
|
-
return (paths.length === 0 && stdinTarget ? [stdinTarget] : paths).flatMap((
|
|
30918
|
-
const resolved =
|
|
30930
|
+
return (paths.length === 0 && stdinTarget ? [stdinTarget] : paths).flatMap((path14) => {
|
|
30931
|
+
const resolved = path14.startsWith("~") ? path14 : resolveShellPath(shellCommand.dir, path14)?.replace(SCRIPT_ROOT, "");
|
|
30919
30932
|
const skillName = resolved && skillNameFromFilePath(resolved);
|
|
30920
30933
|
return skillName ? [skillName] : [];
|
|
30921
30934
|
});
|
|
@@ -30999,7 +31012,7 @@ var init_format2 = __esm({
|
|
|
30999
31012
|
PATTERN_FLAGS = /* @__PURE__ */ new Set(["-e", "-f", "--file", "--regexp"]);
|
|
31000
31013
|
SCRIPT_ROOT = "/";
|
|
31001
31014
|
commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
|
|
31002
|
-
fileWrites = ({ writes }) => writes.filter(({ path:
|
|
31015
|
+
fileWrites = ({ writes }) => writes.filter(({ path: path14 }) => path14 !== "/dev/null");
|
|
31003
31016
|
SKILL_READ_COMMANDS = /* @__PURE__ */ new Set(["awk", "bat", "cat", "head", "less", "more", "nl", "sed", "tail"]);
|
|
31004
31017
|
}
|
|
31005
31018
|
});
|
|
@@ -31114,17 +31127,17 @@ var require_visit = __commonJS({
|
|
|
31114
31127
|
visit2.BREAK = BREAK;
|
|
31115
31128
|
visit2.SKIP = SKIP;
|
|
31116
31129
|
visit2.REMOVE = REMOVE;
|
|
31117
|
-
function visit_(key2, node2, visitor,
|
|
31118
|
-
const ctrl = callVisitor(key2, node2, visitor,
|
|
31130
|
+
function visit_(key2, node2, visitor, path14) {
|
|
31131
|
+
const ctrl = callVisitor(key2, node2, visitor, path14);
|
|
31119
31132
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
31120
|
-
replaceNode(key2,
|
|
31121
|
-
return visit_(key2, ctrl, visitor,
|
|
31133
|
+
replaceNode(key2, path14, ctrl);
|
|
31134
|
+
return visit_(key2, ctrl, visitor, path14);
|
|
31122
31135
|
}
|
|
31123
31136
|
if (typeof ctrl !== "symbol") {
|
|
31124
31137
|
if (identity.isCollection(node2)) {
|
|
31125
|
-
|
|
31138
|
+
path14 = Object.freeze(path14.concat(node2));
|
|
31126
31139
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
31127
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
31140
|
+
const ci = visit_(i, node2.items[i], visitor, path14);
|
|
31128
31141
|
if (typeof ci === "number")
|
|
31129
31142
|
i = ci - 1;
|
|
31130
31143
|
else if (ci === BREAK)
|
|
@@ -31135,13 +31148,13 @@ var require_visit = __commonJS({
|
|
|
31135
31148
|
}
|
|
31136
31149
|
}
|
|
31137
31150
|
} else if (identity.isPair(node2)) {
|
|
31138
|
-
|
|
31139
|
-
const ck = visit_("key", node2.key, visitor,
|
|
31151
|
+
path14 = Object.freeze(path14.concat(node2));
|
|
31152
|
+
const ck = visit_("key", node2.key, visitor, path14);
|
|
31140
31153
|
if (ck === BREAK)
|
|
31141
31154
|
return BREAK;
|
|
31142
31155
|
else if (ck === REMOVE)
|
|
31143
31156
|
node2.key = null;
|
|
31144
|
-
const cv = visit_("value", node2.value, visitor,
|
|
31157
|
+
const cv = visit_("value", node2.value, visitor, path14);
|
|
31145
31158
|
if (cv === BREAK)
|
|
31146
31159
|
return BREAK;
|
|
31147
31160
|
else if (cv === REMOVE)
|
|
@@ -31162,17 +31175,17 @@ var require_visit = __commonJS({
|
|
|
31162
31175
|
visitAsync.BREAK = BREAK;
|
|
31163
31176
|
visitAsync.SKIP = SKIP;
|
|
31164
31177
|
visitAsync.REMOVE = REMOVE;
|
|
31165
|
-
async function visitAsync_(key2, node2, visitor,
|
|
31166
|
-
const ctrl = await callVisitor(key2, node2, visitor,
|
|
31178
|
+
async function visitAsync_(key2, node2, visitor, path14) {
|
|
31179
|
+
const ctrl = await callVisitor(key2, node2, visitor, path14);
|
|
31167
31180
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
31168
|
-
replaceNode(key2,
|
|
31169
|
-
return visitAsync_(key2, ctrl, visitor,
|
|
31181
|
+
replaceNode(key2, path14, ctrl);
|
|
31182
|
+
return visitAsync_(key2, ctrl, visitor, path14);
|
|
31170
31183
|
}
|
|
31171
31184
|
if (typeof ctrl !== "symbol") {
|
|
31172
31185
|
if (identity.isCollection(node2)) {
|
|
31173
|
-
|
|
31186
|
+
path14 = Object.freeze(path14.concat(node2));
|
|
31174
31187
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
31175
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
31188
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path14);
|
|
31176
31189
|
if (typeof ci === "number")
|
|
31177
31190
|
i = ci - 1;
|
|
31178
31191
|
else if (ci === BREAK)
|
|
@@ -31183,13 +31196,13 @@ var require_visit = __commonJS({
|
|
|
31183
31196
|
}
|
|
31184
31197
|
}
|
|
31185
31198
|
} else if (identity.isPair(node2)) {
|
|
31186
|
-
|
|
31187
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
31199
|
+
path14 = Object.freeze(path14.concat(node2));
|
|
31200
|
+
const ck = await visitAsync_("key", node2.key, visitor, path14);
|
|
31188
31201
|
if (ck === BREAK)
|
|
31189
31202
|
return BREAK;
|
|
31190
31203
|
else if (ck === REMOVE)
|
|
31191
31204
|
node2.key = null;
|
|
31192
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
31205
|
+
const cv = await visitAsync_("value", node2.value, visitor, path14);
|
|
31193
31206
|
if (cv === BREAK)
|
|
31194
31207
|
return BREAK;
|
|
31195
31208
|
else if (cv === REMOVE)
|
|
@@ -31216,23 +31229,23 @@ var require_visit = __commonJS({
|
|
|
31216
31229
|
}
|
|
31217
31230
|
return visitor;
|
|
31218
31231
|
}
|
|
31219
|
-
function callVisitor(key2, node2, visitor,
|
|
31232
|
+
function callVisitor(key2, node2, visitor, path14) {
|
|
31220
31233
|
if (typeof visitor === "function")
|
|
31221
|
-
return visitor(key2, node2,
|
|
31234
|
+
return visitor(key2, node2, path14);
|
|
31222
31235
|
if (identity.isMap(node2))
|
|
31223
|
-
return visitor.Map?.(key2, node2,
|
|
31236
|
+
return visitor.Map?.(key2, node2, path14);
|
|
31224
31237
|
if (identity.isSeq(node2))
|
|
31225
|
-
return visitor.Seq?.(key2, node2,
|
|
31238
|
+
return visitor.Seq?.(key2, node2, path14);
|
|
31226
31239
|
if (identity.isPair(node2))
|
|
31227
|
-
return visitor.Pair?.(key2, node2,
|
|
31240
|
+
return visitor.Pair?.(key2, node2, path14);
|
|
31228
31241
|
if (identity.isScalar(node2))
|
|
31229
|
-
return visitor.Scalar?.(key2, node2,
|
|
31242
|
+
return visitor.Scalar?.(key2, node2, path14);
|
|
31230
31243
|
if (identity.isAlias(node2))
|
|
31231
|
-
return visitor.Alias?.(key2, node2,
|
|
31244
|
+
return visitor.Alias?.(key2, node2, path14);
|
|
31232
31245
|
return void 0;
|
|
31233
31246
|
}
|
|
31234
|
-
function replaceNode(key2,
|
|
31235
|
-
const parent =
|
|
31247
|
+
function replaceNode(key2, path14, node2) {
|
|
31248
|
+
const parent = path14[path14.length - 1];
|
|
31236
31249
|
if (identity.isCollection(parent)) {
|
|
31237
31250
|
parent.items[key2] = node2;
|
|
31238
31251
|
} else if (identity.isPair(parent)) {
|
|
@@ -31842,10 +31855,10 @@ var require_Collection = __commonJS({
|
|
|
31842
31855
|
var createNode = require_createNode();
|
|
31843
31856
|
var identity = require_identity();
|
|
31844
31857
|
var Node = require_Node();
|
|
31845
|
-
function collectionFromPath(schema,
|
|
31858
|
+
function collectionFromPath(schema, path14, value) {
|
|
31846
31859
|
let v2 = value;
|
|
31847
|
-
for (let i =
|
|
31848
|
-
const k =
|
|
31860
|
+
for (let i = path14.length - 1; i >= 0; --i) {
|
|
31861
|
+
const k = path14[i];
|
|
31849
31862
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
31850
31863
|
const a = [];
|
|
31851
31864
|
a[k] = v2;
|
|
@@ -31864,7 +31877,7 @@ var require_Collection = __commonJS({
|
|
|
31864
31877
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
31865
31878
|
});
|
|
31866
31879
|
}
|
|
31867
|
-
var isEmptyPath = (
|
|
31880
|
+
var isEmptyPath = (path14) => path14 == null || typeof path14 === "object" && !!path14[Symbol.iterator]().next().done;
|
|
31868
31881
|
var Collection = class extends Node.NodeBase {
|
|
31869
31882
|
constructor(type, schema) {
|
|
31870
31883
|
super(type);
|
|
@@ -31894,11 +31907,11 @@ var require_Collection = __commonJS({
|
|
|
31894
31907
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
31895
31908
|
* that already exists in the map.
|
|
31896
31909
|
*/
|
|
31897
|
-
addIn(
|
|
31898
|
-
if (isEmptyPath(
|
|
31910
|
+
addIn(path14, value) {
|
|
31911
|
+
if (isEmptyPath(path14))
|
|
31899
31912
|
this.add(value);
|
|
31900
31913
|
else {
|
|
31901
|
-
const [key2, ...rest] =
|
|
31914
|
+
const [key2, ...rest] = path14;
|
|
31902
31915
|
const node2 = this.get(key2, true);
|
|
31903
31916
|
if (identity.isCollection(node2))
|
|
31904
31917
|
node2.addIn(rest, value);
|
|
@@ -31912,8 +31925,8 @@ var require_Collection = __commonJS({
|
|
|
31912
31925
|
* Removes a value from the collection.
|
|
31913
31926
|
* @returns `true` if the item was found and removed.
|
|
31914
31927
|
*/
|
|
31915
|
-
deleteIn(
|
|
31916
|
-
const [key2, ...rest] =
|
|
31928
|
+
deleteIn(path14) {
|
|
31929
|
+
const [key2, ...rest] = path14;
|
|
31917
31930
|
if (rest.length === 0)
|
|
31918
31931
|
return this.delete(key2);
|
|
31919
31932
|
const node2 = this.get(key2, true);
|
|
@@ -31927,8 +31940,8 @@ var require_Collection = __commonJS({
|
|
|
31927
31940
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
31928
31941
|
* `true` (collections are always returned intact).
|
|
31929
31942
|
*/
|
|
31930
|
-
getIn(
|
|
31931
|
-
const [key2, ...rest] =
|
|
31943
|
+
getIn(path14, keepScalar) {
|
|
31944
|
+
const [key2, ...rest] = path14;
|
|
31932
31945
|
const node2 = this.get(key2, true);
|
|
31933
31946
|
if (rest.length === 0)
|
|
31934
31947
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -31946,8 +31959,8 @@ var require_Collection = __commonJS({
|
|
|
31946
31959
|
/**
|
|
31947
31960
|
* Checks if the collection includes a value with the key `key`.
|
|
31948
31961
|
*/
|
|
31949
|
-
hasIn(
|
|
31950
|
-
const [key2, ...rest] =
|
|
31962
|
+
hasIn(path14) {
|
|
31963
|
+
const [key2, ...rest] = path14;
|
|
31951
31964
|
if (rest.length === 0)
|
|
31952
31965
|
return this.has(key2);
|
|
31953
31966
|
const node2 = this.get(key2, true);
|
|
@@ -31957,8 +31970,8 @@ var require_Collection = __commonJS({
|
|
|
31957
31970
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
31958
31971
|
* boolean to add/remove the item from the set.
|
|
31959
31972
|
*/
|
|
31960
|
-
setIn(
|
|
31961
|
-
const [key2, ...rest] =
|
|
31973
|
+
setIn(path14, value) {
|
|
31974
|
+
const [key2, ...rest] = path14;
|
|
31962
31975
|
if (rest.length === 0) {
|
|
31963
31976
|
this.set(key2, value);
|
|
31964
31977
|
} else {
|
|
@@ -34473,9 +34486,9 @@ var require_Document = __commonJS({
|
|
|
34473
34486
|
this.contents.add(value);
|
|
34474
34487
|
}
|
|
34475
34488
|
/** Adds a value to the document. */
|
|
34476
|
-
addIn(
|
|
34489
|
+
addIn(path14, value) {
|
|
34477
34490
|
if (assertCollection(this.contents))
|
|
34478
|
-
this.contents.addIn(
|
|
34491
|
+
this.contents.addIn(path14, value);
|
|
34479
34492
|
}
|
|
34480
34493
|
/**
|
|
34481
34494
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -34550,14 +34563,14 @@ var require_Document = __commonJS({
|
|
|
34550
34563
|
* Removes a value from the document.
|
|
34551
34564
|
* @returns `true` if the item was found and removed.
|
|
34552
34565
|
*/
|
|
34553
|
-
deleteIn(
|
|
34554
|
-
if (Collection.isEmptyPath(
|
|
34566
|
+
deleteIn(path14) {
|
|
34567
|
+
if (Collection.isEmptyPath(path14)) {
|
|
34555
34568
|
if (this.contents == null)
|
|
34556
34569
|
return false;
|
|
34557
34570
|
this.contents = null;
|
|
34558
34571
|
return true;
|
|
34559
34572
|
}
|
|
34560
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
34573
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path14) : false;
|
|
34561
34574
|
}
|
|
34562
34575
|
/**
|
|
34563
34576
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -34572,10 +34585,10 @@ var require_Document = __commonJS({
|
|
|
34572
34585
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
34573
34586
|
* `true` (collections are always returned intact).
|
|
34574
34587
|
*/
|
|
34575
|
-
getIn(
|
|
34576
|
-
if (Collection.isEmptyPath(
|
|
34588
|
+
getIn(path14, keepScalar) {
|
|
34589
|
+
if (Collection.isEmptyPath(path14))
|
|
34577
34590
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
34578
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
34591
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path14, keepScalar) : void 0;
|
|
34579
34592
|
}
|
|
34580
34593
|
/**
|
|
34581
34594
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -34586,10 +34599,10 @@ var require_Document = __commonJS({
|
|
|
34586
34599
|
/**
|
|
34587
34600
|
* Checks if the document includes a value at `path`.
|
|
34588
34601
|
*/
|
|
34589
|
-
hasIn(
|
|
34590
|
-
if (Collection.isEmptyPath(
|
|
34602
|
+
hasIn(path14) {
|
|
34603
|
+
if (Collection.isEmptyPath(path14))
|
|
34591
34604
|
return this.contents !== void 0;
|
|
34592
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
34605
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path14) : false;
|
|
34593
34606
|
}
|
|
34594
34607
|
/**
|
|
34595
34608
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -34606,13 +34619,13 @@ var require_Document = __commonJS({
|
|
|
34606
34619
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
34607
34620
|
* boolean to add/remove the item from the set.
|
|
34608
34621
|
*/
|
|
34609
|
-
setIn(
|
|
34610
|
-
if (Collection.isEmptyPath(
|
|
34622
|
+
setIn(path14, value) {
|
|
34623
|
+
if (Collection.isEmptyPath(path14)) {
|
|
34611
34624
|
this.contents = value;
|
|
34612
34625
|
} else if (this.contents == null) {
|
|
34613
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
34626
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path14), value);
|
|
34614
34627
|
} else if (assertCollection(this.contents)) {
|
|
34615
|
-
this.contents.setIn(
|
|
34628
|
+
this.contents.setIn(path14, value);
|
|
34616
34629
|
}
|
|
34617
34630
|
}
|
|
34618
34631
|
/**
|
|
@@ -36572,9 +36585,9 @@ var require_cst_visit = __commonJS({
|
|
|
36572
36585
|
visit2.BREAK = BREAK;
|
|
36573
36586
|
visit2.SKIP = SKIP;
|
|
36574
36587
|
visit2.REMOVE = REMOVE;
|
|
36575
|
-
visit2.itemAtPath = (cst,
|
|
36588
|
+
visit2.itemAtPath = (cst, path14) => {
|
|
36576
36589
|
let item = cst;
|
|
36577
|
-
for (const [field2, index] of
|
|
36590
|
+
for (const [field2, index] of path14) {
|
|
36578
36591
|
const tok = item?.[field2];
|
|
36579
36592
|
if (tok && "items" in tok) {
|
|
36580
36593
|
item = tok.items[index];
|
|
@@ -36583,23 +36596,23 @@ var require_cst_visit = __commonJS({
|
|
|
36583
36596
|
}
|
|
36584
36597
|
return item;
|
|
36585
36598
|
};
|
|
36586
|
-
visit2.parentCollection = (cst,
|
|
36587
|
-
const parent = visit2.itemAtPath(cst,
|
|
36588
|
-
const field2 =
|
|
36599
|
+
visit2.parentCollection = (cst, path14) => {
|
|
36600
|
+
const parent = visit2.itemAtPath(cst, path14.slice(0, -1));
|
|
36601
|
+
const field2 = path14[path14.length - 1][0];
|
|
36589
36602
|
const coll = parent?.[field2];
|
|
36590
36603
|
if (coll && "items" in coll)
|
|
36591
36604
|
return coll;
|
|
36592
36605
|
throw new Error("Parent collection not found");
|
|
36593
36606
|
};
|
|
36594
|
-
function _visit(
|
|
36595
|
-
let ctrl = visitor(item,
|
|
36607
|
+
function _visit(path14, item, visitor) {
|
|
36608
|
+
let ctrl = visitor(item, path14);
|
|
36596
36609
|
if (typeof ctrl === "symbol")
|
|
36597
36610
|
return ctrl;
|
|
36598
36611
|
for (const field2 of ["key", "value"]) {
|
|
36599
36612
|
const token = item[field2];
|
|
36600
36613
|
if (token && "items" in token) {
|
|
36601
36614
|
for (let i = 0; i < token.items.length; ++i) {
|
|
36602
|
-
const ci = _visit(Object.freeze(
|
|
36615
|
+
const ci = _visit(Object.freeze(path14.concat([[field2, i]])), token.items[i], visitor);
|
|
36603
36616
|
if (typeof ci === "number")
|
|
36604
36617
|
i = ci - 1;
|
|
36605
36618
|
else if (ci === BREAK)
|
|
@@ -36610,10 +36623,10 @@ var require_cst_visit = __commonJS({
|
|
|
36610
36623
|
}
|
|
36611
36624
|
}
|
|
36612
36625
|
if (typeof ctrl === "function" && field2 === "key")
|
|
36613
|
-
ctrl = ctrl(item,
|
|
36626
|
+
ctrl = ctrl(item, path14);
|
|
36614
36627
|
}
|
|
36615
36628
|
}
|
|
36616
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
36629
|
+
return typeof ctrl === "function" ? ctrl(item, path14) : ctrl;
|
|
36617
36630
|
}
|
|
36618
36631
|
exports2.visit = visit2;
|
|
36619
36632
|
}
|
|
@@ -38596,7 +38609,7 @@ function stripAttachmentNote(text5) {
|
|
|
38596
38609
|
if (annotationsNote) content = content.slice(0, annotationsNote.index).trim();
|
|
38597
38610
|
return {
|
|
38598
38611
|
content,
|
|
38599
|
-
files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([,
|
|
38612
|
+
files: match ? [...match[1].matchAll(/^- (.+)$/gm)].map(([, path14]) => path14) : [],
|
|
38600
38613
|
walkthroughs,
|
|
38601
38614
|
appshots,
|
|
38602
38615
|
annotations: annotationsNote ? parseAnnotationsNote(annotationsNote.body) : []
|
|
@@ -38635,7 +38648,7 @@ var init_user_message_attachments = __esm({
|
|
|
38635
38648
|
WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
|
|
38636
38649
|
TRUNCATED_WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]*)(?:" duration_seconds="(\d*))?(?:" audio="(true)?)?[^<]*(?:<\/?[a-z_]*)?$/;
|
|
38637
38650
|
VIDEO_SIZES_REGEX = /<replicas_instructions>\nThe attached videos' frame sizes, in pixels:((?:\n- .+: \d+x\d+)+)(?:\nFor display only; ignore\.)?\n<\/replicas_instructions>/;
|
|
38638
|
-
parseVideoSizes = (raw) => Object.fromEntries([...(raw.match(VIDEO_SIZES_REGEX)?.[1] ?? "").matchAll(/^- (.+): (\d+)x(\d+)$/gm)].map(([,
|
|
38651
|
+
parseVideoSizes = (raw) => Object.fromEntries([...(raw.match(VIDEO_SIZES_REGEX)?.[1] ?? "").matchAll(/^- (.+): (\d+)x(\d+)$/gm)].map(([, path14, width, height]) => [path14, { width: Number(width), height: Number(height) }]));
|
|
38639
38652
|
}
|
|
38640
38653
|
});
|
|
38641
38654
|
|
|
@@ -40016,7 +40029,7 @@ function parseOpencodeEvents(events) {
|
|
|
40016
40029
|
upsertDisplayMessage(messages, {
|
|
40017
40030
|
id,
|
|
40018
40031
|
type: "file_change",
|
|
40019
|
-
changes: files.map((
|
|
40032
|
+
changes: files.map((path14) => ({ path: path14, kind: "update" })),
|
|
40020
40033
|
status: "completed",
|
|
40021
40034
|
timestamp: timestamp2
|
|
40022
40035
|
});
|
|
@@ -43167,7 +43180,7 @@ var CLI_VERSION;
|
|
|
43167
43180
|
var init_cli_version = __esm({
|
|
43168
43181
|
"../shared/src/cli-version.ts"() {
|
|
43169
43182
|
"use strict";
|
|
43170
|
-
CLI_VERSION = "0.3.
|
|
43183
|
+
CLI_VERSION = "0.3.641";
|
|
43171
43184
|
}
|
|
43172
43185
|
});
|
|
43173
43186
|
|
|
@@ -55439,15 +55452,34 @@ async function waitForUser(params) {
|
|
|
55439
55452
|
}
|
|
55440
55453
|
return params.settled(value) ? value : params.poll(false);
|
|
55441
55454
|
}
|
|
55442
|
-
|
|
55455
|
+
function readUploadFile(filePath) {
|
|
55456
|
+
const absPath = import_path2.default.resolve(filePath);
|
|
55457
|
+
if (!import_fs2.default.existsSync(absPath)) throw new Error(`File not found: ${absPath}`);
|
|
55458
|
+
if (!import_fs2.default.statSync(absPath).isFile()) throw new Error(`Not a file: ${absPath}`);
|
|
55459
|
+
const body2 = import_fs2.default.readFileSync(absPath);
|
|
55460
|
+
if (body2.length === 0) throw new Error("File is empty");
|
|
55461
|
+
return { fileName: import_path2.default.basename(absPath), body: body2 };
|
|
55462
|
+
}
|
|
55463
|
+
function requireNamePerFile(filePaths, names) {
|
|
55464
|
+
if (filePaths.length === 0) throw new Error("No files specified");
|
|
55465
|
+
if (names.length !== filePaths.length) {
|
|
55466
|
+
throw new Error(`Each file needs a --name. Got ${filePaths.length} file(s) and ${names.length} --name value(s); pass one --name per file, in order.`);
|
|
55467
|
+
}
|
|
55468
|
+
if (names.some((name) => !name.trim())) throw new Error("--name must not be empty.");
|
|
55469
|
+
return names;
|
|
55470
|
+
}
|
|
55471
|
+
var import_chalk6, import_fs2, import_path2, import_prompts10, markdownLabel;
|
|
55443
55472
|
var init_command_utils = __esm({
|
|
55444
55473
|
"src/lib/command-utils.ts"() {
|
|
55445
55474
|
"use strict";
|
|
55446
55475
|
import_chalk6 = __toESM(require("chalk"));
|
|
55476
|
+
import_fs2 = __toESM(require("fs"));
|
|
55477
|
+
import_path2 = __toESM(require("path"));
|
|
55447
55478
|
init_src();
|
|
55448
55479
|
import_prompts10 = __toESM(require("prompts"));
|
|
55449
55480
|
init_config();
|
|
55450
55481
|
init_output();
|
|
55482
|
+
markdownLabel = (name) => name.replace(/[[\]]/g, "");
|
|
55451
55483
|
}
|
|
55452
55484
|
});
|
|
55453
55485
|
|
|
@@ -55691,7 +55723,7 @@ function getGitRoot() {
|
|
|
55691
55723
|
}
|
|
55692
55724
|
function getGitRepoName() {
|
|
55693
55725
|
const root = getGitRoot();
|
|
55694
|
-
return
|
|
55726
|
+
return import_path3.default.basename(root);
|
|
55695
55727
|
}
|
|
55696
55728
|
function isInsideGitRepo() {
|
|
55697
55729
|
try {
|
|
@@ -55704,12 +55736,12 @@ function isInsideGitRepo() {
|
|
|
55704
55736
|
return false;
|
|
55705
55737
|
}
|
|
55706
55738
|
}
|
|
55707
|
-
var import_child_process2,
|
|
55739
|
+
var import_child_process2, import_path3;
|
|
55708
55740
|
var init_git2 = __esm({
|
|
55709
55741
|
"src/lib/git.ts"() {
|
|
55710
55742
|
"use strict";
|
|
55711
55743
|
import_child_process2 = require("child_process");
|
|
55712
|
-
|
|
55744
|
+
import_path3 = __toESM(require("path"));
|
|
55713
55745
|
}
|
|
55714
55746
|
});
|
|
55715
55747
|
|
|
@@ -55845,21 +55877,21 @@ var init_connect = __esm({
|
|
|
55845
55877
|
|
|
55846
55878
|
// src/lib/ssh-config.ts
|
|
55847
55879
|
function ensureSSHDir() {
|
|
55848
|
-
const sshDir =
|
|
55849
|
-
if (!
|
|
55850
|
-
|
|
55880
|
+
const sshDir = import_path4.default.join(import_os2.default.homedir(), ".ssh");
|
|
55881
|
+
if (!import_fs3.default.existsSync(sshDir)) {
|
|
55882
|
+
import_fs3.default.mkdirSync(sshDir, { recursive: true, mode: 448 });
|
|
55851
55883
|
}
|
|
55852
55884
|
}
|
|
55853
55885
|
function readSSHConfig() {
|
|
55854
55886
|
ensureSSHDir();
|
|
55855
|
-
if (!
|
|
55887
|
+
if (!import_fs3.default.existsSync(SSH_CONFIG_PATH)) {
|
|
55856
55888
|
return "";
|
|
55857
55889
|
}
|
|
55858
|
-
return
|
|
55890
|
+
return import_fs3.default.readFileSync(SSH_CONFIG_PATH, "utf-8");
|
|
55859
55891
|
}
|
|
55860
55892
|
function writeSSHConfig(content) {
|
|
55861
55893
|
ensureSSHDir();
|
|
55862
|
-
|
|
55894
|
+
import_fs3.default.writeFileSync(SSH_CONFIG_PATH, content, { mode: 384 });
|
|
55863
55895
|
}
|
|
55864
55896
|
function sanitizeSSHConfigValue(value) {
|
|
55865
55897
|
return value.replace(/[\r\n]+/g, " ").trim();
|
|
@@ -55924,14 +55956,14 @@ function addOrUpdateSSHConfigEntry(entry) {
|
|
|
55924
55956
|
function getWorkspaceHostAlias(workspaceName) {
|
|
55925
55957
|
return `replicas-${workspaceName.toLowerCase().replace(/[^a-z0-9-]/g, "-")}`;
|
|
55926
55958
|
}
|
|
55927
|
-
var
|
|
55959
|
+
var import_fs3, import_path4, import_os2, SSH_CONFIG_PATH, REPLICAS_MARKER_START, REPLICAS_MARKER_END;
|
|
55928
55960
|
var init_ssh_config = __esm({
|
|
55929
55961
|
"src/lib/ssh-config.ts"() {
|
|
55930
55962
|
"use strict";
|
|
55931
|
-
|
|
55932
|
-
|
|
55963
|
+
import_fs3 = __toESM(require("fs"));
|
|
55964
|
+
import_path4 = __toESM(require("path"));
|
|
55933
55965
|
import_os2 = __toESM(require("os"));
|
|
55934
|
-
SSH_CONFIG_PATH =
|
|
55966
|
+
SSH_CONFIG_PATH = import_path4.default.join(import_os2.default.homedir(), ".ssh", "config");
|
|
55935
55967
|
REPLICAS_MARKER_START = "# === REPLICAS CLI MANAGED ENTRY START ===";
|
|
55936
55968
|
REPLICAS_MARKER_END = "# === REPLICAS CLI MANAGED ENTRY END ===";
|
|
55937
55969
|
}
|
|
@@ -56627,8 +56659,8 @@ var init_claude_auth2 = __esm({
|
|
|
56627
56659
|
});
|
|
56628
56660
|
|
|
56629
56661
|
// src/lib/muse-oauth.ts
|
|
56630
|
-
async function post(
|
|
56631
|
-
return fetch(`${AUTH_URL}${
|
|
56662
|
+
async function post(path14, body2) {
|
|
56663
|
+
return fetch(`${AUTH_URL}${path14}`, {
|
|
56632
56664
|
method: "POST",
|
|
56633
56665
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
56634
56666
|
body: body2
|
|
@@ -56801,21 +56833,21 @@ startHook:
|
|
|
56801
56833
|
function initCommand(options) {
|
|
56802
56834
|
const isYaml = options.yaml ?? false;
|
|
56803
56835
|
const targetFilename = isYaml ? "replicas.yaml" : "replicas.json";
|
|
56804
|
-
const configPath =
|
|
56836
|
+
const configPath = import_path5.default.join(process.cwd(), targetFilename);
|
|
56805
56837
|
for (const filename of REPLICAS_CONFIG_FILENAMES) {
|
|
56806
|
-
if (
|
|
56838
|
+
if (import_fs4.default.existsSync(import_path5.default.join(process.cwd(), filename)) && !options.force) {
|
|
56807
56839
|
throw new Error(`${filename} already exists in this directory. Use --force to overwrite the existing file.`);
|
|
56808
56840
|
}
|
|
56809
56841
|
}
|
|
56810
56842
|
const configContent = isYaml ? getDefaultYamlContent() : JSON.stringify(getDefaultConfig(), null, 2) + "\n";
|
|
56811
56843
|
try {
|
|
56812
|
-
|
|
56844
|
+
import_fs4.default.writeFileSync(configPath, configContent, "utf-8");
|
|
56813
56845
|
} catch (error62) {
|
|
56814
56846
|
throw new Error(
|
|
56815
56847
|
`Failed to create ${targetFilename}: ${error62 instanceof Error ? error62.message : "Unknown error"}`
|
|
56816
56848
|
);
|
|
56817
56849
|
}
|
|
56818
|
-
const higherPriority = REPLICAS_CONFIG_FILENAMES.slice(0, REPLICAS_CONFIG_FILENAMES.indexOf(targetFilename)).filter((filename) =>
|
|
56850
|
+
const higherPriority = REPLICAS_CONFIG_FILENAMES.slice(0, REPLICAS_CONFIG_FILENAMES.indexOf(targetFilename)).filter((filename) => import_fs4.default.existsSync(import_path5.default.join(process.cwd(), filename)));
|
|
56819
56851
|
output2({ path: configPath, shadowed_by: higherPriority }, () => {
|
|
56820
56852
|
console.log(import_chalk17.default.green(`\u2713 Created ${targetFilename}`));
|
|
56821
56853
|
for (const filename of higherPriority) {
|
|
@@ -56833,13 +56865,13 @@ function initCommand(options) {
|
|
|
56833
56865
|
}
|
|
56834
56866
|
});
|
|
56835
56867
|
}
|
|
56836
|
-
var import_chalk17,
|
|
56868
|
+
var import_chalk17, import_fs4, import_path5;
|
|
56837
56869
|
var init_init = __esm({
|
|
56838
56870
|
"src/commands/init.ts"() {
|
|
56839
56871
|
"use strict";
|
|
56840
56872
|
import_chalk17 = __toESM(require("chalk"));
|
|
56841
|
-
|
|
56842
|
-
|
|
56873
|
+
import_fs4 = __toESM(require("fs"));
|
|
56874
|
+
import_path5 = __toESM(require("path"));
|
|
56843
56875
|
init_src();
|
|
56844
56876
|
init_output();
|
|
56845
56877
|
}
|
|
@@ -56902,7 +56934,7 @@ async function credentialsGetCommand(service, options) {
|
|
|
56902
56934
|
});
|
|
56903
56935
|
}
|
|
56904
56936
|
async function credentialsSetCommand(service, options) {
|
|
56905
|
-
const
|
|
56937
|
+
const path14 = credentialsPath(service, options, true);
|
|
56906
56938
|
const { org: org2, models, ...fields } = options;
|
|
56907
56939
|
const secretField = service === "bedrock" ? "aws_secret_access_key" : "api_key";
|
|
56908
56940
|
const body2 = {
|
|
@@ -56910,7 +56942,7 @@ async function credentialsSetCommand(service, options) {
|
|
|
56910
56942
|
...models ? { models: models.split(",").map((model2) => model2.trim()).filter(Boolean) } : {},
|
|
56911
56943
|
[secretField]: await readSecret(service, secretField === "api_key" ? "API key" : "AWS secret access key")
|
|
56912
56944
|
};
|
|
56913
|
-
const response = await orgAuthenticatedFetch(
|
|
56945
|
+
const response = await orgAuthenticatedFetch(path14, { method: "POST", body: body2 });
|
|
56914
56946
|
output2(response, () => console.log(import_chalk18.default.green(`Saved ${scopeLabel(options)} ${service} credentials.`)));
|
|
56915
56947
|
}
|
|
56916
56948
|
async function credentialsRemoveCommand(service, options) {
|
|
@@ -57401,7 +57433,7 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57401
57433
|
const invalid = keys.find((key2) => !VARIABLE_KEY_RE.test(key2));
|
|
57402
57434
|
if (invalid) throw new Error(`${invalid} is not a valid environment variable name`);
|
|
57403
57435
|
const timeoutMs = parseRequestTimeout(options.timeout);
|
|
57404
|
-
const readRuntimeEnv = () =>
|
|
57436
|
+
const readRuntimeEnv = () => import_fs5.default.existsSync(RUNTIME_ENV_FILE) ? import_fs5.default.readFileSync(RUNTIME_ENV_FILE, "utf8") : "";
|
|
57405
57437
|
const local = parsePosixEnvFile(readRuntimeEnv());
|
|
57406
57438
|
const available = options.replace ? [] : keys.filter((key2) => Object.hasOwn(local, key2) && local[key2].length > 0);
|
|
57407
57439
|
const wanted = keys.filter((key2) => !available.includes(key2));
|
|
@@ -57438,9 +57470,9 @@ async function envVarsRequestCommand(requiredKeys, options) {
|
|
|
57438
57470
|
const variables = loaded.variables.filter((variable) => !variable.key.startsWith("REPLICAS_"));
|
|
57439
57471
|
const existing = parsePosixEnv(readRuntimeEnv());
|
|
57440
57472
|
const env = { ...existing.values, ...Object.fromEntries(variables.map((variable) => [variable.key, variable.value])) };
|
|
57441
|
-
|
|
57442
|
-
|
|
57443
|
-
|
|
57473
|
+
import_fs5.default.mkdirSync(import_path6.default.dirname(RUNTIME_ENV_FILE), { recursive: true });
|
|
57474
|
+
import_fs5.default.writeFileSync(RUNTIME_ENV_FILE, serializePosixEnvFile(env, existing.unsetKeys.filter((key2) => !env[key2])), { mode: 384 });
|
|
57475
|
+
import_fs5.default.chmodSync(RUNTIME_ENV_FILE, 384);
|
|
57444
57476
|
exported = [...variables.map((variable) => variable.key), ...loaded.already_loaded];
|
|
57445
57477
|
}
|
|
57446
57478
|
if (request2.status !== "pending") await orgAuthenticatedFetch(`/v1/variable-requests/${request2.id}/ack`, { method: "POST" });
|
|
@@ -57499,10 +57531,10 @@ Files (${environment_files.length}):
|
|
|
57499
57531
|
}
|
|
57500
57532
|
function readFileContent(options) {
|
|
57501
57533
|
if (options.file) {
|
|
57502
|
-
if (!
|
|
57534
|
+
if (!import_fs5.default.existsSync(options.file)) {
|
|
57503
57535
|
throw new Error(`Local file not found: ${options.file}`);
|
|
57504
57536
|
}
|
|
57505
|
-
return
|
|
57537
|
+
return import_fs5.default.readFileSync(options.file, "utf-8");
|
|
57506
57538
|
}
|
|
57507
57539
|
if (options.content !== void 0) return options.content;
|
|
57508
57540
|
throw new Error('Pass either --content "..." or --file <local-path>');
|
|
@@ -57832,20 +57864,20 @@ function envWarmPoolCommand(enabled) {
|
|
|
57832
57864
|
output2(response, () => console.log(import_chalk21.default.green(`Warm pool ${enabled ? "enabled" : "disabled"}`)));
|
|
57833
57865
|
};
|
|
57834
57866
|
}
|
|
57835
|
-
var
|
|
57867
|
+
var import_fs5, import_os3, import_path6, import_chalk21, RUNTIME_ENV_FILE;
|
|
57836
57868
|
var init_environment3 = __esm({
|
|
57837
57869
|
"src/commands/environment.ts"() {
|
|
57838
57870
|
"use strict";
|
|
57839
|
-
|
|
57871
|
+
import_fs5 = __toESM(require("fs"));
|
|
57840
57872
|
import_os3 = __toESM(require("os"));
|
|
57841
|
-
|
|
57873
|
+
import_path6 = __toESM(require("path"));
|
|
57842
57874
|
import_chalk21 = __toESM(require("chalk"));
|
|
57843
57875
|
init_api2();
|
|
57844
57876
|
init_command_utils();
|
|
57845
57877
|
init_output();
|
|
57846
57878
|
init_src();
|
|
57847
57879
|
init_repositories2();
|
|
57848
|
-
RUNTIME_ENV_FILE =
|
|
57880
|
+
RUNTIME_ENV_FILE = import_path6.default.join(import_os3.default.homedir(), ".replicas", "runtime-env.sh");
|
|
57849
57881
|
}
|
|
57850
57882
|
});
|
|
57851
57883
|
|
|
@@ -58428,7 +58460,7 @@ async function canvasGetCommand(id, filename) {
|
|
|
58428
58460
|
output2(file2, ({ content }) => process.stdout.write(content ?? ""));
|
|
58429
58461
|
}
|
|
58430
58462
|
async function canvasPutCommand(id, filename, options) {
|
|
58431
|
-
const content = options.file ? options.content ? void 0 :
|
|
58463
|
+
const content = options.file ? options.content ? void 0 : import_fs6.default.readFileSync(options.file, "utf-8") : options.content;
|
|
58432
58464
|
if (content === void 0) throw new Error("Pass exactly one of --content or --file");
|
|
58433
58465
|
const { revision } = await getCanvasFile(id, filename);
|
|
58434
58466
|
const body2 = {
|
|
@@ -58442,11 +58474,11 @@ async function canvasPutCommand(id, filename, options) {
|
|
|
58442
58474
|
if (!result.saved) throw new Error(`${filename} changed while saving; retry`);
|
|
58443
58475
|
output2(result, () => console.log(import_chalk23.default.green(`Saved ${filename}`)));
|
|
58444
58476
|
}
|
|
58445
|
-
var
|
|
58477
|
+
var import_fs6, import_chalk23, getCanvasFile;
|
|
58446
58478
|
var init_workspace = __esm({
|
|
58447
58479
|
"src/commands/workspace.ts"() {
|
|
58448
58480
|
"use strict";
|
|
58449
|
-
|
|
58481
|
+
import_fs6 = __toESM(require("fs"));
|
|
58450
58482
|
import_chalk23 = __toESM(require("chalk"));
|
|
58451
58483
|
init_src();
|
|
58452
58484
|
init_api2();
|
|
@@ -58542,8 +58574,8 @@ async function chatQueueListCommand(id, chatId) {
|
|
|
58542
58574
|
printQueue(queue);
|
|
58543
58575
|
});
|
|
58544
58576
|
}
|
|
58545
|
-
async function mutateQueue(
|
|
58546
|
-
output2(await orgAuthenticatedFetch(
|
|
58577
|
+
async function mutateQueue(path14, method, body2) {
|
|
58578
|
+
output2(await orgAuthenticatedFetch(path14, { method, body: body2 }), ({ queue }) => {
|
|
58547
58579
|
if (queue) printQueue(queue);
|
|
58548
58580
|
else console.log("Done.");
|
|
58549
58581
|
});
|
|
@@ -58557,7 +58589,7 @@ var init_chat = __esm({
|
|
|
58557
58589
|
init_api2();
|
|
58558
58590
|
init_output();
|
|
58559
58591
|
init_replica2();
|
|
58560
|
-
chatPath2 = (id, chatId,
|
|
58592
|
+
chatPath2 = (id, chatId, path14 = "") => `/v1/replica/${id}/chats/${chatId}${path14}`;
|
|
58561
58593
|
chatQueueClearCommand = (id, chatId) => mutateQueue(chatPath2(id, chatId, "/queue"), "DELETE");
|
|
58562
58594
|
chatQueueRemoveCommand = (id, chatId, messageId) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}`), "DELETE");
|
|
58563
58595
|
chatQueueEditCommand = (id, chatId, messageId, message2) => mutateQueue(chatPath2(id, chatId, `/queue/${messageId}`), "PATCH", { message: message2 });
|
|
@@ -58608,7 +58640,7 @@ var init_plugins3 = __esm({
|
|
|
58608
58640
|
init_command_utils();
|
|
58609
58641
|
init_output();
|
|
58610
58642
|
init_environment3();
|
|
58611
|
-
pluginsPath = async ({ env },
|
|
58643
|
+
pluginsPath = async ({ env }, path14) => env ? `/v1/environments/${await resolveEnvironmentId(env)}/plugins${path14}` : `/v1/plugins${path14}`;
|
|
58612
58644
|
}
|
|
58613
58645
|
});
|
|
58614
58646
|
|
|
@@ -58657,7 +58689,7 @@ async function environmentSetupStepCommand(key2, status) {
|
|
|
58657
58689
|
}
|
|
58658
58690
|
function readJsonFile(file2, label) {
|
|
58659
58691
|
try {
|
|
58660
|
-
return JSON.parse(
|
|
58692
|
+
return JSON.parse(import_fs7.default.readFileSync(file2, "utf8"));
|
|
58661
58693
|
} catch (error62) {
|
|
58662
58694
|
throw new Error(`Could not read ${label} JSON from ${file2}: ${error62 instanceof Error ? error62.message : String(error62)}`);
|
|
58663
58695
|
}
|
|
@@ -58680,11 +58712,11 @@ async function environmentSetupProposeCommand(options) {
|
|
|
58680
58712
|
console.log(import_chalk26.default.gray("\n The user reviews and saves it from the Environment panel; nothing has been applied yet.\n"));
|
|
58681
58713
|
});
|
|
58682
58714
|
}
|
|
58683
|
-
var
|
|
58715
|
+
var import_fs7, import_chalk26, STEP_KEYS;
|
|
58684
58716
|
var init_environment_setup2 = __esm({
|
|
58685
58717
|
"src/commands/environment-setup.ts"() {
|
|
58686
58718
|
"use strict";
|
|
58687
|
-
|
|
58719
|
+
import_fs7 = __toESM(require("fs"));
|
|
58688
58720
|
import_chalk26 = __toESM(require("chalk"));
|
|
58689
58721
|
init_api2();
|
|
58690
58722
|
init_command_utils();
|
|
@@ -58695,6 +58727,19 @@ var init_environment_setup2 = __esm({
|
|
|
58695
58727
|
}
|
|
58696
58728
|
});
|
|
58697
58729
|
|
|
58730
|
+
// src/lib/members.ts
|
|
58731
|
+
async function findMemberUserId(emailOrId) {
|
|
58732
|
+
const { members: members2 } = await orgAuthenticatedFetch("/v1/organization/members");
|
|
58733
|
+
const member = members2.find((m) => m.user_id === emailOrId || m.email.toLowerCase() === emailOrId.toLowerCase());
|
|
58734
|
+
return member?.user_id ?? null;
|
|
58735
|
+
}
|
|
58736
|
+
var init_members = __esm({
|
|
58737
|
+
"src/lib/members.ts"() {
|
|
58738
|
+
"use strict";
|
|
58739
|
+
init_api2();
|
|
58740
|
+
}
|
|
58741
|
+
});
|
|
58742
|
+
|
|
58698
58743
|
// src/commands/automation.ts
|
|
58699
58744
|
function parseScopeFilter(value) {
|
|
58700
58745
|
if (!value) return void 0;
|
|
@@ -58966,10 +59011,9 @@ async function resolveCredentialsMember(value) {
|
|
|
58966
59011
|
if (!user) throw new Error("--credentials me needs a signed-in user; pass a member email instead");
|
|
58967
59012
|
return user.id;
|
|
58968
59013
|
}
|
|
58969
|
-
const
|
|
58970
|
-
|
|
58971
|
-
|
|
58972
|
-
return member.user_id;
|
|
59014
|
+
const userId = await findMemberUserId(value);
|
|
59015
|
+
if (!userId) throw new Error(`No organization member matches "${value}". Use me, org, or a member email`);
|
|
59016
|
+
return userId;
|
|
58973
59017
|
}
|
|
58974
59018
|
async function automationListCommand(options) {
|
|
58975
59019
|
ensureOrgApiAuthenticated();
|
|
@@ -59580,6 +59624,7 @@ var init_automation = __esm({
|
|
|
59580
59624
|
init_output();
|
|
59581
59625
|
init_api2();
|
|
59582
59626
|
init_config();
|
|
59627
|
+
init_members();
|
|
59583
59628
|
init_command_utils();
|
|
59584
59629
|
init_src();
|
|
59585
59630
|
DURATION_UNIT_MS = { m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
|
|
@@ -59587,10 +59632,10 @@ var init_automation = __esm({
|
|
|
59587
59632
|
});
|
|
59588
59633
|
|
|
59589
59634
|
// src/lib/agent-api.ts
|
|
59590
|
-
async function agentFetch(
|
|
59591
|
-
return (await agentRequest(
|
|
59635
|
+
async function agentFetch(path14, options) {
|
|
59636
|
+
return (await agentRequest(path14, options)).json();
|
|
59592
59637
|
}
|
|
59593
|
-
async function agentRequest(
|
|
59638
|
+
async function agentRequest(path14, options) {
|
|
59594
59639
|
const config3 = readAgentConfig();
|
|
59595
59640
|
if (!config3) {
|
|
59596
59641
|
throw new Error("Agent mode config not found");
|
|
@@ -59606,7 +59651,7 @@ async function agentRequest(path13, options) {
|
|
|
59606
59651
|
...options?.headers || {}
|
|
59607
59652
|
};
|
|
59608
59653
|
const body2 = rawBody === void 0 ? void 0 : rawBody instanceof FormData || rawBody instanceof ReadableStream ? rawBody : JSON.stringify(rawBody);
|
|
59609
|
-
const response = await fetch(`${MONOLITH_URL}${
|
|
59654
|
+
const response = await fetch(`${MONOLITH_URL}${path14}`, {
|
|
59610
59655
|
...options,
|
|
59611
59656
|
headers,
|
|
59612
59657
|
body: body2,
|
|
@@ -59618,7 +59663,7 @@ async function agentRequest(path13, options) {
|
|
|
59618
59663
|
}
|
|
59619
59664
|
return response;
|
|
59620
59665
|
}
|
|
59621
|
-
async function engineFetch(
|
|
59666
|
+
async function engineFetch(path14, options) {
|
|
59622
59667
|
const config3 = readAgentConfig();
|
|
59623
59668
|
if (!config3) {
|
|
59624
59669
|
throw new Error("Agent mode config not found");
|
|
@@ -59628,7 +59673,7 @@ async function engineFetch(path13, options) {
|
|
|
59628
59673
|
"Content-Type": "application/json",
|
|
59629
59674
|
...options?.headers || {}
|
|
59630
59675
|
};
|
|
59631
|
-
const response = await fetch(`http://localhost:${ENGINE_PORT2}${
|
|
59676
|
+
const response = await fetch(`http://localhost:${ENGINE_PORT2}${path14}`, {
|
|
59632
59677
|
...options,
|
|
59633
59678
|
headers,
|
|
59634
59679
|
body: options?.body !== void 0 ? JSON.stringify(options.body) : void 0
|
|
@@ -59826,21 +59871,9 @@ async function uploadMedia(file2, fileName, fields) {
|
|
|
59826
59871
|
return media2;
|
|
59827
59872
|
}
|
|
59828
59873
|
async function uploadOne(filePath, displayName, kind, options) {
|
|
59829
|
-
const
|
|
59830
|
-
|
|
59831
|
-
throw new Error(`File not found: ${absPath}`);
|
|
59832
|
-
}
|
|
59833
|
-
const stat = import_fs7.default.statSync(absPath);
|
|
59834
|
-
if (!stat.isFile()) {
|
|
59835
|
-
throw new Error(`Not a file: ${absPath}`);
|
|
59836
|
-
}
|
|
59837
|
-
if (stat.size === 0) {
|
|
59838
|
-
throw new Error("File is empty");
|
|
59839
|
-
}
|
|
59840
|
-
const fileName = import_path6.default.basename(absPath);
|
|
59841
|
-
const ext = import_path6.default.extname(absPath).slice(1).toLowerCase();
|
|
59874
|
+
const { fileName, body: body2 } = readUploadFile(filePath);
|
|
59875
|
+
const ext = import_path7.default.extname(fileName).slice(1).toLowerCase();
|
|
59842
59876
|
const contentType = mediaInfo(ext)?.contentType ?? "application/octet-stream";
|
|
59843
|
-
const body2 = import_fs7.default.readFileSync(absPath);
|
|
59844
59877
|
const media2 = await uploadMedia(new Blob([body2], { type: contentType }), fileName, {
|
|
59845
59878
|
kind,
|
|
59846
59879
|
display_name: displayName,
|
|
@@ -59849,9 +59882,7 @@ async function uploadOne(filePath, displayName, kind, options) {
|
|
|
59849
59882
|
return { media: media2, imageSize: kind === MEDIA_KIND.IMAGE ? readImageSize((offset) => body2.subarray(offset)) : null };
|
|
59850
59883
|
}
|
|
59851
59884
|
async function mediaUploadCommand(filePaths, options) {
|
|
59852
|
-
|
|
59853
|
-
throw new Error("No files specified");
|
|
59854
|
-
}
|
|
59885
|
+
const names = requireNamePerFile(filePaths, options.name ?? []);
|
|
59855
59886
|
if (options.kind && !isMediaKind(options.kind)) {
|
|
59856
59887
|
throw new Error(`Invalid kind '${options.kind}'. Must be one of: ${MEDIA_KINDS.join(", ")}`);
|
|
59857
59888
|
}
|
|
@@ -59861,18 +59892,9 @@ async function mediaUploadCommand(filePaths, options) {
|
|
|
59861
59892
|
if (options.share && options.access) {
|
|
59862
59893
|
throw new Error("Pass either --share or --access, not both. --share is an alias for --access public.");
|
|
59863
59894
|
}
|
|
59864
|
-
const names = options.name ?? [];
|
|
59865
|
-
if (names.length !== filePaths.length) {
|
|
59866
|
-
throw new Error(
|
|
59867
|
-
`Each file needs a --name. Got ${filePaths.length} file(s) and ${names.length} --name value(s); pass one --name per file, in order.`
|
|
59868
|
-
);
|
|
59869
|
-
}
|
|
59870
|
-
if (names.some((name) => !name.trim())) {
|
|
59871
|
-
throw new Error("--name must not be empty.");
|
|
59872
|
-
}
|
|
59873
59895
|
const publicAccess = options.share || options.access === "public";
|
|
59874
59896
|
const kinds = filePaths.map((filePath) => {
|
|
59875
|
-
const ext =
|
|
59897
|
+
const ext = import_path7.default.extname(filePath).slice(1).toLowerCase();
|
|
59876
59898
|
return resolveKind(ext, options.kind);
|
|
59877
59899
|
});
|
|
59878
59900
|
if (kinds.includes(MEDIA_KIND.HTML)) {
|
|
@@ -59973,22 +59995,21 @@ async function mediaUrlCommand(mediaId) {
|
|
|
59973
59995
|
const response = await orgAuthenticatedFetch(`/v1/media/${mediaId}/url`);
|
|
59974
59996
|
output2(response, ({ url: url2 }) => console.log(url2));
|
|
59975
59997
|
}
|
|
59976
|
-
var
|
|
59998
|
+
var import_path7, MEDIA_ACCESS_VALUES, MEDIA_DELIVERY_HINT;
|
|
59977
59999
|
var init_media3 = __esm({
|
|
59978
60000
|
"src/commands/media.ts"() {
|
|
59979
60001
|
"use strict";
|
|
59980
|
-
|
|
59981
|
-
import_path6 = __toESM(require("path"));
|
|
60002
|
+
import_path7 = __toESM(require("path"));
|
|
59982
60003
|
init_agent_api();
|
|
59983
60004
|
init_api2();
|
|
59984
60005
|
init_config();
|
|
59985
60006
|
init_monolith_url();
|
|
59986
60007
|
init_media_url();
|
|
60008
|
+
init_command_utils();
|
|
59987
60009
|
init_output();
|
|
59988
60010
|
init_src();
|
|
59989
60011
|
MEDIA_ACCESS_VALUES = ["organization", "public"];
|
|
59990
60012
|
MEDIA_DELIVERY_HINT = "Next: paste each media line above (`` or `[\u2026](\u2026)`) verbatim into your Replicas chat reply so it renders inline; View in Replicas links are secondary and never replace it. Slack, Linear, and GitLab also need a native upload of the file bytes; see the replicas-agent skill's references/MEDIA.md.";
|
|
59991
|
-
markdownLabel = (name) => name.replace(/[[\]]/g, "");
|
|
59992
60013
|
}
|
|
59993
60014
|
});
|
|
59994
60015
|
|
|
@@ -60010,10 +60031,10 @@ function gifFilter({ fps, width, crop }) {
|
|
|
60010
60031
|
].filter(Boolean).join(",");
|
|
60011
60032
|
}
|
|
60012
60033
|
async function mediaGifCommand(input2, options) {
|
|
60013
|
-
const source =
|
|
60034
|
+
const source = import_path8.default.resolve(input2);
|
|
60014
60035
|
if (!import_fs8.default.existsSync(source) || !import_fs8.default.statSync(source).isFile()) throw new Error(`File not found: ${source}`);
|
|
60015
|
-
const target =
|
|
60016
|
-
if (
|
|
60036
|
+
const target = import_path8.default.resolve(options.output ?? `${source.replace(/\.[^./]+$/, "")}.gif`);
|
|
60037
|
+
if (import_path8.default.extname(target).toLowerCase() !== ".gif") throw new Error("--output must end in .gif");
|
|
60017
60038
|
if (target === source) throw new Error("--output must differ from the input file");
|
|
60018
60039
|
if (options.crop && !/^\d+:\d+:\d+:\d+$/.test(options.crop)) {
|
|
60019
60040
|
throw new Error(`--crop must be width:height:x:y in pixels of the recording, got '${options.crop}'`);
|
|
@@ -60022,7 +60043,7 @@ async function mediaGifCommand(input2, options) {
|
|
|
60022
60043
|
const duration3 = parseOption(options.duration, 10, "--duration", 1, 30);
|
|
60023
60044
|
const maxWidth = parseOption(options.width, 960, "--width", 200, 1280);
|
|
60024
60045
|
const maxFps = parseOption(options.fps, 12, "--fps", 5, 20);
|
|
60025
|
-
const temp =
|
|
60046
|
+
const temp = import_path8.default.join(import_path8.default.dirname(target), `.${import_path8.default.basename(target, ".gif")}.${process.pid}.tmp.gif`);
|
|
60026
60047
|
let fps = maxFps;
|
|
60027
60048
|
let width = maxWidth;
|
|
60028
60049
|
try {
|
|
@@ -60065,13 +60086,13 @@ async function mediaGifCommand(input2, options) {
|
|
|
60065
60086
|
`The GIF is still over GitHub's 5 MiB limit at ${fps} fps and ${width}px wide. Show less: a shorter --duration with --start at the interaction, or --crop to the area that changes.`
|
|
60066
60087
|
);
|
|
60067
60088
|
}
|
|
60068
|
-
var import_child_process4, import_fs8,
|
|
60089
|
+
var import_child_process4, import_fs8, import_path8, import_util9, GIF_MAX_BYTES, GIF_ATTEMPTS, execFileAsync;
|
|
60069
60090
|
var init_media_gif = __esm({
|
|
60070
60091
|
"src/commands/media-gif.ts"() {
|
|
60071
60092
|
"use strict";
|
|
60072
60093
|
import_child_process4 = require("child_process");
|
|
60073
60094
|
import_fs8 = __toESM(require("fs"));
|
|
60074
|
-
|
|
60095
|
+
import_path8 = __toESM(require("path"));
|
|
60075
60096
|
import_util9 = require("util");
|
|
60076
60097
|
init_output();
|
|
60077
60098
|
GIF_MAX_BYTES = 5 * 1024 * 1024;
|
|
@@ -60080,6 +60101,129 @@ var init_media_gif = __esm({
|
|
|
60080
60101
|
}
|
|
60081
60102
|
});
|
|
60082
60103
|
|
|
60104
|
+
// src/commands/artifact.ts
|
|
60105
|
+
async function uploadArtifact(filePath, displayName, immutable) {
|
|
60106
|
+
const { fileName, body: body2 } = readUploadFile(filePath);
|
|
60107
|
+
const form = new FormData();
|
|
60108
|
+
form.append("file", new Blob([body2]), fileName);
|
|
60109
|
+
form.append("display_name", displayName);
|
|
60110
|
+
form.append("mutability", immutable ? "immutable" : "mutable");
|
|
60111
|
+
const { artifact: artifact2 } = await agentFetch("/v1/artifacts", { method: "POST", body: form });
|
|
60112
|
+
return artifact2;
|
|
60113
|
+
}
|
|
60114
|
+
async function artifactUploadCommand(filePaths, options) {
|
|
60115
|
+
if (!isAgentMode()) throw new Error("Run this inside a Replicas workspace. Only workspaces can upload artifacts.");
|
|
60116
|
+
const names = requireNamePerFile(filePaths, options.name ?? []);
|
|
60117
|
+
const results = await Promise.allSettled(
|
|
60118
|
+
filePaths.map((filePath, i) => uploadArtifact(filePath, names[i], options.immutable ?? false))
|
|
60119
|
+
);
|
|
60120
|
+
const uploads = [];
|
|
60121
|
+
const failures = [];
|
|
60122
|
+
results.forEach((result, i) => {
|
|
60123
|
+
if (result.status === "fulfilled") {
|
|
60124
|
+
uploads.push({ file: filePaths[i], artifact: result.value });
|
|
60125
|
+
} else {
|
|
60126
|
+
const reason = result.reason instanceof Error ? result.reason.message : String(result.reason);
|
|
60127
|
+
failures.push(`${filePaths[i]}: ${reason}`);
|
|
60128
|
+
}
|
|
60129
|
+
});
|
|
60130
|
+
output2({ uploads }, () => {
|
|
60131
|
+
for (const { artifact: artifact2 } of uploads) {
|
|
60132
|
+
const size = formatBytes(artifact2.size_bytes);
|
|
60133
|
+
const visibility = artifact2.owner ? `Private to ${artifact2.owner.display_name} until shared.` : "This workspace has no owner, so it belongs to the organization: everyone in it can see, rename and delete it.";
|
|
60134
|
+
console.log(`Saved artifact "${artifact2.display_name}" (${artifact2.kind}, ${size}). ${visibility}`);
|
|
60135
|
+
console.log(`[${markdownLabel(artifact2.display_name)}](${getArtifactUrl(artifact2.id)})`);
|
|
60136
|
+
}
|
|
60137
|
+
});
|
|
60138
|
+
if (failures.length > 0) throw new Error(`${failures.length} artifact upload(s) failed \u2014 ${failures.join("; ")}`);
|
|
60139
|
+
}
|
|
60140
|
+
async function artifactListCommand(options) {
|
|
60141
|
+
const query = new URLSearchParams();
|
|
60142
|
+
if (options.all) query.set("mutability", "all");
|
|
60143
|
+
else if (options.immutable) query.set("mutability", "immutable");
|
|
60144
|
+
for (const owner of options.owner ?? []) query.append("owner", owner);
|
|
60145
|
+
for (const kind of options.kind ?? []) query.append("kind", kind);
|
|
60146
|
+
if (options.workspace) {
|
|
60147
|
+
const workspaceId = options.workspace === true ? readAgentConfig()?.workspace_id : options.workspace;
|
|
60148
|
+
if (!workspaceId) throw new Error("Pass --workspace <id>, or run inside a workspace to list its artifacts.");
|
|
60149
|
+
query.set("workspace_id", workspaceId);
|
|
60150
|
+
}
|
|
60151
|
+
if (options.limit) query.set("limit", options.limit);
|
|
60152
|
+
if (options.page) query.set("page", options.page);
|
|
60153
|
+
const response = await orgAuthenticatedFetch(`/v1/artifacts?${query}`);
|
|
60154
|
+
output2(response, ({ artifacts, total }) => {
|
|
60155
|
+
if (artifacts.length === 0) console.log("No artifacts.");
|
|
60156
|
+
for (const artifact2 of artifacts) {
|
|
60157
|
+
const owner = artifact2.owner?.email ?? "organization";
|
|
60158
|
+
const size = formatBytes(artifact2.size_bytes);
|
|
60159
|
+
const columns = [artifact2.id, artifact2.kind, artifact2.mutability, artifact2.display_name, owner, size, artifact2.updated_at];
|
|
60160
|
+
console.log(columns.join(" "));
|
|
60161
|
+
}
|
|
60162
|
+
if (total > artifacts.length) console.log(`Showing ${artifacts.length} of ${total}. Use --page for more.`);
|
|
60163
|
+
});
|
|
60164
|
+
}
|
|
60165
|
+
async function artifactUrlCommand(artifactId) {
|
|
60166
|
+
const path14 = `/v1/artifacts/${artifactId}/url?disposition=attachment`;
|
|
60167
|
+
const response = await orgAuthenticatedFetch(path14);
|
|
60168
|
+
output2(response, ({ url: url2 }) => console.log(url2));
|
|
60169
|
+
}
|
|
60170
|
+
async function artifactRenameCommand(artifactId, name) {
|
|
60171
|
+
const { artifact: artifact2 } = await orgAuthenticatedFetch(`/v1/artifacts/${artifactId}`, {
|
|
60172
|
+
method: "PATCH",
|
|
60173
|
+
body: { display_name: name }
|
|
60174
|
+
});
|
|
60175
|
+
output2({ artifact: artifact2 }, () => console.log(`Renamed artifact ${artifact2.id} to "${artifact2.display_name}".`));
|
|
60176
|
+
}
|
|
60177
|
+
async function artifactDeleteCommand(artifactId) {
|
|
60178
|
+
await orgAuthenticatedFetch(`/v1/artifacts/${artifactId}`, { method: "DELETE" });
|
|
60179
|
+
outputSuccess(`Deleted artifact ${artifactId}`);
|
|
60180
|
+
}
|
|
60181
|
+
async function resolveGrantPath(artifactId, grantee) {
|
|
60182
|
+
if (grantee.organization && grantee.user) throw new Error("Pass either --user <email> or --organization, not both.");
|
|
60183
|
+
if (grantee.organization) {
|
|
60184
|
+
return { path: `/v1/artifacts/${artifactId}/shares/organization`, granteeName: "the organization" };
|
|
60185
|
+
}
|
|
60186
|
+
const email3 = grantee.user;
|
|
60187
|
+
if (!email3) throw new Error("Pass --user <email> or --organization.");
|
|
60188
|
+
const userId = await findMemberUserId(email3);
|
|
60189
|
+
if (!userId) throw new Error(`No member of this organization has the email "${email3}".`);
|
|
60190
|
+
return { path: `/v1/artifacts/${artifactId}/shares/users/${userId}`, granteeName: email3 };
|
|
60191
|
+
}
|
|
60192
|
+
async function artifactShareCommand(artifactId, options) {
|
|
60193
|
+
const permission = ARTIFACT_PERMISSIONS.find((value) => value === (options.permission ?? "view"));
|
|
60194
|
+
if (!permission) {
|
|
60195
|
+
throw new Error(`Invalid permission '${options.permission}'. Must be one of: ${ARTIFACT_PERMISSIONS.join(", ")}`);
|
|
60196
|
+
}
|
|
60197
|
+
const { path: path14, granteeName } = await resolveGrantPath(artifactId, options);
|
|
60198
|
+
const { share: share2 } = await orgAuthenticatedFetch(path14, { method: "PUT", body: { permission } });
|
|
60199
|
+
output2({ share: share2 }, () => console.log(`Shared artifact ${artifactId} with ${granteeName} (${share2.permission}).`));
|
|
60200
|
+
}
|
|
60201
|
+
async function artifactUnshareCommand(artifactId, options) {
|
|
60202
|
+
const { path: path14, granteeName } = await resolveGrantPath(artifactId, options);
|
|
60203
|
+
await orgAuthenticatedFetch(path14, { method: "DELETE" });
|
|
60204
|
+
outputSuccess(`Artifact ${artifactId} is no longer shared with ${granteeName}.`);
|
|
60205
|
+
}
|
|
60206
|
+
async function artifactSharesCommand(artifactId) {
|
|
60207
|
+
const shares = await orgAuthenticatedFetch(`/v1/artifacts/${artifactId}/shares`);
|
|
60208
|
+
output2(shares, ({ organization, users }) => {
|
|
60209
|
+
console.log(`Organization: ${organization ? organization.permission : "not shared"}`);
|
|
60210
|
+
if (users.length === 0) console.log("No people.");
|
|
60211
|
+
for (const share2 of users) console.log(`${share2.user?.email} ${share2.permission}`);
|
|
60212
|
+
});
|
|
60213
|
+
}
|
|
60214
|
+
var init_artifact = __esm({
|
|
60215
|
+
"src/commands/artifact.ts"() {
|
|
60216
|
+
"use strict";
|
|
60217
|
+
init_src();
|
|
60218
|
+
init_agent_api();
|
|
60219
|
+
init_api2();
|
|
60220
|
+
init_command_utils();
|
|
60221
|
+
init_config();
|
|
60222
|
+
init_members();
|
|
60223
|
+
init_output();
|
|
60224
|
+
}
|
|
60225
|
+
});
|
|
60226
|
+
|
|
60083
60227
|
// src/commands/issue.ts
|
|
60084
60228
|
async function callIssueTool(name, args, schema, printHuman) {
|
|
60085
60229
|
if (!isAgentMode() && !getApiKey()) throw new Error("replicas issue needs an API key: run `replicas login --api-key`, or use it inside a workspace.");
|
|
@@ -60231,13 +60375,13 @@ var init_issue = __esm({
|
|
|
60231
60375
|
|
|
60232
60376
|
// src/lib/headless-chrome.ts
|
|
60233
60377
|
function findChrome() {
|
|
60234
|
-
const dirs = (process.env.PATH ?? "").split(
|
|
60235
|
-
return dirs.flatMap((dir) => CHROME_NAMES.map((name) =>
|
|
60378
|
+
const dirs = (process.env.PATH ?? "").split(import_path9.default.delimiter).filter(Boolean);
|
|
60379
|
+
return dirs.flatMap((dir) => CHROME_NAMES.map((name) => import_path9.default.join(dir, name))).find((file2) => import_fs9.default.existsSync(file2)) ?? null;
|
|
60236
60380
|
}
|
|
60237
60381
|
function launchChrome() {
|
|
60238
60382
|
const executable = findChrome();
|
|
60239
60383
|
if (!executable) throw new Error(`Chrome is not installed (looked for ${CHROME_NAMES.join(", ")} on PATH)`);
|
|
60240
|
-
const userDataDir = import_fs9.default.mkdtempSync(
|
|
60384
|
+
const userDataDir = import_fs9.default.mkdtempSync(import_path9.default.join(import_os4.default.tmpdir(), "replicas-chrome-"));
|
|
60241
60385
|
const child = (0, import_child_process5.spawn)(executable, [
|
|
60242
60386
|
"--headless=new",
|
|
60243
60387
|
"--remote-debugging-pipe",
|
|
@@ -60339,14 +60483,14 @@ function launchChrome() {
|
|
|
60339
60483
|
}
|
|
60340
60484
|
};
|
|
60341
60485
|
}
|
|
60342
|
-
var import_child_process5, import_fs9, import_os4,
|
|
60486
|
+
var import_child_process5, import_fs9, import_os4, import_path9, import_stream, CHROME_NAMES, COMMAND_TIMEOUT_MS, CLOSE_TIMEOUT_MS;
|
|
60343
60487
|
var init_headless_chrome = __esm({
|
|
60344
60488
|
"src/lib/headless-chrome.ts"() {
|
|
60345
60489
|
"use strict";
|
|
60346
60490
|
import_child_process5 = require("child_process");
|
|
60347
60491
|
import_fs9 = __toESM(require("fs"));
|
|
60348
60492
|
import_os4 = __toESM(require("os"));
|
|
60349
|
-
|
|
60493
|
+
import_path9 = __toESM(require("path"));
|
|
60350
60494
|
import_stream = require("stream");
|
|
60351
60495
|
init_src();
|
|
60352
60496
|
CHROME_NAMES = ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"];
|
|
@@ -60450,7 +60594,7 @@ async function inspect(html, source) {
|
|
|
60450
60594
|
await resize(width, clampVisualHeight(Math.min(MAX_SCREENSHOT_HEIGHT, await settledHeight(page))));
|
|
60451
60595
|
const { data } = await page.send("Page.captureScreenshot", { format: "png" });
|
|
60452
60596
|
import_fs10.default.mkdirSync(SCREENSHOT_DIR, { recursive: true });
|
|
60453
|
-
const file2 =
|
|
60597
|
+
const file2 = import_path10.default.join(SCREENSHOT_DIR, `${import_path10.default.basename(source, import_path10.default.extname(source))}-${appearance}-${width}.png`);
|
|
60454
60598
|
import_fs10.default.writeFileSync(file2, Buffer.from(data, "base64"));
|
|
60455
60599
|
return file2;
|
|
60456
60600
|
};
|
|
@@ -60491,7 +60635,7 @@ function warnings(inspection) {
|
|
|
60491
60635
|
];
|
|
60492
60636
|
}
|
|
60493
60637
|
async function visualizeCommand(file2, options) {
|
|
60494
|
-
const source =
|
|
60638
|
+
const source = import_path10.default.resolve(file2);
|
|
60495
60639
|
if (!import_fs10.default.statSync(source, { throwIfNoEntry: false })?.isFile()) throw new Error(`File not found: ${source}`);
|
|
60496
60640
|
const { html: inlined, missing } = inlineLocalImages(import_fs10.default.readFileSync(source, "utf8"));
|
|
60497
60641
|
const html = injectVisualBootstrap(inlined);
|
|
@@ -60544,13 +60688,13 @@ Next: publish with \`replicas visualize ${file2} --title "<short title>"\`.`);
|
|
|
60544
60688
|
console.log("\nNext: paste the  line on its own line where the visual belongs in your final reply. The user sees the visual itself, so don't introduce or restate it; add only what it doesn't say. The Forge link is for posting outside Replicas chat (PRs, Slack, Linear); leave it out of your chat reply.");
|
|
60545
60689
|
});
|
|
60546
60690
|
}
|
|
60547
|
-
var import_fs10, import_http3,
|
|
60691
|
+
var import_fs10, import_http3, import_path10, MIB, MAX_IMAGE_BYTES, MAX_PAGE_BYTES, LOAD_TIMEOUT_MS, MAX_SCREENSHOT_HEIGHT, SCREENSHOT_DIR, LOCAL_IMAGE, webAppUrl, VIEWPORT_DEPENDENT_FIX, consoleErrors;
|
|
60548
60692
|
var init_visualize = __esm({
|
|
60549
60693
|
"src/commands/visualize.ts"() {
|
|
60550
60694
|
"use strict";
|
|
60551
60695
|
import_fs10 = __toESM(require("fs"));
|
|
60552
60696
|
import_http3 = __toESM(require("http"));
|
|
60553
|
-
|
|
60697
|
+
import_path10 = __toESM(require("path"));
|
|
60554
60698
|
init_urls();
|
|
60555
60699
|
init_design_tokens();
|
|
60556
60700
|
init_src();
|
|
@@ -60676,16 +60820,16 @@ function computeExecCommand(kind) {
|
|
|
60676
60820
|
return async (command, options) => {
|
|
60677
60821
|
if (command.length === 0) throw new Error(`Pass a command after --, e.g. replicas ${kind} exec -- ${kind === "gpu" ? "nvidia-smi" : "xcodebuild -version"}`);
|
|
60678
60822
|
const sandboxId = await resolveSandboxId(kind, options);
|
|
60679
|
-
const
|
|
60823
|
+
const path14 = `${BASE}/${sandboxId}/exec`;
|
|
60680
60824
|
if (options.detach) {
|
|
60681
|
-
const { jobId } = await agentFetch(
|
|
60825
|
+
const { jobId } = await agentFetch(path14, execRequest(command.join(" "), options));
|
|
60682
60826
|
output2({ jobId, sandboxId }, () => {
|
|
60683
60827
|
console.log(`Started job ${import_chalk30.default.bold(jobId)} in ${sandboxId}`);
|
|
60684
60828
|
console.log(import_chalk30.default.gray(`Follow it with: replicas ${kind} logs ${jobId} -f`));
|
|
60685
60829
|
});
|
|
60686
60830
|
return;
|
|
60687
60831
|
}
|
|
60688
|
-
const exitCode = await streamOutput(await agentRequest(
|
|
60832
|
+
const exitCode = await streamOutput(await agentRequest(path14, execRequest(command.join(" "), options)));
|
|
60689
60833
|
process.exitCode = exitCode ?? 1;
|
|
60690
60834
|
if (isJsonMode()) output2({ sandboxId, exitCode }, () => {
|
|
60691
60835
|
});
|
|
@@ -60718,21 +60862,21 @@ function assertTransferSize(bytes, localPath) {
|
|
|
60718
60862
|
}
|
|
60719
60863
|
}
|
|
60720
60864
|
function archive(localPath) {
|
|
60721
|
-
const
|
|
60722
|
-
if (!(0, import_node_fs3.existsSync)(
|
|
60723
|
-
if (!(0, import_node_fs3.statSync)(
|
|
60724
|
-
assertTransferSize((0, import_node_fs3.statSync)(
|
|
60725
|
-
return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", (0, import_node_path3.dirname)(
|
|
60865
|
+
const path14 = (0, import_node_path3.resolve)(localPath);
|
|
60866
|
+
if (!(0, import_node_fs3.existsSync)(path14)) throw new Error(`${path14} does not exist`);
|
|
60867
|
+
if (!(0, import_node_fs3.statSync)(path14).isDirectory()) {
|
|
60868
|
+
assertTransferSize((0, import_node_fs3.statSync)(path14).size, localPath);
|
|
60869
|
+
return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", (0, import_node_path3.dirname)(path14), (0, import_node_path3.basename)(path14)], { stdio: ["ignore", "pipe", "pipe"] });
|
|
60726
60870
|
}
|
|
60727
|
-
const listed = (0, import_node_child_process2.spawnSync)("git", ["-C",
|
|
60871
|
+
const listed = (0, import_node_child_process2.spawnSync)("git", ["-C", path14, "ls-files", "-co", "--exclude-standard", "-z"], { maxBuffer: 256 * 1024 * 1024 });
|
|
60728
60872
|
if (listed.status !== 0) {
|
|
60729
|
-
const du = (0, import_node_child_process2.spawnSync)("du", ["-sk", "--exclude=.git", "--exclude=node_modules",
|
|
60873
|
+
const du = (0, import_node_child_process2.spawnSync)("du", ["-sk", "--exclude=.git", "--exclude=node_modules", path14]);
|
|
60730
60874
|
assertTransferSize(Number(du.stdout.toString().split(" ")[0]) * 1024, localPath);
|
|
60731
|
-
return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C",
|
|
60875
|
+
return (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path14, "--exclude=.git", "--exclude=node_modules", "."], { stdio: ["ignore", "pipe", "pipe"] });
|
|
60732
60876
|
}
|
|
60733
|
-
const files = listed.stdout.toString().split("\0").filter((file2) => file2 && (0, import_node_fs3.existsSync)((0, import_node_path3.join)(
|
|
60734
|
-
assertTransferSize(files.reduce((total, file2) => total + (0, import_node_fs3.statSync)((0, import_node_path3.join)(
|
|
60735
|
-
const child = (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C",
|
|
60877
|
+
const files = listed.stdout.toString().split("\0").filter((file2) => file2 && (0, import_node_fs3.existsSync)((0, import_node_path3.join)(path14, file2)));
|
|
60878
|
+
assertTransferSize(files.reduce((total, file2) => total + (0, import_node_fs3.statSync)((0, import_node_path3.join)(path14, file2)).size, 0), localPath);
|
|
60879
|
+
const child = (0, import_node_child_process2.spawn)("tar", ["-czf", "-", "-C", path14, "--null", "-T", "-"], { stdio: ["pipe", "pipe", "pipe"] });
|
|
60736
60880
|
child.stdin.end(files.map((file2) => `${file2}\0`).join(""));
|
|
60737
60881
|
return child;
|
|
60738
60882
|
}
|
|
@@ -61507,7 +61651,7 @@ var init_theme = __esm({
|
|
|
61507
61651
|
|
|
61508
61652
|
// src/commands/local-control.ts
|
|
61509
61653
|
async function connectedComputers() {
|
|
61510
|
-
const dir =
|
|
61654
|
+
const dir = import_path11.default.join(import_os5.default.homedir(), DEVICES_DIR);
|
|
61511
61655
|
if (!import_fs11.default.existsSync(dir)) return [];
|
|
61512
61656
|
const names = import_fs11.default.readdirSync(dir).flatMap((entry) => entry.startsWith(LOCAL_CONTROL_FILE_PREFIX) && entry.endsWith(".conf") ? [entry.slice(LOCAL_CONTROL_FILE_PREFIX.length, -".conf".length)] : []);
|
|
61513
61657
|
const answers = await Promise.all(names.map((name) => execFileAsync2("ssh", ["-o", "BatchMode=yes", "-o", "ConnectTimeout=10", name, "true"], { timeout: 2e4 }).then(() => true, () => false)));
|
|
@@ -61579,14 +61723,14 @@ async function localControlRequestCommand(options) {
|
|
|
61579
61723
|
`));
|
|
61580
61724
|
});
|
|
61581
61725
|
}
|
|
61582
|
-
var import_child_process6, import_fs11, import_os5,
|
|
61726
|
+
var import_child_process6, import_fs11, import_os5, import_path11, import_util10, import_chalk36, execFileAsync2;
|
|
61583
61727
|
var init_local_control = __esm({
|
|
61584
61728
|
"src/commands/local-control.ts"() {
|
|
61585
61729
|
"use strict";
|
|
61586
61730
|
import_child_process6 = require("child_process");
|
|
61587
61731
|
import_fs11 = __toESM(require("fs"));
|
|
61588
61732
|
import_os5 = __toESM(require("os"));
|
|
61589
|
-
|
|
61733
|
+
import_path11 = __toESM(require("path"));
|
|
61590
61734
|
import_util10 = require("util");
|
|
61591
61735
|
import_chalk36 = __toESM(require("chalk"));
|
|
61592
61736
|
init_src();
|
|
@@ -61638,13 +61782,13 @@ function oneOf(values, value, label) {
|
|
|
61638
61782
|
if (!match) throw new Error(`Unknown ${label} "${value}". Use one of: ${values.join(", ")}`);
|
|
61639
61783
|
return match;
|
|
61640
61784
|
}
|
|
61641
|
-
function maskBody(
|
|
61785
|
+
function maskBody(path14, body2) {
|
|
61642
61786
|
let masked = 0;
|
|
61643
61787
|
const mask = (value) => {
|
|
61644
61788
|
masked += stringsIn(value).reduce((count, text5) => count + countSecrets(text5), 0);
|
|
61645
61789
|
return maskSecretsDeep(value);
|
|
61646
61790
|
};
|
|
61647
|
-
const setup =
|
|
61791
|
+
const setup = path14 === "/app-setup" ? securityAppSetupSubmissionSchema.safeParse(body2) : null;
|
|
61648
61792
|
if (setup?.success) {
|
|
61649
61793
|
const { recipe } = setup.data;
|
|
61650
61794
|
const prepared = recipe && prepareSecurityAppRecipe(recipe);
|
|
@@ -61656,23 +61800,23 @@ function maskBody(path13, body2) {
|
|
|
61656
61800
|
};
|
|
61657
61801
|
}
|
|
61658
61802
|
if (setup) return { body: body2, masked };
|
|
61659
|
-
if (
|
|
61803
|
+
if (path14.endsWith("/proofs") && body2 && typeof body2 === "object" && "content" in body2) {
|
|
61660
61804
|
const { content, ...meta3 } = body2;
|
|
61661
61805
|
return { body: { ...mask(meta3), content }, masked };
|
|
61662
61806
|
}
|
|
61663
|
-
if (
|
|
61807
|
+
if (path14 === "/fix" && body2 && typeof body2 === "object" && "files" in body2) {
|
|
61664
61808
|
const { files, ...meta3 } = body2;
|
|
61665
61809
|
return { body: { ...mask(meta3), files }, masked };
|
|
61666
61810
|
}
|
|
61667
61811
|
return { body: mask(body2), masked };
|
|
61668
61812
|
}
|
|
61669
|
-
function request(
|
|
61813
|
+
function request(path14, init) {
|
|
61670
61814
|
ensureOrgApiAuthenticated();
|
|
61671
|
-
if (!init) return orgAuthenticatedFetch(`/v1/code-security/run${
|
|
61672
|
-
const { body: body2, masked } = maskBody(
|
|
61815
|
+
if (!init) return orgAuthenticatedFetch(`/v1/code-security/run${path14}`);
|
|
61816
|
+
const { body: body2, masked } = maskBody(path14, init.body);
|
|
61673
61817
|
if (masked > 0) process.stderr.write(`masked ${masked} secret-shaped value(s) before sending
|
|
61674
61818
|
`);
|
|
61675
|
-
return orgAuthenticatedFetch(`/v1/code-security/run${
|
|
61819
|
+
return orgAuthenticatedFetch(`/v1/code-security/run${path14}`, { ...init, body: body2 });
|
|
61676
61820
|
}
|
|
61677
61821
|
function printRun({ run: run2 }) {
|
|
61678
61822
|
const units = Object.values(run2.coverage);
|
|
@@ -61740,7 +61884,7 @@ async function runCheckout() {
|
|
|
61740
61884
|
const gitIn = (dir, args) => (0, import_child_process7.execFileSync)("git", ["-C", dir, ...args], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], maxBuffer: 256 * 1024 * 1024 });
|
|
61741
61885
|
const checkout = run2.commit_sha && checkoutWithCommit(SANDBOX_PATHS.WORKSPACES_DIR, run2.commit_sha);
|
|
61742
61886
|
if (!checkout) throw new Error(`No checkout under ${SANDBOX_PATHS.WORKSPACES_DIR} has the run's commit ${run2.commit_sha}.`);
|
|
61743
|
-
return { run: run2, dir: (0,
|
|
61887
|
+
return { run: run2, dir: (0, import_path12.basename)(checkout), git: (args) => gitIn(checkout, args) };
|
|
61744
61888
|
}
|
|
61745
61889
|
function trackedFiles(run2, git) {
|
|
61746
61890
|
const commit = run2.commit_sha ?? "HEAD";
|
|
@@ -61939,7 +62083,7 @@ function changedFiles(worktree, commitSha, known) {
|
|
|
61939
62083
|
const mode = status === "D" ? oldMode : newMode;
|
|
61940
62084
|
if (mode !== "100644" && mode !== "100755") throw new Error(`${file2} is a ${mode === "120000" ? "symlink" : `mode ${mode} entry`}; a fix can change only regular files`);
|
|
61941
62085
|
if (status === "D") return { path: file2, mode, content: null };
|
|
61942
|
-
const content = import_fs12.default.readFileSync((0,
|
|
62086
|
+
const content = import_fs12.default.readFileSync((0, import_path12.join)(worktree, file2));
|
|
61943
62087
|
if (content.includes(0)) throw new Error(`${file2} is binary; a fix can change only text files`);
|
|
61944
62088
|
const text5 = content.toString("utf8");
|
|
61945
62089
|
if (addsSecret(text5, status === "A" ? "" : git(["cat-file", "blob", `${commitSha}:${file2}`]), known)) refused.push(file2);
|
|
@@ -61988,13 +62132,13 @@ async function securityReviewCommand(options) {
|
|
|
61988
62132
|
` : "\n Recorded. No pull request was opened.\n");
|
|
61989
62133
|
});
|
|
61990
62134
|
}
|
|
61991
|
-
var import_child_process7, import_fs12,
|
|
62135
|
+
var import_child_process7, import_fs12, import_path12, import_chalk37, CHUNK_LINES, CHUNK_FILES, TRACE_BRIEF;
|
|
61992
62136
|
var init_security2 = __esm({
|
|
61993
62137
|
"src/commands/security.ts"() {
|
|
61994
62138
|
"use strict";
|
|
61995
62139
|
import_child_process7 = require("child_process");
|
|
61996
62140
|
import_fs12 = __toESM(require("fs"));
|
|
61997
|
-
|
|
62141
|
+
import_path12 = require("path");
|
|
61998
62142
|
import_chalk37 = __toESM(require("chalk"));
|
|
61999
62143
|
init_src();
|
|
62000
62144
|
init_security_checkout();
|
|
@@ -62040,11 +62184,11 @@ function registerEnvironmentHookCommands(parent, config3) {
|
|
|
62040
62184
|
}
|
|
62041
62185
|
hooks.command("repository-hooks <env>").description(`List per-repo ${config3.kind} hooks defined in replicas.json / replicas.yaml`).action(run(config3.repositoryHooks));
|
|
62042
62186
|
}
|
|
62043
|
-
var
|
|
62187
|
+
var import_config22, import_commander, collect, program, organizationOptionalCommands, interactiveCommands, billing, org, config2, chat, chatQueue, share, pr, canvas, credentials, automation, repos, plugins, skills, artifact, media, issue2, environment, envConfig, envVars, envFiles, envSkills, envMcps, parsePortOption, envDevices, envWarmPool, preview, authenticatedPreviewHelp;
|
|
62044
62188
|
var init_src2 = __esm({
|
|
62045
62189
|
"src/index.ts"() {
|
|
62046
62190
|
"use strict";
|
|
62047
|
-
|
|
62191
|
+
import_config22 = require("dotenv/config");
|
|
62048
62192
|
import_commander = require("commander");
|
|
62049
62193
|
init_login3();
|
|
62050
62194
|
init_logout();
|
|
@@ -62073,6 +62217,7 @@ var init_src2 = __esm({
|
|
|
62073
62217
|
init_preview();
|
|
62074
62218
|
init_media3();
|
|
62075
62219
|
init_media_gif();
|
|
62220
|
+
init_artifact();
|
|
62076
62221
|
init_issue();
|
|
62077
62222
|
init_visualize();
|
|
62078
62223
|
init_compute2();
|
|
@@ -62245,6 +62390,15 @@ var init_src2 = __esm({
|
|
|
62245
62390
|
skills.command("create <file>").description("Save a SKILL.md as an organization skill").requiredOption("--title <text>", 'Short title, e.g. "Always use Conventional Commits"').action(run(skillsCreateCommand));
|
|
62246
62391
|
skills.command("update <name-or-id>").description("Update an organization skill").option("--title <text>", "New title").option("-f, --file <file>", "New SKILL.md content").action(run(skillsUpdateCommand));
|
|
62247
62392
|
skills.command("delete <id>").description("Delete an organization skill").action(run(skillsDeleteCommand));
|
|
62393
|
+
artifact = program.command("artifact").description("Keep files a workspace made: deliverables people can find, open and share after the workspace is gone");
|
|
62394
|
+
artifact.command("upload <files...>").description("Upload one or more files as artifacts, concurrently. They belong to the person this workspace belongs to").option("-n, --name <name>", "Required name people see. Pass one --name per file, in order.", collect, []).option("--immutable", "A record that never changes, such as a screenshot (default: mutable)").action(run(artifactUploadCommand));
|
|
62395
|
+
artifact.command("list").description("List your artifacts and those shared with you (mutable only unless --immutable or --all)").option("--immutable", "Only immutable artifacts").option("--all", "Mutable and immutable artifacts").option("--owner <owner>", "me, others or organization (repeatable)", collect, []).option("-k, --kind <kind>", "Viewer kind such as markdown, html or image (repeatable)", collect, []).option("-w, --workspace [id]", "Everything a workspace made that you can open (this workspace if no id)").option("-l, --limit <n>", "Page size (default 50, max 200)").option("-p, --page <n>", "Page number (default 1)").action(run(artifactListCommand));
|
|
62396
|
+
artifact.command("url <artifactId>").description("Print a short-lived download URL for an artifact").action(run(artifactUrlCommand));
|
|
62397
|
+
artifact.command("rename <artifactId> <name>").description("Rename an artifact (needs edit access)").action(run(artifactRenameCommand));
|
|
62398
|
+
artifact.command("share <artifactId>").description("Share an artifact with a member or the whole organization (needs edit access)").option("-u, --user <email>", "Member to share with").option("--organization", "Share with everyone in the organization").option("--permission <permission>", "view or edit (default view)").action(run(artifactShareCommand));
|
|
62399
|
+
artifact.command("unshare <artifactId>").description("Stop sharing an artifact with a member or the organization (anyone can remove their own access)").option("-u, --user <email>", "Member to remove").option("--organization", "Stop sharing with the organization").action(run(artifactUnshareCommand));
|
|
62400
|
+
artifact.command("shares <artifactId>").description("List who an artifact is shared with").action(run(artifactSharesCommand));
|
|
62401
|
+
artifact.command("delete <artifactId>").description("Permanently delete an artifact (owner only; anyone in the organization for organization-owned ones)").action(run(artifactDeleteCommand));
|
|
62248
62402
|
media = program.command("media").description("Share workspace media and HTML pages");
|
|
62249
62403
|
media.command("list").description("List media uploaded by a workspace (this workspace by default inside one)").option("-w, --workspace <id>", "Workspace ID").option("-k, --kind <kind>", "Filter by kind: image, video, audio, or html").option("-l, --limit <n>", "Page size (default 50, max 200)").option("-p, --page <n>", "Page number (default 1)").action(run(mediaListCommand));
|
|
62250
62404
|
media.command("url <mediaId>").description("Print a short-lived download URL for media").action(run(mediaUrlCommand));
|
|
@@ -62432,6 +62586,7 @@ ${VISUAL_PAGE_RULES}`).action(run(visualizeCommand));
|
|
|
62432
62586
|
"preview",
|
|
62433
62587
|
"service",
|
|
62434
62588
|
"media",
|
|
62589
|
+
"artifact",
|
|
62435
62590
|
"issue",
|
|
62436
62591
|
"visualize",
|
|
62437
62592
|
"gpu",
|