@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/{chunk-KNZIX6IL.js → chunk-5H2PVNB2.js} +93 -107
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/index.d.ts +955 -11
- package/dist/index.js +343 -185
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
enMessages,
|
|
7
7
|
normalizeLocale,
|
|
8
8
|
zhCNMessages
|
|
9
|
-
} from "./chunk-
|
|
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/
|
|
129
|
+
// src/schemas/rule-test-index.ts
|
|
129
130
|
import { z as z2 } from "zod";
|
|
130
|
-
var
|
|
131
|
-
var
|
|
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
|
-
},
|
|
151
|
-
var ledgerQuerySchema =
|
|
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 =
|
|
156
|
-
ledger_id:
|
|
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:
|
|
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 =
|
|
169
|
-
file:
|
|
170
|
-
start_line:
|
|
171
|
-
end_line:
|
|
172
|
-
new_hash:
|
|
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 =
|
|
175
|
-
file:
|
|
205
|
+
var humanLockFileParamsSchema = z3.object({
|
|
206
|
+
file: z3.string().min(1)
|
|
176
207
|
});
|
|
177
|
-
var annotateIntentRequestSchema =
|
|
178
|
-
ledger_entry_id:
|
|
179
|
-
annotation:
|
|
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
|
|
214
|
+
import { z as z4 } from "zod";
|
|
184
215
|
var ledgerEntryBaseSchema = {
|
|
185
|
-
id:
|
|
186
|
-
ts:
|
|
187
|
-
intent:
|
|
188
|
-
affected_paths:
|
|
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 =
|
|
221
|
+
var aiLedgerEntrySchema = z4.object({
|
|
191
222
|
...ledgerEntryBaseSchema,
|
|
192
|
-
source:
|
|
193
|
-
commit_sha:
|
|
223
|
+
source: z4.literal("ai"),
|
|
224
|
+
commit_sha: z4.string().optional()
|
|
194
225
|
});
|
|
195
|
-
var humanLedgerEntrySchema =
|
|
226
|
+
var humanLedgerEntrySchema = z4.object({
|
|
196
227
|
...ledgerEntryBaseSchema,
|
|
197
|
-
source:
|
|
198
|
-
parent_sha:
|
|
199
|
-
parent_ledger_entry_id:
|
|
200
|
-
diff_stat:
|
|
201
|
-
annotation:
|
|
202
|
-
});
|
|
203
|
-
var ledgerEntryUnionSchema =
|
|
204
|
-
var ledgerEntrySchema =
|
|
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
|
|
216
|
-
var humanLockEntrySchema =
|
|
217
|
-
file:
|
|
218
|
-
start_line:
|
|
219
|
-
end_line:
|
|
220
|
-
hash:
|
|
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 =
|
|
223
|
-
locked:
|
|
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
|
|
228
|
-
var auditModeSchema =
|
|
229
|
-
var clientPathsSchema =
|
|
230
|
-
claudeCodeCLI:
|
|
231
|
-
claudeCodeDesktop:
|
|
232
|
-
cursor:
|
|
233
|
-
windsurf:
|
|
234
|
-
rooCode:
|
|
235
|
-
geminiCLI:
|
|
236
|
-
codexCLI:
|
|
237
|
-
});
|
|
238
|
-
var fabricConfigSchema =
|
|
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:
|
|
241
|
-
scanIgnores:
|
|
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
|
|
248
|
-
var forensicCodeSampleSchema =
|
|
249
|
-
path:
|
|
250
|
-
lines:
|
|
251
|
-
snippet:
|
|
252
|
-
pattern_hint:
|
|
253
|
-
});
|
|
254
|
-
var forensicEvidenceAnchorSchema =
|
|
255
|
-
file:
|
|
256
|
-
line:
|
|
257
|
-
snippet:
|
|
258
|
-
});
|
|
259
|
-
var forensicAssertionCoverageSchema =
|
|
260
|
-
ratio:
|
|
261
|
-
total:
|
|
262
|
-
matched:
|
|
263
|
-
co_occurring_patterns:
|
|
264
|
-
});
|
|
265
|
-
var forensicAssertionSchema =
|
|
266
|
-
type:
|
|
267
|
-
statement:
|
|
268
|
-
confidence:
|
|
269
|
-
evidence:
|
|
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:
|
|
272
|
-
alternatives:
|
|
273
|
-
});
|
|
274
|
-
var forensicTopologySchema =
|
|
275
|
-
total_files:
|
|
276
|
-
by_ext:
|
|
277
|
-
key_dirs:
|
|
278
|
-
max_depth:
|
|
279
|
-
});
|
|
280
|
-
var forensicEntryPointSchema =
|
|
281
|
-
path:
|
|
282
|
-
reason:
|
|
283
|
-
size_bytes:
|
|
284
|
-
});
|
|
285
|
-
var forensicFrameworkSchema =
|
|
286
|
-
kind:
|
|
287
|
-
version:
|
|
288
|
-
subkind:
|
|
289
|
-
evidence:
|
|
290
|
-
});
|
|
291
|
-
var forensicReadmeSchema =
|
|
292
|
-
quality:
|
|
293
|
-
line_count:
|
|
294
|
-
has_contributing:
|
|
295
|
-
});
|
|
296
|
-
var candidateFileEntrySchema =
|
|
297
|
-
path:
|
|
298
|
-
family:
|
|
299
|
-
rationale:
|
|
300
|
-
});
|
|
301
|
-
var forensicSamplingBudgetSchema =
|
|
302
|
-
max_files:
|
|
303
|
-
max_lines_per_file:
|
|
304
|
-
});
|
|
305
|
-
var forensicReportSchema =
|
|
306
|
-
version:
|
|
307
|
-
generated_at:
|
|
308
|
-
generated_by:
|
|
309
|
-
target:
|
|
310
|
-
project_name:
|
|
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:
|
|
314
|
-
code_samples:
|
|
315
|
-
assertions:
|
|
316
|
-
candidate_files:
|
|
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:
|
|
350
|
+
recommendations_for_skill: z7.array(z7.string()).optional()
|
|
320
351
|
});
|
|
321
352
|
|
|
322
353
|
// src/schemas/init-context.ts
|
|
323
|
-
import { z as
|
|
324
|
-
var initContextFrameworkSchema =
|
|
325
|
-
kind:
|
|
326
|
-
version:
|
|
327
|
-
subkind:
|
|
328
|
-
});
|
|
329
|
-
var initContextInvariantConfidenceSnapshotSchema =
|
|
330
|
-
confidence:
|
|
331
|
-
evidence_refs:
|
|
332
|
-
});
|
|
333
|
-
var initContextSourceEvidenceSchema =
|
|
334
|
-
file:
|
|
335
|
-
lines:
|
|
336
|
-
});
|
|
337
|
-
var initContextInvariantSchema =
|
|
338
|
-
type:
|
|
339
|
-
rule:
|
|
340
|
-
rationale:
|
|
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:
|
|
343
|
-
});
|
|
344
|
-
var initContextDomainGroupSchema =
|
|
345
|
-
name:
|
|
346
|
-
paths:
|
|
347
|
-
summary:
|
|
348
|
-
topology_type:
|
|
349
|
-
target_path:
|
|
350
|
-
});
|
|
351
|
-
var initContextInterviewTrailEntrySchema =
|
|
352
|
-
phase:
|
|
353
|
-
question:
|
|
354
|
-
answer:
|
|
355
|
-
presentation:
|
|
356
|
-
user_corrections:
|
|
357
|
-
});
|
|
358
|
-
var initContextSchema =
|
|
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:
|
|
361
|
-
invariants:
|
|
362
|
-
domain_groups:
|
|
363
|
-
interview_trail:
|
|
364
|
-
forensic_ref:
|
|
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
|
|
369
|
-
var metaUpdatedEventSchema =
|
|
370
|
-
type:
|
|
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 =
|
|
374
|
-
type:
|
|
375
|
-
payload:
|
|
376
|
-
locked:
|
|
377
|
-
drifted:
|
|
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 =
|
|
381
|
-
type:
|
|
382
|
-
payload:
|
|
383
|
-
locked:
|
|
384
|
-
approved:
|
|
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 =
|
|
388
|
-
type:
|
|
418
|
+
var ledgerAppendedEventSchema = z9.object({
|
|
419
|
+
type: z9.literal("ledger:appended"),
|
|
389
420
|
payload: ledgerEntrySchema
|
|
390
421
|
});
|
|
391
|
-
var driftDetectedEventSchema =
|
|
392
|
-
type:
|
|
422
|
+
var driftDetectedEventSchema = z9.object({
|
|
423
|
+
type: z9.literal("drift:detected"),
|
|
393
424
|
payload: forensicReportSchema
|
|
394
425
|
});
|
|
395
|
-
var fabricEventSchema =
|
|
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
|
};
|
package/dist/types/index.d.ts
CHANGED