@c4a/extract 0.6.18 → 0.7.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.
@@ -101,17 +101,17 @@ var require_visit = __commonJS((exports) => {
101
101
  visit.BREAK = BREAK;
102
102
  visit.SKIP = SKIP;
103
103
  visit.REMOVE = REMOVE;
104
- function visit_(key, node2, visitor, path) {
105
- const ctrl = callVisitor(key, node2, visitor, path);
104
+ function visit_(key, node2, visitor, path2) {
105
+ const ctrl = callVisitor(key, node2, visitor, path2);
106
106
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
107
- replaceNode(key, path, ctrl);
108
- return visit_(key, ctrl, visitor, path);
107
+ replaceNode(key, path2, ctrl);
108
+ return visit_(key, ctrl, visitor, path2);
109
109
  }
110
110
  if (typeof ctrl !== "symbol") {
111
111
  if (identity.isCollection(node2)) {
112
- path = Object.freeze(path.concat(node2));
112
+ path2 = Object.freeze(path2.concat(node2));
113
113
  for (let i = 0;i < node2.items.length; ++i) {
114
- const ci = visit_(i, node2.items[i], visitor, path);
114
+ const ci = visit_(i, node2.items[i], visitor, path2);
115
115
  if (typeof ci === "number")
116
116
  i = ci - 1;
117
117
  else if (ci === BREAK)
@@ -122,13 +122,13 @@ var require_visit = __commonJS((exports) => {
122
122
  }
123
123
  }
124
124
  } else if (identity.isPair(node2)) {
125
- path = Object.freeze(path.concat(node2));
126
- const ck = visit_("key", node2.key, visitor, path);
125
+ path2 = Object.freeze(path2.concat(node2));
126
+ const ck = visit_("key", node2.key, visitor, path2);
127
127
  if (ck === BREAK)
128
128
  return BREAK;
129
129
  else if (ck === REMOVE)
130
130
  node2.key = null;
131
- const cv = visit_("value", node2.value, visitor, path);
131
+ const cv = visit_("value", node2.value, visitor, path2);
132
132
  if (cv === BREAK)
133
133
  return BREAK;
134
134
  else if (cv === REMOVE)
@@ -149,17 +149,17 @@ var require_visit = __commonJS((exports) => {
149
149
  visitAsync.BREAK = BREAK;
150
150
  visitAsync.SKIP = SKIP;
151
151
  visitAsync.REMOVE = REMOVE;
152
- async function visitAsync_(key, node2, visitor, path) {
153
- const ctrl = await callVisitor(key, node2, visitor, path);
152
+ async function visitAsync_(key, node2, visitor, path2) {
153
+ const ctrl = await callVisitor(key, node2, visitor, path2);
154
154
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
155
- replaceNode(key, path, ctrl);
156
- return visitAsync_(key, ctrl, visitor, path);
155
+ replaceNode(key, path2, ctrl);
156
+ return visitAsync_(key, ctrl, visitor, path2);
157
157
  }
158
158
  if (typeof ctrl !== "symbol") {
159
159
  if (identity.isCollection(node2)) {
160
- path = Object.freeze(path.concat(node2));
160
+ path2 = Object.freeze(path2.concat(node2));
161
161
  for (let i = 0;i < node2.items.length; ++i) {
162
- const ci = await visitAsync_(i, node2.items[i], visitor, path);
162
+ const ci = await visitAsync_(i, node2.items[i], visitor, path2);
163
163
  if (typeof ci === "number")
164
164
  i = ci - 1;
165
165
  else if (ci === BREAK)
@@ -170,13 +170,13 @@ var require_visit = __commonJS((exports) => {
170
170
  }
171
171
  }
172
172
  } else if (identity.isPair(node2)) {
173
- path = Object.freeze(path.concat(node2));
174
- const ck = await visitAsync_("key", node2.key, visitor, path);
173
+ path2 = Object.freeze(path2.concat(node2));
174
+ const ck = await visitAsync_("key", node2.key, visitor, path2);
175
175
  if (ck === BREAK)
176
176
  return BREAK;
177
177
  else if (ck === REMOVE)
178
178
  node2.key = null;
179
- const cv = await visitAsync_("value", node2.value, visitor, path);
179
+ const cv = await visitAsync_("value", node2.value, visitor, path2);
180
180
  if (cv === BREAK)
181
181
  return BREAK;
182
182
  else if (cv === REMOVE)
@@ -203,23 +203,23 @@ var require_visit = __commonJS((exports) => {
203
203
  }
204
204
  return visitor;
205
205
  }
206
- function callVisitor(key, node2, visitor, path) {
206
+ function callVisitor(key, node2, visitor, path2) {
207
207
  if (typeof visitor === "function")
208
- return visitor(key, node2, path);
208
+ return visitor(key, node2, path2);
209
209
  if (identity.isMap(node2))
210
- return visitor.Map?.(key, node2, path);
210
+ return visitor.Map?.(key, node2, path2);
211
211
  if (identity.isSeq(node2))
212
- return visitor.Seq?.(key, node2, path);
212
+ return visitor.Seq?.(key, node2, path2);
213
213
  if (identity.isPair(node2))
214
- return visitor.Pair?.(key, node2, path);
214
+ return visitor.Pair?.(key, node2, path2);
215
215
  if (identity.isScalar(node2))
216
- return visitor.Scalar?.(key, node2, path);
216
+ return visitor.Scalar?.(key, node2, path2);
217
217
  if (identity.isAlias(node2))
218
- return visitor.Alias?.(key, node2, path);
218
+ return visitor.Alias?.(key, node2, path2);
219
219
  return;
220
220
  }
221
- function replaceNode(key, path, node2) {
222
- const parent = path[path.length - 1];
221
+ function replaceNode(key, path2, node2) {
222
+ const parent = path2[path2.length - 1];
223
223
  if (identity.isCollection(parent)) {
224
224
  parent.items[key] = node2;
225
225
  } else if (identity.isPair(parent)) {
@@ -776,10 +776,10 @@ var require_Collection = __commonJS((exports) => {
776
776
  var createNode = require_createNode();
777
777
  var identity = require_identity();
778
778
  var Node = require_Node();
779
- function collectionFromPath(schema, path, value) {
779
+ function collectionFromPath(schema, path2, value) {
780
780
  let v = value;
781
- for (let i = path.length - 1;i >= 0; --i) {
782
- const k = path[i];
781
+ for (let i = path2.length - 1;i >= 0; --i) {
782
+ const k = path2[i];
783
783
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
784
784
  const a = [];
785
785
  a[k] = v;
@@ -798,7 +798,7 @@ var require_Collection = __commonJS((exports) => {
798
798
  sourceObjects: new Map
799
799
  });
800
800
  }
801
- var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
801
+ var isEmptyPath = (path2) => path2 == null || typeof path2 === "object" && !!path2[Symbol.iterator]().next().done;
802
802
 
803
803
  class Collection extends Node.NodeBase {
804
804
  constructor(type, schema) {
@@ -819,11 +819,11 @@ var require_Collection = __commonJS((exports) => {
819
819
  copy.range = this.range.slice();
820
820
  return copy;
821
821
  }
822
- addIn(path, value) {
823
- if (isEmptyPath(path))
822
+ addIn(path2, value) {
823
+ if (isEmptyPath(path2))
824
824
  this.add(value);
825
825
  else {
826
- const [key, ...rest] = path;
826
+ const [key, ...rest] = path2;
827
827
  const node2 = this.get(key, true);
828
828
  if (identity.isCollection(node2))
829
829
  node2.addIn(rest, value);
@@ -833,8 +833,8 @@ var require_Collection = __commonJS((exports) => {
833
833
  throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
834
834
  }
835
835
  }
836
- deleteIn(path) {
837
- const [key, ...rest] = path;
836
+ deleteIn(path2) {
837
+ const [key, ...rest] = path2;
838
838
  if (rest.length === 0)
839
839
  return this.delete(key);
840
840
  const node2 = this.get(key, true);
@@ -843,8 +843,8 @@ var require_Collection = __commonJS((exports) => {
843
843
  else
844
844
  throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
845
845
  }
846
- getIn(path, keepScalar) {
847
- const [key, ...rest] = path;
846
+ getIn(path2, keepScalar) {
847
+ const [key, ...rest] = path2;
848
848
  const node2 = this.get(key, true);
849
849
  if (rest.length === 0)
850
850
  return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
@@ -859,15 +859,15 @@ var require_Collection = __commonJS((exports) => {
859
859
  return n == null || allowScalar && identity.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
860
860
  });
861
861
  }
862
- hasIn(path) {
863
- const [key, ...rest] = path;
862
+ hasIn(path2) {
863
+ const [key, ...rest] = path2;
864
864
  if (rest.length === 0)
865
865
  return this.has(key);
866
866
  const node2 = this.get(key, true);
867
867
  return identity.isCollection(node2) ? node2.hasIn(rest) : false;
868
868
  }
869
- setIn(path, value) {
870
- const [key, ...rest] = path;
869
+ setIn(path2, value) {
870
+ const [key, ...rest] = path2;
871
871
  if (rest.length === 0) {
872
872
  this.set(key, value);
873
873
  } else {
@@ -3249,9 +3249,9 @@ var require_Document = __commonJS((exports) => {
3249
3249
  if (assertCollection(this.contents))
3250
3250
  this.contents.add(value);
3251
3251
  }
3252
- addIn(path, value) {
3252
+ addIn(path2, value) {
3253
3253
  if (assertCollection(this.contents))
3254
- this.contents.addIn(path, value);
3254
+ this.contents.addIn(path2, value);
3255
3255
  }
3256
3256
  createAlias(node2, name) {
3257
3257
  if (!node2.anchor) {
@@ -3300,30 +3300,30 @@ var require_Document = __commonJS((exports) => {
3300
3300
  delete(key) {
3301
3301
  return assertCollection(this.contents) ? this.contents.delete(key) : false;
3302
3302
  }
3303
- deleteIn(path) {
3304
- if (Collection.isEmptyPath(path)) {
3303
+ deleteIn(path2) {
3304
+ if (Collection.isEmptyPath(path2)) {
3305
3305
  if (this.contents == null)
3306
3306
  return false;
3307
3307
  this.contents = null;
3308
3308
  return true;
3309
3309
  }
3310
- return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
3310
+ return assertCollection(this.contents) ? this.contents.deleteIn(path2) : false;
3311
3311
  }
3312
3312
  get(key, keepScalar) {
3313
3313
  return identity.isCollection(this.contents) ? this.contents.get(key, keepScalar) : undefined;
3314
3314
  }
3315
- getIn(path, keepScalar) {
3316
- if (Collection.isEmptyPath(path))
3315
+ getIn(path2, keepScalar) {
3316
+ if (Collection.isEmptyPath(path2))
3317
3317
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3318
- return identity.isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : undefined;
3318
+ return identity.isCollection(this.contents) ? this.contents.getIn(path2, keepScalar) : undefined;
3319
3319
  }
3320
3320
  has(key) {
3321
3321
  return identity.isCollection(this.contents) ? this.contents.has(key) : false;
3322
3322
  }
3323
- hasIn(path) {
3324
- if (Collection.isEmptyPath(path))
3323
+ hasIn(path2) {
3324
+ if (Collection.isEmptyPath(path2))
3325
3325
  return this.contents !== undefined;
3326
- return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;
3326
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path2) : false;
3327
3327
  }
3328
3328
  set(key, value) {
3329
3329
  if (this.contents == null) {
@@ -3332,13 +3332,13 @@ var require_Document = __commonJS((exports) => {
3332
3332
  this.contents.set(key, value);
3333
3333
  }
3334
3334
  }
3335
- setIn(path, value) {
3336
- if (Collection.isEmptyPath(path)) {
3335
+ setIn(path2, value) {
3336
+ if (Collection.isEmptyPath(path2)) {
3337
3337
  this.contents = value;
3338
3338
  } else if (this.contents == null) {
3339
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);
3339
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path2), value);
3340
3340
  } else if (assertCollection(this.contents)) {
3341
- this.contents.setIn(path, value);
3341
+ this.contents.setIn(path2, value);
3342
3342
  }
3343
3343
  }
3344
3344
  setSchema(version, options = {}) {
@@ -5227,9 +5227,9 @@ var require_cst_visit = __commonJS((exports) => {
5227
5227
  visit.BREAK = BREAK;
5228
5228
  visit.SKIP = SKIP;
5229
5229
  visit.REMOVE = REMOVE;
5230
- visit.itemAtPath = (cst, path) => {
5230
+ visit.itemAtPath = (cst, path2) => {
5231
5231
  let item = cst;
5232
- for (const [field, index] of path) {
5232
+ for (const [field, index] of path2) {
5233
5233
  const tok = item?.[field];
5234
5234
  if (tok && "items" in tok) {
5235
5235
  item = tok.items[index];
@@ -5238,23 +5238,23 @@ var require_cst_visit = __commonJS((exports) => {
5238
5238
  }
5239
5239
  return item;
5240
5240
  };
5241
- visit.parentCollection = (cst, path) => {
5242
- const parent = visit.itemAtPath(cst, path.slice(0, -1));
5243
- const field = path[path.length - 1][0];
5241
+ visit.parentCollection = (cst, path2) => {
5242
+ const parent = visit.itemAtPath(cst, path2.slice(0, -1));
5243
+ const field = path2[path2.length - 1][0];
5244
5244
  const coll = parent?.[field];
5245
5245
  if (coll && "items" in coll)
5246
5246
  return coll;
5247
5247
  throw new Error("Parent collection not found");
5248
5248
  };
5249
- function _visit(path, item, visitor) {
5250
- let ctrl = visitor(item, path);
5249
+ function _visit(path2, item, visitor) {
5250
+ let ctrl = visitor(item, path2);
5251
5251
  if (typeof ctrl === "symbol")
5252
5252
  return ctrl;
5253
5253
  for (const field of ["key", "value"]) {
5254
5254
  const token = item[field];
5255
5255
  if (token && "items" in token) {
5256
5256
  for (let i = 0;i < token.items.length; ++i) {
5257
- const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
5257
+ const ci = _visit(Object.freeze(path2.concat([[field, i]])), token.items[i], visitor);
5258
5258
  if (typeof ci === "number")
5259
5259
  i = ci - 1;
5260
5260
  else if (ci === BREAK)
@@ -5265,10 +5265,10 @@ var require_cst_visit = __commonJS((exports) => {
5265
5265
  }
5266
5266
  }
5267
5267
  if (typeof ctrl === "function" && field === "key")
5268
- ctrl = ctrl(item, path);
5268
+ ctrl = ctrl(item, path2);
5269
5269
  }
5270
5270
  }
5271
- return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
5271
+ return typeof ctrl === "function" ? ctrl(item, path2) : ctrl;
5272
5272
  }
5273
5273
  exports.visit = visit;
5274
5274
  });
@@ -7178,8 +7178,8 @@ var require_utils = __commonJS((exports) => {
7178
7178
  }
7179
7179
  return output;
7180
7180
  };
7181
- exports.basename = (path, { windows } = {}) => {
7182
- const segs = path.split(windows ? /[\\/]/ : "/");
7181
+ exports.basename = (path2, { windows } = {}) => {
7182
+ const segs = path2.split(windows ? /[\\/]/ : "/");
7183
7183
  const last = segs[segs.length - 1];
7184
7184
  if (last === "") {
7185
7185
  return segs[segs.length - 2];
@@ -8662,7 +8662,7 @@ var require_picomatch2 = __commonJS((exports, module) => {
8662
8662
  // src/runner.ts
8663
8663
  import { readFile as readFile3 } from "node:fs/promises";
8664
8664
  import { createRequire as createRequire2 } from "node:module";
8665
- import path3 from "node:path";
8665
+ import path4 from "node:path";
8666
8666
  import { pathToFileURL } from "node:url";
8667
8667
 
8668
8668
  // ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
@@ -12755,6 +12755,51 @@ var FactRelation;
12755
12755
  FactRelation2["Supersedes"] = "supersedes";
12756
12756
  FactRelation2["References"] = "references";
12757
12757
  })(FactRelation ||= {});
12758
+ // ../core/src/types/refPointer.ts
12759
+ var REF_POINTER_PATTERN = /^ref:(entity|relation|content):(.+)$/;
12760
+ function parseRef(pointer) {
12761
+ const match = REF_POINTER_PATTERN.exec(pointer);
12762
+ if (!match) {
12763
+ return null;
12764
+ }
12765
+ const [, type, id] = match;
12766
+ if (!id) {
12767
+ return null;
12768
+ }
12769
+ return { type, id };
12770
+ }
12771
+ function buildRef(type, id) {
12772
+ return `ref:${type}:${id}`;
12773
+ }
12774
+ function isRefPointer(value) {
12775
+ return typeof value === "string" && parseRef(value) !== null;
12776
+ }
12777
+ function extractAllRefs(data) {
12778
+ const results = [];
12779
+ const visit = (value, path) => {
12780
+ if (typeof value === "string") {
12781
+ if (isRefPointer(value)) {
12782
+ results.push({ pointer: value, fieldPath: path });
12783
+ }
12784
+ return;
12785
+ }
12786
+ if (Array.isArray(value)) {
12787
+ value.forEach((item, index) => {
12788
+ const nextPath = path ? `${path}[${index}]` : `[${index}]`;
12789
+ visit(item, nextPath);
12790
+ });
12791
+ return;
12792
+ }
12793
+ if (value && typeof value === "object") {
12794
+ for (const [key, entry] of Object.entries(value)) {
12795
+ const nextPath = path ? `${path}.${key}` : key;
12796
+ visit(entry, nextPath);
12797
+ }
12798
+ }
12799
+ };
12800
+ visit(data, "");
12801
+ return results;
12802
+ }
12758
12803
  // ../core/src/types/docDigest.ts
12759
12804
  var confidenceAtomSchema = exports_external.number().min(0).max(1).optional().catch(undefined);
12760
12805
  var entityAtomSchema = exports_external.object({
@@ -12936,6 +12981,34 @@ var PathFilterConfigSchema = exports_external.object({
12936
12981
  exclude: exports_external.array(exports_external.string()).default([])
12937
12982
  }).default({})
12938
12983
  });
12984
+ var DEFAULT_PATH_FILTER = {
12985
+ package: {
12986
+ include: [
12987
+ "**/{package.json,pyproject.toml,setup.py,go.mod,Cargo.toml,pom.xml,build.gradle}"
12988
+ ]
12989
+ },
12990
+ code: {
12991
+ include: ["**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}"],
12992
+ exclude: [
12993
+ "**/__{tests,test,e2e,mocks,fixtures,snapshots}__/**",
12994
+ "**/*.{test,spec}.{ts,tsx,mts,cts,js,jsx,mjs,cjs}",
12995
+ "**/*.d.{ts,mts,cts}"
12996
+ ]
12997
+ },
12998
+ doc: {
12999
+ include: ["*.md", "docs/**/*.md"],
13000
+ exclude: ["**/CHANGELOG.md"]
13001
+ }
13002
+ };
13003
+ function resolvePathFilter(metadata) {
13004
+ const raw = metadata?.path_filter;
13005
+ if (raw == null)
13006
+ return { config: DEFAULT_PATH_FILTER, isDefault: true };
13007
+ const parsed = PathFilterConfigSchema.safeParse(raw);
13008
+ if (!parsed.success)
13009
+ return { config: DEFAULT_PATH_FILTER, isDefault: true };
13010
+ return { config: parsed.data, isDefault: false };
13011
+ }
12939
13012
  // ../core/src/schemas/baseSchema.ts
12940
13013
  var sourceRefSpanSchema = exports_external.object({
12941
13014
  start: exports_external.number().int().min(1),
@@ -13061,6 +13134,501 @@ var factSchema = exports_external.union([
13061
13134
  activeFactSchema,
13062
13135
  deprecatedFactSchema
13063
13136
  ]);
13137
+ // ../core/src/schemas/indexerEvidenceAdapterSchema.ts
13138
+ import { createHash } from "node:crypto";
13139
+
13140
+ // ../core/src/indexerOutputRedaction.ts
13141
+ var INDEXER_OUTPUT_REDACTION_MARKER = "[REDACTED:indexer-output]";
13142
+ var SECRET_TOKEN = /^(?:password|passwd|pwd|secret|token|credential|credentials|cookie)$/u;
13143
+ var SECRET_COMPOUND = /^(?:api-key|access-key|private-key|client-secret|access-token|refresh-token)$/u;
13144
+ var NON_SECRET_SUFFIX = new Set([
13145
+ "budget",
13146
+ "count",
13147
+ "digest",
13148
+ "fingerprint",
13149
+ "hash",
13150
+ "index",
13151
+ "kind",
13152
+ "length",
13153
+ "limit",
13154
+ "name",
13155
+ "ref",
13156
+ "reference",
13157
+ "references",
13158
+ "refs",
13159
+ "status",
13160
+ "type"
13161
+ ]);
13162
+ function keyTokens(key) {
13163
+ return key.replace(/([a-z0-9])([A-Z])/gu, "$1-$2").replace(/[^A-Za-z0-9]+/gu, "-").toLowerCase().split("-").filter(Boolean);
13164
+ }
13165
+ function sensitiveKey(key, value) {
13166
+ const tokens = keyTokens(key);
13167
+ if (tokens.length === 0)
13168
+ return false;
13169
+ const normalized = tokens.join("-");
13170
+ if (normalized === "authorization" && value !== null && typeof value === "object") {
13171
+ return false;
13172
+ }
13173
+ if (NON_SECRET_SUFFIX.has(tokens.at(-1)))
13174
+ return false;
13175
+ return SECRET_COMPOUND.test(normalized) || tokens.some((token) => SECRET_TOKEN.test(token)) || normalized === "authorization";
13176
+ }
13177
+ function escapeRegExp(value) {
13178
+ return value.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
13179
+ }
13180
+ function normalizedBlockedScalars(policy) {
13181
+ const identities = new Set;
13182
+ const values = [];
13183
+ for (const value of policy.blocked_scalars ?? []) {
13184
+ if (typeof value === "number" && !Number.isFinite(value))
13185
+ continue;
13186
+ if (typeof value === "string" && value.length === 0)
13187
+ continue;
13188
+ const identity = `${typeof value}:${String(value)}`;
13189
+ if (identities.has(identity))
13190
+ continue;
13191
+ identities.add(identity);
13192
+ values.push(value);
13193
+ }
13194
+ return values.sort((left, right) => String(right).length - String(left).length);
13195
+ }
13196
+ function replaceWithCount(value, pattern, replacement, count) {
13197
+ return value.replace(pattern, (...args) => {
13198
+ count.replacements += 1;
13199
+ if (typeof replacement === "string")
13200
+ return replacement;
13201
+ return replacement(...args.slice(0, -2));
13202
+ });
13203
+ }
13204
+ function redactKnownText(value, count) {
13205
+ let output = value;
13206
+ output = replaceWithCount(output, /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----[\s\S]*?-----END (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/gu, INDEXER_OUTPUT_REDACTION_MARKER, count);
13207
+ output = replaceWithCount(output, /(\bauthorization\s*:\s*(?:bearer|basic)\s+)[^\s,;]+/giu, (_match, prefix) => `${prefix}${INDEXER_OUTPUT_REDACTION_MARKER}`, count);
13208
+ output = replaceWithCount(output, /([a-z][a-z0-9+.-]*:\/\/)[^\s/@:]+:[^\s/@]+@/giu, (_match, prefix) => `${prefix}${INDEXER_OUTPUT_REDACTION_MARKER}@`, count);
13209
+ output = replaceWithCount(output, /([?&](?:access_token|refresh_token|api_key|password|secret)=)[^&#\s]+/giu, (_match, prefix) => `${prefix}${INDEXER_OUTPUT_REDACTION_MARKER}`, count);
13210
+ const key = "(?:[A-Za-z0-9_.-]*(?:password|passwd|pwd|secret|token|credential|cookie)[A-Za-z0-9_.-]*|api[-_]?key|access[-_]?(?:key|token)|private[-_]?key|client[-_]?secret|authorization)";
13211
+ const assignment = `(?:=\\s*|:\\s+(?=\\S)|:\\s*(?=["']))`;
13212
+ output = replaceWithCount(output, new RegExp(`((?:["']?${key}["']?)\\s*${assignment})(?:"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|[^\\s,;}\\]]+)`, "giu"), (_match, prefix) => `${prefix}"${INDEXER_OUTPUT_REDACTION_MARKER}"`, count);
13213
+ return output;
13214
+ }
13215
+ function redactBlockedText(value, blocked, count) {
13216
+ let output = value;
13217
+ for (const scalar of blocked) {
13218
+ const pattern = typeof scalar === "number" ? new RegExp(`(?<![0-9.])${escapeRegExp(String(scalar))}(?![0-9.])`, "gu") : new RegExp(escapeRegExp(scalar), "gu");
13219
+ output = replaceWithCount(output, pattern, INDEXER_OUTPUT_REDACTION_MARKER, count);
13220
+ }
13221
+ return output;
13222
+ }
13223
+ function redactText(value, blocked, count) {
13224
+ return redactBlockedText(redactKnownText(value, count), blocked, count);
13225
+ }
13226
+ function blockedScalar(value, blocked) {
13227
+ return blocked.some((candidate) => typeof candidate === typeof value && Object.is(candidate, value));
13228
+ }
13229
+ function redactStructured(value, blocked, count, seen) {
13230
+ if (blockedScalar(value, blocked)) {
13231
+ count.replacements += 1;
13232
+ return INDEXER_OUTPUT_REDACTION_MARKER;
13233
+ }
13234
+ if (typeof value === "string")
13235
+ return redactText(value, blocked, count);
13236
+ if (value === null || typeof value !== "object")
13237
+ return value;
13238
+ if (seen.has(value))
13239
+ throw new TypeError("Indexer output redaction requires an acyclic value");
13240
+ seen.add(value);
13241
+ if (value instanceof Date) {
13242
+ const redacted2 = redactText(value.toISOString(), blocked, count);
13243
+ seen.delete(value);
13244
+ return redacted2;
13245
+ }
13246
+ if (value instanceof Error) {
13247
+ const redacted2 = {
13248
+ name: redactText(value.name, blocked, count),
13249
+ message: redactText(value.message, blocked, count)
13250
+ };
13251
+ seen.delete(value);
13252
+ return redacted2;
13253
+ }
13254
+ if (Array.isArray(value)) {
13255
+ const redacted2 = value.map((item) => redactStructured(item, blocked, count, seen));
13256
+ seen.delete(value);
13257
+ return redacted2;
13258
+ }
13259
+ const redacted = {};
13260
+ for (const [key, item] of Object.entries(value)) {
13261
+ const safeKey = redactText(key, blocked, count);
13262
+ if (sensitiveKey(key, item)) {
13263
+ count.replacements += 1;
13264
+ redacted[safeKey] = INDEXER_OUTPUT_REDACTION_MARKER;
13265
+ } else {
13266
+ redacted[safeKey] = redactStructured(item, blocked, count, seen);
13267
+ }
13268
+ }
13269
+ seen.delete(value);
13270
+ return redacted;
13271
+ }
13272
+ function redactIndexerOutput(input) {
13273
+ const count = { replacements: 0 };
13274
+ const blocked = normalizedBlockedScalars(input.policy ?? {});
13275
+ const value = typeof input.value === "string" ? redactText(input.value, blocked, count) : redactStructured(input.value, blocked, count, new WeakSet);
13276
+ return {
13277
+ value,
13278
+ redacted: count.replacements > 0,
13279
+ replacement_count: count.replacements
13280
+ };
13281
+ }
13282
+ function redactIndexerOutputText(input) {
13283
+ return redactIndexerOutput(input).value;
13284
+ }
13285
+ function assertIndexerOutputSafe(input) {
13286
+ const result = redactIndexerOutput(input);
13287
+ if (result.redacted) {
13288
+ throw new TypeError(`Indexer ${input.channel} was blocked by the common output redaction boundary`);
13289
+ }
13290
+ return input.value;
13291
+ }
13292
+
13293
+ // ../core/src/schemas/indexerEvidenceAdapterSchema.ts
13294
+ var digestSchema = exports_external.string().regex(/^sha256:[a-f0-9]{64}$/u);
13295
+ var idSchema = exports_external.string().regex(/^[a-z0-9][a-z0-9._/-]*$/u).superRefine((value, context) => {
13296
+ if (value.split("/").some((segment) => segment.length === 0 || segment === "." || segment === "..")) {
13297
+ context.addIssue({
13298
+ code: exports_external.ZodIssueCode.custom,
13299
+ message: "must not contain empty, current-directory, or parent-directory segments"
13300
+ });
13301
+ }
13302
+ });
13303
+ var semverSchema = exports_external.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u);
13304
+ var canonicalRefSchema = exports_external.string().regex(/^[a-z][a-z0-9.-]*:[A-Za-z0-9][A-Za-z0-9._~:/#@+-]*$/u);
13305
+ var packageCoordinateSchema = exports_external.string().regex(/^(?:@[a-z0-9._-]+\/)?[a-z0-9][a-z0-9._-]*$/u);
13306
+ var portablePathSchema = exports_external.string().superRefine((value, context) => {
13307
+ const segments = value.split("/");
13308
+ if (value.length === 0 || value.includes("\x00") || value.includes("\\") || value.startsWith("/") || /^[A-Za-z]:\//u.test(value) || segments.some((segment) => segment.length === 0 || segment === "." || segment === "..")) {
13309
+ context.addIssue({
13310
+ code: exports_external.ZodIssueCode.custom,
13311
+ message: "must be a portable relative path"
13312
+ });
13313
+ }
13314
+ });
13315
+ function addDuplicateIssues(values, context, field) {
13316
+ const seen = new Set;
13317
+ values.forEach((value, index) => {
13318
+ if (seen.has(value)) {
13319
+ context.addIssue({
13320
+ code: exports_external.ZodIssueCode.custom,
13321
+ message: `${field} must not contain duplicate value ${value}`,
13322
+ path: [index]
13323
+ });
13324
+ }
13325
+ seen.add(value);
13326
+ });
13327
+ }
13328
+ var adapterIdentitySchema = exports_external.object({
13329
+ id: idSchema,
13330
+ package: packageCoordinateSchema,
13331
+ export: exports_external.string().regex(/^[A-Za-z_$][A-Za-z0-9_$.-]*$/u),
13332
+ version: semverSchema,
13333
+ digest: digestSchema
13334
+ }).strict();
13335
+ var adapterLocatorSchema = exports_external.object({
13336
+ source_ref: canonicalRefSchema,
13337
+ module_ref: canonicalRefSchema.nullable(),
13338
+ normalized_path: portablePathSchema,
13339
+ qualified_item_path: exports_external.string().min(1).max(1024),
13340
+ signature_digest: digestSchema
13341
+ }).strict();
13342
+ var indexerEvidenceAdapterFactSchema = exports_external.object({
13343
+ fact_ref: canonicalRefSchema,
13344
+ kind: idSchema,
13345
+ locator: adapterLocatorSchema,
13346
+ payload_digest: digestSchema,
13347
+ denominator: exports_external.enum(["none", "eligible-file", "loc", "symbol", "protocol-item"])
13348
+ }).strict();
13349
+ var indexerEvidenceAdapterFileSchema = exports_external.object({
13350
+ file_ref: canonicalRefSchema,
13351
+ source_ref: canonicalRefSchema,
13352
+ module_ref: canonicalRefSchema.nullable(),
13353
+ normalized_path: portablePathSchema,
13354
+ role: exports_external.enum(["primary-owner", "enricher"]),
13355
+ coverage_tier: exports_external.enum(["ast-catalog", "lightweight-evidence"]),
13356
+ disposition: exports_external.enum(["analyzed", "unsupported", "excluded"]),
13357
+ facts: exports_external.array(indexerEvidenceAdapterFactSchema)
13358
+ }).strict().superRefine((value, context) => {
13359
+ addDuplicateIssues(value.facts.map((fact2) => fact2.fact_ref), context, "facts");
13360
+ if (value.disposition !== "analyzed" && value.facts.length > 0) {
13361
+ context.addIssue({
13362
+ code: exports_external.ZodIssueCode.custom,
13363
+ message: "unsupported or excluded files cannot publish facts",
13364
+ path: ["facts"]
13365
+ });
13366
+ }
13367
+ if ((value.role === "enricher" || value.coverage_tier === "lightweight-evidence") && value.facts.some((fact2) => fact2.denominator !== "none")) {
13368
+ context.addIssue({
13369
+ code: exports_external.ZodIssueCode.custom,
13370
+ message: "enricher and lightweight evidence facts cannot contribute denominators",
13371
+ path: ["facts"]
13372
+ });
13373
+ }
13374
+ });
13375
+ var toolchainStepSchema = exports_external.object({
13376
+ step: idSchema,
13377
+ package: packageCoordinateSchema,
13378
+ export: exports_external.string().regex(/^[A-Za-z_$][A-Za-z0-9_$.-]*$/u),
13379
+ version: semverSchema,
13380
+ digest: digestSchema,
13381
+ capabilities: exports_external.array(idSchema).min(1),
13382
+ input_digest: digestSchema,
13383
+ output_digest: digestSchema
13384
+ }).strict().superRefine((value, context) => {
13385
+ addDuplicateIssues(value.capabilities, context, "capabilities");
13386
+ });
13387
+ var adapterDiagnosticSchema = exports_external.object({
13388
+ code: idSchema,
13389
+ fact_ref: canonicalRefSchema.optional(),
13390
+ severity: exports_external.enum(["info", "warning", "error"]),
13391
+ detail_digest: digestSchema
13392
+ }).strict();
13393
+ var indexerEvidenceAdapterResultSchema = exports_external.object({
13394
+ protocol: exports_external.literal("context.indexer.evidence-adapter-result/v1"),
13395
+ adapter: adapterIdentitySchema,
13396
+ authorized_scope: exports_external.object({
13397
+ source_ref: canonicalRefSchema,
13398
+ module_refs: exports_external.array(canonicalRefSchema),
13399
+ scope_digest: digestSchema
13400
+ }).strict(),
13401
+ input_digest: digestSchema,
13402
+ precedence: exports_external.number().int().nonnegative(),
13403
+ files: exports_external.array(indexerEvidenceAdapterFileSchema).min(1),
13404
+ diagnostics: exports_external.array(adapterDiagnosticSchema),
13405
+ toolchain: exports_external.array(toolchainStepSchema).min(1),
13406
+ output_digest: digestSchema
13407
+ }).strict().superRefine((value, context) => {
13408
+ addDuplicateIssues(value.authorized_scope.module_refs, context, "authorized_scope.module_refs");
13409
+ addDuplicateIssues(value.files.map((file) => file.file_ref), context, "files");
13410
+ addDuplicateIssues(value.toolchain.map((step) => step.step), context, "toolchain");
13411
+ });
13412
+ var FACT_PAYLOADS = new WeakMap;
13413
+ function canonicalFactPayload(value, seen = new WeakSet, path = "$") {
13414
+ if (value === null || typeof value === "boolean" || typeof value === "string") {
13415
+ return value;
13416
+ }
13417
+ if (typeof value === "number") {
13418
+ if (!Number.isFinite(value)) {
13419
+ throw new TypeError("Indexer Evidence Adapter fact payload numbers must be finite");
13420
+ }
13421
+ return value;
13422
+ }
13423
+ if (typeof value !== "object") {
13424
+ throw new TypeError(`Indexer Evidence Adapter fact payload ${path} must contain only JSON values`);
13425
+ }
13426
+ if (seen.has(value)) {
13427
+ throw new TypeError(`Indexer Evidence Adapter fact payload ${path} must be acyclic`);
13428
+ }
13429
+ seen.add(value);
13430
+ if (Array.isArray(value)) {
13431
+ const output2 = value.map((item, index) => canonicalFactPayload(item, seen, `${path}[${index}]`));
13432
+ seen.delete(value);
13433
+ return output2;
13434
+ }
13435
+ if (Object.prototype.toString.call(value) !== "[object Object]") {
13436
+ throw new TypeError(`Indexer Evidence Adapter fact payload ${path} must use plain JSON objects; received ${Object.prototype.toString.call(value)}`);
13437
+ }
13438
+ const output = {};
13439
+ for (const [key, item] of Object.entries(value).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0)) {
13440
+ output[key] = canonicalFactPayload(item, seen, `${path}.${key}`);
13441
+ }
13442
+ seen.delete(value);
13443
+ return output;
13444
+ }
13445
+ function canonicalize(value) {
13446
+ if (Array.isArray(value))
13447
+ return value.map(canonicalize);
13448
+ if (value !== null && typeof value === "object") {
13449
+ return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([key, item]) => [key, canonicalize(item)]));
13450
+ }
13451
+ return value;
13452
+ }
13453
+ function indexerEvidenceAdapterProtocolDigest(value) {
13454
+ const canonical = JSON.stringify(canonicalize(value));
13455
+ return `sha256:${createHash("sha256").update(canonical).digest("hex")}`;
13456
+ }
13457
+ function indexerEvidenceAdapterFileRef(input) {
13458
+ return `adapter-file:${indexerEvidenceAdapterProtocolDigest(input)}`;
13459
+ }
13460
+ function indexerEvidenceAdapterFactRef(input) {
13461
+ return `adapter-fact:${indexerEvidenceAdapterProtocolDigest(input)}`;
13462
+ }
13463
+ function createIndexerEvidenceAdapterFact(input) {
13464
+ const payload = canonicalFactPayload(input.payload);
13465
+ const qualifiedItemPath = input.qualified_item_path.length <= 1024 ? input.qualified_item_path : `${input.qualified_item_path.slice(0, 950)}#${indexerEvidenceAdapterProtocolDigest(input.qualified_item_path)}`;
13466
+ const locator = {
13467
+ source_ref: input.source_ref,
13468
+ module_ref: input.module_ref,
13469
+ normalized_path: input.normalized_path,
13470
+ qualified_item_path: qualifiedItemPath,
13471
+ signature_digest: indexerEvidenceAdapterProtocolDigest(input.signature)
13472
+ };
13473
+ const fact2 = {
13474
+ fact_ref: indexerEvidenceAdapterFactRef({ ...locator, kind: input.kind }),
13475
+ kind: input.kind,
13476
+ locator,
13477
+ payload_digest: indexerEvidenceAdapterProtocolDigest(payload),
13478
+ denominator: input.denominator
13479
+ };
13480
+ FACT_PAYLOADS.set(fact2, payload);
13481
+ return fact2;
13482
+ }
13483
+ function indexerEvidenceAdapterFactPayloads(result) {
13484
+ const payloads = result.files.flatMap((file) => file.facts.map((fact2) => {
13485
+ const payload = FACT_PAYLOADS.get(fact2);
13486
+ if (payload === undefined) {
13487
+ throw new TypeError(`Evidence Adapter fact payload ${fact2.fact_ref} is no longer materialized in this process`);
13488
+ }
13489
+ if (indexerEvidenceAdapterProtocolDigest(payload) !== fact2.payload_digest) {
13490
+ throw new TypeError(`Evidence Adapter fact payload ${fact2.fact_ref} is stale`);
13491
+ }
13492
+ return { fact_ref: fact2.fact_ref, payload };
13493
+ })).sort((left, right) => compareCanonicalText(left.fact_ref, right.fact_ref));
13494
+ return assertIndexerOutputSafe({ channel: "ipc-envelope", value: payloads });
13495
+ }
13496
+ function materializeIndexerEvidenceAdapterResult(result) {
13497
+ return {
13498
+ result,
13499
+ fact_payloads: indexerEvidenceAdapterFactPayloads(result)
13500
+ };
13501
+ }
13502
+ function indexerEvidenceAdapterOutputDigest(value) {
13503
+ return indexerEvidenceAdapterProtocolDigest(value);
13504
+ }
13505
+ function compareCanonicalText(left, right) {
13506
+ if (left < right)
13507
+ return -1;
13508
+ if (left > right)
13509
+ return 1;
13510
+ return 0;
13511
+ }
13512
+ function buildIndexerEvidenceAdapterResult(input) {
13513
+ const canonical = {
13514
+ ...input,
13515
+ authorized_scope: {
13516
+ ...input.authorized_scope,
13517
+ module_refs: [...input.authorized_scope.module_refs].sort(compareCanonicalText)
13518
+ },
13519
+ files: input.files.map((file) => ({
13520
+ ...file,
13521
+ facts: [...file.facts].sort((left, right) => compareCanonicalText(left.fact_ref, right.fact_ref))
13522
+ })).sort((left, right) => compareCanonicalText(left.file_ref, right.file_ref)),
13523
+ diagnostics: [...input.diagnostics].sort((left, right) => compareCanonicalText(left.fact_ref ?? "", right.fact_ref ?? "") || compareCanonicalText(left.code, right.code) || compareCanonicalText(left.severity, right.severity) || compareCanonicalText(left.detail_digest, right.detail_digest)),
13524
+ toolchain: input.toolchain.map((step) => ({
13525
+ ...step,
13526
+ capabilities: [...step.capabilities].sort(compareCanonicalText)
13527
+ }))
13528
+ };
13529
+ const payloads = new Map;
13530
+ for (const file of canonical.files) {
13531
+ for (const fact2 of file.facts) {
13532
+ const payload = FACT_PAYLOADS.get(fact2);
13533
+ if (payload !== undefined)
13534
+ payloads.set(fact2.fact_ref, payload);
13535
+ }
13536
+ }
13537
+ const parsed = indexerEvidenceAdapterResultSchema.parse({
13538
+ ...canonical,
13539
+ output_digest: indexerEvidenceAdapterOutputDigest(canonical)
13540
+ });
13541
+ for (const file of parsed.files) {
13542
+ for (const fact2 of file.facts) {
13543
+ const payload = payloads.get(fact2.fact_ref);
13544
+ if (payload !== undefined)
13545
+ FACT_PAYLOADS.set(fact2, payload);
13546
+ }
13547
+ }
13548
+ return assertIndexerOutputSafe({ channel: "success-payload", value: parsed });
13549
+ }
13550
+ // ../core/src/errors/c4aError.ts
13551
+ class C4AError extends Error {
13552
+ code;
13553
+ details;
13554
+ constructor(code, message, details, options) {
13555
+ super(message, options);
13556
+ this.name = "C4AError";
13557
+ this.code = code;
13558
+ this.details = details;
13559
+ }
13560
+ toResponse() {
13561
+ if (this.details === undefined) {
13562
+ return { code: this.code, message: this.message };
13563
+ }
13564
+ return { code: this.code, message: this.message, details: this.details };
13565
+ }
13566
+ }
13567
+ // ../core/src/errors/errorCodes.ts
13568
+ var ErrorCode;
13569
+ ((ErrorCode2) => {
13570
+ ErrorCode2["VALIDATION_FAILED"] = "VALIDATION_FAILED";
13571
+ ErrorCode2["VALIDATION_SCHEMA"] = "VALIDATION_SCHEMA";
13572
+ ErrorCode2["STORAGE_FAILED"] = "STORAGE_FAILED";
13573
+ ErrorCode2["STORAGE_NOT_FOUND"] = "STORAGE_NOT_FOUND";
13574
+ ErrorCode2["STORAGE_CONFLICT"] = "STORAGE_CONFLICT";
13575
+ ErrorCode2["PARSE_FAILED"] = "PARSE_FAILED";
13576
+ ErrorCode2["PARSE_YAML"] = "PARSE_YAML";
13577
+ ErrorCode2["API_NOT_IMPLEMENTED"] = "API_NOT_IMPLEMENTED";
13578
+ ErrorCode2["API_UNAUTHORIZED"] = "API_UNAUTHORIZED";
13579
+ ErrorCode2["API_RATE_LIMITED"] = "API_RATE_LIMITED";
13580
+ ErrorCode2["ENTITY_NOT_FOUND"] = "ENTITY_NOT_FOUND";
13581
+ ErrorCode2["ENTITY_DUPLICATE"] = "ENTITY_DUPLICATE";
13582
+ ErrorCode2["RELATION_INVALID"] = "RELATION_INVALID";
13583
+ ErrorCode2["BATCH_PARTIAL_FAILURE"] = "BATCH_PARTIAL_FAILURE";
13584
+ ErrorCode2["QUERY_INVALID_PARAMS"] = "QUERY_INVALID_PARAMS";
13585
+ ErrorCode2["BACKUP_FAILED"] = "BACKUP_FAILED";
13586
+ ErrorCode2["RESTORE_FAILED"] = "RESTORE_FAILED";
13587
+ ErrorCode2["PURGE_FAILED"] = "PURGE_FAILED";
13588
+ ErrorCode2["BACKUP_VERSION_INCOMPATIBLE"] = "BACKUP_VERSION_INCOMPATIBLE";
13589
+ ErrorCode2["BACKUP_MANIFEST_INVALID"] = "BACKUP_MANIFEST_INVALID";
13590
+ ErrorCode2["BACKUP_DIR_NOT_FOUND"] = "BACKUP_DIR_NOT_FOUND";
13591
+ ErrorCode2["EMBEDDING_NOT_AVAILABLE"] = "EMBEDDING_NOT_AVAILABLE";
13592
+ ErrorCode2["EMBEDDING_FAILED"] = "EMBEDDING_FAILED";
13593
+ ErrorCode2["LLM_NOT_AVAILABLE"] = "LLM_NOT_AVAILABLE";
13594
+ ErrorCode2["LLM_CALL_FAILED"] = "LLM_CALL_FAILED";
13595
+ ErrorCode2["LLM_AUTH_FAILED"] = "LLM_AUTH_FAILED";
13596
+ ErrorCode2["AUTH_REQUIRED"] = "AUTH_REQUIRED";
13597
+ ErrorCode2["AUTH_INVALID_TOKEN"] = "AUTH_INVALID_TOKEN";
13598
+ ErrorCode2["AUTH_INVALID_API_KEY"] = "AUTH_INVALID_API_KEY";
13599
+ ErrorCode2["AUTH_PROVIDER_ERROR"] = "AUTH_PROVIDER_ERROR";
13600
+ ErrorCode2["AUTH_RESERVED_NAME"] = "AUTH_RESERVED_NAME";
13601
+ ErrorCode2["DAEMON_OFFLINE"] = "DAEMON_OFFLINE";
13602
+ ErrorCode2["SOURCE_NOT_FOUND"] = "SOURCE_NOT_FOUND";
13603
+ ErrorCode2["REPO_PATH_NOT_FOUND"] = "REPO_PATH_NOT_FOUND";
13604
+ ErrorCode2["COMMIT_NOT_FOUND"] = "COMMIT_NOT_FOUND";
13605
+ ErrorCode2["INDEX_IN_PROGRESS"] = "INDEX_IN_PROGRESS";
13606
+ ErrorCode2["DIGEST_NOT_FOUND"] = "DIGEST_NOT_FOUND";
13607
+ ErrorCode2["INVALID_REGEX"] = "INVALID_REGEX";
13608
+ ErrorCode2["SOURCE_ACCESS_DENIED"] = "SOURCE_ACCESS_DENIED";
13609
+ ErrorCode2["NOT_INDEXED"] = "NOT_INDEXED";
13610
+ ErrorCode2["QUERY_TIMEOUT"] = "QUERY_TIMEOUT";
13611
+ ErrorCode2["INTENT_NOT_AVAILABLE"] = "INTENT_NOT_AVAILABLE";
13612
+ ErrorCode2["SUB_PATH_CONFLICT"] = "SUB_PATH_CONFLICT";
13613
+ ErrorCode2["WORKSPACE_ISOLATION"] = "WORKSPACE_ISOLATION";
13614
+ ErrorCode2["VECTOR_DIMENSION_MISMATCH"] = "VECTOR_DIMENSION_MISMATCH";
13615
+ ErrorCode2["VECTOR_REBUILD_PARTIAL"] = "VECTOR_REBUILD_PARTIAL";
13616
+ ErrorCode2["COMMIT_NOT_AVAILABLE"] = "COMMIT_NOT_AVAILABLE";
13617
+ ErrorCode2["DAEMON_AUTO_START_FAILED"] = "DAEMON_AUTO_START_FAILED";
13618
+ ErrorCode2["GIT_ARCHIVE_FAILED"] = "GIT_ARCHIVE_FAILED";
13619
+ ErrorCode2["GIT_HOST_NOT_CONFIGURED"] = "GIT_HOST_NOT_CONFIGURED";
13620
+ ErrorCode2["GIT_API_RATE_LIMITED"] = "GIT_API_RATE_LIMITED";
13621
+ ErrorCode2["GIT_API_TREE_TRUNCATED"] = "GIT_API_TREE_TRUNCATED";
13622
+ ErrorCode2["GIT_API_AUTH_FAILED"] = "GIT_API_AUTH_FAILED";
13623
+ ErrorCode2["GIT_API_REPO_NOT_FOUND"] = "GIT_API_REPO_NOT_FOUND";
13624
+ ErrorCode2["GIT_API_NETWORK_ERROR"] = "GIT_API_NETWORK_ERROR";
13625
+ ErrorCode2["DOC_INDEX_LLM_UNAVAILABLE"] = "DOC_INDEX_LLM_UNAVAILABLE";
13626
+ ErrorCode2["DOC_INDEX_EMBEDDING_UNAVAILABLE"] = "DOC_INDEX_EMBEDDING_UNAVAILABLE";
13627
+ ErrorCode2["DOC_INDEX_CONTENT_MISSING"] = "DOC_INDEX_CONTENT_MISSING";
13628
+ ErrorCode2["DOC_INDEX_PARSE_FAILED"] = "DOC_INDEX_PARSE_FAILED";
13629
+ ErrorCode2["DOC_INDEX_LLM_EXHAUSTED"] = "DOC_INDEX_LLM_EXHAUSTED";
13630
+ ErrorCode2["UNKNOWN"] = "UNKNOWN";
13631
+ })(ErrorCode ||= {});
13064
13632
  // ../core/src/errors/httpStatus.ts
13065
13633
  var ERROR_CODE_HTTP_STATUS = {
13066
13634
  ["VALIDATION_FAILED" /* VALIDATION_FAILED */]: 400,
@@ -13125,21 +13693,102 @@ var ERROR_CODE_HTTP_STATUS = {
13125
13693
  ["UNKNOWN" /* UNKNOWN */]: 500,
13126
13694
  ["WORKSPACE_ISOLATION" /* WORKSPACE_ISOLATION */]: 400
13127
13695
  };
13696
+ function mapErrorCodeToStatus(code) {
13697
+ return ERROR_CODE_HTTP_STATUS[code] ?? 500;
13698
+ }
13699
+ // ../core/src/utils/id.ts
13700
+ import { createHash as createHash2, randomUUID } from "node:crypto";
13701
+ function generateId(type, parentId, name) {
13702
+ const input = `${type}:${parentId}:${name}`;
13703
+ const hash = createHash2("sha256").update(input).digest("hex");
13704
+ const hex32 = hash.slice(0, 32);
13705
+ return `${type}_${hex32}`;
13706
+ }
13707
+ function generateUUID() {
13708
+ return randomUUID();
13709
+ }
13128
13710
  // ../core/src/utils/hash.ts
13129
- import { createHash } from "node:crypto";
13711
+ import { createHash as createHash3 } from "node:crypto";
13130
13712
  function contentHash(content) {
13131
- return createHash("sha256").update(content).digest("hex");
13713
+ return createHash3("sha256").update(content).digest("hex");
13714
+ }
13715
+ // ../core/src/utils/object.ts
13716
+ function isPlainObject(value) {
13717
+ return typeof value === "object" && value !== null && !Array.isArray(value);
13718
+ }
13719
+ function mergeDefaults(defaults, override) {
13720
+ const result = { ...defaults };
13721
+ for (const [key, value] of Object.entries(override)) {
13722
+ if (!(key in defaults))
13723
+ continue;
13724
+ const defaultValue = defaults[key];
13725
+ if (isPlainObject(defaultValue)) {
13726
+ if (isPlainObject(value)) {
13727
+ result[key] = mergeDefaults(defaultValue, value);
13728
+ }
13729
+ } else if (value !== undefined && value !== null) {
13730
+ result[key] = value;
13731
+ }
13732
+ }
13733
+ return result;
13734
+ }
13735
+ // ../core/src/utils/path.ts
13736
+ import path from "node:path";
13737
+ function isPathSafe(inputPath) {
13738
+ if (inputPath.length === 0) {
13739
+ return false;
13740
+ }
13741
+ if (inputPath.includes("\x00")) {
13742
+ return false;
13743
+ }
13744
+ if (path.isAbsolute(inputPath)) {
13745
+ return false;
13746
+ }
13747
+ if (/^[a-zA-Z]:/.test(inputPath)) {
13748
+ return false;
13749
+ }
13750
+ if (inputPath.startsWith("~")) {
13751
+ return false;
13752
+ }
13753
+ const normalized = path.posix.normalize(inputPath.replaceAll("\\", "/"));
13754
+ const parts = normalized.split("/");
13755
+ return !parts.some((part) => part === ".." || part === "");
13132
13756
  }
13133
13757
  // ../core/src/utils/yaml.ts
13134
13758
  var import_yaml = __toESM(require_dist(), 1);
13759
+ function serializeYaml(value) {
13760
+ return import_yaml.default.stringify(value);
13761
+ }
13762
+ function parseYaml(value) {
13763
+ try {
13764
+ return import_yaml.default.parse(value);
13765
+ } catch (error) {
13766
+ const message = error instanceof Error ? error.message : "Failed to parse YAML";
13767
+ throw new C4AError("PARSE_YAML" /* PARSE_YAML */, message, { input: value });
13768
+ }
13769
+ }
13135
13770
  // ../core/src/utils/glob.ts
13136
13771
  var import_picomatch = __toESM(require_picomatch2(), 1);
13772
+ var globToRegex = (glob) => import_picomatch.default.makeRe(glob, { dot: false });
13137
13773
  function createPathMatcher(rules) {
13138
13774
  if (rules.include.length === 0)
13139
13775
  return () => false;
13140
13776
  const isIncluded = import_picomatch.default(rules.include, { dot: false });
13141
13777
  const isExcluded = rules.exclude.length > 0 ? import_picomatch.default(rules.exclude, { dot: false }) : () => false;
13142
- return (path) => isIncluded(path) && !isExcluded(path);
13778
+ return (path2) => isIncluded(path2) && !isExcluded(path2);
13779
+ }
13780
+ function matchesPathFilter(path2, category, config) {
13781
+ const section = config[category];
13782
+ const include = section.include;
13783
+ const exclude = "exclude" in section ? section.exclude : [];
13784
+ if (include.length === 0)
13785
+ return false;
13786
+ const isIncluded = import_picomatch.default.isMatch(path2, include, { dot: false });
13787
+ if (!isIncluded)
13788
+ return false;
13789
+ if (exclude.length > 0 && import_picomatch.default.isMatch(path2, exclude, { dot: false }))
13790
+ return false;
13791
+ return true;
13143
13792
  }
13144
13793
  // ../core/src/utils/version.ts
13145
13794
  var VERSION_LABEL_REGEX = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(alpha|beta|rc)\.(0|[1-9]\d*))?$/i;
@@ -13176,7 +13825,38 @@ function encodeVersionLabel(label) {
13176
13825
  }
13177
13826
  return major * 1e6 + minor * 1e4 + patch * 100 + prerelease;
13178
13827
  }
13828
+ function isVersionVisible(record, versionCode) {
13829
+ if (versionCode == null) {
13830
+ return true;
13831
+ }
13832
+ return (record.valid_from == null || record.valid_from <= versionCode) && (record.valid_until == null || record.valid_until > versionCode);
13833
+ }
13834
+ // ../core/src/utils/factContent.ts
13835
+ var SEARCH_PREFIX_RE = /^\[c4a:search [^\]\n]+\]\n\n/;
13836
+ function buildSearchPrefix(keywords) {
13837
+ if (!keywords || keywords.length === 0)
13838
+ return "";
13839
+ const cleaned = keywords.map((k) => k.trim()).filter((k) => k.length > 0);
13840
+ if (cleaned.length === 0)
13841
+ return "";
13842
+ return `[c4a:search ${cleaned.join(" ")}]
13843
+
13844
+ `;
13845
+ }
13846
+ function stripSearchPrefix(content) {
13847
+ if (!content)
13848
+ return content ?? "";
13849
+ return content.replace(SEARCH_PREFIX_RE, "");
13850
+ }
13179
13851
  // ../core/src/constants.ts
13852
+ var DEFAULT_WORKSPACE_NAME = "My Brain";
13853
+ var DEFAULT_CLOUD_LIBRARY_NAME = "My Drive";
13854
+ var SUPERTEST_EMAIL = "supertest@context4ai.org";
13855
+ var SUPERTEST_USER_NAME = "SuperTest";
13856
+ var RESERVED_USER_NAMES = ["SuperTest"];
13857
+ var DAEMON_HEARTBEAT_INTERVAL = 30000;
13858
+ var DAEMON_OFFLINE_THRESHOLD = 60000;
13859
+ var CLOUD_DAEMON_IDLE_TIMEOUT = 300000;
13180
13860
  var SCAN_EXCLUDED_DIRS = new Set([
13181
13861
  ".git",
13182
13862
  ".svn",
@@ -13212,6 +13892,17 @@ var SCAN_EXCLUDED_DIRS = new Set([
13212
13892
  "fixtures",
13213
13893
  ".tmp"
13214
13894
  ]);
13895
+ var CODE_DIGEST_TYPE = "code_tc_b";
13896
+ var hasExcludedSegment = (filePath) => {
13897
+ const segments = filePath.split("/");
13898
+ for (let i = 0;i < segments.length - 1; i++) {
13899
+ const seg = segments[i];
13900
+ if (SCAN_EXCLUDED_DIRS.has(seg) || seg.startsWith(".") && seg !== "." || seg.endsWith(".egg-info")) {
13901
+ return true;
13902
+ }
13903
+ }
13904
+ return false;
13905
+ };
13215
13906
  // ../core/src/contentTypeRegistry.ts
13216
13907
  var DEFAULT_CONTENT_TYPES = [
13217
13908
  {
@@ -13225,7 +13916,15 @@ var DEFAULT_CONTENT_TYPES = [
13225
13916
  {
13226
13917
  id: "typescript",
13227
13918
  category: "code",
13228
- match: { extensions: [".ts", ".tsx"] },
13919
+ match: { extensions: [".ts", ".tsx", ".mts", ".cts"] },
13920
+ cas: { encoding: "utf8", hashInput: "content" },
13921
+ pipeline: { digest: ["ast", "summary"], extraction: ["entities", "relations"] },
13922
+ display: { icon: "\uD83D\uDCDC", renderer: "code" }
13923
+ },
13924
+ {
13925
+ id: "javascript",
13926
+ category: "code",
13927
+ match: { extensions: [".js", ".jsx", ".mjs", ".cjs"] },
13229
13928
  cas: { encoding: "utf8", hashInput: "content" },
13230
13929
  pipeline: { digest: ["ast", "summary"], extraction: ["entities", "relations"] },
13231
13930
  display: { icon: "\uD83D\uDCDC", renderer: "code" }
@@ -13333,6 +14032,15 @@ var INDEXABLE_EXTENSIONS = new Set([
13333
14032
  var UPLOAD_ALLOWED_EXTENSIONS = collectExtensions(() => true);
13334
14033
  var TEXT_EXTENSIONS = collectExtensions((definition) => definition.cas.encoding === "utf8");
13335
14034
  var UPLOAD_MAX_FILE_SIZE = 5 * 1024 * 1024;
14035
+ var UPLOAD_MAX_FILES = 20;
14036
+ function getFileExtension(name) {
14037
+ const dot = name.lastIndexOf(".");
14038
+ return dot >= 0 ? name.slice(dot).toLowerCase() : "";
14039
+ }
14040
+ function isIndexableFile(fileName, manifestFiles) {
14041
+ const baseName = fileName.includes("/") ? fileName.split("/").pop() : fileName;
14042
+ return defaultRegistry.resolve(baseName) !== null;
14043
+ }
13336
14044
  // src/digest.ts
13337
14045
  var sortUniqueNames = (symbols) => [...new Set(symbols.map((symbol) => symbol.name))].sort((left, right) => left.localeCompare(right));
13338
14046
  var deduplicateSymbols = (symbols) => {
@@ -13356,6 +14064,7 @@ var generateDigest = (result) => {
13356
14064
  files: result.files,
13357
14065
  symbols: allSymbols,
13358
14066
  relations: result.relations,
14067
+ ...result.coverage ? { coverage: result.coverage } : {},
13359
14068
  stats: {
13360
14069
  files: result.stats.files,
13361
14070
  lines: result.stats.lines,
@@ -13699,7 +14408,7 @@ var buildCodeSnapshot = (input) => {
13699
14408
 
13700
14409
  // src/repository.ts
13701
14410
  import { readFile as readFile2, readdir as readdir2, stat } from "node:fs/promises";
13702
- import path2 from "node:path";
14411
+ import path3 from "node:path";
13703
14412
 
13704
14413
  // src/registry.ts
13705
14414
  var MANIFEST_LANGUAGE_CANDIDATES = {
@@ -13748,11 +14457,20 @@ import { promisify } from "node:util";
13748
14457
  var execFileAsync = promisify(execFile);
13749
14458
  var isScanExcludedDir = (name) => SCAN_EXCLUDED_DIRS.has(name) || name.startsWith(".") && name !== "." || name.endsWith(".egg-info");
13750
14459
  var DEFAULT_EXCLUDED_FILE_PATTERNS = [
13751
- /\.test\.ts$/i,
13752
- /\.spec\.ts$/i,
13753
- /\.d\.ts$/i
14460
+ /\.test\.(?:[cm]?[jt]sx?)$/i,
14461
+ /\.spec\.(?:[cm]?[jt]sx?)$/i,
14462
+ /\.d\.(?:ts|mts|cts)$/i
13754
14463
  ];
13755
- var SUPPORTED_EXTENSIONS = new Set([".ts", ".tsx"]);
14464
+ var SUPPORTED_EXTENSIONS = new Set([
14465
+ ".ts",
14466
+ ".tsx",
14467
+ ".mts",
14468
+ ".cts",
14469
+ ".js",
14470
+ ".jsx",
14471
+ ".mjs",
14472
+ ".cjs"
14473
+ ]);
13756
14474
  var toPosixPath = (value) => value.split(sep).join("/");
13757
14475
  var shouldExcludeFile = (fileName) => DEFAULT_EXCLUDED_FILE_PATTERNS.some((pattern) => pattern.test(fileName));
13758
14476
  var isSupportedSourceFile = (fileName) => SUPPORTED_EXTENSIONS.has(extname(fileName));
@@ -13904,11 +14622,7 @@ var countFileLines = async (filePath) => {
13904
14622
  const contents = await readFile(filePath, "utf-8");
13905
14623
  if (contents === "")
13906
14624
  return 0;
13907
- const lines = contents.split(/\r\n|\r|\n/);
13908
- if (lines[lines.length - 1] === "") {
13909
- lines.pop();
13910
- }
13911
- return lines.length;
14625
+ return contents.split(/\r\n|\r|\n/).filter((line) => line.trim().length > 0).length;
13912
14626
  };
13913
14627
  var MANIFEST_FILES = [
13914
14628
  "package.json",
@@ -14054,13 +14768,19 @@ var findSubModuleDirs = async (rootDir, excludeDirs, gitFiles, pathFilter2) => {
14054
14768
  var buildModule = async (repoRoot, moduleDir, moduleName, childModuleDirs, ref, pathFilter2, gitFiles) => {
14055
14769
  const excludes = childModuleDirs.size > 0 ? childModuleDirs : undefined;
14056
14770
  const moduleFiles = gitFiles !== undefined && gitFiles !== null && gitFiles.size > 0 ? filterGitSourceFiles(resolve(moduleDir), gitFiles, excludes, pathFilter2) : await scanSourceFiles(moduleDir, excludes, ref, pathFilter2);
14771
+ const broadPathFilter = pathFilter2 === undefined ? undefined : { ...pathFilter2, code: { ...pathFilter2.code, exclude: [] } };
14772
+ const allMatchedFiles = broadPathFilter === undefined ? moduleFiles : gitFiles !== undefined && gitFiles !== null && gitFiles.size > 0 ? filterGitSourceFiles(resolve(moduleDir), gitFiles, excludes, broadPathFilter) : await scanSourceFiles(moduleDir, excludes, ref, broadPathFilter);
14773
+ const included = new Set(moduleFiles);
14774
+ const excludedModuleFiles = allMatchedFiles.filter((file) => !included.has(file));
14057
14775
  const modulePath = toPosixPath(relative(repoRoot, moduleDir)) || ".";
14058
14776
  const totalLines = await Promise.all(moduleFiles.map((file) => countFileLines(join(moduleDir, file))));
14059
14777
  const files = modulePath === "." ? moduleFiles : moduleFiles.map((file) => toPosixPath(join(modulePath, file)));
14778
+ const excludedFiles = modulePath === "." ? excludedModuleFiles : excludedModuleFiles.map((file) => toPosixPath(join(modulePath, file)));
14060
14779
  return {
14061
14780
  name: moduleName,
14062
14781
  path: modulePath,
14063
14782
  files,
14783
+ ...excludedFiles.length === 0 ? {} : { excludedFiles },
14064
14784
  fileCount: files.length,
14065
14785
  totalLines: totalLines.reduce((sum, value) => sum + value, 0)
14066
14786
  };
@@ -14172,10 +14892,10 @@ class ExtractionInputError extends Error {
14172
14892
  // src/repository.ts
14173
14893
  var PACKAGE_JSON = "package.json";
14174
14894
  var GO_MOD = "go.mod";
14175
- var toPosixPath2 = (value) => value.split(path2.sep).join("/");
14895
+ var toPosixPath2 = (value) => value.split(path3.sep).join("/");
14176
14896
  function safeSourceRelativePath(value) {
14177
14897
  const slashPath = value.trim().replace(/\\/gu, "/");
14178
- const normalized = path2.posix.normalize(slashPath).replace(/^\.\//u, "");
14898
+ const normalized = path3.posix.normalize(slashPath).replace(/^\.\//u, "");
14179
14899
  if (normalized.length === 0 || normalized === "." || normalized === ".." || normalized.startsWith("../") || normalized.startsWith("/") || /^[A-Za-z]:\//u.test(normalized)) {
14180
14900
  throw new Error(`Extraction entry must be a source-relative file path: ${value}`);
14181
14901
  }
@@ -14193,7 +14913,7 @@ function moduleRelativeEntryPath(modulePath, sourcePath) {
14193
14913
  function entrySubpath(filePath, index) {
14194
14914
  if (index === 0)
14195
14915
  return ".";
14196
- const withoutExtension = filePath.replace(/\.(?:d\.)?(?:ts|tsx|mts|cts|go)$/u, "");
14916
+ const withoutExtension = filePath.replace(/\.(?:d\.)?(?:ts|tsx|mts|cts|js|jsx|mjs|cjs|go)$/u, "");
14197
14917
  return `./${withoutExtension}`;
14198
14918
  }
14199
14919
  function selectedEntryFiles(input) {
@@ -14239,11 +14959,11 @@ var resolveRepoRelativePath = (modulePath, value) => {
14239
14959
  return normalizedValue;
14240
14960
  return `${normalizeRelativePath(modulePath)}/${normalizedValue}`;
14241
14961
  };
14242
- var resolveModuleDir = (repoPath, modulePath) => modulePath === "." ? repoPath : path2.join(repoPath, modulePath);
14962
+ var resolveModuleDir = (repoPath, modulePath) => modulePath === "." ? repoPath : path3.join(repoPath, modulePath);
14243
14963
  var resolveModuleFsPath = (moduleDir, filePath) => {
14244
- const candidate = path2.isAbsolute(filePath) ? filePath : path2.resolve(moduleDir, filePath);
14245
- const relativePath = path2.relative(moduleDir, candidate);
14246
- if (relativePath.startsWith("..") || path2.isAbsolute(relativePath)) {
14964
+ const candidate = path3.isAbsolute(filePath) ? filePath : path3.resolve(moduleDir, filePath);
14965
+ const relativePath = path3.relative(moduleDir, candidate);
14966
+ if (relativePath.startsWith("..") || path3.isAbsolute(relativePath)) {
14247
14967
  throw new Error(`Path escapes module root: ${filePath}`);
14248
14968
  }
14249
14969
  return candidate;
@@ -14323,7 +15043,20 @@ var prefixExtractionPaths = (extraction, modulePath, commitHash) => ({
14323
15043
  ...file,
14324
15044
  path: resolveRepoRelativePath(modulePath, file.path)
14325
15045
  })),
14326
- symbols: extraction.symbols.map((symbol) => prefixSymbolPaths(symbol, modulePath))
15046
+ symbols: extraction.symbols.map((symbol) => prefixSymbolPaths(symbol, modulePath)),
15047
+ ...extraction.coverage ? {
15048
+ coverage: {
15049
+ ...extraction.coverage,
15050
+ files: extraction.coverage.files.map((file) => ({
15051
+ ...file,
15052
+ path: resolveRepoRelativePath(modulePath, file.path)
15053
+ })),
15054
+ diagnostics: extraction.coverage.diagnostics.map((diagnostic) => ({
15055
+ ...diagnostic,
15056
+ file: resolveRepoRelativePath(modulePath, diagnostic.file)
15057
+ }))
15058
+ }
15059
+ } : {}
14327
15060
  });
14328
15061
  var normalizeExtractionPaths = (extraction, entryDetection, modulePath, commitHash) => ({
14329
15062
  entryDetection: prefixEntryDetectionPaths(entryDetection, modulePath),
@@ -14375,7 +15108,7 @@ var resolveRequestedModules = async (repoPath, modulePaths, ref, pathFilter2) =>
14375
15108
  return { modules, moduleErrors };
14376
15109
  };
14377
15110
  var runRepositoryExtraction = async (input) => {
14378
- const repoPath = path2.resolve(input.repoPath);
15111
+ const repoPath = path3.resolve(input.repoPath);
14379
15112
  input.onProgress?.({ phase: "scanning", progress: 0, message: "detecting modules" });
14380
15113
  const { modules, moduleErrors } = await resolveRequestedModules(repoPath, input.modules, input.ref, input.pathFilter);
14381
15114
  const registry = new ExtractionPluginRegistry;
@@ -14436,7 +15169,6 @@ var runRepositoryExtraction = async (input) => {
14436
15169
  }
14437
15170
  return { repoPath, results, moduleErrors };
14438
15171
  };
14439
-
14440
15172
  // src/runner.ts
14441
15173
  var pluginSpecSchema = exports_external.object({
14442
15174
  package: exports_external.string().min(1),
@@ -14487,9 +15219,9 @@ var isPlugin = (value) => {
14487
15219
  var resolvePluginModule = (packageName, cwd) => {
14488
15220
  if (packageName.startsWith(".") || packageName.startsWith("/") || packageName.startsWith("file:")) {
14489
15221
  const filePath = packageName.startsWith("file:") ? packageName.slice("file:".length) : packageName;
14490
- return path3.resolve(cwd, filePath);
15222
+ return path4.resolve(cwd, filePath);
14491
15223
  }
14492
- const require2 = createRequire2(path3.join(cwd, "package.json"));
15224
+ const require2 = createRequire2(path4.join(cwd, "package.json"));
14493
15225
  return require2.resolve(packageName);
14494
15226
  };
14495
15227
  var loadRunnerPlugins = async (pluginSpecs, cwd = process.cwd()) => {
@@ -14559,11 +15291,15 @@ var runCodeExtractCli = async () => {
14559
15291
  const input = stdin.trim() ? JSON.parse(stdin) : {};
14560
15292
  const events = await runCodeExtractRunner(input);
14561
15293
  for (const event of events) {
14562
- process.stdout.write(JSON.stringify(event) + `
15294
+ const filtered = redactIndexerOutput({ channel: "stdout", value: event });
15295
+ process.stdout.write(JSON.stringify(filtered.value) + `
14563
15296
  `);
14564
15297
  }
14565
15298
  } catch (error) {
14566
- const message = error instanceof Error ? error.message : String(error);
15299
+ const message = redactIndexerOutputText({
15300
+ channel: "exception-message",
15301
+ value: error instanceof Error ? error.message : String(error)
15302
+ });
14567
15303
  process.stdout.write(JSON.stringify({ type: "error", code: "runner-failed", message }) + `
14568
15304
  `);
14569
15305
  process.exitCode = 1;
@@ -14571,7 +15307,7 @@ var runCodeExtractCli = async () => {
14571
15307
  };
14572
15308
  var runCodeExtractCliFromFile = async (inputFile) => {
14573
15309
  const content = await readFile3(inputFile, "utf-8");
14574
- return runCodeExtractRunner(JSON.parse(content), path3.dirname(path3.resolve(inputFile)));
15310
+ return runCodeExtractRunner(JSON.parse(content), path4.dirname(path4.resolve(inputFile)));
14575
15311
  };
14576
15312
 
14577
15313
  // src/bin/c4a-extract-code.ts