@moldea.ai/cli 14.0.1 → 15.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.
@@ -1,67 +1,67 @@
1
1
  import { d as e, f as t, m as n, n as r, u as i } from "./chunk-2cc3bf5c.mjs";
2
2
  import { a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, o as p, p as m, r as h, s as g, t as _, u as v } from "./chunk-8f198616.mjs";
3
- import { a as y, c as b, i as x, l as S, n as C, s as w, u as T } from "./chunk-98d84174.mjs";
3
+ import { a as y, c as b, i as x, l as S, n as C, s as w, u as ee } from "./chunk-98d84174.mjs";
4
4
  //#region ../../node_modules/.pnpm/jg-utilities@1.7.2/node_modules/jg-utilities/dist/utils/marked-region.js
5
- var ee = "", E = (n) => {
5
+ var te = "", T = (n) => {
6
6
  throw new t(n, { code: e.INVALID_MARKED_REGION });
7
- }, te = ({ start: e, end: t }) => {
8
- for (let n of [e, t]) (typeof n != "string" || n === "" || /[\r\n]/.test(n)) && E("Each region marker must be a non-empty single line.");
9
- (e.includes(t) || t.includes(e)) && E("Neither region marker may contain the other.");
10
- }, ne = (e, t) => {
11
- te(t);
7
+ }, ne = ({ start: e, end: t }) => {
8
+ for (let n of [e, t]) (typeof n != "string" || n === "" || /[\r\n]/.test(n)) && T("Each region marker must be a non-empty single line.");
9
+ (e.includes(t) || t.includes(e)) && T("Neither region marker may contain the other.");
10
+ }, re = (e, t) => {
11
+ ne(t);
12
12
  let n, r, i = 0;
13
13
  for (; i < e.length;) {
14
- let a = e.indexOf("\n", i), o = a === -1 ? e.length : a + 1, s = a > i && e[a - 1] === "\r", c = a === -1 ? e.length : a - +!!s, l = i === 0 && e.startsWith(ee) ? 1 : i, u = e.slice(l, c);
15
- for (let e of ["start", "end"]) u.includes(t[e]) && (u !== t[e] && E(`The ${e} marker must fill its whole line.`), e === "start" ? ((n !== void 0 || r !== void 0) && E("The document must hold one start marker, before one end marker."), n = {
14
+ let a = e.indexOf("\n", i), o = a === -1 ? e.length : a + 1, s = a > i && e[a - 1] === "\r", c = a === -1 ? e.length : a - +!!s, l = i === 0 && e.startsWith(te) ? 1 : i, u = e.slice(l, c);
15
+ for (let e of ["start", "end"]) u.includes(t[e]) && (u !== t[e] && T(`The ${e} marker must fill its whole line.`), e === "start" ? ((n !== void 0 || r !== void 0) && T("The document must hold one start marker, before one end marker."), n = {
16
16
  offset: l,
17
17
  lineEnding: s ? "\r\n" : "\n"
18
- }) : (r !== void 0 && E("The document must hold one end marker."), r = o));
18
+ }) : (r !== void 0 && T("The document must hold one end marker."), r = o));
19
19
  i = o;
20
20
  }
21
- return n === void 0 && r === void 0 ? null : n === void 0 || r === void 0 ? E("The document must hold both region markers, or neither.") : {
21
+ return n === void 0 && r === void 0 ? null : n === void 0 || r === void 0 ? T("The document must hold both region markers, or neither.") : {
22
22
  start: n.offset,
23
23
  end: r,
24
24
  lineEnding: n.lineEnding
25
25
  };
26
- }, re = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u, ie = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])$/u, ae = [
26
+ }, ie = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u, ae = /^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])$/u, oe = [
27
27
  "\n",
28
28
  "\r",
29
29
  "…",
30
30
  "\u2028",
31
31
  "\u2029"
32
- ], oe = /[!?[\]{}]/u, se = (e) => ae.some((t) => e.includes(t)), D = (e) => e >= 9 && e <= 13 || e === 32 || e === 133 || e === 160 || e === 5760 || e >= 8192 && e <= 8202 || e === 8232 || e === 8233 || e === 8239 || e === 8287 || e === 12288, O = (e) => {
32
+ ], se = /[!?[\]{}]/u, ce = (e) => oe.some((t) => e.includes(t)), E = (e) => e >= 9 && e <= 13 || e === 32 || e === 133 || e === 160 || e === 5760 || e >= 8192 && e <= 8202 || e === 8232 || e === 8233 || e === 8239 || e === 8287 || e === 12288, D = (e) => {
33
33
  let t = e[Symbol.iterator](), n = 0;
34
34
  for (; t.next().done !== !0;) n += 1;
35
35
  return n;
36
- }, k = (e) => {
37
- for (let t of e) if (!D(t.codePointAt(0) ?? 0)) return !0;
36
+ }, O = (e) => {
37
+ for (let t of e) if (!E(t.codePointAt(0) ?? 0)) return !0;
38
38
  return !1;
39
- }, ce = (e) => {
40
- let t = e.codePointAt(0), n = e.codePointAt(e.length - 1);
41
- return t !== void 0 && D(t) || n !== void 0 && D(n);
42
39
  }, le = (e) => {
40
+ let t = e.codePointAt(0), n = e.codePointAt(e.length - 1);
41
+ return t !== void 0 && E(t) || n !== void 0 && E(n);
42
+ }, ue = (e) => {
43
43
  let t = 0, n = e.length;
44
44
  for (; t < n;) {
45
45
  let n = e.codePointAt(t);
46
- if (n === void 0 || !D(n)) break;
46
+ if (n === void 0 || !E(n)) break;
47
47
  t += n > 65535 ? 2 : 1;
48
48
  }
49
49
  for (; n > t;) {
50
50
  let t = e.codePointAt(n - 1);
51
- if (t === void 0 || !D(t)) break;
51
+ if (t === void 0 || !E(t)) break;
52
52
  --n;
53
53
  }
54
54
  return e.slice(t, n);
55
- }, ue = (e) => e.length > 0 && !se(e), de = (e) => e.length <= 64 && re.test(e), fe = (e) => ie.test(e), pe = (e) => {
56
- let t = O(e);
57
- return t >= 1 && t <= 1e3 && !ce(e) && !se(e) && !e.includes("\0");
58
- }, A = (e) => e !== "/" && b(e) ? S(e) : null, me = (e) => e === "/moldea/moldea.yaml", j = (e) => {
55
+ }, de = (e) => e.length > 0 && !ce(e), fe = (e) => e.length <= 64 && ie.test(e), pe = (e) => ae.test(e), me = (e) => {
56
+ let t = D(e);
57
+ return t >= 1 && t <= 1e3 && !le(e) && !ce(e) && !e.includes("\0");
58
+ }, k = (e) => e !== "/" && b(e) ? S(e) : null, he = (e) => e === "/moldea/moldea.yaml", A = (e) => {
59
59
  let t = /^\/moldea\/decisions\/(\d{13})-([a-z0-9]+(?:-[a-z0-9]+)*)\.md$/u.exec(e), n = t?.[1], r = t?.[2];
60
- return n !== void 0 && r !== void 0 && de(r) ? n : null;
61
- }, he = (e, t) => t && e === "/moldea/project.md" ? !0 : e.startsWith("/moldea/context/") && e.endsWith(".md"), ge = (e) => j(e) !== null, _e = (e) => e !== "/moldea" && !e.startsWith("/moldea/"), ve = (e) => oe.test(e), ye = (e) => ve(e) || e.includes("***") || e.slice(1).split("/").some((e) => e.includes("**") && e !== "**") ? !1 : e.includes("*") && b(e.replaceAll("*", "x")), be = (e) => ue(e) && !e.includes("\0"), xe = (e) => e === "/moldea" || e.startsWith("/moldea/"), Se = new TextEncoder(), Ce = new TextDecoder("utf-8", {
60
+ return n !== void 0 && r !== void 0 && fe(r) ? n : null;
61
+ }, ge = (e, t) => t && e === "/moldea/project.md" ? !0 : e.startsWith("/moldea/context/") && e.endsWith(".md"), _e = (e) => A(e) !== null, ve = (e) => e !== "/moldea" && !e.startsWith("/moldea/"), ye = (e) => se.test(e), be = (e) => ye(e) || e.includes("***") || e.slice(1).split("/").some((e) => e.includes("**") && e !== "**") ? !1 : e.includes("*") && b(e.replaceAll("*", "x")), xe = (e) => de(e) && !e.includes("\0"), Se = (e) => e === "/moldea" || e.startsWith("/moldea/"), Ce = new TextEncoder(), we = new TextDecoder("utf-8", {
62
62
  fatal: !0,
63
63
  ignoreBOM: !0
64
- }), we = (e, t, n) => {
64
+ }), Te = (e, t, n) => {
65
65
  let r = 1, i = 1, a = 0;
66
66
  for (let o of e) o === "\0" && n.add({
67
67
  code: "MOLDEA_TEXT_NUL_FORBIDDEN",
@@ -79,12 +79,12 @@ var ee = "", E = (n) => {
79
79
  }
80
80
  }
81
81
  }), o === "\n" ? (r = 1, i += 1) : r += 1, a += 1;
82
- }, Te = (e) => {
82
+ }, Ee = (e) => {
83
83
  throw new r({
84
84
  code: "INVALID_ARGUMENT",
85
85
  operation: e
86
86
  });
87
- }, Ee = (e, t, n, i) => {
87
+ }, De = (e, t, n, i) => {
88
88
  if (!(e <= t[i])) throw new r({
89
89
  code: "RESOURCE_LIMIT_EXCEEDED",
90
90
  limit: i,
@@ -93,42 +93,42 @@ var ee = "", E = (n) => {
93
93
  observedUsage: e,
94
94
  operation: n
95
95
  });
96
- }, De = (e) => m({
96
+ }, Oe = (e) => m({
97
97
  diagnostics: [...e],
98
98
  text: null,
99
99
  valid: !1
100
- }), Oe = (e, t, n, r, a) => {
101
- if (!i(e, !0)) return Te(n);
100
+ }), ke = (e, t, n, r, a) => {
101
+ if (!i(e, !0)) return Ee(n);
102
102
  let o = e.path, s = e.content;
103
- if (typeof o != "string" || typeof s != "string" && !(s instanceof Uint8Array)) return Te(n);
103
+ if (typeof o != "string" || typeof s != "string" && !(s instanceof Uint8Array)) return Ee(n);
104
104
  let c = S(o);
105
- if (typeof s == "string") return Ee(l(s, t[r]), t, n, r), s.isWellFormed() ? {
105
+ if (typeof s == "string") return De(l(s, t[r]), t, n, r), s.isWellFormed() ? {
106
106
  path: c,
107
107
  value: s
108
108
  } : (a.add({
109
109
  code: "MOLDEA_TEXT_INVALID_UNICODE",
110
110
  path: c
111
- }), De(a.finalize()));
112
- Ee(s.byteLength, t, n, r);
111
+ }), Oe(a.finalize()));
112
+ De(s.byteLength, t, n, r);
113
113
  let u = new Uint8Array(s);
114
114
  try {
115
115
  return {
116
116
  path: c,
117
- value: Ce.decode(u)
117
+ value: we.decode(u)
118
118
  };
119
119
  } catch {
120
120
  return a.add({
121
121
  code: "MOLDEA_TEXT_INVALID_UTF8",
122
122
  path: c
123
- }), De(a.finalize());
123
+ }), Oe(a.finalize());
124
124
  }
125
- }, M = (e, t, n, r = "maxFileBytes") => {
126
- let i = d(t, n), a = Oe(e, t, n, r, i);
125
+ }, j = (e, t, n, r = "maxFileBytes") => {
126
+ let i = d(t, n), a = ke(e, t, n, r, i);
127
127
  if ("valid" in a) return a;
128
128
  let o = (a.value.startsWith("") ? a.value.slice(1) : a.value).replace(/\r\n?/gu, "\n");
129
- if (we(o, a.path, i), i.size > 0) return De(i.finalize());
129
+ if (Te(o, a.path, i), i.size > 0) return Oe(i.finalize());
130
130
  let s = m({
131
- scalarLength: O(o),
131
+ scalarLength: D(o),
132
132
  utf8ByteLength: l(o),
133
133
  value: o
134
134
  });
@@ -137,29 +137,29 @@ var ee = "", E = (n) => {
137
137
  text: s,
138
138
  valid: !0
139
139
  });
