@fenglimg/fabric-shared 1.7.0 → 1.8.0-rc.2

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
@@ -1,3 +1,4 @@
1
+ import "./chunk-LXNCAKJZ.js";
1
2
  import {
2
3
  PROTECTED_TOKENS,
3
4
  createTranslator,
@@ -6,8 +7,25 @@ import {
6
7
  enMessages,
7
8
  normalizeLocale,
8
9
  zhCNMessages
9
- } from "./chunk-5H2PVNB2.js";
10
- import "./chunk-LXNCAKJZ.js";
10
+ } from "./chunk-BLXHC5HA.js";
11
+ import {
12
+ annotateIntentRequestSchema,
13
+ getRulesAnnotations,
14
+ getRulesInputSchema,
15
+ getRulesOutputSchema,
16
+ historyStateQuerySchema,
17
+ humanLockApproveRequestSchema,
18
+ humanLockFileParamsSchema,
19
+ ledgerQuerySchema,
20
+ ledgerSourceSchema,
21
+ planContextAnnotations,
22
+ planContextInputSchema,
23
+ planContextOutputSchema,
24
+ ruleSectionsAnnotations,
25
+ ruleSectionsInputSchema,
26
+ ruleSectionsOutputSchema,
27
+ structuredWarningSchema
28
+ } from "./chunk-KV27CZH3.js";
11
29
 
12
30
  // src/schemas/agents-meta.ts
13
31
  import { z } from "zod";
@@ -156,83 +174,29 @@ var ruleTestIndexSchema = z2.object({
156
174
  orphan_annotations: z2.array(ruleTestOrphanAnnotationSchema)
157
175
  }).strict();
158
176
 
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) => {
163
- if (value === void 0 || value === null || value === "") {
164
- return void 0;
165
- }
166
- if (typeof value === "number") {
167
- return value;
168
- }
169
- if (typeof value === "string") {
170
- const trimmed = value.trim();
171
- if (trimmed.length === 0) {
172
- return void 0;
173
- }
174
- if (/^\d+$/.test(trimmed)) {
175
- return Number.parseInt(trimmed, 10);
176
- }
177
- const parsed = Date.parse(trimmed);
178
- return Number.isNaN(parsed) ? value : parsed;
179
- }
180
- return value;
181
- }, z3.number().int().nonnegative());
182
- var ledgerQuerySchema = z3.object({
183
- source: ledgerSourceSchema.optional(),
184
- since: timestampFilterSchema.optional()
185
- });
186
- var historyStateQuerySchema = z3.object({
187
- ledger_id: z3.string().trim().min(1).optional(),
188
- ts: timestampFilterSchema.optional()
189
- }).superRefine((value, ctx) => {
190
- const provided = [value.ledger_id, value.ts].filter((entry) => entry !== void 0);
191
- if (provided.length !== 1) {
192
- ctx.addIssue({
193
- code: z3.ZodIssueCode.custom,
194
- message: "Provide exactly one of ledger_id or ts.",
195
- path: ["ledger_id"]
196
- });
197
- }
198
- });
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)
204
- });
205
- var humanLockFileParamsSchema = z3.object({
206
- file: z3.string().min(1)
207
- });
208
- var annotateIntentRequestSchema = z3.object({
209
- ledger_entry_id: z3.string().min(1),
210
- annotation: z3.string().trim().min(1)
211
- });
212
-
213
177
  // src/schemas/ledger-entry.ts
214
- import { z as z4 } from "zod";
178
+ import { z as z3 } from "zod";
215
179
  var ledgerEntryBaseSchema = {
216
- id: z4.string().optional(),
217
- ts: z4.number().int().nonnegative(),
218
- intent: z4.string(),
219
- affected_paths: z4.array(z4.string())
180
+ id: z3.string().optional(),
181
+ ts: z3.number().int().nonnegative(),
182
+ intent: z3.string(),
183
+ affected_paths: z3.array(z3.string())
220
184
  };
