@fenglimg/fabric-shared 1.6.0 → 1.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.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  enMessages,
7
7
  normalizeLocale,
8
8
  zhCNMessages
9
- } from "./chunk-KNZIX6IL.js";
9
+ } from "./chunk-5H2PVNB2.js";
10
10
  import "./chunk-LXNCAKJZ.js";
11
11
 
12
12
  // src/schemas/agents-meta.ts
@@ -49,7 +49,8 @@ var agentsMetaNodeBaseSchema = z.object({
49
49
  tier: z.enum(["always", "path", "description"]),
50
50
  description: z.string().optional()
51
51
  }).optional(),
52
- description: ruleDescriptionSchema.optional()
52
+ description: ruleDescriptionSchema.optional(),
53
+ sections: z.array(z.string()).optional()
53
54
  });
54
55
  var agentsMetaNodeSchema = z.preprocess((value) => {
55
56
  if (!isRecord(value) || typeof value.file !== "string") {
@@ -125,10 +126,40 @@ function isRecord(value) {
125
126
  return typeof value === "object" && value !== null;
126
127
  }
127
128
 
128
- // src/schemas/api-contracts.ts
129
+ // src/schemas/rule-test-index.ts
129
130
  import { z as z2 } from "zod";
130
- var ledgerSourceSchema = z2.enum(["ai", "human"]);
131
- var timestampFilterSchema = z2.preprocess((value) => {
131
+ var RULE_TEST_INDEX_SCHEMA_VERSION = 1;
132
+ var hashSchema = z2.string().min(1);
133
+ var ruleTestLinkSchema = z2.object({
134
+ rule_stable_id: z2.string().min(1),
135
+ rule_file: z2.string().min(1),
136
+ rule_hash: hashSchema,
137
+ previous_rule_hash: hashSchema.optional(),
138
+ test_file: z2.string().min(1),
139
+ test_hash: hashSchema,
140
+ previous_test_hash: hashSchema.optional(),
141
+ annotation_line: z2.number().int().positive()
142
+ }).strict();
143
+ var ruleTestOrphanAnnotationSchema = z2.object({
144
+ rule_stable_id: z2.string().min(1),
145
+ test_file: z2.string().min(1),
146
+ test_hash: hashSchema,
147
+ previous_test_hash: hashSchema.optional(),
148
+ annotation_line: z2.number().int().positive()
149
+ }).strict();
150
+ var ruleTestIndexSchema = z2.object({
151
+ schema_version: z2.literal(RULE_TEST_INDEX_SCHEMA_VERSION),
152
+ generated_at: z2.string().datetime({ offset: true }),
153
+ revision: z2.string().min(1).optional(),
154
+ previous_revision: z2.string().min(1).optional(),
155
+ links: z2.array(ruleTestLinkSchema),
156
+ orphan_annotations: z2.array(ruleTestOrphanAnnotationSchema)
157
+ }).strict();
158
+
159
+ // src/schemas/api-contracts.ts
160
+ import { z as z3 } from "zod";
161
+ var ledgerSourceSchema = z3.enum(["ai", "human"]);
162
+ var timestampFilterSchema = z3.preprocess((value) => {
132
163
  if (value === void 0 || value === null || value === "") {
133
164
  return void 0;
134
165
  }
@@ -147,61 +178,61 @@ var timestampFilterSchema = z2.preprocess((value) => {
147
178
  return Number.isNaN(parsed) ? value : parsed;
148
179
  }
149
180
  return value;
150
- }, z2.number().int().nonnegative());
151
- var ledgerQuerySchema = z2.object({
181
+ }, z3.number().int().nonnegative());
182
+ var ledgerQuerySchema = z3.object({
152
183
  source: ledgerSourceSchema.optional(),
153
184
  since: timestampFilterSchema.optional()
154
185
  });
155
- var historyStateQuerySchema = z2.object({
156
- ledger_id: z2.string().trim().min(1).optional(),
186
+ var historyStateQuerySchema = z3.object({
187
+ ledger_id: z3.string().trim().min(1).optional(),
157
188
  ts: timestampFilterSchema.optional()
158
189
  }).superRefine((value, ctx) => {
159
190
  const provided = [value.ledger_id, value.ts].filter((entry) => entry !== void 0);
160
191
  if (provided.length !== 1) {
161
192
  ctx.addIssue({
162
- code: z2.ZodIssueCode.custom,
193
+ code: z3.ZodIssueCode.custom,
163
194
  message: "Provide exactly one of ledger_id or ts.",
164
195
  path: ["ledger_id"]
165
196
  });
166
197
  }
167
198
  });
168
- var humanLockApproveRequestSchema = z2.object({
169
- file: z2.string().min(1),
170
- start_line: z2.number().int().positive(),
171
- end_line: z2.number().int().positive(),
172
- new_hash: z2.string().min(1)
199
+ var humanLockApproveRequestSchema = z3.object({
200
+ file: z3.string().min(1),
201
+ start_line: z3.number().int().positive(),
202
+ end_line: z3.number().int().positive(),
203
+ new_hash: z3.string().min(1)
173
204
  });
174
- var humanLockFileParamsSchema = z2.object({
175
- file: z2.string().min(1)
205
+ var humanLockFileParamsSchema = z3.object({
206
+ file: z3.string().min(1)
176
207
  });
177
- var annotateIntentRequestSchema = z2.object({
178
- ledger_entry_id: z2.string().min(1),
179
- annotation: z2.string().trim().min(1)
208
+ var annotateIntentRequestSchema = z3.object({
209
+ ledger_entry_id: z3.string().min(1),
210
+ annotation: z3.string().trim().min(1)
180
211
  });
181
212
 
182
213
  // src/schemas/ledger-entry.ts
183
- import { z as z3 } from "zod";
214
+ import { z as z4 } from "zod";
184
215
  var ledgerEntryBaseSchema = {
185
- id: z3.string().optional(),
186
- ts: z3.number().int().nonnegative(),
187
- intent: z3.string(),
188
- affected_paths: z3.array(z3.string())
216
+ id: z4.string().optional(),
217
+ ts: z4.number().int().nonnegative(),
218
+ intent: z4.string(),
219
+ affected_paths: z4.array(z4.string())
189
220
  };
190
- var aiLedgerEntrySchema = z3.object({
221
+ var aiLedgerEntrySchema = z4.object({
191
222
  ...ledgerEntryBaseSchema,
192
- source: z3.literal("ai"),
193
- commit_sha: z3.string().optional()
223
+ source: z4.literal("ai"),
224
+ commit_sha: z4.string().optional()
194
225
  });
195
- var humanLedgerEntrySchema = z3.object({
226
+ var humanLedgerEntrySchema = z4.object({
196
227
  ...ledgerEntryBaseSchema,
197
- source: z3.literal("human"),
198
- parent_sha: z3.string(),
199
- parent_ledger_entry_id: z3.string().optional(),
200
- diff_stat: z3.string(),
201
- annotation: z3.string().optional()
202
- });
203
- var ledgerEntryUnionSchema = z3.discriminatedUnion("source", [aiLedgerEntrySchema, humanLedgerEntrySchema]);
204
- var ledgerEntrySchema = z3.preprocess((value) => {
228
+ source: z4.literal("human"),
229
+ parent_sha: z4.string(),
230
+ parent_ledger_entry_id: z4.string().optional(),
231
+ diff_stat: z4.string(),
232
+ annotation: z4.string().optional()
233
+ });
234
+ var ledgerEntryUnionSchema = z4.discriminatedUnion("source", [aiLedgerEntrySchema, humanLedgerEntrySchema]);
235
+ var ledgerEntrySchema = z4.preprocess((value) => {
205
236
  if (value && typeof value === "object" && !Array.isArray(value) && (!("source" in value) || value.source === void 0)) {
206
237
  return {
207
238
  ...value,
@@ -212,198 +243,313 @@ var ledgerEntrySchema = z3.preprocess((value) => {
212
243
  }, ledgerEntryUnionSchema);
213
244
 
214
245
  // src/schemas/human-lock.ts
215
- import { z as z4 } from "zod";
216
- var humanLockEntrySchema = z4.object({
217
- file: z4.string(),
218
- start_line: z4.number().int().nonnegative(),
219
- end_line: z4.number().int().nonnegative(),
220
- hash: z4.string()
246
+ import { z as z5 } from "zod";
247
+ var humanLockEntrySchema = z5.object({
248
+ file: z5.string(),
249
+ start_line: z5.number().int().nonnegative(),
250
+ end_line: z5.number().int().nonnegative(),
251
+ hash: z5.string()
221
252
  });
222
- var humanLockFileSchema = z4.object({
223
- locked: z4.array(humanLockEntrySchema).optional()
253
+ var humanLockFileSchema = z5.object({
254
+ locked: z5.array(humanLockEntrySchema).optional()
224
255
  });
225
256
 
226
257
  // src/schemas/fabric-config.ts
227
- import { z as z5 } from "zod";
228
- var auditModeSchema = z5.enum(["strict", "warn", "off"]);
229
- var clientPathsSchema = z5.object({
230
- claudeCodeCLI: z5.string().optional(),
231
- claudeCodeDesktop: z5.string().optional(),
232
- cursor: z5.string().optional(),
233
- windsurf: z5.string().optional(),
234
- rooCode: z5.string().optional(),
235
- geminiCLI: z5.string().optional(),
236
- codexCLI: z5.string().optional()
237
- });
238
- var fabricConfigSchema = z5.object({
258
+ import { z as z6 } from "zod";
259
+ var auditModeSchema = z6.enum(["strict", "warn", "off"]);
260
+ var clientPathsSchema = z6.object({
261
+ claudeCodeCLI: z6.string().optional(),
262
+ claudeCodeDesktop: z6.string().optional(),
263
+ cursor: z6.string().optional(),
264
+ windsurf: z6.string().optional(),
265
+ rooCode: z6.string().optional(),
266
+ geminiCLI: z6.string().optional(),
267
+ codexCLI: z6.string().optional()
268
+ });
269
+ var fabricConfigSchema = z6.object({
239
270
  clientPaths: clientPathsSchema.optional(),
240
- externalFixturePath: z5.string().optional(),
241
- scanIgnores: z5.array(z5.string()).optional(),
271
+ externalFixturePath: z6.string().optional(),
272
+ scanIgnores: z6.array(z6.string()).optional(),
242
273
  auditMode: auditModeSchema.optional(),
243
274
  audit_mode: auditModeSchema.optional()
244
275
  });
245
276
 
246
277
  // src/schemas/forensic-report.ts
247
- import { z as z6 } from "zod";
248
- var forensicCodeSampleSchema = z6.object({
249
- path: z6.string(),
250
- lines: z6.string(),
251
- snippet: z6.string(),
252
- pattern_hint: z6.string()
253
- });
254
- var forensicEvidenceAnchorSchema = z6.object({
255
- file: z6.string(),
256
- line: z6.string(),
257
- snippet: z6.string()
258
- });
259
- var forensicAssertionCoverageSchema = z6.object({
260
- ratio: z6.number().min(0).max(1),
261
- total: z6.number().int().nonnegative(),
262
- matched: z6.number().int().nonnegative(),
263
- co_occurring_patterns: z6.array(z6.string())
264
- });
265
- var forensicAssertionSchema = z6.object({
266
- type: z6.enum(["framework", "pattern", "invariant", "domain"]),
267
- statement: z6.string(),
268
- confidence: z6.enum(["HIGH", "MEDIUM", "LOW"]),
269
- evidence: z6.array(forensicEvidenceAnchorSchema),
278
+ import { z as z7 } from "zod";
279
+ var forensicCodeSampleSchema = z7.object({
280
+ path: z7.string(),
281
+ lines: z7.string(),
282
+ snippet: z7.string(),
283
+ pattern_hint: z7.string()
284
+ });
285
+ var forensicEvidenceAnchorSchema = z7.object({
286
+ file: z7.string(),
287
+ line: z7.string(),
288
+ snippet: z7.string()
289
+ });
290
+ var forensicAssertionCoverageSchema = z7.object({
291
+ ratio: z7.number().min(0).max(1),
292
+ total: z7.number().int().nonnegative(),
293
+ matched: z7.number().int().nonnegative(),
294
+ co_occurring_patterns: z7.array(z7.string())
295
+ });
296
+ var forensicAssertionSchema = z7.object({
297
+ type: z7.enum(["framework", "pattern", "invariant", "domain"]),
298
+ statement: z7.string(),
299
+ confidence: z7.enum(["HIGH", "MEDIUM", "LOW"]),
300
+ evidence: z7.array(forensicEvidenceAnchorSchema),
270
301
  coverage: forensicAssertionCoverageSchema,
271
- proposed_rule: z6.string().optional(),
272
- alternatives: z6.array(z6.string()).optional()
273
- });
274
- var forensicTopologySchema = z6.object({
275
- total_files: z6.number().int().nonnegative(),
276
- by_ext: z6.record(z6.number().int().nonnegative()),
277
- key_dirs: z6.array(z6.string()),
278
- max_depth: z6.number().int().nonnegative()
279
- });
280
- var forensicEntryPointSchema = z6.object({
281
- path: z6.string(),
282
- reason: z6.string(),
283
- size_bytes: z6.number().int().nonnegative().optional()
284
- });
285
- var forensicFrameworkSchema = z6.object({
286
- kind: z6.string(),
287
- version: z6.string(),
288
- subkind: z6.string(),
289
- evidence: z6.array(z6.string())
290
- });
291
- var forensicReadmeSchema = z6.object({
292
- quality: z6.enum(["missing", "stub", "ok"]),
293
- line_count: z6.number().int().nonnegative(),
294
- has_contributing: z6.boolean()
295
- });
296
- var candidateFileEntrySchema = z6.object({
297
- path: z6.string(),
298
- family: z6.enum(["entry", "component", "config", "test", "domain"]),
299
- rationale: z6.string()
300
- });
301
- var forensicSamplingBudgetSchema = z6.object({
302
- max_files: z6.literal(15),
303
- max_lines_per_file: z6.literal(100)
304
- });
305
- var forensicReportSchema = z6.object({
306
- version: z6.string(),
307
- generated_at: z6.string(),
308
- generated_by: z6.string(),
309
- target: z6.string(),
310
- project_name: z6.string(),
302
+ proposed_rule: z7.string().optional(),
303
+ alternatives: z7.array(z7.string()).optional()
304
+ });
305
+ var forensicTopologySchema = z7.object({
306
+ total_files: z7.number().int().nonnegative(),
307
+ by_ext: z7.record(z7.number().int().nonnegative()),
308
+ key_dirs: z7.array(z7.string()),
309
+ max_depth: z7.number().int().nonnegative()
310
+ });
311
+ var forensicEntryPointSchema = z7.object({
312
+ path: z7.string(),
313
+ reason: z7.string(),
314
+ size_bytes: z7.number().int().nonnegative().optional()
315
+ });
316
+ var forensicFrameworkSchema = z7.object({
317
+ kind: z7.string(),
318
+ version: z7.string(),
319
+ subkind: z7.string(),
320
+ evidence: z7.array(z7.string())
321
+ });
322
+ var forensicReadmeSchema = z7.object({
323
+ quality: z7.enum(["missing", "stub", "ok"]),
324
+ line_count: z7.number().int().nonnegative(),
325
+ has_contributing: z7.boolean()
326
+ });
327
+ var candidateFileEntrySchema = z7.object({
328
+ path: z7.string(),
329
+ family: z7.enum(["entry", "component", "config", "test", "domain"]),
330
+ rationale: z7.string()
331
+ });
332
+ var forensicSamplingBudgetSchema = z7.object({
333
+ max_files: z7.literal(15),
334
+ max_lines_per_file: z7.literal(100)
335
+ });
336
+ var forensicReportSchema = z7.object({
337
+ version: z7.string(),
338
+ generated_at: z7.string(),
339
+ generated_by: z7.string(),
340
+ target: z7.string(),
341
+ project_name: z7.string(),
311
342
  framework: forensicFrameworkSchema,
312
343
  topology: forensicTopologySchema,
313
- entry_points: z6.array(forensicEntryPointSchema),
314
- code_samples: z6.array(forensicCodeSampleSchema),
315
- assertions: z6.array(forensicAssertionSchema),
316
- candidate_files: z6.array(candidateFileEntrySchema),
344
+ entry_points: z7.array(forensicEntryPointSchema),
345
+ code_samples: z7.array(forensicCodeSampleSchema),
346
+ assertions: z7.array(forensicAssertionSchema),
347
+ candidate_files: z7.array(candidateFileEntrySchema),
317
348
  sampling_budget: forensicSamplingBudgetSchema,
318
349
  readme: forensicReadmeSchema,
319
- recommendations_for_skill: z6.array(z6.string()).optional()
350
+ recommendations_for_skill: z7.array(z7.string()).optional()
320
351
  });
321
352
 
322
353
  // src/schemas/init-context.ts
323
- import { z as z7 } from "zod";
324
- var initContextFrameworkSchema = z7.object({
325
- kind: z7.string(),
326
- version: z7.string(),
327
- subkind: z7.string()
328
- });
329
- var initContextInvariantConfidenceSnapshotSchema = z7.object({
330
- confidence: z7.enum(["HIGH", "MEDIUM", "LOW"]),
331
- evidence_refs: z7.array(z7.string())
332
- });
333
- var initContextSourceEvidenceSchema = z7.object({
334
- file: z7.string(),
335
- lines: z7.string()
336
- });
337
- var initContextInvariantSchema = z7.object({
338
- type: z7.enum(["ban", "require", "protect"]),
339
- rule: z7.string(),
340
- rationale: z7.string().optional(),
354
+ import { z as z8 } from "zod";
355
+ var initContextFrameworkSchema = z8.object({
356
+ kind: z8.string(),
357
+ version: z8.string(),
358
+ subkind: z8.string()
359
+ });
360
+ var initContextInvariantConfidenceSnapshotSchema = z8.object({
361
+ confidence: z8.enum(["HIGH", "MEDIUM", "LOW"]),
362
+ evidence_refs: z8.array(z8.string())
363
+ });
364
+ var initContextSourceEvidenceSchema = z8.object({
365
+ file: z8.string(),
366
+ lines: z8.string()
367
+ });
368
+ var initContextInvariantSchema = z8.object({
369
+ type: z8.enum(["ban", "require", "protect"]),
370
+ rule: z8.string(),
371
+ rationale: z8.string().optional(),
341
372
  confidence_snapshot: initContextInvariantConfidenceSnapshotSchema.optional(),
342
- source_evidence: z7.array(initContextSourceEvidenceSchema).optional()
343
- });
344
- var initContextDomainGroupSchema = z7.object({
345
- name: z7.string(),
346
- paths: z7.array(z7.string()),
347
- summary: z7.string().optional(),
348
- topology_type: z7.enum(["mirror", "cross-cutting"]).optional(),
349
- target_path: z7.string().optional()
350
- });
351
- var initContextInterviewTrailEntrySchema = z7.object({
352
- phase: z7.string(),
353
- question: z7.string(),
354
- answer: z7.string(),
355
- presentation: z7.string().optional(),
356
- user_corrections: z7.array(z7.string()).optional()
357
- });
358
- var initContextSchema = z7.object({
373
+ source_evidence: z8.array(initContextSourceEvidenceSchema).optional()
374
+ });
375
+ var initContextDomainGroupSchema = z8.object({
376
+ name: z8.string(),
377
+ paths: z8.array(z8.string()),
378
+ summary: z8.string().optional(),
379
+ topology_type: z8.enum(["mirror", "cross-cutting"]).optional(),
380
+ target_path: z8.string().optional()
381
+ });
382
+ var initContextInterviewTrailEntrySchema = z8.object({
383
+ phase: z8.string(),
384
+ question: z8.string(),
385
+ answer: z8.string(),
386
+ presentation: z8.string().optional(),
387
+ user_corrections: z8.array(z8.string()).optional()
388
+ });
389
+ var initContextSchema = z8.object({
359
390
  framework: initContextFrameworkSchema,
360
- architecture_patterns: z7.array(z7.string()),
361
- invariants: z7.array(initContextInvariantSchema),
362
- domain_groups: z7.array(initContextDomainGroupSchema),
363
- interview_trail: z7.array(initContextInterviewTrailEntrySchema),
364
- forensic_ref: z7.string()
391
+ architecture_patterns: z8.array(z8.string()),
392
+ invariants: z8.array(initContextInvariantSchema),
393
+ domain_groups: z8.array(initContextDomainGroupSchema),
394
+ interview_trail: z8.array(initContextInterviewTrailEntrySchema),
395
+ forensic_ref: z8.string()
365
396
  });
366
397
 
367
398
  // src/schemas/events.ts
368
- import { z as z8 } from "zod";
369
- var metaUpdatedEventSchema = z8.object({
370
- type: z8.literal("meta:updated"),
399
+ import { z as z9 } from "zod";
400
+ var metaUpdatedEventSchema = z9.object({
401
+ type: z9.literal("meta:updated"),
371
402
  payload: agentsMetaSchema
372
403
  });
373
- var lockDriftEventSchema = z8.object({
374
- type: z8.literal("lock:drift"),
375
- payload: z8.object({
376
- locked: z8.array(humanLockEntrySchema),
377
- drifted: z8.array(humanLockEntrySchema)
404
+ var lockDriftEventSchema = z9.object({
405
+ type: z9.literal("lock:drift"),
406
+ payload: z9.object({
407
+ locked: z9.array(humanLockEntrySchema),
408
+ drifted: z9.array(humanLockEntrySchema)
378
409
  })
379
410
  });
380
- var lockApprovedEventSchema = z8.object({
381
- type: z8.literal("lock:approved"),
382
- payload: z8.object({
383
- locked: z8.array(humanLockEntrySchema),
384
- approved: z8.array(humanLockEntrySchema)
411
+ var lockApprovedEventSchema = z9.object({
412
+ type: z9.literal("lock:approved"),
413
+ payload: z9.object({
414
+ locked: z9.array(humanLockEntrySchema),
415
+ approved: z9.array(humanLockEntrySchema)
385
416
  })
386
417
  });
387
- var ledgerAppendedEventSchema = z8.object({
388
- type: z8.literal("ledger:appended"),
418
+ var ledgerAppendedEventSchema = z9.object({
419
+ type: z9.literal("ledger:appended"),
389
420
  payload: ledgerEntrySchema
390
421
  });
391
- var driftDetectedEventSchema = z8.object({
392
- type: z8.literal("drift:detected"),
422
+ var driftDetectedEventSchema = z9.object({
423
+ type: z9.literal("drift:detected"),
393
424
  payload: forensicReportSchema
394
425
  });
395
- var fabricEventSchema = z8.discriminatedUnion("type", [
426
+ var fabricEventSchema = z9.discriminatedUnion("type", [
396
427
  metaUpdatedEventSchema,
397
428
  lockDriftEventSchema,
398
429
  lockApprovedEventSchema,
399
430
  ledgerAppendedEventSchema,
400
431
  driftDetectedEventSchema
401
432
  ]);
433
+
434
+ // src/schemas/event-ledger.ts
435
+ import { z as z10 } from "zod";
436
+ var eventLedgerEnvelopeSchema = {
437
+ kind: z10.literal("fabric-event"),
438
+ id: z10.string(),
439
+ ts: z10.number().int().nonnegative(),
440
+ schema_version: z10.literal(1),
441
+ correlation_id: z10.string().optional(),
442
+ session_id: z10.string().optional()
443
+ };
444
+ var stringRecordSchema = z10.record(z10.string());
445
+ var ruleContextPlannedEventSchema = z10.object({
446
+ ...eventLedgerEnvelopeSchema,
447
+ event_type: z10.literal("rule_context_planned"),
448
+ target_paths: z10.array(z10.string()),
449
+ required_stable_ids: z10.array(z10.string()),
450
+ ai_selectable_stable_ids: z10.array(z10.string()),
451
+ final_stable_ids: z10.array(z10.string()),
452
+ selection_token: z10.string().optional(),
453
+ client_hash: z10.string().optional(),
454
+ intent: z10.string().optional(),
455
+ known_tech: z10.array(z10.string()).optional(),
456
+ diagnostics: z10.array(z10.unknown()).optional()
457
+ });
458
+ var ruleSelectionEventSchema = z10.object({
459
+ ...eventLedgerEnvelopeSchema,
460
+ event_type: z10.literal("rule_selection"),
461
+ selection_token: z10.string(),
462
+ target_paths: z10.array(z10.string()),
463
+ required_stable_ids: z10.array(z10.string()),
464
+ ai_selectable_stable_ids: z10.array(z10.string()),
465
+ ai_selected_stable_ids: z10.array(z10.string()),
466
+ final_stable_ids: z10.array(z10.string()),
467
+ ai_selection_reasons: stringRecordSchema,
468
+ rejected_stable_ids: z10.array(z10.string()),
469
+ ignored_stable_ids: z10.array(z10.string())
470
+ });
471
+ var ruleSectionsFetchedEventSchema = z10.object({
472
+ ...eventLedgerEnvelopeSchema,
473
+ event_type: z10.literal("rule_sections_fetched"),
474
+ selection_token: z10.string(),
475
+ target_paths: z10.array(z10.string()).optional(),
476
+ requested_sections: z10.array(z10.string()),
477
+ final_stable_ids: z10.array(z10.string()),
478
+ ai_selected_stable_ids: z10.array(z10.string()),
479
+ diagnostics: z10.array(z10.unknown()).optional()
480
+ });
481
+ var editIntentCheckedEventSchema = z10.object({
482
+ ...eventLedgerEnvelopeSchema,
483
+ event_type: z10.literal("edit_intent_checked"),
484
+ path: z10.string(),
485
+ compliant: z10.boolean(),
486
+ intent: z10.string(),
487
+ ledger_entry_id: z10.string(),
488
+ ledger_source: z10.enum(["ai", "human"]).optional(),
489
+ commit_sha: z10.string().optional(),
490
+ parent_sha: z10.string().optional(),
491
+ parent_ledger_entry_id: z10.string().optional(),
492
+ diff_stat: z10.string().optional(),
493
+ annotation: z10.string().optional(),
494
+ matched_rule_context_ts: z10.number().int().nonnegative().nullable(),
495
+ window_ms: z10.number().int().nonnegative()
496
+ });
497
+ var ruleDriftDetectedEventSchema = z10.object({
498
+ ...eventLedgerEnvelopeSchema,
499
+ event_type: z10.literal("rule_drift_detected"),
500
+ revision: z10.string().optional(),
501
+ drifted_stable_ids: z10.array(z10.string()),
502
+ missing_files: z10.array(z10.string()),
503
+ stale_files: z10.array(z10.string()),
504
+ details: z10.array(
505
+ z10.object({
506
+ file: z10.string(),
507
+ stable_id: z10.string(),
508
+ expected_hash: z10.string(),
509
+ actual_hash: z10.string().nullable()
510
+ })
511
+ ).optional()
512
+ });
513
+ var ruleBaselineAcceptedEventSchema = z10.object({
514
+ ...eventLedgerEnvelopeSchema,
515
+ event_type: z10.literal("rule_baseline_accepted"),
516
+ revision: z10.string(),
517
+ previous_revision: z10.string().optional(),
518
+ accepted_stable_ids: z10.array(z10.string()),
519
+ source: z10.enum(["doctor_fix", "sync_meta"]).optional()
520
+ });
521
+ var baselineSyncedEventSchema = z10.object({
522
+ ...eventLedgerEnvelopeSchema,
523
+ event_type: z10.literal("baseline_synced"),
524
+ revision: z10.string(),
525
+ previous_revision: z10.string().optional(),
526
+ synced_files: z10.array(z10.string()),
527
+ accepted_stable_ids: z10.array(z10.string()),
528
+ source: z10.enum(["doctor_fix", "sync_meta"])
529
+ });
530
+ var mcpEventLedgerEventSchema = z10.object({
531
+ ...eventLedgerEnvelopeSchema,
532
+ event_type: z10.literal("mcp_event"),
533
+ mcp_event_id: z10.string(),
534
+ stream_id: z10.string(),
535
+ message: z10.unknown()
536
+ });
537
+ var eventLedgerEventSchema = z10.discriminatedUnion("event_type", [
538
+ ruleContextPlannedEventSchema,
539
+ ruleSelectionEventSchema,
540
+ ruleSectionsFetchedEventSchema,
541
+ editIntentCheckedEventSchema,
542
+ ruleDriftDetectedEventSchema,
543
+ ruleBaselineAcceptedEventSchema,
544
+ baselineSyncedEventSchema,
545
+ mcpEventLedgerEventSchema
546
+ ]);
402
547
  export {
403
548
  AGENTS_META_IDENTITY_SOURCES,
404
549
  AGENTS_META_LAYERS,
405
550
  AGENTS_META_TOPOLOGY_TYPES,
406
551
  PROTECTED_TOKENS,
552
+ RULE_TEST_INDEX_SCHEMA_VERSION,
407
553
  agentsIdentitySourceSchema,
408
554
  agentsLayerSchema,
409
555
  agentsMetaNodeSchema,
@@ -412,6 +558,7 @@ export {
412
558
  aiLedgerEntrySchema,
413
559
  annotateIntentRequestSchema,
414
560
  auditModeSchema,
561
+ baselineSyncedEventSchema,
415
562
  candidateFileEntrySchema,
416
563
  clientPathsSchema,
417
564
  createTranslator,
@@ -422,7 +569,9 @@ export {
422
569
  deriveAgentsMetaTopologyType,
423
570
  detectNodeLocale,
424
571
  driftDetectedEventSchema,
572
+ editIntentCheckedEventSchema,
425
573
  enMessages,
574
+ eventLedgerEventSchema,
426
575
  fabricConfigSchema,
427
576
  fabricEventSchema,
428
577
  forensicAssertionCoverageSchema,
@@ -454,10 +603,19 @@ export {
454
603
  ledgerSourceSchema,
455
604
  lockApprovedEventSchema,
456
605
  lockDriftEventSchema,
606
+ mcpEventLedgerEventSchema,
457
607
  metaUpdatedEventSchema,
458
608
  normalizeLocale,
609
+ ruleBaselineAcceptedEventSchema,
610
+ ruleContextPlannedEventSchema,
459
611
  ruleDescriptionIndexItemSchema,
460
612
  ruleDescriptionSchema,
613
+ ruleDriftDetectedEventSchema,
614
+ ruleSectionsFetchedEventSchema,
615
+ ruleSelectionEventSchema,
616
+ ruleTestIndexSchema,
617
+ ruleTestLinkSchema,
618
+ ruleTestOrphanAnnotationSchema,
461
619
  withDerivedAgentsMetaNodeDefaults,
462
620
  zhCNMessages
463
621
  };
@@ -35,6 +35,7 @@ interface AgentsMetaNode {
35
35
  identity_source?: AgentsIdentitySource;
36
36
  activation?: AgentsMetaNodeActivation;
37
37
  description?: RuleDescription;
38
+ sections?: string[];
38
39
  }
39
40
  interface AgentsMeta {
40
41
  revision: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fenglimg/fabric-shared",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",