140
- }, ke = (e) => {
140
+ }, Ae = (e) => {
141
141
  let t = "";
142
142
  for (let n of e) t += n.toString(16).padStart(2, "0");
143
143
  return t;
144
- }, N = async (e) => {
145
- let t = Se.encode(e.value);
146
- return `sha256:${ke(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", t)))}`;
147
- }, Ae = async (e, t) => {
148
- let n = M(e, t, "calculate-content-digest");
144
+ }, M = async (e) => {
145
+ let t = Ce.encode(e.value);
146
+ return `sha256:${Ae(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", t)))}`;
147
+ }, je = async (e, t) => {
148
+ let n = j(e, t, "calculate-content-digest");
149
149
  if (!n.valid || n.text === null) return m({
150
150
  diagnostics: n.diagnostics,
151
151
  digest: null,
152
152
  text: null,
153
153
  valid: !1
154
154
  });
155
- let r = await N(n.text);
155
+ let r = await M(n.text);
156
156
  return m({
157
157
  diagnostics: [],
158
158
  digest: r,
159
159
  text: n.text,
160
160
  valid: !0
161
161
  });
162
- }, je = (e, t) => {
162
+ }, Me = (e, t) => {
163
163
  let n = 0, r = 0, i = -1, a = -1;
164
164
  for (; r < t.length;) {
165
165
  if (e[n] === t[r]) {
@@ -175,7 +175,7 @@ var ee = "", E = (n) => {
175
175
  }
176
176
  for (; e[n] === "*";) n += 1;
177
177
  return n === e.length;
178
- }, Me = (e, t) => {
178
+ }, Ne = (e, t) => {
179
179
  let n = t.slice(1).split("/"), r = new Uint8Array(n.length + 1);
180
180
  r[0] = 1;
181
181
  for (let t of e) {
@@ -183,15 +183,15 @@ var ee = "", E = (n) => {
183
183
  if (t === "**") {
184
184
  let t = !1;
185
185
  for (let n = 0; n < r.length; n += 1) t ||= r[n] === 1, e[n] = +!!t;
186
- } else for (let i = 0; i < n.length; i += 1) r[i] === 1 && je(t, n[i] ?? "") && (e[i + 1] = 1);
186
+ } else for (let i = 0; i < n.length; i += 1) r[i] === 1 && Me(t, n[i] ?? "") && (e[i + 1] = 1);
187
187
  r = e;
188
188
  }
189
189
  return r[n.length] === 1;
190
- }, P = (e, t) => `${e}/${g(t)}`, Ne = (e, t, n = null) => ({
190
+ }, N = (e, t) => `${e}/${g(t)}`, Pe = (e, t, n = null) => ({
191
191
  agentId: n,
192
192
  id: t,
193
193
  kind: e
194
- }), Pe = (e, t) => u(e.kind, t.kind) || u(e.agentId ?? "", t.agentId ?? "") || u(e.id, t.id), Fe = (e) => e.kind === "exact" ? e.path : e.pattern, Ie = (e, t) => Pe(e.owner, t.owner) || u(e.field, t.field) || u(Fe(e.declaration), Fe(t.declaration)) || u(e.pointer, t.pointer), F = (e, t, n, r, i) => {
194
+ }), Fe = (e, t) => u(e.kind, t.kind) || u(e.agentId ?? "", t.agentId ?? "") || u(e.id, t.id), Ie = (e) => e.kind === "exact" ? e.path : e.pattern, Le = (e, t) => Fe(e.owner, t.owner) || u(e.field, t.field) || u(Ie(e.declaration), Ie(t.declaration)) || u(e.pointer, t.pointer), P = (e, t, n, r, i) => {
195
195
  e.push({
196
196
  declaration: typeof i == "string" ? {
197
197
  kind: "exact",
@@ -206,9 +206,9 @@ var ee = "", E = (n) => {
206
206
  owner: t,
207
207
  pointer: r
208
208
  });
209
- }, Le = (e, t, n, r, i) => {
210
- for (let [a, o] of (t ?? []).entries()) F(e, n, r, P(i, String(a)), o);
211
- }, Re = (e, t, n, r) => {
209
+ }, Re = (e, t, n, r, i) => {
210
+ for (let [a, o] of (t ?? []).entries()) P(e, n, r, N(i, String(a)), o);
211
+ }, ze = (e, t, n, r) => {
212
212
  for (let [i, a] of (t ?? []).entries()) e.push({
213
213
  declaration: a.includes("*") ? {
214
214
  kind: "glob",
@@ -220,17 +220,17 @@ var ee = "", E = (n) => {
220
220
  },
221
221
  field: "affectedBy",
222
222
  owner: n,
223
- pointer: P(r, String(i))
223
+ pointer: N(r, String(i))
224
224
  });
225
- }, ze = (e, t, n, r, i) => {
226
- let a = Ne(n.kind, t, r);
227
- if (F(e, a, "implementation", P(i, "implementation"), n.value.implementation), n.value.registration !== void 0 && F(e, a, "registration", P(i, "registration"), n.value.registration), n.kind === "tool") for (let t of ["inputSchema", "outputSchema"]) {
225
+ }, Be = (e, t, n, r, i) => {
226
+ let a = Pe(n.kind, t, r);
227
+ if (P(e, a, "implementation", N(i, "implementation"), n.value.implementation), n.value.registration !== void 0 && P(e, a, "registration", N(i, "registration"), n.value.registration), n.kind === "tool") for (let t of ["inputSchema", "outputSchema"]) {
228
228
  let r = n.value[t];
229
- r !== void 0 && F(e, a, t, P(i, t), r);
229
+ r !== void 0 && P(e, a, t, N(i, t), r);
230
230
  }
231
- Re(e, n.value.affectedBy, a, P(i, "affectedBy"));
232
- }, Be = (e, t, n) => {
233
- let r = P("/agents", t), i = Ne("agent", t, t), a = P(r, "bindings");
231
+ ze(e, n.value.affectedBy, a, N(i, "affectedBy"));
232
+ }, Ve = (e, t, n) => {
233
+ let r = N("/agents", t), i = Pe("agent", t, t), a = N(r, "bindings");
234
234
  for (let t of [
235
235
  "runtimeAgent",
236
236
  "inputSchema",
@@ -238,42 +238,42 @@ var ee = "", E = (n) => {
238
238
  "instructionLoader"
239
239
  ]) {
240
240
  let r = n.bindings?.[t];
241
- r !== void 0 && F(e, i, t, P(a, t), r);
241
+ r !== void 0 && P(e, i, t, N(a, t), r);
242
242
  }
243
- Re(e, n.affectedBy, i, P(r, "affectedBy"));
243
+ ze(e, n.affectedBy, i, N(r, "affectedBy"));
244
244
  for (let i of Object.keys(n.tools ?? {}).sort(u)) {
245
245
  let a = n.tools?.[i];
246
- a !== void 0 && ze(e, i, {
246
+ a !== void 0 && Be(e, i, {
247
247
  kind: "tool",
248
248
  value: a
249
- }, t, P(P(r, "tools"), i));
249
+ }, t, N(N(r, "tools"), i));
250
250
  }
251
251
  for (let i of Object.keys(n.skills ?? {}).sort(u)) {
252
252
  let a = n.skills?.[i];
253
- a !== void 0 && ze(e, i, {
253
+ a !== void 0 && Be(e, i, {
254
254
  kind: "skill",
255
255
  value: a
256
- }, t, P(P(r, "skills"), i));
256
+ }, t, N(N(r, "skills"), i));
257
257
  }
258
- for (let [t, a] of (n.mirrors ?? []).entries()) F(e, i, "mirrors", P(P(r, "mirrors"), String(t)), a);
259
- }, Ve = (e) => {
258
+ for (let [t, a] of (n.mirrors ?? []).entries()) P(e, i, "mirrors", N(N(r, "mirrors"), String(t)), a);
259
+ }, He = (e) => {
260
260
  let t = [];
261
261
  for (let n of ["context", "decision"]) {
262
262
  let r = n === "context" ? e.context : e.decisions;
263
263
  for (let e of Object.keys(r ?? {}).sort(u)) {
264
264
  let i = r?.[e];
265
265
  if (i === void 0) continue;
266
- let a = Ne(n, e), o = P(n === "context" ? "/context" : "/decisions", e);
267
- Le(t, i.bindings, a, "bindings", P(o, "bindings")), Re(t, i.affectedBy, a, P(o, "affectedBy"));
266
+ let a = Pe(n, e), o = N(n === "context" ? "/context" : "/decisions", e);
267
+ Re(t, i.bindings, a, "bindings", N(o, "bindings")), ze(t, i.affectedBy, a, N(o, "affectedBy"));
268
268
  }
269
269
  }
270
270
  for (let n of Object.keys(e.agents ?? {}).sort(u)) {
271
271
  let r = e.agents?.[n];
272
- r !== void 0 && Be(t, n, r);
272
+ r !== void 0 && Ve(t, n, r);
273
273
  }
274
- return t.sort(Ie);
275
- }, He = (e, t) => {
276
- let n = Ve(e);
274
+ return t.sort(Le);
275
+ }, Ue = (e, t) => {
276
+ let n = He(e);
277
277
  if (n.length > t.maxEntries) throw new r({
278
278
  code: "RESOURCE_LIMIT_EXCEEDED",
279
279
  limit: "maxEntries",
@@ -305,13 +305,13 @@ var ee = "", E = (n) => {
305
305
  globalGlobs: a,
306
306
  globsByFirstSegment: o
307
307
  };
308
- }, Ue = (e, t) => Pe(e.owner, t.owner) || u(e.field, t.field) || u(Fe(e.declaration), Fe(t.declaration)) || u(e.inputPath, t.inputPath) || u(e.pointer, t.pointer), We = (e, t) => ({
308
+ }, We = (e, t) => Fe(e.owner, t.owner) || u(e.field, t.field) || u(Ie(e.declaration), Ie(t.declaration)) || u(e.inputPath, t.inputPath) || u(e.pointer, t.pointer), Ge = (e, t) => ({
309
309
  declaration: t.declaration,
310
310
  field: t.field,
311
311
  inputPath: e,
312
312
  owner: t.owner,
313
313
  pointer: t.pointer
314
- }), Ge = (e, t, n, i) => {
314
+ }), Ke = (e, t, n, i) => {
315
315
  if (e.length >= i.maxEntries) throw new r({
316
316
  code: "RESOURCE_LIMIT_EXCEEDED",
317
317
  limit: "maxEntries",
@@ -320,24 +320,24 @@ var ee = "", E = (n) => {
320
320
  observedUsage: e.length + 1,
321
321
  operation: "match-manifest-scope"
322
322
  });
323
- e.push(We(t, n));
324
- }, Ke = (e, t, n, r) => {
325
- for (let i of n) Me(i.segments, t) && Ge(e, t, i.declaration, r);
326
- }, qe = async (e) => {
323
+ e.push(Ge(t, n));
324
+ }, qe = (e, t, n, r) => {
325
+ for (let i of n) Ne(i.segments, t) && Ke(e, t, i.declaration, r);
326
+ }, Je = async (e) => {
327
327
  let t = e.join("\0");
328
- return N({
329
- scalarLength: O(t),
328
+ return M({
329
+ scalarLength: D(t),
330
330
  utf8ByteLength: l(t),
331
331
  value: t
332
332
  });
333
- }, Je = (e, t, n) => {
334
- let r = He(e, n), i = [], a = new Set(), o = new Set();
333
+ }, Ye = (e, t, n) => {
334
+ let r = Ue(e, n), i = [], a = new Set(), o = new Set();
335
335
  for (let e of t) {
336
336
  let t = e.slice(1).split("/", 1)[0] ?? "", a = r.exact.get(e) ?? [];
337
- for (let t of a) Ge(i, e, t, n);
338
- Ke(i, e, r.globalGlobs, n), Ke(i, e, r.globsByFirstSegment.get(t) ?? [], n);
337
+ for (let t of a) Ke(i, e, t, n);
338
+ qe(i, e, r.globalGlobs, n), qe(i, e, r.globsByFirstSegment.get(t) ?? [], n);
339
339
  }
340
- i.sort(Ue);
340
+ i.sort(We);
341
341
  for (let e of i) a.add(`${e.owner.kind}\0${e.owner.agentId ?? ""}\0${e.owner.id}`), o.add(e.inputPath);
342
342
  return m({
343
343
  counts: {
@@ -349,7 +349,7 @@ var ee = "", E = (n) => {
349
349
  },
350
350
  matches: i
351
351
  });
352
- }, I = (e, t) => `${e}/${g(t)}`, L = (e, t, n, r, i = null) => {
352
+ }, F = (e, t) => `${e}/${g(t)}`, I = (e, t, n, r, i = null) => {
353
353
  e.diagnostics.add({
354
354
  code: "MOLDEA_MANIFEST_VALUE_INVALID",
355
355
  details: { reason: r },
@@ -358,12 +358,12 @@ var ee = "", E = (n) => {
358
358
  pointer: t,
359
359
  range: n
360
360
  });
361
- }, R = (e, t, n, r, i = null) => {
362
- if (e.kind !== "mapping") return L(r, t, e.range, "mapping-required", i), null;
361
+ }, L = (e, t, n, r, i = null) => {
362
+ if (e.kind !== "mapping") return I(r, t, e.range, "mapping-required", i), null;
363
363
  let a = new Map();
364
364
  for (let o of e.entries) {
365
365
  if (o.key.kind !== "scalar" || typeof o.key.value != "string") {
366
- L(r, t, o.key.range, "string-key-required", i);
366
+ I(r, t, o.key.range, "string-key-required", i);
367
367
  continue;
368
368
  }
369
369
  let e = o.key.value;
@@ -372,7 +372,7 @@ var ee = "", E = (n) => {
372
372
  code: "MOLDEA_MANIFEST_PROPERTY_UNKNOWN",
373
373
  entity: i,
374
374
  path: r.path,
375
- pointer: I(t, e),
375
+ pointer: F(t, e),
376
376
  range: o.key.range
377
377
  });
378
378
  continue;
@@ -383,12 +383,12 @@ var ee = "", E = (n) => {
383
383
  });
384
384
  }
385
385
  return a;
386
- }, Ye = (e, t, n, r = {}) => {
387
- if (e === void 0) return r.required === !0 && L(n, t, null, "required", r.entity ?? null), null;
388
- if (e.value.kind !== "scalar" || typeof e.value.value != "string") return L(n, t, e.value.range, "string-required", r.entity ?? null), null;
386
+ }, Xe = (e, t, n, r = {}) => {
387
+ if (e === void 0) return r.required === !0 && I(n, t, null, "required", r.entity ?? null), null;
388
+ if (e.value.kind !== "scalar" || typeof e.value.value != "string") return I(n, t, e.value.range, "string-required", r.entity ?? null), null;
389
389
  let i = e.value.value;
390
- return !k(i) || r.singleLine === !0 && !ue(i) ? (L(n, t, e.value.range, "string-invalid", r.entity ?? null), null) : i;
391
- }, Xe = (e, t, n, r, i = null) => de(e) ? !fe(e) || (r.diagnostics.add({
390
+ return !O(i) || r.singleLine === !0 && !de(i) ? (I(n, t, e.value.range, "string-invalid", r.entity ?? null), null) : i;
391
+ }, Ze = (e, t, n, r, i = null) => fe(e) ? !pe(e) || (r.diagnostics.add({
392
392
  code: "MOLDEA_ID_RESERVED",
393
393
  entity: i,
394
394
  path: r.path,
@@ -400,8 +400,8 @@ var ee = "", E = (n) => {
400
400
  path: r.path,
401
401
  pointer: n,
402
402
  range: t
403
- }), !1), Ze = (e, t, n, r = null) => {
404
- let i = R(e, t, new Set(["path", "symbol"]), n, r);
403
+ }), !1), Qe = (e, t, n, r = null) => {
404
+ let i = L(e, t, new Set(["path", "symbol"]), n, r);
405
405
  if (i === null) return null;
406
406
  let a = i.get("path");
407
407
  if (a?.value.kind !== "scalar" || typeof a.value.value != "string") return n.diagnostics.add({
@@ -409,39 +409,39 @@ var ee = "", E = (n) => {
409
409
  details: { reason: a === void 0 ? "missing" : "type" },
410
410
  entity: r,
411
411
  path: n.path,
412
- pointer: I(t, "path"),
412
+ pointer: F(t, "path"),
413
413
  range: a?.value.range ?? null
414
414
  }), null;
415
- let o = A(a.value.value);
415
+ let o = k(a.value.value);
416
416
  if (o === null) return n.diagnostics.add({
417
417
  code: "MOLDEA_PATH_INVALID",
418
418
  entity: r,
419
419
  path: n.path,
420
- pointer: I(t, "path"),
420
+ pointer: F(t, "path"),
421
421
  range: a.value.range
422
422
  }), null;
423
423
  let s = i.get("symbol");
424
- return s === void 0 ? { path: o } : s.value.kind !== "scalar" || typeof s.value.value != "string" || !be(s.value.value) ? (n.diagnostics.add({
424
+ return s === void 0 ? { path: o } : s.value.kind !== "scalar" || typeof s.value.value != "string" || !xe(s.value.value) ? (n.diagnostics.add({
425
425
  code: "MOLDEA_SYMBOL_INVALID",
426
426
  entity: r,
427
427
  path: n.path,
428
- pointer: I(t, "symbol"),
428
+ pointer: F(t, "symbol"),
429
429
  range: s.value.range
430
- }), null) : xe(o) ? (n.diagnostics.add({
430
+ }), null) : Se(o) ? (n.diagnostics.add({
431
431
  code: "MOLDEA_SYMBOL_FORBIDDEN",
432
432
  entity: r,
433
433
  path: n.path,
434
- pointer: I(t, "symbol"),
434
+ pointer: F(t, "symbol"),
435
435
  range: s.value.range
436
436
  }), null) : {
437
437
  path: o,
438
438
  symbol: s.value.value
439
439
  };
440
- }, Qe = (e, t, n, r = null) => {
441
- if (e.kind !== "sequence" || e.items.length === 0) return L(n, t, e.range, "non-empty-sequence-required", r), [];
440
+ }, $e = (e, t, n, r = null) => {
441
+ if (e.kind !== "sequence" || e.items.length === 0) return I(n, t, e.range, "non-empty-sequence-required", r), [];
442
442
  let i = [], a = new Set();
443
443
  return e.items.forEach((e, o) => {
444
- let s = Ze(e, I(t, String(o)), n, r);
444
+ let s = Qe(e, F(t, String(o)), n, r);
445
445
  if (s === null) return;
446
446
  let c = `${s.path}\0${s.symbol ?? ""}`;
447
447
  if (a.has(c)) {
@@ -449,24 +449,24 @@ var ee = "", E = (n) => {
449
449
  code: "MOLDEA_PATH_DUPLICATE",
450
450
  entity: r,
451
451
  path: n.path,
452
- pointer: I(t, String(o)),
452
+ pointer: F(t, String(o)),
453
453
  range: e.range
454
454
  });
455
455
  return;
456
456
  }
457
457
  a.add(c), i.push(s);
458
458
  }), i;
459
- }, $e = (e, t, n, r = null) => {
460
- if (e.kind !== "sequence" || e.items.length === 0) return L(n, t, e.range, "non-empty-sequence-required", r), [];
459
+ }, et = (e, t, n, r = null) => {
460
+ if (e.kind !== "sequence" || e.items.length === 0) return I(n, t, e.range, "non-empty-sequence-required", r), [];
461
461
  let i = [], a = new Set();
462
462
  return e.items.forEach((e, o) => {
463
- let s = I(t, String(o));
463
+ let s = F(t, String(o));
464
464
  if (e.kind !== "scalar" || typeof e.value != "string") {
465
- L(n, s, e.range, "string-required", r);
465
+ I(n, s, e.range, "string-required", r);
466
466
  return;
467
467
  }
468
- let c = e.value.includes("*") || ve(e.value);
469
- if (!(c ? ye(e.value) : A(e.value) !== null)) {
468
+ let c = e.value.includes("*") || ye(e.value);
469
+ if (!(c ? be(e.value) : k(e.value) !== null)) {
470
470
  n.diagnostics.add({
471
471
  code: c ? "MOLDEA_GLOB_INVALID" : "MOLDEA_PATH_INVALID",
472
472
  entity: r,
@@ -488,8 +488,8 @@ var ee = "", E = (n) => {
488
488
  }
489
489
  a.add(e.value), i.push(e.value);
490
490
  }), i;
491
- }, et = (e, t, n) => {
492
- let r = R(e, t, new Set(["affectedBy", "bindings"]), n);
491
+ }, tt = (e, t, n) => {
492
+ let r = L(e, t, new Set(["affectedBy", "bindings"]), n);
493
493
  if (r === null) return null;
494
494
  let i = r.get("bindings"), a = r.get("affectedBy");
495
495
  return i === void 0 && a === void 0 && n.diagnostics.add({
@@ -498,40 +498,40 @@ var ee = "", E = (n) => {
498
498
  pointer: t,
499
499
  range: e.range
500
500
  }), {
501
- ...i === void 0 ? {} : { bindings: Qe(i.value, I(t, "bindings"), n) },
502
- ...a === void 0 ? {} : { affectedBy: $e(a.value, I(t, "affectedBy"), n) }
501
+ ...i === void 0 ? {} : { bindings: $e(i.value, F(t, "bindings"), n) },
502
+ ...a === void 0 ? {} : { affectedBy: et(a.value, F(t, "affectedBy"), n) }
503
503
  };
504
- }, tt = (e, t, n, r) => {
505
- let i = R(e, t, null, r);
504
+ }, nt = (e, t, n, r) => {
505
+ let i = L(e, t, null, r);
506
506
  if (i === null) return null;
507
507
  let a = [];
508
508
  for (let [e, o] of [...i].sort(([e], [t]) => u(e, t))) {
509
- let i = A(e);
510
- if (!(i !== null && (n === "context" ? he(i, !0) : ge(i)))) {
509
+ let i = k(e);
510
+ if (!(i !== null && (n === "context" ? ge(i, !0) : _e(i)))) {
511
511
  r.diagnostics.add({
512
512
  code: n === "context" ? "MOLDEA_CONTEXT_PATH_INVALID" : "MOLDEA_DECISION_FILENAME_INVALID",
513
513
  path: r.path,
514
- pointer: I(t, e),
514
+ pointer: F(t, e),
515
515
  range: o.key.range
516
516
  });
517
517
  continue;
518
518
  }
519
- let s = et(o.value, I(t, e), r);
519
+ let s = tt(o.value, F(t, e), r);
520
520
  s !== null && a.push([e, s]);
521
521
  }
522
522
  return p(a);
523
- }, nt = (e, t, n, r, i) => {
524
- if (e.kind !== "sequence") return L(r, t, e.range, "sequence-required", i), [];
523
+ }, rt = (e, t, n, r, i) => {
524
+ if (e.kind !== "sequence") return I(r, t, e.range, "sequence-required", i), [];
525
525
  let a = [], o = new Set();
526
526
  return e.items.forEach((e, s) => {
527
- let c = I(t, String(s));
527
+ let c = F(t, String(s));
528
528
  if (e.kind !== "scalar" || typeof e.value != "string") {
529
- L(r, c, e.range, "string-required", i);
529
+ I(r, c, e.range, "string-required", i);
530
530
  return;
531
531
  }
532
- let l = A(e.value);
533
- if (!(l !== null && (n === "context" ? he(l, !1) : n === "decision" ? ge(l) : _e(l))) || l === null) {
534
- let t = n === "context" ? "MOLDEA_CONTEXT_PATH_INVALID" : n === "decision" ? "MOLDEA_DECISION_FILENAME_INVALID" : l !== null && !_e(l) ? "MOLDEA_MIRROR_PATH_INSIDE_MOLDEA" : "MOLDEA_MIRROR_PATH_INVALID";
532
+ let l = k(e.value);
533
+ if (!(l !== null && (n === "context" ? ge(l, !1) : n === "decision" ? _e(l) : ve(l))) || l === null) {
534
+ let t = n === "context" ? "MOLDEA_CONTEXT_PATH_INVALID" : n === "decision" ? "MOLDEA_DECISION_FILENAME_INVALID" : l !== null && !ve(l) ? "MOLDEA_MIRROR_PATH_INSIDE_MOLDEA" : "MOLDEA_MIRROR_PATH_INVALID";
535
535
  r.diagnostics.add({
536
536
  code: t,
537
537
  entity: i,
@@ -563,8 +563,8 @@ var ee = "", E = (n) => {
563
563
  }
564
564
  o.add(l), n === "mirror" && r.mirrorPaths.add(l), a.push(l);
565
565
  }), a;
566
- }, rt = (e, t, n, r) => {
567
- let i = { agentId: r }, a = R(e, t, new Set([
566
+ }, it = (e, t, n, r) => {
567
+ let i = { agentId: r }, a = L(e, t, new Set([
568
568
  "inputSchema",
569
569
  "instructionLoader",
570
570
  "outputSchema",
@@ -573,7 +573,7 @@ var ee = "", E = (n) => {
573
573
  if (a === null) return null;
574
574
  let o = (e) => {
575
575
  let r = a.get(e);
576
- return r === void 0 ? null : Ze(r.value, I(t, e), n, i);
576
+ return r === void 0 ? null : Qe(r.value, F(t, e), n, i);
577
577
  }, s = o("inputSchema"), c = o("instructionLoader"), l = o("outputSchema"), u = o("runtimeAgent");
578
578
  return {
579
579
  ...u === null ? {} : { runtimeAgent: u },
@@ -581,12 +581,12 @@ var ee = "", E = (n) => {
581
581
  ...l === null ? {} : { outputSchema: l },
582
582
  ...c === null ? {} : { instructionLoader: c }
583
583
  };
584
- }, it = (e, t, n, r, i, a) => {
584
+ }, at = (e, t, n, r, i, a) => {
585
585
  let o = {
586
586
  agentId: r,
587
587
  capabilityId: i,
588
588
  capabilityKind: a
589
- }, s = R(e, t, a === "tool" ? new Set([
589
+ }, s = L(e, t, a === "tool" ? new Set([
590
590
  "affectedBy",
591
591
  "description",
592
592
  "implementation",
@@ -602,7 +602,7 @@ var ee = "", E = (n) => {
602
602
  "registration"
603
603
  ]), n, o);
604
604
  if (s === null) return null;
605
- let c = Ye(s.get("name"), I(t, "name"), n, {
605
+ let c = Xe(s.get("name"), F(t, "name"), n, {
606
606
  entity: o,
607
607
  required: !0,
608
608
  singleLine: !0
@@ -611,12 +611,12 @@ var ee = "", E = (n) => {
611
611
  code: "MOLDEA_CAPABILITY_DESCRIPTION_MISSING",
612
612
  entity: o,
613
613
  path: n.path,
614
- pointer: I(t, "description")
615
- }) : l.value.kind !== "scalar" || typeof l.value.value != "string" || !pe(l.value.value) ? n.diagnostics.add({
614
+ pointer: F(t, "description")
615
+ }) : l.value.kind !== "scalar" || typeof l.value.value != "string" || !me(l.value.value) ? n.diagnostics.add({
616
616
  code: "MOLDEA_CAPABILITY_DESCRIPTION_INVALID",
617
617
  entity: o,
618
618
  path: n.path,
619
- pointer: I(t, "description"),
619
+ pointer: F(t, "description"),
620
620
  range: l.value.range
621
621
  }) : u = l.value.value;
622
622
  let d = s.get("implementation"), f = null;
@@ -624,12 +624,12 @@ var ee = "", E = (n) => {
624
624
  code: a === "tool" ? "MOLDEA_TOOL_IMPLEMENTATION_MISSING" : "MOLDEA_SKILL_IMPLEMENTATION_MISSING",
625
625
  entity: o,
626
626
  path: n.path,
627
- pointer: I(t, "implementation")
628
- }) : f = Ze(d.value, I(t, "implementation"), n, o);
627
+ pointer: F(t, "implementation")
628
+ }) : f = Qe(d.value, F(t, "implementation"), n, o);
629
629
  let p = (e) => {
630
630
  let r = s.get(e);
631
- return r === void 0 ? null : Ze(r.value, I(t, e), n, o);
632
- }, m = p("registration"), h = a === "tool" ? p("inputSchema") : null, g = a === "tool" ? p("outputSchema") : null, _ = s.get("affectedBy"), v = _ === void 0 ? null : $e(_.value, I(t, "affectedBy"), n, o);
631
+ return r === void 0 ? null : Qe(r.value, F(t, e), n, o);
632
+ }, m = p("registration"), h = a === "tool" ? p("inputSchema") : null, g = a === "tool" ? p("outputSchema") : null, _ = s.get("affectedBy"), v = _ === void 0 ? null : et(_.value, F(t, "affectedBy"), n, o);
633
633
  return c === null || u === null || f === null ? null : {
634
634
  name: c,
635
635
  description: u,
@@ -639,8 +639,8 @@ var ee = "", E = (n) => {
639
639
  ...g === null ? {} : { outputSchema: g },
640
640
  ...v === null ? {} : { affectedBy: v }
641
641
  };
642
- }, at = (e, t, n, r, i) => {
643
- let a = R(e, t, null, n, { agentId: r });
642
+ }, ot = (e, t, n, r, i) => {
643
+ let a = L(e, t, null, n, { agentId: r });
644
644
  if (a === null) return null;
645
645
  let o = [];
646
646
  for (let [e, s] of [...a].sort(([e], [t]) => u(e, t))) {
@@ -648,34 +648,34 @@ var ee = "", E = (n) => {
648
648
  agentId: r,
649
649
  capabilityId: e,
650
650
  capabilityKind: i
651
- }, c = I(t, e);
652
- Xe(e, s.key.range, c, n, a);
653
- let l = it(s.value, c, n, r, e, i);
651
+ }, c = F(t, e);
652
+ Ze(e, s.key.range, c, n, a);
653
+ let l = at(s.value, c, n, r, e, i);
654
654
  l !== null && o.push([e, l]);
655
655
  }
656
656
  return p(o);
657
- }, ot = (e, t) => {
657
+ }, st = (e, t) => {
658
658
  if (e.kind !== "mapping") return null;
659
659
  for (let n of e.entries) if (n.key.kind === "scalar" && n.key.value === t) return n.value;
660
660
  return null;
661
- }, st = (e) => {
661
+ }, ct = (e) => {
662
662
  if (e.kind !== "mapping") return null;
663
- let t = ot(e, "version");
663
+ let t = st(e, "version");
664
664
  return t?.kind === "scalar" && t.value === 1n ? 1 : null;
665
- }, ct = (e, t, n, r) => {
665
+ }, lt = (e, t, n, r) => {
666
666
  let i = new Set();
667
667
  for (let a of ["tools", "skills"]) {
668
- let o = ot(e, a);
668
+ let o = st(e, a);
669
669
  if (o?.kind === "mapping") for (let e of o.entries) e.key.kind === "scalar" && typeof e.key.value == "string" && (i.has(e.key.value) && n.diagnostics.add({
670
670
  code: "MOLDEA_ID_DUPLICATE",
671
671
  entity: { agentId: r },
672
672
  path: n.path,
673
- pointer: I(I(t, a), e.key.value),
673
+ pointer: F(F(t, a), e.key.value),
674
674
  range: e.key.range
675
675
  }), i.add(e.key.value));
676
676
  }
677
- }, lt = (e, t, n, r) => {
678
- let i = { agentId: r }, a = R(e, t, new Set([
677
+ }, ut = (e, t, n, r) => {
678
+ let i = { agentId: r }, a = L(e, t, new Set([
679
679
  "affectedBy",
680
680
  "bindings",
681
681
  "context",
@@ -685,8 +685,8 @@ var ee = "", E = (n) => {
685
685
  "tools"
686
686
  ]), n, i);
687
687
  if (a === null) return null;
688
- ct(e, t, n, r);
689
- let o = a.get("bindings"), s = o === void 0 ? null : rt(o.value, I(t, "bindings"), n, r), c = a.get("context"), l = c === void 0 ? null : nt(c.value, I(t, "context"), "context", n, i), u = a.get("decisions"), d = u === void 0 ? null : nt(u.value, I(t, "decisions"), "decision", n, i), f = a.get("tools"), p = f === void 0 ? null : at(f.value, I(t, "tools"), n, r, "tool"), m = a.get("skills"), h = m === void 0 ? null : at(m.value, I(t, "skills"), n, r, "skill"), g = a.get("affectedBy"), _ = g === void 0 ? null : $e(g.value, I(t, "affectedBy"), n, i), v = a.get("mirrors"), y = v === void 0 ? null : nt(v.value, I(t, "mirrors"), "mirror", n, i);
688
+ lt(e, t, n, r);
689
+ let o = a.get("bindings"), s = o === void 0 ? null : it(o.value, F(t, "bindings"), n, r), c = a.get("context"), l = c === void 0 ? null : rt(c.value, F(t, "context"), "context", n, i), u = a.get("decisions"), d = u === void 0 ? null : rt(u.value, F(t, "decisions"), "decision", n, i), f = a.get("tools"), p = f === void 0 ? null : ot(f.value, F(t, "tools"), n, r, "tool"), m = a.get("skills"), h = m === void 0 ? null : ot(m.value, F(t, "skills"), n, r, "skill"), g = a.get("affectedBy"), _ = g === void 0 ? null : et(g.value, F(t, "affectedBy"), n, i), v = a.get("mirrors"), y = v === void 0 ? null : rt(v.value, F(t, "mirrors"), "mirror", n, i);
690
690
  return {
691
691
  ...l === null ? {} : { context: l },
692
692
  ...d === null ? {} : { decisions: d },
@@ -696,18 +696,18 @@ var ee = "", E = (n) => {
696
696
  ..._ === null ? {} : { affectedBy: _ },
697
697
  ...y === null ? {} : { mirrors: y }
698
698
  };
699
- }, ut = (e, t, n) => {
700
- let r = R(e, t, null, n);
699
+ }, dt = (e, t, n) => {
700
+ let r = L(e, t, null, n);
701
701
  if (r === null) return null;
702
702
  let i = [];
703
703
  for (let [e, a] of [...r].sort(([e], [t]) => u(e, t))) {
704
- let r = I(t, e);
705
- Xe(e, a.key.range, r, n, { agentId: e });
706
- let o = lt(a.value, r, n, e);
704
+ let r = F(t, e);
705
+ Ze(e, a.key.range, r, n, { agentId: e });
706
+ let o = ut(a.value, r, n, e);
707
707
  o !== null && i.push([e, o]);
708
708
  }
709
709
  return p(i);
710
- }, dt = (e, t) => {
710
+ }, ft = (e, t) => {
711
711
  let n = (e, n, r, i) => {
712
712
  t.diagnostics.add({
713
713
  code: "MOLDEA_MANIFEST_VALUE_INVALID",
@@ -745,11 +745,11 @@ var ee = "", E = (n) => {
745
745
  ].includes(i.key.value) ? (n(t, i.key.kind === "scalar" && typeof i.key.value == "string" ? i.key.value : "key", i.key.range, "unknown-field"), o = !1) : e.set(i.key.value, i.value);
746
746
  let s = (i) => {
747
747
  let a = e.get(i);
748
- return a?.kind !== "scalar" || typeof a.value != "string" || !k(a.value) ? (n(t, i, a?.range ?? r.range, a === void 0 ? "required" : "non-empty-string-required"), o = !1, null) : a.value;
749
- }, c = s("code"), l = s("subject"), u = s("reason"), d = l === null ? null : A(l), f = e.get("qualifier"), p = null;
750
- f !== void 0 && (f.kind !== "scalar" || f.value !== null) && (p = s("qualifier"), p !== null && !ue(p) && (n(t, "qualifier", f.range, "single-line-required"), o = !1));
748
+ return a?.kind !== "scalar" || typeof a.value != "string" || !O(a.value) ? (n(t, i, a?.range ?? r.range, a === void 0 ? "required" : "non-empty-string-required"), o = !1, null) : a.value;
749
+ }, c = s("code"), l = s("subject"), u = s("reason"), d = l === null ? null : k(l), f = e.get("qualifier"), p = null;
750
+ f !== void 0 && (f.kind !== "scalar" || f.value !== null) && (p = s("qualifier"), p !== null && !de(p) && (n(t, "qualifier", f.range, "single-line-required"), o = !1));
751
751
  let m = _.find((e) => e === c);
752
- if (c !== null && m === void 0 && (n(t, "code", e.get("code").range, "code-not-acceptable"), o = !1), l !== null && d === null && (n(t, "subject", e.get("subject").range, "repository-path-required"), o = !1), u !== null && O(u) > 256 && (n(t, "reason", e.get("reason").range, "maximum-256-characters"), o = !1), !o || m === void 0 || d === null || u === null) continue;
752
+ if (c !== null && m === void 0 && (n(t, "code", e.get("code").range, "code-not-acceptable"), o = !1), l !== null && d === null && (n(t, "subject", e.get("subject").range, "repository-path-required"), o = !1), u !== null && D(u) > 256 && (n(t, "reason", e.get("reason").range, "maximum-256-characters"), o = !1), !o || m === void 0 || d === null || u === null) continue;
753
753
  let h = JSON.stringify([
754
754
  m,
755
755
  d,
@@ -767,7 +767,7 @@ var ee = "", E = (n) => {
767
767
  });
768
768
  }
769
769
  return i;
770
- }, ft = (e, t, n, r, i) => {
770
+ }, pt = (e, t, n, r, i) => {
771
771
  let a = {
772
772
  diagnostics: n,
773
773
  operation: i,
@@ -780,7 +780,7 @@ var ee = "", E = (n) => {
780
780
  path: t,
781
781
  range: e.range
782
782
  }), null;
783
- let o = ot(e, "version");
783
+ let o = st(e, "version");
784
784
  if (o === null) return n.add({
785
785
  code: "MOLDEA_MANIFEST_VERSION_MISSING",
786
786
  path: t,
@@ -798,7 +798,7 @@ var ee = "", E = (n) => {
798
798
  pointer: "/version",
799
799
  range: o.range
800
800
  }), null;
801
- let s = R(e, "", new Set([
801
+ let s = L(e, "", new Set([
802
802
  "acceptedWarnings",
803
803
  "agents",
804
804
  "context",
@@ -806,7 +806,7 @@ var ee = "", E = (n) => {
806
806
  "version"
807
807
  ]), a);
808
808
  if (s === null) return null;
809
- let c = s.get("acceptedWarnings"), l = c === void 0 ? null : dt(c.value, a), u = s.get("context"), d = u === void 0 ? null : tt(u.value, "/context", "context", a), f = s.get("decisions"), p = f === void 0 ? null : tt(f.value, "/decisions", "decision", a), m = s.get("agents"), h = m === void 0 ? null : ut(m.value, "/agents", a);
809
+ let c = s.get("acceptedWarnings"), l = c === void 0 ? null : ft(c.value, a), u = s.get("context"), d = u === void 0 ? null : nt(u.value, "/context", "context", a), f = s.get("decisions"), p = f === void 0 ? null : nt(f.value, "/decisions", "decision", a), m = s.get("agents"), h = m === void 0 ? null : dt(m.value, "/agents", a);
810
810
  return {
811
811
  version: 1,
812
812
  ...l === null ? {} : { acceptedWarnings: l },
@@ -814,14 +814,14 @@ var ee = "", E = (n) => {
814
814
  ...p === null ? {} : { decisions: p },
815
815
  ...h === null ? {} : { agents: h }
816
816
  };
817
- }, pt = (e, t) => {
817
+ }, mt = (e, t) => {
818
818
  let n = 0, r = e.length - 1;
819
819
  for (; n < r;) {
820
820
  let i = Math.ceil((n + r) / 2);
821
821
  (e[i] ?? 0) <= t ? n = i : r = i - 1;
822
822
  }
823
823
  return n;
824
- }, mt = (e) => {
824
+ }, ht = (e) => {
825
825
  let t = new Uint32Array(e.length + 1), n = [0], r = 0;
826
826
  for (let i = 0; i < e.length;) {
827
827
  let a = e.codePointAt(i), o = a !== void 0 && a > 65535 ? 2 : 1;
@@ -830,7 +830,7 @@ var ee = "", E = (n) => {
830
830
  i += o, r += 1, t[i] = r, a === 10 && n.push(i);
831
831
  }
832
832
  let i = (r) => {
833
- let i = Math.max(0, Math.min(e.length, r)), a = pt(n, i), o = n[a] ?? 0, s = t[i] ?? 0;
833
+ let i = Math.max(0, Math.min(e.length, r)), a = mt(n, i), o = n[a] ?? 0, s = t[i] ?? 0;
834
834
  return {
835
835
  column: s - (t[o] ?? 0) + 1,
836
836
  line: a + 1,
@@ -841,10 +841,10 @@ var ee = "", E = (n) => {
841
841
  end: i(t),
842
842
  start: i(e)
843
843
  }) });
844
- }, ht = async (e, t, n = "parse-manifest") => {
844
+ }, gt = async (e, t, n = "parse-manifest") => {
845
845
  t = a(t);
846
- let r = M(e, t.limits, n, "maxManifestBytes"), i = S(e.path), s = d(t.limits, n);
847
- me(i) || s.add({
846
+ let r = j(e, t.limits, n, "maxManifestBytes"), i = S(e.path), s = d(t.limits, n);
847
+ he(i) || s.add({
848
848
  code: "MOLDEA_MANIFEST_PATH_INVALID",
849
849
  path: i
850
850
  });
@@ -857,7 +857,7 @@ var ee = "", E = (n) => {
857
857
  valid: !1,
858
858
  yamlRoot: null
859
859
  });
860
- let l = mt(r.text.value), u = c(r.text.value, i, l, s), f = u.value === null ? null : st(u.value), p = u.valid && u.value !== null ? ft(u.value, i, s, t.limits, n) : null, h = o(s.finalize(), new Map(u.value === null ? [] : [[i, u.value]]));
860
+ let l = ht(r.text.value), u = c(r.text.value, i, l, s), f = u.value === null ? null : ct(u.value), p = u.valid && u.value !== null ? pt(u.value, i, s, t.limits, n) : null, h = o(s.finalize(), new Map(u.value === null ? [] : [[i, u.value]]));
861
861
  if (p === null || s.size > 0) return m({
862
862
  asset: null,
863
863
  diagnostics: h,
@@ -866,7 +866,7 @@ var ee = "", E = (n) => {
866
866
  valid: !1,
867
867
  yamlRoot: u.value
868
868
  });
869
- let g = await N(r.text), _ = {
869
+ let g = await M(r.text), _ = {
870
870
  content: r.text.value,
871
871
  digest: g,
872
872
  path: i,
@@ -881,20 +881,20 @@ var ee = "", E = (n) => {
881
881
  valid: !0,
882
882
  yamlRoot: u.value
883
883
  });
884
- }, gt = async (e, t, n = "parse-manifest") => {
885
- let r = await ht(e, t, n);
884
+ }, _t = async (e, t, n = "parse-manifest") => {
885
+ let r = await gt(e, t, n);
886
886
  return m({
887
887
  asset: r.asset,
888
888
  diagnostics: r.diagnostics,
889
889
  manifest: r.manifest,
890
890
  valid: r.valid
891
891
  });
892
- }, _t = () => {
892
+ }, vt = () => {
893
893
  throw new r({
894
894
  code: "INVALID_ARGUMENT",
895
895
  operation: "match-manifest-scope"
896
896
  });
897
- }, vt = (e, t, n) => {
897
+ }, yt = (e, t, n) => {
898
898
  throw new r({
899
899
  code: "RESOURCE_LIMIT_EXCEEDED",
900
900
  limit: e,
@@ -903,24 +903,24 @@ var ee = "", E = (n) => {
903
903
  observedUsage: n,
904
904
  operation: "match-manifest-scope"
905
905
  });
906
- }, yt = (e, t) => {
907
- if (!i(e, !0)) return _t();
906
+ }, bt = (e, t) => {
907
+ if (!i(e, !0)) return vt();
908
908
  let n = e.manifest, r = e.paths;
909
- if (!i(n, !0) || !Array.isArray(r)) return _t();
910
- if (r.length > t.maxEntries) return vt("maxEntries", t.maxEntries, r.length);
909
+ if (!i(n, !0) || !Array.isArray(r)) return vt();
910
+ if (r.length > t.maxEntries) return yt("maxEntries", t.maxEntries, r.length);
911
911
  let a = new Set(), o = 0;
912
912
  for (let [e, n] of r.entries()) {
913
- if (typeof n != "string") return _t();
913
+ if (typeof n != "string") return vt();
914
914
  let r = S(n);
915
- if (o += l(r) + (e === 0 ? 0 : 1), o > t.maxTotalBytesRead) return vt("maxTotalBytesRead", t.maxTotalBytesRead, o);
915
+ if (o += l(r) + (e === 0 ? 0 : 1), o > t.maxTotalBytesRead) return yt("maxTotalBytesRead", t.maxTotalBytesRead, o);
916
916
  a.add(r);
917
917
  }
918
918
  return {
919
919
  manifest: n,
920
920
  paths: [...a].sort(u)
921
921
  };
922
- }, bt = async (e, t) => {
923
- let n = yt(e, t.limits), r = await qe(n.paths), i = await gt(n.manifest, t, "match-manifest-scope");
922
+ }, xt = async (e, t) => {
923
+ let n = bt(e, t.limits), r = await Je(n.paths), i = await _t(n.manifest, t, "match-manifest-scope");
924
924
  if (!i.valid || i.asset === null || i.manifest === null) return m({
925
925
  counts: {
926
926
  declarations: 0,
@@ -936,7 +936,7 @@ var ee = "", E = (n) => {
936
936
  relevant: !1,
937
937
  valid: !1
938
938
  });
939
- let a = Je(i.manifest, n.paths, t.limits);
939
+ let a = Ye(i.manifest, n.paths, t.limits);
940
940
  return m({
941
941
  counts: a.counts,
942
942
  diagnostics: [],
@@ -946,27 +946,27 @@ var ee = "", E = (n) => {
946
946
  relevant: a.matches.length > 0,
947
947
  valid: !0
948
948
  });
949
- }, xt = Object.defineProperty, St = (e, t) => {
949
+ }, St = Object.defineProperty, Ct = (e, t) => {
950
950
  let n = {};
951
- for (var r in e) xt(n, r, {
951
+ for (var r in e) St(n, r, {
952
952
  get: e[r],
953
953
  enumerable: !0
954
954
  });
955
- return t || xt(n, Symbol.toStringTag, { value: "Module" }), n;
956
- }, Ct = new TextDecoder("utf-8", {
955
+ return t || St(n, Symbol.toStringTag, { value: "Module" }), n;
956
+ }, wt = new TextDecoder("utf-8", {
957
957
  fatal: !0,
958
958
  ignoreBOM: !0
959
- }), z = () => {
959
+ }), R = () => {
960
960
  throw new r({
961
961
  code: "INVALID_ARGUMENT",
962
962
  operation: "read-canonical-content-page"
963
963
  });
964
- }, wt = () => {
964
+ }, Tt = () => {
965
965
  throw new r({
966
966
  code: "CONTENT_INVALID",
967
967
  operation: "read-canonical-content-page"
968
968
  });
969
- }, Tt = (e) => typeof e == "object" && !!e && typeof e.getEntry == "function" && typeof e.readFilePage == "function", Et = async (e, t, n, r, i) => {
969
+ }, Et = (e) => typeof e == "object" && !!e && typeof e.getEntry == "function" && typeof e.readFilePage == "function", Dt = async (e, t, n, r, i) => {
970
970
  let a = [], o = 0, s = n, c = null, l = null;
971
971
  for (; o < r;) {
972
972
  let n = await e.readFilePage(t, {
@@ -989,25 +989,25 @@ var ee = "", E = (n) => {
989
989
  });
990
990
  s = n.nextOffset;
991
991
  }
992
- if (c === null) return z();
992
+ if (c === null) return R();
993
993
  let u = new Uint8Array(o), d = 0;
994
994
  for (let e of a) u.set(e, d), d += e.byteLength;
995
995
  return {
996
996
  bytes: u,
997
997
  lastPage: c
998
998
  };
999
- }, Dt = (e, t) => {
999
+ }, Ot = (e, t) => {
1000
1000
  let n = Math.max(0, t - 3);
1001
1001
  for (let r = t; r >= n; --r) try {
1002
- let t = Ct.decode(e.subarray(0, r));
1002
+ let t = wt.decode(e.subarray(0, r));
1003
1003
  if (r === 0 && e.byteLength > 0) continue;
1004
1004
  return [t, r];
1005
1005
  } catch {}
1006
- return wt();
1007
- }, Ot = async (e, t) => {
1008
- if (typeof e != "object" || !e || Reflect.ownKeys(e).some((e) => e !== "maxBytes" && e !== "offset" && e !== "path" && e !== "repository" && e !== "signal") || !Tt(e.repository) || !Number.isSafeInteger(e.maxBytes) || e.maxBytes < 1 || e.maxBytes > t.limits.maxFileBytes || !Number.isSafeInteger(e.offset) || e.offset < 0) return z();
1006
+ return Tt();
1007
+ }, kt = async (e, t) => {
1008
+ if (typeof e != "object" || !e || Reflect.ownKeys(e).some((e) => e !== "maxBytes" && e !== "offset" && e !== "path" && e !== "repository" && e !== "signal") || !Et(e.repository) || !Number.isSafeInteger(e.maxBytes) || e.maxBytes < 1 || e.maxBytes > t.limits.maxFileBytes || !Number.isSafeInteger(e.offset) || e.offset < 0) return R();
1009
1009
  let n = S(e.path);
1010
- if (!n.startsWith("/moldea/")) return z();
1010
+ if (!n.startsWith("/moldea/")) return R();
1011
1011
  let i = e.signal === void 0 ? void 0 : { signal: e.signal }, a = await e.repository.getEntry(n, i);
1012
1012
  if (a === null) throw new x({
1013
1013
  code: "ENTRY_NOT_FOUND",
@@ -1029,7 +1029,7 @@ var ee = "", E = (n) => {
1029
1029
  observedUsage: a.byteLength,
1030
1030
  operation: "read-canonical-content-page"
1031
1031
  });
1032
- if (e.offset > a.byteLength) return z();
1032
+ if (e.offset > a.byteLength) return R();
1033
1033
  if (e.offset === a.byteLength) return m({
1034
1034
  byteEnd: e.offset,
1035
1035
  byteStart: e.offset,
@@ -1041,9 +1041,9 @@ var ee = "", E = (n) => {
1041
1041
  source: e.repository.snapshot,
1042
1042
  totalBytes: a.byteLength
1043
1043
  });
1044
- let o = Math.min(a.byteLength - e.offset, e.maxBytes + 3), { bytes: s, lastPage: c } = await Et(e.repository, n, e.offset, o, e.signal);
1045
- if (c.totalBytes !== a.byteLength || (s[0] & 192) == 128) return z();
1046
- let [l, u] = Dt(s, Math.min(e.maxBytes, s.byteLength)), d = e.offset + u, f = d === a.byteLength;
1044
+ let o = Math.min(a.byteLength - e.offset, e.maxBytes + 3), { bytes: s, lastPage: c } = await Dt(e.repository, n, e.offset, o, e.signal);
1045
+ if (c.totalBytes !== a.byteLength || (s[0] & 192) == 128) return R();
1046
+ let [l, u] = Ot(s, Math.min(e.maxBytes, s.byteLength)), d = e.offset + u, f = d === a.byteLength;
1047
1047
  return m({
1048
1048
  byteEnd: d,
1049
1049
  byteStart: e.offset,
@@ -1055,37 +1055,37 @@ var ee = "", E = (n) => {
1055
1055
  source: e.repository.snapshot,
1056
1056
  totalBytes: a.byteLength
1057
1057
  });
1058
- }, kt = new Set([
1058
+ }, At = new Set([
1059
1059
  "accepted",
1060
1060
  "proposed",
1061
1061
  "rejected",
1062
1062
  "superseded"
1063
- ]), At = /^\d{13}$/u, jt = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d\.\d{3}Z$/u, B = (e) => e === null ? null : { decisionId: e }, Mt = (e, t, n, r = null) => {
1063
+ ]), jt = /^\d{13}$/u, Mt = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d\.\d{3}Z$/u, z = (e) => e === null ? null : { decisionId: e }, Nt = (e, t, n, r = null) => {
1064
1064
  e.diagnostics.add({
1065
1065
  code: "MOLDEA_DECISION_FRONTMATTER_INVALID",
1066
1066
  details: { reason: n },
1067
- entity: B(e.decisionId),
1067
+ entity: z(e.decisionId),
1068
1068
  path: e.path,
1069
1069
  pointer: r,
1070
1070
  range: t
1071
1071
  });
1072
- }, Nt = (e) => {
1073
- if (!jt.test(e)) return !1;
1072
+ }, Pt = (e) => {
1073
+ if (!Mt.test(e)) return !1;
1074
1074
  let t = Date.parse(e);
1075
1075
  return Number.isFinite(t) && new Date(t).toISOString() === e;
1076
- }, Pt = (e, t) => {
1077
- if (e.kind !== "mapping") return Mt(t, e.range, "mapping-required"), null;
1076
+ }, Ft = (e, t) => {
1077
+ if (e.kind !== "mapping") return Nt(t, e.range, "mapping-required"), null;
1078
1078
  let n = new Map();
1079
1079
  for (let r of e.entries) {
1080
1080
  if (r.key.kind !== "scalar" || typeof r.key.value != "string") {
1081
- Mt(t, r.key.range, "string-key-required");
1081
+ Nt(t, r.key.range, "string-key-required");
1082
1082
  continue;
1083
1083
  }
1084
1084
  let e = r.key.value;
1085
1085
  if (e !== "status" && e !== "createdAt" && e !== "supersedes") {
1086
1086
  t.diagnostics.add({
1087
1087
  code: "MOLDEA_DECISION_PROPERTY_UNKNOWN",
1088
- entity: B(t.decisionId),
1088
+ entity: z(t.decisionId),
1089
1089
  path: t.path,
1090
1090
  pointer: `/${g(e)}`,
1091
1091
  range: r.key.range
@@ -1095,38 +1095,38 @@ var ee = "", E = (n) => {
1095
1095
  n.set(e, r.value);
1096
1096
  }
1097
1097
  return n;
1098
- }, Ft = (e, t) => e?.kind !== "scalar" || typeof e.value != "string" || !kt.has(e.value) ? (t.diagnostics.add({
1098
+ }, It = (e, t) => e?.kind !== "scalar" || typeof e.value != "string" || !At.has(e.value) ? (t.diagnostics.add({
1099
1099
  code: "MOLDEA_DECISION_STATUS_INVALID",
1100
- entity: B(t.decisionId),
1100
+ entity: z(t.decisionId),
1101
1101
  path: t.path,
1102
1102
  pointer: "/status",
1103
1103
  range: e?.range ?? null
1104
- }), null) : e.value, It = (e, t) => e?.kind !== "scalar" || typeof e.value != "string" || !Nt(e.value) ? (t.diagnostics.add({
1104
+ }), null) : e.value, Lt = (e, t) => e?.kind !== "scalar" || typeof e.value != "string" || !Pt(e.value) ? (t.diagnostics.add({
1105
1105
  code: "MOLDEA_DECISION_CREATED_AT_INVALID",
1106
- entity: B(t.decisionId),
1106
+ entity: z(t.decisionId),
1107
1107
  path: t.path,
1108
1108
  pointer: "/createdAt",
1109
1109
  range: e?.range ?? null
1110
1110
  }), null) : (t.decisionId !== null && Date.parse(e.value) !== Number(t.decisionId) && t.diagnostics.add({
1111
1111
  code: "MOLDEA_DECISION_TIMESTAMP_MISMATCH",
1112
- entity: B(t.decisionId),
1112
+ entity: z(t.decisionId),
1113
1113
  path: t.path,
1114
1114
  pointer: "/createdAt",
1115
1115
  range: e.range
1116
- }), e.value), Lt = (e, t) => {
1116
+ }), e.value), Rt = (e, t) => {
1117
1117
  if (e === void 0) return [];
1118
- if (e.kind !== "sequence" || e.items.length === 0) return Mt(t, e.range, "non-empty-supersedes-sequence-required", "/supersedes"), null;
1118
+ if (e.kind !== "sequence" || e.items.length === 0) return Nt(t, e.range, "non-empty-supersedes-sequence-required", "/supersedes"), null;
1119
1119
  let n = [], r = new Set();
1120
1120
  return e.items.forEach((e, i) => {
1121
1121
  let a = `/supersedes/${i}`;
1122
- if (e.kind !== "scalar" || typeof e.value != "string" || !At.test(e.value)) {
1123
- Mt(t, e.range, "decision-id-string-required", a);
1122
+ if (e.kind !== "scalar" || typeof e.value != "string" || !jt.test(e.value)) {
1123
+ Nt(t, e.range, "decision-id-string-required", a);
1124
1124
  return;
1125
1125
  }
1126
1126
  if (r.has(e.value)) {
1127
1127
  t.diagnostics.add({
1128
1128
  code: "MOLDEA_ID_DUPLICATE",
1129
- entity: B(t.decisionId),
1129
+ entity: z(t.decisionId),
1130
1130
  path: t.path,
1131
1131
  pointer: a,
1132
1132
  range: e.range
@@ -1135,17 +1135,17 @@ var ee = "", E = (n) => {
1135
1135
  }
1136
1136
  r.add(e.value), n.push(e.value), e.value === t.decisionId && t.diagnostics.add({
1137
1137
  code: "MOLDEA_DECISION_SELF_SUPERSESSION",
1138
- entity: B(t.decisionId),
1138
+ entity: z(t.decisionId),
1139
1139
  path: t.path,
1140
1140
  pointer: a,
1141
1141
  range: e.range
1142
1142
  });
1143
1143
  }), n.sort(u);
1144
- }, Rt = (e, t, n) => {
1144
+ }, zt = (e, t, n) => {
1145
1145
  let r = e.indexOf("\n"), i = r === -1 ? e.length : r;
1146
1146
  if (e.slice(0, i) !== "---") return n.diagnostics.add({
1147
1147
  code: "MOLDEA_DECISION_FRONTMATTER_MISSING",
1148
- entity: B(n.decisionId),
1148
+ entity: z(n.decisionId),
1149
1149
  path: n.path,
1150
1150
  range: t.locateRange(0, i)
1151
1151
  }), null;
@@ -1165,27 +1165,27 @@ var ee = "", E = (n) => {
1165
1165
  }
1166
1166
  return n.diagnostics.add({
1167
1167
  code: "MOLDEA_DECISION_FRONTMATTER_MISSING",
1168
- entity: B(n.decisionId),
1168
+ entity: z(n.decisionId),
1169
1169
  path: n.path,
1170
1170
  range: t.locateRange(e.length, e.length)
1171
1171
  }), null;
1172
- }, zt = (e, t) => {
1173
- let n = t.diagnostics.size, r = Pt(e, t);
1172
+ }, Bt = (e, t) => {
1173
+ let n = t.diagnostics.size, r = Ft(e, t);
1174
1174
  if (r === null) return null;
1175
- let i = Ft(r.get("status"), t), a = It(r.get("createdAt"), t), o = Lt(r.get("supersedes"), t);
1175
+ let i = It(r.get("status"), t), a = Lt(r.get("createdAt"), t), o = Rt(r.get("supersedes"), t);
1176
1176
  return i === null || a === null || o === null || t.diagnostics.size > n ? null : {
1177
1177
  createdAt: a,
1178
1178
  status: i,
1179
1179
  supersedes: o
1180
1180
  };
1181
- }, Bt = (e, t, n) => k(e) ? !0 : (n.diagnostics.add({
1181
+ }, Vt = (e, t, n) => O(e) ? !0 : (n.diagnostics.add({
1182
1182
  code: "MOLDEA_DECISION_BODY_EMPTY",
1183
- entity: B(n.decisionId),
1183
+ entity: z(n.decisionId),
1184
1184
  path: n.path,
1185
1185
  range: t
1186
- }), !1), Vt = async (e, t, n = "parse-decision") => {
1186
+ }), !1), Ht = async (e, t, n = "parse-decision") => {
1187
1187
  t = a(t);
1188
- let r = M(e, t.limits, n), i = S(e.path), s = d(t.limits, n), l = j(i);
1188
+ let r = j(e, t.limits, n), i = S(e.path), s = d(t.limits, n), l = A(i);
1189
1189
  l === null && s.add({
1190
1190
  code: "MOLDEA_DECISION_FILENAME_INVALID",
1191
1191
  path: i
@@ -1201,11 +1201,11 @@ var ee = "", E = (n) => {
1201
1201
  decisionId: l,
1202
1202
  diagnostics: s,
1203
1203
  path: i
1204
- }, f = mt(r.text.value), p = Rt(r.text.value, f, u), h = null, g = null;
1204
+ }, f = ht(r.text.value), p = zt(r.text.value, f, u), h = null, g = null;
1205
1205
  if (p !== null) {
1206
- Bt(p.body, p.bodyRange, u);
1206
+ Vt(p.body, p.bodyRange, u);
1207
1207
  let e = c(p.yaml, i, f, s);
1208
- g = e.value, e.valid && e.value !== null && (h = zt(e.value, u));
1208
+ g = e.value, e.valid && e.value !== null && (h = Bt(e.value, u));
1209
1209
  }
1210
1210
  let _ = o(s.finalize(), new Map(g === null ? [] : [[i, g]]));
1211
1211
  if (l === null || p === null || h === null || s.size > 0) return m({
@@ -1214,7 +1214,7 @@ var ee = "", E = (n) => {
1214
1214
  valid: !1,
1215
1215
  yamlRoot: g
1216
1216
  });
1217
- let v = await N(r.text), y = {
1217
+ let v = await M(r.text), y = {
1218
1218
  content: r.text.value,
1219
1219
  digest: v,
1220
1220
  path: i,
@@ -1235,16 +1235,16 @@ var ee = "", E = (n) => {
1235
1235
  valid: !0,
1236
1236
  yamlRoot: g
1237
1237
  });
1238
- }, Ht = async (e, t, n = "parse-decision") => {
1239
- let r = await Vt(e, t, n);
1238
+ }, Ut = async (e, t, n = "parse-decision") => {
1239
+ let r = await Ht(e, t, n);
1240
1240
  return m({
1241
1241
  decision: r.decision,
1242
1242
  diagnostics: r.diagnostics,
1243
1243
  valid: r.valid
1244
1244
  });
1245
- }, Ut = function* (e) {
1245
+ }, Wt = function* (e) {
1246
1246
  for (let t of e.agents) yield { agentId: t.id };
1247
- }, V = (e, t, n = null, r = null) => ({
1247
+ }, B = (e, t, n = null, r = null) => ({
1248
1248
  agentId: n,
1249
1249
  byteLength: e.utf8ByteLength,
1250
1250
  canonicalDigest: null,
@@ -1253,12 +1253,12 @@ var ee = "", E = (n) => {
1253
1253
  kind: t,
1254
1254
  path: e.path,
1255
1255
  scalarLength: e.scalarLength
1256
- }), Wt = function* (e) {
1257
- yield V(e.manifest.asset, "manifest"), yield V(e.project, "project");
1258
- for (let t of e.context) yield V(t.asset, "context");
1259
- for (let { decision: t } of e.decisions) yield V(t.asset, "decision", null, t.id);
1256
+ }), Gt = function* (e) {
1257
+ yield B(e.manifest.asset, "manifest"), yield B(e.project, "project");
1258
+ for (let t of e.context) yield B(t.asset, "context");
1259
+ for (let { decision: t } of e.decisions) yield B(t.asset, "decision", null, t.id);
1260
1260
  for (let t of e.agents) {
1261
- yield V(t.description.asset, "agent-description", t.id), yield V(t.instruction, "agent-instruction", t.id);
1261
+ yield B(t.description.asset, "agent-description", t.id), yield B(t.instruction, "agent-instruction", t.id);
1262
1262
  for (let e of t.mirrors) yield {
1263
1263
  agentId: t.id,
1264
1264
  byteLength: e.byteLength,
@@ -1270,7 +1270,7 @@ var ee = "", E = (n) => {
1270
1270
  scalarLength: e.scalarLength
1271
1271
  };
1272
1272
  }
1273
- }, Gt = (e) => ({
1273
+ }, Kt = (e) => ({
1274
1274
  counts: {
1275
1275
  agents: e.agents.length,
1276
1276
  context: e.context.length,
@@ -1281,48 +1281,48 @@ var ee = "", E = (n) => {
1281
1281
  manifestPath: e.manifest.asset.path,
1282
1282
  projectDigest: e.project.digest,
1283
1283
  projectPath: e.project.path
1284
- }), Kt = (e) => ({
1284
+ }), qt = (e) => ({
1285
1285
  bindings: e.length,
1286
1286
  exportsPassed: e.filter((e) => e.exportCheck === "passed").length,
1287
1287
  exportsFailed: e.filter((e) => e.exportCheck === "failed").length,
1288
1288
  exportsNotChecked: e.filter((e) => e.exportCheck === "not-checked").length
1289
- }), qt = new WeakMap(), Jt = (e, t) => {
1290
- if (qt.has(e)) throw TypeError("The inspection reader is already registered.");
1291
- qt.set(e, t);
1292
- }, Yt = (e) => {
1293
- let t = qt.get(e);
1289
+ }), Jt = new WeakMap(), Yt = (e, t) => {
1290
+ if (Jt.has(e)) throw TypeError("The inspection reader is already registered.");
1291
+ Jt.set(e, t);
1292
+ }, Xt = (e) => {
1293
+ let t = Jt.get(e);
1294
1294
  if (t === void 0) throw TypeError("The inspection reader has no retained-memory ledger.");
1295
1295
  return t;
1296
- }, Xt = (e, t) => {
1297
- qt.get(e)?.reserve(t);
1298
- }, Zt = S("/moldea/moldea.yaml"), Qt = new Set([
1296
+ }, Zt = (e, t) => {
1297
+ Jt.get(e)?.reserve(t);
1298
+ }, Qt = S("/moldea/moldea.yaml"), $t = new Set([
1299
1299
  "/AGENTS.md",
1300
1300
  "/CLAUDE.md",
1301
1301
  "/.claude/CLAUDE.md",
1302
1302
  "/CLAUDE.local.md"
1303
- ].map((e) => S(e))), $t = 256, en = 65536, tn = 4, nn = 64, rn = 2, an = new TextEncoder(), H = (e, t) => {
1303
+ ].map((e) => S(e))), en = 256, tn = 65536, nn = 4, rn = 64, an = 2, on = new TextEncoder(), V = (e, t) => {
1304
1304
  throw new x({
1305
1305
  code: "INVALID_SOURCE_DATA",
1306
1306
  operation: e,
1307
1307
  path: t,
1308
1308
  retryable: !1
1309
1309
  });
1310
- }, on = (e, t, n, r) => {
1311
- if (typeof e != "object" || !e) return H(t, n);
1310
+ }, sn = (e, t, n, r) => {
1311
+ if (typeof e != "object" || !e) return V(t, n);
1312
1312
  let i = e, a = i.path, o = i.type, s = i.byteLength, c = i.contentIdentity;
1313
- if (typeof a != "string" || !b(a)) return H(t, n);
1313
+ if (typeof a != "string" || !b(a)) return V(t, n);
1314
1314
  let l = S(a);
1315
- return r !== void 0 && l !== r || o !== "file" && o !== "directory" && o !== "symlink" || (o === "file" ? !Number.isSafeInteger(s) || s < 0 || c !== null && typeof c != "string" : s !== null || c !== null) ? H(t, l) : {
1315
+ return r !== void 0 && l !== r || o !== "file" && o !== "directory" && o !== "symlink" || (o === "file" ? !Number.isSafeInteger(s) || s < 0 || c !== null && typeof c != "string" : s !== null || c !== null) ? V(t, l) : {
1316
1316
  byteLength: s,
1317
1317
  contentIdentity: c,
1318
1318
  path: l,
1319
1319
  type: o
1320
1320
  };
1321
- }, sn = (e, t) => {
1321
+ }, cn = (e, t) => {
1322
1322
  if (e === t) return !1;
1323
1323
  let n = t === C ? C : `${t}/`;
1324
1324
  return e.startsWith(n);
1325
- }, U = (e, t, n) => {
1325
+ }, H = (e, t, n) => {
1326
1326
  throw new r({
1327
1327
  code: "RESOURCE_LIMIT_EXCEEDED",
1328
1328
  limit: e,
@@ -1331,24 +1331,24 @@ var ee = "", E = (n) => {
1331
1331
  observedUsage: n,
1332
1332
  operation: "validate-project"
1333
1333
  });
1334
- }, W = (e, t) => {
1334
+ }, U = (e, t) => {
1335
1335
  let n = e === void 0 ? t : t === void 0 || t === e ? e : AbortSignal.any([e, t]);
1336
1336
  return n === void 0 ? void 0 : { signal: n };
1337
- }, cn = (e, t, n, i) => {
1337
+ }, ln = (e, t, n, i) => {
1338
1338
  let a = new Set(), o = 0, s = 0, c = 0, l = 0, u = (e) => new r({
1339
1339
  cause: e.reason,
1340
1340
  code: "ABORTED",
1341
1341
  operation: "validate-project"
1342
1342
  }), d = (e) => {
1343
- if (!Number.isSafeInteger(e) || e < 0 || e > t.maxRetainedBytes - c) return U("maxRetainedBytes", t.maxRetainedBytes, c + e);
1343
+ if (!Number.isSafeInteger(e) || e < 0 || e > t.maxRetainedBytes - c) return H("maxRetainedBytes", t.maxRetainedBytes, c + e);
1344
1344
  c += e, s = Math.max(s, c);
1345
1345
  }, f = (e) => {
1346
- if (!Number.isSafeInteger(e) || e < 0 || e > t.maxRetainedBytes - c) return U("maxRetainedBytes", t.maxRetainedBytes, c + e);
1346
+ if (!Number.isSafeInteger(e) || e < 0 || e > t.maxRetainedBytes - c) return H("maxRetainedBytes", t.maxRetainedBytes, c + e);
1347
1347
  s = Math.max(s, c + e);
1348
1348
  }, p = (e) => {
1349
1349
  if (!(e === C || a.has(e))) {
1350
- if (a.size >= t.maxEntries) return U("maxEntries", t.maxEntries, a.size + 1);
1351
- d(nn + an.encode(e).byteLength * rn), a.add(e);
1350
+ if (a.size >= t.maxEntries) return H("maxEntries", t.maxEntries, a.size + 1);
1351
+ d(rn + on.encode(e).byteLength * an), a.add(e);
1352
1352
  }
1353
1353
  }, m = (e) => {
1354
1354
  let t = n?.aborted ? n : e?.aborted ? e : null;
@@ -1356,7 +1356,7 @@ var ee = "", E = (n) => {
1356
1356
  };
1357
1357
  m();
1358
1358
  let h = (e) => {
1359
- if (e > t.maxTotalBytesRead - l) return U("maxTotalBytesRead", t.maxTotalBytesRead, l + e);
1359
+ if (e > t.maxTotalBytesRead - l) return H("maxTotalBytesRead", t.maxTotalBytesRead, l + e);
1360
1360
  l += e;
1361
1361
  }, g = {
1362
1362
  readPage: (t, n) => e.readFilePage(t, n),
@@ -1364,8 +1364,8 @@ var ee = "", E = (n) => {
1364
1364
  }, _ = async (e, t, r) => {
1365
1365
  let i = S(t);
1366
1366
  m(r?.signal), p(i);
1367
- let a = await e.getEntry(i, W(n, r?.signal));
1368
- return m(r?.signal), a === null ? null : on(a, "get-entry", i, i);
1367
+ let a = await e.getEntry(i, U(n, r?.signal));
1368
+ return m(r?.signal), a === null ? null : sn(a, "get-entry", i, i);
1369
1369
  }, v = (t, n) => _(e, t, n), b = (r) => {
1370
1370
  let i = r?.prefix === void 0 ? C : S(r.prefix);
1371
1371
  return { async *[Symbol.asyncIterator]() {
@@ -1375,59 +1375,59 @@ var ee = "", E = (n) => {
1375
1375
  m(r?.signal);
1376
1376
  let c = await e.listEntriesPage({
1377
1377
  ...o === void 0 ? {} : { cursor: o },
1378
- maxEntries: Math.min($t, t.maxEntries),
1378
+ maxEntries: Math.min(en, t.maxEntries),
1379
1379
  prefix: i,
1380
- ...W(n, r?.signal) ?? {}
1380
+ ...U(n, r?.signal) ?? {}
1381
1381
  });
1382
- if (c.snapshot.id !== e.snapshot.id || c.entries.length === 0 && !c.isComplete) return H("list-entries-page", i);
1382
+ if (c.snapshot.id !== e.snapshot.id || c.entries.length === 0 && !c.isComplete) return V("list-entries-page", i);
1383
1383
  for (let e of c.entries) {
1384
1384
  m(r?.signal);
1385
- let t = on(e, "list-entries-page", i);
1386
- if (!sn(t.path, i) || a.has(t.path) || s !== null && y(s, t.path) >= 0) return H("list-entries-page", t.path);
1385
+ let t = sn(e, "list-entries-page", i);
1386
+ if (!cn(t.path, i) || a.has(t.path) || s !== null && y(s, t.path) >= 0) return V("list-entries-page", t.path);
1387
1387
  a.add(t.path), s = t.path, p(t.path), yield t;
1388
1388
  }
1389
- if (c.isComplete) return c.nextCursor === null ? void 0 : H("list-entries-page", i);
1390
- if (c.nextCursor === null || c.nextCursor === o) return H("list-entries-page", i);
1389
+ if (c.isComplete) return c.nextCursor === null ? void 0 : V("list-entries-page", i);
1390
+ if (c.nextCursor === null || c.nextCursor === o) return V("list-entries-page", i);
1391
1391
  o = c.nextCursor;
1392
1392
  } while (!0);
1393
1393
  } };
1394
1394
  }, w = async (e, r, i = !1, a = g) => {
1395
- let s = i ? 1 : tn, l = e === Zt ? "maxManifestBytes" : "maxFileBytes", u = t.maxRetainedBytes - c;
1396
- if (u < 1) return U("maxRetainedBytes", t.maxRetainedBytes, c + 1);
1397
- let p = Math.min(en, Math.max(1, t[l]), u);
1395
+ let s = i ? 1 : nn, l = e === Qt ? "maxManifestBytes" : "maxFileBytes", u = t.maxRetainedBytes - c;
1396
+ if (u < 1) return H("maxRetainedBytes", t.maxRetainedBytes, c + 1);
1397
+ let p = Math.min(tn, Math.max(1, t[l]), u);
1398
1398
  f(p);
1399
1399
  let _ = await a.readPage(e, {
1400
1400
  maxBytes: p,
1401
1401
  offset: 0,
1402
- ...W(n, r) ?? {}
1402
+ ...U(n, r) ?? {}
1403
1403
  });
1404
- if (m(r), _.snapshot.id !== a.snapshotId || _.offset !== 0 || !(_.bytes instanceof Uint8Array) || !Number.isSafeInteger(_.totalBytes) || _.totalBytes < 0 || _.bytes.byteLength > en || _.bytes.byteLength > _.totalBytes || _.bytes.byteLength === 0 && !_.isComplete) return H("read-file-page", e);
1405
- if (_.totalBytes > t[l]) return U(l, t[l], _.totalBytes);
1404
+ if (m(r), _.snapshot.id !== a.snapshotId || _.offset !== 0 || !(_.bytes instanceof Uint8Array) || !Number.isSafeInteger(_.totalBytes) || _.totalBytes < 0 || _.bytes.byteLength > tn || _.bytes.byteLength > _.totalBytes || _.bytes.byteLength === 0 && !_.isComplete) return V("read-file-page", e);
1405
+ if (_.totalBytes > t[l]) return H(l, t[l], _.totalBytes);
1406
1406
  let v = _.bytes.byteLength, y = t.maxRetainedBytes - c - v;
1407
1407
  if (y < 0 || _.totalBytes > Math.floor(y / s)) {
1408
1408
  let e = c + v + _.totalBytes * s;
1409
- return U("maxRetainedBytes", t.maxRetainedBytes, Number.isSafeInteger(e) ? e : 2 ** 53 - 1);
1409
+ return H("maxRetainedBytes", t.maxRetainedBytes, Number.isSafeInteger(e) ? e : 2 ** 53 - 1);
1410
1410
  }
1411
1411
  h(_.totalBytes);
1412
1412
  let b = _.totalBytes * s;
1413
1413
  f(b + v), d(b), i || (o += _.totalBytes);
1414
1414
  let x = new Uint8Array(_.totalBytes), S = 0, C = _, w = !0;
1415
1415
  for (; w || S < x.byteLength;) {
1416
- if (w = !1, C.snapshot.id !== a.snapshotId || C.offset !== S || C.totalBytes !== x.byteLength || !(C.bytes instanceof Uint8Array) || C.bytes.byteLength > en || C.bytes.byteLength > x.byteLength - S || C.bytes.byteLength === 0 && !C.isComplete) return H("read-file-page", e);
1416
+ if (w = !1, C.snapshot.id !== a.snapshotId || C.offset !== S || C.totalBytes !== x.byteLength || !(C.bytes instanceof Uint8Array) || C.bytes.byteLength > tn || C.bytes.byteLength > x.byteLength - S || C.bytes.byteLength === 0 && !C.isComplete) return V("read-file-page", e);
1417
1417
  if (x.set(C.bytes, S), S += C.bytes.byteLength, C.isComplete) {
1418
- if (C.nextOffset !== null || S !== x.byteLength) return H("read-file-page", e);
1418
+ if (C.nextOffset !== null || S !== x.byteLength) return V("read-file-page", e);
1419
1419
  break;
1420
1420
  }
1421
- if (C.nextOffset !== S) return H("read-file-page", e);
1421
+ if (C.nextOffset !== S) return V("read-file-page", e);
1422
1422
  C = await a.readPage(e, {
1423
- maxBytes: Math.min(en, Math.max(1, x.byteLength - S)),
1423
+ maxBytes: Math.min(tn, Math.max(1, x.byteLength - S)),
1424
1424
  offset: S,
1425
- ...W(n, r) ?? {}
1425
+ ...U(n, r) ?? {}
1426
1426
  }), m(r);
1427
1427
  }
1428
1428
  return x;
1429
- }, T = async (e, t) => {
1430
- let r = W(n, t)?.signal;
1429
+ }, te = async (e, t) => {
1430
+ let r = U(n, t)?.signal;
1431
1431
  return r === void 0 ? e : new Promise((t, n) => {
1432
1432
  let i = () => r.removeEventListener("abort", a), a = () => {
1433
1433
  i(), n(u(r));
@@ -1444,14 +1444,14 @@ var ee = "", E = (n) => {
1444
1444
  }));
1445
1445
  });
1446
1446
  });
1447
- }, ee = async (e, t) => {
1447
+ }, T = async (e, t) => {
1448
1448
  let n = S(e);
1449
1449
  m(t?.signal), p(n);
1450
- let r = await T(w(n, t?.signal), t?.signal);
1450
+ let r = await te(w(n, t?.signal), t?.signal);
1451
1451
  return m(t?.signal), r.slice();
1452
- }, E = async (e, t) => {
1452
+ }, ne = async (e, t) => {
1453
1453
  m(), p(e);
1454
- let n = await T(w(e, void 0, !0, t));
1454
+ let n = await te(w(e, void 0, !0, t));
1455
1455
  m();
1456
1456
  let r = !1;
1457
1457
  return {
@@ -1460,40 +1460,46 @@ var ee = "", E = (n) => {
1460
1460
  r || (c -= n.byteLength), r = !0;
1461
1461
  }
1462
1462
  };
1463
- }, te = (t) => i !== void 0 && Qt.has(t) ? i : e, ne = (t) => {
1464
- let n = te(t);
1463
+ }, re = (t) => i !== void 0 && $t.has(t) ? i : e, ie = (t) => {
1464
+ let n = re(t);
1465
1465
  return n === e ? g : {
1466
1466
  readPage: (e, t) => n.readFilePage(e, t),
1467
1467
  snapshotId: n.snapshot.id
1468
1468
  };
1469
- }, re = Object.freeze({
1470
- getEntry: (e, t) => {
1471
- let n = S(e);
1472
- return _(te(n), n, t);
1469
+ }, ae = async (e, t, r) => {
1470
+ let i = S(t);
1471
+ m(r?.signal), p(i);
1472
+ let a = await te(e.readLinkText(i, U(n, r?.signal)), r?.signal);
1473
+ return m(r?.signal), a !== null && (typeof a != "string" || on.encode(a).byteLength > 4096) ? V("read-link-text", i) : a;
1474
+ }, oe = Object.freeze({
1475
+ getEntry: (e) => {
1476
+ let t = S(e);
1477
+ return _(re(t), t);
1473
1478
  },
1474
- readLinkText: async (e, t) => {
1475
- let r = S(e);
1476
- m(t?.signal), p(r);
1477
- let i = await T(te(r).readLinkText(r, W(n, t?.signal)), t?.signal);
1478
- return m(t?.signal), i !== null && (typeof i != "string" || an.encode(i).byteLength > 4096) ? H("read-link-text", r) : i;
1479
+ resolveLink: (t) => {
1480
+ let n = S(t), r = re(n), i = (t) => t === n ? r : e;
1481
+ return ee({
1482
+ getEntry: (e, t) => _(i(e), e, t),
1483
+ readLinkText: (e, t) => ae(i(e), e, t)
1484
+ }, n);
1479
1485
  },
1480
1486
  readSourceFile: (e) => {
1481
1487
  let t = S(e);
1482
- return E(t, ne(t));
1488
+ return ne(t, ie(t));
1483
1489
  }
1484
- }), ie = Object.freeze({
1490
+ }), se = Object.freeze({
1485
1491
  getEntry: v,
1486
1492
  iterateEntries: b,
1487
- readCompleteFile: ee
1493
+ readCompleteFile: T
1488
1494
  });
1489
- return Jt(ie, {
1495
+ return Yt(se, {
1490
1496
  reserve: d,
1491
1497
  tryReserve: (e) => !Number.isSafeInteger(e) || e < 0 || e > t.maxRetainedBytes - c ? !1 : (d(e), !0),
1492
1498
  release: (e) => {
1493
1499
  if (!Number.isSafeInteger(e) || e < 0 || e > c) throw TypeError("The retained-memory release is invalid.");
1494
1500
  c -= e;
1495
1501
  },
1496
- readSourceFile: (e) => E(e, g)
1502
+ readSourceFile: (e) => ne(e, g)
1497
1503
  }), Object.freeze({
1498
1504
  getResourceUsage: () => Object.freeze({
1499
1505
  canonicalBytes: o,
@@ -1501,18 +1507,18 @@ var ee = "", E = (n) => {
1501
1507
  retainedBytes: c,
1502
1508
  totalBytesRead: l
1503
1509
  }),
1504
- instructions: re,
1505
- reader: ie,
1510
+ instructions: oe,
1511
+ reader: se,
1506
1512
  throwIfAborted: m
1507
1513
  });
1508
- }, ln = /^#{1,6} /u, un = (e, t) => {
1514
+ }, un = /^#{1,6} /u, dn = (e, t) => {
1509
1515
  for (let n = t; n < e.length; n += 1) {
1510
1516
  let t = e[n];
1511
- if (t !== void 0 && k(t)) return n;
1517
+ if (t !== void 0 && O(t)) return n;
1512
1518
  }
1513
1519
  return null;
1514
- }, dn = (e, t, n) => {
1515
- let r = d(n, "validate-project"), i = le(e.content), a = O(i);
1520
+ }, fn = (e, t, n) => {
1521
+ let r = d(n, "validate-project"), i = ue(e.content), a = D(i);
1516
1522
  a === 0 && r.add({
1517
1523
  code: "MOLDEA_AGENT_DESCRIPTION_INVALID",
1518
1524
  details: { reason: "empty" },
@@ -1534,9 +1540,9 @@ var ee = "", E = (n) => {
1534
1540
  diagnostics: o,
1535
1541
  valid: o.length === 0
1536
1542
  });
1537
- }, fn = (e, t, n) => {
1543
+ }, pn = (e, t, n) => {
1538
1544
  let r = d(n, "validate-project");
1539
- if (!k(e.content)) return r.add({
1545
+ if (!O(e.content)) return r.add({
1540
1546
  code: "MOLDEA_AGENT_INSTRUCTION_EMPTY",
1541
1547
  entity: { agentId: t },
1542
1548
  path: e.path
@@ -1545,8 +1551,8 @@ var ee = "", E = (n) => {
1545
1551
  instruction: null,
1546
1552
  valid: !1
1547
1553
  });
1548
- let i = `\`${t}\``, a = e.content.split("\n"), o = un(a, 0), s = o;
1549
- o !== null && ln.test(a[o] ?? "") && (s = un(a, o + 1)), (s === null || !(a[s] ?? "").includes(i)) && r.add({
1554
+ let i = `\`${t}\``, a = e.content.split("\n"), o = dn(a, 0), s = o;
1555
+ o !== null && un.test(a[o] ?? "") && (s = dn(a, o + 1)), (s === null || !(a[s] ?? "").includes(i)) && r.add({
1550
1556
  code: "MOLDEA_AGENT_IDENTITY_INVALID",
1551
1557
  details: { reason: e.content.includes(i) ? "misplaced" : "missing" },
1552
1558
  entity: { agentId: t },
@@ -1558,17 +1564,17 @@ var ee = "", E = (n) => {
1558
1564
  instruction: e,
1559
1565
  valid: c.length === 0
1560
1566
  });
1561
- }, pn = (e) => {
1567
+ }, mn = (e) => {
1562
1568
  throw new x({
1563
1569
  code: "INVALID_SOURCE_DATA",
1564
1570
  operation: "read-file-page",
1565
1571
  path: e,
1566
1572
  retryable: !1
1567
1573
  });
1568
- }, G = async (e, t, n, r) => {
1574
+ }, W = async (e, t, n, r) => {
1569
1575
  let i = await e.readCompleteFile(t, r === void 0 ? void 0 : { signal: r });
1570
- if (!(i instanceof Uint8Array)) return pn(t);
1571
- let a = M({
1576
+ if (!(i instanceof Uint8Array)) return mn(t);
1577
+ let a = j({
1572
1578
  content: i,
1573
1579
  path: t
1574
1580
  }, n, "validate-project");
@@ -1579,7 +1585,7 @@ var ee = "", E = (n) => {
1579
1585
  });
1580
1586
  let o = {
1581
1587
  content: a.text.value,
1582
- digest: await N(a.text),
1588
+ digest: await M(a.text),
1583
1589
  path: t,
1584
1590
  scalarLength: a.text.scalarLength,
1585
1591
  utf8ByteLength: a.text.utf8ByteLength
@@ -1589,9 +1595,9 @@ var ee = "", E = (n) => {
1589
1595
  diagnostics: [],
1590
1596
  valid: !0
1591
1597
  });
1592
- }, mn = (e, t) => {
1593
- for (let n of t) e.merge(n);
1594
1598
  }, hn = (e, t) => {
1599
+ for (let n of t) e.merge(n);
1600
+ }, gn = (e, t) => {
1595
1601
  let n = e;
1596
1602
  for (; n.length > 0;) {
1597
1603
  if (t.has(n)) return !0;
@@ -1600,17 +1606,17 @@ var ee = "", E = (n) => {
1600
1606
  n = n.slice(0, e);
1601
1607
  }
1602
1608
  return !1;
1603
- }, gn = async (e, t, n, r, i, a) => {
1604
- let o = await G(e, t, r.limits, a);
1605
- if (mn(i, o.diagnostics), o.asset === null) return null;
1606
- let s = dn(o.asset, n, r.limits);
1607
- return mn(i, s.diagnostics), s.description;
1608
1609
  }, _n = async (e, t, n, r, i, a) => {
1609
- let o = await G(e, t, r.limits, a);
1610
- if (mn(i, o.diagnostics), o.asset === null) return null;
1610
+ let o = await W(e, t, r.limits, a);
1611
+ if (hn(i, o.diagnostics), o.asset === null) return null;
1611
1612
  let s = fn(o.asset, n, r.limits);
1612
- return mn(i, s.diagnostics), s.instruction;
1613
- }, vn = async (e, t, n, r, i) => {
1613
+ return hn(i, s.diagnostics), s.description;
1614
+ }, vn = async (e, t, n, r, i, a) => {
1615
+ let o = await W(e, t, r.limits, a);
1616
+ if (hn(i, o.diagnostics), o.asset === null) return null;
1617
+ let s = pn(o.asset, n, r.limits);
1618
+ return hn(i, s.diagnostics), s.instruction;
1619
+ }, yn = async (e, t, n, r, i) => {
1614
1620
  r = a(r);
1615
1621
  let o = d(r.limits, "validate-project"), s = [], c = t.agents ?? {}, l = new Set(Object.keys(c)), f = new Map(n.inventory.agents.map((e) => [e.id, e])), p = new Set(n.diagnostics.flatMap((e) => e.path === null ? [] : [e.path]));
1616
1622
  for (let e of n.inventory.agents) l.has(e.id) || o.add({
@@ -1624,7 +1630,7 @@ var ee = "", E = (n) => {
1624
1630
  let a = f.get(t);
1625
1631
  if (a === void 0) {
1626
1632
  let e = S(`/moldea/agents/${t}`);
1627
- hn(e, p) || o.add({
1633
+ gn(e, p) || o.add({
1628
1634
  code: "MOLDEA_AGENT_DIRECTORY_MISSING",
1629
1635
  entity: { agentId: t },
1630
1636
  path: e
@@ -1639,20 +1645,20 @@ var ee = "", E = (n) => {
1639
1645
  let l = null, u = null;
1640
1646
  if (a.description === null) {
1641
1647
  let e = S(`${a.path}/description.md`);
1642
- hn(e, p) || o.add({
1648
+ gn(e, p) || o.add({
1643
1649
  code: "MOLDEA_AGENT_DESCRIPTION_MISSING",
1644
1650
  entity: { agentId: t },
1645
1651
  path: e
1646
1652
  });
1647
- } else l = await gn(e, a.description, t, r, o, i);
1653
+ } else l = await _n(e, a.description, t, r, o, i);
1648
1654
  if (a.instruction === null) {
1649
1655
  let e = S(`${a.path}/instruction.md`);
1650
- hn(e, p) || o.add({
1656
+ gn(e, p) || o.add({
1651
1657
  code: "MOLDEA_AGENT_INSTRUCTION_MISSING",
1652
1658
  entity: { agentId: t },
1653
1659
  path: e
1654
1660
  });
1655
- } else u = await _n(e, a.instruction, t, r, o, i);
1661
+ } else u = await vn(e, a.instruction, t, r, o, i);
1656
1662
  s.push({
1657
1663
  declaration: n,
1658
1664
  description: l,
@@ -1666,7 +1672,7 @@ var ee = "", E = (n) => {
1666
1672
  diagnostics: h,
1667
1673
  valid: h.length === 0
1668
1674
  });
1669
- }, yn = /^\/moldea\/agents\/([^/]+)\/(description|instruction)\.md$/u, bn = /^\/moldea\/agents\/([^/]+)$/u, xn = /^\/moldea\/decisions\/[^/]+\.md$/u, Sn = (e) => {
1675
+ }, bn = /^\/moldea\/agents\/([^/]+)\/(description|instruction)\.md$/u, xn = /^\/moldea\/agents\/([^/]+)$/u, Sn = /^\/moldea\/decisions\/[^/]+\.md$/u, Cn = (e) => {
1670
1676
  if (e === "/moldea/moldea.yaml") return {
1671
1677
  agentId: null,
1672
1678
  fileKind: "manifest",
@@ -1677,17 +1683,17 @@ var ee = "", E = (n) => {
1677
1683
  fileKind: "project",
1678
1684
  kind: "canonical-file"
1679
1685
  };
1680
- if (he(e, !1)) return {
1686
+ if (ge(e, !1)) return {
1681
1687
  agentId: null,
1682
1688
  fileKind: "context",
1683
1689
  kind: "canonical-file"
1684
1690
  };
1685
- if (xn.test(e)) return {
1691
+ if (Sn.test(e)) return {
1686
1692
  agentId: null,
1687
1693
  fileKind: "decision",
1688
1694
  kind: "canonical-file"
1689
1695
  };
1690
- let t = yn.exec(e);
1696
+ let t = bn.exec(e);
1691
1697
  if (t === null) return null;
1692
1698
  let n = t[1], r = t[2];
1693
1699
  return n === void 0 || r === void 0 ? null : {
@@ -1695,51 +1701,51 @@ var ee = "", E = (n) => {
1695
1701
  fileKind: r === "description" ? "agent-description" : "agent-instruction",
1696
1702
  kind: "canonical-file"
1697
1703
  };
1698
- }, Cn = (e) => bn.exec(e)?.[1] ?? null, wn = (e) => e === "/moldea" || e === "/moldea/context" || e === "/moldea/decisions" || e === "/moldea/agents", Tn = (e) => wn(e) || e.startsWith("/moldea/context/"), En = (e) => {
1699
- let t = Sn(e.path);
1704
+ }, wn = (e) => xn.exec(e)?.[1] ?? null, Tn = (e) => e === "/moldea" || e === "/moldea/context" || e === "/moldea/decisions" || e === "/moldea/agents", En = (e) => Tn(e) || e.startsWith("/moldea/context/"), Dn = (e) => {
1705
+ let t = Cn(e.path);
1700
1706
  if (t !== null) return e.type === "file" ? t : e.type === "symlink" ? { kind: "canonical-asset-symlink" } : {
1701
1707
  expectedType: "file",
1702
1708
  kind: "entry-type-invalid"
1703
1709
  };
1704
- let n = Cn(e.path);
1705
- return n === null ? wn(e.path) ? e.type === "directory" ? { kind: "structural-directory" } : {
1710
+ let n = wn(e.path);
1711
+ return n === null ? Tn(e.path) ? e.type === "directory" ? { kind: "structural-directory" } : {
1706
1712
  expectedType: "directory",
1707
1713
  kind: "entry-type-invalid"
1708
- } : e.type === "directory" ? Tn(e.path) ? { kind: "structural-directory" } : { kind: "ignored-directory" } : { kind: "unrecognized" } : e.type === "directory" ? {
1714
+ } : e.type === "directory" ? En(e.path) ? { kind: "structural-directory" } : { kind: "ignored-directory" } : { kind: "unrecognized" } : e.type === "directory" ? {
1709
1715
  agentId: n,
1710
1716
  kind: "agent-directory"
1711
1717
  } : {
1712
1718
  expectedType: "directory",
1713
1719
  kind: "entry-type-invalid"
1714
1720
  };
1715
- }, Dn = S("/moldea"), K = S("/moldea/moldea.yaml"), q = S("/moldea/project.md"), On = () => ({
1721
+ }, On = S("/moldea"), G = S("/moldea/moldea.yaml"), K = S("/moldea/project.md"), kn = () => ({
1716
1722
  agents: new Map(),
1717
1723
  context: new Set(),
1718
1724
  decisions: new Set(),
1719
1725
  manifest: null,
1720
1726
  project: null
1721
- }), J = (e, t) => {
1727
+ }), q = (e, t) => {
1722
1728
  throw new x({
1723
1729
  code: "INVALID_SOURCE_DATA",
1724
1730
  operation: e,
1725
1731
  path: t,
1726
1732
  retryable: !1
1727
1733
  });
1728
- }, kn = (e, t, n) => {
1729
- if (typeof e != "object" || !e) return J(t, n ?? null);
1734
+ }, An = (e, t, n) => {
1735
+ if (typeof e != "object" || !e) return q(t, n ?? null);
1730
1736
  let r = e, i = r.path, a = r.type, o = r.byteLength, s = r.contentIdentity;
1731
- if (typeof i != "string" || !b(i)) return J(t, n ?? null);
1737
+ if (typeof i != "string" || !b(i)) return q(t, n ?? null);
1732
1738
  let c = S(i);
1733
- return n !== void 0 && c !== n || a !== "file" && a !== "directory" && a !== "symlink" || (a === "file" ? !Number.isSafeInteger(o) || o < 0 || s !== null && typeof s != "string" : o !== null || s !== null) ? J(t, c) : {
1739
+ return n !== void 0 && c !== n || a !== "file" && a !== "directory" && a !== "symlink" || (a === "file" ? !Number.isSafeInteger(o) || o < 0 || s !== null && typeof s != "string" : o !== null || s !== null) ? q(t, c) : {
1734
1740
  byteLength: o,
1735
1741
  contentIdentity: s,
1736
1742
  path: c,
1737
1743
  type: a
1738
1744
  };
1739
- }, An = async (e, t, n) => {
1745
+ }, jn = async (e, t, n) => {
1740
1746
  let r = await e.getEntry(t, n === void 0 ? void 0 : { signal: n });
1741
- return r === null ? null : kn(r, "get-entry", t);
1742
- }, jn = (e, t, n) => {
1747
+ return r === null ? null : An(r, "get-entry", t);
1748
+ }, Mn = (e, t, n) => {
1743
1749
  e.add({
1744
1750
  code: "MOLDEA_ENTRY_TYPE_INVALID",
1745
1751
  details: {
@@ -1748,7 +1754,7 @@ var ee = "", E = (n) => {
1748
1754
  },
1749
1755
  path: t.path
1750
1756
  });
1751
- }, Mn = (e, t) => {
1757
+ }, Nn = (e, t) => {
1752
1758
  let n = e.get(t);
1753
1759
  if (n !== void 0) return n;
1754
1760
  let r = {
@@ -1758,7 +1764,7 @@ var ee = "", E = (n) => {
1758
1764
  path: S(`/moldea/agents/${t}`)
1759
1765
  };
1760
1766
  return e.set(t, r), r;
1761
- }, Nn = (e, t, n, r) => {
1767
+ }, Pn = (e, t, n, r) => {
1762
1768
  switch (n) {
1763
1769
  case "manifest":
1764
1770
  e.manifest = t;
@@ -1773,10 +1779,10 @@ var ee = "", E = (n) => {
1773
1779
  e.decisions.add(t);
1774
1780
  return;
1775
1781
  }
1776
- if (r === null) return J("list-entries-page", t);
1777
- let i = Mn(e.agents, r);
1782
+ if (r === null) return q("list-entries-page", t);
1783
+ let i = Nn(e.agents, r);
1778
1784
  n === "agent-description" ? i.description = t : i.instruction = t;
1779
- }, Pn = (e) => {
1785
+ }, Fn = (e) => {
1780
1786
  let t = (e) => [...e].sort(u), n = [...e.agents.values()].sort((e, t) => u(e.id, t.id)).map((e) => m({ ...e }));
1781
1787
  return m({
1782
1788
  agents: n,
@@ -1785,14 +1791,14 @@ var ee = "", E = (n) => {
1785
1791
  manifest: e.manifest,
1786
1792
  project: e.project
1787
1793
  });
1788
- }, Fn = (e, t) => {
1794
+ }, In = (e, t) => {
1789
1795
  let n = t.finalize();
1790
1796
  return m({
1791
1797
  diagnostics: n,
1792
- inventory: Pn(e),
1798
+ inventory: Fn(e),
1793
1799
  valid: n.length === 0
1794
1800
  });
1795
- }, In = (e, t, n, r, i) => {
1801
+ }, Ln = (e, t, n, r, i) => {
1796
1802
  if (e === null) {
1797
1803
  i.add({
1798
1804
  code: n,
@@ -1801,7 +1807,7 @@ var ee = "", E = (n) => {
1801
1807
  return;
1802
1808
  }
1803
1809
  if (e.type === "file") {
1804
- t === K ? r.manifest = t : r.project = t;
1810
+ t === G ? r.manifest = t : r.project = t;
1805
1811
  return;
1806
1812
  }
1807
1813
  if (e.type === "symlink") {
@@ -1811,43 +1817,43 @@ var ee = "", E = (n) => {
1811
1817
  });
1812
1818
  return;
1813
1819
  }
1814
- jn(i, e, "file");
1815
- }, Ln = (e, t) => {
1816
- if (t === null || t.type !== e.type) return J("list-entries-page", e.path);
1817
- }, Rn = async (e, t, n, r) => {
1818
- let i = d(t, "validate-project"), a = On(), o = r === void 0 ? await An(e, Dn, n) : r.moldeaRoot;
1820
+ Mn(i, e, "file");
1821
+ }, Rn = (e, t) => {
1822
+ if (t === null || t.type !== e.type) return q("list-entries-page", e.path);
1823
+ }, zn = async (e, t, n, r) => {
1824
+ let i = d(t, "validate-project"), a = kn(), o = r === void 0 ? await jn(e, On, n) : r.moldeaRoot;
1819
1825
  if (o === null) return i.add({
1820
1826
  code: "MOLDEA_MANIFEST_MISSING",
1821
- path: K
1827
+ path: G
1822
1828
  }), i.add({
1823
1829
  code: "MOLDEA_PROJECT_FILE_MISSING",
1824
- path: q
1825
- }), Fn(a, i);
1826
- if (o.type !== "directory") return jn(i, o, "directory"), Fn(a, i);
1827
- let s = r === void 0 ? await An(e, K, n) : r.manifest, c = r === void 0 ? await An(e, q, n) : r.project;
1828
- In(s, K, "MOLDEA_MANIFEST_MISSING", a, i), In(c, q, "MOLDEA_PROJECT_FILE_MISSING", a, i);
1829
- let l = new Set(), u = !1, f = !1, p = n === void 0 ? { prefix: Dn } : {
1830
- prefix: Dn,
1830
+ path: K
1831
+ }), In(a, i);
1832
+ if (o.type !== "directory") return Mn(i, o, "directory"), In(a, i);
1833
+ let s = r === void 0 ? await jn(e, G, n) : r.manifest, c = r === void 0 ? await jn(e, K, n) : r.project;
1834
+ Ln(s, G, "MOLDEA_MANIFEST_MISSING", a, i), Ln(c, K, "MOLDEA_PROJECT_FILE_MISSING", a, i);
1835
+ let l = new Set(), u = !1, f = !1, p = n === void 0 ? { prefix: On } : {
1836
+ prefix: On,
1831
1837
  signal: n
1832
1838
  };
1833
1839
  for await (let t of e.iterateEntries(p)) {
1834
- let e = kn(t, "list-entries-page");
1835
- if (!e.path.startsWith("/moldea/") || l.has(e.path)) return J("list-entries-page", e.path);
1836
- if (l.add(e.path), e.path === K) {
1837
- Ln(e, s), u = !0;
1840
+ let e = An(t, "list-entries-page");
1841
+ if (!e.path.startsWith("/moldea/") || l.has(e.path)) return q("list-entries-page", e.path);
1842
+ if (l.add(e.path), e.path === G) {
1843
+ Rn(e, s), u = !0;
1838
1844
  continue;
1839
1845
  }
1840
- if (e.path === q) {
1841
- Ln(e, c), f = !0;
1846
+ if (e.path === K) {
1847
+ Rn(e, c), f = !0;
1842
1848
  continue;
1843
1849
  }
1844
- let n = En(e);
1850
+ let n = Dn(e);
1845
1851
  switch (n.kind) {
1846
1852
  case "canonical-file":
1847
- Nn(a, e.path, n.fileKind, n.agentId);
1853
+ Pn(a, e.path, n.fileKind, n.agentId);
1848
1854
  break;
1849
1855
  case "agent-directory":
1850
- Mn(a.agents, n.agentId);
1856
+ Nn(a.agents, n.agentId);
1851
1857
  break;
1852
1858
  case "canonical-asset-symlink":
1853
1859
  i.add({
@@ -1856,7 +1862,7 @@ var ee = "", E = (n) => {
1856
1862
  });
1857
1863
  break;
1858
1864
  case "entry-type-invalid":
1859
- jn(i, e, n.expectedType);
1865
+ Mn(i, e, n.expectedType);
1860
1866
  break;
1861
1867
  case "unrecognized": i.add({
1862
1868
  code: "MOLDEA_CANONICAL_PATH_UNRECOGNIZED",
@@ -1865,10 +1871,10 @@ var ee = "", E = (n) => {
1865
1871
  });
1866
1872
  }
1867
1873
  }
1868
- return s !== null === u ? c !== null === f ? Fn(a, i) : J("list-entries-page", q) : J("list-entries-page", K);
1869
- }, zn = (e) => [...e].sort((e, t) => u(e.path, t.path)), Bn = (e) => {
1874
+ return s !== null === u ? c !== null === f ? In(a, i) : q("list-entries-page", K) : q("list-entries-page", G);
1875
+ }, Bn = (e) => [...e].sort((e, t) => u(e.path, t.path)), Vn = (e) => {
1870
1876
  let t = new Map();
1871
- for (let n of zn(e)) {
1877
+ for (let n of Bn(e)) {
1872
1878
  if (n.id === null) continue;
1873
1879
  let e = t.get(n.id) ?? [];
1874
1880
  e.push(n), t.set(n.id, e);
@@ -1894,14 +1900,14 @@ var ee = "", E = (n) => {
1894
1900
  edges: i,
1895
1901
  nodes: r
1896
1902
  };
1897
- }, Vn = (e, t) => {
1903
+ }, Hn = (e, t) => {
1898
1904
  for (let [n, r] of e.candidateGroups) if (!(r.length < 2)) for (let e of r) t.add({
1899
1905
  code: "MOLDEA_DECISION_ID_DUPLICATE",
1900
1906
  details: { occurrences: r.length },
1901
1907
  entity: { decisionId: n },
1902
1908
  path: e.path
1903
1909
  });
1904
- }, Hn = (e, t) => {
1910
+ }, Un = (e, t) => {
1905
1911
  for (let n of e.nodes.values()) for (let r of n.supersedes) e.candidateGroups.has(r) || t.add({
1906
1912
  code: "MOLDEA_DECISION_REFERENCE_MISSING",
1907
1913
  details: { referencedDecisionId: r },
@@ -1909,7 +1915,7 @@ var ee = "", E = (n) => {
1909
1915
  path: n.path,
1910
1916
  pointer: "/supersedes"
1911
1917
  });
1912
- }, Un = (e, t) => {
1918
+ }, Wn = (e, t) => {
1913
1919
  let n = new Set();
1914
1920
  for (let r of e.nodes.values()) if (r.status === "accepted" || r.status === "superseded") for (let i of e.edges.get(r.id) ?? []) {
1915
1921
  let a = e.nodes.get(i);
@@ -1932,13 +1938,13 @@ var ee = "", E = (n) => {
1932
1938
  }
1933
1939
  }
1934
1940
  return n;
1935
- }, Wn = (e, t, n) => {
1941
+ }, Gn = (e, t, n) => {
1936
1942
  for (let r of e.nodes.values()) r.status === "superseded" && !t.has(r.id) && n.add({
1937
1943
  code: "MOLDEA_DECISION_SUPERSEDED_ORPHAN",
1938
1944
  entity: { decisionId: r.id },
1939
1945
  path: r.path
1940
1946
  });
1941
- }, Gn = (e) => {
1947
+ }, Kn = (e) => {
1942
1948
  let t = new Set(), n = [];
1943
1949
  for (let r of e.nodes.keys()) {
1944
1950
  if (t.has(r)) continue;
@@ -1961,15 +1967,15 @@ var ee = "", E = (n) => {
1961
1967
  }
1962
1968
  }
1963
1969
  return n;
1964
- }, Kn = (e) => {
1970
+ }, qn = (e) => {
1965
1971
  let t = new Map();
1966
1972
  for (let n of e.nodes.keys()) t.set(n, []);
1967
1973
  for (let [n, r] of e.edges) for (let e of r) t.get(e)?.push(n);
1968
1974
  for (let e of t.values()) e.sort(u);
1969
1975
  return t;
1970
- }, qn = (e) => {
1971
- let t = Kn(e), n = new Set(), r = [];
1972
- for (let i of [...Gn(e)].reverse()) {
1976
+ }, Jn = (e) => {
1977
+ let t = qn(e), n = new Set(), r = [];
1978
+ for (let i of [...Kn(e)].reverse()) {
1973
1979
  if (n.has(i)) continue;
1974
1980
  let e = [], a = [i];
1975
1981
  for (n.add(i); a.length > 0;) {
@@ -1981,8 +1987,8 @@ var ee = "", E = (n) => {
1981
1987
  r.push(e.sort(u));
1982
1988
  }
1983
1989
  return r.sort((e, t) => u(e[0] ?? "", t[0] ?? ""));
1984
- }, Jn = (e, t) => {
1985
- for (let n of qn(e)) {
1990
+ }, Yn = (e, t) => {
1991
+ for (let n of Jn(e)) {
1986
1992
  if (n.length < 2) continue;
1987
1993
  let r = n[0];
1988
1994
  if (r !== void 0) for (let i of n) {
@@ -1999,23 +2005,23 @@ var ee = "", E = (n) => {
1999
2005
  });
2000
2006
  }
2001
2007
  }
2002
- }, Yn = (e, t) => {
2003
- let n = d(t, "validate-project"), r = Bn(e);
2004
- return Vn(r, n), Hn(r, n), Jn(r, n), Wn(r, Un(r, n), n), n.finalize();
2005
- }, Xn = (e) => {
2008
+ }, Xn = (e, t) => {
2009
+ let n = d(t, "validate-project"), r = Vn(e);
2010
+ return Hn(r, n), Un(r, n), Yn(r, n), Gn(r, Wn(r, n), n), n.finalize();
2011
+ }, Zn = (e) => {
2006
2012
  throw new x({
2007
2013
  code: "INVALID_SOURCE_DATA",
2008
2014
  operation: "read-file-page",
2009
2015
  path: e,
2010
2016
  retryable: !1
2011
2017
  });
2012
- }, Zn = (e) => [...e].sort((e, t) => u(e.id, t.id) || u(e.path, t.path)), Qn = async (e, t, n, r, i) => {
2018
+ }, Qn = (e) => [...e].sort((e, t) => u(e.id, t.id) || u(e.path, t.path)), $n = async (e, t, n, r, i) => {
2013
2019
  n = a(n);
2014
2020
  let o = d(n.limits, "validate-project"), s = [], c = [], l = r === void 0 ? void 0 : { signal: r };
2015
2021
  for (let r of [...t].sort(u)) {
2016
2022
  let t = await e.readCompleteFile(r, l);
2017
- if (!(t instanceof Uint8Array)) return Xn(r);
2018
- let a = await Vt({
2023
+ if (!(t instanceof Uint8Array)) return Zn(r);
2024
+ let a = await Ht({
2019
2025
  content: t.slice(),
2020
2026
  path: r
2021
2027
  }, n, "validate-project");
@@ -2023,24 +2029,24 @@ var ee = "", E = (n) => {
2023
2029
  for (let e of a.diagnostics) o.merge(e);
2024
2030
  s.push({
2025
2031
  decision: a.decision,
2026
- id: j(r),
2032
+ id: A(r),
2027
2033
  path: r
2028
2034
  }), a.decision !== null && c.push(a.decision);
2029
2035
  }
2030
- for (let e of Yn(s, n.limits)) o.merge(e);
2036
+ for (let e of Xn(s, n.limits)) o.merge(e);
2031
2037
  let f = o.finalize();
2032
2038
  return m({
2033
- decisions: Zn(c),
2039
+ decisions: Qn(c),
2034
2040
  diagnostics: f,
2035
2041
  valid: f.length === 0
2036
2042
  });
2037
- }, $n = (e, t) => {
2038
- let n = j(e);
2043
+ }, er = (e, t) => {
2044
+ let n = A(e);
2039
2045
  return {
2040
2046
  ...t === void 0 ? {} : { agentId: t },
2041
2047
  ...n === null ? {} : { decisionId: n }
2042
2048
  };
2043
- }, er = (e, t, n, r, i) => {
2049
+ }, tr = (e, t, n, r, i) => {
2044
2050
  n.has(e) || r.blockedPaths.has(e) || r.collector.add({
2045
2051
  code: "MOLDEA_REFERENCE_MISSING",
2046
2052
  details: { referencedPath: e },
@@ -2048,13 +2054,13 @@ var ee = "", E = (n) => {
2048
2054
  path: r.manifestPath,
2049
2055
  pointer: t
2050
2056
  });
2051
- }, tr = (e, t, n, r) => {
2057
+ }, nr = (e, t, n, r) => {
2052
2058
  if (!n.discoveredDecisionPaths.has(e)) {
2053
2059
  if (n.blockedPaths.has(e)) return;
2054
2060
  n.collector.add({
2055
2061
  code: "MOLDEA_DECISION_REFERENCE_MISSING",
2056
2062
  details: { referencedPath: e },
2057
- entity: $n(e, r),
2063
+ entity: er(e, r),
2058
2064
  path: n.manifestPath,
2059
2065
  pointer: t
2060
2066
  });
@@ -2067,11 +2073,11 @@ var ee = "", E = (n) => {
2067
2073
  referencedPath: e,
2068
2074
  targetStatus: i.status
2069
2075
  },
2070
- entity: $n(e, r),
2076
+ entity: er(e, r),
2071
2077
  path: n.manifestPath,
2072
2078
  pointer: t
2073
2079
  });
2074
- }, nr = (e, t, n, r, i) => {
2080
+ }, rr = (e, t, n, r, i) => {
2075
2081
  let a = d(i, "validate-project"), o = new Set(n.inventory.context), s = new Set(o);
2076
2082
  n.inventory.project !== null && s.add(n.inventory.project);
2077
2083
  let c = {
@@ -2083,24 +2089,24 @@ var ee = "", E = (n) => {
2083
2089
  validAgentContextPaths: o,
2084
2090
  validTopLevelContextPaths: s
2085
2091
  };
2086
- for (let e of Object.keys(t.context ?? {}).sort(u)) er(S(e), `/context/${g(e)}`, c.validTopLevelContextPaths, c);
2087
- for (let e of Object.keys(t.decisions ?? {}).sort(u)) tr(S(e), `/decisions/${g(e)}`, c);
2092
+ for (let e of Object.keys(t.context ?? {}).sort(u)) tr(S(e), `/context/${g(e)}`, c.validTopLevelContextPaths, c);
2093
+ for (let e of Object.keys(t.decisions ?? {}).sort(u)) nr(S(e), `/decisions/${g(e)}`, c);
2088
2094
  for (let e of Object.keys(t.agents ?? {}).sort(u)) {
2089
2095
  let n = t.agents?.[e];
2090
2096
  if (n === void 0) continue;
2091
2097
  let r = g(e);
2092
- for (let [t, i] of (n.context ?? []).entries()) er(i, `/agents/${r}/context/${t}`, c.validAgentContextPaths, c, e);
2093
- for (let [t, i] of (n.decisions ?? []).entries()) tr(i, `/agents/${r}/decisions/${t}`, c, e);
2098
+ for (let [t, i] of (n.context ?? []).entries()) tr(i, `/agents/${r}/context/${t}`, c.validAgentContextPaths, c, e);
2099
+ for (let [t, i] of (n.decisions ?? []).entries()) nr(i, `/agents/${r}/decisions/${t}`, c, e);
2094
2100
  }
2095
2101
  return a.finalize();
2096
- }, Y = {
2102
+ }, J = {
2097
2103
  start: "<!-- moldea:start -->",
2098
2104
  end: "<!-- moldea:end -->"
2099
- }, rr = (t) => {
2105
+ }, ir = (t) => {
2100
2106
  try {
2101
- let e = ne(t.replace(/(<!-- moldea:(?:start|end) -->)[ \t]+(?=\r?$)/gmu, "$1"), Y);
2107
+ let e = re(t.replace(/(<!-- moldea:(?:start|end) -->)[ \t]+(?=\r?$)/gmu, "$1"), J);
2102
2108
  if (e === null) return "block-missing";
2103
- let n = t.indexOf(Y.start), r = t.indexOf("\n", t.indexOf(Y.end));
2109
+ let n = t.indexOf(J.start), r = t.indexOf("\n", t.indexOf(J.end));
2104
2110
  return {
2105
2111
  start: n,
2106
2112
  end: r === -1 ? t.length : r + 1,
@@ -2110,15 +2116,15 @@ var ee = "", E = (n) => {
2110
2116
  if (n(t, e.INVALID_MARKED_REGION)) return "block-invalid";
2111
2117
  throw t;
2112
2118
  }
2113
- }, ir = (e) => {
2119
+ }, ar = (e) => {
2114
2120
  let t = e.replaceAll("\r\n", "\n").replace(/(<!-- moldea:(?:start|end) -->)[ \t]+(?=\n|$)/gu, "$1");
2115
- if (!t.startsWith(`${Y.start}\n`) || !(t.endsWith(Y.end) || t.endsWith(`${Y.end}\n`))) return t;
2116
- let n = Y.start.length, r = t.lastIndexOf(Y.end);
2121
+ if (!t.startsWith(`${J.start}\n`) || !(t.endsWith(J.end) || t.endsWith(`${J.end}\n`))) return t;
2122
+ let n = J.start.length, r = t.lastIndexOf(J.end);
2117
2123
  for (; n < r && t[n] === "\n";) n++;
2118
2124
  for (; r > n && t[r - 1] === "\n";) r--;
2119
- return `${Y.start}\n${t.slice(n, r)}\n${Y.end}`;
2120
- }, ar = (e) => {
2121
- let t = rr(e);
2125
+ return `${J.start}\n${t.slice(n, r)}\n${J.end}`;
2126
+ }, or = (e) => {
2127
+ let t = ir(e);
2122
2128
  if (typeof t == "string") return {
2123
2129
  kind: "missing",
2124
2130
  reason: t
@@ -2143,8 +2149,8 @@ var ee = "", E = (n) => {
2143
2149
  kind: "found",
2144
2150
  skillPath: i
2145
2151
  };
2146
- }, or = new Set(["@AGENTS.md", "@./AGENTS.md"]), sr = new Set(["@../AGENTS.md"]), cr = (e, t) => {
2147
- let n = t ? sr : or, r = null;
2152
+ }, sr = new Set(["@AGENTS.md", "@./AGENTS.md"]), cr = new Set(["@../AGENTS.md"]), lr = (e, t) => {
2153
+ let n = t ? cr : sr, r = null;
2148
2154
  for (let t of e.replace(/^\uFEFF/u, "").split(/\r\n|\n|\r/u)) {
2149
2155
  let e = t.replace(/^[ \t]+|[ \t]+$/gu, ""), i = /^(`{3,}|~{3,})/u.exec(e)?.[1];
2150
2156
  if (r !== null) i !== void 0 && i[0] === r[0] && i.length >= r.length && (r = null);
@@ -2152,7 +2158,7 @@ var ee = "", E = (n) => {
2152
2158
  else if (n.has(e)) return !0;
2153
2159
  }
2154
2160
  return !1;
2155
- }, lr = async (e, t) => {
2161
+ }, ur = async (e, t) => {
2156
2162
  let n = await t(), r = n.bytes.byteLength * 8, i = !1;
2157
2163
  try {
2158
2164
  e.reserve(r), i = !0;
@@ -2171,24 +2177,24 @@ var ee = "", E = (n) => {
2171
2177
  } finally {
2172
2178
  n.release();
2173
2179
  }
2174
- }, ur = (e) => e instanceof x ? e.code === "ENTRY_NOT_FOUND" ? "missing" : e.code === "ENTRY_NOT_FILE" ? "non-regular" : null : null, dr = S("/AGENTS.md"), fr = (e, t) => e("MOLDEA_INTEGRATION_LINK_UNRESOLVED", {
2180
+ }, dr = (e) => e instanceof x ? e.code === "ENTRY_NOT_FOUND" ? "missing" : e.code === "ENTRY_NOT_FILE" ? "non-regular" : null : null, fr = S("/AGENTS.md"), pr = (e, t) => e("MOLDEA_INTEGRATION_LINK_UNRESOLVED", {
2175
2181
  entryKind: "symlink",
2176
2182
  reason: t
2177
- }, t), pr = async (e, t, n, r) => {
2183
+ }, t), mr = async (e, t, n, r) => {
2178
2184
  let { ledger: i, reader: a, signal: o } = e, s;
2179
2185
  try {
2180
- s = await lr(i, n);
2186
+ s = await ur(i, n);
2181
2187
  } catch (e) {
2182
- let n = ur(e);
2188
+ let n = dr(e);
2183
2189
  if (n === null) throw e;
2184
- return r.entryKind === "symlink" ? fr(t, n === "missing" ? "missing" : "not-file") : t("MOLDEA_INTEGRATION_BLOCK_MISSING", { entryKind: n });
2190
+ return r.entryKind === "symlink" ? pr(t, n === "missing" ? "missing" : "not-file") : t("MOLDEA_INTEGRATION_BLOCK_MISSING", { entryKind: n });
2185
2191
  }
2186
2192
  try {
2187
2193
  if (s.text === null) return t("MOLDEA_INTEGRATION_BLOCK_MISSING", {
2188
2194
  ...r,
2189
2195
  reason: "invalid-utf8"
2190
2196
  });
2191
- let e = ar(s.text);
2197
+ let e = or(s.text);
2192
2198
  if (e.kind === "missing") return t(e.reason.startsWith("block-") ? "MOLDEA_INTEGRATION_BLOCK_MISSING" : "MOLDEA_INTEGRATION_SKILL_MISSING", {
2193
2199
  ...r,
2194
2200
  reason: e.reason
@@ -2204,9 +2210,9 @@ var ee = "", E = (n) => {
2204
2210
  }
2205
2211
  let c = S(`/${n}/assets/managed-agents-block.md`), l;
2206
2212
  try {
2207
- l = await lr(i, () => i.readSourceFile(c));
2213
+ l = await ur(i, () => i.readSourceFile(c));
2208
2214
  } catch (e) {
2209
- let r = ur(e);
2215
+ let r = dr(e);
2210
2216
  if (r !== null) return t("MOLDEA_INTEGRATION_SKILL_MISSING", {
2211
2217
  referencedPath: `/${n}`,
2212
2218
  missingFile: c,
@@ -2219,13 +2225,13 @@ var ee = "", E = (n) => {
2219
2225
  referencedPath: `/${n}`,
2220
2226
  reason: "invalid-utf8-asset"
2221
2227
  });
2222
- let e = rr(s.text), r = 0, a = 0;
2228
+ let e = ir(s.text), r = 0, a = 0;
2223
2229
  for (; (a = l.text.indexOf("{{skill-path}}", a)) !== -1;) r++, a += 14;
2224
2230
  let o = (l.text.length + r * n.length) * 8;
2225
2231
  i.reserve(o);
2226
2232
  try {
2227
- let r = ir(l.text.replaceAll("{{skill-path}}", n).replace(/\r\n?/gu, "\n"));
2228
- if (ir(s.text.slice(e.start, e.end)) !== r) return t("MOLDEA_INTEGRATION_BLOCK_STALE", { referencedPath: `/${n}` });
2233
+ let r = ar(l.text.replaceAll("{{skill-path}}", n).replace(/\r\n?/gu, "\n"));
2234
+ if (ar(s.text.slice(e.start, e.end)) !== r) return t("MOLDEA_INTEGRATION_BLOCK_STALE", { referencedPath: `/${n}` });
2229
2235
  } finally {
2230
2236
  i.release(o);
2231
2237
  }
@@ -2235,47 +2241,47 @@ var ee = "", E = (n) => {
2235
2241
  } finally {
2236
2242
  s.release();
2237
2243
  }
2238
- }, mr = async (e) => {
2239
- let { instructions: t } = e, n = (t, n, r) => e.report(t, dr, n, r), r = await t.getEntry(dr);
2240
- if (r === null) return n("MOLDEA_INTEGRATION_BLOCK_MISSING", { entryKind: "missing" }), { kind: "missing" };
2241
- if (r.type === "directory") return n("MOLDEA_INTEGRATION_BLOCK_MISSING", { entryKind: "directory" }), { kind: "directory" };
2242
- if (r.type === "file") return await pr(e, n, () => t.readSourceFile(dr), { entryKind: "file" }), { kind: "file" };
2243
- let i = await T(t, dr);
2244
- if (i.state === "file") {
2245
- let { targetPath: r } = i;
2246
- await pr(e, n, () => t.readSourceFile(r), { entryKind: "symlink" });
2247
- } else fr(n, i.state);
2244
+ }, hr = async (e) => {
2245
+ let { instructions: t, ledger: n } = e, r = (t, n, r) => e.report(t, fr, n, r), i = await t.getEntry(fr);
2246
+ if (i === null) return r("MOLDEA_INTEGRATION_BLOCK_MISSING", { entryKind: "missing" }), { kind: "missing" };
2247
+ if (i.type === "directory") return r("MOLDEA_INTEGRATION_BLOCK_MISSING", { entryKind: "directory" }), { kind: "directory" };
2248
+ if (i.type === "file") return await mr(e, r, () => t.readSourceFile(fr), { entryKind: "file" }), { kind: "file" };
2249
+ let a = await t.resolveLink(fr);
2250
+ if (a.state === "file") {
2251
+ let { targetPath: t } = a;
2252
+ await mr(e, r, () => n.readSourceFile(t), { entryKind: "symlink" });
2253
+ } else pr(r, a.state);
2248
2254
  return {
2249
2255
  kind: "link",
2250
- resolution: i
2256
+ resolution: a
2251
2257
  };
2252
- }, hr = S("/AGENTS.md"), gr = S("/CLAUDE.md"), _r = S("/.claude/CLAUDE.md"), vr = S("/CLAUDE.local.md"), yr = (e) => e.kind === "file" ? hr : e.kind === "link" && e.resolution.state === "file" ? e.resolution.targetPath : null, br = (e, t, n) => {
2253
- let r = yr(n);
2258
+ }, gr = S("/AGENTS.md"), _r = S("/CLAUDE.md"), vr = S("/.claude/CLAUDE.md"), yr = S("/CLAUDE.local.md"), br = (e) => e.kind === "file" ? gr : e.kind === "link" && e.resolution.state === "file" ? e.resolution.targetPath : null, xr = (e, t, n) => {
2259
+ let r = br(n);
2254
2260
  return n.kind === "link" && r === e || t?.state === "file" && t.targetPath === r;
2255
- }, xr = async (e, t, n) => {
2261
+ }, Sr = async (e, t, n) => {
2256
2262
  let { instructions: r, ledger: i } = e, a = await r.getEntry(t);
2257
2263
  if (a === null) return { kind: "absent" };
2258
- if (br(t, null, n)) return { kind: "loads" };
2264
+ if (xr(t, null, n)) return { kind: "loads" };
2259
2265
  if (a.type === "directory") return {
2260
2266
  entryKind: "directory",
2261
2267
  kind: "not-loading"
2262
2268
  };
2263
2269
  let o = () => r.readSourceFile(t);
2264
2270
  if (a.type === "symlink") {
2265
- let e = await T(r, t);
2266
- if (br(t, e, n)) return { kind: "loads" };
2271
+ let e = await r.resolveLink(t);
2272
+ if (xr(t, e, n)) return { kind: "loads" };
2267
2273
  if (e.state !== "file") return {
2268
2274
  kind: "unresolved",
2269
2275
  reason: e.state
2270
2276
  };
2271
- let { targetPath: i } = e;
2272
- o = () => r.readSourceFile(i);
2277
+ let { targetPath: a } = e;
2278
+ o = () => i.readSourceFile(a);
2273
2279
  }
2274
2280
  let s;
2275
2281
  try {
2276
- s = await lr(i, o);
2282
+ s = await ur(i, o);
2277
2283
  } catch (e) {
2278
- let t = ur(e);
2284
+ let t = dr(e);
2279
2285
  if (t === null) throw e;
2280
2286
  return a.type === "symlink" ? {
2281
2287
  kind: "unresolved",
@@ -2283,17 +2289,17 @@ var ee = "", E = (n) => {
2283
2289
  } : { kind: "absent" };
2284
2290
  }
2285
2291
  try {
2286
- return s.text !== null && cr(s.text, t === _r) ? { kind: "loads" } : {
2292
+ return s.text !== null && lr(s.text, t === vr) ? { kind: "loads" } : {
2287
2293
  entryKind: a.type,
2288
2294
  kind: "not-loading"
2289
2295
  };
2290
2296
  } finally {
2291
2297
  s.release();
2292
2298
  }
2293
- }, Sr = async (e, t) => {
2299
+ }, Cr = async (e, t) => {
2294
2300
  let n = [];
2295
- for (let r of [gr, _r]) {
2296
- let i = await xr(e, r, t);
2301
+ for (let r of [_r, vr]) {
2302
+ let i = await Sr(e, r, t);
2297
2303
  if (i.kind === "loads") return;
2298
2304
  i.kind !== "absent" && n.push({
2299
2305
  assessment: i,
@@ -2301,11 +2307,11 @@ var ee = "", E = (n) => {
2301
2307
  });
2302
2308
  }
2303
2309
  if (n.length === 0) {
2304
- let r = await xr(e, vr, t);
2310
+ let r = await Sr(e, yr, t);
2305
2311
  if (r.kind === "absent" || r.kind === "loads") return;
2306
2312
  n.push({
2307
2313
  assessment: r,
2308
- path: vr
2314
+ path: yr
2309
2315
  });
2310
2316
  }
2311
2317
  let r = n.find(({ assessment: e }) => e.kind === "unresolved");
@@ -2319,10 +2325,10 @@ var ee = "", E = (n) => {
2319
2325
  }
2320
2326
  let i = n[0];
2321
2327
  i?.assessment.kind === "not-loading" && e.report("MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING", i.path, { entryKind: i.assessment.entryKind });
2322
- }, Cr = async (e, t, n, r) => {
2328
+ }, wr = async (e, t, n, r) => {
2323
2329
  let i = d(n, "validate-project"), a = {
2324
2330
  instructions: t,
2325
- ledger: Yt(e),
2331
+ ledger: Xt(e),
2326
2332
  reader: e,
2327
2333
  report: (e, t, n, r) => {
2328
2334
  i.add({
@@ -2336,15 +2342,15 @@ var ee = "", E = (n) => {
2336
2342
  },
2337
2343
  ...r === void 0 ? {} : { signal: r }
2338
2344
  };
2339
- return await Sr(a, await mr(a)), i.finalize();
2340
- }, wr = (e) => {
2345
+ return await Cr(a, await hr(a)), i.finalize();
2346
+ }, Tr = (e) => {
2341
2347
  if (e.kind === "context") return {
2342
2348
  subject: S(e.id),
2343
2349
  entity: { contextPath: S(e.id) }
2344
2350
  };
2345
2351
  if (e.kind === "decision") return {
2346
2352
  subject: S(e.id),
2347
- entity: { decisionId: j(S(e.id)) ?? e.id }
2353
+ entity: { decisionId: A(S(e.id)) ?? e.id }
2348
2354
  };
2349
2355
  let t = e.agentId ?? e.id;
2350
2356
  return {
@@ -2357,9 +2363,9 @@ var ee = "", E = (n) => {
2357
2363
  } : {}
2358
2364
  }
2359
2365
  };
2360
- }, Tr = (e) => {
2366
+ }, Er = (e) => {
2361
2367
  let t = new Map();
2362
- for (let n of Ve(e)) {
2368
+ for (let n of He(e)) {
2363
2369
  if (n.field !== "affectedBy" || n.declaration.kind !== "glob") continue;
2364
2370
  let e = n.declaration.pattern, r = e.slice(1).split("/"), i = r.findIndex((e) => e.includes("*")), a = S("/" + r.slice(0, i).join("/")), o = t.get(a) ?? [];
2365
2371
  o.push({
@@ -2369,17 +2375,17 @@ var ee = "", E = (n) => {
2369
2375
  }), t.set(a, o);
2370
2376
  }
2371
2377
  return t;
2372
- }, Er = async (e, t, n, i) => {
2378
+ }, Dr = async (e, t, n, i) => {
2373
2379
  let a = [];
2374
2380
  try {
2375
- for (let [n, r] of Tr(t)) {
2381
+ for (let [n, r] of Er(t)) {
2376
2382
  let t = new Set(r);
2377
2383
  if ((await e.getEntry(n, i === void 0 ? void 0 : { signal: i }))?.type === "directory") {
2378
2384
  for await (let r of e.iterateEntries({
2379
2385
  prefix: n,
2380
2386
  ...i === void 0 ? {} : { signal: i }
2381
2387
  })) if (r.type === "file") {
2382
- for (let e of t) Me(e.segments, r.path) && t.delete(e);
2388
+ for (let e of t) Ne(e.segments, r.path) && t.delete(e);
2383
2389
  if (t.size === 0) break;
2384
2390
  }
2385
2391
  }
@@ -2394,7 +2400,7 @@ var ee = "", E = (n) => {
2394
2400
  }
2395
2401
  let o = d(n, "validate-project");
2396
2402
  for (let { declaration: e, pattern: t } of a) {
2397
- let { subject: n, entity: r } = wr(e.owner);
2403
+ let { subject: n, entity: r } = Tr(e.owner);
2398
2404
  o.add({
2399
2405
  code: "MOLDEA_IMPACT_PATTERN_UNMATCHED",
2400
2406
  path: S("/moldea/moldea.yaml"),
@@ -2412,17 +2418,17 @@ var ee = "", E = (n) => {
2412
2418
  completed: !0,
2413
2419
  diagnostics: o.finalize()
2414
2420
  };
2415
- }, Dr = (e) => JSON.stringify([
2421
+ }, Or = (e) => JSON.stringify([
2416
2422
  e.code,
2417
2423
  e.subject,
2418
2424
  e.qualifier ?? null
2419
- ]), Or = (e, t, n, r) => {
2420
- let i = new Map(t.map((e, t) => [Dr(e), {
2425
+ ]), kr = (e, t, n, r) => {
2426
+ let i = new Map(t.map((e, t) => [Or(e), {
2421
2427
  entry: e,
2422
2428
  index: t
2423
2429
  }])), a = new Set(), o = e.map((e) => {
2424
2430
  if (e.severity !== "warning" || !e.acceptable || !n.has(e.code)) return e;
2425
- let t = Dr(e), r = i.get(t);
2431
+ let t = Or(e), r = i.get(t);
2426
2432
  return r === void 0 ? e : (a.add(t), m({
2427
2433
  ...e,
2428
2434
  accepted: !0,
@@ -2446,9 +2452,9 @@ var ee = "", E = (n) => {
2446
2452
  });
2447
2453
  }
2448
2454
  return s([...o, ...c.finalize()]);
2449
- }, kr = (e, t) => {
2455
+ }, Ar = (e, t) => {
2450
2456
  for (let n of t) e.merge(n);
2451
- }, Ar = (e, t, n, r, i, a, o) => {
2457
+ }, jr = (e, t, n, r, i, a, o) => {
2452
2458
  e.add({
2453
2459
  code: t,
2454
2460
  details: {
@@ -2459,20 +2465,20 @@ var ee = "", E = (n) => {
2459
2465
  path: n,
2460
2466
  pointer: i
2461
2467
  });
2462
- }, jr = async (e, t, n, r, i, a, o, s, c, l) => {
2468
+ }, Mr = async (e, t, n, r, i, a, o, s, c, l) => {
2463
2469
  let u = await e.getEntry(r, c);
2464
- if (u === null) return Ar(s, "MOLDEA_MIRROR_MISSING", t, r, i, a), null;
2465
- if (u.type === "symlink") return Ar(s, "MOLDEA_MIRROR_SYMLINK", t, r, i, a, u), null;
2466
- if (u.type !== "file") return Ar(s, "MOLDEA_MIRROR_NOT_FILE", t, r, i, a, u), null;
2467
- let d = await G(e, r, o.limits, l);
2468
- return kr(s, d.diagnostics), d.asset === null ? null : d.asset.content === n.content ? {
2470
+ if (u === null) return jr(s, "MOLDEA_MIRROR_MISSING", t, r, i, a), null;
2471
+ if (u.type === "symlink") return jr(s, "MOLDEA_MIRROR_SYMLINK", t, r, i, a, u), null;
2472
+ if (u.type !== "file") return jr(s, "MOLDEA_MIRROR_NOT_FILE", t, r, i, a, u), null;
2473
+ let d = await W(e, r, o.limits, l);
2474
+ return Ar(s, d.diagnostics), d.asset === null ? null : d.asset.content === n.content ? {
2469
2475
  byteLength: d.asset.utf8ByteLength,
2470
2476
  canonicalDigest: n.digest,
2471
2477
  digest: d.asset.digest,
2472
2478
  path: r,
2473
2479
  scalarLength: d.asset.scalarLength
2474
- } : (Ar(s, "MOLDEA_MIRROR_STALE", t, r, i, a), null);
2475
- }, Mr = async (e, t, n, r, i) => {
2480
+ } : (jr(s, "MOLDEA_MIRROR_STALE", t, r, i, a), null);
2481
+ }, Nr = async (e, t, n, r, i) => {
2476
2482
  r = a(r);
2477
2483
  let o = d(r.limits, "validate-project"), s = [], c = i === void 0 ? void 0 : { signal: i };
2478
2484
  for (let a of [...n].sort((e, t) => u(e.id, t.id))) {
@@ -2480,7 +2486,7 @@ var ee = "", E = (n) => {
2480
2486
  if (a.instruction !== null) {
2481
2487
  let s = a.declaration.mirrors ?? [];
2482
2488
  for (let [l, u] of s.entries()) {
2483
- let s = await jr(e, t, a.instruction, u, `/agents/${g(a.id)}/mirrors/${l}`, a.id, r, o, c, i);
2489
+ let s = await Mr(e, t, a.instruction, u, `/agents/${g(a.id)}/mirrors/${l}`, a.id, r, o, c, i);
2484
2490
  s !== null && n.push(s);
2485
2491
  }
2486
2492
  }
@@ -2495,14 +2501,14 @@ var ee = "", E = (n) => {
2495
2501
  diagnostics: l,
2496
2502
  valid: l.length === 0
2497
2503
  });
2498
- }, Nr = (e, t) => {
2504
+ }, Pr = (e, t) => {
2499
2505
  for (let n of t) e.merge(n);
2500
- }, Pr = async (e, t, n, r) => {
2506
+ }, Fr = async (e, t, n, r) => {
2501
2507
  n = a(n);
2502
2508
  let i = d(n.limits, "validate-project"), o = null;
2503
2509
  if (t !== null) {
2504
- let a = await G(e, t, n.limits, r);
2505
- Nr(i, a.diagnostics), a.asset !== null && (k(a.asset.content) ? o = a.asset : i.add({
2510
+ let a = await W(e, t, n.limits, r);
2511
+ Pr(i, a.diagnostics), a.asset !== null && (O(a.asset.content) ? o = a.asset : i.add({
2506
2512
  code: "MOLDEA_PROJECT_FILE_EMPTY",
2507
2513
  path: a.asset.path
2508
2514
  }));
@@ -2513,14 +2519,14 @@ var ee = "", E = (n) => {
2513
2519
  project: o,
2514
2520
  valid: s.length === 0
2515
2521
  });
2516
- }, Fr = async (e, t, n, r, i, o) => {
2522
+ }, Ir = async (e, t, n, r, i, o) => {
2517
2523
  r = a(r);
2518
- let s = d(r.limits, "validate-project"), c = [], l = o ?? await Pr(e, n.inventory.project, r, i);
2519
- Nr(s, l.diagnostics);
2524
+ let s = d(r.limits, "validate-project"), c = [], l = o ?? await Fr(e, n.inventory.project, r, i);
2525
+ Pr(s, l.diagnostics);
2520
2526
  for (let a of [...n.inventory.context].sort(u)) {
2521
- let n = await G(e, a, r.limits, i);
2522
- if (Nr(s, n.diagnostics), n.asset !== null) {
2523
- if (!k(n.asset.content)) {
2527
+ let n = await W(e, a, r.limits, i);
2528
+ if (Pr(s, n.diagnostics), n.asset !== null) {
2529
+ if (!O(n.asset.content)) {
2524
2530
  s.add({
2525
2531
  code: "MOLDEA_CONTEXT_FILE_EMPTY",
2526
2532
  path: a
@@ -2540,10 +2546,10 @@ var ee = "", E = (n) => {
2540
2546
  project: l.project,
2541
2547
  valid: f.length === 0
2542
2548
  });
2543
- }, Ir = (e, t) => [...e].sort((e, t) => u(e.id, t.id) || u(e.path, t.path)).map((e) => ({
2549
+ }, Lr = (e, t) => [...e].sort((e, t) => u(e.id, t.id) || u(e.path, t.path)).map((e) => ({
2544
2550
  decision: e,
2545
2551
  relationships: t.value.decisions?.[e.path] ?? null
2546
- })), Lr = (e, t) => {
2552
+ })), Rr = (e, t) => {
2547
2553
  let n = new Map(t.map((e) => [e.id, e.mirrors])), r = [];
2548
2554
  if (n.size !== e.length) return null;
2549
2555
  for (let t of [...e].sort((e, t) => u(e.id, t.id))) {
@@ -2560,22 +2566,22 @@ var ee = "", E = (n) => {
2560
2566
  });
2561
2567
  }
2562
2568
  return r;
2563
- }, Rr = (e) => {
2564
- let t = Lr(e.agents, e.agentMirrors);
2569
+ }, zr = (e) => {
2570
+ let t = Rr(e.agents, e.agentMirrors);
2565
2571
  return t === null ? null : m({
2566
2572
  agents: t,
2567
2573
  context: [...e.context].sort((e, t) => u(e.asset.path, t.asset.path)),
2568
- decisions: Ir(e.decisions, e.manifest),
2574
+ decisions: Lr(e.decisions, e.manifest),
2569
2575
  formatVersion: 1,
2570
2576
  manifest: e.manifest,
2571
2577
  project: e.project
2572
2578
  });
2573
- }, zr = (e) => !/\.d\.(?:ts|tsx|mts|cts)$/.test(e) && /\.(?:ts|tsx|mts|cts|js|mjs|jsx)$/.test(e), Br = async (e, t, n, r) => {
2574
- if (!zr(t)) return {
2579
+ }, Br = (e) => !/\.d\.(?:ts|tsx|mts|cts)$/.test(e) && /\.(?:ts|tsx|mts|cts|js|mjs|jsx)$/.test(e), Vr = async (e, t, n, r) => {
2580
+ if (!Br(t)) return {
2575
2581
  kind: "not-checked",
2576
2582
  reason: "unsupported-file-type"
2577
2583
  };
2578
- let i = Yt(e), a = 65536 + n * 520, o = Math.max(1, n + Math.min(65536, n));
2584
+ let i = Xt(e), a = 65536 + n * 520, o = Math.max(1, n + Math.min(65536, n));
2579
2585
  if (n > r || !i.tryReserve(a + o)) return {
2580
2586
  kind: "not-checked",
2581
2587
  reason: "resource-limit"
@@ -2603,26 +2609,26 @@ var ee = "", E = (n) => {
2603
2609
  } finally {
2604
2610
  i.release(a);
2605
2611
  }
2606
- }, X = (e, t) => `${e}/${g(t)}`, Vr = (e, t, n, r, i) => {
2612
+ }, Y = (e, t) => `${e}/${g(t)}`, Hr = (e, t, n, r, i) => {
2607
2613
  for (let [a, o] of (t ?? []).entries()) e.push({
2608
2614
  entity: r,
2609
2615
  kind: "reference",
2610
2616
  path: o.path,
2611
- pointer: X(n, String(a)),
2617
+ pointer: Y(n, String(a)),
2612
2618
  ...i === void 0 ? {} : { relationship: i },
2613
2619
  ...o.symbol === void 0 ? {} : { symbol: o.symbol }
2614
2620
  });
2615
- }, Hr = (e, t, n, r) => {
2621
+ }, Ur = (e, t, n, r) => {
2616
2622
  for (let [i, a] of (t ?? []).entries()) a.includes("*") || e.push({
2617
2623
  entity: r,
2618
2624
  kind: "impact",
2619
2625
  path: S(a),
2620
- pointer: X(n, String(i))
2626
+ pointer: Y(n, String(i))
2621
2627
  });
2622
- }, Ur = (e, t, n, r) => {
2623
- Vr(e, t.bindings, X(n, "bindings"), r, n.startsWith("/context/") ? "context-binding" : "decision-binding"), Hr(e, t.affectedBy, X(n, "affectedBy"), r);
2624
- }, Wr = (e, t, n, r, i, a, o = []) => {
2625
- let s = X(a, r), c = {
2628
+ }, Wr = (e, t, n, r) => {
2629
+ Hr(e, t.bindings, Y(n, "bindings"), r, n.startsWith("/context/") ? "context-binding" : "decision-binding"), Ur(e, t.affectedBy, Y(n, "affectedBy"), r);
2630
+ }, Gr = (e, t, n, r, i, a, o = []) => {
2631
+ let s = Y(a, r), c = {
2626
2632
  agentId: i,
2627
2633
  capabilityId: r,
2628
2634
  capabilityKind: n
@@ -2633,19 +2639,19 @@ var ee = "", E = (n) => {
2633
2639
  relationship: `${n}-implementation`,
2634
2640
  ...t.implementation.symbol === void 0 ? {} : { symbol: t.implementation.symbol },
2635
2641
  path: t.implementation.path,
2636
- pointer: X(s, "implementation")
2642
+ pointer: Y(s, "implementation")
2637
2643
  });
2638
2644
  for (let [r, i] of [["registration", t.registration], ...o]) i !== void 0 && e.push({
2639
2645
  entity: c,
2640
2646
  kind: "reference",
2641
2647
  path: i.path,
2642
- pointer: X(s, r),
2648
+ pointer: Y(s, r),
2643
2649
  relationship: `${n}-${r === "inputSchema" ? "input-schema" : r === "outputSchema" ? "output-schema" : "registration"}`,
2644
2650
  ...i.symbol === void 0 ? {} : { symbol: i.symbol }
2645
2651
  });
2646
- Hr(e, t.affectedBy, X(s, "affectedBy"), c);
2647
- }, Gr = (e, t, n) => {
2648
- let r = `/agents/${g(t)}`, i = { agentId: t }, a = X(r, "bindings"), o = n.bindings;
2652
+ Ur(e, t.affectedBy, Y(s, "affectedBy"), c);
2653
+ }, Kr = (e, t, n) => {
2654
+ let r = `/agents/${g(t)}`, i = { agentId: t }, a = Y(r, "bindings"), o = n.bindings;
2649
2655
  for (let t of [
2650
2656
  "runtimeAgent",
2651
2657
  "inputSchema",
@@ -2657,7 +2663,7 @@ var ee = "", E = (n) => {
2657
2663
  entity: i,
2658
2664
  kind: "reference",
2659
2665
  path: n.path,
2660
- pointer: X(a, t),
2666
+ pointer: Y(a, t),
2661
2667
  relationship: {
2662
2668
  runtimeAgent: "runtime-agent",
2663
2669
  inputSchema: "agent-input-schema",
@@ -2667,34 +2673,34 @@ var ee = "", E = (n) => {
2667
2673
  ...n.symbol === void 0 ? {} : { symbol: n.symbol }
2668
2674
  });
2669
2675
  }
2670
- Hr(e, n.affectedBy, X(r, "affectedBy"), i);
2671
- let s = X(r, "tools");
2676
+ Ur(e, n.affectedBy, Y(r, "affectedBy"), i);
2677
+ let s = Y(r, "tools");
2672
2678
  for (let r of Object.keys(n.tools ?? {}).sort(u)) {
2673
2679
  let i = n.tools?.[r];
2674
- i !== void 0 && Wr(e, i, "tool", r, t, s, [["inputSchema", i.inputSchema], ["outputSchema", i.outputSchema]]);
2680
+ i !== void 0 && Gr(e, i, "tool", r, t, s, [["inputSchema", i.inputSchema], ["outputSchema", i.outputSchema]]);
2675
2681
  }
2676
- let c = X(r, "skills");
2682
+ let c = Y(r, "skills");
2677
2683
  for (let r of Object.keys(n.skills ?? {}).sort(u)) {
2678
2684
  let i = n.skills?.[r];
2679
- i !== void 0 && Wr(e, i, "skill", r, t, c);
2685
+ i !== void 0 && Gr(e, i, "skill", r, t, c);
2680
2686
  }
2681
- }, Kr = (e) => {
2687
+ }, qr = (e) => {
2682
2688
  let t = [];
2683
2689
  for (let n of ["context", "decisions"]) {
2684
2690
  let r = e[n];
2685
2691
  for (let e of Object.keys(r ?? {}).sort(u)) {
2686
2692
  let i = r?.[e];
2687
2693
  if (i === void 0) continue;
2688
- let a = X(`/${n}`, e), o = n === "decisions" ? j(S(e)) : null;
2689
- Ur(t, i, a, o === null ? { contextPath: S(e) } : { decisionId: o });
2694
+ let a = Y(`/${n}`, e), o = n === "decisions" ? A(S(e)) : null;
2695
+ Wr(t, i, a, o === null ? { contextPath: S(e) } : { decisionId: o });
2690
2696
  }
2691
2697
  }
2692
2698
  for (let n of Object.keys(e.agents ?? {}).sort(u)) {
2693
2699
  let r = e.agents?.[n];
2694
- r !== void 0 && Gr(t, n, r);
2700
+ r !== void 0 && Kr(t, n, r);
2695
2701
  }
2696
2702
  return t.sort((e, t) => u(e.pointer, t.pointer));
2697
- }, qr = (e, t) => {
2703
+ }, Jr = (e, t) => {
2698
2704
  let n = e;
2699
2705
  for (; n.length > 0;) {
2700
2706
  if (t.has(n)) return !0;
@@ -2703,26 +2709,26 @@ var ee = "", E = (n) => {
2703
2709
  n = n.slice(0, e);
2704
2710
  }
2705
2711
  return !1;
2706
- }, Jr = (e, t) => {
2712
+ }, Yr = (e, t) => {
2707
2713
  let n = { [e.kind === "impact" ? "impactPath" : "referencedPath"]: e.path };
2708
2714
  return t !== null && (n.actualType = t.type), (e.kind === "tool-implementation" || e.kind === "skill-implementation") && (n.reason = t === null ? "missing" : t.type === "symlink" ? "symlink" : "not-file"), n;
2709
- }, Yr = (e, t) => t?.type === "file" ? null : e.kind === "tool-implementation" ? "MOLDEA_TOOL_IMPLEMENTATION_MISSING" : e.kind === "skill-implementation" ? "MOLDEA_SKILL_IMPLEMENTATION_MISSING" : e.kind === "impact" ? t === null ? "MOLDEA_IMPACT_PATH_MISSING" : "MOLDEA_IMPACT_PATH_NOT_FILE" : t === null ? "MOLDEA_REFERENCE_MISSING" : t.type === "symlink" ? "MOLDEA_REFERENCE_SYMLINK" : "MOLDEA_REFERENCE_NOT_FILE", Xr = (e, t, n, r) => {
2710
- let i = Yr(e, t);
2715
+ }, Xr = (e, t) => t?.type === "file" ? null : e.kind === "tool-implementation" ? "MOLDEA_TOOL_IMPLEMENTATION_MISSING" : e.kind === "skill-implementation" ? "MOLDEA_SKILL_IMPLEMENTATION_MISSING" : e.kind === "impact" ? t === null ? "MOLDEA_IMPACT_PATH_MISSING" : "MOLDEA_IMPACT_PATH_NOT_FILE" : t === null ? "MOLDEA_REFERENCE_MISSING" : t.type === "symlink" ? "MOLDEA_REFERENCE_SYMLINK" : "MOLDEA_REFERENCE_NOT_FILE", Zr = (e, t, n, r) => {
2716
+ let i = Xr(e, t);
2711
2717
  i !== null && r.add({
2712
2718
  code: i,
2713
- details: Jr(e, t),
2719
+ details: Yr(e, t),
2714
2720
  entity: e.entity,
2715
2721
  path: n,
2716
2722
  pointer: e.pointer
2717
2723
  });
2718
- }, Zr = async (e, t, n, i, a, o, s = []) => {
2724
+ }, Qr = async (e, t, n, i, a, o, s = []) => {
2719
2725
  let c = d(a, "validate-project"), l = new Set(i.diagnostics.flatMap((e) => e.path === null ? [] : [e.path])), u = new Map(), f = new Map(), p = o === void 0 ? void 0 : { signal: o };
2720
- for (let i of Kr(n)) {
2721
- if (qr(i.path, l)) continue;
2726
+ for (let i of qr(n)) {
2727
+ if (Jr(i.path, l)) continue;
2722
2728
  let n = f.get(i.path);
2723
2729
  n === void 0 && (n = e.getEntry(i.path, p), f.set(i.path, n));
2724
2730
  let o = await n;
2725
- if (Xr(i, o, t, c), o?.type !== "file" || i.relationship === void 0) continue;
2731
+ if (Zr(i, o, t, c), o?.type !== "file" || i.relationship === void 0) continue;
2726
2732
  if (o.byteLength === null) throw TypeError("A repository file entry must declare its byte length.");
2727
2733
  if (s.length >= a.maxCoverage) throw new r({
2728
2734
  code: "RESOURCE_LIMIT_EXCEEDED",
@@ -2746,7 +2752,7 @@ var ee = "", E = (n) => {
2746
2752
  };
2747
2753
  else {
2748
2754
  let n = u.get(i.path);
2749
- n === void 0 && (n = await Br(e, i.path, o.byteLength, a.maxFileBytes), u.set(i.path, n)), n.kind === "not-checked" ? m = {
2755
+ n === void 0 && (n = await Vr(e, i.path, o.byteLength, a.maxFileBytes), u.set(i.path, n)), n.kind === "not-checked" ? m = {
2750
2756
  ...d,
2751
2757
  exportCheck: "not-checked",
2752
2758
  exportNotCheckedReason: n.reason
@@ -2772,65 +2778,65 @@ var ee = "", E = (n) => {
2772
2778
  exportNotCheckedReason: "unresolved-exports"
2773
2779
  };
2774
2780
  }
2775
- Xt(e, 512 + JSON.stringify(m).length * 2), s.push(m);
2781
+ Zt(e, 512 + JSON.stringify(m).length * 2), s.push(m);
2776
2782
  }
2777
2783
  return c.finalize();
2778
- }, Qr = S("/moldea"), $r = S("/moldea/moldea.yaml"), ei = S("/moldea/project.md"), Z = (e, t) => {
2784
+ }, $r = S("/moldea"), ei = S("/moldea/moldea.yaml"), ti = S("/moldea/project.md"), X = (e, t) => {
2779
2785
  for (let n of t) e.merge(n);
2780
- }, ti = async (e, t) => {
2786
+ }, ni = async (e, t) => {
2781
2787
  t = a(t);
2782
- let { session: n, signal: r } = e, i = [], s = d(t.limits, "validate-project"), c = r === void 0 ? void 0 : { signal: r }, l = new Map(), u = Yt(n.reader), p = 0, h = (e, t) => {
2788
+ let { session: n, signal: r } = e, i = [], s = d(t.limits, "validate-project"), c = r === void 0 ? void 0 : { signal: r }, l = new Map(), u = Xt(n.reader), p = 0, h = (e, t) => {
2783
2789
  let n = f(t);
2784
2790
  u.reserve(n), p += n, l.set(e, t);
2785
2791
  };
2786
2792
  try {
2787
- let e = await n.reader.getEntry(Qr, c), a = null, u = null, d = null, f = null;
2793
+ let e = await n.reader.getEntry($r, c), a = null, u = null, d = null, f = null;
2788
2794
  if (e?.type === "directory") {
2789
- if (a = await n.reader.getEntry($r, c), a?.type === "file") {
2790
- let e = await ht({
2791
- content: await n.reader.readCompleteFile($r, c),
2792
- path: $r
2795
+ if (a = await n.reader.getEntry(ei, c), a?.type === "file") {
2796
+ let e = await gt({
2797
+ content: await n.reader.readCompleteFile(ei, c),
2798
+ path: ei
2793
2799
  }, t, "validate-project");
2794
- e.manifest !== null && e.yamlRoot !== null && h($r, e.yamlRoot), f = e.formatVersion, Z(s, e.diagnostics), e.asset !== null && e.manifest !== null && (d = {
2800
+ e.manifest !== null && e.yamlRoot !== null && h(ei, e.yamlRoot), f = e.formatVersion, X(s, e.diagnostics), e.asset !== null && e.manifest !== null && (d = {
2795
2801
  asset: e.asset,
2796
2802
  value: e.manifest
2797
2803
  });
2798
2804
  }
2799
- u = await n.reader.getEntry(ei, c);
2805
+ u = await n.reader.getEntry(ti, c);
2800
2806
  }
2801
- let p = await Pr(n.reader, u?.type === "file" ? ei : null, t, r);
2802
- Z(s, p.diagnostics);
2803
- let g = await Rn(n.reader, t.limits, r, {
2807
+ let p = await Fr(n.reader, u?.type === "file" ? ti : null, t, r);
2808
+ X(s, p.diagnostics);
2809
+ let g = await zn(n.reader, t.limits, r, {
2804
2810
  manifest: a,
2805
2811
  moldeaRoot: e,
2806
2812
  project: u
2807
2813
  });
2808
- Z(s, g.diagnostics), n.throwIfAborted();
2809
- let _ = await Fr(n.reader, d?.value ?? null, g, t, r, p);
2810
- Z(s, _.diagnostics);
2811
- let v = await Qn(n.reader, g.inventory.decisions, t, r, h);
2812
- Z(s, v.diagnostics);
2814
+ X(s, g.diagnostics), n.throwIfAborted();
2815
+ let _ = await Ir(n.reader, d?.value ?? null, g, t, r, p);
2816
+ X(s, _.diagnostics);
2817
+ let v = await $n(n.reader, g.inventory.decisions, t, r, h);
2818
+ X(s, v.diagnostics);
2813
2819
  let y = [], b = [];
2814
2820
  if (d !== null) {
2815
- let e = d.asset.path, a = await vn(n.reader, d.value, g, t, r);
2816
- y = a.agents, Z(s, a.diagnostics), Z(s, nr(e, d.value, g, v.decisions, t.limits)), Z(s, await Zr(n.reader, e, d.value, g, t.limits, r, i));
2817
- let o = await Mr(n.reader, e, y, t, r);
2818
- b = o.agentMirrors, Z(s, o.diagnostics);
2821
+ let e = d.asset.path, a = await yn(n.reader, d.value, g, t, r);
2822
+ y = a.agents, X(s, a.diagnostics), X(s, rr(e, d.value, g, v.decisions, t.limits)), X(s, await Qr(n.reader, e, d.value, g, t.limits, r, i));
2823
+ let o = await Nr(n.reader, e, y, t, r);
2824
+ b = o.agentMirrors, X(s, o.diagnostics);
2819
2825
  }
2820
- n.throwIfAborted(), Z(s, await Cr(n.reader, n.instructions, t.limits, r));
2826
+ n.throwIfAborted(), X(s, await wr(n.reader, n.instructions, t.limits, r));
2821
2827
  let x = d === null ? {
2822
2828
  completed: !1,
2823
2829
  diagnostics: []
2824
- } : await Er(n.reader, d.value, t.limits, r);
2825
- n.throwIfAborted(), Z(s, x.diagnostics);
2826
- let S = o(Or(s.finalize(), d?.value.acceptedWarnings ?? [], new Set([
2830
+ } : await Dr(n.reader, d.value, t.limits, r);
2831
+ n.throwIfAborted(), X(s, x.diagnostics);
2832
+ let S = o(kr(s.finalize(), d?.value.acceptedWarnings ?? [], new Set([
2827
2833
  "MOLDEA_INTEGRATION_BLOCK_MISSING",
2828
2834
  "MOLDEA_INTEGRATION_SKILL_MISSING",
2829
2835
  "MOLDEA_INTEGRATION_BLOCK_STALE",
2830
2836
  "MOLDEA_INTEGRATION_LINK_UNRESOLVED",
2831
2837
  "MOLDEA_INTEGRATION_CLAUDE_IMPORT_MISSING",
2832
2838
  ...x.completed ? ["MOLDEA_IMPACT_PATTERN_UNMATCHED"] : []
2833
- ]), t.limits), l), C = !S.some((e) => e.severity === "error") && d !== null && _.project !== null ? Rr({
2839
+ ]), t.limits), l), C = !S.some((e) => e.severity === "error") && d !== null && _.project !== null ? zr({
2834
2840
  agentMirrors: b,
2835
2841
  agents: y,
2836
2842
  context: _.context,
@@ -2847,26 +2853,26 @@ var ee = "", E = (n) => {
2847
2853
  } finally {
2848
2854
  l.clear(), u.release(p);
2849
2855
  }
2850
- }, ni = () => {
2856
+ }, ri = () => {
2851
2857
  throw new r({
2852
2858
  code: "INVALID_ARGUMENT",
2853
2859
  operation: "validate-project"
2854
2860
  });
2855
- }, ri = (e) => i(e, !0) && i(e.snapshot, !0) && typeof e.snapshot.id == "string" && typeof e.snapshot.sourceKind == "string" && typeof e.compare == "function" && typeof e.getEntry == "function" && typeof e.listEntriesPage == "function" && typeof e.readFilePage == "function" && typeof e.readLinkText == "function", ii = (e) => i(e, !0) && typeof e.aborted == "boolean" && typeof e.addEventListener == "function" && typeof e.removeEventListener == "function", ai = (e) => {
2861
+ }, ii = (e) => i(e, !0) && i(e.snapshot, !0) && typeof e.snapshot.id == "string" && typeof e.snapshot.sourceKind == "string" && typeof e.compare == "function" && typeof e.getEntry == "function" && typeof e.listEntriesPage == "function" && typeof e.readFilePage == "function" && typeof e.readLinkText == "function", ai = (e) => i(e, !0) && typeof e.aborted == "boolean" && typeof e.addEventListener == "function" && typeof e.removeEventListener == "function", oi = (e) => {
2856
2862
  try {
2857
- if (!i(e, !0)) return ni();
2863
+ if (!i(e, !0)) return ri();
2858
2864
  let t = e.repository, n = e.instructions, r = e.signal;
2859
- return Reflect.ownKeys(e).some((e) => e !== "repository" && e !== "instructions" && e !== "signal") || !ri(t) || n !== void 0 && !ri(n) || r !== void 0 && !ii(r) ? ni() : {
2865
+ return Reflect.ownKeys(e).some((e) => e !== "repository" && e !== "instructions" && e !== "signal") || !ii(t) || n !== void 0 && !ii(n) || r !== void 0 && !ai(r) ? ri() : {
2860
2866
  ...n === void 0 ? {} : { instructions: n },
2861
2867
  repository: t,
2862
2868
  ...r === void 0 ? {} : { signal: r }
2863
2869
  };
2864
2870
  } catch (e) {
2865
2871
  if (e instanceof r) throw e;
2866
- return ni();
2872
+ return ri();
2867
2873
  }
2868
- }, oi = async (e, t) => {
2869
- let n = ai(e), r = a(t), i = cn(n.repository, r.limits, n.signal, n.instructions), o = await ti({
2874
+ }, si = async (e, t) => {
2875
+ let n = oi(e), r = a(t), i = ln(n.repository, r.limits, n.signal, n.instructions), o = await ni({
2870
2876
  session: i,
2871
2877
  ...n.signal === void 0 ? {} : { signal: n.signal }
2872
2878
  }, r);
@@ -2879,14 +2885,14 @@ var ee = "", E = (n) => {
2879
2885
  diagnostics: o.diagnostics,
2880
2886
  ...s,
2881
2887
  coverage: o.coverage,
2882
- coverageCounts: Kt(o.coverage),
2888
+ coverageCounts: qt(o.coverage),
2883
2889
  formatVersion: o.formatVersion,
2884
2890
  source: n.repository.snapshot,
2885
- summary: o.project === null ? null : Gt(o.project),
2891
+ summary: o.project === null ? null : Kt(o.project),
2886
2892
  valid: s.errorCount === 0
2887
2893
  }
2888
2894
  });
2889
- }, si = async (e, t) => (await oi(e, t)).result, ci = "core7", li = 512, ui = 64, di = 2, fi = 8, pi = new TextEncoder(), Q = () => {
2895
+ }, ci = async (e, t) => (await si(e, t)).result, li = "core7", ui = 512, di = 64, fi = 2, pi = 8, Z = new TextEncoder(), Q = () => {
2890
2896
  throw new r({
2891
2897
  code: "INVALID_ARGUMENT",
2892
2898
  operation: "create-project-inspection"
@@ -2907,7 +2913,7 @@ var ee = "", E = (n) => {
2907
2913
  }
2908
2914
  return Array.isArray(e) ? `[${e.map((e) => $(e)).join(",")}]` : `{${Object.entries(e).filter(([, e]) => e !== void 0).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => `${JSON.stringify(e)}:${$(t)}`).join(",")}}`;
2909
2915
  }, hi = (e) => w((function* () {
2910
- for (let t of e) yield pi.encode(t);
2916
+ for (let t of e) yield Z.encode(t);
2911
2917
  })()), gi = (e) => e.kind === "agent" ? ["3", e.agent.agentId].join("\0") : e.kind === "metadata" ? [
2912
2918
  "0",
2913
2919
  e.metadata.path,
@@ -2938,12 +2944,12 @@ var ee = "", E = (n) => {
2938
2944
  }
2939
2945
  return t;
2940
2946
  }, vi = (e, t, n) => hi([
2941
- ci,
2947
+ li,
2942
2948
  e,
2943
2949
  t,
2944
2950
  n
2945
2951
  ]), yi = (e, t, n) => [
2946
- ci,
2952
+ li,
2947
2953
  t,
2948
2954
  encodeURIComponent(n),
2949
2955
  e,
@@ -2968,7 +2974,7 @@ var ee = "", E = (n) => {
2968
2974
  let i = n + e + t;
2969
2975
  return !Number.isSafeInteger(t) || t < 0 || !Number.isSafeInteger(i) || i > r ? mi(r, Number.isSafeInteger(i) ? i : 2 ** 53 - 1) : e + t;
2970
2976
  }, Ci = function* (e) {
2971
- if (e.project !== null) for (let t of Wt(e.project)) yield {
2977
+ if (e.project !== null) for (let t of Gt(e.project)) yield {
2972
2978
  kind: "metadata",
2973
2979
  metadata: t
2974
2980
  };
@@ -2980,15 +2986,15 @@ var ee = "", E = (n) => {
2980
2986
  coverage: t,
2981
2987
  kind: "coverage"
2982
2988
  };
2983
- if (e.project !== null) for (let t of Ut(e.project)) yield {
2989
+ if (e.project !== null) for (let t of Wt(e.project)) yield {
2984
2990
  agent: t,
2985
2991
  kind: "agent"
2986
2992
  };
2987
2993
  }, wi = (e, t, n) => {
2988
- let r = e.resourceUsage.retainedBytes, i = Si(0, li, r, n), a = 0;
2994
+ let r = e.resourceUsage.retainedBytes, i = Si(0, ui, r, n), a = 0;
2989
2995
  for (let t of Ci(e)) {
2990
- let e = `${gi(t)}:0000000000`, o = pi.encode(e).byteLength + pi.encode($(t)).byteLength;
2991
- i = Si(i, ui + o * di + fi, r, n), t.kind === "metadata" && (a += 1);
2996
+ let e = `${gi(t)}:0000000000`, o = Z.encode(e).byteLength + Z.encode($(t)).byteLength;
2997
+ i = Si(i, di + o * fi + pi, r, n), t.kind === "metadata" && (a += 1);
2992
2998
  }
2993
2999
  let o = {
2994
3000
  agents: t.agents,
@@ -3002,14 +3008,14 @@ var ee = "", E = (n) => {
3002
3008
  warnings: t.warnings,
3003
3009
  acceptedWarnings: t.acceptedWarnings
3004
3010
  };
3005
- return i = Si(i, pi.encode($({
3011
+ return i = Si(i, Z.encode($({
3006
3012
  counts: o,
3007
3013
  formatVersion: e.result.formatVersion,
3008
3014
  inspectionDigest: "sha256:0000000000000000000000000000000000000000000000000000000000000000",
3009
3015
  source: e.result.source,
3010
3016
  summary: e.result.summary,
3011
3017
  valid: e.result.valid
3012
- })).byteLength * di, r, n), {
3018
+ })).byteLength * fi, r, n), {
3013
3019
  counts: o,
3014
3020
  preparedBytes: i
3015
3021
  };
@@ -3074,7 +3080,7 @@ var ee = "", E = (n) => {
3074
3080
  valid: u
3075
3081
  });
3076
3082
  }, Oi = async (e, t) => {
3077
- let n = await oi(e, t), r = wi(n, {
3083
+ let n = await si(e, t), r = wi(n, {
3078
3084
  agents: n.result.summary?.counts.agents ?? 0,
3079
3085
  context: n.result.summary?.counts.context ?? 0,
3080
3086
  decisions: n.result.summary?.counts.decisions ?? 0,
@@ -3097,18 +3103,18 @@ var ee = "", E = (n) => {
3097
3103
  summary: n.result.summary,
3098
3104
  valid: n.result.valid
3099
3105
  });
3100
- }, ki = St({ createCore: () => Ai }), Ai = (e) => {
3106
+ }, ki = Ct({ createCore: () => Ai }), Ai = (e) => {
3101
3107
  let t = v(e);
3102
3108
  return m({
3103
- calculateContentDigest: (e) => Ae(e, a(t).limits),
3109
+ calculateContentDigest: (e) => je(e, a(t).limits),
3104
3110
  createProjectInspection: (e) => Oi(e, a(t)),
3105
- validateProject: (e) => si(e, a(t)),
3106
- matchManifestScope: (e) => bt(e, a(t)),
3107
- normalizeText: (e) => M(e, a(t).limits, "normalize-text"),
3108
- parseDecision: (e) => Ht(e, a(t)),
3109
- parseManifest: (e) => gt(e, a(t)),
3110
- readCanonicalContentPage: (e) => Ot(e, a(t))
3111
+ validateProject: (e) => ci(e, a(t)),
3112
+ matchManifestScope: (e) => xt(e, a(t)),
3113
+ normalizeText: (e) => j(e, a(t).limits, "normalize-text"),
3114
+ parseDecision: (e) => Ut(e, a(t)),
3115
+ parseManifest: (e) => _t(e, a(t)),
3116
+ readCanonicalContentPage: (e) => kt(e, a(t))
3111
3117
  });
3112
3118
  };
3113
3119
  //#endregion
3114
- export { ar as i, Ai as n, zr as r, ki as t };
3120
+ export { or as i, Ai as n, Br as r, ki as t };