@deftai/directive-core 0.99.0 → 0.101.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/actions.d.ts +6 -0
- package/dist/authz/actions.js +3 -0
- package/dist/authz/classify.js +241 -30
- package/dist/authz/decompose-apply.d.ts +81 -0
- package/dist/authz/decompose-apply.js +377 -0
- package/dist/authz/index.d.ts +3 -1
- package/dist/authz/index.js +3 -1
- package/dist/authz/store.d.ts +53 -0
- package/dist/authz/store.js +219 -1
- package/dist/authz/types.d.ts +19 -2
- package/dist/authz/types.js +5 -1
- package/dist/check/cached-orchestrator.d.ts +26 -5
- package/dist/check/cached-orchestrator.js +228 -6
- package/dist/check/gate-lists.d.ts +10 -4
- package/dist/check/gate-lists.js +19 -5
- package/dist/check/index.d.ts +3 -2
- package/dist/check/index.js +2 -1
- package/dist/check/named-cause.d.ts +45 -0
- package/dist/check/named-cause.js +121 -0
- package/dist/check/orchestrator.js +6 -1
- package/dist/doctor/checks.d.ts +44 -0
- package/dist/doctor/checks.js +428 -2
- package/dist/doctor/help.d.ts +5 -0
- package/dist/doctor/help.js +31 -0
- package/dist/doctor/index.d.ts +2 -0
- package/dist/doctor/index.js +2 -0
- package/dist/doctor/main.d.ts +6 -7
- package/dist/doctor/main.js +130 -79
- package/dist/doctor/session-coda.d.ts +82 -0
- package/dist/doctor/session-coda.js +151 -0
- package/dist/doctor/types.d.ts +16 -0
- package/dist/doctor/which.d.ts +20 -1
- package/dist/doctor/which.js +67 -1
- package/dist/finish-loop/pr-finish-loop.d.ts +13 -2
- package/dist/finish-loop/pr-finish-loop.js +116 -5
- package/dist/finish-loop/types.d.ts +1 -1
- package/dist/hooks/dispatcher.d.ts +9 -5
- package/dist/hooks/dispatcher.js +23 -15
- package/dist/hooks/readonly.d.ts +6 -3
- package/dist/hooks/readonly.js +44 -25
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/init-deposit/agent-hooks.d.ts +20 -0
- package/dist/init-deposit/agent-hooks.js +51 -31
- package/dist/init-deposit/gitignore.js +2 -0
- package/dist/intake/issue-ingest.js +36 -0
- package/dist/lifecycle/completed-consistency.d.ts +60 -0
- package/dist/lifecycle/completed-consistency.js +443 -0
- package/dist/lifecycle/completed-tracked-on-delivery.d.ts +47 -0
- package/dist/lifecycle/completed-tracked-on-delivery.js +415 -0
- package/dist/lifecycle/index.d.ts +2 -0
- package/dist/lifecycle/index.js +2 -0
- package/dist/literal-acceptance/capture.d.ts +52 -0
- package/dist/literal-acceptance/capture.js +658 -0
- package/dist/literal-acceptance/evaluate.d.ts +47 -0
- package/dist/literal-acceptance/evaluate.js +193 -0
- package/dist/literal-acceptance/index.d.ts +12 -0
- package/dist/literal-acceptance/index.js +12 -0
- package/dist/literal-acceptance/run.d.ts +38 -0
- package/dist/literal-acceptance/run.js +216 -0
- package/dist/literal-acceptance/safety.d.ts +24 -0
- package/dist/literal-acceptance/safety.js +251 -0
- package/dist/literal-acceptance/types.d.ts +82 -0
- package/dist/literal-acceptance/types.js +26 -0
- package/dist/policy/ac-pass-banking.d.ts +58 -0
- package/dist/policy/ac-pass-banking.js +150 -0
- package/dist/policy/ceremony-dial.d.ts +96 -11
- package/dist/policy/ceremony-dial.js +250 -23
- package/dist/policy/index.d.ts +2 -0
- package/dist/policy/index.js +16 -1
- package/dist/policy/merge-approval-head.d.ts +129 -0
- package/dist/policy/merge-approval-head.js +461 -0
- package/dist/policy/require-human-merge.d.ts +5 -0
- package/dist/policy/require-human-merge.js +5 -0
- package/dist/pr-merge-readiness/ci-gate.d.ts +20 -3
- package/dist/pr-merge-readiness/ci-gate.js +65 -5
- package/dist/pr-merge-readiness/compute.d.ts +13 -0
- package/dist/pr-merge-readiness/compute.js +99 -14
- package/dist/pr-merge-readiness/gh.d.ts +49 -0
- package/dist/pr-merge-readiness/gh.js +268 -0
- package/dist/pr-merge-readiness/index.d.ts +2 -2
- package/dist/pr-merge-readiness/index.js +2 -2
- package/dist/pr-merge-readiness/test-gh-fixtures.helpers.js +4 -0
- package/dist/pr-wait-mergeable/cascade.d.ts +11 -0
- package/dist/pr-wait-mergeable/cascade.js +115 -1
- package/dist/pr-wait-mergeable/main.d.ts +4 -0
- package/dist/pr-wait-mergeable/main.js +4 -0
- package/dist/pr-wait-mergeable/types.d.ts +3 -1
- package/dist/pr-wait-mergeable/wrappers.d.ts +6 -1
- package/dist/pr-wait-mergeable/wrappers.js +7 -1
- package/dist/preflight/evaluate.d.ts +15 -1
- package/dist/preflight/evaluate.js +33 -2
- package/dist/preflight-cache/evaluate.d.ts +3 -0
- package/dist/preflight-cache/evaluate.js +3 -0
- package/dist/product-first-done-gate/acceptance.d.ts +25 -0
- package/dist/product-first-done-gate/acceptance.js +247 -0
- package/dist/product-first-done-gate/check-mode.d.ts +45 -0
- package/dist/product-first-done-gate/check-mode.js +148 -0
- package/dist/product-first-done-gate/evaluate.d.ts +50 -0
- package/dist/product-first-done-gate/evaluate.js +255 -0
- package/dist/product-first-done-gate/index.d.ts +11 -0
- package/dist/product-first-done-gate/index.js +11 -0
- package/dist/product-first-done-gate/types.d.ts +64 -0
- package/dist/product-first-done-gate/types.js +61 -0
- package/dist/render/framework-commands.js +4 -0
- package/dist/run-summary/emit.d.ts +56 -0
- package/dist/run-summary/emit.js +171 -0
- package/dist/run-summary/index.d.ts +4 -0
- package/dist/run-summary/index.js +4 -0
- package/dist/run-summary/path.d.ts +25 -0
- package/dist/run-summary/path.js +78 -0
- package/dist/run-summary/types.d.ts +76 -0
- package/dist/run-summary/types.js +21 -0
- package/dist/scope/acceptance-evidence.d.ts +110 -0
- package/dist/scope/acceptance-evidence.js +422 -0
- package/dist/scope/coverage-map.d.ts +98 -0
- package/dist/scope/coverage-map.js +558 -0
- package/dist/scope/decompose.d.ts +5 -0
- package/dist/scope/decompose.js +134 -11
- package/dist/scope/index.d.ts +3 -0
- package/dist/scope/index.js +3 -0
- package/dist/scope/parent-lineage.d.ts +125 -0
- package/dist/scope/parent-lineage.js +626 -0
- package/dist/scope/transition.d.ts +8 -0
- package/dist/scope/transition.js +61 -2
- package/dist/session/ac-pass-banking.d.ts +221 -0
- package/dist/session/ac-pass-banking.js +761 -0
- package/dist/session/active-cli.d.ts +79 -0
- package/dist/session/active-cli.js +382 -0
- package/dist/session/deposit-sha.d.ts +49 -0
- package/dist/session/deposit-sha.js +121 -0
- package/dist/session/effort-budget.d.ts +136 -0
- package/dist/session/effort-budget.js +352 -0
- package/dist/session/index.d.ts +7 -0
- package/dist/session/index.js +7 -0
- package/dist/session/orientation-compression.d.ts +127 -0
- package/dist/session/orientation-compression.js +425 -0
- package/dist/session/orientation-state.d.ts +29 -0
- package/dist/session/orientation-state.js +85 -0
- package/dist/session/session-start.d.ts +31 -0
- package/dist/session/session-start.js +228 -2
- package/dist/session/toolchain-preflight.d.ts +64 -0
- package/dist/session/toolchain-preflight.js +151 -0
- package/dist/session/verify-session-ritual.d.ts +14 -0
- package/dist/session/verify-session-ritual.js +33 -0
- package/dist/story-ready/evaluate.d.ts +11 -0
- package/dist/story-ready/evaluate.js +41 -3
- package/dist/triage/actions/candidates-log.d.ts +1 -2
- package/dist/triage/actions/candidates-log.js +37 -6
- package/dist/triage/bootstrap/gitignore.d.ts +1 -1
- package/dist/triage/bootstrap/gitignore.js +8 -2
- package/dist/triage/bootstrap/index.js +15 -3
- package/dist/triage/classify/index.d.ts +1 -0
- package/dist/triage/classify/index.js +2 -0
- package/dist/triage/classify/label-mirror.js +16 -0
- package/dist/triage/classify/mirror-discovery-tip.d.ts +95 -0
- package/dist/triage/classify/mirror-discovery-tip.js +234 -0
- package/dist/triage/reconcile/reconcile.js +28 -6
- package/dist/triage/summary/index.js +12 -4
- package/dist/triage/welcome/default-mode.js +16 -0
- package/dist/ts-check-lane/run-lane.js +21 -4
- package/dist/vbrief-validate/conformance.js +7 -0
- package/dist/vitest-runner/coverage-debt-teardown.js +16 -4
- package/dist/xbrief-migrate/migrate-project.d.ts +4 -0
- package/dist/xbrief-migrate/migrate-project.js +92 -3
- package/package.json +15 -3
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hard effort-budget detection and bank-the-pass guidance (#3266).
|
|
3
|
+
*
|
|
4
|
+
* When a host/harness declares max-turns or max-cost, agents must bank the
|
|
5
|
+
* *stated* acceptance pass before self-imposed deepening. Detection is
|
|
6
|
+
* advisory at session start (env / flags / host capability pointer #1461);
|
|
7
|
+
* skill text in deft-directive-build and pre-pr owns the behavioral rule.
|
|
8
|
+
*
|
|
9
|
+
* Composes dual-stop (#2442): dual-stop is the failure/budget envelope;
|
|
10
|
+
* this module is the success-side analog (do not gold-plate past the bar
|
|
11
|
+
* when remaining budget cannot also fund a fix for deeper findings).
|
|
12
|
+
*
|
|
13
|
+
* Fail-loud (#1006): when deepening is skipped for budget, summaries must
|
|
14
|
+
* say so — never silent gold-plate or silent skip.
|
|
15
|
+
*/
|
|
16
|
+
/** Canonical max-turns env (hard turn budget). */
|
|
17
|
+
export declare const ENV_MAX_TURNS = "DEFT_MAX_TURNS";
|
|
18
|
+
/** Canonical max cost/budget env (opaque cost units from the host). */
|
|
19
|
+
export declare const ENV_MAX_BUDGET = "DEFT_MAX_BUDGET";
|
|
20
|
+
/** Remaining turns when the host updates mid-run. */
|
|
21
|
+
export declare const ENV_REMAINING_TURNS = "DEFT_REMAINING_TURNS";
|
|
22
|
+
/** Remaining cost units when the host updates mid-run. */
|
|
23
|
+
export declare const ENV_REMAINING_BUDGET = "DEFT_REMAINING_BUDGET";
|
|
24
|
+
/**
|
|
25
|
+
* Explicit hard-cap flag when the host has a limit but does not expose a number
|
|
26
|
+
* (truthy → hard-capped with unknown numeric ceiling).
|
|
27
|
+
*/
|
|
28
|
+
export declare const ENV_HARD_BUDGET = "DEFT_HARD_BUDGET";
|
|
29
|
+
/**
|
|
30
|
+
* Optional JSON host capability fragment for effort caps (#1461 / #3266).
|
|
31
|
+
* Example: `{"maxTurns":120,"maxBudget":10,"hardBudget":true}`.
|
|
32
|
+
* Production session:start merges this when `effortBudgetSeams.hostDescriptor` is unset.
|
|
33
|
+
*/
|
|
34
|
+
export declare const ENV_HOST_EFFORT_BUDGET = "DEFT_HOST_EFFORT_BUDGET";
|
|
35
|
+
/** Additional env keys accepted as max-turns aliases (harness / CLI common). */
|
|
36
|
+
export declare const MAX_TURNS_ENV_ALIASES: readonly ["DEFT_MAX_TURNS", "MAX_TURNS", "AGENT_MAX_TURNS", "DEFT_AGENT_MAX_TURNS", "CURSOR_MAX_TURNS"];
|
|
37
|
+
/** Additional env keys accepted as max-budget/cost aliases. */
|
|
38
|
+
export declare const MAX_BUDGET_ENV_ALIASES: readonly ["DEFT_MAX_BUDGET", "MAX_BUDGET", "AGENT_BUDGET", "DEFT_AGENT_BUDGET", "AGENT_MAX_BUDGET"];
|
|
39
|
+
export type EffortBudgetKind = "none" | "max-turns" | "max-cost" | "both" | "hard-flag";
|
|
40
|
+
/** Whether the session is under a detectable hard cap. */
|
|
41
|
+
export type EffortBudgetPosture = "unbounded" | "hard-capped";
|
|
42
|
+
/**
|
|
43
|
+
* Recommended self-verification depth given budget + stated-AC status.
|
|
44
|
+
* - stated-only: bank the stated bar; do not start self-imposed suites
|
|
45
|
+
* - stated-then-deepen: stated bar first; deepen only with remaining budget
|
|
46
|
+
* - unconstrained-deepen: no hard budget signal; dual-stop still applies
|
|
47
|
+
*/
|
|
48
|
+
export type VerificationDepthPolicy = "stated-only" | "stated-then-deepen" | "unconstrained-deepen";
|
|
49
|
+
export interface HardEffortBudget {
|
|
50
|
+
readonly detected: boolean;
|
|
51
|
+
readonly posture: EffortBudgetPosture;
|
|
52
|
+
readonly kind: EffortBudgetKind;
|
|
53
|
+
/** Hard max turns when known; null if only a flag or cost cap is present. */
|
|
54
|
+
readonly maxTurns: number | null;
|
|
55
|
+
/** Hard max cost units when known (opaque host units). */
|
|
56
|
+
readonly maxBudget: number | null;
|
|
57
|
+
/** Remaining turns when the host exposes them; else equals maxTurns. */
|
|
58
|
+
readonly remainingTurns: number | null;
|
|
59
|
+
/** Remaining cost units when exposed; else equals maxBudget. */
|
|
60
|
+
readonly remainingBudget: number | null;
|
|
61
|
+
/** Env keys / host signals that contributed. */
|
|
62
|
+
readonly sources: readonly string[];
|
|
63
|
+
}
|
|
64
|
+
export interface DetectHardEffortBudgetInput {
|
|
65
|
+
readonly environ?: Readonly<Record<string, string | undefined>>;
|
|
66
|
+
/**
|
|
67
|
+
* Optional host capability descriptor fragment (#1461 pointer).
|
|
68
|
+
* Accepts maxTurns / max_turns / maxBudget / max_budget / hardBudget.
|
|
69
|
+
*/
|
|
70
|
+
readonly hostDescriptor?: Readonly<Record<string, unknown>> | null;
|
|
71
|
+
}
|
|
72
|
+
export interface RecommendVerificationDepthInput {
|
|
73
|
+
readonly budget: HardEffortBudget;
|
|
74
|
+
/** Whether stated acceptance criteria (issue/xBRIEF AC) are already met. */
|
|
75
|
+
readonly statedAcceptanceMet: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Reserve for a fix after a deeper finding (turns). Default 3 — if remaining
|
|
78
|
+
* is below this, do not start self-imposed deepening.
|
|
79
|
+
*/
|
|
80
|
+
readonly deepenReserveTurns?: number;
|
|
81
|
+
/** Reserve for a fix after a deeper finding (cost units). Default null (ignore). */
|
|
82
|
+
readonly deepenReserveBudget?: number | null;
|
|
83
|
+
/**
|
|
84
|
+
* Minimum remaining fraction of max turns/cost required to deepen after AC bank
|
|
85
|
+
* (#3285). Default 0.2 (20%). Set null to skip the surplus fraction gate and
|
|
86
|
+
* use only the absolute reserve.
|
|
87
|
+
*/
|
|
88
|
+
readonly surplusThreshold?: number | null;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Parse host effort-budget descriptor from env JSON (#1461 / #3266 production wire).
|
|
92
|
+
* Returns null when unset or unparseable (fail-open).
|
|
93
|
+
*/
|
|
94
|
+
export declare function parseHostEffortBudgetEnv(environ?: Readonly<Record<string, string | undefined>>): Readonly<Record<string, unknown>> | null;
|
|
95
|
+
/**
|
|
96
|
+
* Production host-adapter: translate host/harness native signals into a descriptor
|
|
97
|
+
* object for detectHardEffortBudget (#1461 / #3266).
|
|
98
|
+
*
|
|
99
|
+
* Sources (later keys fill gaps only):
|
|
100
|
+
* 1. `DEFT_HOST_EFFORT_BUDGET` JSON (`maxTurns` / `maxBudget` / `hardBudget`)
|
|
101
|
+
* 2. Common harness env aliases already accepted as max-turns / max-budget
|
|
102
|
+
* 3. Explicit hard-budget flag env
|
|
103
|
+
*
|
|
104
|
+
* session:start CLI and resolveEffortBudget always call this so descriptor-only
|
|
105
|
+
* host caps are not lost when the host never set DEFT_HOST_EFFORT_BUDGET.
|
|
106
|
+
*/
|
|
107
|
+
export declare function resolveProductionHostEffortDescriptor(environ?: Readonly<Record<string, string | undefined>>): Readonly<Record<string, unknown>>;
|
|
108
|
+
/**
|
|
109
|
+
* Detect a hard turn/cost budget from env and optional host descriptor (#3266).
|
|
110
|
+
* Defaults to unbounded when no signal is present.
|
|
111
|
+
* When `hostDescriptor` is omitted, falls back to `DEFT_HOST_EFFORT_BUDGET` JSON.
|
|
112
|
+
*/
|
|
113
|
+
export declare function detectHardEffortBudget(input?: DetectHardEffortBudgetInput): HardEffortBudget;
|
|
114
|
+
/**
|
|
115
|
+
* Recommend self-verification depth: bank stated AC before deepening (#3266).
|
|
116
|
+
*/
|
|
117
|
+
export declare function recommendVerificationDepth(input: RecommendVerificationDepthInput): VerificationDepthPolicy;
|
|
118
|
+
/**
|
|
119
|
+
* Operator-visible note when self-imposed deepening is skipped for budget (#1006).
|
|
120
|
+
*/
|
|
121
|
+
export declare function formatDeepeningSkippedNote(budget: HardEffortBudget, reason?: string): string;
|
|
122
|
+
/** Session-start / JSON payload shape. */
|
|
123
|
+
export declare function effortBudgetToDict(budget: HardEffortBudget): Record<string, unknown>;
|
|
124
|
+
/**
|
|
125
|
+
* Format operator-facing effort-budget lines for session:start (#3266).
|
|
126
|
+
* Always emits one summary line; adds bank-the-pass guidance when hard-capped.
|
|
127
|
+
*/
|
|
128
|
+
export declare function formatEffortBudgetLines(budget: HardEffortBudget): string[];
|
|
129
|
+
/**
|
|
130
|
+
* Detect + format; fail-open for session-start callers.
|
|
131
|
+
*/
|
|
132
|
+
export declare function maybeFormatEffortBudgetLines(input?: DetectHardEffortBudgetInput): {
|
|
133
|
+
budget: HardEffortBudget;
|
|
134
|
+
lines: string[];
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=effort-budget.d.ts.map
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hard effort-budget detection and bank-the-pass guidance (#3266).
|
|
3
|
+
*
|
|
4
|
+
* When a host/harness declares max-turns or max-cost, agents must bank the
|
|
5
|
+
* *stated* acceptance pass before self-imposed deepening. Detection is
|
|
6
|
+
* advisory at session start (env / flags / host capability pointer #1461);
|
|
7
|
+
* skill text in deft-directive-build and pre-pr owns the behavioral rule.
|
|
8
|
+
*
|
|
9
|
+
* Composes dual-stop (#2442): dual-stop is the failure/budget envelope;
|
|
10
|
+
* this module is the success-side analog (do not gold-plate past the bar
|
|
11
|
+
* when remaining budget cannot also fund a fix for deeper findings).
|
|
12
|
+
*
|
|
13
|
+
* Fail-loud (#1006): when deepening is skipped for budget, summaries must
|
|
14
|
+
* say so — never silent gold-plate or silent skip.
|
|
15
|
+
*/
|
|
16
|
+
/** Canonical max-turns env (hard turn budget). */
|
|
17
|
+
export const ENV_MAX_TURNS = "DEFT_MAX_TURNS";
|
|
18
|
+
/** Canonical max cost/budget env (opaque cost units from the host). */
|
|
19
|
+
export const ENV_MAX_BUDGET = "DEFT_MAX_BUDGET";
|
|
20
|
+
/** Remaining turns when the host updates mid-run. */
|
|
21
|
+
export const ENV_REMAINING_TURNS = "DEFT_REMAINING_TURNS";
|
|
22
|
+
/** Remaining cost units when the host updates mid-run. */
|
|
23
|
+
export const ENV_REMAINING_BUDGET = "DEFT_REMAINING_BUDGET";
|
|
24
|
+
/**
|
|
25
|
+
* Explicit hard-cap flag when the host has a limit but does not expose a number
|
|
26
|
+
* (truthy → hard-capped with unknown numeric ceiling).
|
|
27
|
+
*/
|
|
28
|
+
export const ENV_HARD_BUDGET = "DEFT_HARD_BUDGET";
|
|
29
|
+
/**
|
|
30
|
+
* Optional JSON host capability fragment for effort caps (#1461 / #3266).
|
|
31
|
+
* Example: `{"maxTurns":120,"maxBudget":10,"hardBudget":true}`.
|
|
32
|
+
* Production session:start merges this when `effortBudgetSeams.hostDescriptor` is unset.
|
|
33
|
+
*/
|
|
34
|
+
export const ENV_HOST_EFFORT_BUDGET = "DEFT_HOST_EFFORT_BUDGET";
|
|
35
|
+
/** Additional env keys accepted as max-turns aliases (harness / CLI common). */
|
|
36
|
+
export const MAX_TURNS_ENV_ALIASES = [
|
|
37
|
+
ENV_MAX_TURNS,
|
|
38
|
+
"MAX_TURNS",
|
|
39
|
+
"AGENT_MAX_TURNS",
|
|
40
|
+
"DEFT_AGENT_MAX_TURNS",
|
|
41
|
+
"CURSOR_MAX_TURNS",
|
|
42
|
+
];
|
|
43
|
+
/** Additional env keys accepted as max-budget/cost aliases. */
|
|
44
|
+
export const MAX_BUDGET_ENV_ALIASES = [
|
|
45
|
+
ENV_MAX_BUDGET,
|
|
46
|
+
"MAX_BUDGET",
|
|
47
|
+
"AGENT_BUDGET",
|
|
48
|
+
"DEFT_AGENT_BUDGET",
|
|
49
|
+
"AGENT_MAX_BUDGET",
|
|
50
|
+
];
|
|
51
|
+
const TRUTHY = new Set(["1", "true", "yes", "on"]);
|
|
52
|
+
function envTruthy(value) {
|
|
53
|
+
return TRUTHY.has((value ?? "").trim().toLowerCase());
|
|
54
|
+
}
|
|
55
|
+
function parsePositiveNumber(raw) {
|
|
56
|
+
if (raw === undefined)
|
|
57
|
+
return null;
|
|
58
|
+
const text = raw.trim();
|
|
59
|
+
if (!text)
|
|
60
|
+
return null;
|
|
61
|
+
const n = Number(text);
|
|
62
|
+
if (!Number.isFinite(n) || n < 0)
|
|
63
|
+
return null;
|
|
64
|
+
return n;
|
|
65
|
+
}
|
|
66
|
+
function firstNumericFromEnv(environ, keys) {
|
|
67
|
+
for (const key of keys) {
|
|
68
|
+
const value = parsePositiveNumber(environ[key]);
|
|
69
|
+
if (value !== null) {
|
|
70
|
+
return { value, source: `env:${key}` };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return { value: null, source: null };
|
|
74
|
+
}
|
|
75
|
+
function hostNumeric(host, keys) {
|
|
76
|
+
if (!host)
|
|
77
|
+
return { value: null, source: null };
|
|
78
|
+
for (const key of keys) {
|
|
79
|
+
const raw = host[key];
|
|
80
|
+
if (typeof raw === "number" && Number.isFinite(raw) && raw >= 0) {
|
|
81
|
+
return { value: raw, source: `host:${key}` };
|
|
82
|
+
}
|
|
83
|
+
if (typeof raw === "string") {
|
|
84
|
+
const n = parsePositiveNumber(raw);
|
|
85
|
+
if (n !== null)
|
|
86
|
+
return { value: n, source: `host:${key}` };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return { value: null, source: null };
|
|
90
|
+
}
|
|
91
|
+
function hostTruthy(host, keys) {
|
|
92
|
+
if (!host)
|
|
93
|
+
return null;
|
|
94
|
+
for (const key of keys) {
|
|
95
|
+
const raw = host[key];
|
|
96
|
+
if (raw === true)
|
|
97
|
+
return `host:${key}`;
|
|
98
|
+
if (typeof raw === "string" && envTruthy(raw))
|
|
99
|
+
return `host:${key}`;
|
|
100
|
+
if (typeof raw === "number" && raw === 1)
|
|
101
|
+
return `host:${key}`;
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Parse host effort-budget descriptor from env JSON (#1461 / #3266 production wire).
|
|
107
|
+
* Returns null when unset or unparseable (fail-open).
|
|
108
|
+
*/
|
|
109
|
+
export function parseHostEffortBudgetEnv(environ = process.env) {
|
|
110
|
+
const raw = (environ[ENV_HOST_EFFORT_BUDGET] ?? "").trim();
|
|
111
|
+
if (!raw)
|
|
112
|
+
return null;
|
|
113
|
+
try {
|
|
114
|
+
const parsed = JSON.parse(raw);
|
|
115
|
+
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
116
|
+
return parsed;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// fail-open
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Production host-adapter: translate host/harness native signals into a descriptor
|
|
126
|
+
* object for detectHardEffortBudget (#1461 / #3266).
|
|
127
|
+
*
|
|
128
|
+
* Sources (later keys fill gaps only):
|
|
129
|
+
* 1. `DEFT_HOST_EFFORT_BUDGET` JSON (`maxTurns` / `maxBudget` / `hardBudget`)
|
|
130
|
+
* 2. Common harness env aliases already accepted as max-turns / max-budget
|
|
131
|
+
* 3. Explicit hard-budget flag env
|
|
132
|
+
*
|
|
133
|
+
* session:start CLI and resolveEffortBudget always call this so descriptor-only
|
|
134
|
+
* host caps are not lost when the host never set DEFT_HOST_EFFORT_BUDGET.
|
|
135
|
+
*/
|
|
136
|
+
export function resolveProductionHostEffortDescriptor(environ = process.env) {
|
|
137
|
+
const out = {
|
|
138
|
+
...(parseHostEffortBudgetEnv(environ) ?? {}),
|
|
139
|
+
};
|
|
140
|
+
if (out.maxTurns === undefined) {
|
|
141
|
+
const turns = firstNumericFromEnv(environ, MAX_TURNS_ENV_ALIASES);
|
|
142
|
+
if (turns.value !== null)
|
|
143
|
+
out.maxTurns = turns.value;
|
|
144
|
+
}
|
|
145
|
+
if (out.maxBudget === undefined) {
|
|
146
|
+
const budget = firstNumericFromEnv(environ, MAX_BUDGET_ENV_ALIASES);
|
|
147
|
+
if (budget.value !== null)
|
|
148
|
+
out.maxBudget = budget.value;
|
|
149
|
+
}
|
|
150
|
+
if (out.hardBudget === undefined && envTruthy(environ[ENV_HARD_BUDGET])) {
|
|
151
|
+
out.hardBudget = true;
|
|
152
|
+
}
|
|
153
|
+
// Remaining counters as soft descriptor fields (detection also reads them).
|
|
154
|
+
if (out.remainingTurns === undefined) {
|
|
155
|
+
const rem = firstNumericFromEnv(environ, [ENV_REMAINING_TURNS, "REMAINING_TURNS"]);
|
|
156
|
+
if (rem.value !== null)
|
|
157
|
+
out.remainingTurns = rem.value;
|
|
158
|
+
}
|
|
159
|
+
if (out.remainingBudget === undefined) {
|
|
160
|
+
const rem = firstNumericFromEnv(environ, [ENV_REMAINING_BUDGET, "REMAINING_BUDGET"]);
|
|
161
|
+
if (rem.value !== null)
|
|
162
|
+
out.remainingBudget = rem.value;
|
|
163
|
+
}
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Detect a hard turn/cost budget from env and optional host descriptor (#3266).
|
|
168
|
+
* Defaults to unbounded when no signal is present.
|
|
169
|
+
* When `hostDescriptor` is omitted, falls back to `DEFT_HOST_EFFORT_BUDGET` JSON.
|
|
170
|
+
*/
|
|
171
|
+
export function detectHardEffortBudget(input = {}) {
|
|
172
|
+
const environ = input.environ ?? process.env;
|
|
173
|
+
const host = input.hostDescriptor !== undefined
|
|
174
|
+
? (input.hostDescriptor ?? null)
|
|
175
|
+
: parseHostEffortBudgetEnv(environ);
|
|
176
|
+
const sources = [];
|
|
177
|
+
if (host !== null && input.hostDescriptor === undefined) {
|
|
178
|
+
sources.push(`env:${ENV_HOST_EFFORT_BUDGET}`);
|
|
179
|
+
}
|
|
180
|
+
const turnsEnv = firstNumericFromEnv(environ, MAX_TURNS_ENV_ALIASES);
|
|
181
|
+
const budgetEnv = firstNumericFromEnv(environ, MAX_BUDGET_ENV_ALIASES);
|
|
182
|
+
const turnsHost = hostNumeric(host, ["maxTurns", "max_turns", "maxTurnLimit"]);
|
|
183
|
+
const budgetHost = hostNumeric(host, ["maxBudget", "max_budget", "maxCost", "max_cost"]);
|
|
184
|
+
// Prefer explicit DEFT_* then first alias; host fills gaps only.
|
|
185
|
+
const maxTurns = turnsEnv.value ?? turnsHost.value;
|
|
186
|
+
const maxBudget = budgetEnv.value ?? budgetHost.value;
|
|
187
|
+
if (turnsEnv.source)
|
|
188
|
+
sources.push(turnsEnv.source);
|
|
189
|
+
else if (turnsHost.source)
|
|
190
|
+
sources.push(turnsHost.source);
|
|
191
|
+
if (budgetEnv.source)
|
|
192
|
+
sources.push(budgetEnv.source);
|
|
193
|
+
else if (budgetHost.source)
|
|
194
|
+
sources.push(budgetHost.source);
|
|
195
|
+
const remainingTurnsEnv = firstNumericFromEnv(environ, [ENV_REMAINING_TURNS, "REMAINING_TURNS"]);
|
|
196
|
+
const remainingBudgetEnv = firstNumericFromEnv(environ, [
|
|
197
|
+
ENV_REMAINING_BUDGET,
|
|
198
|
+
"REMAINING_BUDGET",
|
|
199
|
+
]);
|
|
200
|
+
if (remainingTurnsEnv.source)
|
|
201
|
+
sources.push(remainingTurnsEnv.source);
|
|
202
|
+
if (remainingBudgetEnv.source)
|
|
203
|
+
sources.push(remainingBudgetEnv.source);
|
|
204
|
+
const remainingTurns = remainingTurnsEnv.value ?? maxTurns;
|
|
205
|
+
const remainingBudget = remainingBudgetEnv.value ?? maxBudget;
|
|
206
|
+
let hardFlag = false;
|
|
207
|
+
if (envTruthy(environ[ENV_HARD_BUDGET])) {
|
|
208
|
+
hardFlag = true;
|
|
209
|
+
sources.push(`env:${ENV_HARD_BUDGET}`);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
const hostFlag = hostTruthy(host, ["hardBudget", "hard_budget", "hasHardBudget"]);
|
|
213
|
+
if (hostFlag) {
|
|
214
|
+
hardFlag = true;
|
|
215
|
+
sources.push(hostFlag);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// Remaining-only signals still imply a hard cap even when max is unknown (#3266 Greptile).
|
|
219
|
+
const hasTurns = maxTurns !== null || remainingTurnsEnv.value !== null;
|
|
220
|
+
const hasCost = maxBudget !== null || remainingBudgetEnv.value !== null;
|
|
221
|
+
let kind = "none";
|
|
222
|
+
if (hasTurns && hasCost)
|
|
223
|
+
kind = "both";
|
|
224
|
+
else if (hasTurns)
|
|
225
|
+
kind = "max-turns";
|
|
226
|
+
else if (hasCost)
|
|
227
|
+
kind = "max-cost";
|
|
228
|
+
else if (hardFlag)
|
|
229
|
+
kind = "hard-flag";
|
|
230
|
+
const detected = kind !== "none";
|
|
231
|
+
return {
|
|
232
|
+
detected,
|
|
233
|
+
posture: detected ? "hard-capped" : "unbounded",
|
|
234
|
+
kind,
|
|
235
|
+
maxTurns,
|
|
236
|
+
maxBudget,
|
|
237
|
+
remainingTurns: detected ? remainingTurns : null,
|
|
238
|
+
remainingBudget: detected ? remainingBudget : null,
|
|
239
|
+
sources,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Recommend self-verification depth: bank stated AC before deepening (#3266).
|
|
244
|
+
*/
|
|
245
|
+
export function recommendVerificationDepth(input) {
|
|
246
|
+
const { budget, statedAcceptanceMet } = input;
|
|
247
|
+
if (!budget.detected) {
|
|
248
|
+
return "unconstrained-deepen";
|
|
249
|
+
}
|
|
250
|
+
if (!statedAcceptanceMet) {
|
|
251
|
+
// Hard budget + AC open → only work that banks the stated pass.
|
|
252
|
+
return "stated-only";
|
|
253
|
+
}
|
|
254
|
+
const reserveTurns = input.deepenReserveTurns ?? 3;
|
|
255
|
+
const reserveBudget = input.deepenReserveBudget ?? null;
|
|
256
|
+
// #3285: default 20% surplus of max remaining after bank; null disables.
|
|
257
|
+
const surplusThreshold = input.surplusThreshold === undefined ? 0.2 : input.surplusThreshold;
|
|
258
|
+
const turnsOk = budget.remainingTurns === null || budget.remainingTurns >= reserveTurns;
|
|
259
|
+
const costOk = reserveBudget === null ||
|
|
260
|
+
budget.remainingBudget === null ||
|
|
261
|
+
budget.remainingBudget >= reserveBudget;
|
|
262
|
+
// hard-flag with no numbers: after AC is met, allow stated-then-deepen only
|
|
263
|
+
// when remaining is unknown — agent still must fail-loud if it skips.
|
|
264
|
+
if (budget.kind === "hard-flag") {
|
|
265
|
+
return "stated-then-deepen";
|
|
266
|
+
}
|
|
267
|
+
if (!(turnsOk && costOk)) {
|
|
268
|
+
return "stated-only";
|
|
269
|
+
}
|
|
270
|
+
// Surplus fraction gate (#3285): remaining/max must meet threshold on every
|
|
271
|
+
// known max+remaining axis. When max is unknown, absolute reserve alone applies.
|
|
272
|
+
if (surplusThreshold !== null) {
|
|
273
|
+
if (budget.remainingTurns !== null &&
|
|
274
|
+
budget.maxTurns !== null &&
|
|
275
|
+
budget.maxTurns > 0 &&
|
|
276
|
+
budget.remainingTurns / budget.maxTurns < surplusThreshold) {
|
|
277
|
+
return "stated-only";
|
|
278
|
+
}
|
|
279
|
+
if (budget.remainingBudget !== null &&
|
|
280
|
+
budget.maxBudget !== null &&
|
|
281
|
+
budget.maxBudget > 0 &&
|
|
282
|
+
budget.remainingBudget / budget.maxBudget < surplusThreshold) {
|
|
283
|
+
return "stated-only";
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return "stated-then-deepen";
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Operator-visible note when self-imposed deepening is skipped for budget (#1006).
|
|
290
|
+
*/
|
|
291
|
+
export function formatDeepeningSkippedNote(budget, reason) {
|
|
292
|
+
const detail = reason?.trim() ||
|
|
293
|
+
"remaining budget is insufficient to both deepen verification and fix a found defect";
|
|
294
|
+
const sources = budget.sources.length > 0 ? ` sources=${budget.sources.join(",")}` : "";
|
|
295
|
+
const rem = budget.remainingTurns !== null
|
|
296
|
+
? ` remaining_turns=${budget.remainingTurns}`
|
|
297
|
+
: budget.remainingBudget !== null
|
|
298
|
+
? ` remaining_budget=${budget.remainingBudget}`
|
|
299
|
+
: "";
|
|
300
|
+
return (`[deft effort-budget] deepening_skipped=true reason=${detail}` +
|
|
301
|
+
` posture=${budget.posture} kind=${budget.kind}${rem}${sources} (#3266/#1006)`);
|
|
302
|
+
}
|
|
303
|
+
/** Session-start / JSON payload shape. */
|
|
304
|
+
export function effortBudgetToDict(budget) {
|
|
305
|
+
return {
|
|
306
|
+
detected: budget.detected,
|
|
307
|
+
posture: budget.posture,
|
|
308
|
+
kind: budget.kind,
|
|
309
|
+
max_turns: budget.maxTurns,
|
|
310
|
+
max_budget: budget.maxBudget,
|
|
311
|
+
remaining_turns: budget.remainingTurns,
|
|
312
|
+
remaining_budget: budget.remainingBudget,
|
|
313
|
+
sources: [...budget.sources],
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Format operator-facing effort-budget lines for session:start (#3266).
|
|
318
|
+
* Always emits one summary line; adds bank-the-pass guidance when hard-capped.
|
|
319
|
+
*/
|
|
320
|
+
export function formatEffortBudgetLines(budget) {
|
|
321
|
+
if (!budget.detected) {
|
|
322
|
+
return [
|
|
323
|
+
"[deft effort-budget] posture=unbounded — no hard max-turns/max-budget signal " +
|
|
324
|
+
`(env ${ENV_MAX_TURNS}/${ENV_MAX_BUDGET} or host descriptor) (#3266)`,
|
|
325
|
+
];
|
|
326
|
+
}
|
|
327
|
+
const parts = [`[deft effort-budget] posture=${budget.posture}`, `kind=${budget.kind}`];
|
|
328
|
+
if (budget.maxTurns !== null)
|
|
329
|
+
parts.push(`max_turns=${budget.maxTurns}`);
|
|
330
|
+
if (budget.remainingTurns !== null && budget.remainingTurns !== budget.maxTurns) {
|
|
331
|
+
parts.push(`remaining_turns=${budget.remainingTurns}`);
|
|
332
|
+
}
|
|
333
|
+
if (budget.maxBudget !== null)
|
|
334
|
+
parts.push(`max_budget=${budget.maxBudget}`);
|
|
335
|
+
if (budget.remainingBudget !== null && budget.remainingBudget !== budget.maxBudget) {
|
|
336
|
+
parts.push(`remaining_budget=${budget.remainingBudget}`);
|
|
337
|
+
}
|
|
338
|
+
if (budget.sources.length > 0)
|
|
339
|
+
parts.push(`sources=${budget.sources.join(",")}`);
|
|
340
|
+
const lines = [`${parts.join(" ")} (#3266)`];
|
|
341
|
+
lines.push("[deft effort-budget] bank stated acceptance pass before self-imposed deepening; " +
|
|
342
|
+
"scale verification depth with remaining budget; fail-loud when deepening is skipped (#3266/#1006)");
|
|
343
|
+
return lines;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Detect + format; fail-open for session-start callers.
|
|
347
|
+
*/
|
|
348
|
+
export function maybeFormatEffortBudgetLines(input = {}) {
|
|
349
|
+
const budget = detectHardEffortBudget(input);
|
|
350
|
+
return { budget, lines: formatEffortBudgetLines(budget) };
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=effort-budget.js.map
|
package/dist/session/index.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
export * from "./ac-pass-banking.js";
|
|
2
|
+
export * from "./active-cli.js";
|
|
1
3
|
export * from "./compact-ritual.js";
|
|
2
4
|
export * from "./coverage-check-resume-nudge.js";
|
|
5
|
+
export * from "./deposit-sha.js";
|
|
6
|
+
export * from "./effort-budget.js";
|
|
3
7
|
export * from "./git.js";
|
|
4
8
|
export * from "./json.js";
|
|
5
9
|
export * from "./openclaw-soft-rebind-deposit.js";
|
|
10
|
+
export * from "./orientation-compression.js";
|
|
11
|
+
export * from "./orientation-state.js";
|
|
6
12
|
export * from "./posture.js";
|
|
7
13
|
export * from "./process-cost.js";
|
|
8
14
|
export * from "./resume-conditions.js";
|
|
@@ -11,5 +17,6 @@ export * from "./session-ready.js";
|
|
|
11
17
|
export * from "./session-start.js";
|
|
12
18
|
export * from "./session-start-hook.js";
|
|
13
19
|
export * from "./time.js";
|
|
20
|
+
export * from "./toolchain-preflight.js";
|
|
14
21
|
export * from "./verify-session-ritual.js";
|
|
15
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/session/index.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
export * from "./ac-pass-banking.js";
|
|
2
|
+
export * from "./active-cli.js";
|
|
1
3
|
export * from "./compact-ritual.js";
|
|
2
4
|
export * from "./coverage-check-resume-nudge.js";
|
|
5
|
+
export * from "./deposit-sha.js";
|
|
6
|
+
export * from "./effort-budget.js";
|
|
3
7
|
export * from "./git.js";
|
|
4
8
|
export * from "./json.js";
|
|
5
9
|
export * from "./openclaw-soft-rebind-deposit.js";
|
|
10
|
+
export * from "./orientation-compression.js";
|
|
11
|
+
export * from "./orientation-state.js";
|
|
6
12
|
export * from "./posture.js";
|
|
7
13
|
export * from "./process-cost.js";
|
|
8
14
|
export * from "./resume-conditions.js";
|
|
@@ -11,5 +17,6 @@ export * from "./session-ready.js";
|
|
|
11
17
|
export * from "./session-start.js";
|
|
12
18
|
export * from "./session-start-hook.js";
|
|
13
19
|
export * from "./time.js";
|
|
20
|
+
export * from "./toolchain-preflight.js";
|
|
14
21
|
export * from "./verify-session-ritual.js";
|
|
15
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orientation compression Now path (#3286 / dual-path #2899).
|
|
3
|
+
*
|
|
4
|
+
* Composes doctor + toolchain preflight into session:start as inline sections
|
|
5
|
+
* with per-section status lines; offers deposit-sha fast-paths for
|
|
6
|
+
* agents:refresh and verify:cache-fresh; formats compact (opt-in) vs verbose
|
|
7
|
+
* (default). Does NOT implement unified `deft orient` (Later remains open).
|
|
8
|
+
*/
|
|
9
|
+
import type { DoctorSeams } from "../doctor/types.js";
|
|
10
|
+
import { applyAgentsRefresh } from "../platform/agents-md.js";
|
|
11
|
+
import { type EvaluateOptions, evaluate as evaluateCacheFresh } from "../preflight-cache/evaluate.js";
|
|
12
|
+
import { type ComputeDepositShaOptions } from "./deposit-sha.js";
|
|
13
|
+
import { type OrientationState } from "./orientation-state.js";
|
|
14
|
+
import { type ToolchainPreflightOptions, type ToolchainPreflightResult } from "./toolchain-preflight.js";
|
|
15
|
+
/** Env opt-in for compact orientation output (#3286). Verbose remains default. */
|
|
16
|
+
export declare const ENV_SESSION_COMPACT = "DEFT_SESSION_COMPACT";
|
|
17
|
+
/** Dual-path Later graduation status — Now ships without closing Later (#2899). */
|
|
18
|
+
export declare const ORIENTATION_LATER_STATUS: "open";
|
|
19
|
+
export declare const ORIENTATION_LATER_COMMAND = "deft orient";
|
|
20
|
+
export declare const ORIENTATION_GRADUATION_TRIGGER: string;
|
|
21
|
+
export type OrientationSectionName = "doctor" | "preflight" | "agents_refresh" | "cache_fresh";
|
|
22
|
+
export type OrientationSectionStatus = "ok" | "dirty" | "degraded" | "error" | "skipped" | "sha_match";
|
|
23
|
+
export interface OrientationSectionResult {
|
|
24
|
+
readonly name: OrientationSectionName;
|
|
25
|
+
readonly status: OrientationSectionStatus;
|
|
26
|
+
readonly ok: boolean;
|
|
27
|
+
readonly exitCode: number;
|
|
28
|
+
readonly lines: readonly string[];
|
|
29
|
+
readonly shaMatch: boolean;
|
|
30
|
+
readonly depositSha?: string;
|
|
31
|
+
readonly durationMs: number;
|
|
32
|
+
readonly detail?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
export interface OrientationBundle {
|
|
35
|
+
readonly depositSha: string;
|
|
36
|
+
readonly compact: boolean;
|
|
37
|
+
readonly sections: readonly OrientationSectionResult[];
|
|
38
|
+
readonly lines: readonly string[];
|
|
39
|
+
/** Count of orientation surfaces touched this session (for run-summary #3282 trigger). */
|
|
40
|
+
readonly orientationCallCount: number;
|
|
41
|
+
readonly later: {
|
|
42
|
+
readonly status: typeof ORIENTATION_LATER_STATUS;
|
|
43
|
+
readonly command: typeof ORIENTATION_LATER_COMMAND;
|
|
44
|
+
readonly trigger: typeof ORIENTATION_GRADUATION_TRIGGER;
|
|
45
|
+
};
|
|
46
|
+
readonly preflight: ToolchainPreflightResult | null;
|
|
47
|
+
readonly state: OrientationState;
|
|
48
|
+
}
|
|
49
|
+
export interface RunOrientationOptions {
|
|
50
|
+
readonly projectRoot: string;
|
|
51
|
+
readonly frameworkRoot?: string;
|
|
52
|
+
readonly compact?: boolean;
|
|
53
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
54
|
+
readonly now?: Date;
|
|
55
|
+
readonly depositShaOptions?: ComputeDepositShaOptions;
|
|
56
|
+
readonly toolchainPreflight?: ToolchainPreflightResult | null;
|
|
57
|
+
readonly toolchainPreflightOptions?: ToolchainPreflightOptions;
|
|
58
|
+
/** Skip doctor (tests) or inject structured result. */
|
|
59
|
+
readonly doctorSection?: OrientationSectionResult | null;
|
|
60
|
+
readonly doctorSeams?: DoctorSeams;
|
|
61
|
+
/** Skip agents:refresh or inject. */
|
|
62
|
+
readonly agentsRefreshSection?: OrientationSectionResult | null;
|
|
63
|
+
/** Skip cache_fresh or inject. */
|
|
64
|
+
readonly cacheFreshSection?: OrientationSectionResult | null;
|
|
65
|
+
readonly cacheFreshOptions?: EvaluateOptions;
|
|
66
|
+
/** When true (default), persist orientation-state for next-session fast-path. */
|
|
67
|
+
readonly persistState?: boolean;
|
|
68
|
+
/** Disable individual sections (tests / re-arm). */
|
|
69
|
+
readonly includeDoctor?: boolean;
|
|
70
|
+
readonly includePreflight?: boolean;
|
|
71
|
+
readonly includeAgentsRefresh?: boolean;
|
|
72
|
+
readonly includeCacheFresh?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** Resolve compact flag: explicit option wins, else DEFT_SESSION_COMPACT. */
|
|
75
|
+
export declare function resolveSessionCompact(options?: Pick<RunOrientationOptions, "compact" | "env">): boolean;
|
|
76
|
+
/** Compact machine lines (one per section). Verbose default keeps prose. */
|
|
77
|
+
export declare function formatOrientationCompactLines(sections: readonly OrientationSectionResult[]): string[];
|
|
78
|
+
export declare function formatOrientationVerboseLines(sections: readonly OrientationSectionResult[]): string[];
|
|
79
|
+
/**
|
|
80
|
+
* Doctor orientation section — throttle status when clean/recent; otherwise
|
|
81
|
+
* run doctor and surface a per-section status line (#3286 compose).
|
|
82
|
+
*/
|
|
83
|
+
export declare function runDoctorOrientationSection(projectRoot: string, options?: {
|
|
84
|
+
now?: Date;
|
|
85
|
+
seams?: DoctorSeams;
|
|
86
|
+
doctorRunner?: (args: readonly string[], seams?: DoctorSeams) => number;
|
|
87
|
+
}): OrientationSectionResult;
|
|
88
|
+
export declare function runPreflightOrientationSection(projectRoot: string, options?: {
|
|
89
|
+
frameworkRoot?: string;
|
|
90
|
+
result?: ToolchainPreflightResult | null;
|
|
91
|
+
preflightOptions?: ToolchainPreflightOptions;
|
|
92
|
+
}): {
|
|
93
|
+
section: OrientationSectionResult | null;
|
|
94
|
+
preflight: ToolchainPreflightResult | null;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* agents:refresh orientation section (#3286).
|
|
98
|
+
* Always plans against live AGENTS.md so local managed-section edits are
|
|
99
|
+
* detected (deposit fingerprint alone is insufficient). Content-current →
|
|
100
|
+
* one-line sha-match phrasing; deposit-sha is recorded for orientation telemetry.
|
|
101
|
+
*/
|
|
102
|
+
export declare function runAgentsRefreshOrientationSection(projectRoot: string, options: {
|
|
103
|
+
depositSha: string;
|
|
104
|
+
prior?: OrientationState | null;
|
|
105
|
+
now?: Date;
|
|
106
|
+
apply?: typeof applyAgentsRefresh;
|
|
107
|
+
}): OrientationSectionResult;
|
|
108
|
+
/**
|
|
109
|
+
* verify:cache-fresh orientation section (#3286).
|
|
110
|
+
* Always runs the live evaluate (age + drift). Deposit fingerprint is recorded
|
|
111
|
+
* for orientation telemetry only — it must not suppress triage-cache freshness.
|
|
112
|
+
* When evaluate is already clean, surface a one-line sha-match-style no-op only
|
|
113
|
+
* if the message is the canonical deposit phrase (not used for shortcuts).
|
|
114
|
+
*/
|
|
115
|
+
export declare function runCacheFreshOrientationSection(projectRoot: string, options: {
|
|
116
|
+
depositSha: string;
|
|
117
|
+
prior?: OrientationState | null;
|
|
118
|
+
now?: Date;
|
|
119
|
+
evaluateOptions?: EvaluateOptions;
|
|
120
|
+
evaluateFn?: typeof evaluateCacheFresh;
|
|
121
|
+
}): OrientationSectionResult;
|
|
122
|
+
/**
|
|
123
|
+
* Run the composed orientation sections for a mutation cold session:start.
|
|
124
|
+
*/
|
|
125
|
+
export declare function runOrientationCompression(options: RunOrientationOptions): OrientationBundle;
|
|
126
|
+
export { computeDepositSha, DEPOSIT_SHA_MATCH_NOOP, depositShaMatches, formatDepositShaMatchLine, } from "./deposit-sha.js";
|
|
127
|
+
//# sourceMappingURL=orientation-compression.d.ts.map
|