@habitat-ai/service 0.2.0 → 0.2.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/service/impl.d.ts +222 -2
- package/dist/service/modules/catalog/contract/catalog.d.ts +111 -1
- package/dist/service/modules/catalog/model/dto/catalog.d.ts +124 -5
- package/dist/service/modules/catalog/model/dto/catalog.js +141 -10
- package/dist/service/modules/catalog/model/dto/check.d.ts +60 -0
- package/dist/service/modules/catalog/model/dto/check.js +135 -98
- package/dist/service/modules/catalog/model/dto/structure.d.ts +18 -0
- package/dist/service/modules/catalog/model/dto/structure.js +39 -0
- package/dist/service/modules/catalog/model/policy/catalog.d.ts +16 -4
- package/dist/service/modules/catalog/model/policy/catalog.js +104 -9
- package/dist/service/modules/catalog/model/policy/check.d.ts +14 -2
- package/dist/service/modules/catalog/model/policy/check.js +70 -7
- package/dist/service/modules/catalog/model/policy/structure.d.ts +10 -4
- package/dist/service/modules/catalog/model/policy/structure.js +45 -2
- package/dist/service/modules/catalog/module.d.ts +222 -2
- package/dist/service/modules/catalog/router/catalog.router.d.ts +111 -1
- package/dist/service/modules/catalog/router/catalog.router.js +199 -8
- package/dist/service/modules/catalog/router.d.ts +111 -1
- package/dist/service/router.d.ts +111 -1
- package/package.json +9 -4
|
@@ -302,11 +302,142 @@ const ResolvedRuleApplicationSchema = Type.Object({
|
|
|
302
302
|
description: "Fully resolved runner and acquisition facts.",
|
|
303
303
|
}),
|
|
304
304
|
}, { additionalProperties: false, description: "One resolved instance/rule application." });
|
|
305
|
-
const
|
|
305
|
+
const CompatibilityPlacementSchema = Type.Object({
|
|
306
|
+
niche: Type.String({
|
|
307
|
+
minLength: 1,
|
|
308
|
+
description: "Frozen version-two niche classification.",
|
|
309
|
+
}),
|
|
310
|
+
blueprint: Type.String({
|
|
311
|
+
minLength: 1,
|
|
312
|
+
description: "Frozen version-two blueprint classification.",
|
|
313
|
+
}),
|
|
314
|
+
category: Type.Union([
|
|
315
|
+
Type.Literal("boundary"),
|
|
316
|
+
Type.Literal("contract"),
|
|
317
|
+
Type.Literal("execution"),
|
|
318
|
+
Type.Literal("output"),
|
|
319
|
+
Type.Literal("policy"),
|
|
320
|
+
Type.Literal("quality"),
|
|
321
|
+
Type.Literal("structure"),
|
|
322
|
+
], { description: "Frozen version-two rule category." }),
|
|
323
|
+
}, { additionalProperties: false, description: "Legacy rule classification metadata." });
|
|
324
|
+
const CompatibilityPathCoverageSchema = Type.Object({
|
|
325
|
+
kind: Type.Literal("exact-path", {
|
|
326
|
+
description: "Legacy exact repository-path subject declaration.",
|
|
327
|
+
}),
|
|
328
|
+
patterns: Type.Array(Type.String({
|
|
329
|
+
minLength: 1,
|
|
330
|
+
maxLength: 4_096,
|
|
331
|
+
description: "Repository-relative path or glob admitted for checking and caching.",
|
|
332
|
+
}), {
|
|
333
|
+
minItems: 1,
|
|
334
|
+
uniqueItems: true,
|
|
335
|
+
description: "Unique repository path patterns covered by the rule.",
|
|
336
|
+
}),
|
|
337
|
+
}, { additionalProperties: false, description: "Legacy exact-path coverage entry." });
|
|
338
|
+
const CompatibilitySupportFilesSchema = Type.Object({
|
|
339
|
+
baseline: RelativePathSchema,
|
|
340
|
+
}, { additionalProperties: false, description: "Legacy rule support-file locators." });
|
|
341
|
+
const CompatibilityGritRunnerSourceSchema = Type.Object({
|
|
342
|
+
name: Type.Literal("grit", { description: "Grit runner identity." }),
|
|
343
|
+
files: Type.Object({
|
|
344
|
+
pattern: RelativePathSchema,
|
|
345
|
+
}, { additionalProperties: false, description: "Grit rule asset locator." }),
|
|
346
|
+
patternName: PatternNameSchema,
|
|
347
|
+
acquisition: Type.Object({
|
|
348
|
+
kind: Type.Literal("check", { description: "Supported compatibility operation." }),
|
|
349
|
+
roots: Type.Array(RelativePathSchema, {
|
|
350
|
+
minItems: 1,
|
|
351
|
+
uniqueItems: true,
|
|
352
|
+
description: "Concrete repository roots supplied to Grit.",
|
|
353
|
+
}),
|
|
354
|
+
}, { additionalProperties: false, description: "Compatibility Grit acquisition roots." }),
|
|
355
|
+
}, { additionalProperties: false, description: "Supported legacy Grit runner declaration." });
|
|
356
|
+
const CompatibilityStructureRunnerSourceSchema = Type.Object({
|
|
357
|
+
name: Type.Literal("habitat", { description: "Native Habitat runner identity." }),
|
|
358
|
+
mode: Type.Literal("structure", { description: "Native structure evaluation mode." }),
|
|
359
|
+
files: Type.Object({
|
|
360
|
+
structure: RelativePathSchema,
|
|
361
|
+
}, { additionalProperties: false, description: "Structure rule asset locator." }),
|
|
362
|
+
}, { additionalProperties: false, description: "Supported legacy structure runner declaration." });
|
|
363
|
+
const CompatibilityRuleSourceCommon = {
|
|
364
|
+
schemaVersion: Type.Literal(2, { description: "Legacy rule schema version." }),
|
|
306
365
|
id: IdSchema,
|
|
366
|
+
title: Type.String({ minLength: 1, maxLength: 500, description: "Legacy rule title." }),
|
|
367
|
+
placement: CompatibilityPlacementSchema,
|
|
368
|
+
operation: Type.Object({
|
|
369
|
+
kind: Type.Literal("check", { description: "Only admitted compatibility operation." }),
|
|
370
|
+
}, { additionalProperties: false, description: "Legacy rule operation." }),
|
|
371
|
+
ownerProject: ProjectIdSchema,
|
|
372
|
+
lane: Type.Literal("enforced", { description: "Only admitted compatibility policy lane." }),
|
|
373
|
+
forbids: Type.String({
|
|
374
|
+
minLength: 1,
|
|
375
|
+
maxLength: 16_384,
|
|
376
|
+
description: "State excluded by the compatibility rule.",
|
|
377
|
+
}),
|
|
378
|
+
why: Type.String({
|
|
379
|
+
minLength: 1,
|
|
380
|
+
maxLength: 16_384,
|
|
381
|
+
description: "Reason the compatibility rule exists.",
|
|
382
|
+
}),
|
|
383
|
+
remediate: Type.String({
|
|
384
|
+
minLength: 1,
|
|
385
|
+
maxLength: 16_384,
|
|
386
|
+
description: "Operator remediation for one finding.",
|
|
387
|
+
}),
|
|
388
|
+
message: RuleMessageSchema,
|
|
389
|
+
pathCoverage: Type.Tuple([CompatibilityPathCoverageSchema], {
|
|
390
|
+
description: "Single exact-path cache boundary for the compatibility rule.",
|
|
391
|
+
}),
|
|
392
|
+
supportFiles: CompatibilitySupportFilesSchema,
|
|
393
|
+
};
|
|
394
|
+
const CompatibilityGritRuleSourceSchema = Type.Object({
|
|
395
|
+
...CompatibilityRuleSourceCommon,
|
|
396
|
+
hookCheck: Type.Literal(true, {
|
|
397
|
+
description: "The legacy hook executes this Grit check.",
|
|
398
|
+
}),
|
|
399
|
+
runner: CompatibilityGritRunnerSourceSchema,
|
|
400
|
+
}, { additionalProperties: false, description: "Supported legacy Grit rule source." });
|
|
401
|
+
const CompatibilityStructureRuleSourceSchema = Type.Object({
|
|
402
|
+
...CompatibilityRuleSourceCommon,
|
|
403
|
+
runner: CompatibilityStructureRunnerSourceSchema,
|
|
404
|
+
}, { additionalProperties: false, description: "Supported legacy structure rule source." });
|
|
405
|
+
const ResolvedCompatibilityGritRunnerSchema = Type.Object({
|
|
406
|
+
name: Type.Literal("grit", { description: "Grit runner identity." }),
|
|
407
|
+
pattern: ResolvedRuleAssetSchema,
|
|
408
|
+
patternName: PatternNameSchema,
|
|
409
|
+
acquisition: Type.Object({
|
|
410
|
+
kind: Type.Literal("check", { description: "Resolved compatibility operation." }),
|
|
411
|
+
entries: Type.Array(Type.Object({
|
|
412
|
+
kind: PathKindSchema,
|
|
413
|
+
path: RelativePathSchema,
|
|
414
|
+
}, { additionalProperties: false, description: "Resolved compatibility subject root." }), {
|
|
415
|
+
minItems: 1,
|
|
416
|
+
description: "Concrete compatibility roots in declared order.",
|
|
417
|
+
}),
|
|
418
|
+
}, { additionalProperties: false, description: "Resolved compatibility Grit acquisition." }),
|
|
419
|
+
}, { additionalProperties: false, description: "Resolved compatibility Grit runner." });
|
|
420
|
+
const ResolvedCompatibilityStructureRunnerSchema = Type.Object({
|
|
421
|
+
name: Type.Literal("habitat", { description: "Native Habitat runner identity." }),
|
|
422
|
+
mode: Type.Literal("structure", { description: "Native structure evaluation mode." }),
|
|
423
|
+
structure: ResolvedRuleAssetSchema,
|
|
424
|
+
}, { additionalProperties: false, description: "Resolved compatibility structure runner." });
|
|
425
|
+
const CompatibilityRuleSchema = Type.Object({
|
|
426
|
+
ruleId: IdSchema,
|
|
307
427
|
ownerProject: ProjectIdSchema,
|
|
308
428
|
manifestPath: RelativePathSchema,
|
|
309
|
-
|
|
429
|
+
lane: Type.Literal("enforced", { description: "Compatibility rule policy lane." }),
|
|
430
|
+
message: RuleMessageSchema,
|
|
431
|
+
remediate: RuleRemediationSchema,
|
|
432
|
+
provenance: LocalAuthorityProvenanceSchema,
|
|
433
|
+
coveragePatterns: Type.Array(Type.String({ minLength: 1, maxLength: 4_096 }), {
|
|
434
|
+
minItems: 1,
|
|
435
|
+
uniqueItems: true,
|
|
436
|
+
description: "Repository path patterns that define compatibility subjects and cache inputs.",
|
|
437
|
+
}),
|
|
438
|
+
baseline: ResolvedRuleAssetSchema,
|
|
439
|
+
runner: Type.Union([ResolvedCompatibilityStructureRunnerSchema, ResolvedCompatibilityGritRunnerSchema], { description: "Resolved compatibility runner and its concrete assets." }),
|
|
440
|
+
}, { additionalProperties: false, description: "One executable version 2 compatibility rule." });
|
|
310
441
|
/** Closed compatibility index source schema. */
|
|
311
442
|
export const CompatibilityIndexSchema = Type.Object({
|
|
312
443
|
$comment: Type.Optional(Type.String({ description: "Optional legacy index comment." })),
|
|
@@ -316,21 +447,21 @@ export const CompatibilityIndexSchema = Type.Object({
|
|
|
316
447
|
description: "Legacy owner roots keyed by project identity.",
|
|
317
448
|
}),
|
|
318
449
|
}, { additionalProperties: false, description: "Legacy version 2 registry index." });
|
|
319
|
-
/**
|
|
320
|
-
export const CompatibilityRuleSourceSchema = Type.
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
450
|
+
/** Closed admission schema for the exact executable legacy rule subset. */
|
|
451
|
+
export const CompatibilityRuleSourceSchema = Type.Union([CompatibilityGritRuleSourceSchema, CompatibilityStructureRuleSourceSchema], { description: "Supported version 2 compatibility rule source." });
|
|
452
|
+
/** Closed empty baseline admitted during compatibility resolution. */
|
|
453
|
+
export const CompatibilityBaselineSchema = Type.Tuple([], {
|
|
454
|
+
description: "Empty compatibility baseline; every observed finding remains live.",
|
|
455
|
+
});
|
|
325
456
|
const CompatibilityCatalogSchema = Type.Object({
|
|
326
457
|
schemaVersion: Type.Literal(2, { description: "Legacy compatibility catalog version." }),
|
|
327
458
|
ownerRoots: Type.Record(ProjectIdSchema, RelativePathSchema, {
|
|
328
459
|
description: "Validated legacy owner roots keyed by project identity.",
|
|
329
460
|
}),
|
|
330
461
|
rules: Type.Array(CompatibilityRuleSchema, {
|
|
331
|
-
description: "
|
|
462
|
+
description: "Resolved executable compatibility rules in stable identity order.",
|
|
332
463
|
}),
|
|
333
|
-
}, { additionalProperties: false, description: "
|
|
464
|
+
}, { additionalProperties: false, description: "Version 2 compatibility rule catalog." });
|
|
334
465
|
const ResolvedPolicyPackSchema = Type.Object({
|
|
335
466
|
name: PackageNameSchema,
|
|
336
467
|
version: PackageVersionSchema,
|
|
@@ -60,6 +60,42 @@ export declare const CheckCatalogResultSchema: Type.TUnion<[Type.TObject<{
|
|
|
60
60
|
severity: Type.TUnion<[Type.TLiteral<"error">, Type.TLiteral<"advisory">]>;
|
|
61
61
|
baselined: Type.TLiteral<false>;
|
|
62
62
|
}>>;
|
|
63
|
+
}>, Type.TObject<{
|
|
64
|
+
ownerProject: Type.TString;
|
|
65
|
+
instanceId: Type.TNull;
|
|
66
|
+
ruleId: Type.TString;
|
|
67
|
+
runner: Type.TLiteral<"grit">;
|
|
68
|
+
lane: Type.TUnion<[Type.TLiteral<"enforced">, Type.TLiteral<"advisory">]>;
|
|
69
|
+
locked: Type.TLiteral<true>;
|
|
70
|
+
status: Type.TUnion<[Type.TLiteral<"pass">, Type.TLiteral<"fail">, Type.TLiteral<"advisory-findings">, Type.TLiteral<"error">]>;
|
|
71
|
+
message: Type.TString;
|
|
72
|
+
remediate: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
73
|
+
disposition: Type.TUnion<[Type.TObject<{
|
|
74
|
+
kind: Type.TLiteral<"evaluated">;
|
|
75
|
+
}>, Type.TObject<{
|
|
76
|
+
kind: Type.TLiteral<"not-applicable">;
|
|
77
|
+
reason: Type.TLiteral<"no-matched-acquisition-roots">;
|
|
78
|
+
}>, Type.TObject<{
|
|
79
|
+
kind: Type.TLiteral<"failed">;
|
|
80
|
+
reason: Type.TUnion<[Type.TUnion<[Type.TLiteral<"InvalidInput">, Type.TLiteral<"SetupFailed">, Type.TLiteral<"ExecutionFailed">, Type.TLiteral<"TimedOut">, Type.TLiteral<"InvalidOutput">]>, Type.TLiteral<"PatternReadFailed">, Type.TLiteral<"PatternInvalid">, Type.TLiteral<"FindingPathInvalid">]>;
|
|
81
|
+
detail: Type.TString;
|
|
82
|
+
}>]>;
|
|
83
|
+
findings: Type.TArray<Type.TObject<{
|
|
84
|
+
path: Type.TString;
|
|
85
|
+
start: Type.TObject<{
|
|
86
|
+
line: Type.TReadonly<Type.TInteger>;
|
|
87
|
+
column: Type.TReadonly<Type.TInteger>;
|
|
88
|
+
offset: Type.TReadonly<Type.TInteger>;
|
|
89
|
+
}>;
|
|
90
|
+
end: Type.TObject<{
|
|
91
|
+
line: Type.TReadonly<Type.TInteger>;
|
|
92
|
+
column: Type.TReadonly<Type.TInteger>;
|
|
93
|
+
offset: Type.TReadonly<Type.TInteger>;
|
|
94
|
+
}>;
|
|
95
|
+
message: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
96
|
+
severity: Type.TUnion<[Type.TLiteral<"error">, Type.TLiteral<"advisory">]>;
|
|
97
|
+
baselined: Type.TLiteral<false>;
|
|
98
|
+
}>>;
|
|
63
99
|
}>, Type.TObject<{
|
|
64
100
|
ownerProject: Type.TString;
|
|
65
101
|
instanceId: Type.TString;
|
|
@@ -84,6 +120,30 @@ export declare const CheckCatalogResultSchema: Type.TUnion<[Type.TObject<{
|
|
|
84
120
|
severity: Type.TUnion<[Type.TLiteral<"error">, Type.TLiteral<"advisory">]>;
|
|
85
121
|
baselined: Type.TLiteral<false>;
|
|
86
122
|
}>>;
|
|
123
|
+
}>, Type.TObject<{
|
|
124
|
+
ownerProject: Type.TString;
|
|
125
|
+
instanceId: Type.TNull;
|
|
126
|
+
ruleId: Type.TString;
|
|
127
|
+
runner: Type.TLiteral<"habitat">;
|
|
128
|
+
lane: Type.TUnion<[Type.TLiteral<"enforced">, Type.TLiteral<"advisory">]>;
|
|
129
|
+
locked: Type.TLiteral<true>;
|
|
130
|
+
status: Type.TUnion<[Type.TLiteral<"pass">, Type.TLiteral<"fail">, Type.TLiteral<"advisory-findings">, Type.TLiteral<"error">]>;
|
|
131
|
+
message: Type.TString;
|
|
132
|
+
remediate: Type.TUnion<[Type.TString, Type.TNull]>;
|
|
133
|
+
disposition: Type.TUnion<[Type.TObject<{
|
|
134
|
+
kind: Type.TLiteral<"evaluated">;
|
|
135
|
+
}>, Type.TObject<{
|
|
136
|
+
kind: Type.TLiteral<"failed">;
|
|
137
|
+
reason: Type.TUnion<[Type.TLiteral<"StructureReadFailed">, Type.TLiteral<"StructureInvalid">, Type.TLiteral<"InventoryFailed">, Type.TLiteral<"StructureObservationFailed">]>;
|
|
138
|
+
detail: Type.TString;
|
|
139
|
+
}>]>;
|
|
140
|
+
findings: Type.TArray<Type.TObject<{
|
|
141
|
+
path: Type.TString;
|
|
142
|
+
code: Type.TUnion<[Type.TLiteral<"root-missing">, Type.TLiteral<"wrong-root-kind">, Type.TLiteral<"missing-required-child">, Type.TLiteral<"forbidden-child">, Type.TLiteral<"unexpected-child">]>;
|
|
143
|
+
message: Type.TString;
|
|
144
|
+
severity: Type.TUnion<[Type.TLiteral<"error">, Type.TLiteral<"advisory">]>;
|
|
145
|
+
baselined: Type.TLiteral<false>;
|
|
146
|
+
}>>;
|
|
87
147
|
}>]>>;
|
|
88
148
|
}>]>;
|
|
89
149
|
/** Caller request for one current-catalog check. */
|
|
@@ -67,6 +67,44 @@ const CheckSelectionIssueSchema = Type.Object({
|
|
|
67
67
|
additionalProperties: false,
|
|
68
68
|
description: "One expected application-selection refusal.",
|
|
69
69
|
});
|
|
70
|
+
const ReportOwnerProjectSchema = Type.String({
|
|
71
|
+
minLength: 1,
|
|
72
|
+
maxLength: 250,
|
|
73
|
+
description: "Repository project that owns the checked rule.",
|
|
74
|
+
});
|
|
75
|
+
const ReportInstanceIdSchema = Type.String({
|
|
76
|
+
minLength: 1,
|
|
77
|
+
maxLength: 250,
|
|
78
|
+
description: "Repository-unique version-three instance identity.",
|
|
79
|
+
});
|
|
80
|
+
const ReportRuleIdSchema = Type.String({
|
|
81
|
+
minLength: 1,
|
|
82
|
+
maxLength: 200,
|
|
83
|
+
description: "Resolved rule identity.",
|
|
84
|
+
});
|
|
85
|
+
const ReportLaneSchema = Type.Union([Type.Literal("enforced"), Type.Literal("advisory")], {
|
|
86
|
+
description: "Rule lane that determines finding severity and terminal status.",
|
|
87
|
+
});
|
|
88
|
+
const ReportMessageSchema = Type.String({
|
|
89
|
+
minLength: 1,
|
|
90
|
+
maxLength: 8_192,
|
|
91
|
+
description: "Rule-authored diagnostic message.",
|
|
92
|
+
});
|
|
93
|
+
const ReportRemediationSchema = Type.Union([Type.String({ maxLength: 16_384 }), Type.Null()], {
|
|
94
|
+
description: "Rule-authored remediation when supplied.",
|
|
95
|
+
});
|
|
96
|
+
const InstanceReportLockSchema = Type.Literal(false, {
|
|
97
|
+
description: "Version-three applications do not use compatibility baseline locking.",
|
|
98
|
+
});
|
|
99
|
+
const CompatibilityReportLockSchema = Type.Literal(true, {
|
|
100
|
+
description: "The compatibility rule has an admitted exact empty baseline.",
|
|
101
|
+
});
|
|
102
|
+
const GritRunnerSchema = Type.Literal("grit", {
|
|
103
|
+
description: "Mechanical Grit runner used by this check.",
|
|
104
|
+
});
|
|
105
|
+
const StructureRunnerSchema = Type.Literal("habitat", {
|
|
106
|
+
description: "Native Habitat structure runner used by this check.",
|
|
107
|
+
});
|
|
70
108
|
const GritCheckFindingSchema = Type.Object({
|
|
71
109
|
path: Type.String({
|
|
72
110
|
minLength: 1,
|
|
@@ -82,7 +120,7 @@ const GritCheckFindingSchema = Type.Object({
|
|
|
82
120
|
description: "Service-owned severity derived from the application lane.",
|
|
83
121
|
}),
|
|
84
122
|
baselined: Type.Literal(false, {
|
|
85
|
-
description: "
|
|
123
|
+
description: "No admitted baseline suppresses this observed finding.",
|
|
86
124
|
}),
|
|
87
125
|
}, {
|
|
88
126
|
additionalProperties: false,
|
|
@@ -96,80 +134,83 @@ const CheckApplicationStatusSchema = Type.Union([
|
|
|
96
134
|
], {
|
|
97
135
|
description: "Semantic terminal status for one resolved application.",
|
|
98
136
|
});
|
|
99
|
-
const
|
|
100
|
-
Type.
|
|
101
|
-
|
|
102
|
-
description: "The application completed mechanical evaluation.",
|
|
103
|
-
}),
|
|
104
|
-
}, {
|
|
105
|
-
additionalProperties: false,
|
|
106
|
-
description: "Completed mechanical evaluation disposition.",
|
|
137
|
+
const GritEvaluatedDispositionSchema = Type.Object({
|
|
138
|
+
kind: Type.Literal("evaluated", {
|
|
139
|
+
description: "The application completed mechanical evaluation.",
|
|
107
140
|
}),
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}),
|
|
112
|
-
reason: Type.Union([
|
|
113
|
-
RuleEvaluationFailureReasonSchema,
|
|
114
|
-
Type.Literal("PatternReadFailed"),
|
|
115
|
-
Type.Literal("PatternInvalid"),
|
|
116
|
-
Type.Literal("FindingPathInvalid"),
|
|
117
|
-
], {
|
|
118
|
-
description: "Stable operational failure reason.",
|
|
119
|
-
}),
|
|
120
|
-
detail: Type.String({
|
|
121
|
-
minLength: 1,
|
|
122
|
-
maxLength: 4_096,
|
|
123
|
-
description: "Bounded operational failure detail.",
|
|
124
|
-
}),
|
|
125
|
-
}, {
|
|
126
|
-
additionalProperties: false,
|
|
127
|
-
description: "Failed application evaluation disposition.",
|
|
128
|
-
}),
|
|
129
|
-
], {
|
|
130
|
-
description: "Mechanical disposition underlying one semantic application status.",
|
|
141
|
+
}, {
|
|
142
|
+
additionalProperties: false,
|
|
143
|
+
description: "Completed mechanical evaluation disposition.",
|
|
131
144
|
});
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
const GritFailedDispositionSchema = Type.Object({
|
|
146
|
+
kind: Type.Literal("failed", {
|
|
147
|
+
description: "The application could not produce trusted findings.",
|
|
148
|
+
}),
|
|
149
|
+
reason: Type.Union([
|
|
150
|
+
RuleEvaluationFailureReasonSchema,
|
|
151
|
+
Type.Literal("PatternReadFailed"),
|
|
152
|
+
Type.Literal("PatternInvalid"),
|
|
153
|
+
Type.Literal("FindingPathInvalid"),
|
|
154
|
+
], {
|
|
155
|
+
description: "Stable operational failure reason.",
|
|
156
|
+
}),
|
|
157
|
+
detail: Type.String({
|
|
144
158
|
minLength: 1,
|
|
145
|
-
maxLength:
|
|
146
|
-
description: "
|
|
147
|
-
}),
|
|
148
|
-
runner: Type.Literal("grit", {
|
|
149
|
-
description: "Mechanical runner used by this check operation.",
|
|
159
|
+
maxLength: 4_096,
|
|
160
|
+
description: "Bounded operational failure detail.",
|
|
150
161
|
}),
|
|
151
|
-
|
|
152
|
-
|
|
162
|
+
}, {
|
|
163
|
+
additionalProperties: false,
|
|
164
|
+
description: "Failed application evaluation disposition.",
|
|
165
|
+
});
|
|
166
|
+
const GritNotApplicableDispositionSchema = Type.Object({
|
|
167
|
+
kind: Type.Literal("not-applicable", {
|
|
168
|
+
description: "The compatibility rule had no live exact-coverage subjects.",
|
|
153
169
|
}),
|
|
154
|
-
|
|
155
|
-
description: "
|
|
170
|
+
reason: Type.Literal("no-matched-acquisition-roots", {
|
|
171
|
+
description: "No regular file matched both exact coverage and declared authority.",
|
|
156
172
|
}),
|
|
173
|
+
}, {
|
|
174
|
+
additionalProperties: false,
|
|
175
|
+
description: "Compatibility rule with no current subject files.",
|
|
176
|
+
});
|
|
177
|
+
const GritCheckApplicationDispositionSchema = Type.Union([GritEvaluatedDispositionSchema, GritFailedDispositionSchema], { description: "Version-three Grit evaluation disposition." });
|
|
178
|
+
const CompatibilityGritCheckApplicationDispositionSchema = Type.Union([GritEvaluatedDispositionSchema, GritNotApplicableDispositionSchema, GritFailedDispositionSchema], { description: "Compatibility Grit evaluation disposition." });
|
|
179
|
+
const GritInstanceCheckApplicationReportSchema = Type.Object({
|
|
180
|
+
ownerProject: ReportOwnerProjectSchema,
|
|
181
|
+
instanceId: ReportInstanceIdSchema,
|
|
182
|
+
ruleId: ReportRuleIdSchema,
|
|
183
|
+
runner: GritRunnerSchema,
|
|
184
|
+
lane: ReportLaneSchema,
|
|
185
|
+
locked: InstanceReportLockSchema,
|
|
157
186
|
status: CheckApplicationStatusSchema,
|
|
158
|
-
message:
|
|
159
|
-
|
|
160
|
-
maxLength: 8_192,
|
|
161
|
-
description: "Rule-authored finding message.",
|
|
162
|
-
}),
|
|
163
|
-
remediate: Type.Union([Type.String({ maxLength: 16_384 }), Type.Null()], {
|
|
164
|
-
description: "Rule-authored remediation when supplied.",
|
|
165
|
-
}),
|
|
187
|
+
message: ReportMessageSchema,
|
|
188
|
+
remediate: ReportRemediationSchema,
|
|
166
189
|
disposition: GritCheckApplicationDispositionSchema,
|
|
167
190
|
findings: Type.Array(GritCheckFindingSchema, {
|
|
168
191
|
description: "Deterministically ordered findings for this application.",
|
|
169
192
|
}),
|
|
170
193
|
}, {
|
|
171
194
|
additionalProperties: false,
|
|
172
|
-
description: "One
|
|
195
|
+
description: "One version-three Grit application report.",
|
|
196
|
+
});
|
|
197
|
+
const CompatibilityGritCheckApplicationReportSchema = Type.Object({
|
|
198
|
+
ownerProject: ReportOwnerProjectSchema,
|
|
199
|
+
instanceId: Type.Null({ description: "Compatibility rules have no version-three instance." }),
|
|
200
|
+
ruleId: ReportRuleIdSchema,
|
|
201
|
+
runner: GritRunnerSchema,
|
|
202
|
+
lane: ReportLaneSchema,
|
|
203
|
+
locked: CompatibilityReportLockSchema,
|
|
204
|
+
status: CheckApplicationStatusSchema,
|
|
205
|
+
message: ReportMessageSchema,
|
|
206
|
+
remediate: ReportRemediationSchema,
|
|
207
|
+
disposition: CompatibilityGritCheckApplicationDispositionSchema,
|
|
208
|
+
findings: Type.Array(GritCheckFindingSchema, {
|
|
209
|
+
description: "Deterministically ordered findings for this compatibility rule.",
|
|
210
|
+
}),
|
|
211
|
+
}, {
|
|
212
|
+
additionalProperties: false,
|
|
213
|
+
description: "One version-two compatibility Grit report.",
|
|
173
214
|
});
|
|
174
215
|
const StructureFindingCodeSchema = Type.Union([
|
|
175
216
|
Type.Literal("root-missing"),
|
|
@@ -194,7 +235,7 @@ const StructureCheckFindingSchema = Type.Object({
|
|
|
194
235
|
description: "Service-owned severity derived from the application lane.",
|
|
195
236
|
}),
|
|
196
237
|
baselined: Type.Literal(false, {
|
|
197
|
-
description: "
|
|
238
|
+
description: "No admitted baseline suppresses this observed finding.",
|
|
198
239
|
}),
|
|
199
240
|
}, { additionalProperties: false, description: "One path-only native structure finding." });
|
|
200
241
|
const StructureCheckApplicationDispositionSchema = Type.Union([
|
|
@@ -220,46 +261,42 @@ const StructureCheckApplicationDispositionSchema = Type.Union([
|
|
|
220
261
|
}),
|
|
221
262
|
}, { additionalProperties: false, description: "Failed native structure evaluation." }),
|
|
222
263
|
], { description: "Native structure evaluation disposition." });
|
|
223
|
-
const
|
|
224
|
-
ownerProject:
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
minLength: 1,
|
|
231
|
-
maxLength: 250,
|
|
232
|
-
description: "Resolved instance evaluated by this structure application.",
|
|
233
|
-
}),
|
|
234
|
-
ruleId: Type.String({
|
|
235
|
-
minLength: 1,
|
|
236
|
-
maxLength: 200,
|
|
237
|
-
description: "Native structure rule evaluated for this instance.",
|
|
238
|
-
}),
|
|
239
|
-
runner: Type.Literal("habitat", {
|
|
240
|
-
description: "Native Habitat runner used by this application.",
|
|
241
|
-
}),
|
|
242
|
-
lane: Type.Union([Type.Literal("enforced"), Type.Literal("advisory")], {
|
|
243
|
-
description: "Policy lane that determines finding severity and completion status.",
|
|
244
|
-
}),
|
|
245
|
-
locked: Type.Literal(false, {
|
|
246
|
-
description: "Native structure reports do not expose Grit lock semantics.",
|
|
247
|
-
}),
|
|
264
|
+
const StructureInstanceCheckApplicationReportSchema = Type.Object({
|
|
265
|
+
ownerProject: ReportOwnerProjectSchema,
|
|
266
|
+
instanceId: ReportInstanceIdSchema,
|
|
267
|
+
ruleId: ReportRuleIdSchema,
|
|
268
|
+
runner: StructureRunnerSchema,
|
|
269
|
+
lane: ReportLaneSchema,
|
|
270
|
+
locked: InstanceReportLockSchema,
|
|
248
271
|
status: CheckApplicationStatusSchema,
|
|
249
|
-
message:
|
|
250
|
-
|
|
251
|
-
maxLength: 8_192,
|
|
252
|
-
description: "Catalog-authored human guidance for this structure rule.",
|
|
253
|
-
}),
|
|
254
|
-
remediate: Type.Union([Type.String({ maxLength: 16_384 }), Type.Null()], {
|
|
255
|
-
description: "Optional catalog-authored remediation guidance.",
|
|
256
|
-
}),
|
|
272
|
+
message: ReportMessageSchema,
|
|
273
|
+
remediate: ReportRemediationSchema,
|
|
257
274
|
disposition: StructureCheckApplicationDispositionSchema,
|
|
258
275
|
findings: Type.Array(StructureCheckFindingSchema, {
|
|
259
276
|
description: "Deterministically ordered path-only structure findings.",
|
|
260
277
|
}),
|
|
261
|
-
}, { additionalProperties: false, description: "One native
|
|
262
|
-
const
|
|
278
|
+
}, { additionalProperties: false, description: "One version-three native structure report." });
|
|
279
|
+
const CompatibilityStructureCheckApplicationReportSchema = Type.Object({
|
|
280
|
+
ownerProject: ReportOwnerProjectSchema,
|
|
281
|
+
instanceId: Type.Null({ description: "Compatibility rules have no version-three instance." }),
|
|
282
|
+
ruleId: ReportRuleIdSchema,
|
|
283
|
+
runner: StructureRunnerSchema,
|
|
284
|
+
lane: ReportLaneSchema,
|
|
285
|
+
locked: CompatibilityReportLockSchema,
|
|
286
|
+
status: CheckApplicationStatusSchema,
|
|
287
|
+
message: ReportMessageSchema,
|
|
288
|
+
remediate: ReportRemediationSchema,
|
|
289
|
+
disposition: StructureCheckApplicationDispositionSchema,
|
|
290
|
+
findings: Type.Array(StructureCheckFindingSchema, {
|
|
291
|
+
description: "Deterministically ordered path-only compatibility findings.",
|
|
292
|
+
}),
|
|
293
|
+
}, { additionalProperties: false, description: "One version-two compatibility structure report." });
|
|
294
|
+
const CheckApplicationReportSchema = Type.Union([
|
|
295
|
+
GritInstanceCheckApplicationReportSchema,
|
|
296
|
+
CompatibilityGritCheckApplicationReportSchema,
|
|
297
|
+
StructureInstanceCheckApplicationReportSchema,
|
|
298
|
+
CompatibilityStructureCheckApplicationReportSchema,
|
|
299
|
+
], { description: "Runner- and authority-discriminated application check report." });
|
|
263
300
|
/** Closed total result for one current-catalog check. */
|
|
264
301
|
export const CheckCatalogResultSchema = Type.Union([
|
|
265
302
|
Type.Object({
|
|
@@ -17,7 +17,25 @@ export declare const StructureDocumentSchema: Type.TRefine<Type.TObject<{
|
|
|
17
17
|
forbidden: Type.TOptional<Type.TArray<Type.TRefine<Type.TString>>>;
|
|
18
18
|
}>>;
|
|
19
19
|
}>>;
|
|
20
|
+
/** Sole structural authority for one version-one compatibility structure document. */
|
|
21
|
+
export declare const CompatibilityStructureDocumentSchema: Type.TRefine<Type.TObject<{
|
|
22
|
+
schemaVersion: Type.TLiteral<1>;
|
|
23
|
+
scopes: Type.TArray<Type.TObject<{
|
|
24
|
+
name: Type.TString;
|
|
25
|
+
root: Type.TRefine<Type.TString>;
|
|
26
|
+
kind: Type.TUnion<[Type.TLiteral<"directory">, Type.TLiteral<"file">]>;
|
|
27
|
+
mode: Type.TUnion<[Type.TLiteral<"open">, Type.TLiteral<"closed">]>;
|
|
28
|
+
allowEmpty: Type.TOptional<Type.TBoolean>;
|
|
29
|
+
required: Type.TOptional<Type.TArray<Type.TRefine<Type.TString>>>;
|
|
30
|
+
allowed: Type.TOptional<Type.TArray<Type.TRefine<Type.TString>>>;
|
|
31
|
+
forbidden: Type.TOptional<Type.TArray<Type.TRefine<Type.TString>>>;
|
|
32
|
+
}>>;
|
|
33
|
+
}>>;
|
|
20
34
|
/** Schema-admitted version-two Habitat structure document. */
|
|
21
35
|
export type StructureDocument = Static<typeof StructureDocumentSchema>;
|
|
22
36
|
/** One schema-admitted structure scope. */
|
|
23
37
|
export type StructureScope = StructureDocument["scopes"][number];
|
|
38
|
+
/** Schema-admitted version-one compatibility structure document. */
|
|
39
|
+
export type CompatibilityStructureDocument = Static<typeof CompatibilityStructureDocumentSchema>;
|
|
40
|
+
/** One schema-admitted version-one compatibility structure scope. */
|
|
41
|
+
export type CompatibilityStructureScope = CompatibilityStructureDocument["scopes"][number];
|
|
@@ -50,6 +50,33 @@ const StructureScopeSchema = Type.Object({
|
|
|
50
50
|
description: "Unique direct-child globs rejected in every scope mode.",
|
|
51
51
|
})),
|
|
52
52
|
}, { additionalProperties: false, description: "One closed Habitat structure scope." });
|
|
53
|
+
const CompatibilityStructureScopeSchema = Type.Object({
|
|
54
|
+
name: Type.String({
|
|
55
|
+
minLength: 1,
|
|
56
|
+
maxLength: 200,
|
|
57
|
+
description: "Stable identity for one compatibility structure scope.",
|
|
58
|
+
}),
|
|
59
|
+
root: RootRelativePatternSchema,
|
|
60
|
+
kind: Type.Union([Type.Literal("directory"), Type.Literal("file")], {
|
|
61
|
+
description: "Expected kind for every matched scope root.",
|
|
62
|
+
}),
|
|
63
|
+
mode: Type.Union([Type.Literal("open"), Type.Literal("closed")], {
|
|
64
|
+
description: "Whether unmatched direct children are admitted.",
|
|
65
|
+
}),
|
|
66
|
+
allowEmpty: Type.Optional(Type.Boolean({ description: "Whether a scope may match no visible roots." })),
|
|
67
|
+
required: Type.Optional(Type.Array(DirectChildPatternSchema, {
|
|
68
|
+
uniqueItems: true,
|
|
69
|
+
description: "Unique direct-child globs that must each match at least one child.",
|
|
70
|
+
})),
|
|
71
|
+
allowed: Type.Optional(Type.Array(DirectChildPatternSchema, {
|
|
72
|
+
uniqueItems: true,
|
|
73
|
+
description: "Unique direct-child globs admitted by a closed scope.",
|
|
74
|
+
})),
|
|
75
|
+
forbidden: Type.Optional(Type.Array(DirectChildPatternSchema, {
|
|
76
|
+
uniqueItems: true,
|
|
77
|
+
description: "Unique direct-child globs rejected in every scope mode.",
|
|
78
|
+
})),
|
|
79
|
+
}, { additionalProperties: false, description: "One closed compatibility structure scope." });
|
|
53
80
|
const StructureDocumentShapeSchema = Type.Object({
|
|
54
81
|
schemaVersion: Type.Literal(2, { description: "Structure document schema version." }),
|
|
55
82
|
scopes: Type.Array(StructureScopeSchema, {
|
|
@@ -59,9 +86,21 @@ const StructureDocumentShapeSchema = Type.Object({
|
|
|
59
86
|
}, { additionalProperties: false, description: "Closed Habitat structure document." });
|
|
60
87
|
/** Sole structural authority for one version-two Habitat structure document. */
|
|
61
88
|
export const StructureDocumentSchema = Type.Refine(StructureDocumentShapeSchema, hasUniqueScopeNames, () => "Expected unique structure scope names");
|
|
89
|
+
const CompatibilityStructureDocumentShapeSchema = Type.Object({
|
|
90
|
+
schemaVersion: Type.Literal(1, { description: "Compatibility structure schema version." }),
|
|
91
|
+
scopes: Type.Array(CompatibilityStructureScopeSchema, {
|
|
92
|
+
minItems: 1,
|
|
93
|
+
description: "Compatibility structure scopes evaluated in declared order.",
|
|
94
|
+
}),
|
|
95
|
+
}, { additionalProperties: false, description: "Closed compatibility structure document." });
|
|
96
|
+
/** Sole structural authority for one version-one compatibility structure document. */
|
|
97
|
+
export const CompatibilityStructureDocumentSchema = Type.Refine(CompatibilityStructureDocumentShapeSchema, hasUniqueCompatibilityScopeNames, () => "Expected unique compatibility structure scope names");
|
|
62
98
|
function hasUniqueScopeNames(document) {
|
|
63
99
|
return new Set(document.scopes.map((scope) => scope.name)).size === document.scopes.length;
|
|
64
100
|
}
|
|
101
|
+
function hasUniqueCompatibilityScopeNames(document) {
|
|
102
|
+
return new Set(document.scopes.map((scope) => scope.name)).size === document.scopes.length;
|
|
103
|
+
}
|
|
65
104
|
function isSafeRootRelativePattern(value) {
|
|
66
105
|
if (!isValidGlob(value))
|
|
67
106
|
return false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Path } from "effect";
|
|
2
|
-
import { type BlueprintDefinition, type CatalogIssue, type CompatibilityIndex, type CompatibilityRuleSource, type HabitatInstanceManifest, type PolicyPackManifest, type PolicyPackPackageJson, type ResolveCatalogResult } from "../dto/catalog.js";
|
|
2
|
+
import { type BlueprintDefinition, type CatalogIssue, type CompatibilityBaseline, type CompatibilityIndex, type CompatibilityRuleSource, type HabitatInstanceManifest, type PolicyPackManifest, type PolicyPackPackageJson, type ResolveCatalogResult } from "../dto/catalog.js";
|
|
3
3
|
/** One schema-admitted local blueprint source. */
|
|
4
4
|
export type BlueprintSource = {
|
|
5
5
|
readonly definition: BlueprintDefinition;
|
|
@@ -23,11 +23,15 @@ export type InstanceSource = {
|
|
|
23
23
|
readonly manifest: HabitatInstanceManifest;
|
|
24
24
|
readonly relativePath: string;
|
|
25
25
|
};
|
|
26
|
-
/** One schema-admitted
|
|
27
|
-
export type
|
|
26
|
+
/** One schema-admitted compatibility rule source before support-file admission. */
|
|
27
|
+
export type CompatibilityRuleSourceDocument = {
|
|
28
28
|
readonly rule: CompatibilityRuleSource;
|
|
29
29
|
readonly relativePath: string;
|
|
30
30
|
};
|
|
31
|
+
/** One compatibility rule whose empty baseline has been admitted. */
|
|
32
|
+
export type CompatibilityRuleDocument = CompatibilityRuleSourceDocument & {
|
|
33
|
+
readonly baseline: CompatibilityBaseline;
|
|
34
|
+
};
|
|
31
35
|
/** Schema-admitted authority documents observed by the resolve handler. */
|
|
32
36
|
export type CatalogDocuments = {
|
|
33
37
|
readonly policyPack: PolicyPackSource;
|
|
@@ -96,7 +100,15 @@ export declare function admitCompatibilityIndex(value: unknown, relativePath: st
|
|
|
96
100
|
/** Admits only the inert identity fields required from a legacy rule source. */
|
|
97
101
|
export declare function admitCompatibilityRule(value: unknown, relativePath: string): {
|
|
98
102
|
readonly ok: true;
|
|
99
|
-
readonly source:
|
|
103
|
+
readonly source: CompatibilityRuleSourceDocument;
|
|
104
|
+
} | {
|
|
105
|
+
readonly ok: false;
|
|
106
|
+
readonly issues: readonly CatalogIssue[];
|
|
107
|
+
};
|
|
108
|
+
/** Admits the exact empty baseline supported by compatibility execution. */
|
|
109
|
+
export declare function admitCompatibilityBaseline(value: unknown, relativePath: string): {
|
|
110
|
+
readonly ok: true;
|
|
111
|
+
readonly value: CompatibilityBaseline;
|
|
100
112
|
} | {
|
|
101
113
|
readonly ok: false;
|
|
102
114
|
readonly issues: readonly CatalogIssue[];
|