@telora/daemon 0.18.49 → 0.18.55
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 +11 -3
- package/dist/completion/team-completion.d.ts.map +1 -1
- package/dist/completion/team-completion.js +32 -2
- package/dist/completion/team-completion.js.map +1 -1
- package/dist/focus-executor.d.ts +7 -2
- package/dist/focus-executor.d.ts.map +1 -1
- package/dist/focus-executor.js +20 -9
- package/dist/focus-executor.js.map +1 -1
- package/dist/focus-lifecycle.d.ts.map +1 -1
- package/dist/focus-lifecycle.js +20 -0
- package/dist/focus-lifecycle.js.map +1 -1
- package/dist/git-genesis.d.ts +100 -0
- package/dist/git-genesis.d.ts.map +1 -0
- package/dist/git-genesis.js +231 -0
- package/dist/git-genesis.js.map +1 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +28 -5
- package/dist/git.js.map +1 -1
- package/dist/output-monitor.js +5 -8
- package/dist/output-monitor.js.map +1 -1
- package/dist/prd-controller.d.ts +0 -2
- package/dist/prd-controller.d.ts.map +1 -1
- package/dist/prd-controller.js +14 -35
- package/dist/prd-controller.js.map +1 -1
- package/dist/prd-divergence.d.ts +19 -8
- package/dist/prd-divergence.d.ts.map +1 -1
- package/dist/prd-divergence.js +7 -26
- package/dist/prd-divergence.js.map +1 -1
- package/dist/prd-viability.d.ts +14 -15
- package/dist/prd-viability.d.ts.map +1 -1
- package/dist/prd-viability.js +21 -34
- package/dist/prd-viability.js.map +1 -1
- package/dist/queries/prd.d.ts +24 -2
- package/dist/queries/prd.d.ts.map +1 -1
- package/dist/queries/prd.js +17 -0
- package/dist/queries/prd.js.map +1 -1
- package/dist/queries/schemas.d.ts +28 -0
- package/dist/queries/schemas.d.ts.map +1 -1
- package/dist/queries/schemas.js +26 -0
- package/dist/queries/schemas.js.map +1 -1
- package/dist/queries/sessions.d.ts +14 -0
- package/dist/queries/sessions.d.ts.map +1 -1
- package/dist/queries/sessions.js +19 -0
- package/dist/queries/sessions.js.map +1 -1
- package/dist/queries/starter-repo.d.ts +27 -0
- package/dist/queries/starter-repo.d.ts.map +1 -0
- package/dist/queries/starter-repo.js +32 -0
- package/dist/queries/starter-repo.js.map +1 -0
- package/dist/session-lineage.d.ts +25 -0
- package/dist/session-lineage.d.ts.map +1 -1
- package/dist/session-lineage.js +23 -0
- package/dist/session-lineage.js.map +1 -1
- package/dist/session-stamp.d.ts +63 -0
- package/dist/session-stamp.d.ts.map +1 -0
- package/dist/session-stamp.js +65 -0
- package/dist/session-stamp.js.map +1 -0
- package/dist/spawner/helpers.d.ts.map +1 -1
- package/dist/spawner/helpers.js +5 -8
- package/dist/spawner/helpers.js.map +1 -1
- package/dist/supabase.d.ts +2 -2
- package/dist/supabase.d.ts.map +1 -1
- package/dist/supabase.js +1 -1
- package/dist/supabase.js.map +1 -1
- package/dist/templates/claude-md.d.ts +1 -1
- package/dist/templates/claude-md.d.ts.map +1 -1
- package/dist/templates/claude-md.js +6 -3
- package/dist/templates/claude-md.js.map +1 -1
- package/dist/types/session.d.ts +24 -0
- package/dist/types/session.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/prd-clearance-engine.d.ts +0 -121
- package/dist/prd-clearance-engine.d.ts.map +0 -1
- package/dist/prd-clearance-engine.js +0 -164
- package/dist/prd-clearance-engine.js.map +0 -1
|
@@ -29,7 +29,7 @@ export declare const TELORA_CLAUDE_MD_END = "<!-- END TELORA SEED -->";
|
|
|
29
29
|
* For Codex: the MCP server is registered in `~/.codex/config.toml` (global).
|
|
30
30
|
*/
|
|
31
31
|
export declare const SEED_MCP_REGISTRATION_SENTENCE = "The Telora MCP server is registered in `.mcp.json`.";
|
|
32
|
-
export declare const SEED_BODY = "# Telora workstation context\n\nThis repo is connected to Telora -- a differential control plane for\nsoftware delivery. Intent and reality are paired signals; the meaningful\nwork happens at the difference.\n\n## Before you write any code (read this first)\n\nDEFAULT: on a Telora-connected workstation, a new capability starts as\n**declared intent** before any code. When the user says \"I want to build\nX\", your first move is NOT to scaffold X -- it is to declare it: create\n(or select) a Focus -> delivery -> issue and move an issue to **In\nProgress**. Code is written only after intent is anchored above it.\n\nThis polarity is deliberate and easy to get backwards. Building directly\nin the working tree -- scaffolding, installing dependencies, starting a\ndev server, writing application files -- is the **exception**, taken ONLY\nwhen the user explicitly asks for it. Recognized bypass phrases:\n\"build locally\", \"just write it\", \"skip Telora\", \"don't track this\",\n\"throwaway\". Absent an explicit signal like these, treat any build\nrequest as a request to declare intent in Telora first.\n\nAsking good clarifying questions about stack, scope, or dependencies is\nNOT a substitute for this step -- that is execution-layer scoping, and it\ncomes *after* the capability is declared, not instead of it. Scoping is\nagent work; declaring that a capability matters is the part that must\nland in Telora first.\n\n**Surface the fork; do not silently pick it.** The common failure is\nresolving an ambiguous request toward the path of least resistance --\ne.g. reading \"a web app I run locally on my LAN\" (a deployment target) as\n\"build locally\" (skip Telora). When intent is not already explicit, your\nFIRST response to a build request names the choice rather than assuming\nit: \"I'll scope this in Telora unless you want it built locally -- which?\"\nOne question, once, at the start. Let the user pick; never pick for them\nby starting to type code.\n\n**First action rule.** On a build / new-capability request, your first\ntool call is a Telora planning call (telora_product_focus / _delivery /\n_issue) OR the fork question above -- never Write, Edit, or a code-running\nBash command. If the first move cannot be code, building-before-intent\ncannot happen.\n\nWhy: an artifact with no declared intent above it is reality moving with\nnothing to measure it against -- pure noise to the differential loop. The\nwhole system is built to compute intent-minus-reality; code that skips\nthe intent half defeats the instrument.\n\n## Planning hierarchy\n\n- **Focus** = the context that defines an area of work -- not \"one\n capability.\" All phases of building within that area belong in one\n focus; if a \"focus\" is really just one phase, fold it back in.\n- **Delivery** = a shippable phase or major component of a capability.\n- **Context Group** = optional grouping of related issues that share\n meaningful context (relevant files, architectural notes). A CG earns its\n existence by carrying context, not by being a folder.\n- **Task** = one discrete implementable unit. Bounded files, focused\n session. Multiple \"and\" clauses across different concerns means split.\n\nScope by purpose, not count. The right number of deliveries is however\nmany phases the work naturally has.\n\n## PRD: \"build a working app in one run\"\n\nA **PRD** sits one altitude above Focus (Product -> PRD -> Focus): a\nbounded, verifiable, retire-able milestone carrying a **Prerequisite Tree**\nof `goal` / `obstacle` / `overcome` nodes. Each `overcome` materializes\nas a focus; the daemon progressively arms the **frontier** of foci as\nupstream obstacles clear. This is the entry point a user means by \"build a\nfully working app in one go.\"\n\nIt is NOT big-bang generation: you author the tree once, commit a path,\nand the differential loop walks the frontier to completion -- the execution\nunderneath is still the normal focus -> delivery -> issue + review loop.\n\nThe PRD tools are **lazy-loaded** -- they do not exist until you load the\ndomain. If you don't see `telora_prd` / `telora_prd_tree`, run:\n\n```\ntelora_discover { action: \"load\", domain: \"prd\" }\n```\n\nThen: `telora_prd` create (referencing a Vision) -> `telora_prd_tree`\nauthor nodes (obstacles
|
|
32
|
+
export declare const SEED_BODY = "# Telora workstation context\n\nThis repo is connected to Telora -- a differential control plane for\nsoftware delivery. Intent and reality are paired signals; the meaningful\nwork happens at the difference.\n\n## Before you write any code (read this first)\n\nDEFAULT: on a Telora-connected workstation, a new capability starts as\n**declared intent** before any code. When the user says \"I want to build\nX\", your first move is NOT to scaffold X -- it is to declare it: create\n(or select) a Focus -> delivery -> issue and move an issue to **In\nProgress**. Code is written only after intent is anchored above it.\n\nThis polarity is deliberate and easy to get backwards. Building directly\nin the working tree -- scaffolding, installing dependencies, starting a\ndev server, writing application files -- is the **exception**, taken ONLY\nwhen the user explicitly asks for it. Recognized bypass phrases:\n\"build locally\", \"just write it\", \"skip Telora\", \"don't track this\",\n\"throwaway\". Absent an explicit signal like these, treat any build\nrequest as a request to declare intent in Telora first.\n\nAsking good clarifying questions about stack, scope, or dependencies is\nNOT a substitute for this step -- that is execution-layer scoping, and it\ncomes *after* the capability is declared, not instead of it. Scoping is\nagent work; declaring that a capability matters is the part that must\nland in Telora first.\n\n**Surface the fork; do not silently pick it.** The common failure is\nresolving an ambiguous request toward the path of least resistance --\ne.g. reading \"a web app I run locally on my LAN\" (a deployment target) as\n\"build locally\" (skip Telora). When intent is not already explicit, your\nFIRST response to a build request names the choice rather than assuming\nit: \"I'll scope this in Telora unless you want it built locally -- which?\"\nOne question, once, at the start. Let the user pick; never pick for them\nby starting to type code.\n\n**First action rule.** On a build / new-capability request, your first\ntool call is a Telora planning call (telora_product_focus / _delivery /\n_issue) OR the fork question above -- never Write, Edit, or a code-running\nBash command. If the first move cannot be code, building-before-intent\ncannot happen.\n\nWhy: an artifact with no declared intent above it is reality moving with\nnothing to measure it against -- pure noise to the differential loop. The\nwhole system is built to compute intent-minus-reality; code that skips\nthe intent half defeats the instrument.\n\n## Planning hierarchy\n\n- **Focus** = the context that defines an area of work -- not \"one\n capability.\" All phases of building within that area belong in one\n focus; if a \"focus\" is really just one phase, fold it back in.\n- **Delivery** = a shippable phase or major component of a capability.\n- **Context Group** = optional grouping of related issues that share\n meaningful context (relevant files, architectural notes). A CG earns its\n existence by carrying context, not by being a folder.\n- **Task** = one discrete implementable unit. Bounded files, focused\n session. Multiple \"and\" clauses across different concerns means split.\n\nScope by purpose, not count. The right number of deliveries is however\nmany phases the work naturally has.\n\n## PRD: \"build a working app in one run\"\n\nA **PRD** sits one altitude above Focus (Product -> PRD -> Focus): a\nbounded, verifiable, retire-able milestone carrying a **Prerequisite Tree**\nof `goal` / `obstacle` / `overcome` nodes. Each `overcome` materializes\nas a focus; the daemon progressively arms the **frontier** of foci as\nupstream obstacles clear. This is the entry point a user means by \"build a\nfully working app in one go.\"\n\nIt is NOT big-bang generation: you author the tree once, commit a path,\nand the differential loop walks the frontier to completion -- the execution\nunderneath is still the normal focus -> delivery -> issue + review loop.\n\nThe PRD tools are **lazy-loaded** -- they do not exist until you load the\ndomain. If you don't see `telora_prd` / `telora_prd_tree`, run:\n\n```\ntelora_discover { action: \"load\", domain: \"prd\" }\n```\n\nThen: `telora_prd` create (referencing a Vision) -> `telora_prd_tree`\nauthor nodes (an obstacle's `clearancePredicate` is OPTIONAL and advisory --\nthe frontier advances as upstream obstacles clear via focus-completion, i.e.\neach overcome's focus finishing its deliveries' verify gates, not via a\nper-obstacle predicate) + edges -> commit a pathway -> `materialize_overcome`\neach into a focus -> arm the daemon PRD loop. All authoring is harness+MCP;\nthere is no Telora authoring UI.\n\n## Issue workflow\n\n`To Do` -> `In Progress` -> `In Review` / `Blocked` -> `Done`.\n\nIssue types: **Context Group**, **Task**, **Bug**.\n\nMovement rules:\n\n- An issue MUST be set to `In Progress` before any work begins on it.\n- Never skip `In Progress`. Never move directly from `To Do` to `Done`.\n- Set status with `telora_product_issue` action=update.\n\nDelivery and focus stages advance automatically based on issue\nactivity. Agents never set delivery executionStatus directly.\n\n## MCP tool surface (what's available in this session)\n\nThe Telora MCP server is registered in `.mcp.json`. Core tool families:\n\n- `telora_product` -- list/get/create/update products\n- `telora_product_focus` -- focuses under a product\n- `telora_product_delivery` -- deliveries under a focus\n- `telora_product_issue` -- issues (Context Groups, Tasks, Bugs) under a delivery\n- `telora_agent` -- agent roles, escalation requests\n- `telora_loop_*` -- loop documents, questions, answers\n- `telora_discover` -- on-demand registration of deferred tool domains\n\nResolve the live tool list at runtime via `telora_discover` rather than\nhard-coding a list that drifts.\n\n## Human-vs-agent boundaries\n\n- Humans own **intent** and **completion**.\n - Intent: what capability matters, what changes when. Pre-handoff.\n - Completion: closing the loop on whether a focus is done. Post-handoff.\n- Agents own **scoping** and **execution**.\n - Scoping: decomposing a focus into deliveries, deliveries into\n issues, restructuring mid-flight as the agent learns more.\n - Execution: writing code, running tests, committing, reporting.\n\nDo not ask humans for operational details they expect the agent to figure\nout. Do not silently complete a focus on the human's behalf. Escalate\nwhen stuck via `telora_agent` action=escalate.\n\nWhen communicating with a human, refer to focuses, deliveries, and issues\nby their **title**, never their UUID. UUIDs are for tool calls only and must\nnot be surfaced in chat. MCP tool results carry both, so this is a\ncommunication choice, not a data-availability problem: keep the id in the\ntool call, name the work by its title in the conversation.\n\n## Differential signaling\n\nTelora is asymmetric: it moves reality toward intent, never the reverse.\nAgents do not lower the bar to make signals look better -- they escalate.\nEvery artifact (commit, work summary, gate result) is signal toward the\ndeclared intent; raw activity without intent reduction is noise.\n\nA short corrective comment from the user is high-signal -- treat brief\npushback as the most important input in the session.\n\n## Workflows and policies\n\n- **Workflow**: stage directives shape agent behavior at discrete\n transitions. What context the agent sees (assembly recipes), what tools\n it can use, how it thinks (prompt + model). Live in Telora's\n `workflow_stages.agent_directive` JSONB.\n- **Policy** (organizational, deferred): cross-cutting constraints that\n feed into stage directives.\n\nWhen you cross a stage transition, the daemon may inject context or spawn\na fresh sub-agent per the directive. Don't override that flow without a\nclear reason.\n";
|
|
33
33
|
/**
|
|
34
34
|
* Render a fresh-repo CLAUDE.md.
|
|
35
35
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-md.d.ts","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AACnE,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAE/D;;;;;;GAMG;AACH;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,wDACY,CAAC;AAExD,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"claude-md.d.ts","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AACnE,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAE/D;;;;;;GAMG;AACH;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,wDACY,CAAC;AAExD,eAAO,MAAM,SAAS,+sPAmKrB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CASjE"}
|
|
@@ -113,9 +113,12 @@ telora_discover { action: "load", domain: "prd" }
|
|
|
113
113
|
\`\`\`
|
|
114
114
|
|
|
115
115
|
Then: \`telora_prd\` create (referencing a Vision) -> \`telora_prd_tree\`
|
|
116
|
-
author nodes (
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
author nodes (an obstacle's \`clearancePredicate\` is OPTIONAL and advisory --
|
|
117
|
+
the frontier advances as upstream obstacles clear via focus-completion, i.e.
|
|
118
|
+
each overcome's focus finishing its deliveries' verify gates, not via a
|
|
119
|
+
per-obstacle predicate) + edges -> commit a pathway -> \`materialize_overcome\`
|
|
120
|
+
each into a focus -> arm the daemon PRD loop. All authoring is harness+MCP;
|
|
121
|
+
there is no Telora authoring UI.
|
|
119
122
|
|
|
120
123
|
## Issue workflow
|
|
121
124
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-md.js","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,4BAA4B,CAAC;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAE/D;;;;;;GAMG;AACH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,8BAA8B,GACzC,qDAAqD,CAAC;AAExD,MAAM,CAAC,MAAM,SAAS,GAAG
|
|
1
|
+
{"version":3,"file":"claude-md.js","sourceRoot":"","sources":["../../src/templates/claude-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,4BAA4B,CAAC;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAE/D;;;;;;GAMG;AACH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,8BAA8B,GACzC,qDAAqD,CAAC;AAExD,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmKxB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,WAA0B;IACvD,MAAM,WAAW,GAAG,WAAW;QAC7B,CAAC,CAAC,kCAAkC,WAAW,SAAS;QACxD,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,KAAK,GACT,GAAG,sBAAsB,IAAI;QAC7B,GAAG,WAAW,GAAG,SAAS,EAAE;QAC5B,GAAG,oBAAoB,IAAI,CAAC;IAC9B,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/types/session.d.ts
CHANGED
|
@@ -48,6 +48,30 @@ export interface AgentSession {
|
|
|
48
48
|
files_modified: string[];
|
|
49
49
|
commits: string[];
|
|
50
50
|
workflow_stage_id: string | null;
|
|
51
|
+
pass_id: string | null;
|
|
52
|
+
claude_session_id: string | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Pass-grain session entity (agent_session_passes). A pass is one logical
|
|
56
|
+
* session = (focus, lineage); agent_sessions rows are continuation SEGMENTS
|
|
57
|
+
* under it (linked via AgentSession.pass_id). Rollup columns (token_count,
|
|
58
|
+
* cost_estimate, commits, files_modified) aggregate across the pass's segments.
|
|
59
|
+
*/
|
|
60
|
+
export interface AgentSessionPass {
|
|
61
|
+
id: string;
|
|
62
|
+
organization_id: string;
|
|
63
|
+
focus_id: string | null;
|
|
64
|
+
agent_role_id: string | null;
|
|
65
|
+
session_type: string;
|
|
66
|
+
branch_name: string | null;
|
|
67
|
+
status: 'open' | 'closed';
|
|
68
|
+
started_at: string | null;
|
|
69
|
+
ended_at: string | null;
|
|
70
|
+
token_count: number;
|
|
71
|
+
cost_estimate: number;
|
|
72
|
+
commits: string[];
|
|
73
|
+
files_modified: string[];
|
|
74
|
+
claude_session_id: string | null;
|
|
51
75
|
}
|
|
52
76
|
/**
|
|
53
77
|
* Running agent process info
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{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
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telora/daemon",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.55",
|
|
4
4
|
"description": "Agent orchestration daemon for Telora - spawns and manages Claude Code instances",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"//testRunner": "Uses Node.js built-in test runner (node:test) via tsx for TypeScript support. The root package uses Vitest; this is a deliberate choice for the daemon package to avoid framework dependencies. See src/__tests__/ for test files.",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@telora/daemon-core": "^0.2.49",
|
|
40
|
-
"@telora/mcp-products": "^0.22.
|
|
40
|
+
"@telora/mcp-products": "^0.22.83",
|
|
41
41
|
"commander": "^14.0.3",
|
|
42
42
|
"yaml": "^2.4.0",
|
|
43
43
|
"zod": "^4.3.6"
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PRD obstacle clearance predicate engine -- Staged Assembly: PRD Layer.
|
|
3
|
-
*
|
|
4
|
-
* This module lifts the per-delivery verification engine one altitude up to the
|
|
5
|
-
* PRD Prerequisite Tree (PRT) obstacle. Where `verification-engine.ts` answers
|
|
6
|
-
* "is this delivery's injection cleared?", this answers "is this milestone's
|
|
7
|
-
* obstacle cleared?" -- and, in aggregate, "is the whole milestone complete?".
|
|
8
|
-
*
|
|
9
|
-
* The clearance predicate is BOTH the completion signal AND the divergence
|
|
10
|
-
* detector: a PRD (milestone) is done exactly when every obstacle's verifiable
|
|
11
|
-
* clearance predicate passes. (UDE #4 -> desired effect: milestone completion
|
|
12
|
-
* is computable.)
|
|
13
|
-
*
|
|
14
|
-
* Design constraints (delivery C):
|
|
15
|
-
* - PURE. No DB access, no reality-tree writes, no module-level mutable state.
|
|
16
|
-
* The caller fetches obstacles (from `prd_prt_nodes.clearance_predicate`) and
|
|
17
|
-
* passes them in; this module only computes verdicts.
|
|
18
|
-
* - Command execution is INJECTED via `ClearanceContext.runCommand` so tests
|
|
19
|
-
* never shell out. A `defaultRunCommand` is provided for real callers and
|
|
20
|
-
* mirrors `verification-engine.runDeterministicStrategy` (spawn `sh -c`, tail
|
|
21
|
-
* output at 4000 chars, exit 0 = pass) -- but returns the raw triple rather
|
|
22
|
-
* than a StrategyResult, keeping this module side-effect-light.
|
|
23
|
-
* - NO daemon-loop wiring here. Wiring into the focus/verification loop is a
|
|
24
|
-
* later delivery (D).
|
|
25
|
-
*
|
|
26
|
-
* Predicate kinds mirror the verification engine's strategy taxonomy:
|
|
27
|
-
* deterministic -- run shell checks; all exit 0 => cleared.
|
|
28
|
-
* behavioral -- runtime telemetry observation (deferred; no signal source).
|
|
29
|
-
* ai_inspection -- AI reads code/state and decides (deferred; no driver).
|
|
30
|
-
* human -- a human attests clearance (deferred; out of band).
|
|
31
|
-
*
|
|
32
|
-
* @module prd-clearance-engine
|
|
33
|
-
*/
|
|
34
|
-
/** The kinds of clearance predicate, mirroring verification strategy methods. */
|
|
35
|
-
export type ClearanceKind = 'deterministic' | 'behavioral' | 'ai_inspection' | 'human';
|
|
36
|
-
/** A single deterministic shell check within a predicate. */
|
|
37
|
-
export interface ClearanceCheck {
|
|
38
|
-
cmd: string;
|
|
39
|
-
label?: string;
|
|
40
|
-
}
|
|
41
|
-
/** An obstacle's verifiable clearance predicate (shape of `clearance_predicate`). */
|
|
42
|
-
export interface ClearancePredicate {
|
|
43
|
-
kind: ClearanceKind;
|
|
44
|
-
checks?: ClearanceCheck[];
|
|
45
|
-
}
|
|
46
|
-
/** Outcome of running one deterministic check. */
|
|
47
|
-
export interface ClearanceCheckResult {
|
|
48
|
-
cmd: string;
|
|
49
|
-
exitCode: number | null;
|
|
50
|
-
passed: boolean;
|
|
51
|
-
}
|
|
52
|
-
/** The verdict for a single obstacle's predicate. */
|
|
53
|
-
export interface ClearanceVerdict {
|
|
54
|
-
kind: ClearanceKind;
|
|
55
|
-
/** True only when the predicate is computable AND every check passed. */
|
|
56
|
-
cleared: boolean;
|
|
57
|
-
/** True when the predicate kind has no automatic signal source (deferred). */
|
|
58
|
-
deferred: boolean;
|
|
59
|
-
/** Human-readable summary of how the verdict was reached. */
|
|
60
|
-
evidence: string;
|
|
61
|
-
/** Populated for deterministic predicates; one entry per check run. */
|
|
62
|
-
checkResults?: ClearanceCheckResult[];
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Injected command runner. Mirrors the spawn semantics of
|
|
66
|
-
* `verification-engine.runDeterministicStrategy` but returns the raw triple so
|
|
67
|
-
* this module stays free of StrategyResult/outcome coupling.
|
|
68
|
-
*/
|
|
69
|
-
export type RunCommand = (cmd: string, cwd: string) => Promise<{
|
|
70
|
-
exitCode: number | null;
|
|
71
|
-
stdoutTail: string;
|
|
72
|
-
stderrTail: string;
|
|
73
|
-
}>;
|
|
74
|
-
/** Evaluation context: where to run, and (optionally) how to run. */
|
|
75
|
-
export interface ClearanceContext {
|
|
76
|
-
worktreeDir: string;
|
|
77
|
-
/** Defaults to `defaultRunCommand` when omitted. Tests inject a fake. */
|
|
78
|
-
runCommand?: RunCommand;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Real shell runner: spawn `sh -c <cmd>` in `cwd`, capture stdout/stderr tailed
|
|
82
|
-
* to 4000 chars, resolve `{ exitCode, stdoutTail, stderrTail }`. A spawn error
|
|
83
|
-
* resolves with `exitCode: null` (treated as a non-pass by callers). Mirrors
|
|
84
|
-
* `verification-engine.runDeterministicStrategy` but returns the raw triple.
|
|
85
|
-
*/
|
|
86
|
-
export declare const defaultRunCommand: RunCommand;
|
|
87
|
-
/**
|
|
88
|
-
* Evaluate a single obstacle's clearance predicate. PURE.
|
|
89
|
-
*
|
|
90
|
-
* - deterministic: run each check via `ctx.runCommand ?? defaultRunCommand`.
|
|
91
|
-
* exit 0 = passed. All pass => cleared. No checks (undefined/empty) =>
|
|
92
|
-
* not cleared, not deferred (a deterministic predicate with nothing to check
|
|
93
|
-
* cannot assert clearance).
|
|
94
|
-
* - behavioral | ai_inspection | human: deferred (cleared:false, deferred:true);
|
|
95
|
-
* evidence names the deferral reason.
|
|
96
|
-
*/
|
|
97
|
-
export declare function evaluateClearance(predicate: ClearancePredicate, ctx: ClearanceContext): Promise<ClearanceVerdict>;
|
|
98
|
-
/**
|
|
99
|
-
* Aggregate clearance across all obstacles of a PRT -- the "milestone
|
|
100
|
-
* completion is computable" primitive. PURE; the caller fetches the obstacles
|
|
101
|
-
* (each carrying its `clearance_predicate`).
|
|
102
|
-
*
|
|
103
|
-
* - `allCleared` is true only when there is at least one obstacle AND every
|
|
104
|
-
* obstacle's verdict is cleared. (An empty obstacle set cannot assert a
|
|
105
|
-
* complete milestone.)
|
|
106
|
-
* - `deferredCount` counts obstacles whose predicate could not be evaluated
|
|
107
|
-
* automatically -- these block `allCleared` and flag where human/AI signal
|
|
108
|
-
* is still required.
|
|
109
|
-
*/
|
|
110
|
-
export declare function evaluatePrtClearance(obstacles: {
|
|
111
|
-
nodeId: string;
|
|
112
|
-
predicate: ClearancePredicate;
|
|
113
|
-
}[], ctx: ClearanceContext): Promise<{
|
|
114
|
-
nodeVerdicts: {
|
|
115
|
-
nodeId: string;
|
|
116
|
-
verdict: ClearanceVerdict;
|
|
117
|
-
}[];
|
|
118
|
-
allCleared: boolean;
|
|
119
|
-
deferredCount: number;
|
|
120
|
-
}>;
|
|
121
|
-
//# sourceMappingURL=prd-clearance-engine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prd-clearance-engine.d.ts","sourceRoot":"","sources":["../src/prd-clearance-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAWH,iFAAiF;AACjF,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,YAAY,GAAG,eAAe,GAAG,OAAO,CAAC;AAEvF,6DAA6D;AAC7D,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EA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kBAAkB,CAAA;CAAE,EAAE,EAC9D,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC;IACT,YAAY,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,gBAAgB,CAAA;KAAE,EAAE,CAAC;IAC9D,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC,CAWD"}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PRD obstacle clearance predicate engine -- Staged Assembly: PRD Layer.
|
|
3
|
-
*
|
|
4
|
-
* This module lifts the per-delivery verification engine one altitude up to the
|
|
5
|
-
* PRD Prerequisite Tree (PRT) obstacle. Where `verification-engine.ts` answers
|
|
6
|
-
* "is this delivery's injection cleared?", this answers "is this milestone's
|
|
7
|
-
* obstacle cleared?" -- and, in aggregate, "is the whole milestone complete?".
|
|
8
|
-
*
|
|
9
|
-
* The clearance predicate is BOTH the completion signal AND the divergence
|
|
10
|
-
* detector: a PRD (milestone) is done exactly when every obstacle's verifiable
|
|
11
|
-
* clearance predicate passes. (UDE #4 -> desired effect: milestone completion
|
|
12
|
-
* is computable.)
|
|
13
|
-
*
|
|
14
|
-
* Design constraints (delivery C):
|
|
15
|
-
* - PURE. No DB access, no reality-tree writes, no module-level mutable state.
|
|
16
|
-
* The caller fetches obstacles (from `prd_prt_nodes.clearance_predicate`) and
|
|
17
|
-
* passes them in; this module only computes verdicts.
|
|
18
|
-
* - Command execution is INJECTED via `ClearanceContext.runCommand` so tests
|
|
19
|
-
* never shell out. A `defaultRunCommand` is provided for real callers and
|
|
20
|
-
* mirrors `verification-engine.runDeterministicStrategy` (spawn `sh -c`, tail
|
|
21
|
-
* output at 4000 chars, exit 0 = pass) -- but returns the raw triple rather
|
|
22
|
-
* than a StrategyResult, keeping this module side-effect-light.
|
|
23
|
-
* - NO daemon-loop wiring here. Wiring into the focus/verification loop is a
|
|
24
|
-
* later delivery (D).
|
|
25
|
-
*
|
|
26
|
-
* Predicate kinds mirror the verification engine's strategy taxonomy:
|
|
27
|
-
* deterministic -- run shell checks; all exit 0 => cleared.
|
|
28
|
-
* behavioral -- runtime telemetry observation (deferred; no signal source).
|
|
29
|
-
* ai_inspection -- AI reads code/state and decides (deferred; no driver).
|
|
30
|
-
* human -- a human attests clearance (deferred; out of band).
|
|
31
|
-
*
|
|
32
|
-
* @module prd-clearance-engine
|
|
33
|
-
*/
|
|
34
|
-
import { spawn } from 'node:child_process';
|
|
35
|
-
const DEFAULT_CLEARANCE_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes
|
|
36
|
-
const OUTPUT_TAIL_MAX = 4000;
|
|
37
|
-
// ---------------------------------------------------------------------------
|
|
38
|
-
// Default command runner (mirrors runDeterministicStrategy)
|
|
39
|
-
// ---------------------------------------------------------------------------
|
|
40
|
-
/**
|
|
41
|
-
* Real shell runner: spawn `sh -c <cmd>` in `cwd`, capture stdout/stderr tailed
|
|
42
|
-
* to 4000 chars, resolve `{ exitCode, stdoutTail, stderrTail }`. A spawn error
|
|
43
|
-
* resolves with `exitCode: null` (treated as a non-pass by callers). Mirrors
|
|
44
|
-
* `verification-engine.runDeterministicStrategy` but returns the raw triple.
|
|
45
|
-
*/
|
|
46
|
-
export const defaultRunCommand = (cmd, cwd) => {
|
|
47
|
-
return new Promise((resolve) => {
|
|
48
|
-
const child = spawn('sh', ['-c', cmd], {
|
|
49
|
-
cwd,
|
|
50
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
51
|
-
});
|
|
52
|
-
let stdout = '';
|
|
53
|
-
let stderr = '';
|
|
54
|
-
const tail = (buf, max = OUTPUT_TAIL_MAX) => buf.length <= max ? buf : buf.slice(buf.length - max);
|
|
55
|
-
child.stdout?.on('data', (chunk) => {
|
|
56
|
-
stdout += chunk.toString('utf8');
|
|
57
|
-
stdout = tail(stdout);
|
|
58
|
-
});
|
|
59
|
-
child.stderr?.on('data', (chunk) => {
|
|
60
|
-
stderr += chunk.toString('utf8');
|
|
61
|
-
stderr = tail(stderr);
|
|
62
|
-
});
|
|
63
|
-
const timer = setTimeout(() => {
|
|
64
|
-
try {
|
|
65
|
-
child.kill('SIGKILL');
|
|
66
|
-
}
|
|
67
|
-
catch { /* ignore */ }
|
|
68
|
-
}, DEFAULT_CLEARANCE_TIMEOUT_MS);
|
|
69
|
-
child.on('error', (err) => {
|
|
70
|
-
clearTimeout(timer);
|
|
71
|
-
resolve({
|
|
72
|
-
exitCode: null,
|
|
73
|
-
stdoutTail: stdout,
|
|
74
|
-
stderrTail: tail(`${stderr}\n${err.message}`),
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
child.on('close', (code) => {
|
|
78
|
-
clearTimeout(timer);
|
|
79
|
-
resolve({ exitCode: code, stdoutTail: stdout, stderrTail: stderr });
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
// ---------------------------------------------------------------------------
|
|
84
|
-
// Evaluation
|
|
85
|
-
// ---------------------------------------------------------------------------
|
|
86
|
-
const DEFERRAL_REASON = {
|
|
87
|
-
behavioral: 'behavioral clearance deferred -- no runtime telemetry source wired',
|
|
88
|
-
ai_inspection: 'ai_inspection clearance deferred -- no AI inspection driver wired',
|
|
89
|
-
human: 'human clearance deferred -- requires out-of-band human attestation',
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Evaluate a single obstacle's clearance predicate. PURE.
|
|
93
|
-
*
|
|
94
|
-
* - deterministic: run each check via `ctx.runCommand ?? defaultRunCommand`.
|
|
95
|
-
* exit 0 = passed. All pass => cleared. No checks (undefined/empty) =>
|
|
96
|
-
* not cleared, not deferred (a deterministic predicate with nothing to check
|
|
97
|
-
* cannot assert clearance).
|
|
98
|
-
* - behavioral | ai_inspection | human: deferred (cleared:false, deferred:true);
|
|
99
|
-
* evidence names the deferral reason.
|
|
100
|
-
*/
|
|
101
|
-
export async function evaluateClearance(predicate, ctx) {
|
|
102
|
-
if (predicate.kind !== 'deterministic') {
|
|
103
|
-
return {
|
|
104
|
-
kind: predicate.kind,
|
|
105
|
-
cleared: false,
|
|
106
|
-
deferred: true,
|
|
107
|
-
evidence: DEFERRAL_REASON[predicate.kind],
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
const checks = predicate.checks ?? [];
|
|
111
|
-
if (checks.length === 0) {
|
|
112
|
-
return {
|
|
113
|
-
kind: 'deterministic',
|
|
114
|
-
cleared: false,
|
|
115
|
-
deferred: false,
|
|
116
|
-
evidence: 'no checks defined -- deterministic predicate cannot assert clearance',
|
|
117
|
-
checkResults: [],
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
const run = ctx.runCommand ?? defaultRunCommand;
|
|
121
|
-
const checkResults = [];
|
|
122
|
-
for (const check of checks) {
|
|
123
|
-
const { exitCode } = await run(check.cmd, ctx.worktreeDir);
|
|
124
|
-
checkResults.push({
|
|
125
|
-
cmd: check.cmd,
|
|
126
|
-
exitCode,
|
|
127
|
-
passed: exitCode === 0,
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
const passedCount = checkResults.filter(r => r.passed).length;
|
|
131
|
-
const cleared = passedCount === checkResults.length;
|
|
132
|
-
return {
|
|
133
|
-
kind: 'deterministic',
|
|
134
|
-
cleared,
|
|
135
|
-
deferred: false,
|
|
136
|
-
evidence: cleared
|
|
137
|
-
? `deterministic clearance passed (${passedCount}/${checkResults.length} checks exit 0)`
|
|
138
|
-
: `deterministic clearance failed (${passedCount}/${checkResults.length} checks exit 0)`,
|
|
139
|
-
checkResults,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Aggregate clearance across all obstacles of a PRT -- the "milestone
|
|
144
|
-
* completion is computable" primitive. PURE; the caller fetches the obstacles
|
|
145
|
-
* (each carrying its `clearance_predicate`).
|
|
146
|
-
*
|
|
147
|
-
* - `allCleared` is true only when there is at least one obstacle AND every
|
|
148
|
-
* obstacle's verdict is cleared. (An empty obstacle set cannot assert a
|
|
149
|
-
* complete milestone.)
|
|
150
|
-
* - `deferredCount` counts obstacles whose predicate could not be evaluated
|
|
151
|
-
* automatically -- these block `allCleared` and flag where human/AI signal
|
|
152
|
-
* is still required.
|
|
153
|
-
*/
|
|
154
|
-
export async function evaluatePrtClearance(obstacles, ctx) {
|
|
155
|
-
const nodeVerdicts = [];
|
|
156
|
-
for (const obstacle of obstacles) {
|
|
157
|
-
const verdict = await evaluateClearance(obstacle.predicate, ctx);
|
|
158
|
-
nodeVerdicts.push({ nodeId: obstacle.nodeId, verdict });
|
|
159
|
-
}
|
|
160
|
-
const allCleared = obstacles.length > 0 && nodeVerdicts.every(nv => nv.verdict.cleared);
|
|
161
|
-
const deferredCount = nodeVerdicts.filter(nv => nv.verdict.deferred).length;
|
|
162
|
-
return { nodeVerdicts, allCleared, deferredCount };
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=prd-clearance-engine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prd-clearance-engine.js","sourceRoot":"","sources":["../src/prd-clearance-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,4BAA4B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;AAChE,MAAM,eAAe,GAAG,IAAI,CAAC;AA0D7B,8EAA8E;AAC9E,4DAA4D;AAC5D,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAe,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACxD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE;YACrC,GAAG;YACH,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,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