@telora/daemon 0.15.23 → 0.15.24
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/build-info.json +2 -2
- package/dist/ai-inspection-context.d.ts +56 -0
- package/dist/ai-inspection-context.d.ts.map +1 -0
- package/dist/ai-inspection-context.js +110 -0
- package/dist/ai-inspection-context.js.map +1 -0
- package/dist/ai-inspection-runner.d.ts +72 -0
- package/dist/ai-inspection-runner.d.ts.map +1 -0
- package/dist/ai-inspection-runner.js +247 -0
- package/dist/ai-inspection-runner.js.map +1 -0
- package/dist/assembly-resolvers.d.ts +49 -1
- package/dist/assembly-resolvers.d.ts.map +1 -1
- package/dist/assembly-resolvers.js +125 -2
- package/dist/assembly-resolvers.js.map +1 -1
- package/dist/focus-engine.d.ts +17 -0
- package/dist/focus-engine.d.ts.map +1 -1
- package/dist/focus-engine.js +37 -14
- package/dist/focus-engine.js.map +1 -1
- package/dist/focus-loop.d.ts +2 -0
- package/dist/focus-loop.d.ts.map +1 -1
- package/dist/focus-loop.js +63 -8
- package/dist/focus-loop.js.map +1 -1
- package/dist/heartbeat.d.ts +1 -6
- package/dist/heartbeat.d.ts.map +1 -1
- package/dist/heartbeat.js +3 -27
- package/dist/heartbeat.js.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/queries/control-state.d.ts +5 -5
- package/dist/queries/control-state.d.ts.map +1 -1
- package/dist/queries/control-state.js +4 -7
- package/dist/queries/control-state.js.map +1 -1
- package/dist/queries/reality-tree.d.ts +39 -0
- package/dist/queries/reality-tree.d.ts.map +1 -0
- package/dist/queries/reality-tree.js +84 -0
- package/dist/queries/reality-tree.js.map +1 -0
- package/dist/realign-apply.d.ts +59 -0
- package/dist/realign-apply.d.ts.map +1 -0
- package/dist/realign-apply.js +207 -0
- package/dist/realign-apply.js.map +1 -0
- package/dist/self-update.d.ts +1 -1
- package/dist/self-update.js +2 -2
- package/dist/self-update.js.map +1 -1
- package/dist/unified-engine-lifecycle.d.ts.map +1 -1
- package/dist/unified-engine-lifecycle.js +4 -27
- package/dist/unified-engine-lifecycle.js.map +1 -1
- package/dist/unified-shell-config.d.ts +1 -7
- package/dist/unified-shell-config.d.ts.map +1 -1
- package/dist/unified-shell-config.js +0 -43
- package/dist/unified-shell-config.js.map +1 -1
- package/dist/unified-shell-status.d.ts.map +1 -1
- package/dist/unified-shell-status.js +2 -6
- package/dist/unified-shell-status.js.map +1 -1
- package/dist/unified-shell.d.ts.map +1 -1
- package/dist/unified-shell.js +2 -5
- package/dist/unified-shell.js.map +1 -1
- package/dist/verification-engine.d.ts +51 -3
- package/dist/verification-engine.d.ts.map +1 -1
- package/dist/verification-engine.js +108 -19
- package/dist/verification-engine.js.map +1 -1
- package/package.json +1 -2
package/build-info.json
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the input bundle for the ai_inspection runner.
|
|
3
|
+
*
|
|
4
|
+
* The runner is a tool-augmented Claude SDK invocation that judges whether
|
|
5
|
+
* an injection's FRT statement holds in the delivery's worktree. It needs:
|
|
6
|
+
*
|
|
7
|
+
* 1. The injection's frt_statement (and original CRT statement if different)
|
|
8
|
+
* 2. The full focus reality tree (CRT dump) so it can reason about which
|
|
9
|
+
* statements are at stake without re-querying
|
|
10
|
+
* 3. The delivery diff against the integration branch
|
|
11
|
+
*
|
|
12
|
+
* `resolveAiInspectionInputs` fetches all three and packages them so the
|
|
13
|
+
* runner-spawn task (next in line) stays small.
|
|
14
|
+
*
|
|
15
|
+
* @module ai-inspection-context
|
|
16
|
+
*/
|
|
17
|
+
import { callApi } from './queries/shared.js';
|
|
18
|
+
import type { PendingVerification } from './queries/verification.js';
|
|
19
|
+
export interface InjectionStatementInfo {
|
|
20
|
+
/** Original CRT statement of the injection node. */
|
|
21
|
+
crtStatement: string;
|
|
22
|
+
/** FRT-overlay statement (the post-injection state we are verifying). */
|
|
23
|
+
frtStatement: string;
|
|
24
|
+
/** What obstacle this injection is meant to dissolve, if captured. */
|
|
25
|
+
dissolvesObstacle: string | null;
|
|
26
|
+
/** Lifecycle status (proposed | in_progress | realized | verified). */
|
|
27
|
+
injectionStatus: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface AiInspectionInputs {
|
|
30
|
+
/** The injection-statement bundle the runner is verifying. */
|
|
31
|
+
injection: InjectionStatementInfo;
|
|
32
|
+
/** Markdown CRT dump for the focus's reality tree(s). */
|
|
33
|
+
crtDumpMarkdown: string;
|
|
34
|
+
/** Raw git diff against the integration branch (worktree-aware). */
|
|
35
|
+
deliveryDiff: string;
|
|
36
|
+
/** Worktree CWD for spawning Read/Grep — null if unresolved. */
|
|
37
|
+
worktreePath: string | null;
|
|
38
|
+
}
|
|
39
|
+
export interface AiInspectionContextDeps {
|
|
40
|
+
callApi: typeof callApi;
|
|
41
|
+
/** Resolve the focus worktree path from a productId. */
|
|
42
|
+
resolveCwd: (productId: string | null) => string;
|
|
43
|
+
/** Integration branch to diff against. */
|
|
44
|
+
integrationBranch: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Build the full ai_inspection runner input bundle from a PendingVerification.
|
|
48
|
+
*
|
|
49
|
+
* Returns null when the injection node cannot be resolved — the runner
|
|
50
|
+
* should not spawn in that case (no target statement to verify against).
|
|
51
|
+
*
|
|
52
|
+
* Failures fetching the CRT dump or the diff are non-fatal: the runner
|
|
53
|
+
* will see empty strings for those slots.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveAiInspectionInputs(v: PendingVerification, deps: AiInspectionContextDeps): Promise<AiInspectionInputs | null>;
|
|
56
|
+
//# sourceMappingURL=ai-inspection-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-inspection-context.d.ts","sourceRoot":"","sources":["../src/ai-inspection-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAarE,MAAM,WAAW,sBAAsB;IACrC,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,uEAAuE;IACvE,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB;IACjC,8DAA8D;IAC9D,SAAS,EAAE,sBAAsB,CAAC;IAClC,yDAAyD;IACzD,eAAe,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,YAAY,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,wDAAwD;IACxD,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC;IACjD,0CAA0C;IAC1C,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAyED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,CAAC,EAAE,mBAAmB,EACtB,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAgCpC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the input bundle for the ai_inspection runner.
|
|
3
|
+
*
|
|
4
|
+
* The runner is a tool-augmented Claude SDK invocation that judges whether
|
|
5
|
+
* an injection's FRT statement holds in the delivery's worktree. It needs:
|
|
6
|
+
*
|
|
7
|
+
* 1. The injection's frt_statement (and original CRT statement if different)
|
|
8
|
+
* 2. The full focus reality tree (CRT dump) so it can reason about which
|
|
9
|
+
* statements are at stake without re-querying
|
|
10
|
+
* 3. The delivery diff against the integration branch
|
|
11
|
+
*
|
|
12
|
+
* `resolveAiInspectionInputs` fetches all three and packages them so the
|
|
13
|
+
* runner-spawn task (next in line) stays small.
|
|
14
|
+
*
|
|
15
|
+
* @module ai-inspection-context
|
|
16
|
+
*/
|
|
17
|
+
import { CRT_DUMP_BUDGET_CHARS, getGitDiff, renderRealityTreeDump, } from './assembly-resolvers.js';
|
|
18
|
+
/**
|
|
19
|
+
* Fetch the injection node directly. Returns frtStatement (falling back to
|
|
20
|
+
* the CRT statement when no overlay is set so the runner always has a
|
|
21
|
+
* "what should be true" target).
|
|
22
|
+
*/
|
|
23
|
+
async function fetchInjectionStatement(deps, injectionNodeId) {
|
|
24
|
+
const resp = await deps.callApi('reality_tree_injection_context', { nodeIds: [injectionNodeId] });
|
|
25
|
+
const item = resp.items?.[0];
|
|
26
|
+
if (!item)
|
|
27
|
+
return null;
|
|
28
|
+
const node = item.injection;
|
|
29
|
+
return {
|
|
30
|
+
crtStatement: node.statement,
|
|
31
|
+
frtStatement: node.frtStatement ?? node.statement,
|
|
32
|
+
dissolvesObstacle: node.dissolvesObstacle,
|
|
33
|
+
injectionStatus: node.injectionStatus,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Render the focus reality tree(s) as a single markdown CRT dump. Reuses
|
|
38
|
+
* the same renderer as the focus.reality_tree assembly resolver so the
|
|
39
|
+
* format the runner sees matches what other agents see.
|
|
40
|
+
*/
|
|
41
|
+
async function fetchCrtDumpMarkdown(deps, focusId) {
|
|
42
|
+
const treesResp = await deps.callApi('reality_tree_list', {
|
|
43
|
+
focusId,
|
|
44
|
+
});
|
|
45
|
+
const trees = (treesResp.items ?? []).filter((t) => t.status === 'active');
|
|
46
|
+
if (trees.length === 0)
|
|
47
|
+
return '';
|
|
48
|
+
const sections = [];
|
|
49
|
+
let used = 0;
|
|
50
|
+
for (const tree of trees) {
|
|
51
|
+
if (used >= CRT_DUMP_BUDGET_CHARS)
|
|
52
|
+
break;
|
|
53
|
+
const remaining = CRT_DUMP_BUDGET_CHARS - used;
|
|
54
|
+
const [nodesResp, edgesResp] = await Promise.all([
|
|
55
|
+
deps.callApi('reality_tree_node_list', {
|
|
56
|
+
treeId: tree.id,
|
|
57
|
+
status: 'active',
|
|
58
|
+
}),
|
|
59
|
+
deps.callApi('reality_tree_edge_list', { treeId: tree.id }),
|
|
60
|
+
]);
|
|
61
|
+
const nodes = nodesResp.items ?? [];
|
|
62
|
+
const edges = edgesResp.items ?? [];
|
|
63
|
+
const dump = renderRealityTreeDump(tree, nodes, edges, remaining);
|
|
64
|
+
if (!dump)
|
|
65
|
+
continue;
|
|
66
|
+
sections.push(dump);
|
|
67
|
+
used += dump.length;
|
|
68
|
+
}
|
|
69
|
+
if (sections.length === 0)
|
|
70
|
+
return '';
|
|
71
|
+
return sections.join('\n\n');
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Build the full ai_inspection runner input bundle from a PendingVerification.
|
|
75
|
+
*
|
|
76
|
+
* Returns null when the injection node cannot be resolved — the runner
|
|
77
|
+
* should not spawn in that case (no target statement to verify against).
|
|
78
|
+
*
|
|
79
|
+
* Failures fetching the CRT dump or the diff are non-fatal: the runner
|
|
80
|
+
* will see empty strings for those slots.
|
|
81
|
+
*/
|
|
82
|
+
export async function resolveAiInspectionInputs(v, deps) {
|
|
83
|
+
const injection = await fetchInjectionStatement(deps, v.injectionNodeId);
|
|
84
|
+
if (!injection)
|
|
85
|
+
return null;
|
|
86
|
+
const worktreePath = deps.resolveCwd(v.productId);
|
|
87
|
+
let crtDumpMarkdown = '';
|
|
88
|
+
if (v.focusId) {
|
|
89
|
+
try {
|
|
90
|
+
crtDumpMarkdown = await fetchCrtDumpMarkdown(deps, v.focusId);
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
console.warn(`[ai-inspection-context] CRT dump fetch failed for focus ${v.focusId}: ${err.message}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
let deliveryDiff = '';
|
|
97
|
+
try {
|
|
98
|
+
deliveryDiff = getGitDiff(worktreePath, deps.integrationBranch);
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
console.warn(`[ai-inspection-context] git diff failed for ${worktreePath}: ${err.message}`);
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
injection,
|
|
105
|
+
crtDumpMarkdown,
|
|
106
|
+
deliveryDiff,
|
|
107
|
+
worktreePath,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=ai-inspection-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-inspection-context.js","sourceRoot":"","sources":["../src/ai-inspection-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,qBAAqB,GAOtB,MAAM,yBAAyB,CAAC;AAgCjC;;;;GAIG;AACH,KAAK,UAAU,uBAAuB,CACpC,IAA6B,EAC7B,eAAuB;IAEvB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAW5B,gCAAgC,EAAE,EAAE,OAAO,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAErE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7B,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;IAC5B,OAAO;QACL,YAAY,EAAE,IAAI,CAAC,SAAS;QAC5B,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,SAAS;QACjD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,eAAe,EAAE,IAAI,CAAC,eAAe;KACtC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,oBAAoB,CACjC,IAA6B,EAC7B,OAAe;IAEf,MAAM,SAAS,GAAG,MAAM,IAAI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CAAC;IACrC,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,CAAsB,EACtB,IAA6B;IAE7B,MAAM,SAAS,GAAG,MAAM,uBAAuB,CAAC,IAAI,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC;IACzE,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAE5B,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAElD,IAAI,eAAe,GAAG,EAAE,CAAC;IACzB,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;QACd,IAAI,CAAC;YACH,eAAe,GAAG,MAAM,oBAAoB,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;QAChE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CACV,2DAA2D,CAAC,CAAC,OAAO,KAAM,GAAa,CAAC,OAAO,EAAE,CAClG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,YAAY,GAAG,EAAE,CAAC;IACtB,IAAI,CAAC;QACH,YAAY,GAAG,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CACV,+CAA+C,YAAY,KAAM,GAAa,CAAC,OAAO,EAAE,CACzF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,SAAS;QACT,eAAe;QACf,YAAY;QACZ,YAAY;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool-augmented Claude runner for ai_inspection verification.
|
|
3
|
+
*
|
|
4
|
+
* Spawns the `claude` CLI in print mode with Read/Grep tools restricted
|
|
5
|
+
* to the focus's worktree. The runner is given the injection's FRT
|
|
6
|
+
* statement and the focus CRT dump as a system prompt, plus the delivery
|
|
7
|
+
* diff in the user message. It returns a JSON verdict block:
|
|
8
|
+
*
|
|
9
|
+
* {
|
|
10
|
+
* "verdict": "passed" | "failed" | "inconclusive",
|
|
11
|
+
* "rationale": "...",
|
|
12
|
+
* "drift_observations": [
|
|
13
|
+
* { "node_id": "...", "kind": "update_statement" | ...,
|
|
14
|
+
* "observed": "...", "suggested_correction": "..." }
|
|
15
|
+
* ]
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* Failures (spawn error, malformed JSON, claude binary missing) are
|
|
19
|
+
* mapped to verdict='inconclusive' so the verification engine records
|
|
20
|
+
* 'pending' and the loop tries again.
|
|
21
|
+
*
|
|
22
|
+
* @module ai-inspection-runner
|
|
23
|
+
*/
|
|
24
|
+
import { type ChildProcess } from 'node:child_process';
|
|
25
|
+
import type { AiInspectionInputs } from './ai-inspection-context.js';
|
|
26
|
+
export type InspectionVerdict = 'passed' | 'failed' | 'inconclusive';
|
|
27
|
+
export type DriftProposalKind = 'update_statement' | 'add_node' | 'retire_node' | 'change_node_type' | 'flip_ude_to_de';
|
|
28
|
+
export interface DriftObservation {
|
|
29
|
+
/** Node id the drift attaches to. May be null for add_node proposals. */
|
|
30
|
+
nodeId: string | null;
|
|
31
|
+
kind: DriftProposalKind;
|
|
32
|
+
observed: string;
|
|
33
|
+
suggestedCorrection: string;
|
|
34
|
+
}
|
|
35
|
+
export interface InspectionResult {
|
|
36
|
+
verdict: InspectionVerdict;
|
|
37
|
+
rationale: string;
|
|
38
|
+
driftObservations: DriftObservation[];
|
|
39
|
+
}
|
|
40
|
+
export interface RunnerOptions {
|
|
41
|
+
/** Path to the `claude` CLI binary (default: 'claude'). */
|
|
42
|
+
claudeBin?: string;
|
|
43
|
+
/** Timeout in ms; defaults to 5 minutes. */
|
|
44
|
+
timeoutMs?: number;
|
|
45
|
+
/** Override spawn for tests. Defaults to node:child_process spawn. */
|
|
46
|
+
spawnFn?: (cmd: string, args: string[], opts: SpawnOpts) => ChildProcess;
|
|
47
|
+
/** Override Date.now for deterministic-ish testing. */
|
|
48
|
+
now?: () => number;
|
|
49
|
+
}
|
|
50
|
+
interface SpawnOpts {
|
|
51
|
+
cwd: string;
|
|
52
|
+
stdio: ['pipe', 'pipe', 'pipe'];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Extract the first JSON object from a string. Tolerates code fences and
|
|
56
|
+
* leading/trailing prose.
|
|
57
|
+
*/
|
|
58
|
+
export declare function parseInspectionJson(raw: string): InspectionResult | null;
|
|
59
|
+
/**
|
|
60
|
+
* Build the argv for the claude CLI invocation. Exposed for tests.
|
|
61
|
+
*/
|
|
62
|
+
export declare function buildClaudeArgs(inputs: AiInspectionInputs, systemPrompt: string): string[];
|
|
63
|
+
/**
|
|
64
|
+
* Spawn the claude CLI runner and return the parsed verdict.
|
|
65
|
+
*
|
|
66
|
+
* Returns 'inconclusive' on any error (spawn failure, timeout, malformed
|
|
67
|
+
* output) so the verification engine records 'pending' and the loop will
|
|
68
|
+
* retry on the next tick.
|
|
69
|
+
*/
|
|
70
|
+
export declare function runAiInspection(inputs: AiInspectionInputs, opts?: RunnerOptions): Promise<InspectionResult>;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=ai-inspection-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-inspection-runner.d.ts","sourceRoot":"","sources":["../src/ai-inspection-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,cAAc,CAAC;AAErE,MAAM,MAAM,iBAAiB,GACzB,kBAAkB,GAClB,UAAU,GACV,aA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|
+
*
|
|
4
|
+
* Spawns the `claude` CLI in print mode with Read/Grep tools restricted
|
|
5
|
+
* to the focus's worktree. The runner is given the injection's FRT
|
|
6
|
+
* statement and the focus CRT dump as a system prompt, plus the delivery
|
|
7
|
+
* diff in the user message. It returns a JSON verdict block:
|
|
8
|
+
*
|
|
9
|
+
* {
|
|
10
|
+
* "verdict": "passed" | "failed" | "inconclusive",
|
|
11
|
+
* "rationale": "...",
|
|
12
|
+
* "drift_observations": [
|
|
13
|
+
* { "node_id": "...", "kind": "update_statement" | ...,
|
|
14
|
+
* "observed": "...", "suggested_correction": "..." }
|
|
15
|
+
* ]
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* Failures (spawn error, malformed JSON, claude binary missing) are
|
|
19
|
+
* mapped to verdict='inconclusive' so the verification engine records
|
|
20
|
+
* 'pending' and the loop tries again.
|
|
21
|
+
*
|
|
22
|
+
* @module ai-inspection-runner
|
|
23
|
+
*/
|
|
24
|
+
import { spawn } from 'node:child_process';
|
|
25
|
+
const DEFAULT_TIMEOUT_MS = 5 * 60 * 1000;
|
|
26
|
+
const SYSTEM_PROMPT_TEMPLATE = `You are a code-state verification agent for the Telora differential focus spec.
|
|
27
|
+
|
|
28
|
+
Your job: judge whether the FRT statement below holds in the code visible
|
|
29
|
+
in the current worktree. You may use Read and Grep tools to inspect the
|
|
30
|
+
code. Do NOT attempt to write or edit files.
|
|
31
|
+
|
|
32
|
+
Respond with a single JSON code block (and nothing else after it) of the form:
|
|
33
|
+
|
|
34
|
+
\`\`\`json
|
|
35
|
+
{
|
|
36
|
+
"verdict": "passed" | "failed" | "inconclusive",
|
|
37
|
+
"rationale": "1-3 sentence explanation grounded in specific files/lines",
|
|
38
|
+
"drift_observations": []
|
|
39
|
+
}
|
|
40
|
+
\`\`\`
|
|
41
|
+
|
|
42
|
+
A drift observation is a CRT statement that the code state contradicts.
|
|
43
|
+
Only emit one when you can name the contradicted statement node and
|
|
44
|
+
suggest a correction. Each observation is:
|
|
45
|
+
|
|
46
|
+
{ "node_id": "<uuid|null>",
|
|
47
|
+
"kind": "update_statement" | "add_node" | "retire_node" | "change_node_type" | "flip_ude_to_de",
|
|
48
|
+
"observed": "what the code shows",
|
|
49
|
+
"suggested_correction": "what the CRT statement should say (or what node should be added)" }
|
|
50
|
+
|
|
51
|
+
Use 'inconclusive' when the code does not give you enough signal to decide.
|
|
52
|
+
|
|
53
|
+
`;
|
|
54
|
+
function buildSystemPrompt(inputs) {
|
|
55
|
+
const dissolves = inputs.injection.dissolvesObstacle
|
|
56
|
+
? `\n## Dissolves Obstacle\n\n${inputs.injection.dissolvesObstacle}\n`
|
|
57
|
+
: '';
|
|
58
|
+
return [
|
|
59
|
+
SYSTEM_PROMPT_TEMPLATE,
|
|
60
|
+
`## FRT Statement to Verify\n\n${inputs.injection.frtStatement}\n`,
|
|
61
|
+
`## CRT Original Statement (pre-injection)\n\n${inputs.injection.crtStatement}\n`,
|
|
62
|
+
dissolves,
|
|
63
|
+
inputs.crtDumpMarkdown ? `${inputs.crtDumpMarkdown}\n` : '',
|
|
64
|
+
].filter(Boolean).join('\n');
|
|
65
|
+
}
|
|
66
|
+
function buildUserMessage(inputs) {
|
|
67
|
+
const diff = inputs.deliveryDiff
|
|
68
|
+
? `## Delivery Diff (against integration)\n\n\`\`\`diff\n${inputs.deliveryDiff}\n\`\`\`\n`
|
|
69
|
+
: '';
|
|
70
|
+
return [
|
|
71
|
+
'Please inspect the worktree and judge whether the FRT statement holds.',
|
|
72
|
+
diff,
|
|
73
|
+
'Use Read and Grep as needed. Respond with the JSON verdict block.',
|
|
74
|
+
].filter(Boolean).join('\n\n');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Extract the first JSON object from a string. Tolerates code fences and
|
|
78
|
+
* leading/trailing prose.
|
|
79
|
+
*/
|
|
80
|
+
export function parseInspectionJson(raw) {
|
|
81
|
+
const stripped = raw.replace(/```(?:json)?\s*/g, '').replace(/```/g, '');
|
|
82
|
+
// Find the first `{` and try increasing slice ends until JSON.parse succeeds.
|
|
83
|
+
const firstBrace = stripped.indexOf('{');
|
|
84
|
+
if (firstBrace < 0)
|
|
85
|
+
return null;
|
|
86
|
+
let depth = 0;
|
|
87
|
+
let endIdx = -1;
|
|
88
|
+
for (let i = firstBrace; i < stripped.length; i += 1) {
|
|
89
|
+
const ch = stripped[i];
|
|
90
|
+
if (ch === '{')
|
|
91
|
+
depth += 1;
|
|
92
|
+
else if (ch === '}') {
|
|
93
|
+
depth -= 1;
|
|
94
|
+
if (depth === 0) {
|
|
95
|
+
endIdx = i;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (endIdx < 0)
|
|
101
|
+
return null;
|
|
102
|
+
let parsed;
|
|
103
|
+
try {
|
|
104
|
+
parsed = JSON.parse(stripped.slice(firstBrace, endIdx + 1));
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
if (!parsed || typeof parsed !== 'object')
|
|
110
|
+
return null;
|
|
111
|
+
const obj = parsed;
|
|
112
|
+
const verdict = obj.verdict;
|
|
113
|
+
if (verdict !== 'passed' && verdict !== 'failed' && verdict !== 'inconclusive')
|
|
114
|
+
return null;
|
|
115
|
+
const rationale = typeof obj.rationale === 'string' ? obj.rationale : '';
|
|
116
|
+
const drift = Array.isArray(obj.drift_observations) ? obj.drift_observations : [];
|
|
117
|
+
const driftObservations = [];
|
|
118
|
+
for (const raw of drift) {
|
|
119
|
+
if (!raw || typeof raw !== 'object')
|
|
120
|
+
continue;
|
|
121
|
+
const d = raw;
|
|
122
|
+
const kind = d.kind;
|
|
123
|
+
if (kind !== 'update_statement' &&
|
|
124
|
+
kind !== 'add_node' &&
|
|
125
|
+
kind !== 'retire_node' &&
|
|
126
|
+
kind !== 'change_node_type' &&
|
|
127
|
+
kind !== 'flip_ude_to_de')
|
|
128
|
+
continue;
|
|
129
|
+
driftObservations.push({
|
|
130
|
+
nodeId: typeof d.node_id === 'string' ? d.node_id : null,
|
|
131
|
+
kind,
|
|
132
|
+
observed: typeof d.observed === 'string' ? d.observed : '',
|
|
133
|
+
suggestedCorrection: typeof d.suggested_correction === 'string'
|
|
134
|
+
? d.suggested_correction
|
|
135
|
+
: '',
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return { verdict, rationale, driftObservations };
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Build the argv for the claude CLI invocation. Exposed for tests.
|
|
142
|
+
*/
|
|
143
|
+
export function buildClaudeArgs(inputs, systemPrompt) {
|
|
144
|
+
const args = [
|
|
145
|
+
'--print',
|
|
146
|
+
'--output-format', 'text',
|
|
147
|
+
'--bare',
|
|
148
|
+
'--no-session-persistence',
|
|
149
|
+
'--allowed-tools', 'Read,Grep',
|
|
150
|
+
'--system-prompt', systemPrompt,
|
|
151
|
+
];
|
|
152
|
+
if (inputs.worktreePath) {
|
|
153
|
+
args.push('--add-dir', inputs.worktreePath);
|
|
154
|
+
}
|
|
155
|
+
return args;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Spawn the claude CLI runner and return the parsed verdict.
|
|
159
|
+
*
|
|
160
|
+
* Returns 'inconclusive' on any error (spawn failure, timeout, malformed
|
|
161
|
+
* output) so the verification engine records 'pending' and the loop will
|
|
162
|
+
* retry on the next tick.
|
|
163
|
+
*/
|
|
164
|
+
export async function runAiInspection(inputs, opts = {}) {
|
|
165
|
+
const claudeBin = opts.claudeBin ?? 'claude';
|
|
166
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
167
|
+
const spawnFn = opts.spawnFn ?? ((cmd, args, sopts) => spawn(cmd, args, sopts));
|
|
168
|
+
if (!inputs.worktreePath) {
|
|
169
|
+
return {
|
|
170
|
+
verdict: 'inconclusive',
|
|
171
|
+
rationale: 'ai_inspection skipped: no worktree path resolved for delivery',
|
|
172
|
+
driftObservations: [],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
const systemPrompt = buildSystemPrompt(inputs);
|
|
176
|
+
const userMessage = buildUserMessage(inputs);
|
|
177
|
+
const args = buildClaudeArgs(inputs, systemPrompt);
|
|
178
|
+
return await new Promise((resolve) => {
|
|
179
|
+
let child;
|
|
180
|
+
try {
|
|
181
|
+
child = spawnFn(claudeBin, args, {
|
|
182
|
+
cwd: inputs.worktreePath,
|
|
183
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
resolve({
|
|
188
|
+
verdict: 'inconclusive',
|
|
189
|
+
rationale: `ai_inspection spawn failed: ${err.message}`,
|
|
190
|
+
driftObservations: [],
|
|
191
|
+
});
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
let stdout = '';
|
|
195
|
+
let stderr = '';
|
|
196
|
+
child.stdout?.on('data', (chunk) => { stdout += chunk.toString('utf8'); });
|
|
197
|
+
child.stderr?.on('data', (chunk) => { stderr += chunk.toString('utf8'); });
|
|
198
|
+
const timer = setTimeout(() => {
|
|
199
|
+
try {
|
|
200
|
+
child.kill('SIGKILL');
|
|
201
|
+
}
|
|
202
|
+
catch { /* ignore */ }
|
|
203
|
+
}, timeoutMs);
|
|
204
|
+
child.on('error', (err) => {
|
|
205
|
+
clearTimeout(timer);
|
|
206
|
+
resolve({
|
|
207
|
+
verdict: 'inconclusive',
|
|
208
|
+
rationale: `ai_inspection spawn error: ${err.message}`,
|
|
209
|
+
driftObservations: [],
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
child.on('close', (code) => {
|
|
213
|
+
clearTimeout(timer);
|
|
214
|
+
if (code !== 0) {
|
|
215
|
+
resolve({
|
|
216
|
+
verdict: 'inconclusive',
|
|
217
|
+
rationale: `ai_inspection exited ${code}: ${stderr.slice(-2000)}`,
|
|
218
|
+
driftObservations: [],
|
|
219
|
+
});
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const parsed = parseInspectionJson(stdout);
|
|
223
|
+
if (!parsed) {
|
|
224
|
+
resolve({
|
|
225
|
+
verdict: 'inconclusive',
|
|
226
|
+
rationale: 'ai_inspection produced no parseable JSON verdict',
|
|
227
|
+
driftObservations: [],
|
|
228
|
+
});
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
resolve(parsed);
|
|
232
|
+
});
|
|
233
|
+
try {
|
|
234
|
+
child.stdin?.write(userMessage);
|
|
235
|
+
child.stdin?.end();
|
|
236
|
+
}
|
|
237
|
+
catch (err) {
|
|
238
|
+
clearTimeout(timer);
|
|
239
|
+
resolve({
|
|
240
|
+
verdict: 'inconclusive',
|
|
241
|
+
rationale: `ai_inspection stdin write failed: ${err.message}`,
|
|
242
|
+
driftObservations: [],
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=ai-inspection-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-inspection-runner.js","sourceRoot":"","sources":["../src/ai-inspection-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AA0C9D,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEzC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B9B,CAAC;AAEF,SAAS,iBAAiB,CAAC,MAA0B;IACnD,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,iBAAiB;QAClD,CAAC,CAAC,8BAA8B,MAAM,CAAC,SAAS,CAAC,iBAAiB,IAAI;QACtE,CAAC,CAAC,EAAE,CAAC;IACP,OAAO;QACL,sBAAsB;QACtB,iCAAiC,MAAM,CAAC,SAAS,CAAC,YAAY,IAAI;QAClE,gDAAgD,MAAM,CAAC,SAAS,CAAC,Y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AAW,CAAC,CAAC;YAChC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;QACrB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC;gBACN,OAAO,EAAE,cAAc;gBACvB,SAAS,EAAE,qCAAsC,GAAa,CAAC,OAAO,EAAE;gBACxE,iBAAiB,EAAE,EAAE;aACtB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -5,5 +5,53 @@
|
|
|
5
5
|
* and formats it as markdown content. Resolvers are registered at
|
|
6
6
|
* module load time.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export declare const MAX_DIFF_BYTES: number;
|
|
9
|
+
/**
|
|
10
|
+
* Run git diff in a worktree against the base branch.
|
|
11
|
+
* Returns the raw diff output, or empty string on failure.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getGitDiff(worktreePath: string, baseBranch: string): string;
|
|
14
|
+
export interface RealityTreeRow {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
description: string | null;
|
|
18
|
+
focusId: string | null;
|
|
19
|
+
status: 'active' | 'archived';
|
|
20
|
+
}
|
|
21
|
+
export interface RealityTreeListResponse {
|
|
22
|
+
items: RealityTreeRow[];
|
|
23
|
+
totalCount: number;
|
|
24
|
+
}
|
|
25
|
+
export interface RealityNodeRow {
|
|
26
|
+
id: string;
|
|
27
|
+
realityTreeId: string;
|
|
28
|
+
seq: number;
|
|
29
|
+
statement: string;
|
|
30
|
+
nodeType: 'entity' | 'undesired_effect' | 'desired_effect' | 'injection';
|
|
31
|
+
frtStatement: string | null;
|
|
32
|
+
frtNodeType: string | null;
|
|
33
|
+
viewScope: 'both' | 'crt_only' | 'frt_only';
|
|
34
|
+
status: 'active' | 'retired';
|
|
35
|
+
injectionStatus: 'proposed' | 'in_progress' | 'realized' | 'verified' | null;
|
|
36
|
+
dissolvesObstacle: string | null;
|
|
37
|
+
enablesNodeId: string | null;
|
|
38
|
+
evidence: string | null;
|
|
39
|
+
}
|
|
40
|
+
export interface RealityEdgeRow {
|
|
41
|
+
id: string;
|
|
42
|
+
realityTreeId: string;
|
|
43
|
+
fromNodeId: string;
|
|
44
|
+
toNodeId: string;
|
|
45
|
+
edgeType: 'sufficient' | 'and' | 'derived_from' | 'targets';
|
|
46
|
+
}
|
|
47
|
+
export interface NodeListResponse {
|
|
48
|
+
items: RealityNodeRow[];
|
|
49
|
+
totalCount: number;
|
|
50
|
+
}
|
|
51
|
+
export interface EdgeListResponse {
|
|
52
|
+
items: RealityEdgeRow[];
|
|
53
|
+
totalCount: number;
|
|
54
|
+
}
|
|
55
|
+
export declare const CRT_DUMP_BUDGET_CHARS = 10000;
|
|
56
|
+
export declare function renderRealityTreeDump(tree: RealityTreeRow, nodes: RealityNodeRow[], edges: RealityEdgeRow[], budgetChars: number): string;
|
|
9
57
|
//# sourceMappingURL=assembly-resolvers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assembly-resolvers.d.ts","sourceRoot":"","sources":["../src/assembly-resolvers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
1
|
+
{"version":3,"file":"assembly-resolvers.d.ts","sourceRoot":"","sources":["../src/assembly-resolvers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmLH,eAAO,MAAM,cAAc,QAAY,CAAC;AAUxC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAU3E;AAu5BD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;CAC/B;AAED,MA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