zelari-code 2.12.0 → 2.14.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/cli/headless/policyGate.js +101 -0
- package/dist/cli/headless/policyGate.js.map +1 -0
- package/dist/cli/headless.js.map +1 -1
- package/dist/cli/kraken/completionProof.js +89 -41
- package/dist/cli/kraken/completionProof.js.map +1 -1
- package/dist/cli/kraken/completionProofAttestation.js +157 -0
- package/dist/cli/kraken/completionProofAttestation.js.map +1 -0
- package/dist/cli/kraken/completionProofPersist.js +219 -0
- package/dist/cli/kraken/completionProofPersist.js.map +1 -0
- package/dist/cli/kraken/completionProofProbe.js +135 -0
- package/dist/cli/kraken/completionProofProbe.js.map +1 -0
- package/dist/cli/kraken/contractCompiler.js +142 -0
- package/dist/cli/kraken/contractCompiler.js.map +1 -0
- package/dist/cli/kraken/delegationPolicy.js +40 -3
- package/dist/cli/kraken/delegationPolicy.js.map +1 -1
- package/dist/cli/kraken/executor.js +462 -9
- package/dist/cli/kraken/executor.js.map +1 -1
- package/dist/cli/kraken/fileOwnership.js +190 -0
- package/dist/cli/kraken/fileOwnership.js.map +1 -0
- package/dist/cli/kraken/modelReputation.js +208 -0
- package/dist/cli/kraken/modelReputation.js.map +1 -0
- package/dist/cli/kraken/nativeVerification.js +53 -11
- package/dist/cli/kraken/nativeVerification.js.map +1 -1
- package/dist/cli/kraken/planner.js +2 -0
- package/dist/cli/kraken/planner.js.map +1 -1
- package/dist/cli/kraken/reputationStore.js +139 -0
- package/dist/cli/kraken/reputationStore.js.map +1 -0
- package/dist/cli/kraken/semanticOwnership.js +184 -0
- package/dist/cli/kraken/semanticOwnership.js.map +1 -0
- package/dist/cli/kraken/spawnRoi.js +209 -0
- package/dist/cli/kraken/spawnRoi.js.map +1 -0
- package/dist/cli/kraken/transactional.js +104 -0
- package/dist/cli/kraken/transactional.js.map +1 -0
- package/dist/cli/kraken/verificationAdapters/dotnet.js +49 -0
- package/dist/cli/kraken/verificationAdapters/dotnet.js.map +1 -0
- package/dist/cli/kraken/verificationAdapters/go.js +36 -0
- package/dist/cli/kraken/verificationAdapters/go.js.map +1 -0
- package/dist/cli/kraken/verificationAdapters/index.js +47 -0
- package/dist/cli/kraken/verificationAdapters/index.js.map +1 -0
- package/dist/cli/kraken/verificationAdapters/java.js +102 -0
- package/dist/cli/kraken/verificationAdapters/java.js.map +1 -0
- package/dist/cli/kraken/verificationAdapters/node.js +90 -0
- package/dist/cli/kraken/verificationAdapters/node.js.map +1 -0
- package/dist/cli/kraken/verificationAdapters/python.js +86 -0
- package/dist/cli/kraken/verificationAdapters/python.js.map +1 -0
- package/dist/cli/kraken/verificationAdapters/rust.js +39 -0
- package/dist/cli/kraken/verificationAdapters/rust.js.map +1 -0
- package/dist/cli/kraken/verificationAdapters/types.js +2 -0
- package/dist/cli/kraken/verificationAdapters/types.js.map +1 -0
- package/dist/cli/kraken/verificationBridge.js +40 -3
- package/dist/cli/kraken/verificationBridge.js.map +1 -1
- package/dist/cli/kraken/verifierLifecycle.js +51 -36
- package/dist/cli/kraken/verifierLifecycle.js.map +1 -1
- package/dist/cli/kraken/verifierRouting.js +264 -0
- package/dist/cli/kraken/verifierRouting.js.map +1 -0
- package/dist/cli/kraken/worktreeScheduling.js +201 -0
- package/dist/cli/kraken/worktreeScheduling.js.map +1 -0
- package/dist/cli/main.bundled.js +4085 -939
- package/dist/cli/main.bundled.js.map +4 -4
- package/dist/cli/orchestration/facts.js +127 -0
- package/dist/cli/orchestration/facts.js.map +1 -0
- package/dist/cli/orchestration/policy.js +128 -75
- package/dist/cli/orchestration/policy.js.map +1 -1
- package/dist/cli/orchestration/signals.js +96 -0
- package/dist/cli/orchestration/signals.js.map +1 -0
- package/dist/cli/runHeadless.js +92 -19
- package/dist/cli/runHeadless.js.map +1 -1
- package/dist/cli/safety/policyEngine.js +217 -43
- package/dist/cli/safety/policyEngine.js.map +1 -1
- package/dist/cli/safety/policyLayers.js +55 -0
- package/dist/cli/safety/policyLayers.js.map +1 -0
- package/dist/cli/safety/policyLoadMode.js +59 -0
- package/dist/cli/safety/policyLoadMode.js.map +1 -0
- package/dist/cli/safety/resourceClaims.js +373 -0
- package/dist/cli/safety/resourceClaims.js.map +1 -0
- package/dist/cli/safety/sandboxPath.js +160 -17
- package/dist/cli/safety/sandboxPath.js.map +1 -1
- package/dist/cli/toolRegistry.js +114 -15
- package/dist/cli/toolRegistry.js.map +1 -1
- package/dist/cli/tools/execProcess.js +121 -0
- package/dist/cli/tools/execProcess.js.map +1 -0
- package/dist/cli/tools/krakenCsvFanout.js +4 -4
- package/dist/cli/tools/krakenCsvFanout.js.map +1 -1
- package/dist/cli/tools/krakenRadio.js +9 -0
- package/dist/cli/tools/krakenRadio.js.map +1 -1
- package/dist/cli/tools/taskTool.js +12 -6
- package/dist/cli/tools/taskTool.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* orchestration/facts — t23 (§P1.E): cheap I/O inputs for the decision.
|
|
3
|
+
*
|
|
4
|
+
* chooseOrchestration itself stays PURE (no I/O, no env reads) — this module
|
|
5
|
+
* is the only place that touches disk / the task-contract seam, and callers
|
|
6
|
+
* inject its output into the pure classifier. Every collector fails soft:
|
|
7
|
+
* on any error it returns `undefined` for that input (the table then treats
|
|
8
|
+
* the fact as "unknown", never as an escalation reason).
|
|
9
|
+
*/
|
|
10
|
+
import { promises as fs } from 'node:fs';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { activeContractScope } from '../kraken/contractCompiler.js';
|
|
13
|
+
/** Repos above this file count count as "large" (weak explore-signal only). */
|
|
14
|
+
export const LARGE_REPO_FILES = 800;
|
|
15
|
+
/** Bounded walk budget: stop counting after this many files. */
|
|
16
|
+
const MAX_WALK_FILES = 5_000;
|
|
17
|
+
/** Directories never descended into (dependency/vendor noise). */
|
|
18
|
+
const SKIP_DIRS = new Set([
|
|
19
|
+
'node_modules',
|
|
20
|
+
'.git',
|
|
21
|
+
'dist',
|
|
22
|
+
'build',
|
|
23
|
+
'.next',
|
|
24
|
+
'coverage',
|
|
25
|
+
'.zelari',
|
|
26
|
+
'.venv',
|
|
27
|
+
]);
|
|
28
|
+
/**
|
|
29
|
+
* Count workspace files with a bounded iterative walk (cheap, no deps).
|
|
30
|
+
* `undefined` when the root is unreadable — unknown is not an error.
|
|
31
|
+
*/
|
|
32
|
+
export async function collectRepoFileCount(root = process.cwd()) {
|
|
33
|
+
try {
|
|
34
|
+
// The ROOT failing to read is "unknown repo"; a nested dir failing is
|
|
35
|
+
// just skipped noise. Distinguish them honestly.
|
|
36
|
+
await fs.readdir(root);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
let count = 0;
|
|
43
|
+
const queue = [root];
|
|
44
|
+
while (queue.length > 0 && count <= MAX_WALK_FILES) {
|
|
45
|
+
const dir = queue.pop();
|
|
46
|
+
let entries;
|
|
47
|
+
try {
|
|
48
|
+
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
continue; // unreadable subdir → skip silently
|
|
52
|
+
}
|
|
53
|
+
for (const e of entries) {
|
|
54
|
+
if (e.isDirectory()) {
|
|
55
|
+
if (!SKIP_DIRS.has(e.name))
|
|
56
|
+
queue.push(path.join(dir, e.name));
|
|
57
|
+
}
|
|
58
|
+
else if (e.isFile()) {
|
|
59
|
+
count++;
|
|
60
|
+
if (count > MAX_WALK_FILES)
|
|
61
|
+
return count;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return count;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gather all v2 decision inputs in one place:
|
|
73
|
+
* - risk/scope come from the ACTIVE TaskContract registered on the
|
|
74
|
+
* contractCompiler seam (`setActiveContractScope`, t22); headless turns
|
|
75
|
+
* start fresh per process, so usually undefined ⇒ neutral defaults apply
|
|
76
|
+
* inside the policy (medium-ish risk, no scope).
|
|
77
|
+
* - repoSize from the bounded walk above.
|
|
78
|
+
* - previousFailures is always 0 until a spine look-up is threaded through
|
|
79
|
+
* (see OrchestrationFacts.previousFailures note).
|
|
80
|
+
*/
|
|
81
|
+
export async function collectOrchestrationFacts(cwd = process.cwd()) {
|
|
82
|
+
const scope = safeActiveScope();
|
|
83
|
+
const [repoSize] = await Promise.all([collectRepoFileCount(cwd)]);
|
|
84
|
+
return {
|
|
85
|
+
...(scope?.contract.risk ? { risk: scope.contract.risk } : {}),
|
|
86
|
+
...(scope?.contract.scope
|
|
87
|
+
? {
|
|
88
|
+
scopePathsCount: (scope.contract.scope.allowedPaths?.length ?? 0) +
|
|
89
|
+
(scope.contract.scope.forbiddenPaths?.length ?? 0),
|
|
90
|
+
}
|
|
91
|
+
: {}),
|
|
92
|
+
...(repoSize !== undefined ? { repoSize } : {}),
|
|
93
|
+
previousFailures: 0,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function safeActiveScope() {
|
|
97
|
+
try {
|
|
98
|
+
return activeContractScope();
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Telemetry: record the decision on the session spine as a state-only `note`
|
|
106
|
+
* event (ADR-0021 vocabulary — `note` is existing, never model-surface, and
|
|
107
|
+
* the tolerant replay invariant already ignores it). Adding a brand-new core
|
|
108
|
+
* kind would require a schema review, so we REUSE `note` with a namespaced
|
|
109
|
+
* payload: data.subject === 'orchestration_decision'.
|
|
110
|
+
*/
|
|
111
|
+
export function spineOrchestrationNote(handle, decision) {
|
|
112
|
+
try {
|
|
113
|
+
handle.note(`orchestration_decision ${decision.strategy}`, {
|
|
114
|
+
subject: 'orchestration_decision',
|
|
115
|
+
strategy: decision.strategy,
|
|
116
|
+
surface: decision.surface,
|
|
117
|
+
confidence: decision.confidence,
|
|
118
|
+
rationaleCode: decision.rationaleCode,
|
|
119
|
+
reason: decision.reason,
|
|
120
|
+
estimatedLatencyMs: decision.estimatedLatencyMs,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// Degraded/disabled spine must NEVER break the run over telemetry.
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=facts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facts.js","sourceRoot":"","sources":["../../../src/cli/orchestration/facts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAA4B,MAAM,+BAA+B,CAAC;AAG9F,+EAA+E;AAC/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC,gEAAgE;AAChE,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B,kEAAkE;AAClE,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,cAAc;IACd,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,UAAU;IACV,SAAS;IACT,OAAO;CACR,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAe,OAAO,CAAC,GAAG,EAAE;IACrE,IAAI,CAAC;QACH,sEAAsE;QACtE,iDAAiD;QACjD,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC;QACH,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,KAAK,GAAa,CAAC,IAAI,CAAC,CAAC;QAC/B,OAA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DESIGN_RE, ESTIMATED_LATENCY_MS, EXPLAIN_RE, HEAVY_SIGNALS, MULTI_ARTIFACT_RE, QUESTION_RE, READONLY_RE, STRATEGY_RANK, strategySurface, } from './signals.js';
|
|
2
|
+
/** Human-readable twins of the rationaleCodes (safe to log verbatim). */
|
|
3
|
+
const RATIONALE_TEXT = {
|
|
4
|
+
fail_closed_empty: 'empty task',
|
|
5
|
+
design_conflict_signal: 'design + ambiguity conflict',
|
|
6
|
+
contract_high_risk: 'high-risk contract',
|
|
7
|
+
cross_cutting_scope: 'cross-cutting scope',
|
|
8
|
+
multi_artifact_count: 'multi-artifact count',
|
|
9
|
+
multi_path_scope: 'multi-path contract scope',
|
|
10
|
+
ambiguous_task: 'ambiguous task',
|
|
11
|
+
question_shaped_task: 'question-shaped task',
|
|
12
|
+
explanation_request: 'explanation request',
|
|
13
|
+
read_only_request: 'read-only request',
|
|
14
|
+
small_task_no_heavy_signals: 'small task, no heavy signals',
|
|
15
|
+
fail_closed_default: 'fail-closed default',
|
|
16
|
+
repeated_verification_failures: 'repeated verification failures',
|
|
17
|
+
prior_failure_verification_bump: 'prior failure verification bump',
|
|
18
|
+
};
|
|
19
|
+
/** Per-rule confidence constants (heuristics — documented, stable, pure). */
|
|
20
|
+
const RATIONALE_CONFIDENCE = {
|
|
21
|
+
fail_closed_empty: 0.35,
|
|
22
|
+
design_conflict_signal: 0.8,
|
|
23
|
+
contract_high_risk: 0.85,
|
|
24
|
+
cross_cutting_scope: 0.75,
|
|
25
|
+
multi_artifact_count: 0.7,
|
|
26
|
+
multi_path_scope: 0.7,
|
|
27
|
+
implementation_signal: 0.72,
|
|
28
|
+
refactor_signal: 0.72,
|
|
29
|
+
migration_signal: 0.75,
|
|
30
|
+
new_capability_signal: 0.7,
|
|
31
|
+
test_writing_signal: 0.7,
|
|
32
|
+
ambiguous_task: 0.55,
|
|
33
|
+
read_only_request: 0.65,
|
|
34
|
+
question_shaped_task: 0.6,
|
|
35
|
+
explanation_request: 0.6,
|
|
36
|
+
small_task_no_heavy_signals: 0.62,
|
|
37
|
+
fail_closed_default: 0.3,
|
|
38
|
+
repeated_verification_failures: 0.78,
|
|
39
|
+
prior_failure_verification_bump: 0.66,
|
|
40
|
+
};
|
|
1
41
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Deterministic and side-effect-free: no clock, no randomness, no I/O, no
|
|
6
|
-
* environment reads — callers pass their flags/overrides in via `opts`.
|
|
7
|
-
*
|
|
8
|
-
* Tiers (first match wins):
|
|
9
|
-
* 1. heavy intent -> 'kraken' implement/refactor/migrate, new capabilities,
|
|
10
|
-
* test-writing, counted artifacts, cross-cutting
|
|
11
|
-
* 2. light intent -> 'solo' questions ("...?"), explain/describe,
|
|
12
|
-
* read-only requests (find/show/list/grep)
|
|
13
|
-
* 3. size -> 'solo' short prompt without heavy intent
|
|
14
|
-
* 4. default -> 'solo' fail-closed: unsure means "current behavior"
|
|
15
|
-
*
|
|
16
|
-
* Only surfaces that actually exist in runHeadless dispatch are produced
|
|
17
|
-
* ('kraken' today rides the single-harness super-agent path; 'solo' is the
|
|
18
|
-
* ordinary lightweight turn). No invented values here — council/zelari
|
|
19
|
-
* remain explicit opt-ins, never auto-selected.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* Prompts at or under this length with no heavy intent are treated as small.
|
|
23
|
-
* Conservative on purpose: longer neutral prompts fall through to the same
|
|
24
|
-
* 'solo' default, just with the fail-closed reason.
|
|
42
|
+
* Prompts at or under this length with no signal matched are treated as
|
|
43
|
+
* small (v1 constant kept for compat). Larger neutral prompts still fall
|
|
44
|
+
* through to the fail-closed default — never escalate on size alone.
|
|
25
45
|
*/
|
|
26
46
|
export const DEFAULT_MAX_SOLO_CHARS = 300;
|
|
27
|
-
/**
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
re: /\b(?:unit|integration|e2e|end-to-end)\s+(?:tests?|testing|specs?)\b|\bwrite\s+(?:the\s+|some\s+)?tests?\b/i,
|
|
38
|
-
reason: 'test-writing signal',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
re: /\b\d+\s*-?\s*(?:files?|modules?|packages?|components?|services?|endpoints?|worktrees?)\b/i,
|
|
42
|
-
reason: 'multi-artifact count',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
re: /\b(?:across|spanning|between|touching)\s+(?:all\s+|the\s+)?(?:\w+\s+){0,2}(?:files|modules|packages|layers|surfaces)\b/i,
|
|
46
|
-
reason: 'cross-cutting scope',
|
|
47
|
-
},
|
|
48
|
-
];
|
|
49
|
-
/** Question-shaped prompt: trailing '?' or a leading interrogative/modal. */
|
|
50
|
-
const QUESTION_RE = /\?\s*$|^(?:who|what|why|when|where|which|how|is|are|was|were|does|do|did|can|could|should|would|will)\b/i;
|
|
51
|
-
const EXPLAIN_RE = /\b(?:explain|describe|summarize|summarise|clarify|walk\W*me\W*through)\b/i;
|
|
52
|
-
const READONLY_RE = /\b(?:find|show|list|grep|search|locate|inspect|read|check|review|where\W+is)\b/i;
|
|
47
|
+
/** Contract-scope path count that implies several disjoint slices. */
|
|
48
|
+
export const PARALLEL_SCOPE_PATHS = 3;
|
|
49
|
+
const HEAVY_CODES = new Set([
|
|
50
|
+
'implementation_signal',
|
|
51
|
+
'refactor_signal',
|
|
52
|
+
'migration_signal',
|
|
53
|
+
'new_capability_signal',
|
|
54
|
+
'test_writing_signal',
|
|
55
|
+
]);
|
|
53
56
|
/**
|
|
54
|
-
* Classify a task
|
|
55
|
-
*
|
|
56
|
-
* Pure function: identical inputs always yield identical verdicts.
|
|
57
|
-
* Fail-closed — when nothing matches, the answer is the CLI's historical
|
|
58
|
-
* behavior ('solo'), never a speculative escalation.
|
|
57
|
+
* Classify a task into a full v2 OrchestrationDecision. Pure function:
|
|
58
|
+
* identical inputs always yield identical outputs (property-tested).
|
|
59
59
|
*/
|
|
60
60
|
export function chooseOrchestration(task, opts = {}) {
|
|
61
61
|
const text = String(task ?? '').trim();
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
let hit = !text
|
|
63
|
+
? hitOf('lead-only', 'fail_closed_empty')
|
|
64
|
+
: baseRule(text, opts);
|
|
65
|
+
// Failure post-adjustment — escalation only (never lowers, never touches a
|
|
66
|
+
// council decision: councils are not verification tools).
|
|
67
|
+
if (hit.strategy !== 'council' && (opts.previousFailures ?? 0) > 0) {
|
|
68
|
+
if ((opts.previousFailures ?? 0) >= 2 && STRATEGY_RANK[hit.strategy] < STRATEGY_RANK.graph) {
|
|
69
|
+
hit = hitOf('graph', 'repeated_verification_failures');
|
|
70
|
+
}
|
|
71
|
+
else if ((opts.previousFailures ?? 0) >= 1 &&
|
|
72
|
+
STRATEGY_RANK[hit.strategy] < STRATEGY_RANK['lead+verify']) {
|
|
73
|
+
hit = hitOf('lead+verify', 'prior_failure_verification_bump');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
...hit,
|
|
78
|
+
reason: RATIONALE_TEXT[hit.rationaleCode] ?? hit.rationaleCode,
|
|
79
|
+
surface: strategySurface(hit.strategy),
|
|
80
|
+
estimatedLatencyMs: ESTIMATED_LATENCY_MS[hit.strategy],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function hitOf(strategy, code) {
|
|
84
|
+
return {
|
|
85
|
+
strategy,
|
|
86
|
+
confidence: RATIONALE_CONFIDENCE[code],
|
|
87
|
+
rationaleCode: code,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** Rules 1–12 of the DECISION TABLE above, in documented order. */
|
|
91
|
+
function baseRule(text, o) {
|
|
92
|
+
const risk = o.risk;
|
|
93
|
+
const highRisk = risk === 'high' || risk === 'critical';
|
|
94
|
+
// 1 — the ONLY council trigger: design wording + explicit ambiguity marker.
|
|
95
|
+
if (DESIGN_RE.test(text) && AMBIGUOUS_RE.test(text)) {
|
|
96
|
+
return hitOf('council', 'design_conflict_signal');
|
|
72
97
|
}
|
|
73
|
-
//
|
|
98
|
+
// 2–3 — graph-level care: declared high risk or cross-cutting phrases.
|
|
99
|
+
if (highRisk)
|
|
100
|
+
return hitOf('graph', 'contract_high_risk');
|
|
101
|
+
if (CROSS_CUTTING_RE.test(text))
|
|
102
|
+
return hitOf('graph', 'cross_cutting_scope');
|
|
103
|
+
// 4–5 — parallelism potential: counted artifacts or a multi-path scope.
|
|
104
|
+
if (MULTI_ARTIFACT_RE.test(text))
|
|
105
|
+
return hitOf('parallel-build', 'multi_artifact_count');
|
|
106
|
+
if ((o.scopePathsCount ?? 0) >= PARALLEL_SCOPE_PATHS) {
|
|
107
|
+
return hitOf('parallel-build', 'multi_path_scope');
|
|
108
|
+
}
|
|
109
|
+
// 6 — ordinary build work ⇒ implement then verify.
|
|
110
|
+
for (const { re, code } of HEAVY_SIGNALS) {
|
|
111
|
+
if (re.test(text) && HEAVY_CODES.has(code))
|
|
112
|
+
return hitOf('lead+verify', code);
|
|
113
|
+
}
|
|
114
|
+
// 7–11 — light tiers, most-specific first.
|
|
115
|
+
if (AMBIGUOUS_RE.test(text))
|
|
116
|
+
return hitOf('explore', 'ambiguous_task');
|
|
117
|
+
if (READONLY_RE.test(text))
|
|
118
|
+
return hitOf('explore', 'read_only_request');
|
|
74
119
|
if (QUESTION_RE.test(text))
|
|
75
|
-
return
|
|
120
|
+
return hitOf('lead-only', 'question_shaped_task');
|
|
76
121
|
if (EXPLAIN_RE.test(text))
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
//
|
|
81
|
-
const
|
|
82
|
-
if (text.length <= budget
|
|
83
|
-
|
|
122
|
+
return hitOf('lead-only', 'explanation_request');
|
|
123
|
+
const budget = o.maxSoloChars ?? DEFAULT_MAX_SOLO_CHARS;
|
|
124
|
+
// Tuning knob mirrors facts.collectOrchestrationFacts' bounded walk; kept
|
|
125
|
+
// local so this module stays a pure leaf (facts must not be imported here).
|
|
126
|
+
const largeRepo = (o.repoSize ?? 0) > 800;
|
|
127
|
+
if (text.length <= budget &&
|
|
128
|
+
(o.scopePathsCount ?? 0) <= 1 &&
|
|
129
|
+
(o.previousFailures ?? 0) === 0 &&
|
|
130
|
+
!highRisk &&
|
|
131
|
+
!largeRepo) {
|
|
132
|
+
return hitOf('lead-only', 'small_task_no_heavy_signals');
|
|
84
133
|
}
|
|
85
|
-
//
|
|
86
|
-
return
|
|
134
|
+
// 12 — long neutral prompts stay on the historical default (fail-closed).
|
|
135
|
+
return hitOf('lead-only', 'fail_closed_default');
|
|
136
|
+
}
|
|
137
|
+
/** Shared reason resolution for hosts/logs/tests. */
|
|
138
|
+
export function orchestrationReason(decision) {
|
|
139
|
+
return RATIONALE_TEXT[decision.rationaleCode] ?? decision.rationaleCode;
|
|
87
140
|
}
|
|
88
141
|
//# sourceMappingURL=policy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../../src/cli/orchestration/policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../../src/cli/orchestration/policy.ts"],"names":[],"mappings":"AA0CA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,aAAa,EACb,eAAe,GAGhB,MAAM,cAAc,CAAC;AAItB,yEAAyE;AACzE,MAAM,cAAc,GAAqC;IACvD,iBAAiB,EAAE,YAAY;IAC/B,sBAAsB,EAAE,6BAA6B;IACrD,kBAAkB,EAAE,oBAAoB;IACxC,mBAAmB,EAAE,qBAAqB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,gBAAgB,EAA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BAAmB,CAAC,CAAC;IACzE,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;IAC9E,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,CAAC,CAAC,YAAY,IAAI,sBAAsB,CAAC;IACxD,0EAA0E;IAC1E,4EAA4E;IAC5E,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;IAC1C,IACE,IAAI,CAAC,MAAM,IAAI,MAAM;QACrB,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,IAAI,CAAC;QAC7B,CAAC,CAAC,CAAC,gBAAgB,IAAI,CAAC,CAAC,KAAK,CAAC;QAC/B,CAAC,QAAQ;QACT,CAAC,SAAS,EACV,CAAC;QACD,OAAO,KAAK,CAAC,WAAW,EAAE,6BAA6B,CAAC,CAAC;IAC3D,CAAC;IACD,0EAA0E;IAC1E,OAAO,KAAK,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC;AACnD,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,mBAAmB,CAAC,QAAsD;IACxF,OAAO,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,QAAQ,CAAC,aAAa,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* orchestration/signals — t23 (§P1.E × PW §9): shared vocabulary + signal
|
|
3
|
+
* tables for the deterministic OrchestrationDecision v2.
|
|
4
|
+
*
|
|
5
|
+
* LEAF MODULE on purpose: it imports nothing (not even other cli files) so
|
|
6
|
+
* both orchestration/policy.ts and kraken/delegationPolicy.ts can consume the
|
|
7
|
+
* strategy union without creating an import cycle. Pure data + pure fns only.
|
|
8
|
+
*
|
|
9
|
+
* Strategy ladder (escalation order — see policy.ts decision table):
|
|
10
|
+
* lead-only one focused dev, no tentacles.
|
|
11
|
+
* explore read/search-oriented work, still single harness.
|
|
12
|
+
* lead+verify implement + mandatory verify pass.
|
|
13
|
+
* parallel-build multiple disjoint slices → tentacles preferred.
|
|
14
|
+
* graph high risk / cross-cutting → plan-graph level care.
|
|
15
|
+
* council ONLY with the design-conflict trigger (never invented).
|
|
16
|
+
*/
|
|
17
|
+
/** Fine-grained v2 strategies (supersedes the v1 two-value surface only —
|
|
18
|
+
* `surface` remains for operator logs and back-compat). */
|
|
19
|
+
export const ORCHESTRATION_STRATEGIES = [
|
|
20
|
+
'lead-only',
|
|
21
|
+
'explore',
|
|
22
|
+
'lead+verify',
|
|
23
|
+
'parallel-build',
|
|
24
|
+
'graph',
|
|
25
|
+
'council',
|
|
26
|
+
];
|
|
27
|
+
/** Monotonic complexity rank: a failure/risk bump may raise but never lower. */
|
|
28
|
+
export const STRATEGY_RANK = {
|
|
29
|
+
'lead-only': 0,
|
|
30
|
+
explore: 1,
|
|
31
|
+
'lead+verify': 2,
|
|
32
|
+
'parallel-build': 3,
|
|
33
|
+
graph: 4,
|
|
34
|
+
council: 5,
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* estimatedLatency heuristic (UNIT: milliseconds, ORDER-OF-MAGNITUDE ONLY —
|
|
38
|
+
* NOT a prediction): rough cost of a typical single-turn run per strategy,
|
|
39
|
+
* measured-in-the-head at authoring time and kept monotonic with
|
|
40
|
+
* STRATEGY_RANK. Used by telemetry dashboards and tests to compare relative
|
|
41
|
+
* orchestration weight, never to promise wall-clock behavior.
|
|
42
|
+
*/
|
|
43
|
+
export const ESTIMATED_LATENCY_MS = {
|
|
44
|
+
'lead-only': 15_000,
|
|
45
|
+
explore: 45_000,
|
|
46
|
+
'lead+verify': 120_000,
|
|
47
|
+
'parallel-build': 360_000,
|
|
48
|
+
graph: 720_000,
|
|
49
|
+
council: 900_000,
|
|
50
|
+
};
|
|
51
|
+
/** strategy → headless dispatch surface (mode-selection input). */
|
|
52
|
+
export function strategySurface(strategy) {
|
|
53
|
+
if (strategy === 'council')
|
|
54
|
+
return 'council';
|
|
55
|
+
if (STRATEGY_RANK[strategy] >= STRATEGY_RANK['lead+verify'])
|
|
56
|
+
return 'kraken';
|
|
57
|
+
return 'solo';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Heavy-intent signals (t12 table carried over verbatim, now tagged with a
|
|
61
|
+
* stable rationaleCode). Evaluated FIRST: heavy intent outranks any light
|
|
62
|
+
* signal below.
|
|
63
|
+
*/
|
|
64
|
+
export const HEAVY_SIGNALS = [
|
|
65
|
+
{ re: /\bimplement(?:s|ed|ing)?\b/i, code: 'implementation_signal' },
|
|
66
|
+
{ re: /\brefactor(?:ing|ed)?\b/i, code: 'refactor_signal' },
|
|
67
|
+
{ re: /\bmigrat(?:e|es|ed|ion|ing)\b/i, code: 'migration_signal' },
|
|
68
|
+
{
|
|
69
|
+
re: /\b(?:add|build|create|introduce)\b[^.?!]{0,48}\b(?:feature|endpoint|module|service|command|api|registry|runtime)\b/i,
|
|
70
|
+
code: 'new_capability_signal',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
re: /\b(?:unit|integration|e2e|end-to-end)\s+(?:tests?|testing|specs?)\b|\bwrite\s+(?:the\s+|some\s+)?tests?\b/i,
|
|
74
|
+
code: 'test_writing_signal',
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
/**
|
|
78
|
+
* Counted artifacts ("Split the helpers into 4 files") — evidence of several
|
|
79
|
+
* DISJOINT targets, i.e. parallelism potential (rank ≥ parallel-build).
|
|
80
|
+
*/
|
|
81
|
+
export const MULTI_ARTIFACT_RE = /\b\d+\s*-?\s*(?:files?|modules?|packages?|components?|services?|endpoints?|worktrees?)\b/i;
|
|
82
|
+
/** Cross-cutting scope phrases → graph-level care regardless of verb. */
|
|
83
|
+
export const CROSS_CUTTING_RE = /\b(?:across|spanning|between|touching)\s+(?:all\s+|the\s+)?(?:\w+\s+){0,2}(?:files|modules|packages|layers|surfaces)\b/i;
|
|
84
|
+
/** Question-shaped prompt: trailing '?' or a leading interrogative/modal. */
|
|
85
|
+
export const QUESTION_RE = /\?\s*$|^(?:who|what|why|when|where|which|how|is|are|was|were|does|do|did|can|could|should|would|will)\b/i;
|
|
86
|
+
export const EXPLAIN_RE = /\b(?:explain|describe|summarize|summarise|clarify|walk\W*me\W*through)\b/i;
|
|
87
|
+
export const READONLY_RE = /\b(?:find|show|list|grep|search|locate|inspect|read|check|review|where\W+is)\b/i;
|
|
88
|
+
/** Ambiguity markers: task asks for judgment on unclear/conflicting ground. */
|
|
89
|
+
export const AMBIGUOUS_RE = /\b(?:ambiguous|ambiguity|unclear|vague|contradict(?:ory|ions?)?|conflicts?\b|trade[- ]?offs?\b|not\s+sure|unsure)\b/i;
|
|
90
|
+
/**
|
|
91
|
+
* Design-intent nouns for the (ONLY) council trigger: "plan/design/architect"
|
|
92
|
+
* wording CO-OCCURRING with ambiguity markers above ⇒ multi-member review.
|
|
93
|
+
* Both halves required — neither alone ever selects council.
|
|
94
|
+
*/
|
|
95
|
+
export const DESIGN_RE = /\b(?:design|architecture|architect(?:ure)?\b|approach|proposal|blueprint)/i;
|
|
96
|
+
//# sourceMappingURL=signals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signals.js","sourceRoot":"","sources":["../../../src/cli/orchestration/signals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;2DAC2D;AAC3D,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,WAAW;IACX,SAAS;IACT,aAAa;IACb,gBAAgB;IAChB,OAAO;IACP,SAAS;CACD,CAAC;AAOX,gFAAgF;AAChF,MAAM,CAAC,MAAM,aAAa,GAAoD;IAC5E,WAAW,EAAE,CAAC;IACd,OAAO,EAAE,CAAC;IACV,aAAa,EAAE,CAAC;IAChB,gBAAgB,EA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