@tryarcanist/cli 0.1.288 → 0.1.290
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.js +98 -52
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -634,6 +634,8 @@ var require_Alias = __commonJS({
|
|
|
634
634
|
* instance of the `source` anchor before this node.
|
|
635
635
|
*/
|
|
636
636
|
resolve(doc, ctx) {
|
|
637
|
+
if (ctx?.maxAliasCount === 0)
|
|
638
|
+
throw new ReferenceError("Alias resolution is disabled");
|
|
637
639
|
let nodes;
|
|
638
640
|
if (ctx?.aliasResolveCache) {
|
|
639
641
|
nodes = ctx.aliasResolveCache;
|
|
@@ -1706,18 +1708,18 @@ var require_merge = __commonJS({
|
|
|
1706
1708
|
};
|
|
1707
1709
|
var isMergeKey = (ctx, key) => (merge.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
|
|
1708
1710
|
function addMergeToJSMap(ctx, map, value) {
|
|
1709
|
-
|
|
1710
|
-
if (identity.isSeq(
|
|
1711
|
-
for (const it of
|
|
1711
|
+
const source = resolveAliasValue(ctx, value);
|
|
1712
|
+
if (identity.isSeq(source))
|
|
1713
|
+
for (const it of source.items)
|
|
1712
1714
|
mergeValue(ctx, map, it);
|
|
1713
|
-
else if (Array.isArray(
|
|
1714
|
-
for (const it of
|
|
1715
|
+
else if (Array.isArray(source))
|
|
1716
|
+
for (const it of source)
|
|
1715
1717
|
mergeValue(ctx, map, it);
|
|
1716
1718
|
else
|
|
1717
|
-
mergeValue(ctx, map,
|
|
1719
|
+
mergeValue(ctx, map, source);
|
|
1718
1720
|
}
|
|
1719
1721
|
function mergeValue(ctx, map, value) {
|
|
1720
|
-
const source = ctx
|
|
1722
|
+
const source = resolveAliasValue(ctx, value);
|
|
1721
1723
|
if (!identity.isMap(source))
|
|
1722
1724
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1723
1725
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
@@ -1738,6 +1740,9 @@ var require_merge = __commonJS({
|
|
|
1738
1740
|
}
|
|
1739
1741
|
return map;
|
|
1740
1742
|
}
|
|
1743
|
+
function resolveAliasValue(ctx, value) {
|
|
1744
|
+
return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
1745
|
+
}
|
|
1741
1746
|
exports.addMergeToJSMap = addMergeToJSMap;
|
|
1742
1747
|
exports.isMergeKey = isMergeKey;
|
|
1743
1748
|
exports.merge = merge;
|
|
@@ -2375,7 +2380,7 @@ var require_stringifyNumber = __commonJS({
|
|
|
2375
2380
|
if (!isFinite(num))
|
|
2376
2381
|
return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
|
|
2377
2382
|
let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
|
|
2378
|
-
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") &&
|
|
2383
|
+
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
|
|
2379
2384
|
let i = n.indexOf(".");
|
|
2380
2385
|
if (i < 0) {
|
|
2381
2386
|
i = n.length;
|
|
@@ -4747,7 +4752,7 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
4747
4752
|
while (next === " " || next === " ")
|
|
4748
4753
|
next = source[++i + 1];
|
|
4749
4754
|
} else if (next === "x" || next === "u" || next === "U") {
|
|
4750
|
-
const length =
|
|
4755
|
+
const length = next === "x" ? 2 : next === "u" ? 4 : 8;
|
|
4751
4756
|
res += parseCharCode(source, i + 1, length, onError);
|
|
4752
4757
|
i += length;
|
|
4753
4758
|
} else {
|
|
@@ -4822,12 +4827,13 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
4822
4827
|
const cc = source.substr(offset, length);
|
|
4823
4828
|
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
|
4824
4829
|
const code = ok ? parseInt(cc, 16) : NaN;
|
|
4825
|
-
|
|
4830
|
+
try {
|
|
4831
|
+
return String.fromCodePoint(code);
|
|
4832
|
+
} catch {
|
|
4826
4833
|
const raw = source.substr(offset - 2, length + 2);
|
|
4827
4834
|
onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
|
|
4828
4835
|
return raw;
|
|
4829
4836
|
}
|
|
4830
|
-
return String.fromCodePoint(code);
|
|
4831
4837
|
}
|
|
4832
4838
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
4833
4839
|
}
|
|
@@ -5177,8 +5183,10 @@ ${cb}` : comment;
|
|
|
5177
5183
|
}
|
|
5178
5184
|
}
|
|
5179
5185
|
if (afterDoc) {
|
|
5180
|
-
|
|
5181
|
-
|
|
5186
|
+
for (let i = 0; i < this.errors.length; ++i)
|
|
5187
|
+
doc.errors.push(this.errors[i]);
|
|
5188
|
+
for (let i = 0; i < this.warnings.length; ++i)
|
|
5189
|
+
doc.warnings.push(this.warnings[i]);
|
|
5182
5190
|
} else {
|
|
5183
5191
|
doc.errors = this.errors;
|
|
5184
5192
|
doc.warnings = this.warnings;
|
|
@@ -5911,7 +5919,7 @@ var require_lexer = __commonJS({
|
|
|
5911
5919
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
5912
5920
|
this.indentNext = this.indentValue + 1;
|
|
5913
5921
|
this.indentValue += n;
|
|
5914
|
-
return
|
|
5922
|
+
return "block-start";
|
|
5915
5923
|
}
|
|
5916
5924
|
return "doc";
|
|
5917
5925
|
}
|
|
@@ -6210,28 +6218,38 @@ var require_lexer = __commonJS({
|
|
|
6210
6218
|
return 0;
|
|
6211
6219
|
}
|
|
6212
6220
|
*pushIndicators() {
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6221
|
+
let n = 0;
|
|
6222
|
+
loop: while (true) {
|
|
6223
|
+
switch (this.charAt(0)) {
|
|
6224
|
+
case "!":
|
|
6225
|
+
n += yield* this.pushTag();
|
|
6226
|
+
n += yield* this.pushSpaces(true);
|
|
6227
|
+
continue loop;
|
|
6228
|
+
case "&":
|
|
6229
|
+
n += yield* this.pushUntil(isNotAnchorChar);
|
|
6230
|
+
n += yield* this.pushSpaces(true);
|
|
6231
|
+
continue loop;
|
|
6232
|
+
case "-":
|
|
6233
|
+
// this is an error
|
|
6234
|
+
case "?":
|
|
6235
|
+
// this is an error outside flow collections
|
|
6236
|
+
case ":": {
|
|
6237
|
+
const inFlow = this.flowLevel > 0;
|
|
6238
|
+
const ch1 = this.charAt(1);
|
|
6239
|
+
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
6240
|
+
if (!inFlow)
|
|
6241
|
+
this.indentNext = this.indentValue + 1;
|
|
6242
|
+
else if (this.flowKey)
|
|
6243
|
+
this.flowKey = false;
|
|
6244
|
+
n += yield* this.pushCount(1);
|
|
6245
|
+
n += yield* this.pushSpaces(true);
|
|
6246
|
+
continue loop;
|
|
6247
|
+
}
|
|
6231
6248
|
}
|
|
6232
6249
|
}
|
|
6250
|
+
break loop;
|
|
6233
6251
|
}
|
|
6234
|
-
return
|
|
6252
|
+
return n;
|
|
6235
6253
|
}
|
|
6236
6254
|
*pushTag() {
|
|
6237
6255
|
if (this.charAt(1) === "<") {
|
|
@@ -6390,6 +6408,13 @@ var require_parser = __commonJS({
|
|
|
6390
6408
|
}
|
|
6391
6409
|
return prev.splice(i, prev.length);
|
|
6392
6410
|
}
|
|
6411
|
+
function arrayPushArray(target, source) {
|
|
6412
|
+
if (source.length < 1e5)
|
|
6413
|
+
Array.prototype.push.apply(target, source);
|
|
6414
|
+
else
|
|
6415
|
+
for (let i = 0; i < source.length; ++i)
|
|
6416
|
+
target.push(source[i]);
|
|
6417
|
+
}
|
|
6393
6418
|
function fixFlowSeqItems(fc) {
|
|
6394
6419
|
if (fc.start.type === "flow-seq-start") {
|
|
6395
6420
|
for (const it of fc.items) {
|
|
@@ -6399,11 +6424,11 @@ var require_parser = __commonJS({
|
|
|
6399
6424
|
delete it.key;
|
|
6400
6425
|
if (isFlowToken(it.value)) {
|
|
6401
6426
|
if (it.value.end)
|
|
6402
|
-
|
|
6427
|
+
arrayPushArray(it.value.end, it.sep);
|
|
6403
6428
|
else
|
|
6404
6429
|
it.value.end = it.sep;
|
|
6405
6430
|
} else
|
|
6406
|
-
|
|
6431
|
+
arrayPushArray(it.start, it.sep);
|
|
6407
6432
|
delete it.sep;
|
|
6408
6433
|
}
|
|
6409
6434
|
}
|
|
@@ -6758,7 +6783,7 @@ var require_parser = __commonJS({
|
|
|
6758
6783
|
const prev = map.items[map.items.length - 2];
|
|
6759
6784
|
const end = prev?.value?.end;
|
|
6760
6785
|
if (Array.isArray(end)) {
|
|
6761
|
-
|
|
6786
|
+
arrayPushArray(end, it.start);
|
|
6762
6787
|
end.push(this.sourceToken);
|
|
6763
6788
|
map.items.pop();
|
|
6764
6789
|
return;
|
|
@@ -6946,7 +6971,7 @@ var require_parser = __commonJS({
|
|
|
6946
6971
|
const prev = seq.items[seq.items.length - 2];
|
|
6947
6972
|
const end = prev?.value?.end;
|
|
6948
6973
|
if (Array.isArray(end)) {
|
|
6949
|
-
|
|
6974
|
+
arrayPushArray(end, it.start);
|
|
6950
6975
|
end.push(this.sourceToken);
|
|
6951
6976
|
seq.items.pop();
|
|
6952
6977
|
return;
|
|
@@ -8524,6 +8549,19 @@ async function egressValidateCommand(path = EGRESS_ALLOWLIST_SOURCE_PATH, option
|
|
|
8524
8549
|
});
|
|
8525
8550
|
}
|
|
8526
8551
|
|
|
8552
|
+
// src/commands/hades.ts
|
|
8553
|
+
async function hadesCommand(options = {}, command) {
|
|
8554
|
+
assertArcanistSessionMutationAllowed("hades");
|
|
8555
|
+
const { config } = resolveBusinessContext(command, options);
|
|
8556
|
+
const result = await apiFetch(config, "/api/hades-runs", {
|
|
8557
|
+
method: "POST",
|
|
8558
|
+
body: "{}"
|
|
8559
|
+
});
|
|
8560
|
+
emit(command, options, result, (payload) => {
|
|
8561
|
+
console.log(`Started Hades run ${payload.runId} (${payload.jobId}).`);
|
|
8562
|
+
});
|
|
8563
|
+
}
|
|
8564
|
+
|
|
8527
8565
|
// src/commands/login.ts
|
|
8528
8566
|
async function loginCommand(options, command) {
|
|
8529
8567
|
const runtime = getRuntimeOptions(command, options);
|
|
@@ -10352,7 +10390,7 @@ function getRawSessionEventPromptId(event) {
|
|
|
10352
10390
|
if (isCanonicalRawSessionEvent(event)) {
|
|
10353
10391
|
return canonicalPromptId(event);
|
|
10354
10392
|
}
|
|
10355
|
-
return typeof event.data
|
|
10393
|
+
return isRecord(event.data) && typeof event.data.promptId === "string" && event.data.promptId.length > 0 ? event.data.promptId : void 0;
|
|
10356
10394
|
}
|
|
10357
10395
|
function getRawSessionEventKind(event) {
|
|
10358
10396
|
if (!isCanonicalRawSessionEvent(event)) return event.type;
|
|
@@ -10398,7 +10436,7 @@ function getRawSessionEventTimestamp(event) {
|
|
|
10398
10436
|
if (isCanonicalRawSessionEvent(event)) {
|
|
10399
10437
|
return Number.isFinite(event.timestampMs) && Number.isFinite(new Date(event.timestampMs).getTime()) ? new Date(event.timestampMs).toISOString() : void 0;
|
|
10400
10438
|
}
|
|
10401
|
-
const dataTimestamp = event.data
|
|
10439
|
+
const dataTimestamp = isRecord(event.data) ? event.data.timestamp : void 0;
|
|
10402
10440
|
if (typeof dataTimestamp === "string" && dataTimestamp.length > 0 || typeof dataTimestamp === "number") {
|
|
10403
10441
|
const parsed = new Date(dataTimestamp);
|
|
10404
10442
|
if (Number.isFinite(parsed.getTime())) return parsed.toISOString();
|
|
@@ -10477,6 +10515,7 @@ function getRawSessionEventData(event) {
|
|
|
10477
10515
|
...base,
|
|
10478
10516
|
error: payload.message,
|
|
10479
10517
|
...typeof payload.code === "string" ? { code: payload.code } : {},
|
|
10518
|
+
...typeof payload.command === "string" ? { command: payload.command } : {},
|
|
10480
10519
|
...payload.details !== void 0 ? { errorDetails: payload.details } : {}
|
|
10481
10520
|
});
|
|
10482
10521
|
case "bridge.event":
|
|
@@ -10761,21 +10800,20 @@ function mergeMemoryRefs(ids, rawRefs) {
|
|
|
10761
10800
|
const byId = /* @__PURE__ */ new Map();
|
|
10762
10801
|
if (Array.isArray(rawRefs)) {
|
|
10763
10802
|
for (const entry of rawRefs) {
|
|
10764
|
-
if (!entry
|
|
10765
|
-
const
|
|
10766
|
-
const id = typeof record.id === "string" ? record.id.trim() : "";
|
|
10803
|
+
if (!isRecord(entry)) continue;
|
|
10804
|
+
const id = typeof entry.id === "string" ? entry.id.trim() : "";
|
|
10767
10805
|
if (!id) continue;
|
|
10768
10806
|
const ref = { id };
|
|
10769
|
-
if (typeof
|
|
10770
|
-
if (typeof
|
|
10771
|
-
if (typeof
|
|
10772
|
-
if (typeof
|
|
10773
|
-
if (typeof
|
|
10774
|
-
if (typeof
|
|
10775
|
-
ref.expectedEffect =
|
|
10807
|
+
if (typeof entry.path === "string" && entry.path.trim()) ref.path = entry.path.trim();
|
|
10808
|
+
if (typeof entry.title === "string" && entry.title.trim()) ref.title = entry.title.trim();
|
|
10809
|
+
if (typeof entry.selectionRank === "number") ref.selectionRank = entry.selectionRank;
|
|
10810
|
+
if (typeof entry.selectionScore === "number") ref.selectionScore = entry.selectionScore;
|
|
10811
|
+
if (typeof entry.reason === "string" && entry.reason.trim()) ref.reason = entry.reason.trim();
|
|
10812
|
+
if (typeof entry.expectedEffect === "string" && entry.expectedEffect.trim()) {
|
|
10813
|
+
ref.expectedEffect = entry.expectedEffect.trim();
|
|
10776
10814
|
}
|
|
10777
|
-
if (typeof
|
|
10778
|
-
ref.observedEffect =
|
|
10815
|
+
if (typeof entry.observedEffect === "string" && entry.observedEffect.trim()) {
|
|
10816
|
+
ref.observedEffect = entry.observedEffect.trim();
|
|
10779
10817
|
}
|
|
10780
10818
|
byId.set(id, ref);
|
|
10781
10819
|
}
|
|
@@ -10824,7 +10862,8 @@ function projectSessionError(data, index) {
|
|
|
10824
10862
|
id: resolveEventId(data, "err", index),
|
|
10825
10863
|
error: typeof data?.error === "string" ? data.error : "Unknown error",
|
|
10826
10864
|
...resolvePromptId(data) ? { promptId: resolvePromptId(data) } : {},
|
|
10827
|
-
...typeof data?.code === "string" ? { code: data.code } : {}
|
|
10865
|
+
...typeof data?.code === "string" ? { code: data.code } : {},
|
|
10866
|
+
...typeof data?.command === "string" ? { command: data.command } : {}
|
|
10828
10867
|
};
|
|
10829
10868
|
}
|
|
10830
10869
|
function recordMalformedSearchBlock(data, state) {
|
|
@@ -12397,6 +12436,13 @@ The result is posted as a PR comment marked arcanist-anubis:v1.
|
|
|
12397
12436
|
Anubis requires a write-scoped CLI token and repository write access.
|
|
12398
12437
|
`
|
|
12399
12438
|
).action((prUrl, options, command) => anubisCommand(prUrl, options, command));
|
|
12439
|
+
program.command("hades").description("Start an internal Hades adversarial Zeus probe").addHelpText(
|
|
12440
|
+
"after",
|
|
12441
|
+
`
|
|
12442
|
+
Hades is internal-only. It creates one proved adversarial patch in tryarcanist/arcanist;
|
|
12443
|
+
the control plane opens the draft pull request and triggers Zeus.
|
|
12444
|
+
`
|
|
12445
|
+
).action((options, command) => hadesCommand(options, command));
|
|
12400
12446
|
sessions.command("stop").description("Stop the active run for a session").argument("<session-id>", "Session ID").addHelpText(
|
|
12401
12447
|
"after",
|
|
12402
12448
|
`
|