voidmachine 5.0.8 → 7.0.0
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/core-assets/.claude-plugin/plugin.json +13 -2
- package/core-assets/PHILOSOPHY.md +29 -6
- package/core-assets/data/catalog.v3.json +52 -132
- package/core-assets/data/certification.json +1 -1
- package/core-assets/data/model.json +51 -75
- package/core-assets/hooks/_syntax-worker.cjs +1 -1
- package/core-assets/hooks/_void-hook.mjs +730 -515
- package/core-assets/hooks/outcome-meter.sh +2 -1
- package/core-assets/hooks/tdd-guard.md +45 -88
- package/core-assets/hooks/viewport-screenshot-gate.sh +3 -3
- package/core-assets/packs/pack-monorepo/skills/void-dependency-direction/SKILL.md +27 -146
- package/core-assets/packs/pack-monorepo/skills/void-service-package/SKILL.md +5 -8
- package/core-assets/packs/pack-server/skills/void-webhook-handler-pattern/.source +4 -2
- package/core-assets/packs/pack-server/skills/void-webhook-handler-pattern/SKILL.md +32 -132
- package/core-assets/skills/void-accessibility/SKILL.md +2 -2
- package/core-assets/skills/void-async-safety/SKILL.md +37 -24
- package/core-assets/skills/void-autopilot/SKILL.md +7 -6
- package/core-assets/skills/void-brainstorm/SKILL.md +40 -61
- package/core-assets/skills/void-code-review/SKILL.md +24 -11
- package/core-assets/skills/void-commit-discipline/SKILL.md +13 -20
- package/core-assets/skills/void-debug/SKILL.md +9 -10
- package/core-assets/skills/void-domain-driven-design/SKILL.md +1 -1
- package/core-assets/skills/void-frontend-design/SKILL.md +3 -3
- package/core-assets/skills/void-hexagonal-architecture/SKILL.md +5 -5
- package/core-assets/skills/void-implement/SKILL.md +67 -26
- package/core-assets/skills/void-llm-cost-discipline/SKILL.md +3 -0
- package/core-assets/skills/void-observability/SKILL.md +4 -4
- package/core-assets/skills/void-orchestrate/SKILL.md +91 -221
- package/core-assets/skills/void-plan/SKILL.md +12 -17
- package/core-assets/skills/void-qa/SKILL.md +15 -14
- package/core-assets/skills/void-tdd/SKILL.md +33 -84
- package/core-assets/skills/void-testing/SKILL.md +5 -5
- package/core-assets/skills/void-ticket/SKILL.md +2 -0
- package/core-assets/skills/void-typescript-strict/SKILL.md +5 -5
- package/core-assets/skills/void-verify/SKILL.md +57 -159
- package/dist/main.js +1959 -1633
- package/package.json +3 -3
- package/core-assets/hooks/block-protected-push.sh +0 -81
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// syntax-worker: {"sha256":"
|
|
1
|
+
// syntax-worker: {"sha256":"462f4c488e85f6e104338e09b283bb934a84442f26c40102ec268eeb89c12ffe","bytes":3588428}
|
|
2
2
|
import { createRequire as createNodeRequire } from 'node:module'; const require = createNodeRequire(import.meta.url);
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -52,7 +52,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
52
52
|
var define_VOID_SYNTAX_WORKER_IDENTITY_default;
|
|
53
53
|
var init_define_VOID_SYNTAX_WORKER_IDENTITY = __esm({
|
|
54
54
|
"<define:__VOID_SYNTAX_WORKER_IDENTITY__>"() {
|
|
55
|
-
define_VOID_SYNTAX_WORKER_IDENTITY_default = { sha256: "
|
|
55
|
+
define_VOID_SYNTAX_WORKER_IDENTITY_default = { sha256: "462f4c488e85f6e104338e09b283bb934a84442f26c40102ec268eeb89c12ffe", bytes: 3588428 };
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
|
|
@@ -117,13 +117,13 @@ var require_visit = __commonJS({
|
|
|
117
117
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/visit.js"(exports) {
|
|
118
118
|
"use strict";
|
|
119
119
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
120
|
-
var
|
|
120
|
+
var identity2 = require_identity();
|
|
121
121
|
var BREAK = /* @__PURE__ */ Symbol("break visit");
|
|
122
122
|
var SKIP = /* @__PURE__ */ Symbol("skip children");
|
|
123
123
|
var REMOVE = /* @__PURE__ */ Symbol("remove node");
|
|
124
124
|
function visit2(node, visitor) {
|
|
125
125
|
const visitor_ = initVisitor(visitor);
|
|
126
|
-
if (
|
|
126
|
+
if (identity2.isDocument(node)) {
|
|
127
127
|
const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
|
|
128
128
|
if (cd === REMOVE)
|
|
129
129
|
node.contents = null;
|
|
@@ -135,12 +135,12 @@ var require_visit = __commonJS({
|
|
|
135
135
|
visit2.REMOVE = REMOVE;
|
|
136
136
|
function visit_(key, node, visitor, path2) {
|
|
137
137
|
const ctrl = callVisitor(key, node, visitor, path2);
|
|
138
|
-
if (
|
|
138
|
+
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
139
139
|
replaceNode(key, path2, ctrl);
|
|
140
140
|
return visit_(key, ctrl, visitor, path2);
|
|
141
141
|
}
|
|
142
142
|
if (typeof ctrl !== "symbol") {
|
|
143
|
-
if (
|
|
143
|
+
if (identity2.isCollection(node)) {
|
|
144
144
|
path2 = Object.freeze(path2.concat(node));
|
|
145
145
|
for (let i = 0; i < node.items.length; ++i) {
|
|
146
146
|
const ci = visit_(i, node.items[i], visitor, path2);
|
|
@@ -153,7 +153,7 @@ var require_visit = __commonJS({
|
|
|
153
153
|
i -= 1;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
} else if (
|
|
156
|
+
} else if (identity2.isPair(node)) {
|
|
157
157
|
path2 = Object.freeze(path2.concat(node));
|
|
158
158
|
const ck = visit_("key", node.key, visitor, path2);
|
|
159
159
|
if (ck === BREAK)
|
|
@@ -171,7 +171,7 @@ var require_visit = __commonJS({
|
|
|
171
171
|
}
|
|
172
172
|
async function visitAsync(node, visitor) {
|
|
173
173
|
const visitor_ = initVisitor(visitor);
|
|
174
|
-
if (
|
|
174
|
+
if (identity2.isDocument(node)) {
|
|
175
175
|
const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));
|
|
176
176
|
if (cd === REMOVE)
|
|
177
177
|
node.contents = null;
|
|
@@ -183,12 +183,12 @@ var require_visit = __commonJS({
|
|
|
183
183
|
visitAsync.REMOVE = REMOVE;
|
|
184
184
|
async function visitAsync_(key, node, visitor, path2) {
|
|
185
185
|
const ctrl = await callVisitor(key, node, visitor, path2);
|
|
186
|
-
if (
|
|
186
|
+
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
187
187
|
replaceNode(key, path2, ctrl);
|
|
188
188
|
return visitAsync_(key, ctrl, visitor, path2);
|
|
189
189
|
}
|
|
190
190
|
if (typeof ctrl !== "symbol") {
|
|
191
|
-
if (
|
|
191
|
+
if (identity2.isCollection(node)) {
|
|
192
192
|
path2 = Object.freeze(path2.concat(node));
|
|
193
193
|
for (let i = 0; i < node.items.length; ++i) {
|
|
194
194
|
const ci = await visitAsync_(i, node.items[i], visitor, path2);
|
|
@@ -201,7 +201,7 @@ var require_visit = __commonJS({
|
|
|
201
201
|
i -= 1;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
} else if (
|
|
204
|
+
} else if (identity2.isPair(node)) {
|
|
205
205
|
path2 = Object.freeze(path2.concat(node));
|
|
206
206
|
const ck = await visitAsync_("key", node.key, visitor, path2);
|
|
207
207
|
if (ck === BREAK)
|
|
@@ -238,31 +238,31 @@ var require_visit = __commonJS({
|
|
|
238
238
|
function callVisitor(key, node, visitor, path2) {
|
|
239
239
|
if (typeof visitor === "function")
|
|
240
240
|
return visitor(key, node, path2);
|
|
241
|
-
if (
|
|
241
|
+
if (identity2.isMap(node))
|
|
242
242
|
return visitor.Map?.(key, node, path2);
|
|
243
|
-
if (
|
|
243
|
+
if (identity2.isSeq(node))
|
|
244
244
|
return visitor.Seq?.(key, node, path2);
|
|
245
|
-
if (
|
|
245
|
+
if (identity2.isPair(node))
|
|
246
246
|
return visitor.Pair?.(key, node, path2);
|
|
247
|
-
if (
|
|
247
|
+
if (identity2.isScalar(node))
|
|
248
248
|
return visitor.Scalar?.(key, node, path2);
|
|
249
|
-
if (
|
|
249
|
+
if (identity2.isAlias(node))
|
|
250
250
|
return visitor.Alias?.(key, node, path2);
|
|
251
251
|
return void 0;
|
|
252
252
|
}
|
|
253
253
|
function replaceNode(key, path2, node) {
|
|
254
254
|
const parent = path2[path2.length - 1];
|
|
255
|
-
if (
|
|
255
|
+
if (identity2.isCollection(parent)) {
|
|
256
256
|
parent.items[key] = node;
|
|
257
|
-
} else if (
|
|
257
|
+
} else if (identity2.isPair(parent)) {
|
|
258
258
|
if (key === "key")
|
|
259
259
|
parent.key = node;
|
|
260
260
|
else
|
|
261
261
|
parent.value = node;
|
|
262
|
-
} else if (
|
|
262
|
+
} else if (identity2.isDocument(parent)) {
|
|
263
263
|
parent.contents = node;
|
|
264
264
|
} else {
|
|
265
|
-
const pt =
|
|
265
|
+
const pt = identity2.isAlias(parent) ? "alias" : "scalar";
|
|
266
266
|
throw new Error(`Cannot replace node with ${pt} parent`);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
@@ -275,7 +275,7 @@ var require_directives = __commonJS({
|
|
|
275
275
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/doc/directives.js"(exports) {
|
|
276
276
|
"use strict";
|
|
277
277
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
278
|
-
var
|
|
278
|
+
var identity2 = require_identity();
|
|
279
279
|
var visit2 = require_visit();
|
|
280
280
|
var escapeChars = {
|
|
281
281
|
"!": "%21",
|
|
@@ -418,10 +418,10 @@ var require_directives = __commonJS({
|
|
|
418
418
|
const lines = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [];
|
|
419
419
|
const tagEntries = Object.entries(this.tags);
|
|
420
420
|
let tagNames;
|
|
421
|
-
if (doc && tagEntries.length > 0 &&
|
|
421
|
+
if (doc && tagEntries.length > 0 && identity2.isNode(doc.contents)) {
|
|
422
422
|
const tags = {};
|
|
423
423
|
visit2.visit(doc.contents, (_key, node) => {
|
|
424
|
-
if (
|
|
424
|
+
if (identity2.isNode(node) && node.tag)
|
|
425
425
|
tags[node.tag] = true;
|
|
426
426
|
});
|
|
427
427
|
tagNames = Object.keys(tags);
|
|
@@ -446,7 +446,7 @@ var require_anchors = __commonJS({
|
|
|
446
446
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/doc/anchors.js"(exports) {
|
|
447
447
|
"use strict";
|
|
448
448
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
449
|
-
var
|
|
449
|
+
var identity2 = require_identity();
|
|
450
450
|
var visit2 = require_visit();
|
|
451
451
|
function anchorIsValid(anchor2) {
|
|
452
452
|
if (/[\x00-\x19\s,[\]{}]/.test(anchor2)) {
|
|
@@ -493,7 +493,7 @@ var require_anchors = __commonJS({
|
|
|
493
493
|
setAnchors: () => {
|
|
494
494
|
for (const source2 of aliasObjects) {
|
|
495
495
|
const ref = sourceObjects.get(source2);
|
|
496
|
-
if (typeof ref === "object" && ref.anchor && (
|
|
496
|
+
if (typeof ref === "object" && ref.anchor && (identity2.isScalar(ref.node) || identity2.isCollection(ref.node))) {
|
|
497
497
|
ref.node.anchor = ref.anchor;
|
|
498
498
|
} else {
|
|
499
499
|
const error = new Error("Failed to resolve repeated object (this should not happen)");
|
|
@@ -566,12 +566,12 @@ var require_toJS = __commonJS({
|
|
|
566
566
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/toJS.js"(exports) {
|
|
567
567
|
"use strict";
|
|
568
568
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
569
|
-
var
|
|
569
|
+
var identity2 = require_identity();
|
|
570
570
|
function toJS(value, arg, ctx) {
|
|
571
571
|
if (Array.isArray(value))
|
|
572
572
|
return value.map((v, i) => toJS(v, String(i), ctx));
|
|
573
573
|
if (value && typeof value.toJSON === "function") {
|
|
574
|
-
if (!ctx || !
|
|
574
|
+
if (!ctx || !identity2.hasAnchor(value))
|
|
575
575
|
return value.toJSON(arg, ctx);
|
|
576
576
|
const data = { aliasCount: 0, count: 1, res: void 0 };
|
|
577
577
|
ctx.anchors.set(value, data);
|
|
@@ -597,11 +597,11 @@ var require_Node = __commonJS({
|
|
|
597
597
|
"use strict";
|
|
598
598
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
599
599
|
var applyReviver = require_applyReviver();
|
|
600
|
-
var
|
|
600
|
+
var identity2 = require_identity();
|
|
601
601
|
var toJS = require_toJS();
|
|
602
602
|
var NodeBase = class {
|
|
603
603
|
constructor(type) {
|
|
604
|
-
Object.defineProperty(this,
|
|
604
|
+
Object.defineProperty(this, identity2.NODE_TYPE, { value: type });
|
|
605
605
|
}
|
|
606
606
|
/** Create a copy of this node. */
|
|
607
607
|
clone() {
|
|
@@ -612,7 +612,7 @@ var require_Node = __commonJS({
|
|
|
612
612
|
}
|
|
613
613
|
/** A plain JavaScript representation of this node. */
|
|
614
614
|
toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
|
|
615
|
-
if (!
|
|
615
|
+
if (!identity2.isDocument(doc))
|
|
616
616
|
throw new TypeError("A document argument is required");
|
|
617
617
|
const ctx = {
|
|
618
618
|
anchors: /* @__PURE__ */ new Map(),
|
|
@@ -639,12 +639,12 @@ var require_Alias = __commonJS({
|
|
|
639
639
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
640
640
|
var anchors = require_anchors();
|
|
641
641
|
var visit2 = require_visit();
|
|
642
|
-
var
|
|
642
|
+
var identity2 = require_identity();
|
|
643
643
|
var Node = require_Node();
|
|
644
644
|
var toJS = require_toJS();
|
|
645
645
|
var Alias = class extends Node.NodeBase {
|
|
646
646
|
constructor(source2) {
|
|
647
|
-
super(
|
|
647
|
+
super(identity2.ALIAS);
|
|
648
648
|
this.source = source2;
|
|
649
649
|
Object.defineProperty(this, "tag", {
|
|
650
650
|
set() {
|
|
@@ -666,7 +666,7 @@ var require_Alias = __commonJS({
|
|
|
666
666
|
nodes = [];
|
|
667
667
|
visit2.visit(doc, {
|
|
668
668
|
Node: (_key, node) => {
|
|
669
|
-
if (
|
|
669
|
+
if (identity2.isAlias(node) || identity2.hasAnchor(node))
|
|
670
670
|
nodes.push(node);
|
|
671
671
|
}
|
|
672
672
|
});
|
|
@@ -726,11 +726,11 @@ var require_Alias = __commonJS({
|
|
|
726
726
|
}
|
|
727
727
|
};
|
|
728
728
|
function getAliasCount(doc, node, anchors2) {
|
|
729
|
-
if (
|
|
729
|
+
if (identity2.isAlias(node)) {
|
|
730
730
|
const source2 = node.resolve(doc);
|
|
731
731
|
const anchor2 = anchors2 && source2 && anchors2.get(source2);
|
|
732
732
|
return anchor2 ? anchor2.count * anchor2.aliasCount : 0;
|
|
733
|
-
} else if (
|
|
733
|
+
} else if (identity2.isCollection(node)) {
|
|
734
734
|
let count = 0;
|
|
735
735
|
for (const item of node.items) {
|
|
736
736
|
const c = getAliasCount(doc, item, anchors2);
|
|
@@ -738,7 +738,7 @@ var require_Alias = __commonJS({
|
|
|
738
738
|
count = c;
|
|
739
739
|
}
|
|
740
740
|
return count;
|
|
741
|
-
} else if (
|
|
741
|
+
} else if (identity2.isPair(node)) {
|
|
742
742
|
const kc = getAliasCount(doc, node.key, anchors2);
|
|
743
743
|
const vc = getAliasCount(doc, node.value, anchors2);
|
|
744
744
|
return Math.max(kc, vc);
|
|
@@ -753,13 +753,13 @@ var require_Scalar = __commonJS({
|
|
|
753
753
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/Scalar.js"(exports) {
|
|
754
754
|
"use strict";
|
|
755
755
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
756
|
-
var
|
|
756
|
+
var identity2 = require_identity();
|
|
757
757
|
var Node = require_Node();
|
|
758
758
|
var toJS = require_toJS();
|
|
759
759
|
var isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
|
|
760
760
|
var Scalar = class extends Node.NodeBase {
|
|
761
761
|
constructor(value) {
|
|
762
|
-
super(
|
|
762
|
+
super(identity2.SCALAR);
|
|
763
763
|
this.value = value;
|
|
764
764
|
}
|
|
765
765
|
toJSON(arg, ctx) {
|
|
@@ -784,7 +784,7 @@ var require_createNode = __commonJS({
|
|
|
784
784
|
"use strict";
|
|
785
785
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
786
786
|
var Alias = require_Alias();
|
|
787
|
-
var
|
|
787
|
+
var identity2 = require_identity();
|
|
788
788
|
var Scalar = require_Scalar();
|
|
789
789
|
var defaultTagPrefix = "tag:yaml.org,2002:";
|
|
790
790
|
function findTagObject(value, tagName, tags) {
|
|
@@ -798,12 +798,12 @@ var require_createNode = __commonJS({
|
|
|
798
798
|
return tags.find((t) => t.identify?.(value) && !t.format);
|
|
799
799
|
}
|
|
800
800
|
function createNode(value, tagName, ctx) {
|
|
801
|
-
if (
|
|
801
|
+
if (identity2.isDocument(value))
|
|
802
802
|
value = value.contents;
|
|
803
|
-
if (
|
|
803
|
+
if (identity2.isNode(value))
|
|
804
804
|
return value;
|
|
805
|
-
if (
|
|
806
|
-
const map = ctx.schema[
|
|
805
|
+
if (identity2.isPair(value)) {
|
|
806
|
+
const map = ctx.schema[identity2.MAP].createNode?.(ctx.schema, null, ctx);
|
|
807
807
|
map.items.push(value);
|
|
808
808
|
return map;
|
|
809
809
|
}
|
|
@@ -835,7 +835,7 @@ var require_createNode = __commonJS({
|
|
|
835
835
|
ref.node = node2;
|
|
836
836
|
return node2;
|
|
837
837
|
}
|
|
838
|
-
tagObj = value instanceof Map ? schema[
|
|
838
|
+
tagObj = value instanceof Map ? schema[identity2.MAP] : Symbol.iterator in Object(value) ? schema[identity2.SEQ] : schema[identity2.MAP];
|
|
839
839
|
}
|
|
840
840
|
if (onTagObj) {
|
|
841
841
|
onTagObj(tagObj);
|
|
@@ -859,7 +859,7 @@ var require_Collection = __commonJS({
|
|
|
859
859
|
"use strict";
|
|
860
860
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
861
861
|
var createNode = require_createNode();
|
|
862
|
-
var
|
|
862
|
+
var identity2 = require_identity();
|
|
863
863
|
var Node = require_Node();
|
|
864
864
|
function collectionFromPath(schema, path2, value) {
|
|
865
865
|
let v = value;
|
|
@@ -903,7 +903,7 @@ var require_Collection = __commonJS({
|
|
|
903
903
|
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
904
904
|
if (schema)
|
|
905
905
|
copy.schema = schema;
|
|
906
|
-
copy.items = copy.items.map((it) =>
|
|
906
|
+
copy.items = copy.items.map((it) => identity2.isNode(it) || identity2.isPair(it) ? it.clone(schema) : it);
|
|
907
907
|
if (this.range)
|
|
908
908
|
copy.range = this.range.slice();
|
|
909
909
|
return copy;
|
|
@@ -919,7 +919,7 @@ var require_Collection = __commonJS({
|
|
|
919
919
|
else {
|
|
920
920
|
const [key, ...rest] = path2;
|
|
921
921
|
const node = this.get(key, true);
|
|
922
|
-
if (
|
|
922
|
+
if (identity2.isCollection(node))
|
|
923
923
|
node.addIn(rest, value);
|
|
924
924
|
else if (node === void 0 && this.schema)
|
|
925
925
|
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
@@ -936,7 +936,7 @@ var require_Collection = __commonJS({
|
|
|
936
936
|
if (rest.length === 0)
|
|
937
937
|
return this.delete(key);
|
|
938
938
|
const node = this.get(key, true);
|
|
939
|
-
if (
|
|
939
|
+
if (identity2.isCollection(node))
|
|
940
940
|
return node.deleteIn(rest);
|
|
941
941
|
else
|
|
942
942
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
@@ -950,16 +950,16 @@ var require_Collection = __commonJS({
|
|
|
950
950
|
const [key, ...rest] = path2;
|
|
951
951
|
const node = this.get(key, true);
|
|
952
952
|
if (rest.length === 0)
|
|
953
|
-
return !keepScalar &&
|
|
953
|
+
return !keepScalar && identity2.isScalar(node) ? node.value : node;
|
|
954
954
|
else
|
|
955
|
-
return
|
|
955
|
+
return identity2.isCollection(node) ? node.getIn(rest, keepScalar) : void 0;
|
|
956
956
|
}
|
|
957
957
|
hasAllNullValues(allowScalar) {
|
|
958
958
|
return this.items.every((node) => {
|
|
959
|
-
if (!
|
|
959
|
+
if (!identity2.isPair(node))
|
|
960
960
|
return false;
|
|
961
961
|
const n = node.value;
|
|
962
|
-
return n == null || allowScalar &&
|
|
962
|
+
return n == null || allowScalar && identity2.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
963
963
|
});
|
|
964
964
|
}
|
|
965
965
|
/**
|
|
@@ -970,7 +970,7 @@ var require_Collection = __commonJS({
|
|
|
970
970
|
if (rest.length === 0)
|
|
971
971
|
return this.has(key);
|
|
972
972
|
const node = this.get(key, true);
|
|
973
|
-
return
|
|
973
|
+
return identity2.isCollection(node) ? node.hasIn(rest) : false;
|
|
974
974
|
}
|
|
975
975
|
/**
|
|
976
976
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
@@ -982,7 +982,7 @@ var require_Collection = __commonJS({
|
|
|
982
982
|
this.set(key, value);
|
|
983
983
|
} else {
|
|
984
984
|
const node = this.get(key, true);
|
|
985
|
-
if (
|
|
985
|
+
if (identity2.isCollection(node))
|
|
986
986
|
node.setIn(rest, value);
|
|
987
987
|
else if (node === void 0 && this.schema)
|
|
988
988
|
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
@@ -1438,7 +1438,7 @@ var require_stringify = __commonJS({
|
|
|
1438
1438
|
"use strict";
|
|
1439
1439
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
1440
1440
|
var anchors = require_anchors();
|
|
1441
|
-
var
|
|
1441
|
+
var identity2 = require_identity();
|
|
1442
1442
|
var stringifyComment = require_stringifyComment();
|
|
1443
1443
|
var stringifyString = require_stringifyString();
|
|
1444
1444
|
function createStringifyContext(doc, options) {
|
|
@@ -1491,7 +1491,7 @@ var require_stringify = __commonJS({
|
|
|
1491
1491
|
}
|
|
1492
1492
|
let tagObj = void 0;
|
|
1493
1493
|
let obj;
|
|
1494
|
-
if (
|
|
1494
|
+
if (identity2.isScalar(item)) {
|
|
1495
1495
|
obj = item.value;
|
|
1496
1496
|
let match = tags.filter((t) => t.identify?.(obj));
|
|
1497
1497
|
if (match.length > 1) {
|
|
@@ -1514,7 +1514,7 @@ var require_stringify = __commonJS({
|
|
|
1514
1514
|
if (!doc.directives)
|
|
1515
1515
|
return "";
|
|
1516
1516
|
const props = [];
|
|
1517
|
-
const anchor2 = (
|
|
1517
|
+
const anchor2 = (identity2.isScalar(node) || identity2.isCollection(node)) && node.anchor;
|
|
1518
1518
|
if (anchor2 && anchors.anchorIsValid(anchor2)) {
|
|
1519
1519
|
anchors$1.add(anchor2);
|
|
1520
1520
|
props.push(`&${anchor2}`);
|
|
@@ -1525,9 +1525,9 @@ var require_stringify = __commonJS({
|
|
|
1525
1525
|
return props.join(" ");
|
|
1526
1526
|
}
|
|
1527
1527
|
function stringify(item, ctx, onComment, onChompKeep) {
|
|
1528
|
-
if (
|
|
1528
|
+
if (identity2.isPair(item))
|
|
1529
1529
|
return item.toString(ctx, onComment, onChompKeep);
|
|
1530
|
-
if (
|
|
1530
|
+
if (identity2.isAlias(item)) {
|
|
1531
1531
|
if (ctx.doc.directives)
|
|
1532
1532
|
return item.toString(ctx);
|
|
1533
1533
|
if (ctx.resolvedAliases?.has(item)) {
|
|
@@ -1541,15 +1541,15 @@ var require_stringify = __commonJS({
|
|
|
1541
1541
|
}
|
|
1542
1542
|
}
|
|
1543
1543
|
let tagObj = void 0;
|
|
1544
|
-
const node =
|
|
1544
|
+
const node = identity2.isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o) => tagObj = o });
|
|
1545
1545
|
tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
|
|
1546
1546
|
const props = stringifyProps(node, tagObj, ctx);
|
|
1547
1547
|
if (props.length > 0)
|
|
1548
1548
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
1549
|
-
const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) :
|
|
1549
|
+
const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : identity2.isScalar(node) ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
|
|
1550
1550
|
if (!props)
|
|
1551
1551
|
return str;
|
|
1552
|
-
return
|
|
1552
|
+
return identity2.isScalar(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
|
|
1553
1553
|
${ctx.indent}${str}`;
|
|
1554
1554
|
}
|
|
1555
1555
|
exports.createStringifyContext = createStringifyContext;
|
|
@@ -1561,23 +1561,23 @@ var require_stringifyPair = __commonJS({
|
|
|
1561
1561
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyPair.js"(exports) {
|
|
1562
1562
|
"use strict";
|
|
1563
1563
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
1564
|
-
var
|
|
1564
|
+
var identity2 = require_identity();
|
|
1565
1565
|
var Scalar = require_Scalar();
|
|
1566
1566
|
var stringify = require_stringify();
|
|
1567
1567
|
var stringifyComment = require_stringifyComment();
|
|
1568
1568
|
function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
1569
1569
|
const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
|
|
1570
|
-
let keyComment =
|
|
1570
|
+
let keyComment = identity2.isNode(key) && key.comment || null;
|
|
1571
1571
|
if (simpleKeys) {
|
|
1572
1572
|
if (keyComment) {
|
|
1573
1573
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
1574
1574
|
}
|
|
1575
|
-
if (
|
|
1575
|
+
if (identity2.isCollection(key) || !identity2.isNode(key) && typeof key === "object") {
|
|
1576
1576
|
const msg = "With simple keys, collection cannot be used as a key value";
|
|
1577
1577
|
throw new Error(msg);
|
|
1578
1578
|
}
|
|
1579
1579
|
}
|
|
1580
|
-
let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow ||
|
|
1580
|
+
let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || identity2.isCollection(key) || (identity2.isScalar(key) ? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL : typeof key === "object"));
|
|
1581
1581
|
ctx = Object.assign({}, ctx, {
|
|
1582
1582
|
allNullValues: false,
|
|
1583
1583
|
implicitKey: !explicitKey && (simpleKeys || !allNullValues),
|
|
@@ -1618,7 +1618,7 @@ ${indent}:`;
|
|
|
1618
1618
|
str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
|
|
1619
1619
|
}
|
|
1620
1620
|
let vsb, vcb, valueComment;
|
|
1621
|
-
if (
|
|
1621
|
+
if (identity2.isNode(value)) {
|
|
1622
1622
|
vsb = !!value.spaceBefore;
|
|
1623
1623
|
vcb = value.commentBefore;
|
|
1624
1624
|
valueComment = value.comment;
|
|
@@ -1630,10 +1630,10 @@ ${indent}:`;
|
|
|
1630
1630
|
value = doc.createNode(value);
|
|
1631
1631
|
}
|
|
1632
1632
|
ctx.implicitKey = false;
|
|
1633
|
-
if (!explicitKey && !keyComment &&
|
|
1633
|
+
if (!explicitKey && !keyComment && identity2.isScalar(value))
|
|
1634
1634
|
ctx.indentAtStart = str.length + 1;
|
|
1635
1635
|
chompKeep = false;
|
|
1636
|
-
if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey &&
|
|
1636
|
+
if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && identity2.isSeq(value) && !value.flow && !value.tag && !value.anchor) {
|
|
1637
1637
|
ctx.indent = ctx.indent.substring(2);
|
|
1638
1638
|
}
|
|
1639
1639
|
let valueCommentDone = false;
|
|
@@ -1653,7 +1653,7 @@ ${stringifyComment.indentComment(cs, ctx.indent)}`;
|
|
|
1653
1653
|
ws += `
|
|
1654
1654
|
${ctx.indent}`;
|
|
1655
1655
|
}
|
|
1656
|
-
} else if (!explicitKey &&
|
|
1656
|
+
} else if (!explicitKey && identity2.isCollection(value)) {
|
|
1657
1657
|
const vs0 = valueStr[0];
|
|
1658
1658
|
const nl0 = valueStr.indexOf("\n");
|
|
1659
1659
|
const hasNewline = nl0 !== -1;
|
|
@@ -1716,7 +1716,7 @@ var require_merge = __commonJS({
|
|
|
1716
1716
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/merge.js"(exports) {
|
|
1717
1717
|
"use strict";
|
|
1718
1718
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
1719
|
-
var
|
|
1719
|
+
var identity2 = require_identity();
|
|
1720
1720
|
var Scalar = require_Scalar();
|
|
1721
1721
|
var MERGE_KEY = "<<";
|
|
1722
1722
|
var merge2 = {
|
|
@@ -1729,10 +1729,10 @@ var require_merge = __commonJS({
|
|
|
1729
1729
|
}),
|
|
1730
1730
|
stringify: () => MERGE_KEY
|
|
1731
1731
|
};
|
|
1732
|
-
var isMergeKey = (ctx, key) => (merge2.identify(key) ||
|
|
1732
|
+
var isMergeKey = (ctx, key) => (merge2.identify(key) || identity2.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge2.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge2.tag && tag.default);
|
|
1733
1733
|
function addMergeToJSMap(ctx, map, value) {
|
|
1734
1734
|
const source2 = resolveAliasValue(ctx, value);
|
|
1735
|
-
if (
|
|
1735
|
+
if (identity2.isSeq(source2))
|
|
1736
1736
|
for (const it of source2.items)
|
|
1737
1737
|
mergeValue(ctx, map, it);
|
|
1738
1738
|
else if (Array.isArray(source2))
|
|
@@ -1743,7 +1743,7 @@ var require_merge = __commonJS({
|
|
|
1743
1743
|
}
|
|
1744
1744
|
function mergeValue(ctx, map, value) {
|
|
1745
1745
|
const source2 = resolveAliasValue(ctx, value);
|
|
1746
|
-
if (!
|
|
1746
|
+
if (!identity2.isMap(source2))
|
|
1747
1747
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1748
1748
|
const srcMap = source2.toJSON(null, ctx, Map);
|
|
1749
1749
|
for (const [key, value2] of srcMap) {
|
|
@@ -1764,7 +1764,7 @@ var require_merge = __commonJS({
|
|
|
1764
1764
|
return map;
|
|
1765
1765
|
}
|
|
1766
1766
|
function resolveAliasValue(ctx, value) {
|
|
1767
|
-
return ctx &&
|
|
1767
|
+
return ctx && identity2.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
1768
1768
|
}
|
|
1769
1769
|
exports.addMergeToJSMap = addMergeToJSMap;
|
|
1770
1770
|
exports.isMergeKey = isMergeKey;
|
|
@@ -1779,10 +1779,10 @@ var require_addPairToJSMap = __commonJS({
|
|
|
1779
1779
|
var log = require_log();
|
|
1780
1780
|
var merge2 = require_merge();
|
|
1781
1781
|
var stringify = require_stringify();
|
|
1782
|
-
var
|
|
1782
|
+
var identity2 = require_identity();
|
|
1783
1783
|
var toJS = require_toJS();
|
|
1784
1784
|
function addPairToJSMap(ctx, map, { key, value }) {
|
|
1785
|
-
if (
|
|
1785
|
+
if (identity2.isNode(key) && key.addToJSMap)
|
|
1786
1786
|
key.addToJSMap(ctx, map, value);
|
|
1787
1787
|
else if (merge2.isMergeKey(ctx, key))
|
|
1788
1788
|
merge2.addMergeToJSMap(ctx, map, value);
|
|
@@ -1813,7 +1813,7 @@ var require_addPairToJSMap = __commonJS({
|
|
|
1813
1813
|
return "";
|
|
1814
1814
|
if (typeof jsKey !== "object")
|
|
1815
1815
|
return String(jsKey);
|
|
1816
|
-
if (
|
|
1816
|
+
if (identity2.isNode(key) && ctx?.doc) {
|
|
1817
1817
|
const strCtx = stringify.createStringifyContext(ctx.doc, {});
|
|
1818
1818
|
strCtx.anchors = /* @__PURE__ */ new Set();
|
|
1819
1819
|
for (const node of ctx.anchors.keys())
|
|
@@ -1843,7 +1843,7 @@ var require_Pair = __commonJS({
|
|
|
1843
1843
|
var createNode = require_createNode();
|
|
1844
1844
|
var stringifyPair = require_stringifyPair();
|
|
1845
1845
|
var addPairToJSMap = require_addPairToJSMap();
|
|
1846
|
-
var
|
|
1846
|
+
var identity2 = require_identity();
|
|
1847
1847
|
function createPair(key, value, ctx) {
|
|
1848
1848
|
const k = createNode.createNode(key, void 0, ctx);
|
|
1849
1849
|
const v = createNode.createNode(value, void 0, ctx);
|
|
@@ -1851,15 +1851,15 @@ var require_Pair = __commonJS({
|
|
|
1851
1851
|
}
|
|
1852
1852
|
var Pair = class _Pair {
|
|
1853
1853
|
constructor(key, value = null) {
|
|
1854
|
-
Object.defineProperty(this,
|
|
1854
|
+
Object.defineProperty(this, identity2.NODE_TYPE, { value: identity2.PAIR });
|
|
1855
1855
|
this.key = key;
|
|
1856
1856
|
this.value = value;
|
|
1857
1857
|
}
|
|
1858
1858
|
clone(schema) {
|
|
1859
1859
|
let { key, value } = this;
|
|
1860
|
-
if (
|
|
1860
|
+
if (identity2.isNode(key))
|
|
1861
1861
|
key = key.clone(schema);
|
|
1862
|
-
if (
|
|
1862
|
+
if (identity2.isNode(value))
|
|
1863
1863
|
value = value.clone(schema);
|
|
1864
1864
|
return new _Pair(key, value);
|
|
1865
1865
|
}
|
|
@@ -1880,7 +1880,7 @@ var require_stringifyCollection = __commonJS({
|
|
|
1880
1880
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports) {
|
|
1881
1881
|
"use strict";
|
|
1882
1882
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
1883
|
-
var
|
|
1883
|
+
var identity2 = require_identity();
|
|
1884
1884
|
var stringify = require_stringify();
|
|
1885
1885
|
var stringifyComment = require_stringifyComment();
|
|
1886
1886
|
function stringifyCollection(collection, ctx, options) {
|
|
@@ -1896,14 +1896,14 @@ var require_stringifyCollection = __commonJS({
|
|
|
1896
1896
|
for (let i = 0; i < items.length; ++i) {
|
|
1897
1897
|
const item = items[i];
|
|
1898
1898
|
let comment2 = null;
|
|
1899
|
-
if (
|
|
1899
|
+
if (identity2.isNode(item)) {
|
|
1900
1900
|
if (!chompKeep && item.spaceBefore)
|
|
1901
1901
|
lines.push("");
|
|
1902
1902
|
addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
|
|
1903
1903
|
if (item.comment)
|
|
1904
1904
|
comment2 = item.comment;
|
|
1905
|
-
} else if (
|
|
1906
|
-
const ik =
|
|
1905
|
+
} else if (identity2.isPair(item)) {
|
|
1906
|
+
const ik = identity2.isNode(item.key) ? item.key : null;
|
|
1907
1907
|
if (ik) {
|
|
1908
1908
|
if (!chompKeep && ik.spaceBefore)
|
|
1909
1909
|
lines.push("");
|
|
@@ -1951,14 +1951,14 @@ ${indent}${line}` : "\n";
|
|
|
1951
1951
|
for (let i = 0; i < items.length; ++i) {
|
|
1952
1952
|
const item = items[i];
|
|
1953
1953
|
let comment = null;
|
|
1954
|
-
if (
|
|
1954
|
+
if (identity2.isNode(item)) {
|
|
1955
1955
|
if (item.spaceBefore)
|
|
1956
1956
|
lines.push("");
|
|
1957
1957
|
addCommentBefore(ctx, lines, item.commentBefore, false);
|
|
1958
1958
|
if (item.comment)
|
|
1959
1959
|
comment = item.comment;
|
|
1960
|
-
} else if (
|
|
1961
|
-
const ik =
|
|
1960
|
+
} else if (identity2.isPair(item)) {
|
|
1961
|
+
const ik = identity2.isNode(item.key) ? item.key : null;
|
|
1962
1962
|
if (ik) {
|
|
1963
1963
|
if (ik.spaceBefore)
|
|
1964
1964
|
lines.push("");
|
|
@@ -1966,7 +1966,7 @@ ${indent}${line}` : "\n";
|
|
|
1966
1966
|
if (ik.comment)
|
|
1967
1967
|
reqNewline = true;
|
|
1968
1968
|
}
|
|
1969
|
-
const iv =
|
|
1969
|
+
const iv = identity2.isNode(item.value) ? item.value : null;
|
|
1970
1970
|
if (iv) {
|
|
1971
1971
|
if (iv.comment)
|
|
1972
1972
|
comment = iv.comment;
|
|
@@ -2034,16 +2034,16 @@ var require_YAMLMap = __commonJS({
|
|
|
2034
2034
|
var stringifyCollection = require_stringifyCollection();
|
|
2035
2035
|
var addPairToJSMap = require_addPairToJSMap();
|
|
2036
2036
|
var Collection = require_Collection();
|
|
2037
|
-
var
|
|
2037
|
+
var identity2 = require_identity();
|
|
2038
2038
|
var Pair = require_Pair();
|
|
2039
2039
|
var Scalar = require_Scalar();
|
|
2040
2040
|
function findPair(items, key) {
|
|
2041
|
-
const k =
|
|
2041
|
+
const k = identity2.isScalar(key) ? key.value : key;
|
|
2042
2042
|
for (const it of items) {
|
|
2043
|
-
if (
|
|
2043
|
+
if (identity2.isPair(it)) {
|
|
2044
2044
|
if (it.key === key || it.key === k)
|
|
2045
2045
|
return it;
|
|
2046
|
-
if (
|
|
2046
|
+
if (identity2.isScalar(it.key) && it.key.value === k)
|
|
2047
2047
|
return it;
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
@@ -2054,7 +2054,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2054
2054
|
return "tag:yaml.org,2002:map";
|
|
2055
2055
|
}
|
|
2056
2056
|
constructor(schema) {
|
|
2057
|
-
super(
|
|
2057
|
+
super(identity2.MAP, schema);
|
|
2058
2058
|
this.items = [];
|
|
2059
2059
|
}
|
|
2060
2060
|
/**
|
|
@@ -2092,7 +2092,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2092
2092
|
*/
|
|
2093
2093
|
add(pair, overwrite) {
|
|
2094
2094
|
let _pair;
|
|
2095
|
-
if (
|
|
2095
|
+
if (identity2.isPair(pair))
|
|
2096
2096
|
_pair = pair;
|
|
2097
2097
|
else if (!pair || typeof pair !== "object" || !("key" in pair)) {
|
|
2098
2098
|
_pair = new Pair.Pair(pair, pair?.value);
|
|
@@ -2103,7 +2103,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2103
2103
|
if (prev) {
|
|
2104
2104
|
if (!overwrite)
|
|
2105
2105
|
throw new Error(`Key ${_pair.key} already set`);
|
|
2106
|
-
if (
|
|
2106
|
+
if (identity2.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))
|
|
2107
2107
|
prev.value.value = _pair.value;
|
|
2108
2108
|
else
|
|
2109
2109
|
prev.value = _pair.value;
|
|
@@ -2127,7 +2127,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2127
2127
|
get(key, keepScalar) {
|
|
2128
2128
|
const it = findPair(this.items, key);
|
|
2129
2129
|
const node = it?.value;
|
|
2130
|
-
return (!keepScalar &&
|
|
2130
|
+
return (!keepScalar && identity2.isScalar(node) ? node.value : node) ?? void 0;
|
|
2131
2131
|
}
|
|
2132
2132
|
has(key) {
|
|
2133
2133
|
return !!findPair(this.items, key);
|
|
@@ -2152,7 +2152,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2152
2152
|
if (!ctx)
|
|
2153
2153
|
return JSON.stringify(this);
|
|
2154
2154
|
for (const item of this.items) {
|
|
2155
|
-
if (!
|
|
2155
|
+
if (!identity2.isPair(item))
|
|
2156
2156
|
throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
|
|
2157
2157
|
}
|
|
2158
2158
|
if (!ctx.allNullValues && this.hasAllNullValues(false))
|
|
@@ -2175,7 +2175,7 @@ var require_map = __commonJS({
|
|
|
2175
2175
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/common/map.js"(exports) {
|
|
2176
2176
|
"use strict";
|
|
2177
2177
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
2178
|
-
var
|
|
2178
|
+
var identity2 = require_identity();
|
|
2179
2179
|
var YAMLMap = require_YAMLMap();
|
|
2180
2180
|
var map = {
|
|
2181
2181
|
collection: "map",
|
|
@@ -2183,7 +2183,7 @@ var require_map = __commonJS({
|
|
|
2183
2183
|
nodeClass: YAMLMap.YAMLMap,
|
|
2184
2184
|
tag: "tag:yaml.org,2002:map",
|
|
2185
2185
|
resolve(map2, onError) {
|
|
2186
|
-
if (!
|
|
2186
|
+
if (!identity2.isMap(map2))
|
|
2187
2187
|
onError("Expected a mapping for this tag");
|
|
2188
2188
|
return map2;
|
|
2189
2189
|
},
|
|
@@ -2200,7 +2200,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
2200
2200
|
var createNode = require_createNode();
|
|
2201
2201
|
var stringifyCollection = require_stringifyCollection();
|
|
2202
2202
|
var Collection = require_Collection();
|
|
2203
|
-
var
|
|
2203
|
+
var identity2 = require_identity();
|
|
2204
2204
|
var Scalar = require_Scalar();
|
|
2205
2205
|
var toJS = require_toJS();
|
|
2206
2206
|
var YAMLSeq = class extends Collection.Collection {
|
|
@@ -2208,7 +2208,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
2208
2208
|
return "tag:yaml.org,2002:seq";
|
|
2209
2209
|
}
|
|
2210
2210
|
constructor(schema) {
|
|
2211
|
-
super(
|
|
2211
|
+
super(identity2.SEQ, schema);
|
|
2212
2212
|
this.items = [];
|
|
2213
2213
|
}
|
|
2214
2214
|
add(value) {
|
|
@@ -2234,7 +2234,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
2234
2234
|
if (typeof idx !== "number")
|
|
2235
2235
|
return void 0;
|
|
2236
2236
|
const it = this.items[idx];
|
|
2237
|
-
return !keepScalar &&
|
|
2237
|
+
return !keepScalar && identity2.isScalar(it) ? it.value : it;
|
|
2238
2238
|
}
|
|
2239
2239
|
/**
|
|
2240
2240
|
* Checks if the collection includes a value with the key `key`.
|
|
@@ -2258,7 +2258,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
2258
2258
|
if (typeof idx !== "number")
|
|
2259
2259
|
throw new Error(`Expected a valid index, not ${key}.`);
|
|
2260
2260
|
const prev = this.items[idx];
|
|
2261
|
-
if (
|
|
2261
|
+
if (identity2.isScalar(prev) && Scalar.isScalarValue(value))
|
|
2262
2262
|
prev.value = value;
|
|
2263
2263
|
else
|
|
2264
2264
|
this.items[idx] = value;
|
|
@@ -2300,7 +2300,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
2300
2300
|
}
|
|
2301
2301
|
};
|
|
2302
2302
|
function asItemIndex(key) {
|
|
2303
|
-
let idx =
|
|
2303
|
+
let idx = identity2.isScalar(key) ? key.value : key;
|
|
2304
2304
|
if (idx && typeof idx === "string")
|
|
2305
2305
|
idx = Number(idx);
|
|
2306
2306
|
return typeof idx === "number" && Number.isInteger(idx) && idx >= 0 ? idx : null;
|
|
@@ -2313,7 +2313,7 @@ var require_seq = __commonJS({
|
|
|
2313
2313
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/common/seq.js"(exports) {
|
|
2314
2314
|
"use strict";
|
|
2315
2315
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
2316
|
-
var
|
|
2316
|
+
var identity2 = require_identity();
|
|
2317
2317
|
var YAMLSeq = require_YAMLSeq();
|
|
2318
2318
|
var seq = {
|
|
2319
2319
|
collection: "seq",
|
|
@@ -2321,7 +2321,7 @@ var require_seq = __commonJS({
|
|
|
2321
2321
|
nodeClass: YAMLSeq.YAMLSeq,
|
|
2322
2322
|
tag: "tag:yaml.org,2002:seq",
|
|
2323
2323
|
resolve(seq2, onError) {
|
|
2324
|
-
if (!
|
|
2324
|
+
if (!identity2.isSeq(seq2))
|
|
2325
2325
|
onError("Expected a sequence for this tag");
|
|
2326
2326
|
return seq2;
|
|
2327
2327
|
},
|
|
@@ -2675,17 +2675,17 @@ var require_pairs = __commonJS({
|
|
|
2675
2675
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/pairs.js"(exports) {
|
|
2676
2676
|
"use strict";
|
|
2677
2677
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
2678
|
-
var
|
|
2678
|
+
var identity2 = require_identity();
|
|
2679
2679
|
var Pair = require_Pair();
|
|
2680
2680
|
var Scalar = require_Scalar();
|
|
2681
2681
|
var YAMLSeq = require_YAMLSeq();
|
|
2682
2682
|
function resolvePairs(seq, onError) {
|
|
2683
|
-
if (
|
|
2683
|
+
if (identity2.isSeq(seq)) {
|
|
2684
2684
|
for (let i = 0; i < seq.items.length; ++i) {
|
|
2685
2685
|
let item = seq.items[i];
|
|
2686
|
-
if (
|
|
2686
|
+
if (identity2.isPair(item))
|
|
2687
2687
|
continue;
|
|
2688
|
-
else if (
|
|
2688
|
+
else if (identity2.isMap(item)) {
|
|
2689
2689
|
if (item.items.length > 1)
|
|
2690
2690
|
onError("Each pair must have its own sequence indicator");
|
|
2691
2691
|
const pair = item.items[0] || new Pair.Pair(new Scalar.Scalar(null));
|
|
@@ -2699,7 +2699,7 @@ ${cn.comment}` : item.comment;
|
|
|
2699
2699
|
}
|
|
2700
2700
|
item = pair;
|
|
2701
2701
|
}
|
|
2702
|
-
seq.items[i] =
|
|
2702
|
+
seq.items[i] = identity2.isPair(item) ? item : new Pair.Pair(item);
|
|
2703
2703
|
}
|
|
2704
2704
|
} else
|
|
2705
2705
|
onError("Expected a sequence for this tag");
|
|
@@ -2753,7 +2753,7 @@ var require_omap = __commonJS({
|
|
|
2753
2753
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/omap.js"(exports) {
|
|
2754
2754
|
"use strict";
|
|
2755
2755
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
2756
|
-
var
|
|
2756
|
+
var identity2 = require_identity();
|
|
2757
2757
|
var toJS = require_toJS();
|
|
2758
2758
|
var YAMLMap = require_YAMLMap();
|
|
2759
2759
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -2780,7 +2780,7 @@ var require_omap = __commonJS({
|
|
|
2780
2780
|
ctx.onCreate(map);
|
|
2781
2781
|
for (const pair of this.items) {
|
|
2782
2782
|
let key, value;
|
|
2783
|
-
if (
|
|
2783
|
+
if (identity2.isPair(pair)) {
|
|
2784
2784
|
key = toJS.toJS(pair.key, "", ctx);
|
|
2785
2785
|
value = toJS.toJS(pair.value, key, ctx);
|
|
2786
2786
|
} else {
|
|
@@ -2810,7 +2810,7 @@ var require_omap = __commonJS({
|
|
|
2810
2810
|
const pairs$1 = pairs.resolvePairs(seq, onError);
|
|
2811
2811
|
const seenKeys = [];
|
|
2812
2812
|
for (const { key } of pairs$1.items) {
|
|
2813
|
-
if (
|
|
2813
|
+
if (identity2.isScalar(key)) {
|
|
2814
2814
|
if (seenKeys.includes(key.value)) {
|
|
2815
2815
|
onError(`Ordered maps must not include duplicate keys: ${key.value}`);
|
|
2816
2816
|
} else {
|
|
@@ -2991,7 +2991,7 @@ var require_set = __commonJS({
|
|
|
2991
2991
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/yaml-1.1/set.js"(exports) {
|
|
2992
2992
|
"use strict";
|
|
2993
2993
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
2994
|
-
var
|
|
2994
|
+
var identity2 = require_identity();
|
|
2995
2995
|
var Pair = require_Pair();
|
|
2996
2996
|
var YAMLMap = require_YAMLMap();
|
|
2997
2997
|
var YAMLSet = class _YAMLSet extends YAMLMap.YAMLMap {
|
|
@@ -3001,7 +3001,7 @@ var require_set = __commonJS({
|
|
|
3001
3001
|
}
|
|
3002
3002
|
add(key) {
|
|
3003
3003
|
let pair;
|
|
3004
|
-
if (
|
|
3004
|
+
if (identity2.isPair(key))
|
|
3005
3005
|
pair = key;
|
|
3006
3006
|
else if (key && typeof key === "object" && "key" in key && "value" in key && key.value === null)
|
|
3007
3007
|
pair = new Pair.Pair(key.key, null);
|
|
@@ -3017,7 +3017,7 @@ var require_set = __commonJS({
|
|
|
3017
3017
|
*/
|
|
3018
3018
|
get(key, keepPair) {
|
|
3019
3019
|
const pair = YAMLMap.findPair(this.items, key);
|
|
3020
|
-
return !keepPair &&
|
|
3020
|
+
return !keepPair && identity2.isPair(pair) ? identity2.isScalar(pair.key) ? pair.key.value : pair.key : pair;
|
|
3021
3021
|
}
|
|
3022
3022
|
set(key, value) {
|
|
3023
3023
|
if (typeof value !== "boolean")
|
|
@@ -3061,7 +3061,7 @@ var require_set = __commonJS({
|
|
|
3061
3061
|
tag: "tag:yaml.org,2002:set",
|
|
3062
3062
|
createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),
|
|
3063
3063
|
resolve(map, onError) {
|
|
3064
|
-
if (
|
|
3064
|
+
if (identity2.isMap(map)) {
|
|
3065
3065
|
if (map.hasAllNullValues(true))
|
|
3066
3066
|
return Object.assign(new YAMLSet(), map);
|
|
3067
3067
|
else
|
|
@@ -3306,7 +3306,7 @@ var require_Schema = __commonJS({
|
|
|
3306
3306
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/schema/Schema.js"(exports) {
|
|
3307
3307
|
"use strict";
|
|
3308
3308
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
3309
|
-
var
|
|
3309
|
+
var identity2 = require_identity();
|
|
3310
3310
|
var map = require_map();
|
|
3311
3311
|
var seq = require_seq();
|
|
3312
3312
|
var string3 = require_string();
|
|
@@ -3319,9 +3319,9 @@ var require_Schema = __commonJS({
|
|
|
3319
3319
|
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
|
3320
3320
|
this.tags = tags.getTags(customTags, this.name, merge2);
|
|
3321
3321
|
this.toStringOptions = toStringDefaults ?? null;
|
|
3322
|
-
Object.defineProperty(this,
|
|
3323
|
-
Object.defineProperty(this,
|
|
3324
|
-
Object.defineProperty(this,
|
|
3322
|
+
Object.defineProperty(this, identity2.MAP, { value: map.map });
|
|
3323
|
+
Object.defineProperty(this, identity2.SCALAR, { value: string3.string });
|
|
3324
|
+
Object.defineProperty(this, identity2.SEQ, { value: seq.seq });
|
|
3325
3325
|
this.sortMapEntries = typeof sortMapEntries === "function" ? sortMapEntries : sortMapEntries === true ? sortMapEntriesByKey : null;
|
|
3326
3326
|
}
|
|
3327
3327
|
clone() {
|
|
@@ -3338,7 +3338,7 @@ var require_stringifyDocument = __commonJS({
|
|
|
3338
3338
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports) {
|
|
3339
3339
|
"use strict";
|
|
3340
3340
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
3341
|
-
var
|
|
3341
|
+
var identity2 = require_identity();
|
|
3342
3342
|
var stringify = require_stringify();
|
|
3343
3343
|
var stringifyComment = require_stringifyComment();
|
|
3344
3344
|
function stringifyDocument(doc, options) {
|
|
@@ -3365,7 +3365,7 @@ var require_stringifyDocument = __commonJS({
|
|
|
3365
3365
|
let chompKeep = false;
|
|
3366
3366
|
let contentComment = null;
|
|
3367
3367
|
if (doc.contents) {
|
|
3368
|
-
if (
|
|
3368
|
+
if (identity2.isNode(doc.contents)) {
|
|
3369
3369
|
if (doc.contents.spaceBefore && hasDirectives)
|
|
3370
3370
|
lines.push("");
|
|
3371
3371
|
if (doc.contents.commentBefore) {
|
|
@@ -3420,7 +3420,7 @@ var require_Document = __commonJS({
|
|
|
3420
3420
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
3421
3421
|
var Alias = require_Alias();
|
|
3422
3422
|
var Collection = require_Collection();
|
|
3423
|
-
var
|
|
3423
|
+
var identity2 = require_identity();
|
|
3424
3424
|
var Pair = require_Pair();
|
|
3425
3425
|
var toJS = require_toJS();
|
|
3426
3426
|
var Schema = require_Schema();
|
|
@@ -3435,7 +3435,7 @@ var require_Document = __commonJS({
|
|
|
3435
3435
|
this.comment = null;
|
|
3436
3436
|
this.errors = [];
|
|
3437
3437
|
this.warnings = [];
|
|
3438
|
-
Object.defineProperty(this,
|
|
3438
|
+
Object.defineProperty(this, identity2.NODE_TYPE, { value: identity2.DOC });
|
|
3439
3439
|
let _replacer = null;
|
|
3440
3440
|
if (typeof replacer === "function" || Array.isArray(replacer)) {
|
|
3441
3441
|
_replacer = replacer;
|
|
@@ -3471,7 +3471,7 @@ var require_Document = __commonJS({
|
|
|
3471
3471
|
*/
|
|
3472
3472
|
clone() {
|
|
3473
3473
|
const copy = Object.create(_Document.prototype, {
|
|
3474
|
-
[
|
|
3474
|
+
[identity2.NODE_TYPE]: { value: identity2.DOC }
|
|
3475
3475
|
});
|
|
3476
3476
|
copy.commentBefore = this.commentBefore;
|
|
3477
3477
|
copy.comment = this.comment;
|
|
@@ -3481,7 +3481,7 @@ var require_Document = __commonJS({
|
|
|
3481
3481
|
if (this.directives)
|
|
3482
3482
|
copy.directives = this.directives.clone();
|
|
3483
3483
|
copy.schema = this.schema.clone();
|
|
3484
|
-
copy.contents =
|
|
3484
|
+
copy.contents = identity2.isNode(this.contents) ? this.contents.clone(copy.schema) : this.contents;
|
|
3485
3485
|
if (this.range)
|
|
3486
3486
|
copy.range = this.range.slice();
|
|
3487
3487
|
return copy;
|
|
@@ -3544,7 +3544,7 @@ var require_Document = __commonJS({
|
|
|
3544
3544
|
sourceObjects
|
|
3545
3545
|
};
|
|
3546
3546
|
const node = createNode.createNode(value, tag, ctx);
|
|
3547
|
-
if (flow &&
|
|
3547
|
+
if (flow && identity2.isCollection(node))
|
|
3548
3548
|
node.flow = true;
|
|
3549
3549
|
setAnchors();
|
|
3550
3550
|
return node;
|
|
@@ -3584,7 +3584,7 @@ var require_Document = __commonJS({
|
|
|
3584
3584
|
* `true` (collections are always returned intact).
|
|
3585
3585
|
*/
|
|
3586
3586
|
get(key, keepScalar) {
|
|
3587
|
-
return
|
|
3587
|
+
return identity2.isCollection(this.contents) ? this.contents.get(key, keepScalar) : void 0;
|
|
3588
3588
|
}
|
|
3589
3589
|
/**
|
|
3590
3590
|
* Returns item at `path`, or `undefined` if not found. By default unwraps
|
|
@@ -3593,14 +3593,14 @@ var require_Document = __commonJS({
|
|
|
3593
3593
|
*/
|
|
3594
3594
|
getIn(path2, keepScalar) {
|
|
3595
3595
|
if (Collection.isEmptyPath(path2))
|
|
3596
|
-
return !keepScalar &&
|
|
3597
|
-
return
|
|
3596
|
+
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3597
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path2, keepScalar) : void 0;
|
|
3598
3598
|
}
|
|
3599
3599
|
/**
|
|
3600
3600
|
* Checks if the document includes a value with the key `key`.
|
|
3601
3601
|
*/
|
|
3602
3602
|
has(key) {
|
|
3603
|
-
return
|
|
3603
|
+
return identity2.isCollection(this.contents) ? this.contents.has(key) : false;
|
|
3604
3604
|
}
|
|
3605
3605
|
/**
|
|
3606
3606
|
* Checks if the document includes a value at `path`.
|
|
@@ -3608,7 +3608,7 @@ var require_Document = __commonJS({
|
|
|
3608
3608
|
hasIn(path2) {
|
|
3609
3609
|
if (Collection.isEmptyPath(path2))
|
|
3610
3610
|
return this.contents !== void 0;
|
|
3611
|
-
return
|
|
3611
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path2) : false;
|
|
3612
3612
|
}
|
|
3613
3613
|
/**
|
|
3614
3614
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3715,7 +3715,7 @@ var require_Document = __commonJS({
|
|
|
3715
3715
|
}
|
|
3716
3716
|
};
|
|
3717
3717
|
function assertCollection(contents) {
|
|
3718
|
-
if (
|
|
3718
|
+
if (identity2.isCollection(contents))
|
|
3719
3719
|
return true;
|
|
3720
3720
|
throw new Error("Expected a YAML collection as document contents");
|
|
3721
3721
|
}
|
|
@@ -3986,12 +3986,12 @@ var require_util_map_includes = __commonJS({
|
|
|
3986
3986
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/util-map-includes.js"(exports) {
|
|
3987
3987
|
"use strict";
|
|
3988
3988
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
3989
|
-
var
|
|
3989
|
+
var identity2 = require_identity();
|
|
3990
3990
|
function mapIncludes(ctx, items, search) {
|
|
3991
3991
|
const { uniqueKeys } = ctx.options;
|
|
3992
3992
|
if (uniqueKeys === false)
|
|
3993
3993
|
return false;
|
|
3994
|
-
const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b ||
|
|
3994
|
+
const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b || identity2.isScalar(a) && identity2.isScalar(b) && a.value === b.value;
|
|
3995
3995
|
return items.some((pair) => isEqual(pair.key, search));
|
|
3996
3996
|
}
|
|
3997
3997
|
exports.mapIncludes = mapIncludes;
|
|
@@ -4204,7 +4204,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4204
4204
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/resolve-flow-collection.js"(exports) {
|
|
4205
4205
|
"use strict";
|
|
4206
4206
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
4207
|
-
var
|
|
4207
|
+
var identity2 = require_identity();
|
|
4208
4208
|
var Pair = require_Pair();
|
|
4209
4209
|
var YAMLMap = require_YAMLMap();
|
|
4210
4210
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -4283,7 +4283,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4283
4283
|
}
|
|
4284
4284
|
if (prevItemComment) {
|
|
4285
4285
|
let prev = coll.items[coll.items.length - 1];
|
|
4286
|
-
if (
|
|
4286
|
+
if (identity2.isPair(prev))
|
|
4287
4287
|
prev = prev.value ?? prev.key;
|
|
4288
4288
|
if (prev.comment)
|
|
4289
4289
|
prev.comment += "\n" + prevItemComment;
|
|
@@ -4398,7 +4398,7 @@ var require_compose_collection = __commonJS({
|
|
|
4398
4398
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/compose-collection.js"(exports) {
|
|
4399
4399
|
"use strict";
|
|
4400
4400
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
4401
|
-
var
|
|
4401
|
+
var identity2 = require_identity();
|
|
4402
4402
|
var Scalar = require_Scalar();
|
|
4403
4403
|
var YAMLMap = require_YAMLMap();
|
|
4404
4404
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -4448,7 +4448,7 @@ var require_compose_collection = __commonJS({
|
|
|
4448
4448
|
}
|
|
4449
4449
|
const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);
|
|
4450
4450
|
const res = tag.resolve?.(coll, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg), ctx.options) ?? coll;
|
|
4451
|
-
const node =
|
|
4451
|
+
const node = identity2.isNode(res) ? res : new Scalar.Scalar(res);
|
|
4452
4452
|
node.range = coll.range;
|
|
4453
4453
|
node.tag = tagName;
|
|
4454
4454
|
if (tag?.format)
|
|
@@ -4866,7 +4866,7 @@ var require_compose_scalar = __commonJS({
|
|
|
4866
4866
|
"node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/compose/compose-scalar.js"(exports) {
|
|
4867
4867
|
"use strict";
|
|
4868
4868
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
4869
|
-
var
|
|
4869
|
+
var identity2 = require_identity();
|
|
4870
4870
|
var Scalar = require_Scalar();
|
|
4871
4871
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
4872
4872
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -4875,17 +4875,17 @@ var require_compose_scalar = __commonJS({
|
|
|
4875
4875
|
const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null;
|
|
4876
4876
|
let tag;
|
|
4877
4877
|
if (ctx.options.stringKeys && ctx.atKey) {
|
|
4878
|
-
tag = ctx.schema[
|
|
4878
|
+
tag = ctx.schema[identity2.SCALAR];
|
|
4879
4879
|
} else if (tagName)
|
|
4880
4880
|
tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
|
|
4881
4881
|
else if (token.type === "scalar")
|
|
4882
4882
|
tag = findScalarTagByTest(ctx, value, token, onError);
|
|
4883
4883
|
else
|
|
4884
|
-
tag = ctx.schema[
|
|
4884
|
+
tag = ctx.schema[identity2.SCALAR];
|
|
4885
4885
|
let scalar2;
|
|
4886
4886
|
try {
|
|
4887
4887
|
const res = tag.resolve(value, (msg) => onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg), ctx.options);
|
|
4888
|
-
scalar2 =
|
|
4888
|
+
scalar2 = identity2.isScalar(res) ? res : new Scalar.Scalar(res);
|
|
4889
4889
|
} catch (error) {
|
|
4890
4890
|
const msg = error instanceof Error ? error.message : String(error);
|
|
4891
4891
|
onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
|
|
@@ -4905,7 +4905,7 @@ var require_compose_scalar = __commonJS({
|
|
|
4905
4905
|
}
|
|
4906
4906
|
function findScalarTagByName(schema, value, tagName, tagToken, onError) {
|
|
4907
4907
|
if (tagName === "!")
|
|
4908
|
-
return schema[
|
|
4908
|
+
return schema[identity2.SCALAR];
|
|
4909
4909
|
const matchWithTest = [];
|
|
4910
4910
|
for (const tag of schema.tags) {
|
|
4911
4911
|
if (!tag.collection && tag.tag === tagName) {
|
|
@@ -4924,12 +4924,12 @@ var require_compose_scalar = __commonJS({
|
|
|
4924
4924
|
return kt;
|
|
4925
4925
|
}
|
|
4926
4926
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
|
|
4927
|
-
return schema[
|
|
4927
|
+
return schema[identity2.SCALAR];
|
|
4928
4928
|
}
|
|
4929
4929
|
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
|
4930
|
-
const tag = schema.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema[
|
|
4930
|
+
const tag = schema.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema[identity2.SCALAR];
|
|
4931
4931
|
if (schema.compat) {
|
|
4932
|
-
const compat = schema.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema[
|
|
4932
|
+
const compat = schema.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema[identity2.SCALAR];
|
|
4933
4933
|
if (tag.tag !== compat.tag) {
|
|
4934
4934
|
const ts = directives.tagString(tag.tag);
|
|
4935
4935
|
const cs = directives.tagString(compat.tag);
|
|
@@ -4978,7 +4978,7 @@ var require_compose_node = __commonJS({
|
|
|
4978
4978
|
"use strict";
|
|
4979
4979
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
4980
4980
|
var Alias = require_Alias();
|
|
4981
|
-
var
|
|
4981
|
+
var identity2 = require_identity();
|
|
4982
4982
|
var composeCollection = require_compose_collection();
|
|
4983
4983
|
var composeScalar = require_compose_scalar();
|
|
4984
4984
|
var resolveEnd = require_resolve_end();
|
|
@@ -5024,7 +5024,7 @@ var require_compose_node = __commonJS({
|
|
|
5024
5024
|
node ?? (node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError));
|
|
5025
5025
|
if (anchor2 && node.anchor === "")
|
|
5026
5026
|
onError(anchor2, "BAD_ALIAS", "Anchor cannot be an empty string");
|
|
5027
|
-
if (atKey && ctx.options.stringKeys && (!
|
|
5027
|
+
if (atKey && ctx.options.stringKeys && (!identity2.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
|
|
5028
5028
|
const msg = "With stringKeys, all keys must be strings";
|
|
5029
5029
|
onError(tag ?? token, "NON_STRING_KEY", msg);
|
|
5030
5030
|
}
|
|
@@ -5130,7 +5130,7 @@ var require_composer = __commonJS({
|
|
|
5130
5130
|
var directives = require_directives();
|
|
5131
5131
|
var Document = require_Document();
|
|
5132
5132
|
var errors = require_errors();
|
|
5133
|
-
var
|
|
5133
|
+
var identity2 = require_identity();
|
|
5134
5134
|
var composeDoc = require_compose_doc();
|
|
5135
5135
|
var resolveEnd = require_resolve_end();
|
|
5136
5136
|
function getErrorPos(src) {
|
|
@@ -5192,9 +5192,9 @@ var require_composer = __commonJS({
|
|
|
5192
5192
|
${comment}` : comment;
|
|
5193
5193
|
} else if (afterEmptyLine || doc.directives.docStart || !dc) {
|
|
5194
5194
|
doc.commentBefore = comment;
|
|
5195
|
-
} else if (
|
|
5195
|
+
} else if (identity2.isCollection(dc) && !dc.flow && dc.items.length > 0) {
|
|
5196
5196
|
let it = dc.items[0];
|
|
5197
|
-
if (
|
|
5197
|
+
if (identity2.isPair(it))
|
|
5198
5198
|
it = it.key;
|
|
5199
5199
|
const cb = it.commentBefore;
|
|
5200
5200
|
it.commentBefore = cb ? `${comment}
|
|
@@ -7242,7 +7242,7 @@ var require_public_api = __commonJS({
|
|
|
7242
7242
|
var Document = require_Document();
|
|
7243
7243
|
var errors = require_errors();
|
|
7244
7244
|
var log = require_log();
|
|
7245
|
-
var
|
|
7245
|
+
var identity2 = require_identity();
|
|
7246
7246
|
var lineCounter = require_line_counter();
|
|
7247
7247
|
var parser = require_parser();
|
|
7248
7248
|
function parseOptions(options) {
|
|
@@ -7320,7 +7320,7 @@ var require_public_api = __commonJS({
|
|
|
7320
7320
|
if (!keepUndefined)
|
|
7321
7321
|
return void 0;
|
|
7322
7322
|
}
|
|
7323
|
-
if (
|
|
7323
|
+
if (identity2.isDocument(value) && !_replacer)
|
|
7324
7324
|
return value.toString(options);
|
|
7325
7325
|
return new Document.Document(value, _replacer, options).toString(options);
|
|
7326
7326
|
}
|
|
@@ -7340,7 +7340,7 @@ var require_dist = __commonJS({
|
|
|
7340
7340
|
var Schema = require_Schema();
|
|
7341
7341
|
var errors = require_errors();
|
|
7342
7342
|
var Alias = require_Alias();
|
|
7343
|
-
var
|
|
7343
|
+
var identity2 = require_identity();
|
|
7344
7344
|
var Pair = require_Pair();
|
|
7345
7345
|
var Scalar = require_Scalar();
|
|
7346
7346
|
var YAMLMap = require_YAMLMap();
|
|
@@ -7358,14 +7358,14 @@ var require_dist = __commonJS({
|
|
|
7358
7358
|
exports.YAMLParseError = errors.YAMLParseError;
|
|
7359
7359
|
exports.YAMLWarning = errors.YAMLWarning;
|
|
7360
7360
|
exports.Alias = Alias.Alias;
|
|
7361
|
-
exports.isAlias =
|
|
7362
|
-
exports.isCollection =
|
|
7363
|
-
exports.isDocument =
|
|
7364
|
-
exports.isMap =
|
|
7365
|
-
exports.isNode =
|
|
7366
|
-
exports.isPair =
|
|
7367
|
-
exports.isScalar =
|
|
7368
|
-
exports.isSeq =
|
|
7361
|
+
exports.isAlias = identity2.isAlias;
|
|
7362
|
+
exports.isCollection = identity2.isCollection;
|
|
7363
|
+
exports.isDocument = identity2.isDocument;
|
|
7364
|
+
exports.isMap = identity2.isMap;
|
|
7365
|
+
exports.isNode = identity2.isNode;
|
|
7366
|
+
exports.isPair = identity2.isPair;
|
|
7367
|
+
exports.isScalar = identity2.isScalar;
|
|
7368
|
+
exports.isSeq = identity2.isSeq;
|
|
7369
7369
|
exports.Pair = Pair.Pair;
|
|
7370
7370
|
exports.Scalar = Scalar.Scalar;
|
|
7371
7371
|
exports.YAMLMap = YAMLMap.YAMLMap;
|
|
@@ -7483,9 +7483,9 @@ function evidenceVerdict(code2, message, evidence) {
|
|
|
7483
7483
|
var IMPORT = /\bfrom\s+['"](@[A-Za-z0-9_-]+\/[A-Za-z0-9._-]+)/;
|
|
7484
7484
|
function nearestManifest(projectRoot2, filePath) {
|
|
7485
7485
|
const root = resolve(projectRoot2);
|
|
7486
|
-
let
|
|
7487
|
-
while (
|
|
7488
|
-
const candidate = join(
|
|
7486
|
+
let directory2 = dirname(resolve(projectRoot2, filePath));
|
|
7487
|
+
while (directory2.startsWith(root)) {
|
|
7488
|
+
const candidate = join(directory2, "package.json");
|
|
7489
7489
|
if (existsSync(candidate)) {
|
|
7490
7490
|
try {
|
|
7491
7491
|
const parsed = JSON.parse(readFileSync(candidate, "utf8"));
|
|
@@ -7502,9 +7502,9 @@ function nearestManifest(projectRoot2, filePath) {
|
|
|
7502
7502
|
return void 0;
|
|
7503
7503
|
}
|
|
7504
7504
|
}
|
|
7505
|
-
const parent = dirname(
|
|
7506
|
-
if (parent ===
|
|
7507
|
-
|
|
7505
|
+
const parent = dirname(directory2);
|
|
7506
|
+
if (parent === directory2) break;
|
|
7507
|
+
directory2 = parent;
|
|
7508
7508
|
}
|
|
7509
7509
|
return void 0;
|
|
7510
7510
|
}
|
|
@@ -7842,7 +7842,7 @@ function noConsole(edits, projectRoot2) {
|
|
|
7842
7842
|
}
|
|
7843
7843
|
|
|
7844
7844
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
7845
|
-
var FOCUSED = /\b(?:it|test|describe)\.only\b|\b(?:it|test)\.skip\b|\b(?:xit|xdescribe)\b/;
|
|
7845
|
+
var FOCUSED = /\b(?:it|test|describe)\.only\b|\b(?:it|test|describe)\.skip\b|\b(?:xit|xdescribe|fit|fdescribe)\b/;
|
|
7846
7846
|
function noFocusedTest(edits) {
|
|
7847
7847
|
return evidenceVerdict(
|
|
7848
7848
|
"FOCUSED_OR_SKIPPED_TEST",
|
|
@@ -8406,14 +8406,14 @@ import { readFileSync as readFileSync4, statSync } from "node:fs";
|
|
|
8406
8406
|
import { fileURLToPath } from "node:url";
|
|
8407
8407
|
|
|
8408
8408
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
8409
|
-
var SYNTAX_WORKER_IDENTITY = { "sha256": "
|
|
8409
|
+
var SYNTAX_WORKER_IDENTITY = { "sha256": "462f4c488e85f6e104338e09b283bb934a84442f26c40102ec268eeb89c12ffe", "bytes": 3588428 };
|
|
8410
8410
|
|
|
8411
8411
|
function runSyntaxWorker(root, input, remainingMs) {
|
|
8412
8412
|
const started = performance.now();
|
|
8413
8413
|
const worker = fileURLToPath(new URL(true ? "./_syntax-worker.cjs" : "../../../core/hooks/_syntax-worker.cjs", import.meta.url));
|
|
8414
|
-
const
|
|
8414
|
+
const identity2 = typeof define_VOID_SYNTAX_WORKER_IDENTITY_default === "object" ? define_VOID_SYNTAX_WORKER_IDENTITY_default : SYNTAX_WORKER_IDENTITY;
|
|
8415
8415
|
try {
|
|
8416
|
-
if (
|
|
8416
|
+
if (identity2.bytes > 8 * 1024 * 1024 || statSync(worker).size !== identity2.bytes || createHash("sha256").update(readFileSync4(worker)).digest("hex") !== identity2.sha256) {
|
|
8417
8417
|
return { version: 1, kind: "unavailable" };
|
|
8418
8418
|
}
|
|
8419
8419
|
const timeout = Math.min(SYNTAX_OPERATION_BUDGET_MS, remainingMs) - (performance.now() - started);
|
|
@@ -8616,8 +8616,8 @@ function parseProductIdentity(value) {
|
|
|
8616
8616
|
}
|
|
8617
8617
|
var PRODUCT_IDENTITY = parseProductIdentity(identity_default);
|
|
8618
8618
|
var PRODUCT_COMMAND = PRODUCT_IDENTITY.commands.primary;
|
|
8619
|
-
function productSetting(env, name,
|
|
8620
|
-
for (const prefix of [
|
|
8619
|
+
function productSetting(env, name, identity2 = PRODUCT_IDENTITY) {
|
|
8620
|
+
for (const prefix of [identity2.environment.prefix, ...identity2.environment.deprecated]) {
|
|
8621
8621
|
const value = env[`${prefix}${name}`];
|
|
8622
8622
|
if (value !== void 0) return value;
|
|
8623
8623
|
}
|
|
@@ -8746,8 +8746,8 @@ function focusedVerdict(root, edits, raw, syntaxInspector) {
|
|
|
8746
8746
|
edit.path,
|
|
8747
8747
|
"provide an exact supported Edit/patch or a complete Write within 64 KiB"
|
|
8748
8748
|
);
|
|
8749
|
-
if (!/\b(?:only|skip|xit|xdescribe)\b|\\u/.test(proposed.content)) continue;
|
|
8750
|
-
if (/^[ \t]*(?:(?:it|test|describe)\.only|(?:it|test)\.skip|xit|xdescribe)[ \t]*\(/.test(proposed.content)) {
|
|
8749
|
+
if (!/\b(?:only|skip|xit|xdescribe|fit|fdescribe)\b|\\u/.test(proposed.content)) continue;
|
|
8750
|
+
if (/^[ \t]*(?:(?:it|test|describe)\.only|(?:it|test|describe)\.skip|xit|xdescribe|fit|fdescribe)[ \t]*\(/.test(proposed.content)) {
|
|
8751
8751
|
return noFocusedTest([{ path: edit.path, addedContent: proposed.content.split("\n")[0] ?? "" }]);
|
|
8752
8752
|
}
|
|
8753
8753
|
const verdict = syntaxInspector(root, edit.path, proposed.content, deadline - performance.now());
|
|
@@ -9313,7 +9313,7 @@ function missionEntries(runs) {
|
|
|
9313
9313
|
}
|
|
9314
9314
|
}
|
|
9315
9315
|
function journalFiles(root) {
|
|
9316
|
-
const locations = [voidMachinePath(root, "runs"), legacyVoidPath(root, "runs")].filter((
|
|
9316
|
+
const locations = [voidMachinePath(root, "runs"), legacyVoidPath(root, "runs")].filter((directory2, index, all) => all.indexOf(directory2) === index);
|
|
9317
9317
|
const files = [];
|
|
9318
9318
|
for (const runs of locations) {
|
|
9319
9319
|
for (const entry of missionEntries(runs)) {
|
|
@@ -10358,10 +10358,10 @@ function findExecutable(name, root, env) {
|
|
|
10358
10358
|
for (const suffix of suffixes) {
|
|
10359
10359
|
if (executable(`${local}${suffix}`)) return `${local}${suffix}`;
|
|
10360
10360
|
}
|
|
10361
|
-
for (const
|
|
10362
|
-
if (
|
|
10361
|
+
for (const directory2 of (env["PATH"] ?? "").split(delimiter)) {
|
|
10362
|
+
if (directory2 === "") continue;
|
|
10363
10363
|
for (const suffix of suffixes) {
|
|
10364
|
-
const candidate = join9(
|
|
10364
|
+
const candidate = join9(directory2, `${name}${suffix}`);
|
|
10365
10365
|
if (executable(candidate)) return candidate;
|
|
10366
10366
|
}
|
|
10367
10367
|
}
|
|
@@ -10587,8 +10587,8 @@ function safeMachineDirectory(root) {
|
|
|
10587
10587
|
const created = lstatSync3(cursor);
|
|
10588
10588
|
if (!created.isDirectory() || created.isSymbolicLink()) return void 0;
|
|
10589
10589
|
}
|
|
10590
|
-
const
|
|
10591
|
-
if (!within(canonicalRoot,
|
|
10590
|
+
const canonical4 = realpathSync3(cursor);
|
|
10591
|
+
if (!within(canonicalRoot, canonical4) || canonical4 !== cursor) return void 0;
|
|
10592
10592
|
}
|
|
10593
10593
|
return cursor;
|
|
10594
10594
|
} catch {
|
|
@@ -10596,23 +10596,23 @@ function safeMachineDirectory(root) {
|
|
|
10596
10596
|
}
|
|
10597
10597
|
}
|
|
10598
10598
|
function anchorMachineDirectory(root) {
|
|
10599
|
-
const
|
|
10600
|
-
if (
|
|
10599
|
+
const directory2 = safeMachineDirectory(root);
|
|
10600
|
+
if (directory2 === void 0) return void 0;
|
|
10601
10601
|
let descriptor;
|
|
10602
10602
|
const previousCwd = process.cwd();
|
|
10603
10603
|
let changedDirectory = false;
|
|
10604
10604
|
let anchorEstablished = false;
|
|
10605
10605
|
try {
|
|
10606
10606
|
descriptor = openSync2(
|
|
10607
|
-
|
|
10607
|
+
directory2,
|
|
10608
10608
|
constants3.O_RDONLY | (constants3.O_DIRECTORY ?? 0) | (constants3.O_NOFOLLOW ?? 0)
|
|
10609
10609
|
);
|
|
10610
10610
|
const opened = fstatSync2(descriptor);
|
|
10611
10611
|
if (!opened.isDirectory()) return void 0;
|
|
10612
|
-
process.chdir(
|
|
10612
|
+
process.chdir(directory2);
|
|
10613
10613
|
changedDirectory = true;
|
|
10614
10614
|
const current = statSync5(".");
|
|
10615
|
-
if (current.dev !== opened.dev || current.ino !== opened.ino || realpathSync3(".") !==
|
|
10615
|
+
if (current.dev !== opened.dev || current.ino !== opened.ino || realpathSync3(".") !== directory2) return void 0;
|
|
10616
10616
|
anchorEstablished = true;
|
|
10617
10617
|
return { descriptor, previousCwd };
|
|
10618
10618
|
} catch {
|
|
@@ -10704,8 +10704,8 @@ function canonicalDirectory(path2) {
|
|
|
10704
10704
|
try {
|
|
10705
10705
|
const info = lstatSync3(path2);
|
|
10706
10706
|
if (!info.isDirectory() || info.isSymbolicLink()) return void 0;
|
|
10707
|
-
const
|
|
10708
|
-
return
|
|
10707
|
+
const canonical4 = realpathSync3(path2);
|
|
10708
|
+
return canonical4 === resolve5(path2) ? canonical4 : void 0;
|
|
10709
10709
|
} catch {
|
|
10710
10710
|
return void 0;
|
|
10711
10711
|
}
|
|
@@ -11091,11 +11091,203 @@ function executeContextContinuity(rawInput, root, runtime3, now) {
|
|
|
11091
11091
|
return { status: "skipped", details: { reason: "event-not-actionable" } };
|
|
11092
11092
|
}
|
|
11093
11093
|
|
|
11094
|
+
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
11095
|
+
import { join as join11 } from "node:path";
|
|
11096
|
+
var VERSION_SHAPE = /^[0-9A-Za-z.+-]{1,64}$/;
|
|
11097
|
+
function readVersion(path2) {
|
|
11098
|
+
const version2 = record3(readJson(path2))?.["version"];
|
|
11099
|
+
return typeof version2 === "string" && VERSION_SHAPE.test(version2) ? version2 : void 0;
|
|
11100
|
+
}
|
|
11101
|
+
function resolveInstall(root, env) {
|
|
11102
|
+
const explicit = productSetting(env, "VERSION");
|
|
11103
|
+
if (explicit !== void 0 && VERSION_SHAPE.test(explicit)) {
|
|
11104
|
+
return { version: explicit, source: void 0 };
|
|
11105
|
+
}
|
|
11106
|
+
const pluginRoot = env["CLAUDE_PLUGIN_ROOT"];
|
|
11107
|
+
if (pluginRoot !== void 0) {
|
|
11108
|
+
const version3 = readVersion(join11(pluginRoot, ".claude-plugin", "plugin.json"));
|
|
11109
|
+
if (version3 !== void 0) return { version: version3, source: "marketplace" };
|
|
11110
|
+
}
|
|
11111
|
+
const receipt = record3(readJson(voidReadPath(root, "receipts", "install-v1.json")));
|
|
11112
|
+
const version2 = receipt?.["version"];
|
|
11113
|
+
if (typeof version2 === "string" && VERSION_SHAPE.test(version2)) {
|
|
11114
|
+
const declared = receipt?.["source"];
|
|
11115
|
+
const source2 = declared === "local" || declared === "marketplace" ? declared : void 0;
|
|
11116
|
+
return { version: version2, source: source2 };
|
|
11117
|
+
}
|
|
11118
|
+
return { version: "unknown", source: void 0 };
|
|
11119
|
+
}
|
|
11120
|
+
|
|
11121
|
+
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
11122
|
+
import { randomUUID } from "node:crypto";
|
|
11123
|
+
import { lstatSync as lstatSync4, mkdirSync as mkdirSync4, readFileSync as readFileSync11, readdirSync as readdirSync3, realpathSync as realpathSync4, renameSync as renameSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
11124
|
+
import { basename as basename5, dirname as dirname6, isAbsolute as isAbsolute5, join as join13 } from "node:path";
|
|
11125
|
+
|
|
11094
11126
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
11095
11127
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
11096
|
-
import {
|
|
11128
|
+
import { basename as basename4, dirname as dirname5, join as join12 } from "node:path";
|
|
11129
|
+
function machineRootOf(cwd) {
|
|
11130
|
+
const result = spawnSync2(
|
|
11131
|
+
"git",
|
|
11132
|
+
["rev-parse", "--path-format=absolute", "--git-common-dir"],
|
|
11133
|
+
{ cwd, shell: false, encoding: "utf8", timeout: 5e3 }
|
|
11134
|
+
);
|
|
11135
|
+
const common = result.status === 0 ? result.stdout.replace(/\r?\n$/, "") : "";
|
|
11136
|
+
return common !== "" && basename4(common) === ".git" ? join12(dirname5(common), ".void", "machine") : void 0;
|
|
11137
|
+
}
|
|
11138
|
+
|
|
11139
|
+
var SESSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
11140
|
+
var MAX_MESSAGE_BYTES = 262144;
|
|
11141
|
+
var MAX_CLAIM_BYTES = 4096;
|
|
11142
|
+
var PARKING_WINDOW_MS = 6e5;
|
|
11143
|
+
var skipped = (reason) => ({ status: "skipped", details: { reason } });
|
|
11144
|
+
function claimedPath(root, sessionId) {
|
|
11145
|
+
try {
|
|
11146
|
+
const claim2 = record3(JSON.parse(readFileSync11(join13(root, "agents", "sessions", `${sessionId}.json`), "utf8")));
|
|
11147
|
+
const path2 = claim2?.["resultPath"];
|
|
11148
|
+
if (claim2?.["schemaVersion"] !== 1 || typeof path2 !== "string" || !isAbsolute5(path2)) return void 0;
|
|
11149
|
+
if (path2.length > MAX_CLAIM_BYTES || basename5(path2) !== "result.json") return void 0;
|
|
11150
|
+
const runs = join13(root, "runs");
|
|
11151
|
+
if (!within(runs, path2) || lstatSync4(dirname6(path2), { throwIfNoEntry: false })?.isDirectory() !== true) {
|
|
11152
|
+
return void 0;
|
|
11153
|
+
}
|
|
11154
|
+
return within(realpathSync4(runs), realpathSync4(dirname6(path2))) ? path2 : void 0;
|
|
11155
|
+
} catch {
|
|
11156
|
+
return void 0;
|
|
11157
|
+
}
|
|
11158
|
+
}
|
|
11159
|
+
function waitingRun(root, cwd, now) {
|
|
11160
|
+
try {
|
|
11161
|
+
const here = realpathSync4(cwd);
|
|
11162
|
+
const directory2 = join13(root, "agents", "pending");
|
|
11163
|
+
return readdirSync3(directory2).filter((name) => !name.startsWith(".")).slice(0, 64).some((name) => {
|
|
11164
|
+
const marker = record3(JSON.parse(readFileSync11(join13(directory2, name), "utf8")));
|
|
11165
|
+
const createdAt = marker?.["createdAt"];
|
|
11166
|
+
const runCwd = marker?.["cwd"];
|
|
11167
|
+
return typeof createdAt === "number" && now - createdAt < PARKING_WINDOW_MS && typeof runCwd === "string" && realpathSync4(runCwd) === here;
|
|
11168
|
+
});
|
|
11169
|
+
} catch {
|
|
11170
|
+
return false;
|
|
11171
|
+
}
|
|
11172
|
+
}
|
|
11173
|
+
function boundedMessage(message) {
|
|
11174
|
+
const bytes = Buffer.from(message, "utf8");
|
|
11175
|
+
if (bytes.byteLength <= MAX_MESSAGE_BYTES) return { text: message, truncated: false };
|
|
11176
|
+
return { text: bytes.subarray(0, MAX_MESSAGE_BYTES).toString("utf8").replace(/�+$/, ""), truncated: true };
|
|
11177
|
+
}
|
|
11178
|
+
function executeDelegationResult(input, now) {
|
|
11179
|
+
const fields = record3(input);
|
|
11180
|
+
const [sessionId, cwd] = [fields?.["session_id"], fields?.["cwd"]];
|
|
11181
|
+
if (typeof sessionId !== "string" || !SESSION_ID.test(sessionId) || typeof cwd !== "string") {
|
|
11182
|
+
return skipped("not-a-session");
|
|
11183
|
+
}
|
|
11184
|
+
const root = machineRootOf(cwd);
|
|
11185
|
+
if (root === void 0) return skipped("no-repository");
|
|
11186
|
+
let target = claimedPath(root, sessionId);
|
|
11187
|
+
const parked = target === void 0;
|
|
11188
|
+
if (target === void 0) {
|
|
11189
|
+
if (!waitingRun(root, cwd, now)) return skipped("not-delegated");
|
|
11190
|
+
target = join13(root, "agents", "parked", `${sessionId}.json`);
|
|
11191
|
+
}
|
|
11192
|
+
const message = fields?.["last_assistant_message"];
|
|
11193
|
+
const { text: text3, truncated } = boundedMessage(typeof message === "string" ? message : "");
|
|
11194
|
+
try {
|
|
11195
|
+
mkdirSync4(dirname6(target), { recursive: true, mode: 448 });
|
|
11196
|
+
const temporary = join13(dirname6(target), `.tmp-${randomUUID()}`);
|
|
11197
|
+
const pendingWork = [fields?.["background_tasks"], fields?.["session_crons"]].reduce((sum, list) => sum + (Array.isArray(list) ? list.length : 0), 0);
|
|
11198
|
+
writeFileSync3(temporary, JSON.stringify({
|
|
11199
|
+
schemaVersion: 1,
|
|
11200
|
+
sessionId,
|
|
11201
|
+
recordedAt: now,
|
|
11202
|
+
lastAssistantMessage: text3,
|
|
11203
|
+
truncated,
|
|
11204
|
+
pendingWork
|
|
11205
|
+
}), { mode: 384, flag: "wx" });
|
|
11206
|
+
renameSync4(temporary, target);
|
|
11207
|
+
} catch {
|
|
11208
|
+
return { status: "degraded", details: { reason: "result-not-written" } };
|
|
11209
|
+
}
|
|
11210
|
+
return { status: "ok", details: { recorded: true, parked, truncated } };
|
|
11211
|
+
}
|
|
11212
|
+
|
|
11213
|
+
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
11214
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
11215
|
+
|
|
11216
|
+
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
11217
|
+
import {
|
|
11218
|
+
isAbsolute as isAbsolute6,
|
|
11219
|
+
relative as relative5,
|
|
11220
|
+
resolve as resolve6
|
|
11221
|
+
} from "node:path";
|
|
11222
|
+
var FORMATTABLE = /\.(?:ts|tsx|js|jsx|mjs|cjs|json|jsonc|css)$/;
|
|
11223
|
+
function within2(root, target) {
|
|
11224
|
+
const rel = relative5(root, target);
|
|
11225
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute6(rel);
|
|
11226
|
+
}
|
|
11227
|
+
function formatCandidates(touchedPaths, projectRoot2) {
|
|
11228
|
+
const root = resolve6(projectRoot2);
|
|
11229
|
+
const found = /* @__PURE__ */ new Set();
|
|
11230
|
+
for (const touchedPath of touchedPaths) {
|
|
11231
|
+
const target = resolve6(root, touchedPath);
|
|
11232
|
+
if (touchedPath.trim() !== "" && FORMATTABLE.test(touchedPath.replaceAll("\\", "/")) && within2(root, target)) {
|
|
11233
|
+
found.add(target);
|
|
11234
|
+
}
|
|
11235
|
+
}
|
|
11236
|
+
return [...found];
|
|
11237
|
+
}
|
|
11238
|
+
|
|
11239
|
+
function executeFormat(rawInput, root, env) {
|
|
11240
|
+
const call = normalizeToolCall(rawInput);
|
|
11241
|
+
if (call.tool !== "Edit" && call.tool !== "Write" && call.tool !== "apply_patch") {
|
|
11242
|
+
return { status: "skipped", details: { reason: "tool-not-applicable" } };
|
|
11243
|
+
}
|
|
11244
|
+
const files = safeExistingFiles(
|
|
11245
|
+
formatCandidates(call.edits.map((edit) => edit.path), root),
|
|
11246
|
+
root
|
|
11247
|
+
);
|
|
11248
|
+
if (files.length === 0) {
|
|
11249
|
+
return { status: "skipped", details: { reason: "no-formattable-touched-file" } };
|
|
11250
|
+
}
|
|
11251
|
+
const biome = findExecutable("biome", root, env);
|
|
11252
|
+
if (biome === void 0) {
|
|
11253
|
+
return { status: "skipped", details: { reason: "formatter-unavailable" } };
|
|
11254
|
+
}
|
|
11255
|
+
const timeout = boundedInteger(
|
|
11256
|
+
productSetting(env, "FORMAT_TIMEOUT_MS"),
|
|
11257
|
+
1e4,
|
|
11258
|
+
100,
|
|
11259
|
+
3e4
|
|
11260
|
+
);
|
|
11261
|
+
let formatted = 0;
|
|
11262
|
+
for (const file of files) {
|
|
11263
|
+
const result = spawnSync3(biome, ["format", "--write", file], {
|
|
11264
|
+
cwd: root,
|
|
11265
|
+
env: { ...process.env, ...env },
|
|
11266
|
+
shell: false,
|
|
11267
|
+
stdio: "ignore",
|
|
11268
|
+
timeout
|
|
11269
|
+
});
|
|
11270
|
+
if (result.error !== void 0 || result.status !== 0) {
|
|
11271
|
+
const timedOut = result.error?.message.includes("ETIMEDOUT") ?? false;
|
|
11272
|
+
return {
|
|
11273
|
+
status: "degraded",
|
|
11274
|
+
details: {
|
|
11275
|
+
reason: timedOut ? "timeout" : "formatter-error",
|
|
11276
|
+
formatted,
|
|
11277
|
+
timeoutMs: timeout
|
|
11278
|
+
}
|
|
11279
|
+
};
|
|
11280
|
+
}
|
|
11281
|
+
formatted += 1;
|
|
11282
|
+
}
|
|
11283
|
+
return { status: "ok", details: { formatted } };
|
|
11284
|
+
}
|
|
11285
|
+
|
|
11286
|
+
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
11287
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
11288
|
+
import { realpathSync as realpathSync6 } from "node:fs";
|
|
11097
11289
|
import { homedir as homedir2 } from "node:os";
|
|
11098
|
-
import { join as
|
|
11290
|
+
import { join as join15 } from "node:path";
|
|
11099
11291
|
|
|
11100
11292
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
11101
11293
|
|
|
@@ -11662,6 +11854,24 @@ var numericOriginMap = {
|
|
|
11662
11854
|
bigint: "bigint",
|
|
11663
11855
|
object: "date"
|
|
11664
11856
|
};
|
|
11857
|
+
var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
11858
|
+
$ZodCheck.init(inst, def);
|
|
11859
|
+
const origin = numericOriginMap[typeof def.value];
|
|
11860
|
+
inst._zod.check = (payload) => {
|
|
11861
|
+
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
|
|
11862
|
+
return;
|
|
11863
|
+
}
|
|
11864
|
+
payload.issues.push({
|
|
11865
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
11866
|
+
code: "too_big",
|
|
11867
|
+
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
11868
|
+
input: payload.value,
|
|
11869
|
+
inclusive: def.inclusive,
|
|
11870
|
+
inst,
|
|
11871
|
+
continue: !def.abort
|
|
11872
|
+
});
|
|
11873
|
+
};
|
|
11874
|
+
});
|
|
11665
11875
|
var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
11666
11876
|
$ZodCheck.init(inst, def);
|
|
11667
11877
|
const origin = numericOriginMap[typeof def.value];
|
|
@@ -12626,6 +12836,15 @@ function _never(Class, params) {
|
|
|
12626
12836
|
});
|
|
12627
12837
|
}
|
|
12628
12838
|
// @__NO_SIDE_EFFECTS__
|
|
12839
|
+
function _lte(value, params) {
|
|
12840
|
+
return new $ZodCheckLessThan({
|
|
12841
|
+
check: "less_than",
|
|
12842
|
+
...normalizeParams(params),
|
|
12843
|
+
value,
|
|
12844
|
+
inclusive: true
|
|
12845
|
+
});
|
|
12846
|
+
}
|
|
12847
|
+
// @__NO_SIDE_EFFECTS__
|
|
12629
12848
|
function _gte(value, params) {
|
|
12630
12849
|
return new $ZodCheckGreaterThan({
|
|
12631
12850
|
check: "greater_than",
|
|
@@ -13020,15 +13239,15 @@ function proveOwnership(pids, call) {
|
|
|
13020
13239
|
|
|
13021
13240
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13022
13241
|
import { createHash as createHash4 } from "node:crypto";
|
|
13023
|
-
import { closeSync as closeSync3, constants as constants4, fstatSync as fstatSync3, lstatSync as
|
|
13024
|
-
import { isAbsolute as
|
|
13242
|
+
import { closeSync as closeSync3, constants as constants4, fstatSync as fstatSync3, lstatSync as lstatSync5, opendirSync, openSync as openSync3, readSync as readSync3, realpathSync as realpathSync5 } from "node:fs";
|
|
13243
|
+
import { isAbsolute as isAbsolute8, join as join14, parse as parse2, relative as relative6, resolve as resolve7, sep } from "node:path";
|
|
13025
13244
|
|
|
13026
13245
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13027
13246
|
var import_yaml = __toESM(require_dist(), 1);
|
|
13028
|
-
import { isAbsolute as
|
|
13247
|
+
import { isAbsolute as isAbsolute7 } from "node:path";
|
|
13029
13248
|
var identifier = string2().check(_regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/));
|
|
13030
13249
|
var text = string2().check(_minLength(1), _maxLength(4096), refine((value) => [...value].every((char) => char.charCodeAt(0) >= 32 && !(char.charCodeAt(0) >= 127 && char.charCodeAt(0) <= 159))));
|
|
13031
|
-
var path = text.check(refine((value) =>
|
|
13250
|
+
var path = text.check(refine((value) => isAbsolute7(value) && !value.split(/[\\/]/).includes("..")));
|
|
13032
13251
|
var selectionSchema = strictObject({
|
|
13033
13252
|
schema: literal(1),
|
|
13034
13253
|
project: string2().check(_regex(/^[a-f0-9]{64}$/)),
|
|
@@ -13112,8 +13331,8 @@ function matchReport(mission, label, report) {
|
|
|
13112
13331
|
}
|
|
13113
13332
|
return report;
|
|
13114
13333
|
}
|
|
13115
|
-
function resolvePane(
|
|
13116
|
-
const matching = panes.filter((pane2) => pane2.label ===
|
|
13334
|
+
function resolvePane(identity2, panes) {
|
|
13335
|
+
const matching = panes.filter((pane2) => pane2.label === identity2.label && pane2.cwd === identity2.worktree);
|
|
13117
13336
|
const pane = matching[0];
|
|
13118
13337
|
if (matching.length !== 1 || pane === void 0) throw Error("absent or ambiguous orchestra pane identity");
|
|
13119
13338
|
return pane;
|
|
@@ -13129,7 +13348,7 @@ function absent(error) {
|
|
|
13129
13348
|
}
|
|
13130
13349
|
function canonical(path2) {
|
|
13131
13350
|
try {
|
|
13132
|
-
return
|
|
13351
|
+
return realpathSync5(path2);
|
|
13133
13352
|
} catch (error) {
|
|
13134
13353
|
if (absent(error)) return void 0;
|
|
13135
13354
|
throw error;
|
|
@@ -13137,33 +13356,33 @@ function canonical(path2) {
|
|
|
13137
13356
|
}
|
|
13138
13357
|
function missionEntries2(root) {
|
|
13139
13358
|
safePath(root);
|
|
13140
|
-
const
|
|
13359
|
+
const directory2 = opendirSync(root);
|
|
13141
13360
|
const entries = [];
|
|
13142
13361
|
try {
|
|
13143
13362
|
for (let i = 0; i <= MAX_MISSIONS; i++) {
|
|
13144
|
-
const entry =
|
|
13363
|
+
const entry = directory2.readSync();
|
|
13145
13364
|
if (!entry) return entries;
|
|
13146
13365
|
entries.push(entry.name);
|
|
13147
13366
|
}
|
|
13148
13367
|
throw Error("orchestra discovery incomplete: entry limit");
|
|
13149
13368
|
} finally {
|
|
13150
|
-
|
|
13369
|
+
directory2.closeSync();
|
|
13151
13370
|
}
|
|
13152
13371
|
}
|
|
13153
13372
|
function safePath(path2) {
|
|
13154
13373
|
let current = parse2(path2).root;
|
|
13155
13374
|
for (const component of path2.slice(current.length).split(sep).filter(Boolean)) {
|
|
13156
|
-
current =
|
|
13157
|
-
if (
|
|
13375
|
+
current = join14(current, component);
|
|
13376
|
+
if (lstatSync5(current).isSymbolicLink()) throw Error("orchestra state symlink refused");
|
|
13158
13377
|
}
|
|
13159
13378
|
}
|
|
13160
13379
|
function readDocument(root, relativePath, limit) {
|
|
13161
|
-
if (
|
|
13162
|
-
const target =
|
|
13380
|
+
if (isAbsolute8(relativePath) || relativePath.split(/[\\/]/).includes("..")) throw Error("orchestra traversal refused");
|
|
13381
|
+
const target = resolve7(root, relativePath);
|
|
13163
13382
|
safePath(target);
|
|
13164
|
-
const canonicalRoot =
|
|
13165
|
-
const rel =
|
|
13166
|
-
if (rel.startsWith("..") ||
|
|
13383
|
+
const canonicalRoot = realpathSync5(root);
|
|
13384
|
+
const rel = relative6(canonicalRoot, realpathSync5(target));
|
|
13385
|
+
if (rel.startsWith("..") || isAbsolute8(rel)) throw Error("orchestra path escapes mission");
|
|
13167
13386
|
const descriptor = openSync3(target, constants4.O_RDONLY | constants4.O_NONBLOCK | constants4.O_NOFOLLOW);
|
|
13168
13387
|
try {
|
|
13169
13388
|
const info = fstatSync3(descriptor);
|
|
@@ -13171,7 +13390,7 @@ function readDocument(root, relativePath, limit) {
|
|
|
13171
13390
|
const buffer = Buffer.alloc(limit + 1);
|
|
13172
13391
|
const count = readSync3(descriptor, buffer, 0, buffer.length, 0);
|
|
13173
13392
|
const after = fstatSync3(descriptor);
|
|
13174
|
-
const current =
|
|
13393
|
+
const current = lstatSync5(target);
|
|
13175
13394
|
if (count > limit || count !== info.size || info.size !== after.size || info.mtimeMs !== after.mtimeMs || current.dev !== info.dev || current.ino !== info.ino) throw Error("orchestra state changed during read");
|
|
13176
13395
|
safePath(target);
|
|
13177
13396
|
return new TextDecoder("utf-8", { fatal: true }).decode(buffer.subarray(0, count));
|
|
@@ -13179,11 +13398,11 @@ function readDocument(root, relativePath, limit) {
|
|
|
13179
13398
|
closeSync3(descriptor);
|
|
13180
13399
|
}
|
|
13181
13400
|
}
|
|
13182
|
-
function effectiveWorkers(
|
|
13401
|
+
function effectiveWorkers(directory2, mission) {
|
|
13183
13402
|
return mission.workers.map((worker) => {
|
|
13184
13403
|
let briefText;
|
|
13185
13404
|
try {
|
|
13186
|
-
briefText = readDocument(
|
|
13405
|
+
briefText = readDocument(directory2, `workers/${worker.label}/brief.md`, 262144);
|
|
13187
13406
|
} catch (error) {
|
|
13188
13407
|
if (!absent(error)) throw error;
|
|
13189
13408
|
}
|
|
@@ -13195,7 +13414,7 @@ function effectiveWorkers(directory, mission) {
|
|
|
13195
13414
|
}
|
|
13196
13415
|
let raw;
|
|
13197
13416
|
try {
|
|
13198
|
-
raw = readDocument(
|
|
13417
|
+
raw = readDocument(directory2, `workers/${worker.label}/report.md`, 65536);
|
|
13199
13418
|
} catch (error) {
|
|
13200
13419
|
if (absent(error)) return worker;
|
|
13201
13420
|
throw error;
|
|
@@ -13207,7 +13426,7 @@ function effectiveWorkers(directory, mission) {
|
|
|
13207
13426
|
function readSelection(cwd, project) {
|
|
13208
13427
|
const relativePath = ".void/machine/orchestra-selection.json";
|
|
13209
13428
|
try {
|
|
13210
|
-
safePath(
|
|
13429
|
+
safePath(join14(cwd, relativePath));
|
|
13211
13430
|
} catch (error) {
|
|
13212
13431
|
if (absent(error)) return void 0;
|
|
13213
13432
|
throw error;
|
|
@@ -13231,11 +13450,11 @@ function selectCandidates(candidates, binding, cwd, panes) {
|
|
|
13231
13450
|
return active.length ? active : candidates.filter(({ mission }) => [mission.coordinator, ...mission.workers].some((person) => canonical(person.worktree) === cwd && panes.some((pane) => pane.label === person.label && canonical(pane.cwd) === cwd && pane.tokens?.["mission"] === mission.mission)));
|
|
13232
13451
|
}
|
|
13233
13452
|
function readOrchestra(state, common, cwd, inventory) {
|
|
13234
|
-
const repository =
|
|
13453
|
+
const repository = realpathSync5(common);
|
|
13235
13454
|
const project = projectIdentity(repository);
|
|
13236
|
-
const canonicalCwd =
|
|
13455
|
+
const canonicalCwd = realpathSync5(cwd);
|
|
13237
13456
|
const binding = readSelection(canonicalCwd, project);
|
|
13238
|
-
const root =
|
|
13457
|
+
const root = join14(state, project);
|
|
13239
13458
|
let entries;
|
|
13240
13459
|
try {
|
|
13241
13460
|
entries = missionEntries2(root);
|
|
@@ -13249,8 +13468,8 @@ function readOrchestra(state, common, cwd, inventory) {
|
|
|
13249
13468
|
let bytes = 0;
|
|
13250
13469
|
for (const entry of entries) {
|
|
13251
13470
|
if (!/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/.test(entry)) throw Error("invalid orchestra mission directory");
|
|
13252
|
-
const
|
|
13253
|
-
const raw = readDocument(
|
|
13471
|
+
const directory3 = join14(root, entry);
|
|
13472
|
+
const raw = readDocument(directory3, "mission.md", 65536);
|
|
13254
13473
|
bytes += Buffer.byteLength(raw);
|
|
13255
13474
|
if (bytes > MAX_DISCOVERY_BYTES) throw Error("orchestra discovery incomplete: byte limit");
|
|
13256
13475
|
const mission2 = parseMission(raw);
|
|
@@ -13258,7 +13477,7 @@ function readOrchestra(state, common, cwd, inventory) {
|
|
|
13258
13477
|
throw Error("foreign orchestra mission");
|
|
13259
13478
|
}
|
|
13260
13479
|
const participants = [mission2.coordinator, ...mission2.workers];
|
|
13261
|
-
if (participants.some((person) => canonical(person.worktree) === canonicalCwd)) candidates.push({ directory:
|
|
13480
|
+
if (participants.some((person) => canonical(person.worktree) === canonicalCwd)) candidates.push({ directory: directory3, mission: mission2 });
|
|
13262
13481
|
}
|
|
13263
13482
|
if (candidates.length === 0 && binding === void 0) return void 0;
|
|
13264
13483
|
const inventoryPanes = inventory();
|
|
@@ -13269,17 +13488,17 @@ function readOrchestra(state, common, cwd, inventory) {
|
|
|
13269
13488
|
const names = selected.map((item) => item.mission.mission).sort().join(", ").slice(0, 300);
|
|
13270
13489
|
throw Error(`ambiguous orchestra missions: ${names}; ORCH must choose an explicit selection`);
|
|
13271
13490
|
}
|
|
13272
|
-
const { mission, directory } = candidate;
|
|
13491
|
+
const { mission, directory: directory2 } = candidate;
|
|
13273
13492
|
const identities = [mission.coordinator, ...mission.workers].filter((person) => canonical(person.worktree) === canonicalCwd);
|
|
13274
13493
|
if (identities.length !== 1 || identities[0] === void 0) throw Error("ambiguous orchestra participant");
|
|
13275
|
-
const
|
|
13494
|
+
const identity2 = identities[0];
|
|
13276
13495
|
const labels = new Set([mission.coordinator, ...mission.workers].map((person) => person.label));
|
|
13277
13496
|
const panes = inventoryPanes.filter((pane2) => labels.has(pane2.label)).flatMap((pane2) => {
|
|
13278
13497
|
const cwd2 = canonical(pane2.cwd);
|
|
13279
13498
|
return cwd2 === void 0 ? [] : [{ ...pane2, cwd: cwd2 }];
|
|
13280
13499
|
});
|
|
13281
|
-
const pane = resolvePane({ label:
|
|
13282
|
-
const workers = effectiveWorkers(
|
|
13500
|
+
const pane = resolvePane({ label: identity2.label, worktree: canonicalCwd }, panes);
|
|
13501
|
+
const workers = effectiveWorkers(directory2, mission);
|
|
13283
13502
|
const ownedPanes = [mission.coordinator, ...mission.workers].flatMap((person) => {
|
|
13284
13503
|
const cwd2 = canonical(person.worktree);
|
|
13285
13504
|
const matches2 = panes.filter((pane2) => pane2.label === person.label && pane2.cwd === cwd2);
|
|
@@ -13287,18 +13506,18 @@ function readOrchestra(state, common, cwd, inventory) {
|
|
|
13287
13506
|
return matches2;
|
|
13288
13507
|
});
|
|
13289
13508
|
return {
|
|
13290
|
-
directory,
|
|
13509
|
+
directory: directory2,
|
|
13291
13510
|
mission,
|
|
13292
13511
|
pane,
|
|
13293
|
-
coordinator:
|
|
13294
|
-
worker: workers.find((worker) => worker.label ===
|
|
13512
|
+
coordinator: identity2.label === mission.coordinator.label,
|
|
13513
|
+
worker: workers.find((worker) => worker.label === identity2.label),
|
|
13295
13514
|
workers,
|
|
13296
13515
|
ownedPanes
|
|
13297
13516
|
};
|
|
13298
13517
|
}
|
|
13299
13518
|
|
|
13300
13519
|
var runCommand = (command, args, options) => {
|
|
13301
|
-
const result =
|
|
13520
|
+
const result = spawnSync4(command, args, { ...options, encoding: "utf8" });
|
|
13302
13521
|
if (result.error !== void 0 || result.status !== 0) {
|
|
13303
13522
|
throw Error(`${command}: ${result.error?.message ?? result.stderr?.slice(0, 300) ?? "transport refused"}`);
|
|
13304
13523
|
}
|
|
@@ -13329,7 +13548,7 @@ function executeHerdrMetadata(raw, root, env, runtime3, run = runCommand) {
|
|
|
13329
13548
|
try {
|
|
13330
13549
|
const common = call("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"]).trim();
|
|
13331
13550
|
const inventory = () => paneList.parse(JSON.parse(call("herdr", ["pane", "list"]))).result.panes;
|
|
13332
|
-
const snapshot = readOrchestra(
|
|
13551
|
+
const snapshot = readOrchestra(join15(env["HOME"] ?? homedir2(), ".local/state/orchestra"), common, root, () => {
|
|
13333
13552
|
return inventory().flatMap((pane) => typeof pane.label === "string" && typeof pane.cwd === "string" ? [{
|
|
13334
13553
|
pane_id: pane.pane_id,
|
|
13335
13554
|
workspace_id: pane.workspace_id,
|
|
@@ -13345,10 +13564,10 @@ function executeHerdrMetadata(raw, root, env, runtime3, run = runCommand) {
|
|
|
13345
13564
|
const panes = inventory();
|
|
13346
13565
|
const matches2 = panes.filter((pane2) => pane2.pane_id === paneId);
|
|
13347
13566
|
const pane = matches2[0];
|
|
13348
|
-
if (matches2.length !== 1 || !pane || !pane.cwd ||
|
|
13567
|
+
if (matches2.length !== 1 || !pane || !pane.cwd || realpathSync6(pane.cwd) !== realpathSync6(root)) {
|
|
13349
13568
|
throw Error("Herdr caller pane missing or foreign worktree");
|
|
13350
13569
|
}
|
|
13351
|
-
if (pane.label && panes.filter((other) => other.label === pane.label && typeof other.cwd === "string" &&
|
|
13570
|
+
if (pane.label && panes.filter((other) => other.label === pane.label && typeof other.cwd === "string" && realpathSync6(other.cwd) === realpathSync6(root)).length !== 1) {
|
|
13352
13571
|
throw Error("ambiguous Herdr coordinator identity");
|
|
13353
13572
|
}
|
|
13354
13573
|
const pids = foreground(Buffer.from(call("herdr", ["pane", "process-info", "--pane", paneId])), paneId);
|
|
@@ -13412,12 +13631,12 @@ Do not act on this host until resolved. Native delegation independent of that ac
|
|
|
13412
13631
|
}
|
|
13413
13632
|
|
|
13414
13633
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13415
|
-
import { spawnSync as
|
|
13634
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
13416
13635
|
import { statSync as statSync6 } from "node:fs";
|
|
13417
13636
|
import { homedir as homedir3 } from "node:os";
|
|
13418
|
-
import { join as
|
|
13637
|
+
import { join as join16 } from "node:path";
|
|
13419
13638
|
var runCommand2 = (command, args, options) => {
|
|
13420
|
-
const result =
|
|
13639
|
+
const result = spawnSync5(command, args, options);
|
|
13421
13640
|
if (result.error !== void 0 || result.status !== 0) throw Error("process-failed");
|
|
13422
13641
|
return result.stdout;
|
|
13423
13642
|
};
|
|
@@ -13426,8 +13645,8 @@ function refused(reason) {
|
|
|
13426
13645
|
` };
|
|
13427
13646
|
}
|
|
13428
13647
|
function nativeHook(env) {
|
|
13429
|
-
const path2 =
|
|
13430
|
-
env["CODEX_HOME"] ||
|
|
13648
|
+
const path2 = join16(
|
|
13649
|
+
env["CODEX_HOME"] || join16(env["HOME"] || homedir3(), ".codex"),
|
|
13431
13650
|
"herdr-agent-state.sh"
|
|
13432
13651
|
);
|
|
13433
13652
|
try {
|
|
@@ -13485,199 +13704,6 @@ function executeHerdrSession(input, env, runtime3, run = runCommand2, clock = ()
|
|
|
13485
13704
|
}
|
|
13486
13705
|
}
|
|
13487
13706
|
|
|
13488
|
-
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13489
|
-
import { randomUUID } from "node:crypto";
|
|
13490
|
-
import { lstatSync as lstatSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync11, readdirSync as readdirSync3, realpathSync as realpathSync6, renameSync as renameSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
13491
|
-
import { basename as basename5, dirname as dirname6, isAbsolute as isAbsolute7, join as join16 } from "node:path";
|
|
13492
|
-
|
|
13493
|
-
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13494
|
-
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
13495
|
-
import { basename as basename4, dirname as dirname5, join as join15 } from "node:path";
|
|
13496
|
-
|
|
13497
|
-
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13498
|
-
import { join as join14 } from "node:path";
|
|
13499
|
-
var VERSION_SHAPE = /^[0-9A-Za-z.+-]{1,64}$/;
|
|
13500
|
-
function readVersion(path2) {
|
|
13501
|
-
const version2 = record3(readJson(path2))?.["version"];
|
|
13502
|
-
return typeof version2 === "string" && VERSION_SHAPE.test(version2) ? version2 : void 0;
|
|
13503
|
-
}
|
|
13504
|
-
function resolveInstall(root, env) {
|
|
13505
|
-
const explicit = productSetting(env, "VERSION");
|
|
13506
|
-
if (explicit !== void 0 && VERSION_SHAPE.test(explicit)) {
|
|
13507
|
-
return { version: explicit, source: void 0 };
|
|
13508
|
-
}
|
|
13509
|
-
const pluginRoot = env["CLAUDE_PLUGIN_ROOT"];
|
|
13510
|
-
if (pluginRoot !== void 0) {
|
|
13511
|
-
const version3 = readVersion(join14(pluginRoot, ".claude-plugin", "plugin.json"));
|
|
13512
|
-
if (version3 !== void 0) return { version: version3, source: "marketplace" };
|
|
13513
|
-
}
|
|
13514
|
-
const receipt = record3(readJson(voidReadPath(root, "receipts", "install-v1.json")));
|
|
13515
|
-
const version2 = receipt?.["version"];
|
|
13516
|
-
if (typeof version2 === "string" && VERSION_SHAPE.test(version2)) {
|
|
13517
|
-
const declared = receipt?.["source"];
|
|
13518
|
-
const source2 = declared === "local" || declared === "marketplace" ? declared : void 0;
|
|
13519
|
-
return { version: version2, source: source2 };
|
|
13520
|
-
}
|
|
13521
|
-
return { version: "unknown", source: void 0 };
|
|
13522
|
-
}
|
|
13523
|
-
|
|
13524
|
-
function machineRootOf(cwd) {
|
|
13525
|
-
const result = spawnSync4(
|
|
13526
|
-
"git",
|
|
13527
|
-
["rev-parse", "--path-format=absolute", "--git-common-dir"],
|
|
13528
|
-
{ cwd, shell: false, encoding: "utf8", timeout: 5e3 }
|
|
13529
|
-
);
|
|
13530
|
-
const common = result.status === 0 ? result.stdout.replace(/\r?\n$/, "") : "";
|
|
13531
|
-
return common !== "" && basename4(common) === ".git" ? join15(dirname5(common), ".void", "machine") : void 0;
|
|
13532
|
-
}
|
|
13533
|
-
|
|
13534
|
-
var SESSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
13535
|
-
var MAX_MESSAGE_BYTES = 262144;
|
|
13536
|
-
var MAX_CLAIM_BYTES = 4096;
|
|
13537
|
-
var PARKING_WINDOW_MS = 6e5;
|
|
13538
|
-
var skipped = (reason) => ({ status: "skipped", details: { reason } });
|
|
13539
|
-
function claimedPath(root, sessionId) {
|
|
13540
|
-
try {
|
|
13541
|
-
const claim2 = record3(JSON.parse(readFileSync11(join16(root, "agents", "sessions", `${sessionId}.json`), "utf8")));
|
|
13542
|
-
const path2 = claim2?.["resultPath"];
|
|
13543
|
-
if (claim2?.["schemaVersion"] !== 1 || typeof path2 !== "string" || !isAbsolute7(path2)) return void 0;
|
|
13544
|
-
if (path2.length > MAX_CLAIM_BYTES || basename5(path2) !== "result.json") return void 0;
|
|
13545
|
-
const runs = join16(root, "runs");
|
|
13546
|
-
if (!within(runs, path2) || lstatSync5(dirname6(path2), { throwIfNoEntry: false })?.isDirectory() !== true) {
|
|
13547
|
-
return void 0;
|
|
13548
|
-
}
|
|
13549
|
-
return within(realpathSync6(runs), realpathSync6(dirname6(path2))) ? path2 : void 0;
|
|
13550
|
-
} catch {
|
|
13551
|
-
return void 0;
|
|
13552
|
-
}
|
|
13553
|
-
}
|
|
13554
|
-
function waitingRun(root, cwd, now) {
|
|
13555
|
-
try {
|
|
13556
|
-
const here = realpathSync6(cwd);
|
|
13557
|
-
const directory = join16(root, "agents", "pending");
|
|
13558
|
-
return readdirSync3(directory).filter((name) => !name.startsWith(".")).slice(0, 64).some((name) => {
|
|
13559
|
-
const marker = record3(JSON.parse(readFileSync11(join16(directory, name), "utf8")));
|
|
13560
|
-
const createdAt = marker?.["createdAt"];
|
|
13561
|
-
const runCwd = marker?.["cwd"];
|
|
13562
|
-
return typeof createdAt === "number" && now - createdAt < PARKING_WINDOW_MS && typeof runCwd === "string" && realpathSync6(runCwd) === here;
|
|
13563
|
-
});
|
|
13564
|
-
} catch {
|
|
13565
|
-
return false;
|
|
13566
|
-
}
|
|
13567
|
-
}
|
|
13568
|
-
function boundedMessage(message) {
|
|
13569
|
-
const bytes = Buffer.from(message, "utf8");
|
|
13570
|
-
if (bytes.byteLength <= MAX_MESSAGE_BYTES) return { text: message, truncated: false };
|
|
13571
|
-
return { text: bytes.subarray(0, MAX_MESSAGE_BYTES).toString("utf8").replace(/�+$/, ""), truncated: true };
|
|
13572
|
-
}
|
|
13573
|
-
function executeDelegationResult(input, now) {
|
|
13574
|
-
const fields = record3(input);
|
|
13575
|
-
const [sessionId, cwd] = [fields?.["session_id"], fields?.["cwd"]];
|
|
13576
|
-
if (typeof sessionId !== "string" || !SESSION_ID.test(sessionId) || typeof cwd !== "string") {
|
|
13577
|
-
return skipped("not-a-session");
|
|
13578
|
-
}
|
|
13579
|
-
const root = machineRootOf(cwd);
|
|
13580
|
-
if (root === void 0) return skipped("no-repository");
|
|
13581
|
-
let target = claimedPath(root, sessionId);
|
|
13582
|
-
const parked = target === void 0;
|
|
13583
|
-
if (target === void 0) {
|
|
13584
|
-
if (!waitingRun(root, cwd, now)) return skipped("not-delegated");
|
|
13585
|
-
target = join16(root, "agents", "parked", `${sessionId}.json`);
|
|
13586
|
-
}
|
|
13587
|
-
const message = fields?.["last_assistant_message"];
|
|
13588
|
-
const { text: text3, truncated } = boundedMessage(typeof message === "string" ? message : "");
|
|
13589
|
-
try {
|
|
13590
|
-
mkdirSync4(dirname6(target), { recursive: true, mode: 448 });
|
|
13591
|
-
const temporary = join16(dirname6(target), `.tmp-${randomUUID()}`);
|
|
13592
|
-
const pendingWork = [fields?.["background_tasks"], fields?.["session_crons"]].reduce((sum, list) => sum + (Array.isArray(list) ? list.length : 0), 0);
|
|
13593
|
-
writeFileSync3(temporary, JSON.stringify({
|
|
13594
|
-
schemaVersion: 1,
|
|
13595
|
-
sessionId,
|
|
13596
|
-
recordedAt: now,
|
|
13597
|
-
lastAssistantMessage: text3,
|
|
13598
|
-
truncated,
|
|
13599
|
-
pendingWork
|
|
13600
|
-
}), { mode: 384, flag: "wx" });
|
|
13601
|
-
renameSync4(temporary, target);
|
|
13602
|
-
} catch {
|
|
13603
|
-
return { status: "degraded", details: { reason: "result-not-written" } };
|
|
13604
|
-
}
|
|
13605
|
-
return { status: "ok", details: { recorded: true, parked, truncated } };
|
|
13606
|
-
}
|
|
13607
|
-
|
|
13608
|
-
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13609
|
-
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
13610
|
-
|
|
13611
|
-
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13612
|
-
import {
|
|
13613
|
-
isAbsolute as isAbsolute8,
|
|
13614
|
-
relative as relative6,
|
|
13615
|
-
resolve as resolve7
|
|
13616
|
-
} from "node:path";
|
|
13617
|
-
var FORMATTABLE = /\.(?:ts|tsx|js|jsx|mjs|cjs|json|jsonc|css)$/;
|
|
13618
|
-
function within2(root, target) {
|
|
13619
|
-
const rel = relative6(root, target);
|
|
13620
|
-
return rel === "" || !rel.startsWith("..") && !isAbsolute8(rel);
|
|
13621
|
-
}
|
|
13622
|
-
function formatCandidates(touchedPaths, projectRoot2) {
|
|
13623
|
-
const root = resolve7(projectRoot2);
|
|
13624
|
-
const found = /* @__PURE__ */ new Set();
|
|
13625
|
-
for (const touchedPath of touchedPaths) {
|
|
13626
|
-
const target = resolve7(root, touchedPath);
|
|
13627
|
-
if (touchedPath.trim() !== "" && FORMATTABLE.test(touchedPath.replaceAll("\\", "/")) && within2(root, target)) {
|
|
13628
|
-
found.add(target);
|
|
13629
|
-
}
|
|
13630
|
-
}
|
|
13631
|
-
return [...found];
|
|
13632
|
-
}
|
|
13633
|
-
|
|
13634
|
-
function executeFormat(rawInput, root, env) {
|
|
13635
|
-
const call = normalizeToolCall(rawInput);
|
|
13636
|
-
if (call.tool !== "Edit" && call.tool !== "Write" && call.tool !== "apply_patch") {
|
|
13637
|
-
return { status: "skipped", details: { reason: "tool-not-applicable" } };
|
|
13638
|
-
}
|
|
13639
|
-
const files = safeExistingFiles(
|
|
13640
|
-
formatCandidates(call.edits.map((edit) => edit.path), root),
|
|
13641
|
-
root
|
|
13642
|
-
);
|
|
13643
|
-
if (files.length === 0) {
|
|
13644
|
-
return { status: "skipped", details: { reason: "no-formattable-touched-file" } };
|
|
13645
|
-
}
|
|
13646
|
-
const biome = findExecutable("biome", root, env);
|
|
13647
|
-
if (biome === void 0) {
|
|
13648
|
-
return { status: "skipped", details: { reason: "formatter-unavailable" } };
|
|
13649
|
-
}
|
|
13650
|
-
const timeout = boundedInteger(
|
|
13651
|
-
productSetting(env, "FORMAT_TIMEOUT_MS"),
|
|
13652
|
-
1e4,
|
|
13653
|
-
100,
|
|
13654
|
-
3e4
|
|
13655
|
-
);
|
|
13656
|
-
let formatted = 0;
|
|
13657
|
-
for (const file of files) {
|
|
13658
|
-
const result = spawnSync5(biome, ["format", "--write", file], {
|
|
13659
|
-
cwd: root,
|
|
13660
|
-
env: { ...process.env, ...env },
|
|
13661
|
-
shell: false,
|
|
13662
|
-
stdio: "ignore",
|
|
13663
|
-
timeout
|
|
13664
|
-
});
|
|
13665
|
-
if (result.error !== void 0 || result.status !== 0) {
|
|
13666
|
-
const timedOut = result.error?.message.includes("ETIMEDOUT") ?? false;
|
|
13667
|
-
return {
|
|
13668
|
-
status: "degraded",
|
|
13669
|
-
details: {
|
|
13670
|
-
reason: timedOut ? "timeout" : "formatter-error",
|
|
13671
|
-
formatted,
|
|
13672
|
-
timeoutMs: timeout
|
|
13673
|
-
}
|
|
13674
|
-
};
|
|
13675
|
-
}
|
|
13676
|
-
formatted += 1;
|
|
13677
|
-
}
|
|
13678
|
-
return { status: "ok", details: { formatted } };
|
|
13679
|
-
}
|
|
13680
|
-
|
|
13681
13707
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13682
13708
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
13683
13709
|
|
|
@@ -13804,30 +13830,209 @@ function executeLargeChange(root, env) {
|
|
|
13804
13830
|
};
|
|
13805
13831
|
}
|
|
13806
13832
|
|
|
13833
|
+
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13834
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
13835
|
+
import {
|
|
13836
|
+
closeSync as closeSync4,
|
|
13837
|
+
constants as constants5,
|
|
13838
|
+
fstatSync as fstatSync4,
|
|
13839
|
+
lstatSync as lstatSync6,
|
|
13840
|
+
mkdirSync as mkdirSync5,
|
|
13841
|
+
openSync as openSync4,
|
|
13842
|
+
readSync as readSync4,
|
|
13843
|
+
realpathSync as realpathSync7,
|
|
13844
|
+
renameSync as renameSync5,
|
|
13845
|
+
statSync as statSync7,
|
|
13846
|
+
unlinkSync as unlinkSync2,
|
|
13847
|
+
writeFileSync as writeFileSync4
|
|
13848
|
+
} from "node:fs";
|
|
13849
|
+
import { join as join17 } from "node:path";
|
|
13850
|
+
|
|
13851
|
+
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13852
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
13853
|
+
var digest = string2().check(_regex(/^[a-f0-9]{64}$/));
|
|
13854
|
+
var readLoopState = strictObject({ schemaVersion: literal(1), sessions: array(strictObject({
|
|
13855
|
+
session: digest,
|
|
13856
|
+
fingerprint: digest,
|
|
13857
|
+
invocation: digest,
|
|
13858
|
+
count: number2().check(int(), _gte(1), _lte(4)),
|
|
13859
|
+
at: number2().check(int(), _gte(0))
|
|
13860
|
+
})).check(_maxLength(32)) });
|
|
13861
|
+
var hash = (value) => createHash5("sha256").update(value).digest("hex");
|
|
13862
|
+
var identity = (value) => typeof value === "string" && value.length > 0 && value.length <= 256 && [...value].every((char) => (char.codePointAt(0) ?? 0) >= 32 && char.codePointAt(0) !== 127);
|
|
13863
|
+
function canonical2(value) {
|
|
13864
|
+
let remaining = 4096;
|
|
13865
|
+
function visit2(item, depth) {
|
|
13866
|
+
if (--remaining < 0 || depth > 32) throw new Error("bounded-json");
|
|
13867
|
+
if (item === null || typeof item === "boolean" || typeof item === "string") return item;
|
|
13868
|
+
if (typeof item === "number" && Number.isFinite(item)) return item;
|
|
13869
|
+
if (Array.isArray(item)) return item.map((child) => visit2(child, depth + 1));
|
|
13870
|
+
const object3 = record3(item);
|
|
13871
|
+
if (object3 === void 0) throw new Error("invalid-json");
|
|
13872
|
+
return Object.fromEntries(Object.keys(object3).sort().map((key) => [key, visit2(object3[key], depth + 1)]));
|
|
13873
|
+
}
|
|
13874
|
+
try {
|
|
13875
|
+
const serialized = JSON.stringify(visit2(value, 0));
|
|
13876
|
+
return serialized !== void 0 && Buffer.byteLength(serialized) <= 262144 ? serialized : void 0;
|
|
13877
|
+
} catch {
|
|
13878
|
+
return void 0;
|
|
13879
|
+
}
|
|
13880
|
+
}
|
|
13881
|
+
function observeRead(rawInput, runtime3) {
|
|
13882
|
+
const raw = record3(rawInput);
|
|
13883
|
+
if (raw === void 0 || runtime3 === "unknown" || !identity(raw["session_id"])) return void 0;
|
|
13884
|
+
const session = hash(`${runtime3}\0${raw["session_id"]}`);
|
|
13885
|
+
const reset = { kind: "reset", session };
|
|
13886
|
+
if (raw["hook_event_name"] !== "PostToolUse" || !["Read", "Grep", "Glob"].includes(String(raw["tool_name"]))) return reset;
|
|
13887
|
+
const response = raw["tool_response"];
|
|
13888
|
+
const result = record3(response);
|
|
13889
|
+
if (response === void 0 || response === null || result !== void 0 && (Object.keys(result).length === 0 || result["is_error"] === true || result["isError"] === true || result["success"] === false || result["error"] !== void 0 || result["interrupted"] === true || typeof result["exit_code"] === "number" && result["exit_code"] !== 0)) return reset;
|
|
13890
|
+
if (!identity(raw["tool_use_id"]) || record3(raw["tool_input"]) === void 0) return reset;
|
|
13891
|
+
const args = canonical2(raw["tool_input"]);
|
|
13892
|
+
const output = canonical2(response);
|
|
13893
|
+
if (args === void 0 || output === void 0) return reset;
|
|
13894
|
+
return {
|
|
13895
|
+
kind: "read",
|
|
13896
|
+
session,
|
|
13897
|
+
invocation: hash(raw["tool_use_id"]),
|
|
13898
|
+
fingerprint: hash(`${raw["tool_name"]}\0${args}\0${output}`)
|
|
13899
|
+
};
|
|
13900
|
+
}
|
|
13901
|
+
function advanceReadLoop(state, observation, now) {
|
|
13902
|
+
const fresh = state.sessions.filter((entry) => entry.at <= now && now - entry.at < 864e5);
|
|
13903
|
+
const previous = fresh.find((entry) => entry.session === observation.session);
|
|
13904
|
+
const others = fresh.filter((entry) => entry.session !== observation.session);
|
|
13905
|
+
if (observation.kind === "reset") return { state: { schemaVersion: 1, sessions: others }, warn: false };
|
|
13906
|
+
if (previous?.invocation === observation.invocation) return { state: { schemaVersion: 1, sessions: fresh }, warn: false };
|
|
13907
|
+
const count = previous?.fingerprint === observation.fingerprint ? Math.min(previous.count + 1, 4) : 1;
|
|
13908
|
+
return { state: { schemaVersion: 1, sessions: [...others.slice(-31), {
|
|
13909
|
+
session: observation.session,
|
|
13910
|
+
fingerprint: observation.fingerprint,
|
|
13911
|
+
invocation: observation.invocation,
|
|
13912
|
+
count,
|
|
13913
|
+
at: now
|
|
13914
|
+
}] }, warn: count === 4 && previous?.count === 3 };
|
|
13915
|
+
}
|
|
13916
|
+
|
|
13917
|
+
var MAX_STATE_BYTES = 32 * 1024;
|
|
13918
|
+
var unavailable = () => ({
|
|
13919
|
+
status: "degraded",
|
|
13920
|
+
details: { reason: "read-loop-unavailable" },
|
|
13921
|
+
diagnostic: "READ_LOOP_UNAVAILABLE: repetition advice unavailable; check session payload and local cache access. Tools remain allowed.\n"
|
|
13922
|
+
});
|
|
13923
|
+
function missing(error) {
|
|
13924
|
+
return recordCode(error) === "ENOENT";
|
|
13925
|
+
}
|
|
13926
|
+
function recordCode(error) {
|
|
13927
|
+
return typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
13928
|
+
}
|
|
13929
|
+
function directory(root) {
|
|
13930
|
+
let path2 = realpathSync7(root);
|
|
13931
|
+
for (const segment2 of [".void", "machine", "read-loop"]) {
|
|
13932
|
+
path2 = join17(path2, segment2);
|
|
13933
|
+
try {
|
|
13934
|
+
mkdirSync5(path2, { mode: 448 });
|
|
13935
|
+
} catch (error) {
|
|
13936
|
+
if (recordCode(error) !== "EEXIST") throw error;
|
|
13937
|
+
}
|
|
13938
|
+
const info = lstatSync6(path2);
|
|
13939
|
+
if (!info.isDirectory() || info.isSymbolicLink() || realpathSync7(path2) !== path2) throw new Error("unsafe-directory");
|
|
13940
|
+
if (segment2 === "read-loop" && process.platform !== "win32" && (info.mode & 63) !== 0) throw new Error("public-cache");
|
|
13941
|
+
}
|
|
13942
|
+
return path2;
|
|
13943
|
+
}
|
|
13944
|
+
function readState() {
|
|
13945
|
+
let fd;
|
|
13946
|
+
try {
|
|
13947
|
+
const info = lstatSync6("state.json");
|
|
13948
|
+
if (!info.isFile() || info.isSymbolicLink() || info.size > MAX_STATE_BYTES) throw new Error("unsafe-state");
|
|
13949
|
+
fd = openSync4("state.json", constants5.O_RDONLY | constants5.O_NONBLOCK | (constants5.O_NOFOLLOW ?? 0));
|
|
13950
|
+
const opened = fstatSync4(fd);
|
|
13951
|
+
if (!opened.isFile() || opened.size > MAX_STATE_BYTES || opened.nlink !== 1) throw new Error("unsafe-state");
|
|
13952
|
+
const buffer = Buffer.alloc(MAX_STATE_BYTES + 1);
|
|
13953
|
+
const bytes = readSync4(fd, buffer, 0, buffer.length, 0);
|
|
13954
|
+
if (bytes > MAX_STATE_BYTES) throw new Error("oversized-state");
|
|
13955
|
+
return readLoopState.parse(JSON.parse(buffer.subarray(0, bytes).toString("utf8")));
|
|
13956
|
+
} catch (error) {
|
|
13957
|
+
if (missing(error)) return { schemaVersion: 1, sessions: [] };
|
|
13958
|
+
throw error;
|
|
13959
|
+
} finally {
|
|
13960
|
+
if (fd !== void 0) closeSync4(fd);
|
|
13961
|
+
}
|
|
13962
|
+
}
|
|
13963
|
+
function executeReadLoop(raw, root, runtime3) {
|
|
13964
|
+
const observation = observeRead(raw, runtime3);
|
|
13965
|
+
if (observation === void 0) return unavailable();
|
|
13966
|
+
const previousCwd = process.cwd();
|
|
13967
|
+
let anchor2;
|
|
13968
|
+
let lock;
|
|
13969
|
+
let temporary;
|
|
13970
|
+
try {
|
|
13971
|
+
const path2 = directory(root);
|
|
13972
|
+
anchor2 = openSync4(path2, constants5.O_RDONLY | (constants5.O_DIRECTORY ?? 0) | (constants5.O_NOFOLLOW ?? 0));
|
|
13973
|
+
const expected = fstatSync4(anchor2);
|
|
13974
|
+
process.chdir(path2);
|
|
13975
|
+
const actual = statSync7(".");
|
|
13976
|
+
if (!expected.isDirectory() || actual.dev !== expected.dev || actual.ino !== expected.ino || realpathSync7(".") !== path2) throw new Error("directory-changed");
|
|
13977
|
+
lock = openSync4("state.lock", constants5.O_WRONLY | constants5.O_CREAT | constants5.O_EXCL | (constants5.O_NOFOLLOW ?? 0), 384);
|
|
13978
|
+
const next = advanceReadLoop(readState(), observation, Date.now());
|
|
13979
|
+
const serialized = JSON.stringify(next.state);
|
|
13980
|
+
if (Buffer.byteLength(serialized) > MAX_STATE_BYTES) throw new Error("oversized-state");
|
|
13981
|
+
temporary = `.state-${randomUUID2()}.tmp`;
|
|
13982
|
+
writeFileSync4(temporary, serialized, { flag: "wx", mode: 384 });
|
|
13983
|
+
renameSync5(temporary, "state.json");
|
|
13984
|
+
temporary = void 0;
|
|
13985
|
+
return {
|
|
13986
|
+
status: observation.kind === "read" ? "ok" : "skipped",
|
|
13987
|
+
details: { warned: next.warn, reason: observation.kind === "read" ? "read-observed" : "stream-reset" },
|
|
13988
|
+
...next.warn ? { output: { hookSpecificOutput: {
|
|
13989
|
+
hookEventName: "PostToolUse",
|
|
13990
|
+
additionalContext: "READ_LOOP_WARNING: 4 consecutive identical read results. Reuse the existing result or change the question; repeat only when new information is expected. This is advice, not a tool block."
|
|
13991
|
+
} } } : {}
|
|
13992
|
+
};
|
|
13993
|
+
} catch {
|
|
13994
|
+
return unavailable();
|
|
13995
|
+
} finally {
|
|
13996
|
+
try {
|
|
13997
|
+
if (temporary !== void 0) unlinkSync2(temporary);
|
|
13998
|
+
if (lock !== void 0) {
|
|
13999
|
+
const owner = fstatSync4(lock);
|
|
14000
|
+
const current = lstatSync6("state.lock");
|
|
14001
|
+
if (owner.dev === current.dev && owner.ino === current.ino) unlinkSync2("state.lock");
|
|
14002
|
+
}
|
|
14003
|
+
} catch {
|
|
14004
|
+
process.stderr.write("READ_LOOP_UNAVAILABLE: local cache cleanup incomplete; tools remain allowed.\n");
|
|
14005
|
+
}
|
|
14006
|
+
if (lock !== void 0) closeSync4(lock);
|
|
14007
|
+
process.chdir(previousCwd);
|
|
14008
|
+
if (anchor2 !== void 0) closeSync4(anchor2);
|
|
14009
|
+
}
|
|
14010
|
+
}
|
|
14011
|
+
|
|
13807
14012
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13808
14013
|
import { execFileSync } from "node:child_process";
|
|
13809
14014
|
import {
|
|
13810
14015
|
existsSync as existsSync6,
|
|
13811
|
-
lstatSync as
|
|
14016
|
+
lstatSync as lstatSync7,
|
|
13812
14017
|
readFileSync as readFileSync12,
|
|
13813
|
-
statSync as
|
|
14018
|
+
statSync as statSync8
|
|
13814
14019
|
} from "node:fs";
|
|
13815
|
-
import { basename as basename6, join as
|
|
14020
|
+
import { basename as basename6, join as join18 } from "node:path";
|
|
13816
14021
|
var PROGRAM_PATHS = [
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
14022
|
+
join18(".void", "program.md"),
|
|
14023
|
+
join18(".void", "active.md"),
|
|
14024
|
+
join18("plans", "ACTIVE.md")
|
|
13820
14025
|
];
|
|
13821
14026
|
var CHECKPOINT_PATHS = [
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
14027
|
+
join18(".void", "machine", "checkpoint.md"),
|
|
14028
|
+
join18(".void", "local", "checkpoint.md"),
|
|
14029
|
+
join18(".void", "session", "current.md")
|
|
13825
14030
|
];
|
|
13826
14031
|
var MAX_READ_BYTES = 5e5;
|
|
13827
14032
|
var GIT_TIMEOUT_MS = 200;
|
|
13828
14033
|
function readBounded(path2) {
|
|
13829
14034
|
try {
|
|
13830
|
-
const info =
|
|
14035
|
+
const info = lstatSync7(path2);
|
|
13831
14036
|
if (!info.isFile() || info.isSymbolicLink() || info.size > MAX_READ_BYTES) return void 0;
|
|
13832
14037
|
return readFileSync12(path2, "utf8");
|
|
13833
14038
|
} catch {
|
|
@@ -13880,7 +14085,7 @@ function programFrom(raw, legacy) {
|
|
|
13880
14085
|
};
|
|
13881
14086
|
}
|
|
13882
14087
|
function observeProgram(root) {
|
|
13883
|
-
const present = PROGRAM_PATHS.filter((relative12) => existsSync6(
|
|
14088
|
+
const present = PROGRAM_PATHS.filter((relative12) => existsSync6(join18(root, relative12)));
|
|
13884
14089
|
if (present.length === 0) return { program: void 0 };
|
|
13885
14090
|
if (present.length > 1) {
|
|
13886
14091
|
return {
|
|
@@ -13890,7 +14095,7 @@ function observeProgram(root) {
|
|
|
13890
14095
|
}
|
|
13891
14096
|
const relative11 = present[0];
|
|
13892
14097
|
if (relative11 === void 0) return { program: void 0 };
|
|
13893
|
-
const raw = readBounded(
|
|
14098
|
+
const raw = readBounded(join18(root, relative11));
|
|
13894
14099
|
const program = raw === void 0 ? void 0 : programFrom(raw, relative11 !== PROGRAM_PATHS[0]);
|
|
13895
14100
|
return program === void 0 ? { program: void 0, programError: `invalid program descriptor: ${relative11}` } : { program };
|
|
13896
14101
|
}
|
|
@@ -13918,11 +14123,11 @@ function gitObservation(root) {
|
|
|
13918
14123
|
}
|
|
13919
14124
|
function checkpointObservation(root) {
|
|
13920
14125
|
for (const relative11 of CHECKPOINT_PATHS) {
|
|
13921
|
-
const path2 =
|
|
14126
|
+
const path2 = join18(root, relative11);
|
|
13922
14127
|
const raw = readBounded(path2);
|
|
13923
14128
|
if (raw === void 0) continue;
|
|
13924
14129
|
try {
|
|
13925
|
-
return { checkpoint: parseCheckpoint2(raw), checkpointWrittenAt:
|
|
14130
|
+
return { checkpoint: parseCheckpoint2(raw), checkpointWrittenAt: statSync8(path2).mtimeMs };
|
|
13926
14131
|
} catch {
|
|
13927
14132
|
return { checkpoint: parseCheckpoint2(raw) };
|
|
13928
14133
|
}
|
|
@@ -13983,14 +14188,14 @@ function checkpointReminderOutput(prompt) {
|
|
|
13983
14188
|
}
|
|
13984
14189
|
|
|
13985
14190
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13986
|
-
import { createHash as
|
|
14191
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
13987
14192
|
import {
|
|
13988
|
-
lstatSync as
|
|
13989
|
-
mkdirSync as
|
|
13990
|
-
realpathSync as
|
|
13991
|
-
writeFileSync as
|
|
14193
|
+
lstatSync as lstatSync8,
|
|
14194
|
+
mkdirSync as mkdirSync6,
|
|
14195
|
+
realpathSync as realpathSync8,
|
|
14196
|
+
writeFileSync as writeFileSync5
|
|
13992
14197
|
} from "node:fs";
|
|
13993
|
-
import { join as
|
|
14198
|
+
import { join as join19, relative as relative7 } from "node:path";
|
|
13994
14199
|
|
|
13995
14200
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
13996
14201
|
function record5(value) {
|
|
@@ -14058,11 +14263,11 @@ ${errors}
|
|
|
14058
14263
|
|
|
14059
14264
|
function safeOutputDirectory(root) {
|
|
14060
14265
|
try {
|
|
14061
|
-
const canonicalRoot =
|
|
14062
|
-
const
|
|
14063
|
-
|
|
14064
|
-
const info =
|
|
14065
|
-
const canonicalDirectory2 =
|
|
14266
|
+
const canonicalRoot = realpathSync8(root);
|
|
14267
|
+
const directory2 = voidMachinePath(root, "outputs");
|
|
14268
|
+
mkdirSync6(directory2, { recursive: true, mode: 448 });
|
|
14269
|
+
const info = lstatSync8(directory2);
|
|
14270
|
+
const canonicalDirectory2 = realpathSync8(directory2);
|
|
14066
14271
|
if (!info.isDirectory() || info.isSymbolicLink() || !within(canonicalRoot, canonicalDirectory2)) {
|
|
14067
14272
|
return void 0;
|
|
14068
14273
|
}
|
|
@@ -14088,17 +14293,17 @@ function executeTrim(rawInput, root, env) {
|
|
|
14088
14293
|
if (Buffer.byteLength(extracted.text, "utf8") <= thresholdBytes) {
|
|
14089
14294
|
return { status: "skipped", details: { reason: "below-threshold" } };
|
|
14090
14295
|
}
|
|
14091
|
-
const
|
|
14092
|
-
if (
|
|
14296
|
+
const directory2 = safeOutputDirectory(root);
|
|
14297
|
+
if (directory2 === void 0) {
|
|
14093
14298
|
return {
|
|
14094
14299
|
status: "degraded",
|
|
14095
14300
|
details: { reason: "unsafe-output-directory" }
|
|
14096
14301
|
};
|
|
14097
14302
|
}
|
|
14098
|
-
const
|
|
14303
|
+
const hash2 = createHash6("sha256").update(extracted.text).digest("hex").slice(0, 12);
|
|
14099
14304
|
const tool = extracted.tool.replaceAll(/[^A-Za-z0-9_]/g, "_").slice(0, 80);
|
|
14100
|
-
const file =
|
|
14101
|
-
const spillPath = relative7(
|
|
14305
|
+
const file = join19(directory2, `${tool}-${process.pid}-${Date.now()}-${hash2}.log`);
|
|
14306
|
+
const spillPath = relative7(realpathSync8(root), file).replaceAll("\\", "/");
|
|
14102
14307
|
const plan = planOutputTrim(extracted.text, {
|
|
14103
14308
|
tool: extracted.tool,
|
|
14104
14309
|
thresholdBytes,
|
|
@@ -14108,7 +14313,7 @@ function executeTrim(rawInput, root, env) {
|
|
|
14108
14313
|
return { status: "skipped", details: { reason: "below-threshold" } };
|
|
14109
14314
|
}
|
|
14110
14315
|
try {
|
|
14111
|
-
|
|
14316
|
+
writeFileSync5(file, plan.fullOutput, {
|
|
14112
14317
|
encoding: "utf8",
|
|
14113
14318
|
flag: "wx",
|
|
14114
14319
|
mode: 384
|
|
@@ -14134,14 +14339,14 @@ function executeTrim(rawInput, root, env) {
|
|
|
14134
14339
|
|
|
14135
14340
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
14136
14341
|
import { existsSync as existsSync7 } from "node:fs";
|
|
14137
|
-
import { join as
|
|
14342
|
+
import { join as join21 } from "node:path";
|
|
14138
14343
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
14139
14344
|
|
|
14140
14345
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
14141
14346
|
import {
|
|
14142
14347
|
dirname as dirname7,
|
|
14143
14348
|
isAbsolute as isAbsolute9,
|
|
14144
|
-
join as
|
|
14349
|
+
join as join20,
|
|
14145
14350
|
relative as relative8,
|
|
14146
14351
|
resolve as resolve8
|
|
14147
14352
|
} from "node:path";
|
|
@@ -14243,7 +14448,7 @@ function nearestTsconfigs(changedPaths, projectRoot2, hasFile) {
|
|
|
14243
14448
|
if (!within3(root, target)) continue;
|
|
14244
14449
|
let current = dirname7(target);
|
|
14245
14450
|
while (within3(root, current)) {
|
|
14246
|
-
const config2 =
|
|
14451
|
+
const config2 = join20(current, "tsconfig.json");
|
|
14247
14452
|
if (hasFile(config2)) {
|
|
14248
14453
|
found.add(config2);
|
|
14249
14454
|
break;
|
|
@@ -14299,7 +14504,7 @@ function executeTypecheck(root, env) {
|
|
|
14299
14504
|
return { status: "skipped", details: { reason: "no-touched-typescript" } };
|
|
14300
14505
|
}
|
|
14301
14506
|
const configs = nearestTsconfigs(changed, root, existsSync7);
|
|
14302
|
-
const configured = configuredTypecheck(readJson(
|
|
14507
|
+
const configured = configuredTypecheck(readJson(join21(root, ".void", "config.json")));
|
|
14303
14508
|
const configuredArgv = "argv" in configured ? configured.argv : void 0;
|
|
14304
14509
|
const warning = "warning" in configured ? configured.warning : void 0;
|
|
14305
14510
|
const fallback = findExecutable("tsc", root, env);
|
|
@@ -14385,13 +14590,13 @@ Resolve before claiming done. This never blocks.
|
|
|
14385
14590
|
|
|
14386
14591
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
14387
14592
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
14388
|
-
import { closeSync as
|
|
14389
|
-
import { dirname as dirname8, isAbsolute as isAbsolute10, join as
|
|
14593
|
+
import { closeSync as closeSync5, existsSync as existsSync8, lstatSync as lstatSync9, openSync as openSync5, readSync as readSync5, realpathSync as realpathSync9 } from "node:fs";
|
|
14594
|
+
import { dirname as dirname8, isAbsolute as isAbsolute10, join as join22, resolve as resolve9 } from "node:path";
|
|
14390
14595
|
var GIT_TIMEOUT_MS2 = 5e3;
|
|
14391
14596
|
var GIT_MAX_OUTPUT_BYTES = 1e6;
|
|
14392
|
-
function
|
|
14597
|
+
function canonical3(path2) {
|
|
14393
14598
|
try {
|
|
14394
|
-
return
|
|
14599
|
+
return realpathSync9(resolve9(path2));
|
|
14395
14600
|
} catch {
|
|
14396
14601
|
return resolve9(path2);
|
|
14397
14602
|
}
|
|
@@ -14424,18 +14629,18 @@ function mainWorkingTree(cwd, deadline, expectedCommon, query = git2) {
|
|
|
14424
14629
|
const args = ["rev-parse", "--show-toplevel", ...expectedCommon === void 0 ? [] : ["--git-common-dir"]];
|
|
14425
14630
|
const [toplevel, common] = query(listed, args, deadline)?.trim().split(/\r?\n/) ?? [];
|
|
14426
14631
|
if (toplevel === void 0 || toplevel === "") return void 0;
|
|
14427
|
-
if (expectedCommon !== void 0 && (common === void 0 ||
|
|
14428
|
-
return
|
|
14632
|
+
if (expectedCommon !== void 0 && (common === void 0 || canonical3(resolve9(listed, common)) !== expectedCommon)) return void 0;
|
|
14633
|
+
return canonical3(toplevel);
|
|
14429
14634
|
}
|
|
14430
14635
|
function holdsInstallReceipt(root) {
|
|
14431
14636
|
return existsSync8(voidReadPath(root, "receipts", "install-v1.json"));
|
|
14432
14637
|
}
|
|
14433
14638
|
function gitPointer(path2) {
|
|
14434
|
-
if (!
|
|
14435
|
-
const file =
|
|
14639
|
+
if (!lstatSync9(path2).isFile()) throw new Error("INVALID_GIT_POINTER");
|
|
14640
|
+
const file = openSync5(path2, "r");
|
|
14436
14641
|
try {
|
|
14437
14642
|
const bytes = Buffer.alloc(4097);
|
|
14438
|
-
const size =
|
|
14643
|
+
const size = readSync5(file, bytes, 0, bytes.length, 0);
|
|
14439
14644
|
if (size > 4096) throw new Error("INVALID_GIT_POINTER");
|
|
14440
14645
|
const content = bytes.subarray(0, size);
|
|
14441
14646
|
const value = content.toString("utf8").replace(/\r?\n$/, "");
|
|
@@ -14444,38 +14649,38 @@ function gitPointer(path2) {
|
|
|
14444
14649
|
}
|
|
14445
14650
|
return value;
|
|
14446
14651
|
} finally {
|
|
14447
|
-
|
|
14652
|
+
closeSync5(file);
|
|
14448
14653
|
}
|
|
14449
14654
|
}
|
|
14450
14655
|
function ordinaryLinkedMain(tree) {
|
|
14451
|
-
const marker =
|
|
14656
|
+
const marker = join22(tree, ".git");
|
|
14452
14657
|
const pointer = gitPointer(marker);
|
|
14453
14658
|
if (!pointer.startsWith("gitdir: ")) throw new Error("INVALID_GIT_POINTER");
|
|
14454
|
-
const
|
|
14455
|
-
if (!existsSync8(
|
|
14456
|
-
const common =
|
|
14457
|
-
const backlink = gitPointer(
|
|
14458
|
-
if (!isAbsolute10(backlink) ||
|
|
14659
|
+
const directory2 = canonical3(resolve9(tree, pointer.slice(8)));
|
|
14660
|
+
if (!existsSync8(join22(directory2, "commondir"))) return void 0;
|
|
14661
|
+
const common = canonical3(resolve9(directory2, gitPointer(join22(directory2, "commondir"))));
|
|
14662
|
+
const backlink = gitPointer(join22(directory2, "gitdir"));
|
|
14663
|
+
if (!isAbsolute10(backlink) || canonical3(backlink) !== canonical3(marker) || canonical3(dirname8(directory2)) !== canonical3(join22(common, "worktrees"))) {
|
|
14459
14664
|
throw new Error("INVALID_GIT_POINTER");
|
|
14460
14665
|
}
|
|
14461
14666
|
const candidate = dirname8(common);
|
|
14462
|
-
const candidateMarker =
|
|
14463
|
-
if (!
|
|
14667
|
+
const candidateMarker = join22(candidate, ".git");
|
|
14668
|
+
if (!lstatSync9(candidateMarker, { throwIfNoEntry: false })?.isDirectory() || canonical3(candidateMarker) !== common) return void 0;
|
|
14464
14669
|
return candidate;
|
|
14465
14670
|
}
|
|
14466
14671
|
function resolveTelemetryRoot(cwd, query = git2) {
|
|
14467
14672
|
const refused2 = { kind: "unavailable", code: "TELEMETRY_ROOT_UNRESOLVED" };
|
|
14468
14673
|
try {
|
|
14469
|
-
let tree =
|
|
14470
|
-
while (
|
|
14674
|
+
let tree = canonical3(cwd);
|
|
14675
|
+
while (lstatSync9(join22(tree, ".git"), { throwIfNoEntry: false }) === void 0 && !holdsInstallReceipt(tree)) {
|
|
14471
14676
|
const parent = dirname8(tree);
|
|
14472
14677
|
if (parent === tree) {
|
|
14473
|
-
return { kind: "resolved", root:
|
|
14678
|
+
return { kind: "resolved", root: canonical3(discoverProjectRoot(cwd)) };
|
|
14474
14679
|
}
|
|
14475
14680
|
tree = parent;
|
|
14476
14681
|
}
|
|
14477
|
-
const marker =
|
|
14478
|
-
const markerStat =
|
|
14682
|
+
const marker = join22(tree, ".git");
|
|
14683
|
+
const markerStat = lstatSync9(marker, { throwIfNoEntry: false });
|
|
14479
14684
|
if (markerStat?.isSymbolicLink()) return refused2;
|
|
14480
14685
|
if (markerStat === void 0 || markerStat.isDirectory() || holdsInstallReceipt(tree)) {
|
|
14481
14686
|
return { kind: "resolved", root: tree };
|
|
@@ -14483,16 +14688,16 @@ function resolveTelemetryRoot(cwd, query = git2) {
|
|
|
14483
14688
|
const ordinary = ordinaryLinkedMain(tree);
|
|
14484
14689
|
if (ordinary !== void 0) return { kind: "resolved", root: ordinary };
|
|
14485
14690
|
const deadline = performance.now() + 100;
|
|
14486
|
-
const [toplevel,
|
|
14691
|
+
const [toplevel, directory2, common] = query(tree, [
|
|
14487
14692
|
"rev-parse",
|
|
14488
14693
|
"--show-toplevel",
|
|
14489
14694
|
"--absolute-git-dir",
|
|
14490
14695
|
"--git-common-dir"
|
|
14491
14696
|
], deadline)?.trim().split(/\r?\n/) ?? [];
|
|
14492
|
-
if (toplevel === void 0 ||
|
|
14493
|
-
if (
|
|
14494
|
-
const commonDirectory =
|
|
14495
|
-
if (
|
|
14697
|
+
if (toplevel === void 0 || canonical3(toplevel) !== tree) return refused2;
|
|
14698
|
+
if (directory2 === void 0 || common === void 0) return refused2;
|
|
14699
|
+
const commonDirectory = canonical3(resolve9(tree, common));
|
|
14700
|
+
if (canonical3(directory2) === commonDirectory) return { kind: "resolved", root: tree };
|
|
14496
14701
|
const main2 = mainWorkingTree(tree, deadline, commonDirectory, query);
|
|
14497
14702
|
if (main2 === void 0) return refused2;
|
|
14498
14703
|
return { kind: "resolved", root: main2 };
|
|
@@ -14504,7 +14709,7 @@ function resolveTelemetryRoot(cwd, query = git2) {
|
|
|
14504
14709
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
14505
14710
|
|
|
14506
14711
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
14507
|
-
import { createHash as
|
|
14712
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
14508
14713
|
import {
|
|
14509
14714
|
basename as basename7,
|
|
14510
14715
|
extname,
|
|
@@ -14624,14 +14829,14 @@ function deriveMissionId(explicit, runtime3, runtimeSessionId2, root) {
|
|
|
14624
14829
|
}
|
|
14625
14830
|
return explicit;
|
|
14626
14831
|
}
|
|
14627
|
-
const opaque =
|
|
14832
|
+
const opaque = createHash7("sha256").update(`${runtime3}\0${runtimeSessionId2 || "unknown"}\0${resolve10(root)}`).digest("hex").slice(0, 32);
|
|
14628
14833
|
return `mis_${opaque}`;
|
|
14629
14834
|
}
|
|
14630
14835
|
|
|
14631
14836
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
14632
14837
|
import { randomUUID as nodeRandomUUID } from "node:crypto";
|
|
14633
14838
|
import {
|
|
14634
|
-
constants as
|
|
14839
|
+
constants as constants6
|
|
14635
14840
|
} from "node:fs";
|
|
14636
14841
|
import {
|
|
14637
14842
|
lstat,
|
|
@@ -14646,7 +14851,7 @@ import {
|
|
|
14646
14851
|
import {
|
|
14647
14852
|
dirname as dirname9,
|
|
14648
14853
|
isAbsolute as isAbsolute12,
|
|
14649
|
-
join as
|
|
14854
|
+
join as join23,
|
|
14650
14855
|
relative as relative10,
|
|
14651
14856
|
resolve as resolve11
|
|
14652
14857
|
} from "node:path";
|
|
@@ -14894,6 +15099,8 @@ function replayEventLog(text3) {
|
|
|
14894
15099
|
|
|
14895
15100
|
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
14896
15101
|
|
|
15102
|
+
init_define_VOID_SYNTAX_WORKER_IDENTITY();
|
|
15103
|
+
|
|
14897
15104
|
var MAX_EVENT_LOG_BYTES = 8 * 1024 * 1024;
|
|
14898
15105
|
var MISSION_ID3 = /^mis_[A-Za-z0-9_-]{8,100}$/;
|
|
14899
15106
|
var EVENT_ID2 = /^evt_[A-Za-z0-9_-]{8,100}$/;
|
|
@@ -15022,7 +15229,7 @@ async function ensureLineBoundary(logPath, logBytes) {
|
|
|
15022
15229
|
}
|
|
15023
15230
|
const append = await open(
|
|
15024
15231
|
logPath,
|
|
15025
|
-
|
|
15232
|
+
constants6.O_APPEND | constants6.O_WRONLY | (constants6.O_NOFOLLOW ?? 0)
|
|
15026
15233
|
);
|
|
15027
15234
|
try {
|
|
15028
15235
|
await append.writeFile("\n", "utf8");
|
|
@@ -15032,7 +15239,7 @@ async function ensureLineBoundary(logPath, logBytes) {
|
|
|
15032
15239
|
return logBytes + 1;
|
|
15033
15240
|
}
|
|
15034
15241
|
async function appendLine(logPath, line) {
|
|
15035
|
-
const flags =
|
|
15242
|
+
const flags = constants6.O_APPEND | constants6.O_CREAT | constants6.O_WRONLY | (constants6.O_NOFOLLOW ?? 0);
|
|
15036
15243
|
const handle = await open(logPath, flags, 384);
|
|
15037
15244
|
try {
|
|
15038
15245
|
await handle.writeFile(`${line}
|
|
@@ -15042,8 +15249,8 @@ async function appendLine(logPath, line) {
|
|
|
15042
15249
|
await handle.close();
|
|
15043
15250
|
}
|
|
15044
15251
|
}
|
|
15045
|
-
async function writeSequenceState(statePath, state,
|
|
15046
|
-
const temporary = `${statePath}.${
|
|
15252
|
+
async function writeSequenceState(statePath, state, randomUUID3) {
|
|
15253
|
+
const temporary = `${statePath}.${randomUUID3()}.tmp`;
|
|
15047
15254
|
const handle = await open(temporary, "wx", 384);
|
|
15048
15255
|
try {
|
|
15049
15256
|
await handle.writeFile(JSON.stringify(state), "utf8");
|
|
@@ -15080,9 +15287,9 @@ async function writeSequencedEventInternal(options) {
|
|
|
15080
15287
|
throw new Error("HOOK_INVALID_EVENT_ID: expected evt_<opaque-id>");
|
|
15081
15288
|
}
|
|
15082
15289
|
const run = await safeRunDirectory(options.root, options.missionId);
|
|
15083
|
-
const logPath =
|
|
15084
|
-
const statePath =
|
|
15085
|
-
const lockPath =
|
|
15290
|
+
const logPath = join23(run, "events.jsonl");
|
|
15291
|
+
const statePath = join23(run, ".seq.state");
|
|
15292
|
+
const lockPath = join23(run, ".seq.lock");
|
|
15086
15293
|
await Promise.all([
|
|
15087
15294
|
rejectSymlink(logPath),
|
|
15088
15295
|
rejectSymlink(statePath),
|
|
@@ -15093,7 +15300,7 @@ async function writeSequencedEventInternal(options) {
|
|
|
15093
15300
|
options.lockStaleMs ?? DEFAULT_LOCK_STALE_MS,
|
|
15094
15301
|
options.lockAttempts ?? DEFAULT_LOCK_ATTEMPTS
|
|
15095
15302
|
);
|
|
15096
|
-
const
|
|
15303
|
+
const randomUUID3 = options.randomUUID ?? nodeRandomUUID;
|
|
15097
15304
|
try {
|
|
15098
15305
|
await rejectSymlink(logPath);
|
|
15099
15306
|
const currentBytes = await stat(logPath).then((value) => value.size).catch((error) => {
|
|
@@ -15126,7 +15333,7 @@ async function writeSequencedEventInternal(options) {
|
|
|
15126
15333
|
const event = {
|
|
15127
15334
|
schemaVersion: 1,
|
|
15128
15335
|
seq: previousSeq + 1,
|
|
15129
|
-
eventId: options.eventId ?? `evt_${
|
|
15336
|
+
eventId: options.eventId ?? `evt_${randomUUID3()}`,
|
|
15130
15337
|
missionId: options.missionId,
|
|
15131
15338
|
ts: (options.now ?? /* @__PURE__ */ new Date()).toISOString(),
|
|
15132
15339
|
...options.draft
|
|
@@ -15139,7 +15346,7 @@ async function writeSequencedEventInternal(options) {
|
|
|
15139
15346
|
await writeSequenceState(
|
|
15140
15347
|
statePath,
|
|
15141
15348
|
{ seq: event.seq, logBytes },
|
|
15142
|
-
|
|
15349
|
+
randomUUID3
|
|
15143
15350
|
);
|
|
15144
15351
|
return Object.freeze({ event, appended: true });
|
|
15145
15352
|
} finally {
|
|
@@ -15422,11 +15629,19 @@ async function main() {
|
|
|
15422
15629
|
}
|
|
15423
15630
|
if (process.argv[2] !== "enforce" && process.argv[2] !== "enforce-ci") {
|
|
15424
15631
|
try {
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
process.env
|
|
15429
|
-
|
|
15632
|
+
const rawInput = parseHookPayload(input);
|
|
15633
|
+
const event = record3(rawInput)?.["hook_event_name"];
|
|
15634
|
+
if (process.argv[2] === "outcome" && (event === "PostToolUse" || event === "PostToolUseFailure")) {
|
|
15635
|
+
const agentRuntime = runtime2(process.argv[3] ?? process.env["VOID_AGENT_RUNTIME"]);
|
|
15636
|
+
const root = projectRoot();
|
|
15637
|
+
const advice = executeReadLoop(rawInput, root, agentRuntime);
|
|
15638
|
+
if (advice.diagnostic !== void 0) process.stderr.write(advice.diagnostic);
|
|
15639
|
+
if (advice.output !== void 0) process.stdout.write(`${JSON.stringify(advice.output)}
|
|
15640
|
+
`);
|
|
15641
|
+
await observeHook("outcome-meter", advice, rawInput, agentRuntime, root);
|
|
15642
|
+
if (event === "PostToolUseFailure") return;
|
|
15643
|
+
}
|
|
15644
|
+
await recordRuntimeEventFromCli(rawInput, process.argv, process.env);
|
|
15430
15645
|
} catch (error) {
|
|
15431
15646
|
reportTelemetryFailure(error);
|
|
15432
15647
|
}
|