replicas-cli 0.3.497 → 0.3.498
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 +474 -255
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -14719,7 +14719,7 @@ function generateRecordCheck(doc, ctx, schema, accessor) {
|
|
|
14719
14719
|
}, `return INVALID;`);
|
|
14720
14720
|
return outputVar;
|
|
14721
14721
|
}
|
|
14722
|
-
function emitOwnKeys(doc, ctx, accessor, kVar,
|
|
14722
|
+
function emitOwnKeys(doc, ctx, accessor, kVar, body2, onSymbol) {
|
|
14723
14723
|
const propIsEnumerableConst = addConstant(ctx, Object.prototype.propertyIsEnumerable);
|
|
14724
14724
|
const symsVar = newVar(ctx);
|
|
14725
14725
|
const keysVar = newVar(ctx);
|
|
@@ -14730,7 +14730,7 @@ function emitOwnKeys(doc, ctx, accessor, kVar, body, onSymbol) {
|
|
|
14730
14730
|
doc.indented((d) => {
|
|
14731
14731
|
d.write(`const ${kVar} = ${keysVar}[${iVar}];`);
|
|
14732
14732
|
d.write(`if (${kVar} === "__proto__" || !${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`);
|
|
14733
|
-
|
|
14733
|
+
body2(d);
|
|
14734
14734
|
});
|
|
14735
14735
|
doc.write(`}`);
|
|
14736
14736
|
doc.write(`for (let ${iVar} = 0; ${iVar} < ${symsVar}.length; ${iVar}++) {`);
|
|
@@ -14740,7 +14740,7 @@ function emitOwnKeys(doc, ctx, accessor, kVar, body, onSymbol) {
|
|
|
14740
14740
|
if (onSymbol)
|
|
14741
14741
|
d.write(onSymbol);
|
|
14742
14742
|
else
|
|
14743
|
-
|
|
14743
|
+
body2(d);
|
|
14744
14744
|
});
|
|
14745
14745
|
doc.write(`}`);
|
|
14746
14746
|
}
|
|
@@ -15931,12 +15931,12 @@ function _check(fn, params) {
|
|
|
15931
15931
|
return ch;
|
|
15932
15932
|
}
|
|
15933
15933
|
// @__NO_SIDE_EFFECTS__
|
|
15934
|
-
function describe(
|
|
15934
|
+
function describe(description2) {
|
|
15935
15935
|
const ch = new $ZodCheck({ check: "describe" });
|
|
15936
15936
|
ch._zod.onattach = [
|
|
15937
15937
|
(inst) => {
|
|
15938
15938
|
const existing = globalRegistry.get(inst) ?? {};
|
|
15939
|
-
globalRegistry.add(inst, { ...existing, description });
|
|
15939
|
+
globalRegistry.add(inst, { ...existing, description: description2 });
|
|
15940
15940
|
}
|
|
15941
15941
|
];
|
|
15942
15942
|
ch._zod.check = () => {
|
|
@@ -18658,9 +18658,9 @@ var init_schemas2 = __esm({
|
|
|
18658
18658
|
readonly() {
|
|
18659
18659
|
return readonly(this);
|
|
18660
18660
|
},
|
|
18661
|
-
describe(
|
|
18661
|
+
describe(description2) {
|
|
18662
18662
|
const cl = this.clone();
|
|
18663
|
-
globalRegistry.add(cl, { description });
|
|
18663
|
+
globalRegistry.add(cl, { description: description2 });
|
|
18664
18664
|
return cl;
|
|
18665
18665
|
},
|
|
18666
18666
|
meta(...args) {
|
|
@@ -27416,8 +27416,8 @@ function parseAutomationRun(raw) {
|
|
|
27416
27416
|
}
|
|
27417
27417
|
if (!isRecord(run2) || typeof run2.id !== "string" || typeof run2.name !== "string") return null;
|
|
27418
27418
|
const rest = raw.slice(match[0].length);
|
|
27419
|
-
const
|
|
27420
|
-
return { kind: "automation", id: run2.id, name: run2.name, body, ...typeof run2.firedAt === "string" ? { firedAt: run2.firedAt } : {} };
|
|
27419
|
+
const body2 = stripReplicasInstructionBlock(rest.replace(SCHEDULED_FOLLOW_UP, ""));
|
|
27420
|
+
return { kind: "automation", id: run2.id, name: run2.name, body: body2, ...typeof run2.firedAt === "string" ? { firedAt: run2.firedAt } : {} };
|
|
27421
27421
|
}
|
|
27422
27422
|
function parseMessageOrigin(raw) {
|
|
27423
27423
|
const run2 = parseAutomationRun(raw);
|
|
@@ -29532,10 +29532,10 @@ ${indent}`) + "'";
|
|
|
29532
29532
|
literalFallback = true;
|
|
29533
29533
|
};
|
|
29534
29534
|
}
|
|
29535
|
-
const
|
|
29535
|
+
const body2 = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);
|
|
29536
29536
|
if (!literalFallback)
|
|
29537
29537
|
return `>${header}
|
|
29538
|
-
${indent}${
|
|
29538
|
+
${indent}${body2}`;
|
|
29539
29539
|
}
|
|
29540
29540
|
value = value.replace(/\n+/g, `$&${indent}`);
|
|
29541
29541
|
return `|${header}
|
|
@@ -31307,7 +31307,7 @@ var require_timestamp = __commonJS({
|
|
|
31307
31307
|
resolve: (str) => parseSexagesimal(str, false),
|
|
31308
31308
|
stringify: stringifySexagesimal
|
|
31309
31309
|
};
|
|
31310
|
-
var
|
|
31310
|
+
var timestamp2 = {
|
|
31311
31311
|
identify: (value) => value instanceof Date,
|
|
31312
31312
|
default: true,
|
|
31313
31313
|
tag: "tag:yaml.org,2002:timestamp",
|
|
@@ -31316,7 +31316,7 @@ var require_timestamp = __commonJS({
|
|
|
31316
31316
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
31317
31317
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
31318
31318
|
resolve(str) {
|
|
31319
|
-
const match = str.match(
|
|
31319
|
+
const match = str.match(timestamp2.test);
|
|
31320
31320
|
if (!match)
|
|
31321
31321
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
31322
31322
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
@@ -31335,7 +31335,7 @@ var require_timestamp = __commonJS({
|
|
|
31335
31335
|
};
|
|
31336
31336
|
exports2.floatTime = floatTime;
|
|
31337
31337
|
exports2.intTime = intTime;
|
|
31338
|
-
exports2.timestamp =
|
|
31338
|
+
exports2.timestamp = timestamp2;
|
|
31339
31339
|
}
|
|
31340
31340
|
});
|
|
31341
31341
|
|
|
@@ -31355,7 +31355,7 @@ var require_schema3 = __commonJS({
|
|
|
31355
31355
|
var omap = require_omap();
|
|
31356
31356
|
var pairs = require_pairs();
|
|
31357
31357
|
var set2 = require_set();
|
|
31358
|
-
var
|
|
31358
|
+
var timestamp2 = require_timestamp();
|
|
31359
31359
|
var schema = [
|
|
31360
31360
|
map2.map,
|
|
31361
31361
|
seq.seq,
|
|
@@ -31375,9 +31375,9 @@ var require_schema3 = __commonJS({
|
|
|
31375
31375
|
omap.omap,
|
|
31376
31376
|
pairs.pairs,
|
|
31377
31377
|
set2.set,
|
|
31378
|
-
|
|
31379
|
-
|
|
31380
|
-
|
|
31378
|
+
timestamp2.intTime,
|
|
31379
|
+
timestamp2.floatTime,
|
|
31380
|
+
timestamp2.timestamp
|
|
31381
31381
|
];
|
|
31382
31382
|
exports2.schema = schema;
|
|
31383
31383
|
}
|
|
@@ -31402,7 +31402,7 @@ var require_tags = __commonJS({
|
|
|
31402
31402
|
var pairs = require_pairs();
|
|
31403
31403
|
var schema$2 = require_schema3();
|
|
31404
31404
|
var set2 = require_set();
|
|
31405
|
-
var
|
|
31405
|
+
var timestamp2 = require_timestamp();
|
|
31406
31406
|
var schemas = /* @__PURE__ */ new Map([
|
|
31407
31407
|
["core", schema.schema],
|
|
31408
31408
|
["failsafe", [map2.map, seq.seq, string4.string]],
|
|
@@ -31416,11 +31416,11 @@ var require_tags = __commonJS({
|
|
|
31416
31416
|
float: float.float,
|
|
31417
31417
|
floatExp: float.floatExp,
|
|
31418
31418
|
floatNaN: float.floatNaN,
|
|
31419
|
-
floatTime:
|
|
31419
|
+
floatTime: timestamp2.floatTime,
|
|
31420
31420
|
int: int2.int,
|
|
31421
31421
|
intHex: int2.intHex,
|
|
31422
31422
|
intOct: int2.intOct,
|
|
31423
|
-
intTime:
|
|
31423
|
+
intTime: timestamp2.intTime,
|
|
31424
31424
|
map: map2.map,
|
|
31425
31425
|
merge: merge2.merge,
|
|
31426
31426
|
null: _null4.nullTag,
|
|
@@ -31428,7 +31428,7 @@ var require_tags = __commonJS({
|
|
|
31428
31428
|
pairs: pairs.pairs,
|
|
31429
31429
|
seq: seq.seq,
|
|
31430
31430
|
set: set2.set,
|
|
31431
|
-
timestamp:
|
|
31431
|
+
timestamp: timestamp2.timestamp
|
|
31432
31432
|
};
|
|
31433
31433
|
var coreKnownTags = {
|
|
31434
31434
|
"tag:yaml.org,2002:binary": binary.binary,
|
|
@@ -31436,7 +31436,7 @@ var require_tags = __commonJS({
|
|
|
31436
31436
|
"tag:yaml.org,2002:omap": omap.omap,
|
|
31437
31437
|
"tag:yaml.org,2002:pairs": pairs.pairs,
|
|
31438
31438
|
"tag:yaml.org,2002:set": set2.set,
|
|
31439
|
-
"tag:yaml.org,2002:timestamp":
|
|
31439
|
+
"tag:yaml.org,2002:timestamp": timestamp2.timestamp
|
|
31440
31440
|
};
|
|
31441
31441
|
function getTags(customTags, schemaName, addMergeTag) {
|
|
31442
31442
|
const schemaTags = schemas.get(schemaName);
|
|
@@ -31551,13 +31551,13 @@ var require_stringifyDocument = __commonJS({
|
|
|
31551
31551
|
contentComment = doc.contents.comment;
|
|
31552
31552
|
}
|
|
31553
31553
|
const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
|
|
31554
|
-
let
|
|
31554
|
+
let body2 = stringify.stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
|
|
31555
31555
|
if (contentComment)
|
|
31556
|
-
|
|
31557
|
-
if ((
|
|
31558
|
-
lines[lines.length - 1] = `--- ${
|
|
31556
|
+
body2 += stringifyComment.lineComment(body2, "", commentString(contentComment));
|
|
31557
|
+
if ((body2[0] === "|" || body2[0] === ">") && lines[lines.length - 1] === "---") {
|
|
31558
|
+
lines[lines.length - 1] = `--- ${body2}`;
|
|
31559
31559
|
} else
|
|
31560
|
-
lines.push(
|
|
31560
|
+
lines.push(body2);
|
|
31561
31561
|
} else {
|
|
31562
31562
|
lines.push(stringify.stringify(doc.contents, ctx));
|
|
31563
31563
|
}
|
|
@@ -33549,13 +33549,13 @@ var require_cst_scalar = __commonJS({
|
|
|
33549
33549
|
case ">": {
|
|
33550
33550
|
const he = source.indexOf("\n");
|
|
33551
33551
|
const head = source.substring(0, he);
|
|
33552
|
-
const
|
|
33552
|
+
const body2 = source.substring(he + 1) + "\n";
|
|
33553
33553
|
const props = [
|
|
33554
33554
|
{ type: "block-scalar-header", offset, indent, source: head }
|
|
33555
33555
|
];
|
|
33556
33556
|
if (!addEndtoBlockProps(props, end))
|
|
33557
33557
|
props.push({ type: "newline", offset: -1, indent, source: "\n" });
|
|
33558
|
-
return { type: "block-scalar", offset, indent, props, source:
|
|
33558
|
+
return { type: "block-scalar", offset, indent, props, source: body2 };
|
|
33559
33559
|
}
|
|
33560
33560
|
case '"':
|
|
33561
33561
|
return { type: "double-quoted-scalar", offset, indent, source, end };
|
|
@@ -33612,13 +33612,13 @@ var require_cst_scalar = __commonJS({
|
|
|
33612
33612
|
function setBlockScalarValue(token, source) {
|
|
33613
33613
|
const he = source.indexOf("\n");
|
|
33614
33614
|
const head = source.substring(0, he);
|
|
33615
|
-
const
|
|
33615
|
+
const body2 = source.substring(he + 1) + "\n";
|
|
33616
33616
|
if (token.type === "block-scalar") {
|
|
33617
33617
|
const header = token.props[0];
|
|
33618
33618
|
if (header.type !== "block-scalar-header")
|
|
33619
33619
|
throw new Error("Invalid block scalar header");
|
|
33620
33620
|
header.source = head;
|
|
33621
|
-
token.source =
|
|
33621
|
+
token.source = body2;
|
|
33622
33622
|
} else {
|
|
33623
33623
|
const { offset } = token;
|
|
33624
33624
|
const indent = "indent" in token ? token.indent : -1;
|
|
@@ -33630,7 +33630,7 @@ var require_cst_scalar = __commonJS({
|
|
|
33630
33630
|
for (const key of Object.keys(token))
|
|
33631
33631
|
if (key !== "type" && key !== "offset")
|
|
33632
33632
|
delete token[key];
|
|
33633
|
-
Object.assign(token, { type: "block-scalar", indent, props, source:
|
|
33633
|
+
Object.assign(token, { type: "block-scalar", indent, props, source: body2 });
|
|
33634
33634
|
}
|
|
33635
33635
|
}
|
|
33636
33636
|
function addEndtoBlockProps(props, end) {
|
|
@@ -35717,14 +35717,14 @@ var init_manager_board = __esm({
|
|
|
35717
35717
|
});
|
|
35718
35718
|
|
|
35719
35719
|
// ../shared/src/user-message-matching.ts
|
|
35720
|
-
function parseTimestampMs(
|
|
35721
|
-
if (typeof
|
|
35722
|
-
let value = parsedTimestamps.get(
|
|
35720
|
+
function parseTimestampMs(timestamp2) {
|
|
35721
|
+
if (typeof timestamp2 === "number") return Number.isFinite(timestamp2) ? timestamp2 : 0;
|
|
35722
|
+
let value = parsedTimestamps.get(timestamp2);
|
|
35723
35723
|
if (value === void 0) {
|
|
35724
|
-
const parsed = Date.parse(
|
|
35724
|
+
const parsed = Date.parse(timestamp2);
|
|
35725
35725
|
value = Number.isFinite(parsed) ? parsed : 0;
|
|
35726
35726
|
if (parsedTimestamps.size >= 5e4) parsedTimestamps.clear();
|
|
35727
|
-
parsedTimestamps.set(
|
|
35727
|
+
parsedTimestamps.set(timestamp2, value);
|
|
35728
35728
|
}
|
|
35729
35729
|
return value;
|
|
35730
35730
|
}
|
|
@@ -35866,8 +35866,8 @@ function findAnnotationsNote(content) {
|
|
|
35866
35866
|
}
|
|
35867
35867
|
return null;
|
|
35868
35868
|
}
|
|
35869
|
-
function parseAnnotationsNote(
|
|
35870
|
-
return
|
|
35869
|
+
function parseAnnotationsNote(body2) {
|
|
35870
|
+
return body2.split(ANNOTATION_HEADER_REGEX).slice(1).map((entry) => {
|
|
35871
35871
|
const lines = entry.trim().split("\n");
|
|
35872
35872
|
const file2 = lines[0]?.match(ANNOTATION_FILE_REGEX);
|
|
35873
35873
|
if (file2) lines.shift();
|
|
@@ -35965,12 +35965,12 @@ var init_user_message_attachments = __esm({
|
|
|
35965
35965
|
function isBytes(a) {
|
|
35966
35966
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
|
|
35967
35967
|
}
|
|
35968
|
-
function abytes(value, length,
|
|
35968
|
+
function abytes(value, length, title3 = "") {
|
|
35969
35969
|
const bytes = isBytes(value);
|
|
35970
35970
|
const len = value?.length;
|
|
35971
35971
|
const needsLen = length !== void 0;
|
|
35972
35972
|
if (!bytes || needsLen && len !== length) {
|
|
35973
|
-
const prefix =
|
|
35973
|
+
const prefix = title3 && `"${title3}" `;
|
|
35974
35974
|
const ofLen = needsLen ? ` of length ${length}` : "";
|
|
35975
35975
|
const got = bytes ? `length=${len}` : `type=${typeof value}`;
|
|
35976
35976
|
const message2 = prefix + "expected Uint8Array" + ofLen + ", got " + got;
|
|
@@ -37174,17 +37174,17 @@ var init_errors3 = __esm({
|
|
|
37174
37174
|
function formatInferenceError(message2, context = {}) {
|
|
37175
37175
|
const label = context.provider ? INFERENCE_PROVIDER_LABELS[context.provider] ?? context.provider : null;
|
|
37176
37176
|
const source = label ? `${label}${context.model ? ` (${context.model})` : ""} request failed${typeof context.status === "number" ? ` with HTTP ${context.status}` : ""}` : null;
|
|
37177
|
-
let
|
|
37177
|
+
let body2 = source ? message2 ? `${source}: ${message2}` : `${source}.` : message2;
|
|
37178
37178
|
const detail = context.detail?.trim();
|
|
37179
|
-
if (detail && !
|
|
37180
|
-
|
|
37179
|
+
if (detail && !body2.includes(detail)) {
|
|
37180
|
+
body2 = `${body2}
|
|
37181
37181
|
${detail.length > INFERENCE_ERROR_DETAIL_MAX ? `${detail.slice(0, INFERENCE_ERROR_DETAIL_MAX)}\u2026` : detail}`;
|
|
37182
37182
|
}
|
|
37183
37183
|
const sniffText = `${message2}
|
|
37184
37184
|
${detail ?? ""}`;
|
|
37185
37185
|
const transient = context.retryable ?? (typeof context.status === "number" ? TRANSIENT_HTTP_STATUSES.includes(context.status) || context.status >= 500 : isTransientErrorText(sniffText, { httpStatuses: TRANSIENT_HTTP_STATUSES, includeRateLimit: true }) || SERVER_ERROR_TEXT_PATTERN.test(sniffText));
|
|
37186
|
-
return transient ? `${
|
|
37187
|
-
${INFERENCE_ERROR_RETRY_HINT}` :
|
|
37186
|
+
return transient ? `${body2}
|
|
37187
|
+
${INFERENCE_ERROR_RETRY_HINT}` : body2;
|
|
37188
37188
|
}
|
|
37189
37189
|
var TRANSIENT_HTTP_STATUSES, SERVER_ERROR_TEXT_PATTERN, INFERENCE_ERROR_DETAIL_MAX, INFERENCE_ERROR_RETRY_HINT;
|
|
37190
37190
|
var init_inference_error = __esm({
|
|
@@ -37226,9 +37226,9 @@ function parseOpencodeEvents(events) {
|
|
|
37226
37226
|
const messages = [];
|
|
37227
37227
|
const inputState = { requests: /* @__PURE__ */ new Map(), resolutions: /* @__PURE__ */ new Map(), requestedAt: /* @__PURE__ */ new Map() };
|
|
37228
37228
|
const streamedParts = /* @__PURE__ */ new Map();
|
|
37229
|
-
const upsertStreamedPart = ({ id, type, text: text4, completed, timestamp }) => {
|
|
37229
|
+
const upsertStreamedPart = ({ id, type, text: text4, completed, timestamp: timestamp2 }) => {
|
|
37230
37230
|
if (!text4.trim()) return;
|
|
37231
|
-
upsertDisplayMessage(messages, type === "text" ? { id, type: "agent", content: text4, timestamp } : { id, type: "reasoning", content: text4, status: completed ? "completed" : "in_progress", timestamp });
|
|
37231
|
+
upsertDisplayMessage(messages, type === "text" ? { id, type: "agent", content: text4, timestamp: timestamp2 } : { id, type: "reasoning", content: text4, status: completed ? "completed" : "in_progress", timestamp: timestamp2 });
|
|
37232
37232
|
};
|
|
37233
37233
|
for (const event of events) {
|
|
37234
37234
|
if (event.type === "event_msg" && event.payload.type === "user_message") {
|
|
@@ -37301,14 +37301,14 @@ function parseOpencodeEvents(events) {
|
|
|
37301
37301
|
if (typeof part.callID === "string") id = `opencode-tool-${part.callID}`;
|
|
37302
37302
|
else if (typeof part.id === "string") id = `opencode-${part.id}`;
|
|
37303
37303
|
const time3 = isRecord(part.time) ? part.time : null;
|
|
37304
|
-
const
|
|
37304
|
+
const timestamp2 = timestampFromMs(time3?.start, event.timestamp);
|
|
37305
37305
|
if ((part.type === "text" || part.type === "reasoning") && typeof part.id === "string") {
|
|
37306
37306
|
const streamed = {
|
|
37307
37307
|
id,
|
|
37308
37308
|
type: part.type,
|
|
37309
37309
|
text: typeof part.text === "string" ? part.text : "",
|
|
37310
37310
|
completed: Boolean(time3?.end),
|
|
37311
|
-
timestamp
|
|
37311
|
+
timestamp: timestamp2
|
|
37312
37312
|
};
|
|
37313
37313
|
streamedParts.set(part.id, streamed);
|
|
37314
37314
|
upsertStreamedPart(streamed);
|
|
@@ -37328,7 +37328,7 @@ function parseOpencodeEvents(events) {
|
|
|
37328
37328
|
input: isRecord(input2) ? input2 : stringifyDisplayValue(input2),
|
|
37329
37329
|
output: output3,
|
|
37330
37330
|
status,
|
|
37331
|
-
timestamp
|
|
37331
|
+
timestamp: timestamp2
|
|
37332
37332
|
}));
|
|
37333
37333
|
continue;
|
|
37334
37334
|
}
|
|
@@ -37340,7 +37340,7 @@ function parseOpencodeEvents(events) {
|
|
|
37340
37340
|
type: "file_change",
|
|
37341
37341
|
changes: files.map((path11) => ({ path: path11, kind: "update" })),
|
|
37342
37342
|
status: "completed",
|
|
37343
|
-
timestamp
|
|
37343
|
+
timestamp: timestamp2
|
|
37344
37344
|
});
|
|
37345
37345
|
}
|
|
37346
37346
|
}
|
|
@@ -37706,16 +37706,16 @@ function contentBlocks(value) {
|
|
|
37706
37706
|
function blockImages(blocks) {
|
|
37707
37707
|
return blocks.flatMap((block) => block.type === "image" && typeof block.data === "string" && typeof block.mimeType === "string" ? [{ type: "image", mediaType: block.mimeType, data: block.data }] : []);
|
|
37708
37708
|
}
|
|
37709
|
-
function toolCallMessage(id, name, args,
|
|
37709
|
+
function toolCallMessage(id, name, args, timestamp2, result) {
|
|
37710
37710
|
const status = !result ? "in_progress" : result.isError ? "failed" : "completed";
|
|
37711
37711
|
if (name === "bash" && typeof args.command === "string") {
|
|
37712
|
-
return { id, type: "command", command: args.command, output: result?.output, ...result?.exitCode !== void 0 ? { exitCode: result.exitCode } : {}, status, timestamp };
|
|
37712
|
+
return { id, type: "command", command: args.command, output: result?.output, ...result?.exitCode !== void 0 ? { exitCode: result.exitCode } : {}, status, timestamp: timestamp2 };
|
|
37713
37713
|
}
|
|
37714
37714
|
if ((name === "write" || name === "edit") && typeof args.path === "string") {
|
|
37715
|
-
return { id, type: "file_change", changes: [{ path: args.path, kind: name === "write" ? "add" : "update" }], status, timestamp };
|
|
37715
|
+
return { id, type: "file_change", changes: [{ path: args.path, kind: name === "write" ? "add" : "update" }], status, timestamp: timestamp2 };
|
|
37716
37716
|
}
|
|
37717
37717
|
if (name === "web_search" && typeof args.query === "string") {
|
|
37718
|
-
return { id, type: "web_search", query: args.query, status, timestamp };
|
|
37718
|
+
return { id, type: "web_search", query: args.query, status, timestamp: timestamp2 };
|
|
37719
37719
|
}
|
|
37720
37720
|
if (name === "spawn_agent") {
|
|
37721
37721
|
const spawned = result?.output ? (() => {
|
|
@@ -37725,9 +37725,9 @@ function toolCallMessage(id, name, args, timestamp, result) {
|
|
|
37725
37725
|
return null;
|
|
37726
37726
|
}
|
|
37727
37727
|
})() : null;
|
|
37728
|
-
return { id, type: "subagent", toolUseId: id, description: typeof args.title === "string" ? args.title : "Replicas subagent", prompt: typeof args.prompt === "string" ? args.prompt : "", subagentType: "replicas", model: typeof args.model === "string" ? args.model : void 0, receiverThreadIds: isRecord(spawned) && typeof spawned.agentId === "string" ? [spawned.agentId] : void 0, status: result?.isError ? "failed" : "in_progress", nestedEvents: [], timestamp };
|
|
37728
|
+
return { id, type: "subagent", toolUseId: id, description: typeof args.title === "string" ? args.title : "Replicas subagent", prompt: typeof args.prompt === "string" ? args.prompt : "", subagentType: "replicas", model: typeof args.model === "string" ? args.model : void 0, receiverThreadIds: isRecord(spawned) && typeof spawned.agentId === "string" ? [spawned.agentId] : void 0, status: result?.isError ? "failed" : "in_progress", nestedEvents: [], timestamp: timestamp2 };
|
|
37729
37729
|
}
|
|
37730
|
-
return createCallDisplayMessage({ id, server: "replicas", tool: name, input: args, output: result?.output, status, timestamp });
|
|
37730
|
+
return createCallDisplayMessage({ id, server: "replicas", tool: name, input: args, output: result?.output, status, timestamp: timestamp2 });
|
|
37731
37731
|
}
|
|
37732
37732
|
function parseReplicasEvents(events) {
|
|
37733
37733
|
const messages = [];
|
|
@@ -37736,20 +37736,20 @@ function parseReplicasEvents(events) {
|
|
|
37736
37736
|
const streamEndedMs = latestMs(["assistant_message", "error", "status"].map((type) => `${HARNESS_EVENT_TYPE_PREFIX}${type}`));
|
|
37737
37737
|
const livePartialMs = latestMs([CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE]);
|
|
37738
37738
|
events.forEach((event) => {
|
|
37739
|
-
const { payload, timestamp } = event;
|
|
37739
|
+
const { payload, timestamp: timestamp2 } = event;
|
|
37740
37740
|
const message2 = isRecord(payload.message) ? payload.message : {};
|
|
37741
37741
|
switch (event.type) {
|
|
37742
37742
|
// The client's copy of a sent prompt, shown until the worker saves it under the same message id.
|
|
37743
37743
|
case "event_msg": {
|
|
37744
37744
|
if (payload.type !== "user_message" || typeof payload.message !== "string") return;
|
|
37745
37745
|
const images = userMessageImages(payload.images);
|
|
37746
|
-
messages.push({ id: getUserMessageId(event) ?? `replicas-pending-${
|
|
37746
|
+
messages.push({ id: getUserMessageId(event) ?? `replicas-pending-${timestamp2}`, type: "user", content: payload.message, ...images ? { images } : {}, timestamp: timestamp2 });
|
|
37747
37747
|
return;
|
|
37748
37748
|
}
|
|
37749
37749
|
case `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message`:
|
|
37750
37750
|
case `${HARNESS_EVENT_TYPE_PREFIX}user_message`: {
|
|
37751
37751
|
if (isRecord(payload.agentOutcome)) {
|
|
37752
|
-
messages.push({ id: `replicas-peer-${String(payload.seq)}`, type: "peer_message", direction: "received", chat: typeof payload.agentOutcome.agentId === "string" ? payload.agentOutcome.agentId : void 0, content: extractToolResultText(message2.content), timestamp });
|
|
37752
|
+
messages.push({ id: `replicas-peer-${String(payload.seq)}`, type: "peer_message", direction: "received", chat: typeof payload.agentOutcome.agentId === "string" ? payload.agentOutcome.agentId : void 0, content: extractToolResultText(message2.content), timestamp: timestamp2 });
|
|
37753
37753
|
for (const item of messages) {
|
|
37754
37754
|
if (item.type === "subagent" && item.receiverThreadIds?.includes(String(payload.agentOutcome.agentId))) {
|
|
37755
37755
|
item.status = payload.agentOutcome.status === "completed" ? "completed" : payload.agentOutcome.status === "help" ? "in_progress" : "failed";
|
|
@@ -37765,19 +37765,19 @@ function parseReplicasEvents(events) {
|
|
|
37765
37765
|
type: "user",
|
|
37766
37766
|
content: `${event.type === `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message` ? "[Cancelled before it started]\n\n" : ""}${extractToolResultText(message2.content)}`,
|
|
37767
37767
|
...images.length ? { images } : {},
|
|
37768
|
-
timestamp
|
|
37768
|
+
timestamp: timestamp2
|
|
37769
37769
|
});
|
|
37770
37770
|
return;
|
|
37771
37771
|
}
|
|
37772
37772
|
case `${HARNESS_EVENT_TYPE_PREFIX}assistant_message`: {
|
|
37773
37773
|
contentBlocks(message2.content).forEach((block, blockIndex) => {
|
|
37774
37774
|
const id = `replicas-${String(payload.seq)}-${blockIndex}`;
|
|
37775
|
-
if (block.type === "text" && typeof block.text === "string" && block.text) messages.push({ id, type: "agent", content: block.text, timestamp });
|
|
37776
|
-
if (block.type === "thinking" && typeof block.thinking === "string" && block.thinking) messages.push({ id, type: "reasoning", content: block.thinking, status: "completed", timestamp });
|
|
37775
|
+
if (block.type === "text" && typeof block.text === "string" && block.text) messages.push({ id, type: "agent", content: block.text, timestamp: timestamp2 });
|
|
37776
|
+
if (block.type === "thinking" && typeof block.thinking === "string" && block.thinking) messages.push({ id, type: "reasoning", content: block.thinking, status: "completed", timestamp: timestamp2 });
|
|
37777
37777
|
if (block.type === "toolCall" && typeof block.id === "string" && typeof block.name === "string") {
|
|
37778
|
-
const call = { name: block.name, args: isRecord(block.arguments) ? block.arguments : {}, timestamp };
|
|
37778
|
+
const call = { name: block.name, args: isRecord(block.arguments) ? block.arguments : {}, timestamp: timestamp2 };
|
|
37779
37779
|
toolCalls.set(block.id, call);
|
|
37780
|
-
messages.push(toolCallMessage(`replicas-tool-${block.id}`, call.name, call.args,
|
|
37780
|
+
messages.push(toolCallMessage(`replicas-tool-${block.id}`, call.name, call.args, timestamp2));
|
|
37781
37781
|
}
|
|
37782
37782
|
});
|
|
37783
37783
|
if (message2.stopReason === "error") {
|
|
@@ -37788,14 +37788,14 @@ function parseReplicasEvents(events) {
|
|
|
37788
37788
|
...typeof message2.provider === "string" ? { provider: message2.provider } : {},
|
|
37789
37789
|
...typeof message2.model === "string" ? { model: message2.model } : {}
|
|
37790
37790
|
}),
|
|
37791
|
-
timestamp
|
|
37791
|
+
timestamp: timestamp2
|
|
37792
37792
|
});
|
|
37793
37793
|
}
|
|
37794
37794
|
return;
|
|
37795
37795
|
}
|
|
37796
37796
|
case `${HARNESS_EVENT_TYPE_PREFIX}tool_result`: {
|
|
37797
37797
|
if (typeof message2.toolCallId !== "string") return;
|
|
37798
|
-
const call = toolCalls.get(message2.toolCallId) ?? { name: typeof message2.toolName === "string" ? message2.toolName : "tool", args: {}, timestamp };
|
|
37798
|
+
const call = toolCalls.get(message2.toolCallId) ?? { name: typeof message2.toolName === "string" ? message2.toolName : "tool", args: {}, timestamp: timestamp2 };
|
|
37799
37799
|
const exitCode = isRecord(message2.details) && typeof message2.details.exitCode === "number" ? message2.details.exitCode : void 0;
|
|
37800
37800
|
upsertDisplayMessage(messages, toolCallMessage(`replicas-tool-${message2.toolCallId}`, call.name, call.args, call.timestamp, {
|
|
37801
37801
|
output: extractToolResultText(message2.content) || void 0,
|
|
@@ -37805,16 +37805,16 @@ function parseReplicasEvents(events) {
|
|
|
37805
37805
|
return;
|
|
37806
37806
|
}
|
|
37807
37807
|
case `${HARNESS_EVENT_TYPE_PREFIX}compaction`:
|
|
37808
|
-
messages.push({ id: `replicas-compaction-${String(payload.seq)}`, type: "reasoning", content: COMPACTION_CONTENT, status: "completed", timestamp, completedAt:
|
|
37808
|
+
messages.push({ id: `replicas-compaction-${String(payload.seq)}`, type: "reasoning", content: COMPACTION_CONTENT, status: "completed", timestamp: timestamp2, completedAt: timestamp2 });
|
|
37809
37809
|
return;
|
|
37810
37810
|
case `${HARNESS_EVENT_TYPE_PREFIX}error`:
|
|
37811
|
-
messages.push({ id: `replicas-error-${String(payload.seq)}`, type: "error", message: stringifyDisplayValue(payload.message) ?? "The agent stopped with an error", timestamp });
|
|
37811
|
+
messages.push({ id: `replicas-error-${String(payload.seq)}`, type: "error", message: stringifyDisplayValue(payload.message) ?? "The agent stopped with an error", timestamp: timestamp2 });
|
|
37812
37812
|
return;
|
|
37813
37813
|
case CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE: {
|
|
37814
37814
|
const partial2 = coerceClaudePartialMessagePayload(payload);
|
|
37815
37815
|
if (!partial2 || Date.parse(event.timestamp) <= streamEndedMs || Date.parse(event.timestamp) < livePartialMs) return;
|
|
37816
|
-
if (partial2.thinking) upsertDisplayMessage(messages, { id: `replicas-partial-${partial2.streamId}-thinking`, type: "reasoning", content: partial2.thinking, status: "in_progress", timestamp });
|
|
37817
|
-
if (partial2.text) upsertDisplayMessage(messages, { id: `replicas-partial-${partial2.streamId}`, type: "agent", content: partial2.text, timestamp });
|
|
37816
|
+
if (partial2.thinking) upsertDisplayMessage(messages, { id: `replicas-partial-${partial2.streamId}-thinking`, type: "reasoning", content: partial2.thinking, status: "in_progress", timestamp: timestamp2 });
|
|
37817
|
+
if (partial2.text) upsertDisplayMessage(messages, { id: `replicas-partial-${partial2.streamId}`, type: "agent", content: partial2.text, timestamp: timestamp2 });
|
|
37818
37818
|
return;
|
|
37819
37819
|
}
|
|
37820
37820
|
}
|
|
@@ -37837,14 +37837,14 @@ var init_replicas_parser = __esm({
|
|
|
37837
37837
|
});
|
|
37838
37838
|
|
|
37839
37839
|
// ../shared/src/display-message/parsers/claude-parser.ts
|
|
37840
|
-
function fileOrCommandMessage(block,
|
|
37840
|
+
function fileOrCommandMessage(block, timestamp2) {
|
|
37841
37841
|
let template = toolMessageTemplates.get(block);
|
|
37842
37842
|
if (!template) {
|
|
37843
37843
|
const input2 = typeof block.input === "string" ? safeJsonParse(block.input, {}) : block.input ?? {};
|
|
37844
37844
|
template = toolMessageTemplate(block.name ?? "", block.id ?? "", input2);
|
|
37845
37845
|
toolMessageTemplates.set(block, template);
|
|
37846
37846
|
}
|
|
37847
|
-
return { ...template, timestamp };
|
|
37847
|
+
return { ...template, timestamp: timestamp2 };
|
|
37848
37848
|
}
|
|
37849
37849
|
function toolMessageTemplate(toolName, toolUseId, input2) {
|
|
37850
37850
|
if (COMMAND_TOOL_NAMES.has(toolName)) {
|
|
@@ -37888,17 +37888,17 @@ function toolMessageTemplate(toolName, toolUseId, input2) {
|
|
|
37888
37888
|
status: "in_progress"
|
|
37889
37889
|
};
|
|
37890
37890
|
}
|
|
37891
|
-
function createSubagentMessage(
|
|
37892
|
-
return { id: `subagent-${fields.toolUseId}`, type: "subagent", ...fields, timestamp };
|
|
37891
|
+
function createSubagentMessage(timestamp2, fields) {
|
|
37892
|
+
return { id: `subagent-${fields.toolUseId}`, type: "subagent", ...fields, timestamp: timestamp2 };
|
|
37893
37893
|
}
|
|
37894
37894
|
function groupNestedEvents(events) {
|
|
37895
37895
|
const nested = /* @__PURE__ */ new Map();
|
|
37896
|
-
for (const { timestamp, type, payload } of events) {
|
|
37896
|
+
for (const { timestamp: timestamp2, type, payload } of events) {
|
|
37897
37897
|
const parent = payload.parent_tool_use_id;
|
|
37898
37898
|
if (typeof parent !== "string") continue;
|
|
37899
37899
|
const siblings = nested.get(parent);
|
|
37900
|
-
if (siblings) siblings.push({ timestamp, type, payload });
|
|
37901
|
-
else nested.set(parent, [{ timestamp, type, payload }]);
|
|
37900
|
+
if (siblings) siblings.push({ timestamp: timestamp2, type, payload });
|
|
37901
|
+
else nested.set(parent, [{ timestamp: timestamp2, type, payload }]);
|
|
37902
37902
|
}
|
|
37903
37903
|
return nested;
|
|
37904
37904
|
}
|
|
@@ -38011,14 +38011,14 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
38011
38011
|
const canonicalUserMessageIndexes = /* @__PURE__ */ new Set();
|
|
38012
38012
|
const supersededUserMessageIndexes = /* @__PURE__ */ new Set();
|
|
38013
38013
|
const stampedUserMessages = /* @__PURE__ */ new Set();
|
|
38014
|
-
const findMatchingUserMessageIndex = (indexes, content,
|
|
38014
|
+
const findMatchingUserMessageIndex = (indexes, content, timestamp2, messageId) => {
|
|
38015
38015
|
if (typeof messageId === "string") {
|
|
38016
38016
|
const byId = indexesOf(messageId).find((index) => messages[index].type === "user" && !supersededUserMessageIndexes.has(index));
|
|
38017
38017
|
if (byId !== void 0) return byId;
|
|
38018
38018
|
}
|
|
38019
38019
|
for (const index of indexes) {
|
|
38020
38020
|
const message2 = messages[index];
|
|
38021
|
-
if (message2?.type === "user" && !(typeof messageId === "string" && stampedUserMessages.has(message2)) && areUserMessagesWithinMatchWindow(message2, { content, timestamp })) return index;
|
|
38021
|
+
if (message2?.type === "user" && !(typeof messageId === "string" && stampedUserMessages.has(message2)) && areUserMessagesWithinMatchWindow(message2, { content, timestamp: timestamp2 })) return index;
|
|
38022
38022
|
}
|
|
38023
38023
|
return void 0;
|
|
38024
38024
|
};
|
|
@@ -38091,8 +38091,8 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
38091
38091
|
return;
|
|
38092
38092
|
}
|
|
38093
38093
|
if (event.type === CLAUDE_PEER_MESSAGE_EVENT_TYPE) {
|
|
38094
|
-
const { name, from, body } = event.payload;
|
|
38095
|
-
if (typeof
|
|
38094
|
+
const { name, from, body: body2 } = event.payload;
|
|
38095
|
+
if (typeof body2 !== "string") return;
|
|
38096
38096
|
if (typeof name === "string" && typeof from === "string") peerNames.set(from, name);
|
|
38097
38097
|
const sameTime = peerTimestamps.get(event.timestamp) ?? 0;
|
|
38098
38098
|
peerTimestamps.set(event.timestamp, sameTime + 1);
|
|
@@ -38101,7 +38101,7 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
38101
38101
|
type: "peer_message",
|
|
38102
38102
|
direction: "received",
|
|
38103
38103
|
...typeof name === "string" ? { chat: name } : {},
|
|
38104
|
-
content:
|
|
38104
|
+
content: body2,
|
|
38105
38105
|
timestamp: event.timestamp
|
|
38106
38106
|
});
|
|
38107
38107
|
return;
|
|
@@ -38404,10 +38404,10 @@ function parseClaudeEvents(events, parentToolUseId) {
|
|
|
38404
38404
|
};
|
|
38405
38405
|
}
|
|
38406
38406
|
});
|
|
38407
|
-
for (const [streamId, { tool, timestamp }] of streamingTools) {
|
|
38407
|
+
for (const [streamId, { tool, timestamp: timestamp2 }] of streamingTools) {
|
|
38408
38408
|
if (toolCallMap.has(tool.id) || supersededStreamIds.has(streamId)) continue;
|
|
38409
38409
|
if (!COMMAND_TOOL_NAMES.has(tool.name) && !FILE_TOOL_NAMES.has(tool.name)) continue;
|
|
38410
|
-
messages.push(fileOrCommandMessage({ type: "tool_use", id: tool.id, name: tool.name, input: "filePath" in tool ? { file_path: tool.filePath } : { command: tool.command } },
|
|
38410
|
+
messages.push(fileOrCommandMessage({ type: "tool_use", id: tool.id, name: tool.name, input: "filePath" in tool ? { file_path: tool.filePath } : { command: tool.command } }, timestamp2));
|
|
38411
38411
|
}
|
|
38412
38412
|
filteredEvents.forEach((event) => {
|
|
38413
38413
|
const result = readToolResult(event);
|
|
@@ -39732,7 +39732,7 @@ var CLI_VERSION;
|
|
|
39732
39732
|
var init_cli_version = __esm({
|
|
39733
39733
|
"../shared/src/cli-version.ts"() {
|
|
39734
39734
|
"use strict";
|
|
39735
|
-
CLI_VERSION = "0.3.
|
|
39735
|
+
CLI_VERSION = "0.3.498";
|
|
39736
39736
|
}
|
|
39737
39737
|
});
|
|
39738
39738
|
|
|
@@ -39809,7 +39809,7 @@ var init_exec_protocol = __esm({
|
|
|
39809
39809
|
/** Kill after this long with nobody attached. */
|
|
39810
39810
|
idleTtlMs: external_exports.number().int().positive().max(EXEC_MAX_IDLE_TTL_MS).optional(),
|
|
39811
39811
|
stdin: external_exports.boolean().optional()
|
|
39812
|
-
}).refine((
|
|
39812
|
+
}).refine((body2) => [body2.command, body2.argv, body2.mcpServer].filter((value) => value !== void 0).length === 1, { message: "Pass exactly one of command, argv or mcpServer" });
|
|
39813
39813
|
execStartedSchema = external_exports.object({ processId: external_exports.string(), pid: external_exports.number() });
|
|
39814
39814
|
execExitSchema = external_exports.object({ exitCode: external_exports.number(), signal: external_exports.string().nullable(), reason: external_exports.enum(["exit", "timeout", "killed", "idle"]) });
|
|
39815
39815
|
execReplySchemas = {
|
|
@@ -40188,7 +40188,7 @@ var init_scout2 = __esm({
|
|
|
40188
40188
|
preset_id: external_exports.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
|
|
40189
40189
|
});
|
|
40190
40190
|
RESET_TO_DEFAULT = "default";
|
|
40191
|
-
resettable = (schema,
|
|
40191
|
+
resettable = (schema, description2) => external_exports.union([schema, external_exports.literal(RESET_TO_DEFAULT)]).optional().describe(`${description2} \`${RESET_TO_DEFAULT}\` falls back to the organization default. Omit to keep it.`);
|
|
40192
40192
|
scoutSetSlackAgentDefaultsToolInputSchema = scoutSettingsConfirmationSchema.extend({
|
|
40193
40193
|
agent_provider: resettable(external_exports.enum(VALID_AGENT_PROVIDERS), "Agent for Slack-triggered workspaces. Changing it without `model` resets the model to that agent's default."),
|
|
40194
40194
|
model: resettable(external_exports.string(), "Model id for that agent; the default is the agent's own."),
|
|
@@ -40394,6 +40394,7 @@ var init_workspace_events = __esm({
|
|
|
40394
40394
|
ts: external_exports.string()
|
|
40395
40395
|
}),
|
|
40396
40396
|
external_exports.object({ type: external_exports.enum(["manager.board.changed", "mothership.board.changed"]), workspaceId: external_exports.string(), ts: external_exports.string() }),
|
|
40397
|
+
external_exports.object({ type: external_exports.literal("issues.synced"), syncId: external_exports.number(), ts: external_exports.string() }),
|
|
40397
40398
|
external_exports.object({ type: external_exports.literal("needs-you.changed"), workspaceId: external_exports.string().nullable(), userId: external_exports.string().optional(), ts: external_exports.string() }),
|
|
40398
40399
|
external_exports.object({
|
|
40399
40400
|
type: external_exports.literal("workspace.shared"),
|
|
@@ -40545,8 +40546,8 @@ var init_github_checks = __esm({
|
|
|
40545
40546
|
});
|
|
40546
40547
|
|
|
40547
40548
|
// ../shared/src/automations/agent-validation.ts
|
|
40548
|
-
function validateAgentSelection(
|
|
40549
|
-
const agentProvider =
|
|
40549
|
+
function validateAgentSelection(body2, existing, allowedProviders, modelCatalogs = {}) {
|
|
40550
|
+
const agentProvider = body2.agent_provider;
|
|
40550
40551
|
if (agentProvider !== void 0 && agentProvider !== null) {
|
|
40551
40552
|
if (!isValidAgentProvider(agentProvider) || !allowedProviders.includes(agentProvider)) {
|
|
40552
40553
|
return createErrorResult({ message: `Invalid agent_provider: must be one of ${allowedProviders.join(", ")}` });
|
|
@@ -40554,11 +40555,11 @@ function validateAgentSelection(body, existing, allowedProviders, modelCatalogs
|
|
|
40554
40555
|
}
|
|
40555
40556
|
const executionAgent = agentProvider !== void 0 ? agentProvider : existing.agentProvider;
|
|
40556
40557
|
const agentChanged = agentProvider !== void 0 && agentProvider !== existing.agentProvider;
|
|
40557
|
-
let model2 =
|
|
40558
|
+
let model2 = body2.model;
|
|
40558
40559
|
if (agentChanged && model2 === void 0 && existing.model) {
|
|
40559
40560
|
model2 = null;
|
|
40560
40561
|
}
|
|
40561
|
-
let thinkingLevel2 =
|
|
40562
|
+
let thinkingLevel2 = body2.thinking_level;
|
|
40562
40563
|
if (agentChanged && thinkingLevel2 === void 0 && existing.thinkingLevel && executionAgent && !getThinkingLevelOptions(executionAgent).includes(existing.thinkingLevel)) {
|
|
40563
40564
|
thinkingLevel2 = null;
|
|
40564
40565
|
}
|
|
@@ -47793,7 +47794,7 @@ var require_CronDate = __commonJS({
|
|
|
47793
47794
|
* @param {CronDate | Date | number | string} [timestamp] - The timestamp to initialize the CronDate with.
|
|
47794
47795
|
* @param {string} [tz] - The timezone to use for the CronDate.
|
|
47795
47796
|
*/
|
|
47796
|
-
constructor(
|
|
47797
|
+
constructor(timestamp2, tz) {
|
|
47797
47798
|
__privateAdd(this, _CronDate_instances);
|
|
47798
47799
|
__privateAdd(this, _date2);
|
|
47799
47800
|
__privateAdd(this, _dstStart, null);
|
|
@@ -47820,24 +47821,24 @@ var require_CronDate = __commonJS({
|
|
|
47820
47821
|
}
|
|
47821
47822
|
});
|
|
47822
47823
|
const dateOpts = { zone: tz };
|
|
47823
|
-
if (!
|
|
47824
|
+
if (!timestamp2) {
|
|
47824
47825
|
__privateSet(this, _date2, luxon_1.DateTime.local());
|
|
47825
|
-
} else if (
|
|
47826
|
-
__privateSet(this, _date2, __privateGet(
|
|
47827
|
-
__privateSet(this, _dstStart, __privateGet(
|
|
47828
|
-
__privateSet(this, _dstEnd, __privateGet(
|
|
47829
|
-
} else if (
|
|
47830
|
-
__privateSet(this, _date2, luxon_1.DateTime.fromJSDate(
|
|
47831
|
-
} else if (typeof
|
|
47832
|
-
__privateSet(this, _date2, luxon_1.DateTime.fromMillis(
|
|
47826
|
+
} else if (timestamp2 instanceof _CronDate) {
|
|
47827
|
+
__privateSet(this, _date2, __privateGet(timestamp2, _date2));
|
|
47828
|
+
__privateSet(this, _dstStart, __privateGet(timestamp2, _dstStart));
|
|
47829
|
+
__privateSet(this, _dstEnd, __privateGet(timestamp2, _dstEnd));
|
|
47830
|
+
} else if (timestamp2 instanceof Date) {
|
|
47831
|
+
__privateSet(this, _date2, luxon_1.DateTime.fromJSDate(timestamp2, dateOpts));
|
|
47832
|
+
} else if (typeof timestamp2 === "number") {
|
|
47833
|
+
__privateSet(this, _date2, luxon_1.DateTime.fromMillis(timestamp2, dateOpts));
|
|
47833
47834
|
} else {
|
|
47834
|
-
__privateSet(this, _date2, luxon_1.DateTime.fromISO(
|
|
47835
|
-
__privateGet(this, _date2).isValid || __privateSet(this, _date2, luxon_1.DateTime.fromRFC2822(
|
|
47836
|
-
__privateGet(this, _date2).isValid || __privateSet(this, _date2, luxon_1.DateTime.fromSQL(
|
|
47837
|
-
__privateGet(this, _date2).isValid || __privateSet(this, _date2, luxon_1.DateTime.fromFormat(
|
|
47835
|
+
__privateSet(this, _date2, luxon_1.DateTime.fromISO(timestamp2, dateOpts));
|
|
47836
|
+
__privateGet(this, _date2).isValid || __privateSet(this, _date2, luxon_1.DateTime.fromRFC2822(timestamp2, dateOpts));
|
|
47837
|
+
__privateGet(this, _date2).isValid || __privateSet(this, _date2, luxon_1.DateTime.fromSQL(timestamp2, dateOpts));
|
|
47838
|
+
__privateGet(this, _date2).isValid || __privateSet(this, _date2, luxon_1.DateTime.fromFormat(timestamp2, "EEE, d MMM yyyy HH:mm:ss", dateOpts));
|
|
47838
47839
|
}
|
|
47839
47840
|
if (!__privateGet(this, _date2).isValid) {
|
|
47840
|
-
throw new Error(`CronDate: unhandled timestamp: ${
|
|
47841
|
+
throw new Error(`CronDate: unhandled timestamp: ${timestamp2}`);
|
|
47841
47842
|
}
|
|
47842
47843
|
if (tz && tz !== __privateGet(this, _date2).zoneName) {
|
|
47843
47844
|
__privateSet(this, _date2, __privateGet(this, _date2).setZone(tz));
|
|
@@ -50301,6 +50302,223 @@ var init_feature_flags = __esm({
|
|
|
50301
50302
|
}
|
|
50302
50303
|
});
|
|
50303
50304
|
|
|
50305
|
+
// ../shared/src/routes/issues.ts
|
|
50306
|
+
var ISSUE_STATUSES, ISSUE_PRIORITIES, ISSUE_ACTOR_TYPES, ISSUE_SUBSCRIBER_ROLES, ISSUE_RELATION_TYPES, ISSUE_PULL_REQUEST_STATES, issueStatusSchema, issuePrioritySchema, issueSubscriberRoleSchema, issueRelationTypeSchema, issuePullRequestStateSchema, issueActorSchema, ISSUE_KEY_RE, timestamp, nullableTimestamp, issueSchema2, issueSubscriberSchema, issueRelationSchema, issuePullRequestSchema, issueCommentSchema, change, nullableId, ISSUE_EVENT_TYPES, issueEventDataSchemas, issueEventBase, issueEventVariant, issueEventSchema, clientMutationId, title2, description, body, createIssueRequestSchema, updateIssueRequestSchema, issueActorRequestSchema, createIssueCommentRequestSchema, updateIssueCommentRequestSchema, createIssueRelationRequestSchema, linkIssuePullRequestRequestSchema, updateIssuePullRequestRequestSchema, issueMutationRequestSchema, updateIssueSettingsRequestSchema, listIssuesQuerySchema, issuesDeltaQuerySchema;
|
|
50307
|
+
var init_issues = __esm({
|
|
50308
|
+
"../shared/src/routes/issues.ts"() {
|
|
50309
|
+
"use strict";
|
|
50310
|
+
init_zod();
|
|
50311
|
+
ISSUE_STATUSES = ["backlog", "todo", "in_progress", "in_review", "done", "canceled", "duplicate"];
|
|
50312
|
+
ISSUE_PRIORITIES = ["none", "urgent", "high", "medium", "low"];
|
|
50313
|
+
ISSUE_ACTOR_TYPES = ["user", "workspace"];
|
|
50314
|
+
ISSUE_SUBSCRIBER_ROLES = ["assignee", "creator", "mentioned", "manual"];
|
|
50315
|
+
ISSUE_RELATION_TYPES = ["blocks", "duplicate_of"];
|
|
50316
|
+
ISSUE_PULL_REQUEST_STATES = ["draft", "open", "merged", "closed"];
|
|
50317
|
+
issueStatusSchema = external_exports.enum(ISSUE_STATUSES);
|
|
50318
|
+
issuePrioritySchema = external_exports.enum(ISSUE_PRIORITIES);
|
|
50319
|
+
issueSubscriberRoleSchema = external_exports.enum(ISSUE_SUBSCRIBER_ROLES);
|
|
50320
|
+
issueRelationTypeSchema = external_exports.enum(ISSUE_RELATION_TYPES);
|
|
50321
|
+
issuePullRequestStateSchema = external_exports.enum(ISSUE_PULL_REQUEST_STATES);
|
|
50322
|
+
issueActorSchema = external_exports.object({
|
|
50323
|
+
type: external_exports.enum(ISSUE_ACTOR_TYPES),
|
|
50324
|
+
id: external_exports.string().toLowerCase().uuid()
|
|
50325
|
+
});
|
|
50326
|
+
ISSUE_KEY_RE = /^[A-Z][A-Z0-9]{0,9}$/;
|
|
50327
|
+
timestamp = external_exports.string();
|
|
50328
|
+
nullableTimestamp = timestamp.nullable();
|
|
50329
|
+
issueSchema2 = external_exports.object({
|
|
50330
|
+
id: external_exports.string().uuid(),
|
|
50331
|
+
organization_id: external_exports.string().uuid(),
|
|
50332
|
+
number: external_exports.number().int(),
|
|
50333
|
+
identifier: external_exports.string(),
|
|
50334
|
+
title: external_exports.string(),
|
|
50335
|
+
description: external_exports.string(),
|
|
50336
|
+
status: issueStatusSchema,
|
|
50337
|
+
priority: issuePrioritySchema,
|
|
50338
|
+
parent_id: external_exports.string().uuid().nullable(),
|
|
50339
|
+
manager_id: external_exports.string().uuid().nullable(),
|
|
50340
|
+
creator: issueActorSchema,
|
|
50341
|
+
/** Fractional: to move an issue between two others, send the midpoint of their sort orders. */
|
|
50342
|
+
sort_order: external_exports.number(),
|
|
50343
|
+
created_at: timestamp,
|
|
50344
|
+
updated_at: timestamp,
|
|
50345
|
+
completed_at: nullableTimestamp,
|
|
50346
|
+
canceled_at: nullableTimestamp,
|
|
50347
|
+
archived_at: nullableTimestamp
|
|
50348
|
+
});
|
|
50349
|
+
issueSubscriberSchema = external_exports.object({
|
|
50350
|
+
issue_id: external_exports.string().uuid(),
|
|
50351
|
+
subscriber: issueActorSchema,
|
|
50352
|
+
role: issueSubscriberRoleSchema,
|
|
50353
|
+
created_at: timestamp
|
|
50354
|
+
});
|
|
50355
|
+
issueRelationSchema = external_exports.object({
|
|
50356
|
+
id: external_exports.string().uuid(),
|
|
50357
|
+
type: issueRelationTypeSchema,
|
|
50358
|
+
issue_id: external_exports.string().uuid(),
|
|
50359
|
+
related_issue_id: external_exports.string().uuid(),
|
|
50360
|
+
created_at: timestamp
|
|
50361
|
+
});
|
|
50362
|
+
issuePullRequestSchema = external_exports.object({
|
|
50363
|
+
id: external_exports.string().uuid(),
|
|
50364
|
+
issue_id: external_exports.string().uuid(),
|
|
50365
|
+
url: external_exports.string(),
|
|
50366
|
+
pull_request_id: external_exports.string().uuid().nullable(),
|
|
50367
|
+
title: external_exports.string().nullable(),
|
|
50368
|
+
state: issuePullRequestStateSchema,
|
|
50369
|
+
created_at: timestamp,
|
|
50370
|
+
updated_at: timestamp
|
|
50371
|
+
});
|
|
50372
|
+
issueCommentSchema = external_exports.object({
|
|
50373
|
+
id: external_exports.string().uuid(),
|
|
50374
|
+
issue_id: external_exports.string().uuid(),
|
|
50375
|
+
author: issueActorSchema,
|
|
50376
|
+
body: external_exports.string(),
|
|
50377
|
+
created_at: timestamp,
|
|
50378
|
+
updated_at: timestamp
|
|
50379
|
+
});
|
|
50380
|
+
change = (value) => external_exports.object({ from: value, to: value });
|
|
50381
|
+
nullableId = external_exports.string().uuid().nullable();
|
|
50382
|
+
ISSUE_EVENT_TYPES = [
|
|
50383
|
+
"created",
|
|
50384
|
+
"title_changed",
|
|
50385
|
+
"description_changed",
|
|
50386
|
+
"status_changed",
|
|
50387
|
+
"priority_changed",
|
|
50388
|
+
"parent_changed",
|
|
50389
|
+
"manager_changed",
|
|
50390
|
+
"sort_order_changed",
|
|
50391
|
+
"assignee_added",
|
|
50392
|
+
"assignee_removed",
|
|
50393
|
+
"subscriber_added",
|
|
50394
|
+
"subscriber_removed",
|
|
50395
|
+
"relation_added",
|
|
50396
|
+
"relation_removed",
|
|
50397
|
+
"pr_linked",
|
|
50398
|
+
"pr_unlinked",
|
|
50399
|
+
"pr_state_changed",
|
|
50400
|
+
"comment_added",
|
|
50401
|
+
"comment_edited",
|
|
50402
|
+
"comment_deleted",
|
|
50403
|
+
"archived",
|
|
50404
|
+
"restored"
|
|
50405
|
+
];
|
|
50406
|
+
issueEventDataSchemas = {
|
|
50407
|
+
created: external_exports.object({ issue: issueSchema2 }),
|
|
50408
|
+
title_changed: change(external_exports.string()),
|
|
50409
|
+
description_changed: change(external_exports.string()),
|
|
50410
|
+
status_changed: change(issueStatusSchema).extend({ completed_at: nullableTimestamp, canceled_at: nullableTimestamp }),
|
|
50411
|
+
priority_changed: change(issuePrioritySchema),
|
|
50412
|
+
parent_changed: change(nullableId),
|
|
50413
|
+
manager_changed: change(nullableId),
|
|
50414
|
+
sort_order_changed: change(external_exports.number()),
|
|
50415
|
+
/** `subscriber` is the row after the change: an unassigned principal stays subscribed with role `manual`. */
|
|
50416
|
+
assignee_added: external_exports.object({ subscriber: issueSubscriberSchema }),
|
|
50417
|
+
assignee_removed: external_exports.object({ subscriber: issueSubscriberSchema }),
|
|
50418
|
+
subscriber_added: external_exports.object({ subscriber: issueSubscriberSchema }),
|
|
50419
|
+
subscriber_removed: external_exports.object({ subscriber: issueSubscriberSchema }),
|
|
50420
|
+
relation_added: external_exports.object({ relation: issueRelationSchema }),
|
|
50421
|
+
relation_removed: external_exports.object({ relation: issueRelationSchema }),
|
|
50422
|
+
pr_linked: external_exports.object({ pull_request: issuePullRequestSchema }),
|
|
50423
|
+
pr_unlinked: external_exports.object({ pull_request: issuePullRequestSchema }),
|
|
50424
|
+
pr_state_changed: external_exports.object({ pull_request: issuePullRequestSchema, from: issuePullRequestStateSchema }),
|
|
50425
|
+
comment_added: external_exports.object({ comment: issueCommentSchema }),
|
|
50426
|
+
comment_edited: external_exports.object({ comment: issueCommentSchema, from: external_exports.string() }),
|
|
50427
|
+
comment_deleted: external_exports.object({ comment: issueCommentSchema }),
|
|
50428
|
+
archived: external_exports.object({ archived_at: timestamp }),
|
|
50429
|
+
restored: external_exports.object({
|
|
50430
|
+
issue: issueSchema2,
|
|
50431
|
+
subscribers: external_exports.array(issueSubscriberSchema),
|
|
50432
|
+
relations: external_exports.array(issueRelationSchema),
|
|
50433
|
+
pull_requests: external_exports.array(issuePullRequestSchema)
|
|
50434
|
+
})
|
|
50435
|
+
};
|
|
50436
|
+
issueEventBase = external_exports.object({
|
|
50437
|
+
sync_id: external_exports.number().int(),
|
|
50438
|
+
issue_id: external_exports.string().uuid(),
|
|
50439
|
+
actor: issueActorSchema,
|
|
50440
|
+
/** Echo of the `client_mutation_id` sent with the write, so the writer can settle its optimistic change. */
|
|
50441
|
+
client_mutation_id: external_exports.string().nullable(),
|
|
50442
|
+
created_at: timestamp
|
|
50443
|
+
});
|
|
50444
|
+
issueEventVariant = (type) => issueEventBase.extend({ type: external_exports.literal(type), data: issueEventDataSchemas[type] });
|
|
50445
|
+
issueEventSchema = external_exports.discriminatedUnion("type", [issueEventVariant(ISSUE_EVENT_TYPES[0]), ...ISSUE_EVENT_TYPES.slice(1).map(issueEventVariant)]);
|
|
50446
|
+
clientMutationId = external_exports.string().min(1).max(128).optional();
|
|
50447
|
+
title2 = external_exports.string().trim().min(1).max(500);
|
|
50448
|
+
description = external_exports.string().max(1e5);
|
|
50449
|
+
body = external_exports.string().trim().min(1).max(1e5);
|
|
50450
|
+
createIssueRequestSchema = external_exports.object({
|
|
50451
|
+
/** Client-generated id, so an optimistic create can be referenced before the server answers. */
|
|
50452
|
+
id: external_exports.string().uuid().optional(),
|
|
50453
|
+
title: title2,
|
|
50454
|
+
description: description.optional(),
|
|
50455
|
+
status: issueStatusSchema.optional(),
|
|
50456
|
+
priority: issuePrioritySchema.optional(),
|
|
50457
|
+
parent_id: external_exports.string().uuid().optional(),
|
|
50458
|
+
manager_id: external_exports.string().uuid().optional(),
|
|
50459
|
+
sort_order: external_exports.number().finite().optional(),
|
|
50460
|
+
assignees: external_exports.array(issueActorSchema).max(20).optional(),
|
|
50461
|
+
subscribers: external_exports.array(issueActorSchema).max(50).optional(),
|
|
50462
|
+
client_mutation_id: clientMutationId
|
|
50463
|
+
});
|
|
50464
|
+
updateIssueRequestSchema = external_exports.object({
|
|
50465
|
+
title: title2.optional(),
|
|
50466
|
+
description: description.optional(),
|
|
50467
|
+
status: issueStatusSchema.optional(),
|
|
50468
|
+
priority: issuePrioritySchema.optional(),
|
|
50469
|
+
// PATCH semantics: null clears the parent or Manager, omitting it leaves it unchanged.
|
|
50470
|
+
parent_id: nullableId.optional(),
|
|
50471
|
+
manager_id: nullableId.optional(),
|
|
50472
|
+
sort_order: external_exports.number().finite().optional(),
|
|
50473
|
+
client_mutation_id: clientMutationId
|
|
50474
|
+
});
|
|
50475
|
+
issueActorRequestSchema = issueActorSchema.partial().extend({ client_mutation_id: clientMutationId });
|
|
50476
|
+
createIssueCommentRequestSchema = external_exports.object({
|
|
50477
|
+
id: external_exports.string().uuid().optional(),
|
|
50478
|
+
body,
|
|
50479
|
+
client_mutation_id: clientMutationId
|
|
50480
|
+
});
|
|
50481
|
+
updateIssueCommentRequestSchema = external_exports.object({ body, client_mutation_id: clientMutationId });
|
|
50482
|
+
createIssueRelationRequestSchema = external_exports.object({
|
|
50483
|
+
id: external_exports.string().uuid().optional(),
|
|
50484
|
+
type: issueRelationTypeSchema,
|
|
50485
|
+
related_issue: external_exports.string().min(1),
|
|
50486
|
+
client_mutation_id: clientMutationId
|
|
50487
|
+
});
|
|
50488
|
+
linkIssuePullRequestRequestSchema = external_exports.object({
|
|
50489
|
+
id: external_exports.string().uuid().optional(),
|
|
50490
|
+
url: external_exports.string().url().max(2e3),
|
|
50491
|
+
title: external_exports.string().max(500).optional(),
|
|
50492
|
+
state: issuePullRequestStateSchema.optional(),
|
|
50493
|
+
pull_request_id: external_exports.string().uuid().optional(),
|
|
50494
|
+
client_mutation_id: clientMutationId
|
|
50495
|
+
});
|
|
50496
|
+
updateIssuePullRequestRequestSchema = external_exports.object({
|
|
50497
|
+
state: issuePullRequestStateSchema,
|
|
50498
|
+
client_mutation_id: clientMutationId
|
|
50499
|
+
});
|
|
50500
|
+
issueMutationRequestSchema = external_exports.object({ client_mutation_id: clientMutationId });
|
|
50501
|
+
updateIssueSettingsRequestSchema = external_exports.object({ issue_key: external_exports.string().trim().toUpperCase().regex(ISSUE_KEY_RE) });
|
|
50502
|
+
listIssuesQuerySchema = external_exports.object({
|
|
50503
|
+
status: external_exports.string().optional(),
|
|
50504
|
+
priority: external_exports.string().optional(),
|
|
50505
|
+
assignee: external_exports.string().optional(),
|
|
50506
|
+
subscriber: external_exports.string().optional(),
|
|
50507
|
+
creator: external_exports.string().optional(),
|
|
50508
|
+
manager_id: external_exports.string().optional(),
|
|
50509
|
+
parent_id: external_exports.string().optional(),
|
|
50510
|
+
q: external_exports.string().max(200).optional(),
|
|
50511
|
+
include_archived: external_exports.enum(["true", "false"]).optional(),
|
|
50512
|
+
limit: external_exports.coerce.number().int().min(1).max(200).optional(),
|
|
50513
|
+
cursor: external_exports.coerce.number().int().min(0).max(2147483647).optional()
|
|
50514
|
+
});
|
|
50515
|
+
issuesDeltaQuerySchema = external_exports.object({
|
|
50516
|
+
after: external_exports.coerce.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
|
|
50517
|
+
limit: external_exports.coerce.number().int().min(1).max(1e3).optional()
|
|
50518
|
+
});
|
|
50519
|
+
}
|
|
50520
|
+
});
|
|
50521
|
+
|
|
50304
50522
|
// ../shared/src/routes/repo-files.ts
|
|
50305
50523
|
var MAX_REPO_FILE_CONTENT_BYTES;
|
|
50306
50524
|
var init_repo_files = __esm({
|
|
@@ -50547,8 +50765,8 @@ function parseSseChunk(chunk) {
|
|
|
50547
50765
|
return null;
|
|
50548
50766
|
}
|
|
50549
50767
|
}
|
|
50550
|
-
async function* iterateSseStream(
|
|
50551
|
-
const reader =
|
|
50768
|
+
async function* iterateSseStream(body2, onChunk) {
|
|
50769
|
+
const reader = body2.getReader();
|
|
50552
50770
|
const decoder3 = new TextDecoder();
|
|
50553
50771
|
let buffer = "";
|
|
50554
50772
|
let searchFrom = 0;
|
|
@@ -50567,9 +50785,9 @@ async function* iterateSseStream(body, onChunk) {
|
|
|
50567
50785
|
searchFrom = Math.max(0, buffer.length - 1);
|
|
50568
50786
|
}
|
|
50569
50787
|
}
|
|
50570
|
-
async function readSseStream(
|
|
50788
|
+
async function readSseStream(body2, onEvent, shouldContinue = () => true, onChunk) {
|
|
50571
50789
|
if (!shouldContinue()) return;
|
|
50572
|
-
for await (const event of iterateSseStream(
|
|
50790
|
+
for await (const event of iterateSseStream(body2, onChunk)) {
|
|
50573
50791
|
if (!shouldContinue()) break;
|
|
50574
50792
|
await onEvent(event);
|
|
50575
50793
|
}
|
|
@@ -50826,6 +51044,7 @@ var init_src = __esm({
|
|
|
50826
51044
|
init_automations();
|
|
50827
51045
|
init_egress2();
|
|
50828
51046
|
init_feature_flags();
|
|
51047
|
+
init_issues();
|
|
50829
51048
|
init_repo_files();
|
|
50830
51049
|
init_replica();
|
|
50831
51050
|
init_admin();
|
|
@@ -51330,9 +51549,9 @@ async function verifyAuthFlowTarget(target, assumeYes) {
|
|
|
51330
51549
|
}
|
|
51331
51550
|
return true;
|
|
51332
51551
|
}
|
|
51333
|
-
function renderAuthFlowStep(step, total,
|
|
51552
|
+
function renderAuthFlowStep(step, total, title3) {
|
|
51334
51553
|
console.log(import_chalk2.default.bold(`
|
|
51335
|
-
${step}/${total} ${
|
|
51554
|
+
${step}/${total} ${title3}`));
|
|
51336
51555
|
}
|
|
51337
51556
|
function renderAuthFlowDetail(text4) {
|
|
51338
51557
|
console.log(import_chalk2.default.gray(` ${text4}`));
|
|
@@ -51817,10 +52036,10 @@ async function fetchToken(audience, awsSourceIdentity) {
|
|
|
51817
52036
|
} catch {
|
|
51818
52037
|
return createErrorResult({ message: "Workspace identity is only available inside a running Replicas workspace." });
|
|
51819
52038
|
}
|
|
51820
|
-
const
|
|
51821
|
-
const parsed = workspaceTokenResponseSchema.safeParse(
|
|
52039
|
+
const body2 = await response.json().catch(() => null);
|
|
52040
|
+
const parsed = workspaceTokenResponseSchema.safeParse(body2);
|
|
51822
52041
|
if (!response.ok || !parsed.success) {
|
|
51823
|
-
const detail = isRecord(
|
|
52042
|
+
const detail = isRecord(body2) && typeof body2.error === "string" ? body2.error : `HTTP ${response.status}`;
|
|
51824
52043
|
return createErrorResult({ message: `Could not obtain a workspace token: ${detail}` });
|
|
51825
52044
|
}
|
|
51826
52045
|
return createSuccessResult(parsed.data);
|
|
@@ -52936,11 +53155,11 @@ var init_claude_auth2 = __esm({
|
|
|
52936
53155
|
});
|
|
52937
53156
|
|
|
52938
53157
|
// src/lib/muse-oauth.ts
|
|
52939
|
-
async function post(path11,
|
|
53158
|
+
async function post(path11, body2) {
|
|
52940
53159
|
return fetch(`${AUTH_URL}${path11}`, {
|
|
52941
53160
|
method: "POST",
|
|
52942
53161
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
52943
|
-
body
|
|
53162
|
+
body: body2
|
|
52944
53163
|
});
|
|
52945
53164
|
}
|
|
52946
53165
|
async function mintMuseApiKey(identityToken, fetchImpl = fetch) {
|
|
@@ -52954,16 +53173,16 @@ async function mintMuseApiKey(identityToken, fetchImpl = fetch) {
|
|
|
52954
53173
|
},
|
|
52955
53174
|
body: "{}"
|
|
52956
53175
|
});
|
|
52957
|
-
const
|
|
53176
|
+
const body2 = await response.json();
|
|
52958
53177
|
if (!response.ok) {
|
|
52959
|
-
const detail = isRecord(
|
|
53178
|
+
const detail = isRecord(body2) && typeof body2.message === "string" ? `: ${body2.message}` : "";
|
|
52960
53179
|
throw new Error(`Muse API-key setup failed (${response.status})${detail}`);
|
|
52961
53180
|
}
|
|
52962
|
-
if (!isRecord(
|
|
52963
|
-
const setup = isRecord(
|
|
53181
|
+
if (!isRecord(body2) || typeof body2.api_key !== "string" || !body2.api_key) {
|
|
53182
|
+
const setup = isRecord(body2) && typeof body2.action_url === "string" ? ` Complete setup at ${body2.action_url}.` : "";
|
|
52964
53183
|
throw new Error(`Muse did not issue an API key.${setup}`);
|
|
52965
53184
|
}
|
|
52966
|
-
return
|
|
53185
|
+
return body2.api_key;
|
|
52967
53186
|
}
|
|
52968
53187
|
async function runMuseOAuthFlow(totalSteps) {
|
|
52969
53188
|
const authorization = await post("/oidc/device/authorization/", new URLSearchParams({ client_id: CLIENT_ID }));
|
|
@@ -53169,12 +53388,12 @@ async function credentialsSetCommand(service, options) {
|
|
|
53169
53388
|
const path11 = credentialsPath(service, options, true);
|
|
53170
53389
|
const { org: org2, models, ...fields } = options;
|
|
53171
53390
|
const secretField = service === "bedrock" ? "aws_secret_access_key" : "api_key";
|
|
53172
|
-
const
|
|
53391
|
+
const body2 = {
|
|
53173
53392
|
...toSnakeCaseKeys(fields),
|
|
53174
53393
|
...models ? { models: models.split(",").map((model2) => model2.trim()).filter(Boolean) } : {},
|
|
53175
53394
|
[secretField]: await readSecret(service, secretField === "api_key" ? "API key" : "AWS secret access key")
|
|
53176
53395
|
};
|
|
53177
|
-
const response = await orgAuthenticatedFetch(path11, { method: "POST", body });
|
|
53396
|
+
const response = await orgAuthenticatedFetch(path11, { method: "POST", body: body2 });
|
|
53178
53397
|
output2(response, () => console.log(import_chalk18.default.green(`Saved ${scopeLabel(options)} ${service} credentials.`)));
|
|
53179
53398
|
}
|
|
53180
53399
|
async function credentialsRemoveCommand(service, options) {
|
|
@@ -53301,7 +53520,7 @@ async function repositoriesAddCommand(fullName, options) {
|
|
|
53301
53520
|
const { repositories } = await orgAuthenticatedFetch("/v1/github/repositories");
|
|
53302
53521
|
const repository = repositories.find((item) => item.fullName.toLowerCase() === fullName.toLowerCase());
|
|
53303
53522
|
if (!repository) throw new Error(`${fullName} is not reachable by the GitHub app. List options with: replicas repos available`);
|
|
53304
|
-
const
|
|
53523
|
+
const body2 = {
|
|
53305
53524
|
provider: "github",
|
|
53306
53525
|
name: repository.name,
|
|
53307
53526
|
url: repository.cloneUrl,
|
|
@@ -53309,13 +53528,13 @@ async function repositoriesAddCommand(fullName, options) {
|
|
|
53309
53528
|
github_installation_id: repository.installationId,
|
|
53310
53529
|
github_repository_id: repository.id
|
|
53311
53530
|
};
|
|
53312
|
-
await orgAuthenticatedFetch("/v1/repositories", { method: "POST", body });
|
|
53531
|
+
await orgAuthenticatedFetch("/v1/repositories", { method: "POST", body: body2 });
|
|
53313
53532
|
outputSuccess(`Added ${repository.fullName}`);
|
|
53314
53533
|
}
|
|
53315
53534
|
async function repositoriesUpdateCommand(repository, options) {
|
|
53316
53535
|
const [id] = await resolveRepositoryIds([repository]);
|
|
53317
|
-
const
|
|
53318
|
-
await orgAuthenticatedFetch(`/v1/repositories/${id}`, { method: "PATCH", body });
|
|
53536
|
+
const body2 = { default_branch: options.defaultBranch };
|
|
53537
|
+
await orgAuthenticatedFetch(`/v1/repositories/${id}`, { method: "PATCH", body: body2 });
|
|
53319
53538
|
outputSuccess(`Default branch set to ${options.defaultBranch}`);
|
|
53320
53539
|
}
|
|
53321
53540
|
async function repositoriesDeleteCommand(repository) {
|
|
@@ -53443,7 +53662,7 @@ async function environmentCreateCommand(name, options) {
|
|
|
53443
53662
|
if (r.repo) repositoryIds = [r.repo];
|
|
53444
53663
|
}
|
|
53445
53664
|
}
|
|
53446
|
-
const
|
|
53665
|
+
const body2 = {
|
|
53447
53666
|
name: envName,
|
|
53448
53667
|
description: options.description ?? null,
|
|
53449
53668
|
repository_ids: repositoryIds,
|
|
@@ -53451,7 +53670,7 @@ async function environmentCreateCommand(name, options) {
|
|
|
53451
53670
|
};
|
|
53452
53671
|
const response = await orgAuthenticatedFetch("/v1/environments", {
|
|
53453
53672
|
method: "POST",
|
|
53454
|
-
body
|
|
53673
|
+
body: body2
|
|
53455
53674
|
});
|
|
53456
53675
|
output2(response, ({ environment: environment2 }) => {
|
|
53457
53676
|
console.log(import_chalk21.default.green(`
|
|
@@ -53463,19 +53682,19 @@ Created environment: ${environment2.name}`));
|
|
|
53463
53682
|
async function environmentEditCommand(idOrName, options) {
|
|
53464
53683
|
ensureOrgApiAuthenticated();
|
|
53465
53684
|
const id = await resolveEnvironmentId(idOrName);
|
|
53466
|
-
const
|
|
53467
|
-
if (options.name !== void 0)
|
|
53468
|
-
if (options.description !== void 0)
|
|
53469
|
-
if (options.systemPrompt !== void 0)
|
|
53685
|
+
const body2 = {};
|
|
53686
|
+
if (options.name !== void 0) body2.name = options.name;
|
|
53687
|
+
if (options.description !== void 0) body2.description = options.description;
|
|
53688
|
+
if (options.systemPrompt !== void 0) body2.system_prompt = options.systemPrompt;
|
|
53470
53689
|
if (options.repository !== void 0) {
|
|
53471
|
-
|
|
53690
|
+
body2.repository_ids = options.repository === "" || options.repository === "null" ? [] : await resolveRepositoryIds(splitList(options.repository));
|
|
53472
53691
|
}
|
|
53473
|
-
if (Object.keys(
|
|
53692
|
+
if (Object.keys(body2).length === 0) {
|
|
53474
53693
|
throw new Error("No changes specified. Pass --name, --description, --repository, or --system-prompt.");
|
|
53475
53694
|
}
|
|
53476
53695
|
const response = await orgAuthenticatedFetch(`/v1/environments/${id}`, {
|
|
53477
53696
|
method: "PATCH",
|
|
53478
|
-
body
|
|
53697
|
+
body: body2
|
|
53479
53698
|
});
|
|
53480
53699
|
output2(response, ({ environment: environment2 }) => console.log(import_chalk21.default.green(`
|
|
53481
53700
|
Updated environment: ${environment2.name}
|
|
@@ -53526,24 +53745,24 @@ async function envVarsSetCommand(envIdOrName, key, value) {
|
|
|
53526
53745
|
);
|
|
53527
53746
|
const match = existing.environment_variables.find((v) => v.key === key);
|
|
53528
53747
|
if (match) {
|
|
53529
|
-
const
|
|
53748
|
+
const body3 = { value };
|
|
53530
53749
|
const response2 = await orgAuthenticatedFetch(
|
|
53531
53750
|
`/v1/environments/${id}/variables/${match.id}`,
|
|
53532
|
-
{ method: "PATCH", body:
|
|
53751
|
+
{ method: "PATCH", body: body3 }
|
|
53533
53752
|
);
|
|
53534
53753
|
output2({ ...response2, environment_variable: { ...response2.environment_variable, value: maskValue(response2.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk21.default.green(`
|
|
53535
53754
|
Updated variable ${environment_variable.key}.
|
|
53536
53755
|
`)));
|
|
53537
53756
|
return;
|
|
53538
53757
|
}
|
|
53539
|
-
const
|
|
53758
|
+
const body2 = {
|
|
53540
53759
|
environment_id: id,
|
|
53541
53760
|
key,
|
|
53542
53761
|
value
|
|
53543
53762
|
};
|
|
53544
53763
|
const response = await orgAuthenticatedFetch(
|
|
53545
53764
|
`/v1/environments/${id}/variables`,
|
|
53546
|
-
{ method: "POST", body }
|
|
53765
|
+
{ method: "POST", body: body2 }
|
|
53547
53766
|
);
|
|
53548
53767
|
output2({ ...response, environment_variable: { ...response.environment_variable, value: maskValue(response.environment_variable.value) } }, ({ environment_variable }) => console.log(import_chalk21.default.green(`
|
|
53549
53768
|
Created variable ${environment_variable.key}.
|
|
@@ -53694,17 +53913,17 @@ async function envFilesSetCommand(envIdOrName, destinationPath, options) {
|
|
|
53694
53913
|
const fallbackName = destinationPath.split("/").pop() || destinationPath;
|
|
53695
53914
|
const name = options.name ?? match?.name ?? fallbackName;
|
|
53696
53915
|
if (match) {
|
|
53697
|
-
const
|
|
53916
|
+
const body3 = { name, path: destinationPath, content };
|
|
53698
53917
|
const response2 = await orgAuthenticatedFetch(
|
|
53699
53918
|
`/v1/environments/${id}/files/${match.id}`,
|
|
53700
|
-
{ method: "PATCH", body:
|
|
53919
|
+
{ method: "PATCH", body: body3 }
|
|
53701
53920
|
);
|
|
53702
53921
|
output2(response2, ({ environment_file }) => console.log(import_chalk21.default.green(`
|
|
53703
53922
|
Updated file ${environment_file.path}.
|
|
53704
53923
|
`)));
|
|
53705
53924
|
return;
|
|
53706
53925
|
}
|
|
53707
|
-
const
|
|
53926
|
+
const body2 = {
|
|
53708
53927
|
environment_id: id,
|
|
53709
53928
|
name,
|
|
53710
53929
|
path: destinationPath,
|
|
@@ -53712,7 +53931,7 @@ Updated file ${environment_file.path}.
|
|
|
53712
53931
|
};
|
|
53713
53932
|
const response = await orgAuthenticatedFetch(
|
|
53714
53933
|
`/v1/environments/${id}/files`,
|
|
53715
|
-
{ method: "POST", body }
|
|
53934
|
+
{ method: "POST", body: body2 }
|
|
53716
53935
|
);
|
|
53717
53936
|
output2(response, ({ environment_file }) => console.log(import_chalk21.default.green(`
|
|
53718
53937
|
Created file ${environment_file.path}.
|
|
@@ -53764,20 +53983,20 @@ async function envHookSaveCommand(envIdOrName, options, kind) {
|
|
|
53764
53983
|
const id = await resolveEnvironmentId(envIdOrName);
|
|
53765
53984
|
const content = readFileContent(options);
|
|
53766
53985
|
if (kind === "warm") {
|
|
53767
|
-
const
|
|
53986
|
+
const body3 = { environment_id: id, content };
|
|
53768
53987
|
const response2 = await orgAuthenticatedFetch(
|
|
53769
53988
|
`/v1/environments/${id}/warm-hooks/save`,
|
|
53770
|
-
{ method: "POST", body:
|
|
53989
|
+
{ method: "POST", body: body3 }
|
|
53771
53990
|
);
|
|
53772
53991
|
output2(response2, ({ warm_hook }) => console.log(import_chalk21.default.green(warm_hook ? `
|
|
53773
53992
|
Saved warm hook v${warm_hook.version}.
|
|
53774
53993
|
` : "\nCleared warm hook.\n")));
|
|
53775
53994
|
return;
|
|
53776
53995
|
}
|
|
53777
|
-
const
|
|
53996
|
+
const body2 = { content };
|
|
53778
53997
|
const response = await orgAuthenticatedFetch(
|
|
53779
53998
|
`/v1/environments/${id}/start-hooks/save`,
|
|
53780
|
-
{ method: "POST", body }
|
|
53999
|
+
{ method: "POST", body: body2 }
|
|
53781
54000
|
);
|
|
53782
54001
|
output2(response, ({ start_hook }) => console.log(import_chalk21.default.green(start_hook ? `
|
|
53783
54002
|
Saved start hook v${start_hook.version}.
|
|
@@ -53888,8 +54107,8 @@ async function envSkillsListCommand(env) {
|
|
|
53888
54107
|
}
|
|
53889
54108
|
async function envSkillsAddCommand(env, source, slug, options) {
|
|
53890
54109
|
const id = await resolveEnvironmentId(env);
|
|
53891
|
-
const
|
|
53892
|
-
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/skills`, { method: "POST", body });
|
|
54110
|
+
const body2 = { environment_id: id, source, slug, name: options.name ?? slug };
|
|
54111
|
+
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/skills`, { method: "POST", body: body2 });
|
|
53893
54112
|
output2(response, () => console.log(import_chalk21.default.green(`Added skill ${slug} from ${source}`)));
|
|
53894
54113
|
}
|
|
53895
54114
|
async function envSkillsRemoveCommand(env, slugOrId) {
|
|
@@ -53916,8 +54135,8 @@ async function envMcpsAddCommand(env, name, options) {
|
|
|
53916
54135
|
const server = url2 && !command ? { transport: options.transport ?? "http", config: { url: url2, headers: parseKeyValuePairs(options.header) } } : command && !url2 ? { transport: "stdio", config: { command, args: options.arg, env: parseKeyValuePairs(options.env) } } : void 0;
|
|
53917
54136
|
if (!server) throw new Error("Pass exactly one of --url or --command");
|
|
53918
54137
|
const id = await resolveEnvironmentId(env);
|
|
53919
|
-
const
|
|
53920
|
-
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/mcps`, { method: "POST", body });
|
|
54138
|
+
const body2 = { environment_id: id, name, ...server };
|
|
54139
|
+
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/mcps`, { method: "POST", body: body2 });
|
|
53921
54140
|
output2(response, () => console.log(import_chalk21.default.green(`Added MCP server ${name}`)));
|
|
53922
54141
|
}
|
|
53923
54142
|
async function envMcpsRemoveCommand(env, nameOrId) {
|
|
@@ -53947,8 +54166,8 @@ No devices. Add one with: replicas env devices add ${env} <name> --user <user>
|
|
|
53947
54166
|
}
|
|
53948
54167
|
async function envDevicesAddCommand(env, name, options) {
|
|
53949
54168
|
const id = await resolveEnvironmentId(env);
|
|
53950
|
-
const
|
|
53951
|
-
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices`, { method: "POST", body });
|
|
54169
|
+
const body2 = { name, host: options.host, username: options.user, port: options.port, screen_password: options.screenPassword };
|
|
54170
|
+
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices`, { method: "POST", body: body2 });
|
|
53952
54171
|
const connect2 = options.host === void 0 ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${response.environment_device.id}/connect-token`) : void 0;
|
|
53953
54172
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
53954
54173
|
console.log(import_chalk21.default.green(`Added device ${name}. Allow its key by running this on the device as ${options.user}:`));
|
|
@@ -53961,15 +54180,15 @@ async function envDevicesAddCommand(env, name, options) {
|
|
|
53961
54180
|
});
|
|
53962
54181
|
}
|
|
53963
54182
|
async function envDevicesEditCommand(env, nameOrId, options) {
|
|
53964
|
-
const
|
|
53965
|
-
if (Object.values(
|
|
54183
|
+
const body2 = { name: options.name, host: options.host, username: options.user, port: options.port, screen_password: options.screenPassword };
|
|
54184
|
+
if (Object.values(body2).every((value) => value === void 0)) {
|
|
53966
54185
|
throw new Error("No changes specified. Pass --name, --host, --user, --port, or --screen-password.");
|
|
53967
54186
|
}
|
|
53968
54187
|
const id = await resolveEnvironmentId(env);
|
|
53969
54188
|
const { environment_devices } = await orgAuthenticatedFetch(`/v1/environments/${id}/devices`);
|
|
53970
54189
|
const device = resolveByNameOrId(nameOrId, environment_devices);
|
|
53971
54190
|
if (!device) throw new Error(`Device not found: ${nameOrId}`);
|
|
53972
|
-
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}`, { method: "PATCH", body });
|
|
54191
|
+
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}`, { method: "PATCH", body: body2 });
|
|
53973
54192
|
const connect2 = device.host !== null && response.environment_device.host === null ? await orgAuthenticatedFetch(`/v1/environments/${id}/devices/${device.id}/connect-token`) : void 0;
|
|
53974
54193
|
output2({ ...response, connect_token: connect2?.token }, ({ environment_device, connect_token }) => {
|
|
53975
54194
|
console.log(import_chalk21.default.green(`Updated device ${environment_device.name}. Workspaces started from now on get the change.`));
|
|
@@ -54003,8 +54222,8 @@ async function envDevicesResetCommand(env, nameOrId) {
|
|
|
54003
54222
|
function envWarmPoolCommand(enabled) {
|
|
54004
54223
|
return async (env) => {
|
|
54005
54224
|
const id = await resolveEnvironmentId(env);
|
|
54006
|
-
const
|
|
54007
|
-
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/warm-pools`, { method: "PUT", body });
|
|
54225
|
+
const body2 = { environment_id: id, enabled };
|
|
54226
|
+
const response = await orgAuthenticatedFetch(`/v1/environments/${id}/warm-pools`, { method: "PUT", body: body2 });
|
|
54008
54227
|
output2(response, () => console.log(import_chalk21.default.green(`Warm pool ${enabled ? "enabled" : "disabled"}`)));
|
|
54009
54228
|
};
|
|
54010
54229
|
}
|
|
@@ -54076,10 +54295,10 @@ function formatDisplayMessage(message2) {
|
|
|
54076
54295
|
case "file_change":
|
|
54077
54296
|
console.log(import_chalk22.default.yellow(`
|
|
54078
54297
|
[${time3}] FILE CHANGES:`));
|
|
54079
|
-
for (const
|
|
54080
|
-
const icon =
|
|
54081
|
-
const color =
|
|
54082
|
-
console.log(color(` ${icon} ${
|
|
54298
|
+
for (const change2 of message2.changes) {
|
|
54299
|
+
const icon = change2.kind === "add" ? "+" : change2.kind === "delete" ? "-" : "~";
|
|
54300
|
+
const color = change2.kind === "add" ? import_chalk22.default.green : change2.kind === "delete" ? import_chalk22.default.red : import_chalk22.default.yellow;
|
|
54301
|
+
console.log(color(` ${icon} ${change2.path}`));
|
|
54083
54302
|
}
|
|
54084
54303
|
break;
|
|
54085
54304
|
case "patch":
|
|
@@ -54279,7 +54498,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
54279
54498
|
}
|
|
54280
54499
|
codingAgent = parseReplicaAgent(response2.agent);
|
|
54281
54500
|
}
|
|
54282
|
-
const
|
|
54501
|
+
const body2 = {
|
|
54283
54502
|
name: replicaName,
|
|
54284
54503
|
message: message2,
|
|
54285
54504
|
environment_id: selectedEnvironmentId,
|
|
@@ -54289,7 +54508,7 @@ async function replicaCreateCommand(name, options) {
|
|
|
54289
54508
|
console.log(import_chalk22.default.gray("\nCreating replica..."));
|
|
54290
54509
|
const response = await orgAuthenticatedFetch("/v1/replica", {
|
|
54291
54510
|
method: "POST",
|
|
54292
|
-
body
|
|
54511
|
+
body: body2
|
|
54293
54512
|
});
|
|
54294
54513
|
output2(response, ({ replica }) => {
|
|
54295
54514
|
console.log(import_chalk22.default.green(`
|
|
@@ -54320,7 +54539,7 @@ async function replicaSendCommand(id, options) {
|
|
|
54320
54539
|
}
|
|
54321
54540
|
message2 = answer;
|
|
54322
54541
|
}
|
|
54323
|
-
const
|
|
54542
|
+
const body2 = {
|
|
54324
54543
|
message: message2,
|
|
54325
54544
|
chat_id: options.chat,
|
|
54326
54545
|
model: options.model,
|
|
@@ -54330,13 +54549,13 @@ async function replicaSendCommand(id, options) {
|
|
|
54330
54549
|
fast_mode: options.fast
|
|
54331
54550
|
};
|
|
54332
54551
|
if (options.agent) {
|
|
54333
|
-
|
|
54552
|
+
body2.coding_agent = parseReplicaAgent(options.agent);
|
|
54334
54553
|
}
|
|
54335
54554
|
const response = await orgAuthenticatedFetch(
|
|
54336
54555
|
`/v1/replica/${id}/messages`,
|
|
54337
54556
|
{
|
|
54338
54557
|
method: "POST",
|
|
54339
|
-
body
|
|
54558
|
+
body: body2
|
|
54340
54559
|
}
|
|
54341
54560
|
);
|
|
54342
54561
|
output2(response, (response2) => {
|
|
@@ -54475,11 +54694,11 @@ async function workspaceResourcesCommand(id) {
|
|
|
54475
54694
|
});
|
|
54476
54695
|
}
|
|
54477
54696
|
async function workspaceExecCommand(id, command, options) {
|
|
54478
|
-
const
|
|
54697
|
+
const body2 = {
|
|
54479
54698
|
command: command.length === 1 ? command[0] : command.map(shellQuotePosix).join(" "),
|
|
54480
54699
|
...options.timeout ? { timeout_seconds: Number(options.timeout) } : {}
|
|
54481
54700
|
};
|
|
54482
|
-
const result = await orgAuthenticatedFetch(`/v1/replica/${id}/exec`, { method: "POST", body });
|
|
54701
|
+
const result = await orgAuthenticatedFetch(`/v1/replica/${id}/exec`, { method: "POST", body: body2 });
|
|
54483
54702
|
output2(result, () => {
|
|
54484
54703
|
process.stdout.write(result.output.endsWith("\n") || !result.output ? result.output : `${result.output}
|
|
54485
54704
|
`);
|
|
@@ -54544,8 +54763,8 @@ async function shareListCommand(id) {
|
|
|
54544
54763
|
});
|
|
54545
54764
|
}
|
|
54546
54765
|
async function shareAddCommand(id, userId) {
|
|
54547
|
-
const
|
|
54548
|
-
await orgAuthenticatedFetch(`/v1/replica/${id}/share`, { method: "POST", body });
|
|
54766
|
+
const body2 = { user_id: userId };
|
|
54767
|
+
await orgAuthenticatedFetch(`/v1/replica/${id}/share`, { method: "POST", body: body2 });
|
|
54549
54768
|
outputSuccess(`Shared workspace ${id} with ${userId}`);
|
|
54550
54769
|
}
|
|
54551
54770
|
async function shareRemoveCommand(id, userId) {
|
|
@@ -54583,8 +54802,8 @@ async function prMergeCommand(id, prUrl) {
|
|
|
54583
54802
|
}
|
|
54584
54803
|
function prUpdateCommand(action) {
|
|
54585
54804
|
return async (id, prUrl) => {
|
|
54586
|
-
const
|
|
54587
|
-
await orgAuthenticatedFetch(`/v1/replica/${id}/pull-requests/update`, { method: "POST", body });
|
|
54805
|
+
const body2 = { prUrl, action };
|
|
54806
|
+
await orgAuthenticatedFetch(`/v1/replica/${id}/pull-requests/update`, { method: "POST", body: body2 });
|
|
54588
54807
|
outputSuccess(`${prUrl}: ${action.replaceAll("_", " ")} done`);
|
|
54589
54808
|
};
|
|
54590
54809
|
}
|
|
@@ -54604,13 +54823,13 @@ async function canvasPutCommand(id, filename, options) {
|
|
|
54604
54823
|
const content = options.file ? options.content ? void 0 : import_fs5.default.readFileSync(options.file, "utf-8") : options.content;
|
|
54605
54824
|
if (content === void 0) throw new Error("Pass exactly one of --content or --file");
|
|
54606
54825
|
const { revision } = await getCanvasFile(id, filename);
|
|
54607
|
-
const
|
|
54826
|
+
const body2 = {
|
|
54608
54827
|
content,
|
|
54609
54828
|
expectedRevision: revision ?? ""
|
|
54610
54829
|
};
|
|
54611
54830
|
const result = await orgAuthenticatedFetch(
|
|
54612
54831
|
`/v1/replica/${id}/canvas/${encodeURIComponent(filename)}`,
|
|
54613
|
-
{ method: "PUT", body }
|
|
54832
|
+
{ method: "PUT", body: body2 }
|
|
54614
54833
|
);
|
|
54615
54834
|
if (!result.saved) throw new Error(`${filename} changed while saving; retry`);
|
|
54616
54835
|
output2(result, () => console.log(import_chalk23.default.green(`Saved ${filename}`)));
|
|
@@ -54653,8 +54872,8 @@ async function chatListCommand(id) {
|
|
|
54653
54872
|
async function chatCreateCommand(id, options) {
|
|
54654
54873
|
const provider2 = parseReplicaAgent(options.agent);
|
|
54655
54874
|
if (!provider2) throw new Error("--agent is required");
|
|
54656
|
-
const
|
|
54657
|
-
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/chats`, { method: "POST", body }), ({ chat: chat2 }) => console.log(chat2.id));
|
|
54875
|
+
const body2 = { provider: provider2, title: options.title };
|
|
54876
|
+
output2(await orgAuthenticatedFetch(`/v1/replica/${id}/chats`, { method: "POST", body: body2 }), ({ chat: chat2 }) => console.log(chat2.id));
|
|
54658
54877
|
}
|
|
54659
54878
|
async function chatRenameCommand(id, chatId, name) {
|
|
54660
54879
|
await orgAuthenticatedFetch(chatPath2(id, chatId), { method: "PATCH", body: { displayName: name } });
|
|
@@ -54675,25 +54894,25 @@ async function chatForkCommand(id, chatId, options) {
|
|
|
54675
54894
|
const provider2 = parseReplicaAgent(options.agent);
|
|
54676
54895
|
if (!provider2) throw new Error("--agent is required");
|
|
54677
54896
|
if (!isEngineAgentProvider(provider2)) throw new Error("Chats cannot be forked to the Replicas harness");
|
|
54678
|
-
const
|
|
54897
|
+
const body2 = {
|
|
54679
54898
|
provider: provider2,
|
|
54680
54899
|
title: options.title,
|
|
54681
54900
|
message: options.message,
|
|
54682
54901
|
model: options.model
|
|
54683
54902
|
};
|
|
54684
|
-
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/fork"), { method: "POST", body }), ({ chat: chat2 }) => console.log(chat2.id));
|
|
54903
|
+
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/fork"), { method: "POST", body: body2 }), ({ chat: chat2 }) => console.log(chat2.id));
|
|
54685
54904
|
}
|
|
54686
54905
|
async function chatGoalCommand(id, chatId, options) {
|
|
54687
54906
|
if (options.clear) {
|
|
54688
54907
|
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/goal/clear"), { method: "POST" }), printGoal);
|
|
54689
54908
|
return;
|
|
54690
54909
|
}
|
|
54691
|
-
const
|
|
54910
|
+
const body2 = {
|
|
54692
54911
|
objective: options.objective,
|
|
54693
54912
|
status: options.pause ? "paused" : options.resume ? "active" : void 0
|
|
54694
54913
|
};
|
|
54695
|
-
if (!
|
|
54696
|
-
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/goal"), { method: "PATCH", body }), printGoal);
|
|
54914
|
+
if (!body2.objective && !body2.status) throw new Error("Pass --objective, --pause, --resume, or --clear");
|
|
54915
|
+
output2(await orgAuthenticatedFetch(chatPath2(id, chatId, "/goal"), { method: "PATCH", body: body2 }), printGoal);
|
|
54697
54916
|
}
|
|
54698
54917
|
async function chatAnswerCommand(id, chatId, requestId, selectionId) {
|
|
54699
54918
|
const response = await orgAuthenticatedFetch(chatPath2(id, chatId, "/tool-input"), {
|
|
@@ -54715,8 +54934,8 @@ async function chatQueueListCommand(id, chatId) {
|
|
|
54715
54934
|
printQueue(queue);
|
|
54716
54935
|
});
|
|
54717
54936
|
}
|
|
54718
|
-
async function mutateQueue(path11, method,
|
|
54719
|
-
output2(await orgAuthenticatedFetch(path11, { method, body }), ({ queue }) => {
|
|
54937
|
+
async function mutateQueue(path11, method, body2) {
|
|
54938
|
+
output2(await orgAuthenticatedFetch(path11, { method, body: body2 }), ({ queue }) => {
|
|
54720
54939
|
if (queue) printQueue(queue);
|
|
54721
54940
|
else console.log("Done.");
|
|
54722
54941
|
});
|
|
@@ -54819,10 +55038,10 @@ async function environmentSetupStepCommand(key, status) {
|
|
|
54819
55038
|
throw new Error(`Unknown status "${status}". Use one of: ${ENVIRONMENT_SETUP_STEP_STATUSES.join(", ")}`);
|
|
54820
55039
|
}
|
|
54821
55040
|
const { run: run2 } = await fetchCurrentRun();
|
|
54822
|
-
const
|
|
55041
|
+
const body2 = { steps: { [key]: status } };
|
|
54823
55042
|
const result = await orgAuthenticatedFetch(`/v1/environment-setups/${run2.id}/steps`, {
|
|
54824
55043
|
method: "POST",
|
|
54825
|
-
body
|
|
55044
|
+
body: body2
|
|
54826
55045
|
});
|
|
54827
55046
|
output2(result, () => console.log(import_chalk26.default.green(`
|
|
54828
55047
|
\u2713 ${key} \u2192 ${status}
|
|
@@ -54989,8 +55208,8 @@ function parseAutomationLifecycleOptions(options) {
|
|
|
54989
55208
|
if (options.sleepWhenDone) return "sleep_when_done";
|
|
54990
55209
|
return parseWorkspaceLifecyclePolicyOption(options.lifecycle);
|
|
54991
55210
|
}
|
|
54992
|
-
function applyAgentSelection(
|
|
54993
|
-
const result = validateAgentSelection(
|
|
55211
|
+
function applyAgentSelection(body2, existing) {
|
|
55212
|
+
const result = validateAgentSelection(body2, existing, VALID_AGENT_PROVIDERS, AGENT_MODELS);
|
|
54994
55213
|
if (!result.ok) throw new Error(result.error.message);
|
|
54995
55214
|
const out = {};
|
|
54996
55215
|
if (result.data.agentProvider !== void 0) out.agent_provider = result.data.agentProvider;
|
|
@@ -55452,7 +55671,7 @@ async function automationCreateCommand(name, options) {
|
|
|
55452
55671
|
});
|
|
55453
55672
|
prFollowups = prFollowupsResponse.prFollowups === true;
|
|
55454
55673
|
}
|
|
55455
|
-
const
|
|
55674
|
+
const body2 = {
|
|
55456
55675
|
scope: options.personal ? "user" : "org",
|
|
55457
55676
|
name: automationName,
|
|
55458
55677
|
...options.description ? { description: options.description } : {},
|
|
@@ -55477,7 +55696,7 @@ async function automationCreateCommand(name, options) {
|
|
|
55477
55696
|
console.log(import_chalk27.default.gray("\nCreating automation..."));
|
|
55478
55697
|
const response = await orgAuthenticatedFetch("/v1/automations", {
|
|
55479
55698
|
method: "POST",
|
|
55480
|
-
body
|
|
55699
|
+
body: body2
|
|
55481
55700
|
});
|
|
55482
55701
|
output2(response.automation, (automation2) => {
|
|
55483
55702
|
console.log(import_chalk27.default.green(`
|
|
@@ -55525,7 +55744,7 @@ async function automationEditCommand(id, options) {
|
|
|
55525
55744
|
agentProvider: existing.automation.agent_provider,
|
|
55526
55745
|
model: existing.automation.model
|
|
55527
55746
|
});
|
|
55528
|
-
const
|
|
55747
|
+
const body2 = {};
|
|
55529
55748
|
const hasOptions = options.name || options.prompt || options.description !== void 0 || workspaceSize || options.enabled !== void 0 || options.prFollowups !== void 0 || replacingTriggers || options.environment || options.triggerGithubExcludeUsers !== void 0 || options.triggerGitlabExcludeUsers !== void 0 || options.githubChecks !== void 0 || options.addGithubChecks !== void 0 || options.lifecycle || options.sleepWhenDone || options.autoStopMinutes || options.agentProvider !== void 0 || options.model !== void 0 || options.thinkingLevel !== void 0 || options.planMode !== void 0 || options.goalMode !== void 0 || options.fastMode !== void 0 || runAt !== void 0 || maxRuns !== void 0 || workspaceTarget !== void 0 || options.background !== void 0 || options.credentials !== void 0 || options.moveToOrg;
|
|
55530
55749
|
if (!hasOptions) {
|
|
55531
55750
|
const nameResponse = await ask({
|
|
@@ -55535,7 +55754,7 @@ async function automationEditCommand(id, options) {
|
|
|
55535
55754
|
initial: existing.automation.name
|
|
55536
55755
|
});
|
|
55537
55756
|
if (nameResponse.name && nameResponse.name !== existing.automation.name) {
|
|
55538
|
-
|
|
55757
|
+
body2.name = nameResponse.name;
|
|
55539
55758
|
}
|
|
55540
55759
|
const promptResponse = await ask({
|
|
55541
55760
|
type: "text",
|
|
@@ -55544,7 +55763,7 @@ async function automationEditCommand(id, options) {
|
|
|
55544
55763
|
initial: existing.automation.prompt
|
|
55545
55764
|
});
|
|
55546
55765
|
if (promptResponse.prompt && promptResponse.prompt !== existing.automation.prompt) {
|
|
55547
|
-
|
|
55766
|
+
body2.prompt = promptResponse.prompt;
|
|
55548
55767
|
}
|
|
55549
55768
|
const enabledResponse = await ask({
|
|
55550
55769
|
type: "confirm",
|
|
@@ -55553,7 +55772,7 @@ async function automationEditCommand(id, options) {
|
|
|
55553
55772
|
initial: existing.automation.enabled
|
|
55554
55773
|
});
|
|
55555
55774
|
if (enabledResponse.enabled !== void 0 && enabledResponse.enabled !== existing.automation.enabled) {
|
|
55556
|
-
|
|
55775
|
+
body2.enabled = enabledResponse.enabled;
|
|
55557
55776
|
}
|
|
55558
55777
|
const existingPrFollowups = existing.automation.config.capabilities?.pr_followups === true;
|
|
55559
55778
|
const prFollowupsResponse = await ask({
|
|
@@ -55563,7 +55782,7 @@ async function automationEditCommand(id, options) {
|
|
|
55563
55782
|
initial: existingPrFollowups
|
|
55564
55783
|
});
|
|
55565
55784
|
if (prFollowupsResponse.prFollowups !== void 0 && prFollowupsResponse.prFollowups !== existingPrFollowups) {
|
|
55566
|
-
|
|
55785
|
+
body2.config = workspaceConfigWithPrFollowups(existing.automation.config, prFollowupsResponse.prFollowups);
|
|
55567
55786
|
}
|
|
55568
55787
|
const editTriggersResponse = await ask({
|
|
55569
55788
|
type: "confirm",
|
|
@@ -55574,33 +55793,33 @@ async function automationEditCommand(id, options) {
|
|
|
55574
55793
|
if (editTriggersResponse.edit) {
|
|
55575
55794
|
const triggers = await promptForTriggers();
|
|
55576
55795
|
if (triggers.length > 0) {
|
|
55577
|
-
|
|
55796
|
+
body2.triggers = triggers;
|
|
55578
55797
|
}
|
|
55579
55798
|
}
|
|
55580
55799
|
} else {
|
|
55581
|
-
if (options.name)
|
|
55582
|
-
if (options.prompt)
|
|
55583
|
-
if (options.description !== void 0)
|
|
55584
|
-
if (workspaceSize)
|
|
55800
|
+
if (options.name) body2.name = options.name;
|
|
55801
|
+
if (options.prompt) body2.prompt = options.prompt;
|
|
55802
|
+
if (options.description !== void 0) body2.description = options.description;
|
|
55803
|
+
if (workspaceSize) body2.workspace_size = workspaceSize;
|
|
55585
55804
|
if (options.enabled !== void 0) {
|
|
55586
55805
|
if (options.enabled !== "true" && options.enabled !== "false") throw new Error("--enabled must be true or false");
|
|
55587
|
-
|
|
55806
|
+
body2.enabled = options.enabled === "true";
|
|
55588
55807
|
}
|
|
55589
55808
|
if (options.prFollowups !== void 0) {
|
|
55590
|
-
|
|
55809
|
+
body2.config = workspaceConfigWithPrFollowups(existing.automation.config, options.prFollowups);
|
|
55591
55810
|
}
|
|
55592
55811
|
if (options.githubChecks !== void 0) {
|
|
55593
|
-
|
|
55812
|
+
body2.github_check_names = normalizeAutomationGithubCheckNames(options.githubChecks.split(","));
|
|
55594
55813
|
}
|
|
55595
55814
|
if (options.addGithubChecks !== void 0) {
|
|
55596
|
-
|
|
55815
|
+
body2.github_check_names = [.../* @__PURE__ */ new Set([
|
|
55597
55816
|
...existing.automation.github_check_names,
|
|
55598
55817
|
...normalizeAutomationGithubCheckNames(options.addGithubChecks.split(","))
|
|
55599
55818
|
])];
|
|
55600
55819
|
}
|
|
55601
55820
|
if (runAt || replacingTriggers) {
|
|
55602
55821
|
const repositories = options.triggerGithubRepos || options.triggerGitlabRepos ? (await orgAuthenticatedFetch("/v1/repositories")).repositories : [];
|
|
55603
|
-
|
|
55822
|
+
body2.triggers = [
|
|
55604
55823
|
...options.keepTriggers ? existing.automation.triggers : [],
|
|
55605
55824
|
...buildTriggersFromOptions(options, runAt, repositories)
|
|
55606
55825
|
];
|
|
@@ -55609,7 +55828,7 @@ async function automationEditCommand(id, options) {
|
|
|
55609
55828
|
const gitlabExcludedActors = parseActorListOption(options.triggerGitlabExcludeUsers);
|
|
55610
55829
|
let matchedGithub = options.triggerGithubExcludeUsers === void 0;
|
|
55611
55830
|
let matchedGitlab = options.triggerGitlabExcludeUsers === void 0;
|
|
55612
|
-
|
|
55831
|
+
body2.triggers = existing.automation.triggers.map((trigger) => {
|
|
55613
55832
|
if (trigger.type === "github" && options.triggerGithubExcludeUsers !== void 0) {
|
|
55614
55833
|
matchedGithub = true;
|
|
55615
55834
|
return { ...trigger, config: withExcludedActors(trigger.config, githubExcludedActors) };
|
|
@@ -55627,35 +55846,35 @@ async function automationEditCommand(id, options) {
|
|
|
55627
55846
|
const envResp = await orgAuthenticatedFetch(
|
|
55628
55847
|
`/v1/environments?scope=${existing.automation.user_id ? "all" : "org"}`
|
|
55629
55848
|
);
|
|
55630
|
-
|
|
55849
|
+
body2.environment_id = resolveSelectableEnvironmentId(options.environment, envResp.environments);
|
|
55631
55850
|
}
|
|
55632
55851
|
if (lifecyclePolicy) {
|
|
55633
|
-
|
|
55852
|
+
body2.workspace_lifecycle_policy = lifecyclePolicy;
|
|
55634
55853
|
if (!lifecyclePolicySupportsAutoStop(lifecyclePolicy)) {
|
|
55635
|
-
|
|
55854
|
+
body2.workspace_auto_stop_minutes = null;
|
|
55636
55855
|
}
|
|
55637
55856
|
}
|
|
55638
55857
|
if (options.autoStopMinutes) {
|
|
55639
|
-
|
|
55640
|
-
}
|
|
55641
|
-
if (options.planMode !== void 0)
|
|
55642
|
-
if (options.goalMode !== void 0)
|
|
55643
|
-
if (options.fastMode !== void 0)
|
|
55644
|
-
if (maxRuns !== void 0)
|
|
55645
|
-
if (options.background !== void 0)
|
|
55646
|
-
if (options.credentials !== void 0)
|
|
55647
|
-
if (options.moveToOrg)
|
|
55648
|
-
Object.assign(
|
|
55649
|
-
Object.assign(
|
|
55650
|
-
}
|
|
55651
|
-
if (Object.keys(
|
|
55858
|
+
body2.workspace_auto_stop_minutes = parseInt(options.autoStopMinutes, 10);
|
|
55859
|
+
}
|
|
55860
|
+
if (options.planMode !== void 0) body2.plan_mode = options.planMode;
|
|
55861
|
+
if (options.goalMode !== void 0) body2.goal_mode = options.goalMode;
|
|
55862
|
+
if (options.fastMode !== void 0) body2.fast_mode = options.fastMode;
|
|
55863
|
+
if (maxRuns !== void 0) body2.max_runs = maxRuns;
|
|
55864
|
+
if (options.background !== void 0) body2.background = options.background;
|
|
55865
|
+
if (options.credentials !== void 0) body2.credential_user_id = options.credentials === "org" ? null : await resolveCredentialsMember(options.credentials);
|
|
55866
|
+
if (options.moveToOrg) body2.scope = "org";
|
|
55867
|
+
Object.assign(body2, workspaceTarget);
|
|
55868
|
+
Object.assign(body2, agentSelection);
|
|
55869
|
+
}
|
|
55870
|
+
if (Object.keys(body2).length === 0) {
|
|
55652
55871
|
output2(existing.automation, () => console.log(import_chalk27.default.yellow("\nNo changes made.\n")));
|
|
55653
55872
|
return;
|
|
55654
55873
|
}
|
|
55655
55874
|
console.log(import_chalk27.default.gray("\nUpdating automation..."));
|
|
55656
55875
|
const response = await orgAuthenticatedFetch(`/v1/automations/${id}`, {
|
|
55657
55876
|
method: "PATCH",
|
|
55658
|
-
body
|
|
55877
|
+
body: body2
|
|
55659
55878
|
});
|
|
55660
55879
|
output2(response.automation, (automation2) => {
|
|
55661
55880
|
console.log(import_chalk27.default.green(`
|
|
@@ -55714,7 +55933,7 @@ async function automationCheckCommand(checkRunId, options) {
|
|
|
55714
55933
|
const { conclusion } = options;
|
|
55715
55934
|
if (!isAutomationCheckConclusion(conclusion)) throw new Error(`--conclusion must be one of ${AUTOMATION_CHECK_CONCLUSIONS.join(", ")}`);
|
|
55716
55935
|
if (!options.title?.trim()) throw new Error("--title is required");
|
|
55717
|
-
const
|
|
55936
|
+
const body2 = {
|
|
55718
55937
|
token: options.token,
|
|
55719
55938
|
conclusion,
|
|
55720
55939
|
title: options.title.trim(),
|
|
@@ -55722,7 +55941,7 @@ async function automationCheckCommand(checkRunId, options) {
|
|
|
55722
55941
|
};
|
|
55723
55942
|
const response = await orgAuthenticatedFetch(
|
|
55724
55943
|
`/v1/automations/checks/${id}`,
|
|
55725
|
-
{ method: "POST", body }
|
|
55944
|
+
{ method: "POST", body: body2 }
|
|
55726
55945
|
);
|
|
55727
55946
|
output2(response, (response2) => console.log(response2.reported ? import_chalk27.default.green(`
|
|
55728
55947
|
Reported ${conclusion} for "${response2.name}".
|
|
@@ -55785,11 +56004,11 @@ async function agentRequest(path11, options) {
|
|
|
55785
56004
|
...isFormData ? {} : { "Content-Type": isStream ? "application/octet-stream" : "application/json" },
|
|
55786
56005
|
...options?.headers || {}
|
|
55787
56006
|
};
|
|
55788
|
-
const
|
|
56007
|
+
const body2 = rawBody === void 0 ? void 0 : rawBody instanceof FormData || rawBody instanceof ReadableStream ? rawBody : JSON.stringify(rawBody);
|
|
55789
56008
|
const response = await fetch(`${MONOLITH_URL}${path11}`, {
|
|
55790
56009
|
...options,
|
|
55791
56010
|
headers,
|
|
55792
|
-
body,
|
|
56011
|
+
body: body2,
|
|
55793
56012
|
...isStream ? { duplex: "half" } : {}
|
|
55794
56013
|
});
|
|
55795
56014
|
if (!response.ok) {
|
|
@@ -56506,22 +56725,22 @@ Next: publish with \`replicas visualize ${file2} --title "<short title>"\`.`);
|
|
|
56506
56725
|
});
|
|
56507
56726
|
return;
|
|
56508
56727
|
}
|
|
56509
|
-
const
|
|
56510
|
-
if (!
|
|
56728
|
+
const title3 = options.title?.trim();
|
|
56729
|
+
if (!title3) throw new Error('Pass --title "<short title>" to publish, or --check to preview without publishing.');
|
|
56511
56730
|
const inspection = await inspect(html, source);
|
|
56512
56731
|
if (inspection.viewportDependent) throw new Error(`Not published. ${VIEWPORT_DEPENDENT_FIX}`);
|
|
56513
56732
|
const media2 = await uploadMedia(new Blob([html], { type: "text/html; charset=utf-8" }), "visual.html", {
|
|
56514
56733
|
kind: "html",
|
|
56515
|
-
display_name:
|
|
56734
|
+
display_name: title3,
|
|
56516
56735
|
visual_heights: JSON.stringify(inspection.heights.map(([width, height]) => [width, clampVisualHeight(height)]))
|
|
56517
56736
|
});
|
|
56518
|
-
const embed = `![${
|
|
56737
|
+
const embed = `![${title3.replace(/[[\]]/g, "")}](${MONOLITH_URL}/v1/media/${media2.id})`;
|
|
56519
56738
|
const forgeUrl = getOrganizationMediaUrl(media2.organization_id, media2.id);
|
|
56520
56739
|
const notes = [...missingImages, ...warnings(inspection), ...consoleErrors(inspection)];
|
|
56521
56740
|
const { screenshots } = inspection;
|
|
56522
56741
|
output2({ media: media2, embed, forgeUrl, screenshots, warnings: notes }, () => {
|
|
56523
56742
|
console.log(embed);
|
|
56524
|
-
console.log(`Forge link (organization only): [View ${
|
|
56743
|
+
console.log(`Forge link (organization only): [View ${title3}](${forgeUrl})`);
|
|
56525
56744
|
console.log("\nScreenshots (open both; if something looks wrong, fix the page and publish again):");
|
|
56526
56745
|
for (const screenshot of screenshots) console.log(` ${screenshot}`);
|
|
56527
56746
|
if (notes.length > 0) {
|
|
@@ -56878,7 +57097,7 @@ function printPreview({ preview: preview2 }) {
|
|
|
56878
57097
|
if (preview2.blockers.length || preview2.missing_secrets.length) console.log(import_chalk30.default.yellow("Cannot apply this configuration. No changes have been made."));
|
|
56879
57098
|
if (!preview2.changes.length && !addedSecrets.length && !removedSecrets.length) console.log("No setting changes. Applying records this configuration.");
|
|
56880
57099
|
else console.log("Proposed changes (not applied):");
|
|
56881
|
-
for (const
|
|
57100
|
+
for (const change2 of preview2.changes) console.log(` ${change2.kind === "plugin" ? change2.operation === "remove" ? "stop requiring" : "require" : change2.operation}: ${change2.kind} ${change2.key}`);
|
|
56882
57101
|
for (const key of addedSecrets) console.log(` require: secret ${key}`);
|
|
56883
57102
|
for (const key of removedSecrets) console.log(` stop requiring: secret ${key}`);
|
|
56884
57103
|
if (preview2.missing_secrets.length) console.log(import_chalk30.default.yellow(`Missing required secrets: ${preview2.missing_secrets.join(", ")}`));
|
|
@@ -56937,8 +57156,8 @@ async function applySource(environment2, options, operation) {
|
|
|
56937
57156
|
if (!await confirmAction(`${operation === "link" ? "Link and apply" : "Apply"} this configuration to ${environment2}?`)) return;
|
|
56938
57157
|
}
|
|
56939
57158
|
if (options.file && JSON.stringify(await sourceInput2(options)) !== JSON.stringify(input2)) throw new Error("The configuration file changed after preview. Preview it again before applying");
|
|
56940
|
-
const
|
|
56941
|
-
output2(await orgAuthenticatedFetch(`/v1/environments/${id}/config-source${operation === "sync" ? "/sync" : ""}`, { method: "POST", body }), printSource);
|
|
57159
|
+
const body2 = { ...preview2.kind !== "file" ? { repository_id: preview2.repository_id, commit_sha: preview2.commit_sha } : input2, fingerprint: preview2.fingerprint };
|
|
57160
|
+
output2(await orgAuthenticatedFetch(`/v1/environments/${id}/config-source${operation === "sync" ? "/sync" : ""}`, { method: "POST", body: body2 }), printSource);
|
|
56942
57161
|
}
|
|
56943
57162
|
async function environmentConfigApplyCommand(environment2, options) {
|
|
56944
57163
|
await applySource(environment2, options, "file");
|
|
@@ -57003,11 +57222,11 @@ var init_history = __esm({
|
|
|
57003
57222
|
|
|
57004
57223
|
// src/commands/skills.ts
|
|
57005
57224
|
async function skillsSuggestCommand(file2, options) {
|
|
57006
|
-
const
|
|
57007
|
-
if (!
|
|
57225
|
+
const body2 = options.delete ? { remove: options.delete } : file2 && options.title ? { content: (0, import_node_fs4.readFileSync)(file2, "utf-8"), title: options.title } : null;
|
|
57226
|
+
if (!body2) throw new Error("Pass a SKILL.md file with --title, or --delete <name-or-id>");
|
|
57008
57227
|
const { id, name, update } = await agentFetch("/v1/learned-skills/suggestions", {
|
|
57009
57228
|
method: "POST",
|
|
57010
|
-
body
|
|
57229
|
+
body: body2
|
|
57011
57230
|
});
|
|
57012
57231
|
const link = `[${name}](${MONOLITH_URL}/v1/learned-skills/suggestions/${id})`;
|
|
57013
57232
|
output2({ id, name, update, link }, () => {
|
|
@@ -57023,18 +57242,18 @@ async function skillsListCommand() {
|
|
|
57023
57242
|
});
|
|
57024
57243
|
}
|
|
57025
57244
|
async function skillsCreateCommand(file2, options) {
|
|
57026
|
-
const
|
|
57027
|
-
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body }), ({ id, name }) => console.log(import_chalk31.default.green(`Saved learning '${name}' (${id})`)));
|
|
57245
|
+
const body2 = { content: (0, import_node_fs4.readFileSync)(file2, "utf-8"), title: options.title };
|
|
57246
|
+
output2(await orgAuthenticatedFetch("/v1/learned-skills", { method: "POST", body: body2 }), ({ id, name }) => console.log(import_chalk31.default.green(`Saved learning '${name}' (${id})`)));
|
|
57028
57247
|
}
|
|
57029
57248
|
async function skillsUpdateCommand(id, options) {
|
|
57030
57249
|
const { skills: skills2 } = await orgAuthenticatedFetch("/v1/learned-skills");
|
|
57031
57250
|
const existing = skills2.find((skill) => skill.id === id || skill.name === id);
|
|
57032
57251
|
if (!existing) throw new Error(`Learning not found: ${id}`);
|
|
57033
|
-
const
|
|
57252
|
+
const body2 = {
|
|
57034
57253
|
title: options.title ?? existing.title,
|
|
57035
57254
|
content: options.file ? (0, import_node_fs4.readFileSync)(options.file, "utf-8") : existing.content
|
|
57036
57255
|
};
|
|
57037
|
-
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body }), ({ name }) => console.log(import_chalk31.default.green(`Updated learning '${name}'`)));
|
|
57256
|
+
output2(await orgAuthenticatedFetch(`/v1/learned-skills/${existing.id}`, { method: "PUT", body: body2 }), ({ name }) => console.log(import_chalk31.default.green(`Updated learning '${name}'`)));
|
|
57038
57257
|
}
|
|
57039
57258
|
async function skillsDeleteCommand(id) {
|
|
57040
57259
|
await orgAuthenticatedFetch(`/v1/learned-skills/${id}`, { method: "DELETE" });
|
|
@@ -57303,8 +57522,8 @@ trim "$1"`;
|
|
|
57303
57522
|
|
|
57304
57523
|
// src/commands/device.ts
|
|
57305
57524
|
async function refuse(response) {
|
|
57306
|
-
const
|
|
57307
|
-
throw new Error(
|
|
57525
|
+
const body2 = await response.json().catch(() => null);
|
|
57526
|
+
throw new Error(body2 && typeof body2 === "object" && "error" in body2 ? String(body2.error) : `Replicas refused this device (${response.status})`);
|
|
57308
57527
|
}
|
|
57309
57528
|
async function scanHostKeys(port) {
|
|
57310
57529
|
const { stdout } = await (0, import_node_util.promisify)(import_node_child_process4.execFile)("ssh-keyscan", ["-T", "5", "-p", String(port), "127.0.0.1"]).catch(() => ({ stdout: "" }));
|
|
@@ -57365,8 +57584,8 @@ async function deviceConnectCommand() {
|
|
|
57365
57584
|
const device = response?.ok ? deviceConnectionResponseSchema.parse(await response.json()) : void 0;
|
|
57366
57585
|
let problem = device ? void 0 : `Can't reach Replicas (${response?.status ?? "network error"}), retrying...`;
|
|
57367
57586
|
if (device && !pinned) {
|
|
57368
|
-
const
|
|
57369
|
-
const pin =
|
|
57587
|
+
const body2 = { host_keys: await scanHostKeys(device.port) };
|
|
57588
|
+
const pin = body2.host_keys.length === 0 ? void 0 : await fetch(`${MONOLITH_URL}/v1/devices/host-keys`, { method: "PUT", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify(body2) }).catch(() => null);
|
|
57370
57589
|
if (pin && [400, 401, 403, 409].includes(pin.status)) await refuse(pin);
|
|
57371
57590
|
pinned = pin?.ok === true;
|
|
57372
57591
|
if (pin === void 0) problem = `Can't reach SSH on port ${device.port} here, retrying... ${REMOTE_LOGIN_HINT}`;
|
|
@@ -57416,9 +57635,9 @@ async function themeGetCommand() {
|
|
|
57416
57635
|
print((email3) => `Theme of ${email3}`)(await agentFetch("/v1/engine/theme"));
|
|
57417
57636
|
}
|
|
57418
57637
|
async function themeSetCommand(options) {
|
|
57419
|
-
const
|
|
57638
|
+
const body2 = { theme: options.theme, palette: options.colorTheme, accent: options.accent, code: options.code };
|
|
57420
57639
|
print((email3) => `Changed the theme of ${email3}. Their open web and desktop apps repaint on their own.`)(
|
|
57421
|
-
await agentFetch("/v1/engine/theme", { method: "PUT", body })
|
|
57640
|
+
await agentFetch("/v1/engine/theme", { method: "PUT", body: body2 })
|
|
57422
57641
|
);
|
|
57423
57642
|
}
|
|
57424
57643
|
var print;
|
|
@@ -57428,8 +57647,8 @@ var init_theme = __esm({
|
|
|
57428
57647
|
init_design_tokens();
|
|
57429
57648
|
init_agent_api();
|
|
57430
57649
|
init_output();
|
|
57431
|
-
print = (
|
|
57432
|
-
console.log(
|
|
57650
|
+
print = (title3) => (saved) => output2(saved, ({ email: email3, theme, palette, accent, custom: custom2 }) => {
|
|
57651
|
+
console.log(title3(email3));
|
|
57433
57652
|
console.log(`theme: ${theme}`);
|
|
57434
57653
|
console.log(`color theme: ${palette}`);
|
|
57435
57654
|
console.log(`accent: ${accent === "custom" ? custom2.accent : accent}`);
|