@deftai/directive-types 0.68.0 → 0.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/policy.d.ts +9 -1
- package/dist/policy.js +1 -0
- package/dist/resolution.d.ts +93 -0
- package/dist/resolution.js +31 -0
- package/package.json +1 -1
- package/schemas/resolution-plan-v1.schema.json +75 -0
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { collectExtensionProperties, type ExtensionKey, isExtensionKey, } from "
|
|
|
4
4
|
export { GATE_EXIT_CONFIG_ERROR, GATE_EXIT_OK, GATE_EXIT_VIOLATION, type GateExitCode, type GateResult, } from "./gate.js";
|
|
5
5
|
export { type PlanPolicy, type ProjectionProviderExpectation, type ProjectionProviderPolicy, REGISTERED_POLICY_FIELD_NAMES, type TriageScopeRule, } from "./policy.js";
|
|
6
6
|
export { isVBriefReferenceType, KNOWN_REFERENCE_TYPES, type KnownReferenceType, referenceTypeMatches, type TrustLevel, type VBriefReference, } from "./reference.js";
|
|
7
|
+
export { RESOLUTION_ENCODINGS, RESOLUTION_MODES, RESOLUTION_PLAN_SCHEMA_VERSION, type ResolutionEncoding, type ResolutionFacts, type ResolutionFile, type ResolutionMode, type ResolutionNextAction, type ResolutionPlan, } from "./resolution.js";
|
|
7
8
|
export { FOLDER_ALLOWED_STATUSES, type Status, VALID_STATUSES, } from "./status.js";
|
|
8
9
|
/** Relative path to the published v0.6 core JSON Schema inside the npm package. */
|
|
9
10
|
export declare const PUBLISHED_VBRIEF_CORE_SCHEMA_PATH: "schemas/vbrief-core-0.6.schema.json";
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { collectExtensionProperties, isExtensionKey, } from "./extension.js";
|
|
|
3
3
|
export { GATE_EXIT_CONFIG_ERROR, GATE_EXIT_OK, GATE_EXIT_VIOLATION, } from "./gate.js";
|
|
4
4
|
export { REGISTERED_POLICY_FIELD_NAMES, } from "./policy.js";
|
|
5
5
|
export { isVBriefReferenceType, KNOWN_REFERENCE_TYPES, referenceTypeMatches, } from "./reference.js";
|
|
6
|
+
export { RESOLUTION_ENCODINGS, RESOLUTION_MODES, RESOLUTION_PLAN_SCHEMA_VERSION, } from "./resolution.js";
|
|
6
7
|
export { FOLDER_ALLOWED_STATUSES, VALID_STATUSES, } from "./status.js";
|
|
7
8
|
/** Relative path to the published v0.6 core JSON Schema inside the npm package. */
|
|
8
9
|
export const PUBLISHED_VBRIEF_CORE_SCHEMA_PATH = "schemas/vbrief-core-0.6.schema.json";
|
package/dist/policy.d.ts
CHANGED
|
@@ -10,6 +10,14 @@ export interface PlanPolicy {
|
|
|
10
10
|
readonly allowDirectCommitsToMaster?: boolean;
|
|
11
11
|
readonly wipCap?: number;
|
|
12
12
|
readonly sessionRitualStalenessHours?: number | null;
|
|
13
|
+
/**
|
|
14
|
+
* Engine-vs-pin skew tolerance for the three-band skew policy (#2264).
|
|
15
|
+
*
|
|
16
|
+
* Pre-1.0 the window is measured in minor versions (default 3); post-1.0 it
|
|
17
|
+
* collapses to "same major". `engine > pin` beyond this window fails closed
|
|
18
|
+
* unless `--accept-engine-jump` / `DEFT_ACCEPT_ENGINE_SKEW=1` is supplied.
|
|
19
|
+
*/
|
|
20
|
+
readonly engineSkewWindow?: number | null;
|
|
13
21
|
readonly triageScope?: readonly TriageScopeRule[];
|
|
14
22
|
readonly triageScopeIgnores?: readonly unknown[];
|
|
15
23
|
readonly triageRankingLabels?: readonly string[];
|
|
@@ -32,5 +40,5 @@ export interface ProjectionProviderPolicy {
|
|
|
32
40
|
readonly [key: `x-${string}`]: unknown;
|
|
33
41
|
}
|
|
34
42
|
/** Canonical dotted policy field names registered by the directive engine. */
|
|
35
|
-
export declare const REGISTERED_POLICY_FIELD_NAMES: readonly ["plan.policy.allowDirectCommitsToMaster", "plan.policy.wipCap", "plan.policy.sessionRitualStalenessHours", "plan.policy.triageScope", "plan.policy.triageScopeIgnores", "plan.policy.triageRankingLabels", "plan.policy.triageAutoClassify", "plan.policy.triageHoldMarkers", "plan.policy.swarmSubagentBackend"];
|
|
43
|
+
export declare const REGISTERED_POLICY_FIELD_NAMES: readonly ["plan.policy.allowDirectCommitsToMaster", "plan.policy.wipCap", "plan.policy.sessionRitualStalenessHours", "plan.policy.triageScope", "plan.policy.triageScopeIgnores", "plan.policy.triageRankingLabels", "plan.policy.triageAutoClassify", "plan.policy.triageHoldMarkers", "plan.policy.swarmSubagentBackend", "plan.policy.engineSkewWindow"];
|
|
36
44
|
//# sourceMappingURL=policy.d.ts.map
|
package/dist/policy.js
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public contract for the shared resolution spine (keystone #2264 / epic #2203).
|
|
3
|
+
*
|
|
4
|
+
* `classify()` (in @deftai/directive-core/resolution) produces the orthogonal
|
|
5
|
+
* {@link ResolutionFacts} fact-set; `plan()` applies one ordered precedence
|
|
6
|
+
* table over those facts and emits a {@link ResolutionPlan}, the single
|
|
7
|
+
* versioned public JSON schema every epic-#2203 consumer derives from
|
|
8
|
+
* (init / update / doctor / headless). Keeping the decision behind one schema
|
|
9
|
+
* closes the #537 split-source drift risk.
|
|
10
|
+
*
|
|
11
|
+
* The matching JSON Schema lives at
|
|
12
|
+
* `packages/types/schemas/resolution-plan-v1.schema.json` and MUST stay in
|
|
13
|
+
* lockstep with the types below (a lockstep test enforces it in the core
|
|
14
|
+
* resolution suite).
|
|
15
|
+
*/
|
|
16
|
+
/** Schema version tag stamped into every {@link ResolutionPlan}. */
|
|
17
|
+
export declare const RESOLUTION_PLAN_SCHEMA_VERSION: "resolution-plan/v1";
|
|
18
|
+
/** Content encoding for a file the plan recommends materialising. */
|
|
19
|
+
export type ResolutionEncoding = "utf-8" | "base64";
|
|
20
|
+
/**
|
|
21
|
+
* Orthogonal project + engine fact-set returned by `classify()`.
|
|
22
|
+
*
|
|
23
|
+
* It is deliberately a flat set of independent facts, never a single collapsed
|
|
24
|
+
* enum — `plan()` owns the collapse into one recommended action so there is
|
|
25
|
+
* exactly one precedence table in the system.
|
|
26
|
+
*/
|
|
27
|
+
export interface ResolutionFacts {
|
|
28
|
+
/** A git worktree is present at the classified root. */
|
|
29
|
+
readonly hasGit: boolean;
|
|
30
|
+
/** Consumer application source is present (app markers, not just a Deft deposit). */
|
|
31
|
+
readonly hasAppCode: boolean;
|
|
32
|
+
/** The canonical `.deft/core/` vendored payload directory is present. */
|
|
33
|
+
readonly hasDeftCore: boolean;
|
|
34
|
+
/** Version marker read from the `.deft/core/VERSION` manifest, or null. */
|
|
35
|
+
readonly deftCorePayloadVersion: string | null;
|
|
36
|
+
/** `AGENTS.md` carries a v2/v3 managed section. */
|
|
37
|
+
readonly hasManagedSection: boolean;
|
|
38
|
+
/** `sha=` attribute parsed from the managed-section open marker, or null. */
|
|
39
|
+
readonly managedSectionSha: string | null;
|
|
40
|
+
/** A legacy `vbrief/` lifecycle tree is present. */
|
|
41
|
+
readonly hasVbrief: boolean;
|
|
42
|
+
/** An `xbrief/` lifecycle tree is present. */
|
|
43
|
+
readonly hasXbrief: boolean;
|
|
44
|
+
/** Pre-v0.20 document-model artifacts require migration before any gate. */
|
|
45
|
+
readonly preCutoverArtifacts: boolean;
|
|
46
|
+
/** A Directive engine is reachable in the execution environment. */
|
|
47
|
+
readonly engineReachable: boolean;
|
|
48
|
+
/** Version of the reachable engine, or null when unreachable. */
|
|
49
|
+
readonly engineVersion: string | null;
|
|
50
|
+
/** Exact committed `package.json` devDependency pin, or null. */
|
|
51
|
+
readonly pinVersion: string | null;
|
|
52
|
+
}
|
|
53
|
+
/** A file the plan recommends materialising (empty in the keystone spine). */
|
|
54
|
+
export interface ResolutionFile {
|
|
55
|
+
readonly path: string;
|
|
56
|
+
readonly content: string;
|
|
57
|
+
readonly encoding: ResolutionEncoding;
|
|
58
|
+
}
|
|
59
|
+
/** The single recommended next action for the resolved mode. */
|
|
60
|
+
export interface ResolutionNextAction {
|
|
61
|
+
/** Command to run, or null when the action is manual / has no single command. */
|
|
62
|
+
readonly command: string | null;
|
|
63
|
+
/** Why this action is recommended (the resolved fact combination). */
|
|
64
|
+
readonly rootCause: string;
|
|
65
|
+
/** Human-facing remediation guidance. */
|
|
66
|
+
readonly remediation: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The one recommended resolution mode. `plan()` emits exactly one.
|
|
70
|
+
*
|
|
71
|
+
* - `proceed` — engine + content matched; run the requested gate.
|
|
72
|
+
* - `init` — no usable deposit; deposit / reconstitute one.
|
|
73
|
+
* - `migrate` — pre-v0.20 (or legacy) artifacts must migrate first.
|
|
74
|
+
* - `update` — deposit present but content behind the pin; forward-migrate.
|
|
75
|
+
* - `install-global` — install the pinned engine into the global prefix.
|
|
76
|
+
* - `install-sandbox` — install the pinned engine into `.deft/.cli/<platform>`.
|
|
77
|
+
* - `install-staged` — registry down; install from a staged / vendored payload.
|
|
78
|
+
* - `blocked` — cannot self-heal (skew fail-closed, no payload); needs an operator.
|
|
79
|
+
*/
|
|
80
|
+
export type ResolutionMode = "proceed" | "init" | "migrate" | "update" | "install-global" | "install-sandbox" | "install-staged" | "blocked";
|
|
81
|
+
/** The versioned public output of `plan()` — the single source of truth. */
|
|
82
|
+
export interface ResolutionPlan {
|
|
83
|
+
readonly schemaVersion: typeof RESOLUTION_PLAN_SCHEMA_VERSION;
|
|
84
|
+
readonly mode: ResolutionMode;
|
|
85
|
+
readonly files: readonly ResolutionFile[];
|
|
86
|
+
readonly nextAction: ResolutionNextAction;
|
|
87
|
+
readonly warnings: readonly string[];
|
|
88
|
+
}
|
|
89
|
+
/** All resolution modes, exported for exhaustiveness checks + schema lockstep. */
|
|
90
|
+
export declare const RESOLUTION_MODES: readonly ResolutionMode[];
|
|
91
|
+
/** All resolution encodings, exported for schema lockstep. */
|
|
92
|
+
export declare const RESOLUTION_ENCODINGS: readonly ResolutionEncoding[];
|
|
93
|
+
//# sourceMappingURL=resolution.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public contract for the shared resolution spine (keystone #2264 / epic #2203).
|
|
3
|
+
*
|
|
4
|
+
* `classify()` (in @deftai/directive-core/resolution) produces the orthogonal
|
|
5
|
+
* {@link ResolutionFacts} fact-set; `plan()` applies one ordered precedence
|
|
6
|
+
* table over those facts and emits a {@link ResolutionPlan}, the single
|
|
7
|
+
* versioned public JSON schema every epic-#2203 consumer derives from
|
|
8
|
+
* (init / update / doctor / headless). Keeping the decision behind one schema
|
|
9
|
+
* closes the #537 split-source drift risk.
|
|
10
|
+
*
|
|
11
|
+
* The matching JSON Schema lives at
|
|
12
|
+
* `packages/types/schemas/resolution-plan-v1.schema.json` and MUST stay in
|
|
13
|
+
* lockstep with the types below (a lockstep test enforces it in the core
|
|
14
|
+
* resolution suite).
|
|
15
|
+
*/
|
|
16
|
+
/** Schema version tag stamped into every {@link ResolutionPlan}. */
|
|
17
|
+
export const RESOLUTION_PLAN_SCHEMA_VERSION = "resolution-plan/v1";
|
|
18
|
+
/** All resolution modes, exported for exhaustiveness checks + schema lockstep. */
|
|
19
|
+
export const RESOLUTION_MODES = [
|
|
20
|
+
"proceed",
|
|
21
|
+
"init",
|
|
22
|
+
"migrate",
|
|
23
|
+
"update",
|
|
24
|
+
"install-global",
|
|
25
|
+
"install-sandbox",
|
|
26
|
+
"install-staged",
|
|
27
|
+
"blocked",
|
|
28
|
+
];
|
|
29
|
+
/** All resolution encodings, exported for schema lockstep. */
|
|
30
|
+
export const RESOLUTION_ENCODINGS = ["utf-8", "base64"];
|
|
31
|
+
//# sourceMappingURL=resolution.js.map
|
package/package.json
CHANGED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://xbrief.dev/schemas/resolution-plan-v1.schema.json",
|
|
4
|
+
"title": "Resolution Plan Schema v1",
|
|
5
|
+
"description": "Versioned public output of the resolution-spine plan() function (keystone #2264 / epic #2203). The single source of truth every consumption context (init / update / doctor / headless) derives from. MUST stay in lockstep with @deftai/directive-types resolution.ts.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["schemaVersion", "mode", "files", "nextAction", "warnings"],
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"schemaVersion": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"const": "resolution-plan/v1",
|
|
13
|
+
"description": "Schema version tag stamped into every plan."
|
|
14
|
+
},
|
|
15
|
+
"mode": {
|
|
16
|
+
"$ref": "#/$defs/ResolutionMode"
|
|
17
|
+
},
|
|
18
|
+
"files": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"description": "Files the plan recommends materialising (empty in the keystone spine).",
|
|
21
|
+
"items": { "$ref": "#/$defs/ResolutionFile" }
|
|
22
|
+
},
|
|
23
|
+
"nextAction": {
|
|
24
|
+
"$ref": "#/$defs/ResolutionNextAction"
|
|
25
|
+
},
|
|
26
|
+
"warnings": {
|
|
27
|
+
"type": "array",
|
|
28
|
+
"description": "Non-fatal advisories (loud skew deltas, legacy-tree hints, reconciliation mismatches).",
|
|
29
|
+
"items": { "type": "string" }
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"$defs": {
|
|
33
|
+
"ResolutionMode": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "The one recommended resolution mode. plan() emits exactly one.",
|
|
36
|
+
"enum": [
|
|
37
|
+
"proceed",
|
|
38
|
+
"init",
|
|
39
|
+
"migrate",
|
|
40
|
+
"update",
|
|
41
|
+
"install-global",
|
|
42
|
+
"install-sandbox",
|
|
43
|
+
"install-staged",
|
|
44
|
+
"blocked"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"ResolutionEncoding": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"enum": ["utf-8", "base64"]
|
|
50
|
+
},
|
|
51
|
+
"ResolutionFile": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"required": ["path", "content", "encoding"],
|
|
54
|
+
"additionalProperties": false,
|
|
55
|
+
"properties": {
|
|
56
|
+
"path": { "type": "string" },
|
|
57
|
+
"content": { "type": "string" },
|
|
58
|
+
"encoding": { "$ref": "#/$defs/ResolutionEncoding" }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"ResolutionNextAction": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"required": ["command", "rootCause", "remediation"],
|
|
64
|
+
"additionalProperties": false,
|
|
65
|
+
"properties": {
|
|
66
|
+
"command": {
|
|
67
|
+
"type": ["string", "null"],
|
|
68
|
+
"description": "Command to run, or null when the action is manual / has no single command."
|
|
69
|
+
},
|
|
70
|
+
"rootCause": { "type": "string" },
|
|
71
|
+
"remediation": { "type": "string" }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|