@deftai/directive-core 0.98.1 → 0.99.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/authz/classify.js +265 -73
- package/dist/consumer-check-contract/evaluate.d.ts +40 -0
- package/dist/consumer-check-contract/evaluate.js +188 -3
- package/dist/consumer-check-contract/index.d.ts +1 -1
- package/dist/consumer-check-contract/index.js +1 -1
- package/dist/content-contracts/skills/greptile-detector.d.ts +42 -0
- package/dist/content-contracts/skills/greptile-detector.js +202 -4
- package/dist/decision/index.d.ts +17 -0
- package/dist/decision/index.js +35 -0
- package/dist/decision/list.d.ts +47 -0
- package/dist/decision/list.js +250 -0
- package/dist/decision/schema.d.ts +88 -0
- package/dist/decision/schema.js +293 -0
- package/dist/decision/write.d.ts +82 -0
- package/dist/decision/write.js +427 -0
- package/dist/eval/report.d.ts +29 -0
- package/dist/eval/report.js +69 -0
- package/dist/eval/run.d.ts +9 -0
- package/dist/eval/run.js +40 -4
- package/dist/eval/version-pin.d.ts +99 -0
- package/dist/eval/version-pin.js +181 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/platform/host-content-surface.d.ts +74 -0
- package/dist/platform/host-content-surface.js +214 -0
- package/dist/platform/index.d.ts +1 -0
- package/dist/platform/index.js +1 -0
- package/dist/policy/ceremony-dial.d.ts +233 -0
- package/dist/policy/ceremony-dial.js +829 -0
- package/dist/policy/deft-directive-disable.js +12 -2
- package/dist/policy/index.d.ts +1 -0
- package/dist/policy/index.js +15 -1
- package/dist/pr-merge-readiness/evaluate.js +10 -0
- package/dist/pr-merge-readiness/mergeability.js +5 -0
- package/dist/pr-merge-readiness/output.js +2 -0
- package/dist/pr-merge-readiness/parse.js +4 -0
- package/dist/pr-merge-readiness/types.d.ts +6 -0
- package/dist/scope/effort-activate-gate.d.ts +28 -0
- package/dist/scope/effort-activate-gate.js +64 -0
- package/dist/scope/index.d.ts +1 -0
- package/dist/scope/index.js +1 -0
- package/dist/scope/transition.js +8 -0
- package/dist/session/session-start.d.ts +24 -1
- package/dist/session/session-start.js +183 -26
- package/dist/swarm/index.d.ts +2 -0
- package/dist/swarm/index.js +2 -0
- package/dist/swarm/pre-dispatch-cli.d.ts +19 -0
- package/dist/swarm/pre-dispatch-cli.js +143 -0
- package/dist/swarm/pre-dispatch.d.ts +87 -0
- package/dist/swarm/pre-dispatch.js +373 -0
- package/dist/vbrief-activate/activate.js +6 -0
- package/dist/vbrief-validate/constants.d.ts +2 -0
- package/dist/vbrief-validate/constants.js +2 -0
- package/dist/vbrief-validate/schema.js +4 -1
- package/package.json +15 -3
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host content-surface class + managed-section drift (#3162).
|
|
3
|
+
*
|
|
4
|
+
* Directive file gates and #830/#2508 pins assume filesystem-visible work product
|
|
5
|
+
* and a host that does not rewrite constitution mid-run. REPL-first and
|
|
6
|
+
* self-mutating hosts break those assumptions. This module classifies the host
|
|
7
|
+
* surface (capability pointer #1461/#1357) and reports managed AGENTS section
|
|
8
|
+
* drift without inventing a full pin product.
|
|
9
|
+
*
|
|
10
|
+
* Never blocks session-start — advisory only.
|
|
11
|
+
*/
|
|
12
|
+
import { createHash } from "node:crypto";
|
|
13
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { agentsRefreshPlan, extractManagedSection, parseManagedSectionAttrs, stripManagedSectionAttrs, } from "./agents-md.js";
|
|
16
|
+
/** Host content-surface classes for gate / pin honesty (#3162). */
|
|
17
|
+
export const HOST_CONTENT_SURFACE_CLASSES = [
|
|
18
|
+
"file-first",
|
|
19
|
+
"repl-first",
|
|
20
|
+
"self-mutating",
|
|
21
|
+
"unknown",
|
|
22
|
+
];
|
|
23
|
+
/** Env key for explicit class override (capability descriptor pointer). */
|
|
24
|
+
export const ENV_HOST_CONTENT_SURFACE = "DEFT_HOST_CONTENT_SURFACE";
|
|
25
|
+
/** Env opt-in: host holds executable work product before files exist. */
|
|
26
|
+
export const ENV_HOST_REPL_FIRST = "DEFT_HOST_REPL_FIRST";
|
|
27
|
+
/** Env opt-in: host refine/kernel may CRUD skills/prompts mid-run. */
|
|
28
|
+
export const ENV_HOST_SELF_MUTATE = "DEFT_HOST_SELF_MUTATE";
|
|
29
|
+
const TRUTHY = new Set(["1", "true", "yes", "on"]);
|
|
30
|
+
function envTruthy(value) {
|
|
31
|
+
return TRUTHY.has((value ?? "").trim().toLowerCase());
|
|
32
|
+
}
|
|
33
|
+
function normalizeClassToken(raw) {
|
|
34
|
+
const token = raw.trim().toLowerCase().replace(/_/g, "-");
|
|
35
|
+
if (HOST_CONTENT_SURFACE_CLASSES.includes(token)) {
|
|
36
|
+
return token;
|
|
37
|
+
}
|
|
38
|
+
// Accept aliases used in host docs.
|
|
39
|
+
if (token === "file" || token === "filesystem" || token === "fs-first")
|
|
40
|
+
return "file-first";
|
|
41
|
+
if (token === "repl" || token === "kernel-first")
|
|
42
|
+
return "repl-first";
|
|
43
|
+
if (token === "self-edit" || token === "self-editing" || token === "continual-harness") {
|
|
44
|
+
return "self-mutating";
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Classify host content surface from explicit env / capability signals (#1461/#1357 pointer).
|
|
50
|
+
* Defaults to file-first (historical Directive assumption) when no signal is set.
|
|
51
|
+
*/
|
|
52
|
+
export function classifyHostContentSurface(environ = process.env) {
|
|
53
|
+
const signals = [];
|
|
54
|
+
const explicit = (environ[ENV_HOST_CONTENT_SURFACE] ?? "").trim();
|
|
55
|
+
if (explicit) {
|
|
56
|
+
signals.push(ENV_HOST_CONTENT_SURFACE);
|
|
57
|
+
const parsed = normalizeClassToken(explicit);
|
|
58
|
+
if (parsed !== null) {
|
|
59
|
+
return {
|
|
60
|
+
contentClass: parsed,
|
|
61
|
+
source: `env:${ENV_HOST_CONTENT_SURFACE}`,
|
|
62
|
+
signals,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
contentClass: "unknown",
|
|
67
|
+
source: `env:${ENV_HOST_CONTENT_SURFACE}:unrecognized`,
|
|
68
|
+
signals,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const selfMutate = envTruthy(environ[ENV_HOST_SELF_MUTATE]);
|
|
72
|
+
const replFirst = envTruthy(environ[ENV_HOST_REPL_FIRST]);
|
|
73
|
+
if (selfMutate)
|
|
74
|
+
signals.push(ENV_HOST_SELF_MUTATE);
|
|
75
|
+
if (replFirst)
|
|
76
|
+
signals.push(ENV_HOST_REPL_FIRST);
|
|
77
|
+
// Self-mutating supersedes REPL-first when both are set (broader honesty surface).
|
|
78
|
+
if (selfMutate) {
|
|
79
|
+
return {
|
|
80
|
+
contentClass: "self-mutating",
|
|
81
|
+
source: `env:${ENV_HOST_SELF_MUTATE}`,
|
|
82
|
+
signals,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (replFirst) {
|
|
86
|
+
return {
|
|
87
|
+
contentClass: "repl-first",
|
|
88
|
+
source: `env:${ENV_HOST_REPL_FIRST}`,
|
|
89
|
+
signals,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
contentClass: "file-first",
|
|
94
|
+
source: "assumed",
|
|
95
|
+
signals,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function hashBody(text) {
|
|
99
|
+
return createHash("sha256").update(text, "utf8").digest("hex").slice(0, 12);
|
|
100
|
+
}
|
|
101
|
+
function mapPlanState(raw) {
|
|
102
|
+
if (typeof raw !== "string")
|
|
103
|
+
return "unknown";
|
|
104
|
+
switch (raw) {
|
|
105
|
+
case "current":
|
|
106
|
+
case "stale":
|
|
107
|
+
case "missing":
|
|
108
|
+
case "absent":
|
|
109
|
+
case "unreadable":
|
|
110
|
+
case "template-missing":
|
|
111
|
+
case "template-malformed":
|
|
112
|
+
return raw;
|
|
113
|
+
default:
|
|
114
|
+
return "unknown";
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Probe managed AGENTS.md section drift (tamper-evident boundary, not full #830 pins).
|
|
119
|
+
* Uses agents:refresh plan state + embedded marker sha + body hash.
|
|
120
|
+
*/
|
|
121
|
+
export function probeManagedSectionDrift(projectRoot, seams = {}) {
|
|
122
|
+
const agentsPath = join(projectRoot, "AGENTS.md");
|
|
123
|
+
const plan = agentsRefreshPlan(projectRoot, seams.agentsMdSeams ?? {});
|
|
124
|
+
const state = mapPlanState(plan.state);
|
|
125
|
+
let embeddedSha = null;
|
|
126
|
+
let bodyHash = null;
|
|
127
|
+
const readAgents = seams.agentsMdSeams?.readAgents ??
|
|
128
|
+
((path) => {
|
|
129
|
+
try {
|
|
130
|
+
if (!existsSync(path))
|
|
131
|
+
return null;
|
|
132
|
+
return readFileSync(path, "utf8");
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
try {
|
|
139
|
+
const text = readAgents(agentsPath);
|
|
140
|
+
if (text !== null) {
|
|
141
|
+
const extracted = extractManagedSection(text);
|
|
142
|
+
if (extracted !== null) {
|
|
143
|
+
const attrs = parseManagedSectionAttrs(extracted);
|
|
144
|
+
embeddedSha = attrs?.sha ?? null;
|
|
145
|
+
bodyHash = hashBody(stripManagedSectionAttrs(extracted));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
// body hash is best-effort
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
state,
|
|
154
|
+
embeddedSha,
|
|
155
|
+
bodyHash,
|
|
156
|
+
path: typeof plan.path === "string" ? plan.path : agentsPath,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/** Full host-surface report for session-start payload + lines. */
|
|
160
|
+
export function probeHostContentSurface(projectRoot, seams = {}) {
|
|
161
|
+
const environ = seams.environ ?? process.env;
|
|
162
|
+
const classified = classifyHostContentSurface(environ);
|
|
163
|
+
const managedSection = probeManagedSectionDrift(projectRoot, seams);
|
|
164
|
+
return {
|
|
165
|
+
contentClass: classified.contentClass,
|
|
166
|
+
classSource: classified.source,
|
|
167
|
+
signals: classified.signals,
|
|
168
|
+
managedSection,
|
|
169
|
+
runtimeMode: seams.runtimeMode ?? null,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
export function hostContentSurfaceToDict(report) {
|
|
173
|
+
return {
|
|
174
|
+
content_class: report.contentClass,
|
|
175
|
+
class_source: report.classSource,
|
|
176
|
+
signals: [...report.signals],
|
|
177
|
+
runtime_mode: report.runtimeMode,
|
|
178
|
+
managed_section: {
|
|
179
|
+
state: report.managedSection.state,
|
|
180
|
+
embedded_sha: report.managedSection.embeddedSha,
|
|
181
|
+
body_hash: report.managedSection.bodyHash,
|
|
182
|
+
path: report.managedSection.path,
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Format operator-facing host-surface lines (#3162).
|
|
188
|
+
* Always emits one summary line; adds honesty note for non-file-first or drift.
|
|
189
|
+
*/
|
|
190
|
+
export function formatHostContentSurfaceLines(report) {
|
|
191
|
+
const managed = report.managedSection.state;
|
|
192
|
+
const summary = `[deft host-surface] class=${report.contentClass} source=${report.classSource} ` +
|
|
193
|
+
`managed=${managed}` +
|
|
194
|
+
(report.managedSection.embeddedSha ? ` sha=${report.managedSection.embeddedSha}` : "") +
|
|
195
|
+
(report.managedSection.bodyHash ? ` body=${report.managedSection.bodyHash}` : "");
|
|
196
|
+
const lines = [summary];
|
|
197
|
+
if (report.contentClass === "repl-first" || report.contentClass === "self-mutating") {
|
|
198
|
+
lines.push("[deft host-surface] honesty: file gates and agent-only pins do not see host-kernel " +
|
|
199
|
+
"or mid-run host refine work product — see content/docs/host-surface-assumptions.md (#3162)");
|
|
200
|
+
}
|
|
201
|
+
if (managed === "stale" || managed === "missing" || managed === "absent") {
|
|
202
|
+
lines.push("[deft host-surface] managed AGENTS section drift — run `deft agents:refresh` " +
|
|
203
|
+
"(or `task agents:refresh`) so pins/managed constitution match the deposit");
|
|
204
|
+
}
|
|
205
|
+
return lines;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Probe + format; fail-open for session-start (never throws to callers that wrap).
|
|
209
|
+
*/
|
|
210
|
+
export function maybeFormatHostContentSurfaceLines(projectRoot, seams = {}) {
|
|
211
|
+
const report = probeHostContentSurface(projectRoot, seams);
|
|
212
|
+
return { report, lines: formatHostContentSurfaceLines(report) };
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=host-content-surface.js.map
|
package/dist/platform/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./agents-consumer-header.js";
|
|
2
2
|
export * from "./agents-md.js";
|
|
3
3
|
export * from "./constants.js";
|
|
4
|
+
export * from "./host-content-surface.js";
|
|
4
5
|
export * from "./ip-risk.js";
|
|
5
6
|
export * from "./linear-scan.js";
|
|
6
7
|
export * from "./platform-capabilities.js";
|
package/dist/platform/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./agents-consumer-header.js";
|
|
2
2
|
export * from "./agents-md.js";
|
|
3
3
|
export * from "./constants.js";
|
|
4
|
+
export * from "./host-content-surface.js";
|
|
4
5
|
export * from "./ip-risk.js";
|
|
5
6
|
export * from "./linear-scan.js";
|
|
6
7
|
export * from "./platform-capabilities.js";
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ceremony dial (#3214): ritual depth = f(task size × model tier × project shape).
|
|
3
|
+
*
|
|
4
|
+
* Selection policy over existing pieces — not a new subsystem.
|
|
5
|
+
* Composes:
|
|
6
|
+
* - strategies/rapid.md (light / rapid path)
|
|
7
|
+
* - #3014 minimal consumer AGENTS profile (research pointer; not yet a shipped deposit)
|
|
8
|
+
* - effort estimate (#1581), model routing (#1976/#818), host capability (#1461)
|
|
9
|
+
*
|
|
10
|
+
* Two-stage dial (#3214 design note / #1581 ordering):
|
|
11
|
+
* cold-start / incomplete inputs → **rapid** (start light; no plan-item deadlock)
|
|
12
|
+
* escalate when evidence arrives (provisional M/L, mid/low tier, full matrix)
|
|
13
|
+
* Full matrix: S × frontier → rapid; non-project → minimal; else scales up.
|
|
14
|
+
* Override always available via plan.policy.ceremonyDial.override; audited on write.
|
|
15
|
+
*/
|
|
16
|
+
/** Canonical dotted policy field name. */
|
|
17
|
+
export declare const FIELD_CEREMONY_DIAL = "plan.policy.ceremonyDial";
|
|
18
|
+
/** Short alias for `policy:show --field=ceremonyDial`. */
|
|
19
|
+
export declare const FIELD_CEREMONY_DIAL_CLI_ALIAS = "ceremonyDial";
|
|
20
|
+
/** Depth ladder: less ceremony → more ceremony. */
|
|
21
|
+
export declare const CEREMONY_DEPTHS: readonly ["minimal", "rapid", "standard", "elevated"];
|
|
22
|
+
export type CeremonyDepth = (typeof CEREMONY_DEPTHS)[number];
|
|
23
|
+
/** Task size band (aligns with swarm size / effort estimate vocabulary). */
|
|
24
|
+
export declare const CEREMONY_TASK_SIZES: readonly ["S", "M", "L", "XL"];
|
|
25
|
+
export type CeremonyTaskSize = (typeof CEREMONY_TASK_SIZES)[number];
|
|
26
|
+
/**
|
|
27
|
+
* Model capability tier for dial selection.
|
|
28
|
+
* `frontier` = strongest class; `mid` benefits from structure; `low` needs more ceremony.
|
|
29
|
+
*/
|
|
30
|
+
export declare const CEREMONY_MODEL_TIERS: readonly ["frontier", "mid", "low"];
|
|
31
|
+
export type CeremonyModelTier = (typeof CEREMONY_MODEL_TIERS)[number];
|
|
32
|
+
/** Whether the session is project-shaped (Directive repo/work) or ad-hoc non-project. */
|
|
33
|
+
export declare const CEREMONY_PROJECT_SHAPES: readonly ["project", "non-project"];
|
|
34
|
+
export type CeremonyProjectShape = (typeof CEREMONY_PROJECT_SHAPES)[number];
|
|
35
|
+
/** Pointers for composition (not loaded as a subsystem — discovery only). */
|
|
36
|
+
export declare const CEREMONY_RAPID_STRATEGY_POINTER = "content/strategies/rapid.md";
|
|
37
|
+
export declare const CEREMONY_MINIMAL_AGENTS_PROFILE_POINTER = "docs/analysis/2026-07-31-minimal-consumer-agents-profile-research.md (#3014)";
|
|
38
|
+
export interface CeremonyDialConfig {
|
|
39
|
+
/** When false, selection always returns standard (full ceremony). Default true. */
|
|
40
|
+
readonly enabled?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Force a depth regardless of inputs. Always wins when set.
|
|
43
|
+
* Use null/omit for matrix selection.
|
|
44
|
+
*/
|
|
45
|
+
readonly override?: CeremonyDepth | null;
|
|
46
|
+
}
|
|
47
|
+
export interface CeremonyDialInputs {
|
|
48
|
+
readonly taskSize?: CeremonyTaskSize | null;
|
|
49
|
+
readonly modelTier?: CeremonyModelTier | null;
|
|
50
|
+
readonly projectShape?: CeremonyProjectShape | null;
|
|
51
|
+
}
|
|
52
|
+
export interface CeremonyDialProfile {
|
|
53
|
+
readonly depth: CeremonyDepth;
|
|
54
|
+
/**
|
|
55
|
+
* Ritual steps auto-deferred at this depth (merged into session:start deferrals).
|
|
56
|
+
* Matches QUICK_STEPS / GATED_STEPS names in session-start.
|
|
57
|
+
*/
|
|
58
|
+
readonly autoDeferSteps: readonly string[];
|
|
59
|
+
/** Skip fat cold-path work (verify tools, triage welcome, release probe, tickler). */
|
|
60
|
+
readonly skipFatPath: boolean;
|
|
61
|
+
/** How much lifecycle / history write budget this depth intends. */
|
|
62
|
+
readonly lifecycleWrites: "minimal" | "light" | "full";
|
|
63
|
+
readonly label: string;
|
|
64
|
+
}
|
|
65
|
+
export type CeremonyDialSource = "override" | "matrix" | "default" | "disabled" | "typed" | "default-on-error";
|
|
66
|
+
export interface CeremonyDialComposition {
|
|
67
|
+
/** Set when depth is rapid (light path). */
|
|
68
|
+
readonly rapidStrategy: string | null;
|
|
69
|
+
/** Set when depth is minimal (non-project / #3014 direction). */
|
|
70
|
+
readonly minimalAgentsProfile: string | null;
|
|
71
|
+
}
|
|
72
|
+
export interface CeremonyDialSelection {
|
|
73
|
+
readonly depth: CeremonyDepth;
|
|
74
|
+
readonly source: CeremonyDialSource;
|
|
75
|
+
readonly inputs: {
|
|
76
|
+
readonly taskSize: CeremonyTaskSize | null;
|
|
77
|
+
readonly modelTier: CeremonyModelTier | null;
|
|
78
|
+
readonly projectShape: CeremonyProjectShape | null;
|
|
79
|
+
};
|
|
80
|
+
readonly profile: CeremonyDialProfile;
|
|
81
|
+
readonly composition: CeremonyDialComposition;
|
|
82
|
+
readonly config: CeremonyDialConfig;
|
|
83
|
+
readonly error: string | null;
|
|
84
|
+
}
|
|
85
|
+
export declare function ceremonyDialProfile(depth: CeremonyDepth): CeremonyDialProfile;
|
|
86
|
+
/** Validate a typed `plan.policy.ceremonyDial` payload. */
|
|
87
|
+
export declare function validateCeremonyDial(value: unknown): string[];
|
|
88
|
+
/**
|
|
89
|
+
* Normalize free-form size tokens (swarm size vocabulary) into dial bands.
|
|
90
|
+
* Accepts S|M|L|XL and small|medium|large|extra-large (case-insensitive).
|
|
91
|
+
*/
|
|
92
|
+
export declare function normalizeCeremonyTaskSize(raw: unknown): CeremonyTaskSize | null;
|
|
93
|
+
/**
|
|
94
|
+
* Normalize model tier tokens. Frontier covers high/strong; mid covers medium;
|
|
95
|
+
* low covers weak/economy.
|
|
96
|
+
*/
|
|
97
|
+
export declare function normalizeCeremonyModelTier(raw: unknown): CeremonyModelTier | null;
|
|
98
|
+
export declare function normalizeCeremonyProjectShape(raw: unknown): CeremonyProjectShape | null;
|
|
99
|
+
/**
|
|
100
|
+
* Two-stage / partial-evidence selection when size or tier is missing (#3214 design note).
|
|
101
|
+
*
|
|
102
|
+
* Start light (rapid) on cold incomplete inputs; escalate when partial evidence already
|
|
103
|
+
* implies heavier ceremony (apps-bank safety: hard/substantial work must not stay rapid).
|
|
104
|
+
* Does not invent plan-item effort (#1581 post-planning only).
|
|
105
|
+
*/
|
|
106
|
+
export declare function selectCeremonyDepthFromPartialEvidence(inputs: {
|
|
107
|
+
readonly taskSize: CeremonyTaskSize | null;
|
|
108
|
+
readonly modelTier: CeremonyModelTier | null;
|
|
109
|
+
}): CeremonyDepth;
|
|
110
|
+
/**
|
|
111
|
+
* Pure default matrix (#3214 acceptance + two-stage design note):
|
|
112
|
+
* - non-project → minimal (#3014 direction)
|
|
113
|
+
* - S × frontier → rapid (strategies/rapid.md)
|
|
114
|
+
* - S × mid → standard (mid-tier gains from structure)
|
|
115
|
+
* - S × low → elevated
|
|
116
|
+
* - M × low → elevated; M otherwise → standard
|
|
117
|
+
* - L/XL → elevated (except L × frontier stays standard)
|
|
118
|
+
* - Incomplete size/tier → two-stage partial evidence (default rapid; escalate on M/L or mid/low)
|
|
119
|
+
*/
|
|
120
|
+
export declare function selectCeremonyDepthFromMatrix(inputs: CeremonyDialInputs): CeremonyDepth;
|
|
121
|
+
export interface SelectCeremonyDepthOptions {
|
|
122
|
+
readonly config?: CeremonyDialConfig;
|
|
123
|
+
readonly inputs?: CeremonyDialInputs;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Deterministic depth selection (pure; no IO).
|
|
127
|
+
*
|
|
128
|
+
* Precedence: disabled → standard; override → forced depth; else matrix on inputs;
|
|
129
|
+
* empty inputs → **rapid** (two-stage cold default; escalate when evidence arrives).
|
|
130
|
+
*/
|
|
131
|
+
export declare function selectCeremonyDepth(options?: SelectCeremonyDepthOptions): CeremonyDialSelection;
|
|
132
|
+
export interface ResolveCeremonyDialOptions {
|
|
133
|
+
readonly inputs?: CeremonyDialInputs;
|
|
134
|
+
/** Explicit config bypasses PROJECT-DEFINITION load (tests). */
|
|
135
|
+
readonly config?: CeremonyDialConfig;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Resolve ceremony dial from PROJECT-DEFINITION policy + session inputs (#3214).
|
|
139
|
+
*/
|
|
140
|
+
export declare function resolveCeremonyDial(projectRoot: string, options?: ResolveCeremonyDialOptions): CeremonyDialSelection;
|
|
141
|
+
/** Human-readable status line for session:start / policy:show. */
|
|
142
|
+
export declare function formatCeremonyDialStatusLine(selection: CeremonyDialSelection): string;
|
|
143
|
+
/** JSON-serializable dial snapshot for ritual-state / session payload. */
|
|
144
|
+
export declare function ceremonyDialToDict(selection: CeremonyDialSelection): Record<string, unknown>;
|
|
145
|
+
export interface CeremonyDialPolicyField {
|
|
146
|
+
readonly name: typeof FIELD_CEREMONY_DIAL;
|
|
147
|
+
readonly current: CeremonyDialConfig & {
|
|
148
|
+
selectedDepth?: CeremonyDepth;
|
|
149
|
+
};
|
|
150
|
+
readonly default: CeremonyDialConfig;
|
|
151
|
+
readonly source: string;
|
|
152
|
+
}
|
|
153
|
+
/** Inspector row for `task policy:show --field=ceremonyDial`. */
|
|
154
|
+
export declare function inspectCeremonyDial(data: Record<string, unknown> | null, projectRoot?: string): CeremonyDialPolicyField;
|
|
155
|
+
export interface SetCeremonyDialOptions {
|
|
156
|
+
readonly enabled?: boolean;
|
|
157
|
+
readonly override?: CeremonyDepth | null;
|
|
158
|
+
readonly actor?: string;
|
|
159
|
+
readonly note?: string;
|
|
160
|
+
readonly confirm?: boolean;
|
|
161
|
+
}
|
|
162
|
+
export interface SetCeremonyDialResult {
|
|
163
|
+
readonly exitCode: 0 | 1 | 2;
|
|
164
|
+
readonly stdout: string;
|
|
165
|
+
readonly changed: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Persist plan.policy.ceremonyDial (override + enabled) with audit trail (#3214).
|
|
169
|
+
* Requires --confirm for override writes (capability-cost style disclosure).
|
|
170
|
+
*/
|
|
171
|
+
export declare function setCeremonyDial(projectRoot: string, options: SetCeremonyDialOptions): SetCeremonyDialResult;
|
|
172
|
+
/**
|
|
173
|
+
* Merge dial auto-defer steps into an existing deferrals map without clobbering
|
|
174
|
+
* operator-supplied reasons.
|
|
175
|
+
*/
|
|
176
|
+
export declare function mergeCeremonyDialDeferrals(existing: Readonly<Record<string, string>>, selection: CeremonyDialSelection): Record<string, string>;
|
|
177
|
+
/** Env keys for headless dial inputs (no operator confirmation). */
|
|
178
|
+
export declare const ENV_CEREMONY_TASK_SIZE = "DEFT_CEREMONY_TASK_SIZE";
|
|
179
|
+
export declare const ENV_CEREMONY_MODEL_TIER = "DEFT_CEREMONY_MODEL_TIER";
|
|
180
|
+
export declare const ENV_CEREMONY_PROJECT_SHAPE = "DEFT_CEREMONY_PROJECT_SHAPE";
|
|
181
|
+
/** Optional host model hint used when DEFT_CEREMONY_MODEL_TIER is unset. */
|
|
182
|
+
export declare const ENV_CEREMONY_MODEL_HINT = "DEFT_MODEL";
|
|
183
|
+
export interface ProvisionalCeremonyEstimateHints {
|
|
184
|
+
/** Free-text task / prompt (optional; headless may omit). */
|
|
185
|
+
readonly promptText?: string | null;
|
|
186
|
+
/** Closed-verb or action verb token when known. */
|
|
187
|
+
readonly verb?: string | null;
|
|
188
|
+
/** Paths in scope (files or dirs); used for file-count / multi-area signals. */
|
|
189
|
+
readonly filePaths?: readonly string[] | null;
|
|
190
|
+
/** Explicit file count when paths are not enumerated. */
|
|
191
|
+
readonly fileCount?: number | null;
|
|
192
|
+
/** Process env for headless size/tier/shape overrides. */
|
|
193
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
194
|
+
/** Project root for deposit-based project-shape detection. */
|
|
195
|
+
readonly projectRoot?: string | null;
|
|
196
|
+
}
|
|
197
|
+
export interface ProvisionalCeremonyEstimate {
|
|
198
|
+
readonly taskSize: CeremonyTaskSize | null;
|
|
199
|
+
readonly modelTier: CeremonyModelTier | null;
|
|
200
|
+
readonly projectShape: CeremonyProjectShape | null;
|
|
201
|
+
/** Why each filled field was chosen (headless diagnostics). */
|
|
202
|
+
readonly reasons: readonly string[];
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Detect project shape from deposit layout (headless, no prompts).
|
|
206
|
+
* Returns `project` when vanilla deposit markers exist; **null** when unknown
|
|
207
|
+
* (two-stage cold default stays rapid — do not invent non-project without evidence).
|
|
208
|
+
* Explicit `non-project` comes from CLI/env only.
|
|
209
|
+
*/
|
|
210
|
+
export declare function detectCeremonyProjectShape(projectRoot: string): CeremonyProjectShape | null;
|
|
211
|
+
/**
|
|
212
|
+
* Headless-safe provisional S/M/L (+ optional tier/shape) **before** ritual.
|
|
213
|
+
* No operator confirmation. Plan-item effort (#1581) later confirms/corrects.
|
|
214
|
+
*
|
|
215
|
+
* Signals (max-wins for size): env → verb class → file-scope count → prompt shape.
|
|
216
|
+
* Project shape: env, else deposit detection when projectRoot is set.
|
|
217
|
+
*/
|
|
218
|
+
export declare function estimateProvisionalCeremonyInputs(hints?: ProvisionalCeremonyEstimateHints): ProvisionalCeremonyEstimate;
|
|
219
|
+
/**
|
|
220
|
+
* Merge explicit dial inputs over provisional estimates. Explicit non-null wins.
|
|
221
|
+
* Used by session:start so vanilla deposit gets provisional fill without policy opt-in.
|
|
222
|
+
*/
|
|
223
|
+
export declare function mergeCeremonyDialInputsWithProvisional(explicit: CeremonyDialInputs | undefined, provisional: ProvisionalCeremonyEstimate): CeremonyDialInputs;
|
|
224
|
+
/**
|
|
225
|
+
* Resolve dial inputs for session:start: explicit CLI/options first, then
|
|
226
|
+
* headless provisional classifier (env / verb / files / prompt / deposit).
|
|
227
|
+
* ⊗ Does not read plan-item effort (#1581) — that lands post-planning only.
|
|
228
|
+
*/
|
|
229
|
+
export declare function resolveSessionCeremonyDialInputs(projectRoot: string, explicit?: CeremonyDialInputs, options?: Omit<ProvisionalCeremonyEstimateHints, "projectRoot">): {
|
|
230
|
+
readonly inputs: CeremonyDialInputs;
|
|
231
|
+
readonly provisional: ProvisionalCeremonyEstimate;
|
|
232
|
+
};
|
|
233
|
+
//# sourceMappingURL=ceremony-dial.d.ts.map
|