221
- var aiLedgerEntrySchema = z4.object({
185
+ var aiLedgerEntrySchema = z3.object({
222
186
  ...ledgerEntryBaseSchema,
223
- source: z4.literal("ai"),
224
- commit_sha: z4.string().optional()
187
+ source: z3.literal("ai"),
188
+ commit_sha: z3.string().optional()
225
189
  });
226
- var humanLedgerEntrySchema = z4.object({
190
+ var humanLedgerEntrySchema = z3.object({
227
191
  ...ledgerEntryBaseSchema,
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) => {
192
+ source: z3.literal("human"),
193
+ parent_sha: z3.string(),
194
+ parent_ledger_entry_id: z3.string().optional(),
195
+ diff_stat: z3.string(),
196
+ annotation: z3.string().optional()
197
+ });
198
+ var ledgerEntryUnionSchema = z3.discriminatedUnion("source", [aiLedgerEntrySchema, humanLedgerEntrySchema]);
199
+ var ledgerEntrySchema = z3.preprocess((value) => {
236
200
  if (value && typeof value === "object" && !Array.isArray(value) && (!("source" in value) || value.source === void 0)) {
237
201
  return {
238
202
  ...value,
@@ -243,187 +207,189 @@ var ledgerEntrySchema = z4.preprocess((value) => {
243
207
  }, ledgerEntryUnionSchema);
244
208
 
245
209
  // src/schemas/human-lock.ts
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()
210
+ import { z as z4 } from "zod";
211
+ var humanLockEntrySchema = z4.object({
212
+ file: z4.string(),
213
+ start_line: z4.number().int().nonnegative(),
214
+ end_line: z4.number().int().nonnegative(),
215
+ hash: z4.string()
252
216
  });
253
- var humanLockFileSchema = z5.object({
254
- locked: z5.array(humanLockEntrySchema).optional()
217
+ var humanLockFileSchema = z4.object({
218
+ locked: z4.array(humanLockEntrySchema).optional()
255
219
  });
256
220
 
257
221
  // src/schemas/fabric-config.ts
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({
222
+ import { z as z5 } from "zod";
223
+ var auditModeSchema = z5.enum(["strict", "warn", "off"]);
224
+ var clientPathsSchema = z5.object({
225
+ claudeCodeCLI: z5.string().optional(),
226
+ claudeCodeDesktop: z5.string().optional(),
227
+ cursor: z5.string().optional(),
228
+ codexCLI: z5.string().optional()
229
+ }).passthrough();
230
+ var mcpPayloadLimitsSchema = z5.object({
231
+ warnBytes: z5.number().int().positive().optional(),
232
+ hardBytes: z5.number().int().positive().optional()
233
+ }).optional();
234
+ var fabricConfigSchema = z5.object({
270
235
  clientPaths: clientPathsSchema.optional(),
271
- externalFixturePath: z6.string().optional(),
272
- scanIgnores: z6.array(z6.string()).optional(),
236
+ externalFixturePath: z5.string().optional(),
237
+ scanIgnores: z5.array(z5.string()).optional(),
273
238
  auditMode: auditModeSchema.optional(),
274
- audit_mode: auditModeSchema.optional()
239
+ audit_mode: auditModeSchema.optional(),
240
+ mcpPayloadLimits: mcpPayloadLimitsSchema
275
241
  });
276
242
 
277
243
  // src/schemas/forensic-report.ts
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),
244
+ import { z as z6 } from "zod";
245
+ var forensicCodeSampleSchema = z6.object({
246
+ path: z6.string(),
247
+ lines: z6.string(),
248
+ snippet: z6.string(),
249
+ pattern_hint: z6.string()
250
+ });
251
+ var forensicEvidenceAnchorSchema = z6.object({
252
+ file: z6.string(),
253
+ line: z6.string(),
254
+ snippet: z6.string()
255
+ });
256
+ var forensicAssertionCoverageSchema = z6.object({
257
+ ratio: z6.number().min(0).max(1),
258
+ total: z6.number().int().nonnegative(),
259
+ matched: z6.number().int().nonnegative(),
260
+ co_occurring_patterns: z6.array(z6.string())
261
+ });
262
+ var forensicAssertionSchema = z6.object({
263
+ type: z6.enum(["framework", "pattern", "invariant", "domain"]),
264
+ statement: z6.string(),
265
+ confidence: z6.enum(["HIGH", "MEDIUM", "LOW"]),
266
+ evidence: z6.array(forensicEvidenceAnchorSchema),
301
267
  coverage: forensicAssertionCoverageSchema,
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(),
268
+ proposed_rule: z6.string().optional(),
269
+ alternatives: z6.array(z6.string()).optional()
270
+ });
271
+ var forensicTopologySchema = z6.object({
272
+ total_files: z6.number().int().nonnegative(),
273
+ by_ext: z6.record(z6.number().int().nonnegative()),
274
+ key_dirs: z6.array(z6.string()),
275
+ max_depth: z6.number().int().nonnegative()
276
+ });
277
+ var forensicEntryPointSchema = z6.object({
278
+ path: z6.string(),
279
+ reason: z6.string(),
280
+ size_bytes: z6.number().int().nonnegative().optional()
281
+ });
282
+ var forensicFrameworkSchema = z6.object({
283
+ kind: z6.string(),
284
+ version: z6.string(),
285
+ subkind: z6.string(),
286
+ evidence: z6.array(z6.string())
287
+ });
288
+ var forensicReadmeSchema = z6.object({
289
+ quality: z6.enum(["missing", "stub", "ok"]),
290
+ line_count: z6.number().int().nonnegative(),
291
+ has_contributing: z6.boolean()
292
+ });
293
+ var candidateFileEntrySchema = z6.object({
294
+ path: z6.string(),
295
+ family: z6.enum(["entry", "component", "config", "test", "domain"]),
296
+ rationale: z6.string()
297
+ });
298
+ var forensicSamplingBudgetSchema = z6.object({
299
+ max_files: z6.literal(15),
300
+ max_lines_per_file: z6.literal(100)
301
+ });
302
+ var forensicReportSchema = z6.object({
303
+ version: z6.string(),
304
+ generated_at: z6.string(),
305
+ generated_by: z6.string(),
306
+ target: z6.string(),
307
+ project_name: z6.string(),
342
308
  framework: forensicFrameworkSchema,
343
309
  topology: forensicTopologySchema,
344
- entry_points: z7.array(forensicEntryPointSchema),
345
- code_samples: z7.array(forensicCodeSampleSchema),
346
- assertions: z7.array(forensicAssertionSchema),
347
- candidate_files: z7.array(candidateFileEntrySchema),
310
+ entry_points: z6.array(forensicEntryPointSchema),
311
+ code_samples: z6.array(forensicCodeSampleSchema),
312
+ assertions: z6.array(forensicAssertionSchema),
313
+ candidate_files: z6.array(candidateFileEntrySchema),
348
314
  sampling_budget: forensicSamplingBudgetSchema,
349
315
  readme: forensicReadmeSchema,
350
- recommendations_for_skill: z7.array(z7.string()).optional()
316
+ recommendations_for_skill: z6.array(z6.string()).optional()
351
317
  });
352
318
 
353
319
  // src/schemas/init-context.ts
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(),
320
+ import { z as z7 } from "zod";
321
+ var initContextFrameworkSchema = z7.object({
322
+ kind: z7.string(),
323
+ version: z7.string(),
324
+ subkind: z7.string()
325
+ });
326
+ var initContextInvariantConfidenceSnapshotSchema = z7.object({
327
+ confidence: z7.enum(["HIGH", "MEDIUM", "LOW"]),
328
+ evidence_refs: z7.array(z7.string())
329
+ });
330
+ var initContextSourceEvidenceSchema = z7.object({
331
+ file: z7.string(),
332
+ lines: z7.string()
333
+ });
334
+ var initContextInvariantSchema = z7.object({
335
+ type: z7.enum(["ban", "require", "protect"]),
336
+ rule: z7.string(),
337
+ rationale: z7.string().optional(),
372
338
  confidence_snapshot: initContextInvariantConfidenceSnapshotSchema.optional(),
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({
339
+ source_evidence: z7.array(initContextSourceEvidenceSchema).optional()
340
+ });
341
+ var initContextDomainGroupSchema = z7.object({
342
+ name: z7.string(),
343
+ paths: z7.array(z7.string()),
344
+ summary: z7.string().optional(),
345
+ topology_type: z7.enum(["mirror", "cross-cutting"]).optional(),
346
+ target_path: z7.string().optional()
347
+ });
348
+ var initContextInterviewTrailEntrySchema = z7.object({
349
+ phase: z7.string(),
350
+ question: z7.string(),
351
+ answer: z7.string(),
352
+ presentation: z7.string().optional(),
353
+ user_corrections: z7.array(z7.string()).optional()
354
+ });
355
+ var initContextSchema = z7.object({
390
356
  framework: initContextFrameworkSchema,
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()
357
+ architecture_patterns: z7.array(z7.string()),
358
+ invariants: z7.array(initContextInvariantSchema),
359
+ domain_groups: z7.array(initContextDomainGroupSchema),
360
+ interview_trail: z7.array(initContextInterviewTrailEntrySchema),
361
+ forensic_ref: z7.string()
396
362
  });
397
363
 
398
364
  // src/schemas/events.ts
399
- import { z as z9 } from "zod";
400
- var metaUpdatedEventSchema = z9.object({
401
- type: z9.literal("meta:updated"),
365
+ import { z as z8 } from "zod";
366
+ var metaUpdatedEventSchema = z8.object({
367
+ type: z8.literal("meta:updated"),
402
368
  payload: agentsMetaSchema
403
369
  });
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)
370
+ var lockDriftEventSchema = z8.object({
371
+ type: z8.literal("lock:drift"),
372
+ payload: z8.object({
373
+ locked: z8.array(humanLockEntrySchema),
374
+ drifted: z8.array(humanLockEntrySchema)
409
375
  })
410
376
  });
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)
377
+ var lockApprovedEventSchema = z8.object({
378
+ type: z8.literal("lock:approved"),
379
+ payload: z8.object({
380
+ locked: z8.array(humanLockEntrySchema),
381
+ approved: z8.array(humanLockEntrySchema)
416
382
  })
417
383
  });
418
- var ledgerAppendedEventSchema = z9.object({
419
- type: z9.literal("ledger:appended"),
384
+ var ledgerAppendedEventSchema = z8.object({
385
+ type: z8.literal("ledger:appended"),
420
386
  payload: ledgerEntrySchema
421
387
  });
422
- var driftDetectedEventSchema = z9.object({
423
- type: z9.literal("drift:detected"),
388
+ var driftDetectedEventSchema = z8.object({
389
+ type: z8.literal("drift:detected"),
424
390
  payload: forensicReportSchema
425
391
  });
426
- var fabricEventSchema = z9.discriminatedUnion("type", [
392
+ var fabricEventSchema = z8.discriminatedUnion("type", [
427
393
  metaUpdatedEventSchema,
428
394
  lockDriftEventSchema,
429
395
  lockApprovedEventSchema,
@@ -432,109 +398,161 @@ var fabricEventSchema = z9.discriminatedUnion("type", [
432
398
  ]);
433
399
 
434
400
  // src/schemas/event-ledger.ts
435
- import { z as z10 } from "zod";
401
+ import { z as z9 } from "zod";
436
402
  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()
403
+ kind: z9.literal("fabric-event"),
404
+ id: z9.string(),
405
+ ts: z9.number().int().nonnegative(),
406
+ schema_version: z9.literal(1),
407
+ correlation_id: z9.string().optional(),
408
+ session_id: z9.string().optional()
443
409
  };
444
- var stringRecordSchema = z10.record(z10.string());
445
- var ruleContextPlannedEventSchema = z10.object({
410
+ var stringRecordSchema = z9.record(z9.string());
411
+ var ruleContextPlannedEventSchema = z9.object({
446
412
  ...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({
413
+ event_type: z9.literal("rule_context_planned"),
414
+ target_paths: z9.array(z9.string()),
415
+ required_stable_ids: z9.array(z9.string()),
416
+ ai_selectable_stable_ids: z9.array(z9.string()),
417
+ final_stable_ids: z9.array(z9.string()),
418
+ selection_token: z9.string().optional(),
419
+ client_hash: z9.string().optional(),
420
+ intent: z9.string().optional(),
421
+ known_tech: z9.array(z9.string()).optional(),
422
+ diagnostics: z9.array(z9.unknown()).optional()
423
+ });
424
+ var ruleSelectionEventSchema = z9.object({
459
425
  ...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()),
426
+ event_type: z9.literal("rule_selection"),
427
+ selection_token: z9.string(),
428
+ target_paths: z9.array(z9.string()),
429
+ required_stable_ids: z9.array(z9.string()),
430
+ ai_selectable_stable_ids: z9.array(z9.string()),
431
+ ai_selected_stable_ids: z9.array(z9.string()),
432
+ final_stable_ids: z9.array(z9.string()),
467
433
  ai_selection_reasons: stringRecordSchema,
468
- rejected_stable_ids: z10.array(z10.string()),
469
- ignored_stable_ids: z10.array(z10.string())
434
+ rejected_stable_ids: z9.array(z9.string()),
435
+ ignored_stable_ids: z9.array(z9.string())
470
436
  });
471
- var ruleSectionsFetchedEventSchema = z10.object({
437
+ var ruleSectionsFetchedEventSchema = z9.object({
472
438
  ...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({
439
+ event_type: z9.literal("rule_sections_fetched"),
440
+ selection_token: z9.string(),
441
+ target_paths: z9.array(z9.string()).optional(),
442
+ requested_sections: z9.array(z9.string()),
443
+ final_stable_ids: z9.array(z9.string()),
444
+ ai_selected_stable_ids: z9.array(z9.string()),
445
+ diagnostics: z9.array(z9.unknown()).optional()
446
+ });
447
+ var editIntentCheckedEventSchema = z9.object({
482
448
  ...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({
449
+ event_type: z9.literal("edit_intent_checked"),
450
+ path: z9.string(),
451
+ compliant: z9.boolean(),
452
+ intent: z9.string(),
453
+ ledger_entry_id: z9.string(),
454
+ ledger_source: z9.enum(["ai", "human"]).optional(),
455
+ commit_sha: z9.string().optional(),
456
+ parent_sha: z9.string().optional(),
457
+ parent_ledger_entry_id: z9.string().optional(),
458
+ diff_stat: z9.string().optional(),
459
+ annotation: z9.string().optional(),
460
+ matched_rule_context_ts: z9.number().int().nonnegative().nullable(),
461
+ window_ms: z9.number().int().nonnegative()
462
+ });
463
+ var ruleDriftDetectedEventSchema = z9.object({
498
464
  ...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()
465
+ event_type: z9.literal("rule_drift_detected"),
466
+ revision: z9.string().optional(),
467
+ drifted_stable_ids: z9.array(z9.string()),
468
+ missing_files: z9.array(z9.string()),
469
+ stale_files: z9.array(z9.string()),
470
+ details: z9.array(
471
+ z9.object({
472
+ file: z9.string(),
473
+ stable_id: z9.string(),
474
+ expected_hash: z9.string(),
475
+ actual_hash: z9.string().nullable()
510
476
  })
511
477
  ).optional()
512
478
  });
513
- var ruleBaselineAcceptedEventSchema = z10.object({
479
+ var ruleBaselineAcceptedEventSchema = z9.object({
514
480
  ...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()
481
+ event_type: z9.literal("rule_baseline_accepted"),
482
+ revision: z9.string(),
483
+ previous_revision: z9.string().optional(),
484
+ accepted_stable_ids: z9.array(z9.string()),
485
+ source: z9.enum(["doctor_fix", "sync_meta"]).optional()
520
486
  });
521
- var baselineSyncedEventSchema = z10.object({
487
+ var baselineSyncedEventSchema = z9.object({
522
488
  ...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({
489
+ event_type: z9.literal("baseline_synced"),
490
+ revision: z9.string(),
491
+ previous_revision: z9.string().optional(),
492
+ synced_files: z9.array(z9.string()),
493
+ accepted_stable_ids: z9.array(z9.string()),
494
+ source: z9.enum(["doctor_fix", "sync_meta"])
495
+ });
496
+ var mcpEventLedgerEventSchema = z9.object({
531
497
  ...eventLedgerEnvelopeSchema,
532
- event_type: z10.literal("mcp_event"),
533
- mcp_event_id: z10.string(),
534
- stream_id: z10.string(),
535
- message: z10.unknown()
498
+ event_type: z9.literal("mcp_event"),
499
+ mcp_event_id: z9.string(),
500
+ stream_id: z9.string(),
501
+ message: z9.unknown()
536
502
  });
537
- var eventLedgerEventSchema = z10.discriminatedUnion("event_type", [
503
+ var reapplyCompletedEventSchema = z9.object({
504
+ ...eventLedgerEnvelopeSchema,
505
+ event_type: z9.literal("reapply_completed"),
506
+ preserved_ledger: z9.boolean(),
507
+ preserved_meta: z9.boolean(),
508
+ rules_count: z9.number().int().nonnegative()
509
+ });
510
+ var eventLedgerTruncatedEventSchema = z9.object({
511
+ ...eventLedgerEnvelopeSchema,
512
+ event_type: z9.literal("event_ledger_truncated"),
513
+ byte_offset: z9.number().int().nonnegative(),
514
+ byte_length: z9.number().int().nonnegative(),
515
+ corrupted_path: z9.string()
516
+ });
517
+ var mcpConfigMigratedEventSchema = z9.object({
518
+ ...eventLedgerEnvelopeSchema,
519
+ event_type: z9.literal("mcp_config_migrated"),
520
+ source: z9.literal("doctor_fix"),
521
+ removed_from: z9.string()
522
+ });
523
+ var metaReconciledOnStartupEventSchema = z9.object({
524
+ ...eventLedgerEnvelopeSchema,
525
+ event_type: z9.literal("meta_reconciled_on_startup"),
526
+ reconciled_files: z9.array(z9.string()),
527
+ duration_ms: z9.number().int().nonnegative(),
528
+ source: z9.literal("reconcileRules")
529
+ });
530
+ var metaReconciledEventSchema = z9.object({
531
+ ...eventLedgerEnvelopeSchema,
532
+ event_type: z9.literal("meta_reconciled"),
533
+ reconciled_files: z9.array(z9.string()),
534
+ duration_ms: z9.number().int().nonnegative(),
535
+ trigger: z9.enum(["doctor", "manual"]),
536
+ source: z9.literal("reconcileRules")
537
+ });
538
+ var claudeSkillPathMigratedEventSchema = z9.object({
539
+ ...eventLedgerEnvelopeSchema,
540
+ event_type: z9.literal("claude_skill_path_migrated"),
541
+ from: z9.string(),
542
+ to: z9.string()
543
+ });
544
+ var claudeHookPathMigratedEventSchema = z9.object({
545
+ ...eventLedgerEnvelopeSchema,
546
+ event_type: z9.literal("claude_hook_path_migrated"),
547
+ from: z9.string(),
548
+ to: z9.string()
549
+ });
550
+ var legacyClientPathPresentEventSchema = z9.object({
551
+ ...eventLedgerEnvelopeSchema,
552
+ event_type: z9.literal("legacy_client_path_present"),
553
+ removed: z9.array(z9.string())
554
+ });
555
+ var eventLedgerEventSchema = z9.discriminatedUnion("event_type", [
538
556
  ruleContextPlannedEventSchema,
539
557
  ruleSelectionEventSchema,
540
558
  ruleSectionsFetchedEventSchema,
@@ -542,7 +560,15 @@ var eventLedgerEventSchema = z10.discriminatedUnion("event_type", [
542
560
  ruleDriftDetectedEventSchema,
543
561
  ruleBaselineAcceptedEventSchema,
544
562
  baselineSyncedEventSchema,
545
- mcpEventLedgerEventSchema
563
+ mcpEventLedgerEventSchema,
564
+ reapplyCompletedEventSchema,
565
+ eventLedgerTruncatedEventSchema,
566
+ mcpConfigMigratedEventSchema,
567
+ metaReconciledOnStartupEventSchema,
568
+ metaReconciledEventSchema,
569
+ claudeSkillPathMigratedEventSchema,
570
+ claudeHookPathMigratedEventSchema,
571
+ legacyClientPathPresentEventSchema
546
572
  ]);
547
573
  export {
548
574
  AGENTS_META_IDENTITY_SOURCES,
@@ -560,6 +586,8 @@ export {
560
586
  auditModeSchema,
561
587
  baselineSyncedEventSchema,
562
588
  candidateFileEntrySchema,
589
+ claudeHookPathMigratedEventSchema,
590
+ claudeSkillPathMigratedEventSchema,
563
591
  clientPathsSchema,
564
592
  createTranslator,
565
593
  defaultMessages,
@@ -572,6 +600,7 @@ export {
572
600
  editIntentCheckedEventSchema,
573
601
  enMessages,
574
602
  eventLedgerEventSchema,
603
+ eventLedgerTruncatedEventSchema,
575
604
  fabricConfigSchema,
576
605
  fabricEventSchema,
577
606
  forensicAssertionCoverageSchema,
@@ -584,6 +613,9 @@ export {
584
613
  forensicReportSchema,
585
614
  forensicSamplingBudgetSchema,
586
615
  forensicTopologySchema,
616
+ getRulesAnnotations,
617
+ getRulesInputSchema,
618
+ getRulesOutputSchema,
587
619
  historyStateQuerySchema,
588
620
  humanLedgerEntrySchema,
589
621
  humanLockApproveRequestSchema,
@@ -601,21 +633,34 @@ export {
601
633
  ledgerEntrySchema,
602
634
  ledgerQuerySchema,
603
635
  ledgerSourceSchema,
636
+ legacyClientPathPresentEventSchema,
604
637
  lockApprovedEventSchema,
605
638
  lockDriftEventSchema,
639
+ mcpConfigMigratedEventSchema,
606
640
  mcpEventLedgerEventSchema,
641
+ mcpPayloadLimitsSchema,
642
+ metaReconciledEventSchema,
643
+ metaReconciledOnStartupEventSchema,
607
644
  metaUpdatedEventSchema,
608
645
  normalizeLocale,
646
+ planContextAnnotations,
647
+ planContextInputSchema,
648
+ planContextOutputSchema,
649
+ reapplyCompletedEventSchema,
609
650
  ruleBaselineAcceptedEventSchema,
610
651
  ruleContextPlannedEventSchema,
611
652
  ruleDescriptionIndexItemSchema,
612
653
  ruleDescriptionSchema,
613
654
  ruleDriftDetectedEventSchema,
655
+ ruleSectionsAnnotations,
614
656
  ruleSectionsFetchedEventSchema,
657
+ ruleSectionsInputSchema,
658
+ ruleSectionsOutputSchema,
615
659
  ruleSelectionEventSchema,
616
660
  ruleTestIndexSchema,
617
661
  ruleTestLinkSchema,
618
662
  ruleTestOrphanAnnotationSchema,
663
+ structuredWarningSchema,
619
664
  withDerivedAgentsMetaNodeDefaults,
620
665
  zhCNMessages
621
666
  };