@pellux/goodvibes-sdk 0.37.2 → 0.38.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/contracts/artifacts/operator-contract.json +1 -1
- package/dist/events/communication.d.ts +21 -1
- package/dist/events/communication.d.ts.map +1 -1
- package/dist/platform/agents/message-bus-core.d.ts +7 -0
- package/dist/platform/agents/message-bus-core.d.ts.map +1 -1
- package/dist/platform/agents/message-bus-core.js +2 -1
- package/dist/platform/agents/orchestrator-runner.d.ts +37 -1
- package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator-runner.js +158 -7
- package/dist/platform/agents/orchestrator.d.ts +40 -0
- package/dist/platform/agents/orchestrator.d.ts.map +1 -1
- package/dist/platform/agents/orchestrator.js +29 -0
- package/dist/platform/agents/turn-knowledge-injection.d.ts +107 -0
- package/dist/platform/agents/turn-knowledge-injection.d.ts.map +1 -0
- package/dist/platform/agents/turn-knowledge-injection.js +152 -0
- package/dist/platform/agents/wrfc-controller.d.ts +23 -0
- package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
- package/dist/platform/agents/wrfc-controller.js +55 -0
- package/dist/platform/config/manager.d.ts +9 -0
- package/dist/platform/config/manager.d.ts.map +1 -1
- package/dist/platform/config/manager.js +15 -0
- package/dist/platform/core/adaptive-planner.d.ts +50 -0
- package/dist/platform/core/adaptive-planner.d.ts.map +1 -1
- package/dist/platform/core/adaptive-planner.js +49 -0
- package/dist/platform/core/index.d.ts +1 -0
- package/dist/platform/core/index.d.ts.map +1 -1
- package/dist/platform/core/index.js +1 -0
- package/dist/platform/core/orchestrator-runtime.d.ts +11 -0
- package/dist/platform/core/orchestrator-runtime.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-turn-loop.d.ts +28 -1
- package/dist/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
- package/dist/platform/core/orchestrator-turn-loop.js +115 -3
- package/dist/platform/core/orchestrator.d.ts +61 -0
- package/dist/platform/core/orchestrator.d.ts.map +1 -1
- package/dist/platform/core/orchestrator.js +74 -1
- package/dist/platform/core/plan-proposal.d.ts +165 -0
- package/dist/platform/core/plan-proposal.d.ts.map +1 -0
- package/dist/platform/core/plan-proposal.js +296 -0
- package/dist/platform/knowledge/knowledge-api.d.ts +26 -0
- package/dist/platform/knowledge/knowledge-api.d.ts.map +1 -1
- package/dist/platform/knowledge/knowledge-api.js +11 -0
- package/dist/platform/orchestration/budget.d.ts +22 -0
- package/dist/platform/orchestration/budget.d.ts.map +1 -0
- package/dist/platform/orchestration/budget.js +35 -0
- package/dist/platform/orchestration/cancellation.d.ts +31 -0
- package/dist/platform/orchestration/cancellation.d.ts.map +1 -0
- package/dist/platform/orchestration/cancellation.js +25 -0
- package/dist/platform/orchestration/controller-compat.d.ts +32 -0
- package/dist/platform/orchestration/controller-compat.d.ts.map +1 -0
- package/dist/platform/orchestration/controller-compat.js +13 -0
- package/dist/platform/orchestration/dirty-guard.d.ts +32 -0
- package/dist/platform/orchestration/dirty-guard.d.ts.map +1 -0
- package/dist/platform/orchestration/dirty-guard.js +147 -0
- package/dist/platform/orchestration/engine.d.ts +57 -0
- package/dist/platform/orchestration/engine.d.ts.map +1 -0
- package/dist/platform/orchestration/engine.js +418 -0
- package/dist/platform/orchestration/index.d.ts +18 -0
- package/dist/platform/orchestration/index.d.ts.map +1 -0
- package/dist/platform/orchestration/index.js +10 -0
- package/dist/platform/orchestration/persistence.d.ts +24 -0
- package/dist/platform/orchestration/persistence.d.ts.map +1 -0
- package/dist/platform/orchestration/persistence.js +176 -0
- package/dist/platform/orchestration/phase-runner.d.ts +87 -0
- package/dist/platform/orchestration/phase-runner.d.ts.map +1 -0
- package/dist/platform/orchestration/phase-runner.js +274 -0
- package/dist/platform/orchestration/scheduler.d.ts +45 -0
- package/dist/platform/orchestration/scheduler.d.ts.map +1 -0
- package/dist/platform/orchestration/scheduler.js +57 -0
- package/dist/platform/orchestration/types.d.ts +250 -0
- package/dist/platform/orchestration/types.d.ts.map +1 -0
- package/dist/platform/orchestration/types.js +15 -0
- package/dist/platform/runtime/emitters/communication.d.ts +11 -0
- package/dist/platform/runtime/emitters/communication.d.ts.map +1 -1
- package/dist/platform/runtime/emitters/communication.js +9 -0
- package/dist/platform/runtime/feature-flags/flags.d.ts.map +1 -1
- package/dist/platform/runtime/feature-flags/flags.js +17 -0
- package/dist/platform/runtime/fleet/adapters/agent.d.ts +56 -0
- package/dist/platform/runtime/fleet/adapters/agent.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/agent.js +143 -0
- package/dist/platform/runtime/fleet/adapters/automation.d.ts +30 -0
- package/dist/platform/runtime/fleet/adapters/automation.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/automation.js +41 -0
- package/dist/platform/runtime/fleet/adapters/background-process.d.ts +12 -0
- package/dist/platform/runtime/fleet/adapters/background-process.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/background-process.js +46 -0
- package/dist/platform/runtime/fleet/adapters/code-index.d.ts +21 -0
- package/dist/platform/runtime/fleet/adapters/code-index.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/code-index.js +44 -0
- package/dist/platform/runtime/fleet/adapters/orchestration.d.ts +47 -0
- package/dist/platform/runtime/fleet/adapters/orchestration.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/orchestration.js +225 -0
- package/dist/platform/runtime/fleet/adapters/schedule.d.ts +14 -0
- package/dist/platform/runtime/fleet/adapters/schedule.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/schedule.js +28 -0
- package/dist/platform/runtime/fleet/adapters/trigger.d.ts +12 -0
- package/dist/platform/runtime/fleet/adapters/trigger.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/trigger.js +22 -0
- package/dist/platform/runtime/fleet/adapters/watcher.d.ts +13 -0
- package/dist/platform/runtime/fleet/adapters/watcher.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/watcher.js +47 -0
- package/dist/platform/runtime/fleet/adapters/workflow.d.ts +11 -0
- package/dist/platform/runtime/fleet/adapters/workflow.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/workflow.js +34 -0
- package/dist/platform/runtime/fleet/adapters/wrfc.d.ts +22 -0
- package/dist/platform/runtime/fleet/adapters/wrfc.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/adapters/wrfc.js +228 -0
- package/dist/platform/runtime/fleet/index.d.ts +10 -0
- package/dist/platform/runtime/fleet/index.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/index.js +6 -0
- package/dist/platform/runtime/fleet/registry.d.ts +113 -0
- package/dist/platform/runtime/fleet/registry.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/registry.js +630 -0
- package/dist/platform/runtime/fleet/types.d.ts +199 -0
- package/dist/platform/runtime/fleet/types.d.ts.map +1 -0
- package/dist/platform/runtime/fleet/types.js +2 -0
- package/dist/platform/runtime/runtime-knowledge-api.d.ts +1 -1
- package/dist/platform/runtime/runtime-knowledge-api.d.ts.map +1 -1
- package/dist/platform/runtime/runtime-knowledge-api.js +1 -0
- package/dist/platform/runtime/services.d.ts +46 -0
- package/dist/platform/runtime/services.d.ts.map +1 -1
- package/dist/platform/runtime/services.js +78 -0
- package/dist/platform/state/code-index-chunking.d.ts +49 -0
- package/dist/platform/state/code-index-chunking.d.ts.map +1 -0
- package/dist/platform/state/code-index-chunking.js +111 -0
- package/dist/platform/state/code-index-db.d.ts +53 -0
- package/dist/platform/state/code-index-db.d.ts.map +1 -0
- package/dist/platform/state/code-index-db.js +101 -0
- package/dist/platform/state/code-index-store.d.ts +175 -0
- package/dist/platform/state/code-index-store.d.ts.map +1 -0
- package/dist/platform/state/code-index-store.js +612 -0
- package/dist/platform/state/index.d.ts +4 -2
- package/dist/platform/state/index.d.ts.map +1 -1
- package/dist/platform/state/index.js +2 -1
- package/dist/platform/state/knowledge-injection.d.ts +23 -0
- package/dist/platform/state/knowledge-injection.d.ts.map +1 -1
- package/dist/platform/state/knowledge-injection.js +34 -19
- package/dist/platform/state/memory-vector-store.d.ts +1 -13
- package/dist/platform/state/memory-vector-store.d.ts.map +1 -1
- package/dist/platform/state/memory-vector-store.js +6 -38
- package/dist/platform/state/sqlite-vec-loader.d.ts +25 -0
- package/dist/platform/state/sqlite-vec-loader.d.ts.map +1 -0
- package/dist/platform/state/sqlite-vec-loader.js +43 -0
- package/dist/platform/tools/agent/manager.d.ts +128 -1
- package/dist/platform/tools/agent/manager.d.ts.map +1 -1
- package/dist/platform/tools/agent/manager.js +137 -1
- package/dist/platform/tools/exec/runtime.d.ts.map +1 -1
- package/dist/platform/tools/exec/runtime.js +139 -44
- package/dist/platform/tools/exec/schema.d.ts +2 -0
- package/dist/platform/tools/exec/schema.d.ts.map +1 -1
- package/dist/platform/tools/fetch/runtime.d.ts +7 -0
- package/dist/platform/tools/fetch/runtime.d.ts.map +1 -1
- package/dist/platform/tools/fetch/runtime.js +8 -6
- package/dist/platform/tools/registry.d.ts +9 -3
- package/dist/platform/tools/registry.d.ts.map +1 -1
- package/dist/platform/tools/registry.js +9 -3
- package/dist/platform/types/tools.d.ts +14 -1
- package/dist/platform/types/tools.d.ts.map +1 -1
- package/dist/platform/version.js +1 -1
- package/package.json +17 -9
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan proposal types + pure assembler.
|
|
3
|
+
*
|
|
4
|
+
* This module turns a loose decomposition (produced by an LLM planning agent,
|
|
5
|
+
* or handed in directly by a caller) into a validated, typed `PlanProposal`.
|
|
6
|
+
* It is intentionally free of I/O and LLM calls: no filesystem access, no
|
|
7
|
+
* agent spawning, no network. It exists so `AdaptivePlanner` can stay a
|
|
8
|
+
* synchronous, deterministic, side-effect-free scorer while still producing
|
|
9
|
+
* a rich, structured artifact that an orchestration engine can render for
|
|
10
|
+
* human approval and (once approved) instantiate.
|
|
11
|
+
*
|
|
12
|
+
* A `PlanProposal` is DATA. It is never instantiated on its own — approval
|
|
13
|
+
* flows through the existing `ProjectPlanningState.executionApproved` gate
|
|
14
|
+
* (see `planProposalToPlanningState` below), and durable persistence reuses
|
|
15
|
+
* `ExecutionPlanManager` (see `planProposalToExecutionPlanItems` below).
|
|
16
|
+
* Neither adapter performs any I/O itself; they only shape data for callers
|
|
17
|
+
* that do.
|
|
18
|
+
*/
|
|
19
|
+
import { randomUUID } from 'node:crypto';
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Helpers
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
24
|
+
function normalizeKey(value) {
|
|
25
|
+
return value.toLowerCase().trim();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Detect dependency cycles in a resolved work-item graph without ever
|
|
29
|
+
* looping forever: each id is visited at most once per traversal state
|
|
30
|
+
* (`visiting` blocks re-entry into an in-progress path; `done` short-circuits
|
|
31
|
+
* repeat visits from other roots).
|
|
32
|
+
*/
|
|
33
|
+
function detectCycleTitles(workItems) {
|
|
34
|
+
const byId = new Map(workItems.map((item) => [item.id, item]));
|
|
35
|
+
const state = new Map();
|
|
36
|
+
const cyclic = new Set();
|
|
37
|
+
const visit = (id, stack) => {
|
|
38
|
+
const current = state.get(id);
|
|
39
|
+
if (current === 'done')
|
|
40
|
+
return;
|
|
41
|
+
if (current === 'visiting') {
|
|
42
|
+
const cycleStart = stack.indexOf(id);
|
|
43
|
+
const cycle = cycleStart === -1 ? stack : stack.slice(cycleStart);
|
|
44
|
+
for (const cycleId of cycle)
|
|
45
|
+
cyclic.add(cycleId);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
state.set(id, 'visiting');
|
|
49
|
+
const item = byId.get(id);
|
|
50
|
+
if (item) {
|
|
51
|
+
for (const dep of item.dependsOn) {
|
|
52
|
+
visit(dep, [...stack, id]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
state.set(id, 'done');
|
|
56
|
+
};
|
|
57
|
+
for (const item of workItems)
|
|
58
|
+
visit(item.id, []);
|
|
59
|
+
return workItems.filter((item) => cyclic.has(item.id)).map((item) => item.title);
|
|
60
|
+
}
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// Assembler
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
/**
|
|
65
|
+
* Turn a raw decomposition into a validated, typed `PlanProposal`.
|
|
66
|
+
*
|
|
67
|
+
* Never throws. Malformed input degrades to an honest partial result: an
|
|
68
|
+
* unresolved phase reference lands its work item in a synthesized "Unphased"
|
|
69
|
+
* bucket; an unresolved dependency reference is dropped; a dependency cycle
|
|
70
|
+
* is flagged but left in place (no silent edge removal). Every problem is
|
|
71
|
+
* reported via the returned `issues` list rather than an exception.
|
|
72
|
+
*
|
|
73
|
+
* Dependency resolution mirrors `ExecutionPlanManager.replaceItems` exactly:
|
|
74
|
+
* a dep that already looks like a UUID passes through unchecked, otherwise
|
|
75
|
+
* it is resolved by case-insensitive title match, otherwise it is dropped.
|
|
76
|
+
*
|
|
77
|
+
* `source` defaults to `'planner-agent'` (the expected majority caller —
|
|
78
|
+
* `AdaptivePlanner.proposeWorkstream`). Pass `'caller-supplied'` when a
|
|
79
|
+
* non-agent caller hands in its own decomposition directly.
|
|
80
|
+
*/
|
|
81
|
+
export function assemblePlanProposal(task, strategy, raw, source = 'planner-agent') {
|
|
82
|
+
const issues = [];
|
|
83
|
+
// Pass 1: assign phase ids + stable order, index by normalized title.
|
|
84
|
+
const phaseByTitle = new Map();
|
|
85
|
+
const phases = raw.phases.map((rawPhase, index) => {
|
|
86
|
+
const phase = {
|
|
87
|
+
id: randomUUID(),
|
|
88
|
+
title: rawPhase.title,
|
|
89
|
+
order: index,
|
|
90
|
+
...(rawPhase.description ? { description: rawPhase.description } : {}),
|
|
91
|
+
};
|
|
92
|
+
phaseByTitle.set(normalizeKey(rawPhase.title), phase);
|
|
93
|
+
return phase;
|
|
94
|
+
});
|
|
95
|
+
let unphased = null;
|
|
96
|
+
const resolvePhaseId = (title) => {
|
|
97
|
+
const found = phaseByTitle.get(normalizeKey(title));
|
|
98
|
+
if (found)
|
|
99
|
+
return { id: found.id, matched: true };
|
|
100
|
+
if (!unphased) {
|
|
101
|
+
unphased = { id: randomUUID(), title: 'Unphased', order: phases.length };
|
|
102
|
+
phases.push(unphased);
|
|
103
|
+
}
|
|
104
|
+
return { id: unphased.id, matched: false };
|
|
105
|
+
};
|
|
106
|
+
// Pass 2: assign work-item ids, index by normalized title (for dep resolution).
|
|
107
|
+
const idByTitle = new Map();
|
|
108
|
+
const provisional = raw.workItems.map((rawItem) => {
|
|
109
|
+
const id = randomUUID();
|
|
110
|
+
idByTitle.set(normalizeKey(rawItem.title), id);
|
|
111
|
+
return { id, rawItem };
|
|
112
|
+
});
|
|
113
|
+
const workItems = provisional.map(({ id, rawItem }) => {
|
|
114
|
+
const { id: phaseId, matched } = resolvePhaseId(rawItem.phase);
|
|
115
|
+
if (!matched) {
|
|
116
|
+
issues.push({
|
|
117
|
+
kind: 'unresolved-phase',
|
|
118
|
+
workItemTitle: rawItem.title,
|
|
119
|
+
message: `Work item "${rawItem.title}" referenced unknown phase "${rawItem.phase}"; placed in "Unphased".`,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
id,
|
|
124
|
+
title: rawItem.title,
|
|
125
|
+
brief: rawItem.brief,
|
|
126
|
+
phaseId,
|
|
127
|
+
dependsOn: [],
|
|
128
|
+
...(rawItem.suggestedArchetype ? { suggestedArchetype: rawItem.suggestedArchetype } : {}),
|
|
129
|
+
...(rawItem.likelyFiles ? { likelyFiles: rawItem.likelyFiles } : {}),
|
|
130
|
+
...(rawItem.verification ? { verification: rawItem.verification } : {}),
|
|
131
|
+
...(rawItem.canRunConcurrently !== undefined ? { canRunConcurrently: rawItem.canRunConcurrently } : {}),
|
|
132
|
+
...(rawItem.needsReview !== undefined ? { needsReview: rawItem.needsReview } : {}),
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
// Pass 3: resolve dependsOn — UUID passthrough, else case-insensitive title lookup, else drop.
|
|
136
|
+
for (let i = 0; i < workItems.length; i++) {
|
|
137
|
+
const rawDeps = raw.workItems[i]?.dependsOn;
|
|
138
|
+
if (!rawDeps || rawDeps.length === 0)
|
|
139
|
+
continue;
|
|
140
|
+
const item = workItems[i];
|
|
141
|
+
const resolved = [];
|
|
142
|
+
for (const dep of rawDeps) {
|
|
143
|
+
if (UUID_RE.test(dep)) {
|
|
144
|
+
resolved.push(dep);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const depId = idByTitle.get(normalizeKey(dep));
|
|
148
|
+
if (depId) {
|
|
149
|
+
resolved.push(depId);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
issues.push({
|
|
153
|
+
kind: 'dangling-dependency',
|
|
154
|
+
workItemTitle: item.title,
|
|
155
|
+
message: `Work item "${item.title}" depends on unresolved item "${dep}"; dependency dropped.`,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
item.dependsOn = resolved;
|
|
160
|
+
}
|
|
161
|
+
// Pass 4: flag (do not silently fix) dependency cycles.
|
|
162
|
+
for (const title of detectCycleTitles(workItems)) {
|
|
163
|
+
issues.push({
|
|
164
|
+
kind: 'dependency-cycle',
|
|
165
|
+
workItemTitle: title,
|
|
166
|
+
message: `Work item "${title}" is part of a dependency cycle.`,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
const proposal = {
|
|
170
|
+
id: randomUUID(),
|
|
171
|
+
task,
|
|
172
|
+
strategy,
|
|
173
|
+
rationale: `Decomposed "${task}" into ${phases.length} phase(s) and ${workItems.length} work item(s) for ${strategy} execution.`,
|
|
174
|
+
phases,
|
|
175
|
+
workItems,
|
|
176
|
+
createdAt: Date.now(),
|
|
177
|
+
source,
|
|
178
|
+
};
|
|
179
|
+
return { proposal, issues };
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The honest fallback: one phase ("Execute"), one work item whose title and
|
|
183
|
+
* brief both equal the task text, no dependencies. Used whenever decomposition
|
|
184
|
+
* was not warranted (see `AdaptivePlanner.shouldDecompose`) or no raw
|
|
185
|
+
* decomposition is available yet.
|
|
186
|
+
*/
|
|
187
|
+
export function singleItemProposal(task) {
|
|
188
|
+
const phaseId = randomUUID();
|
|
189
|
+
return {
|
|
190
|
+
id: randomUUID(),
|
|
191
|
+
task,
|
|
192
|
+
strategy: 'single',
|
|
193
|
+
rationale: `No decomposition applied; running "${task}" as a single work item.`,
|
|
194
|
+
phases: [{ id: phaseId, title: 'Execute', order: 0 }],
|
|
195
|
+
workItems: [{
|
|
196
|
+
id: randomUUID(),
|
|
197
|
+
title: task,
|
|
198
|
+
brief: task,
|
|
199
|
+
phaseId,
|
|
200
|
+
dependsOn: [],
|
|
201
|
+
}],
|
|
202
|
+
createdAt: Date.now(),
|
|
203
|
+
source: 'single-item-fallback',
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
// ---------------------------------------------------------------------------
|
|
207
|
+
// Approval-seam adapter: PlanProposal -> ProjectPlanningState
|
|
208
|
+
// ---------------------------------------------------------------------------
|
|
209
|
+
/**
|
|
210
|
+
* Project a `PlanProposal` into the existing `/plan approve` seam. This is
|
|
211
|
+
* data-only — no store is written here. The caller feeds the result into
|
|
212
|
+
* `ProjectPlanningService.upsertState` (or an equivalent), which is what
|
|
213
|
+
* actually persists it and evaluates readiness.
|
|
214
|
+
*
|
|
215
|
+
* Direction convention for the emitted `ProjectPlanningDependency` records
|
|
216
|
+
* (this type has no prior producer in the codebase to inherit a convention
|
|
217
|
+
* from, so it is fixed here): `fromTaskId` depends on `toTaskId`, i.e. the
|
|
218
|
+
* edge reads "fromTaskId depends on toTaskId" the same way `WorkItem.dependsOn`
|
|
219
|
+
* reads "this item depends on these ids".
|
|
220
|
+
*
|
|
221
|
+
* `ProjectPlanningTask` has no first-class phase concept, so phase
|
|
222
|
+
* membership is preserved in `metadata` rather than dropped silently.
|
|
223
|
+
*
|
|
224
|
+
* `executionApproved` is always `false` here — approval is a separate,
|
|
225
|
+
* explicit step owned by `/plan approve` (planning-runtime.ts), never implied
|
|
226
|
+
* by proposing.
|
|
227
|
+
*/
|
|
228
|
+
export function planProposalToPlanningState(proposal) {
|
|
229
|
+
const phaseTitleById = new Map(proposal.phases.map((phase) => [phase.id, phase.title]));
|
|
230
|
+
const tasks = proposal.workItems.map((item) => ({
|
|
231
|
+
id: item.id,
|
|
232
|
+
title: item.title,
|
|
233
|
+
why: item.brief,
|
|
234
|
+
status: 'pending',
|
|
235
|
+
...(item.dependsOn.length > 0 ? { dependencies: item.dependsOn } : {}),
|
|
236
|
+
...(item.likelyFiles ? { likelyFiles: item.likelyFiles } : {}),
|
|
237
|
+
...(item.verification ? { verification: item.verification } : {}),
|
|
238
|
+
...(item.canRunConcurrently !== undefined ? { canRunConcurrently: item.canRunConcurrently } : {}),
|
|
239
|
+
...(item.needsReview !== undefined ? { needsReview: item.needsReview } : {}),
|
|
240
|
+
...(item.suggestedArchetype ? { recommendedAgent: item.suggestedArchetype } : {}),
|
|
241
|
+
metadata: {
|
|
242
|
+
phaseId: item.phaseId,
|
|
243
|
+
...(phaseTitleById.has(item.phaseId) ? { phaseTitle: phaseTitleById.get(item.phaseId) } : {}),
|
|
244
|
+
},
|
|
245
|
+
}));
|
|
246
|
+
const dependencies = proposal.workItems.flatMap((item) => item.dependsOn.map((toTaskId) => ({ fromTaskId: item.id, toTaskId })));
|
|
247
|
+
const scope = proposal.phases.length > 0
|
|
248
|
+
? `Phases: ${proposal.phases.map((phase) => phase.title).join(', ')}`
|
|
249
|
+
: undefined;
|
|
250
|
+
return {
|
|
251
|
+
goal: proposal.task,
|
|
252
|
+
...(scope ? { scope } : {}),
|
|
253
|
+
...(proposal.rationale ? { assumptions: [proposal.rationale] } : {}),
|
|
254
|
+
tasks,
|
|
255
|
+
dependencies,
|
|
256
|
+
executionApproved: false,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
// ---------------------------------------------------------------------------
|
|
260
|
+
// Persistence adapter: PlanProposal -> ExecutionPlanManager's PlanItem shape
|
|
261
|
+
// ---------------------------------------------------------------------------
|
|
262
|
+
/**
|
|
263
|
+
* Project a `PlanProposal` into the plain items `ExecutionPlanManager` deals
|
|
264
|
+
* in. This is a deliberately lossy projection: `PlanItem` has no room for
|
|
265
|
+
* verification/likelyFiles/suggestedArchetype, and those stay in the
|
|
266
|
+
* full-fidelity `ProjectPlanningState` render above. It exists purely so a
|
|
267
|
+
* caller can hand a proposal's items to `ExecutionPlanManager` without
|
|
268
|
+
* re-deriving the phase/description/dependency shape by hand.
|
|
269
|
+
*
|
|
270
|
+
* Dependencies are expressed as WORK ITEM TITLES, not ids, because
|
|
271
|
+
* `ExecutionPlanManager.create()` does not resolve dependency references —
|
|
272
|
+
* only `ExecutionPlanManager.replaceItems()` does, by case-insensitive
|
|
273
|
+
* description match. The intended call sequence at instantiation is
|
|
274
|
+
* therefore:
|
|
275
|
+
*
|
|
276
|
+
* const plan = planManager.create(title, []);
|
|
277
|
+
* const { items } = planProposalToExecutionPlanItems(proposal);
|
|
278
|
+
* planManager.replaceItems(plan.id, items);
|
|
279
|
+
*
|
|
280
|
+
* which reuses `replaceItems`' existing dependency resolver end-to-end
|
|
281
|
+
* instead of re-implementing dependency resolution here. This module defines
|
|
282
|
+
* no scheduler of its own — ready-to-run item selection stays
|
|
283
|
+
* `ExecutionPlanManager.getNextItems`'s job.
|
|
284
|
+
*/
|
|
285
|
+
export function planProposalToExecutionPlanItems(proposal) {
|
|
286
|
+
const phaseTitleById = new Map(proposal.phases.map((phase) => [phase.id, phase.title]));
|
|
287
|
+
const titleById = new Map(proposal.workItems.map((item) => [item.id, item.title]));
|
|
288
|
+
const items = proposal.workItems.map((item) => ({
|
|
289
|
+
phase: phaseTitleById.get(item.phaseId) ?? 'Unphased',
|
|
290
|
+
description: item.title,
|
|
291
|
+
...(item.dependsOn.length > 0
|
|
292
|
+
? { dependencies: item.dependsOn.map((depId) => titleById.get(depId) ?? depId) }
|
|
293
|
+
: {}),
|
|
294
|
+
}));
|
|
295
|
+
return { title: proposal.task, items };
|
|
296
|
+
}
|
|
@@ -4,6 +4,7 @@ import { type KnowledgeInjection } from '../state/knowledge-injection.js';
|
|
|
4
4
|
import type { MemoryAddOptions, MemoryBundle, MemoryDoctorReport, MemoryImportResult, MemoryLink, MemoryRecord, MemoryReviewPatch, MemoryScope, MemorySearchFilter, MemorySemanticSearchResult } from '../state/memory-store.js';
|
|
5
5
|
import type { MemoryVectorStats } from '../state/memory-vector-store.js';
|
|
6
6
|
import type { MemoryRegistry } from '../state/memory-registry.js';
|
|
7
|
+
import type { CodeChunkMode, CodeContextResult, CodeIndexBuildStats, CodeIndexStats, CodeIndexStore } from '../state/code-index-store.js';
|
|
7
8
|
export type { ArtifactFetchMode } from '../artifacts/types.js';
|
|
8
9
|
export type { KnowledgeInjection, } from '../state/knowledge-injection.js';
|
|
9
10
|
export type { KnowledgeInjectionIngestMode, KnowledgeInjectionProvenance, KnowledgeInjectionRetention, KnowledgeInjectionTrustTier, KnowledgeInjectionUseAs, } from './shared.js';
|
|
@@ -72,8 +73,31 @@ export interface MemoryApi {
|
|
|
72
73
|
explain(task: string, writeScope?: readonly string[], limit?: number): MemoryExplainResult;
|
|
73
74
|
}
|
|
74
75
|
export type MemoryApiRegistry = Pick<MemoryRegistry, 'add' | 'doctor' | 'delete' | 'exportBundle' | 'get' | 'getAll' | 'importBundle' | 'link' | 'linksFor' | 'rebuildVectors' | 'rebuildVectorsAsync' | 'review' | 'reviewQueue' | 'search' | 'searchSemantic' | 'update' | 'vectorStats'>;
|
|
76
|
+
/**
|
|
77
|
+
* memory-api-parallel query surface for the repo source-tree code index
|
|
78
|
+
* (Wave-5 wo802, W5.3 Stage A). Deliberately NOT folded into MemoryApi:
|
|
79
|
+
* CodeContextResult/CodeIndexStats are a different record shape than
|
|
80
|
+
* MemoryRecord, and code-index retrieval carries no cls/reviewState/trustTier
|
|
81
|
+
* provenance semantics — see createCodeIndexApi / createMemoryApi below.
|
|
82
|
+
*/
|
|
83
|
+
export interface CodeIndexApi {
|
|
84
|
+
search(query: string, opts?: {
|
|
85
|
+
limit?: number;
|
|
86
|
+
}): readonly CodeContextResult[];
|
|
87
|
+
stats(): CodeIndexStats;
|
|
88
|
+
reindex(): Promise<CodeIndexBuildStats>;
|
|
89
|
+
scheduleReindex(): void;
|
|
90
|
+
reindexFile(absPath: string): Promise<{
|
|
91
|
+
indexed: boolean;
|
|
92
|
+
mode: CodeChunkMode;
|
|
93
|
+
}>;
|
|
94
|
+
/** Stated once, honest: why auto-retrieval would be absent right now (no semantic embedding provider). Null when available. */
|
|
95
|
+
describeDegradation(): string | null;
|
|
96
|
+
}
|
|
97
|
+
export type CodeIndexApiRegistry = Pick<CodeIndexStore, 'search' | 'stats' | 'buildFull' | 'scheduleBuild' | 'reindexFile' | 'describeDegradation'>;
|
|
75
98
|
export interface CreateKnowledgeApiOptions {
|
|
76
99
|
readonly memoryRegistry?: MemoryApiRegistry | undefined;
|
|
100
|
+
readonly codeIndexStore?: CodeIndexApiRegistry | undefined;
|
|
77
101
|
}
|
|
78
102
|
export interface KnowledgeApi {
|
|
79
103
|
readonly status: {
|
|
@@ -160,7 +184,9 @@ export interface KnowledgeApi {
|
|
|
160
184
|
decide(candidateId: string, decision: ConsolidationDecision, input?: ConsolidationDecisionInput): ReturnType<KnowledgeService['decideConsolidationCandidate']>;
|
|
161
185
|
};
|
|
162
186
|
readonly memory?: MemoryApi | undefined;
|
|
187
|
+
readonly codeIndex?: CodeIndexApi | undefined;
|
|
163
188
|
}
|
|
164
189
|
export declare function createMemoryApi(memoryRegistry: MemoryApiRegistry): MemoryApi;
|
|
190
|
+
export declare function createCodeIndexApi(codeIndexStore: CodeIndexApiRegistry): CodeIndexApi;
|
|
165
191
|
export declare function createKnowledgeApi(knowledgeService: KnowledgeService, options?: CreateKnowledgeApiOptions): KnowledgeApi;
|
|
166
192
|
//# sourceMappingURL=knowledge-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge-api.d.ts","sourceRoot":"","sources":["../../../src/platform/knowledge/knowledge-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,0BAA0B,EAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,YAAY,EACV,kBAAkB,GACnB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,4BAA4B,EAC5B,4BAA4B,EAC5B,2BAA2B,EAC3B,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAErB,KAAK,cAAc,GAAG,UAAU,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,KAAK,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxE,KAAK,cAAc,GAAG,UAAU,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,KAAK,eAAe,GAAG,UAAU,CAAC,gBAAgB,CA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AAC,EAAE,MAAM,GAAG,UAAU,CAAC,gBAAgB,CAAC,0BAA0B,CAAC,CAAC,CAAC;QAClF,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC,CAAC;QAC9E,MAAM,CACJ,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,qBAAqB,EAC/B,KAAK,CAAC,EAAE,0BAA0B,GACjC,UAAU,CAAC,gBAAgB,CAAC,8BAA8B,CAAC,CAAC,CAAC;KACjE,CAAC;IACF,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,SAAS,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CAC/C;AAgCD,wBAAgB,eAAe,CAAC,cAAc,EAAE,iBAAiB,GAAG,SAAS,CA6B5E;AAED,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,oBAAoB,GAAG,YAAY,CASrF;AAED,wBAAgB,kBAAkB,CAChC,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,GAAE,yBAA8B,GACtC,YAAY,CAwId"}
|
|
@@ -50,6 +50,16 @@ export function createMemoryApi(memoryRegistry) {
|
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
+
export function createCodeIndexApi(codeIndexStore) {
|
|
54
|
+
return Object.freeze({
|
|
55
|
+
search: (query, opts = {}) => codeIndexStore.search(query, opts),
|
|
56
|
+
stats: () => codeIndexStore.stats(),
|
|
57
|
+
reindex: () => codeIndexStore.buildFull(),
|
|
58
|
+
scheduleReindex: () => codeIndexStore.scheduleBuild(),
|
|
59
|
+
reindexFile: (absPath) => codeIndexStore.reindexFile(absPath),
|
|
60
|
+
describeDegradation: () => codeIndexStore.describeDegradation(),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
53
63
|
export function createKnowledgeApi(knowledgeService, options = {}) {
|
|
54
64
|
return Object.freeze({
|
|
55
65
|
status: Object.freeze({
|
|
@@ -144,5 +154,6 @@ export function createKnowledgeApi(knowledgeService, options = {}) {
|
|
|
144
154
|
decide: (candidateId, decision, input = {}) => knowledgeService.decideConsolidationCandidate(candidateId, decision, input),
|
|
145
155
|
}),
|
|
146
156
|
...(options.memoryRegistry ? { memory: createMemoryApi(options.memoryRegistry) } : {}),
|
|
157
|
+
...(options.codeIndexStore ? { codeIndex: createCodeIndexApi(options.codeIndexStore) } : {}),
|
|
147
158
|
});
|
|
148
159
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
/**
|
|
3
|
+
* Budget enforcement (Wave 4, wo701). Enforcement point is BEFORE the
|
|
4
|
+
* scheduler claims an item into a new phase (i.e. before a new agent spawn)
|
|
5
|
+
* — never mid-item. An in-flight item's phase always runs to completion even
|
|
6
|
+
* if a later check here would refuse a NEW claim: honest semantics, never a
|
|
7
|
+
* mid-run kill on budget (see design doc (e)).
|
|
8
|
+
*
|
|
9
|
+
* Usage is summed directly from WorkItem.usage, which phase-runner.ts
|
|
10
|
+
* populates from the SAME `priceUsage` function threaded through
|
|
11
|
+
* OrchestrationEngineDeps — the single cost source shared with the fleet
|
|
12
|
+
* registry (registry.ts ProcessRegistryDeps.priceUsage), so budget checks and
|
|
13
|
+
* fleet cost totals can never double-count against each other.
|
|
14
|
+
*/
|
|
15
|
+
import type { Workstream } from './types.js';
|
|
16
|
+
export interface BudgetCheck {
|
|
17
|
+
readonly allowed: boolean;
|
|
18
|
+
readonly reason?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
/** Refuses a NEW claim once the workstream's running total has reached its ceiling. Never mid-item. */
|
|
21
|
+
export declare function checkBudget(workstream: Workstream): BudgetCheck;
|
|
22
|
+
//# sourceMappingURL=budget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"budget.d.ts","sourceRoot":"","sources":["../../../src/platform/orchestration/budget.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC;AAmBD,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,WAAW,CAmB/D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
function totalTokens(workstream) {
|
|
3
|
+
return workstream.items.reduce((sum, item) => sum + item.usage.inputTokens + item.usage.outputTokens, 0);
|
|
4
|
+
}
|
|
5
|
+
/** Sum of every item's costUsd that IS priced. Returns null when nothing is priced yet (never a fabricated zero). */
|
|
6
|
+
function totalCostUsd(workstream) {
|
|
7
|
+
let total = 0;
|
|
8
|
+
let sawPriced = false;
|
|
9
|
+
for (const item of workstream.items) {
|
|
10
|
+
if (item.usage.costUsd !== null) {
|
|
11
|
+
total += item.usage.costUsd;
|
|
12
|
+
sawPriced = true;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return sawPriced ? total : null;
|
|
16
|
+
}
|
|
17
|
+
/** Refuses a NEW claim once the workstream's running total has reached its ceiling. Never mid-item. */
|
|
18
|
+
export function checkBudget(workstream) {
|
|
19
|
+
const budget = workstream.budget;
|
|
20
|
+
if (!budget)
|
|
21
|
+
return { allowed: true };
|
|
22
|
+
if (budget.maxTokens !== undefined) {
|
|
23
|
+
const tokens = totalTokens(workstream);
|
|
24
|
+
if (tokens >= budget.maxTokens) {
|
|
25
|
+
return { allowed: false, reason: `workstream token usage (${tokens}) has reached the ${budget.maxTokens}-token ceiling` };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (budget.maxCostUsd !== undefined) {
|
|
29
|
+
const cost = totalCostUsd(workstream);
|
|
30
|
+
if (cost !== null && cost >= budget.maxCostUsd) {
|
|
31
|
+
return { allowed: false, reason: `workstream cost ($${cost.toFixed(4)}) has reached the $${budget.maxCostUsd} ceiling` };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { allowed: true };
|
|
35
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
/**
|
|
3
|
+
* Per-work-item cancellation registry (Wave 4, wo701) — the deferred W0.1
|
|
4
|
+
* cooperative-cancellation piece.
|
|
5
|
+
*
|
|
6
|
+
* One AbortController per in-flight WorkItem. `engine.kill(itemId)` aborts
|
|
7
|
+
* the controller here AND calls `agentManager.cancel(agentId, 'kill')` — the
|
|
8
|
+
* same mechanism every agent in the system already uses to stop at its next
|
|
9
|
+
* turn boundary (orchestrator-runner.ts's `record.status === 'cancelled'`
|
|
10
|
+
* poll). That covers "no orphaned AGENT" unconditionally.
|
|
11
|
+
*
|
|
12
|
+
* The AbortSignal this registry hands out is ALSO registered on AgentManager
|
|
13
|
+
* (registerCancellationSignal) so opted-in tools (exec, fetch) can abort an
|
|
14
|
+
* in-flight child process/request immediately instead of waiting for that
|
|
15
|
+
* turn boundary — see AgentManager.getCancellationSignal /
|
|
16
|
+
* AgentOrchestrator.setCancellationSource / orchestrator-runner.ts's
|
|
17
|
+
* `context.getCancellationSignal?.(record.id)` threaded into
|
|
18
|
+
* `toolRegistry.execute` opts.
|
|
19
|
+
*/
|
|
20
|
+
export interface CancellationRegistry {
|
|
21
|
+
/** Create (replacing any prior registration) the controller for a work item and return its signal. */
|
|
22
|
+
start(itemId: string): AbortSignal;
|
|
23
|
+
/** Abort the item's controller, if one is registered. Returns false when nothing was registered (already terminal, or never started). */
|
|
24
|
+
abort(itemId: string): boolean;
|
|
25
|
+
/** Drop the registration once the item's phase run has ended (success, failure, or cancel). Safe to call unconditionally. */
|
|
26
|
+
release(itemId: string): void;
|
|
27
|
+
/** True when this item currently has a live (non-aborted) registration. */
|
|
28
|
+
isActive(itemId: string): boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function createCancellationRegistry(): CancellationRegistry;
|
|
31
|
+
//# sourceMappingURL=cancellation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancellation.d.ts","sourceRoot":"","sources":["../../../src/platform/orchestration/cancellation.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,oBAAoB;IACnC,sGAAsG;IACtG,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;IACnC,yIAAyI;IACzI,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,6HAA6H;IAC7H,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC;AAED,wBAAgB,0BAA0B,IAAI,oBAAoB,CA2BjE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
export function createCancellationRegistry() {
|
|
3
|
+
const controllers = new Map();
|
|
4
|
+
function start(itemId) {
|
|
5
|
+
controllers.get(itemId)?.abort();
|
|
6
|
+
const controller = new AbortController();
|
|
7
|
+
controllers.set(itemId, controller);
|
|
8
|
+
return controller.signal;
|
|
9
|
+
}
|
|
10
|
+
function abort(itemId) {
|
|
11
|
+
const controller = controllers.get(itemId);
|
|
12
|
+
if (!controller)
|
|
13
|
+
return false;
|
|
14
|
+
controller.abort();
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
function release(itemId) {
|
|
18
|
+
controllers.delete(itemId);
|
|
19
|
+
}
|
|
20
|
+
function isActive(itemId) {
|
|
21
|
+
const controller = controllers.get(itemId);
|
|
22
|
+
return controller !== undefined && !controller.signal.aborted;
|
|
23
|
+
}
|
|
24
|
+
return { start, abort, release, isActive };
|
|
25
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
/**
|
|
3
|
+
* Controller-compat (Wave 4, wo701) — stage 1 of the 3-stage WrfcController
|
|
4
|
+
* migration (see design doc (g) and the work-order report's design-
|
|
5
|
+
* divergences section).
|
|
6
|
+
*
|
|
7
|
+
* `fromChainSpec()` produces the canned two-phase engineer->review
|
|
8
|
+
* WORKSTREAM SPEC that a `WrfcController.createChain(ownerRecord)` call
|
|
9
|
+
* would otherwise start — a NEW opt-in surface for callers that want the
|
|
10
|
+
* engine-backed pipeline. It returns a `CreateWorkstreamInput` (a spec), not
|
|
11
|
+
* a live `Workstream`: realizing one (generated ids, initialized item
|
|
12
|
+
* state) is the engine's own responsibility via
|
|
13
|
+
* `engine.createWorkstream(fromChainSpec(...))`, mirroring how the type
|
|
14
|
+
* model already separates PhaseSpec/WorkItemSpec (input) from Phase/WorkItem
|
|
15
|
+
* (engine-owned state).
|
|
16
|
+
*
|
|
17
|
+
* STAGE 1 (this wave, unchanged): WrfcController itself is NOT touched.
|
|
18
|
+
* spawn-forced-wrfc, /teamwork, and archetypes all keep hitting
|
|
19
|
+
* WrfcController.createChain via AgentManager.manager.ts:565 exactly as
|
|
20
|
+
* before. This function is additive only.
|
|
21
|
+
* STAGE 2 (later, feature-flagged): WrfcController.createChain internally
|
|
22
|
+
* builds a workstream via this same helper and delegates execution to the
|
|
23
|
+
* engine — the public seam (createChain's signature and the three entry
|
|
24
|
+
* points) stays byte-for-byte unchanged.
|
|
25
|
+
* STAGE 3 (future wave): retire the standalone WrfcController state machine
|
|
26
|
+
* once parity is proven.
|
|
27
|
+
*/
|
|
28
|
+
import type { AgentRecord } from '../tools/agent/manager.js';
|
|
29
|
+
import type { ConfigManager } from '../config/manager.js';
|
|
30
|
+
import type { CreateWorkstreamInput } from './engine.js';
|
|
31
|
+
export declare function fromChainSpec(ownerRecord: Pick<AgentRecord, 'id' | 'task'>, configManager: Pick<ConfigManager, 'get' | 'getCategory'>): CreateWorkstreamInput;
|
|
32
|
+
//# sourceMappingURL=controller-compat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller-compat.d.ts","sourceRoot":"","sources":["../../../src/platform/orchestration/controller-compat.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,wBAAgB,aAAa,CAC3B,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC,EAC7C,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,aAAa,CAAC,GACxD,qBAAqB,CAUvB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
import { getWrfcCommitScope } from '../agents/wrfc-config.js';
|
|
3
|
+
export function fromChainSpec(ownerRecord, configManager) {
|
|
4
|
+
const commitScope = getWrfcCommitScope(configManager);
|
|
5
|
+
return {
|
|
6
|
+
title: ownerRecord.task,
|
|
7
|
+
items: [{ id: ownerRecord.id, title: ownerRecord.task, task: ownerRecord.task }],
|
|
8
|
+
phases: [
|
|
9
|
+
{ role: 'engineer', capacity: 1, kind: 'engineer', gate: { scope: commitScope, gates: [] } },
|
|
10
|
+
{ role: 'reviewer', capacity: 1, kind: 'review', gate: { scope: commitScope, gates: [] } },
|
|
11
|
+
],
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
/** Content hash of a file's current working-tree bytes. Binary-safe (raw bytes, not text). Returns null when the path does not exist on disk (a working-tree deletion). */
|
|
3
|
+
export declare function hashWorkingTreeFile(cwd: string, relativePath: string): string | null;
|
|
4
|
+
/** path -> content hash at launch (null = the dirty path did not exist on disk, e.g. an unstaged deletion). */
|
|
5
|
+
export type DirtyLaunchSnapshot = ReadonlyMap<string, string | null>;
|
|
6
|
+
/**
|
|
7
|
+
* Snapshot every dirty path (staged + unstaged + untracked) in `cwd`'s
|
|
8
|
+
* working tree right now, each with a content hash. Call once at engine
|
|
9
|
+
* launch, before any phase of this run has had a chance to touch anything.
|
|
10
|
+
* Never throws: a git failure (e.g. `cwd` is not a repo) degrades to an
|
|
11
|
+
* empty snapshot, which makes the exclusion guard a no-op (today's
|
|
12
|
+
* behavior) rather than blocking commits.
|
|
13
|
+
*/
|
|
14
|
+
export declare function snapshotDirtyTree(cwd: string): DirtyLaunchSnapshot;
|
|
15
|
+
/** Result of partitioning a scoped commit's candidate paths against the launch snapshot. */
|
|
16
|
+
export interface ScopedCommitExclusion {
|
|
17
|
+
readonly included: readonly string[];
|
|
18
|
+
readonly excluded: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Partition `candidatePaths` into paths safe to include in a scoped commit
|
|
22
|
+
* vs. paths that must be excluded because they are untouched launch-dirty
|
|
23
|
+
* residue. A path is excluded only when BOTH:
|
|
24
|
+
* - it appears in `launchSnapshot` (it was already dirty before this run), AND
|
|
25
|
+
* - its current content hash equals the hash recorded at launch (this run
|
|
26
|
+
* never actually changed it).
|
|
27
|
+
* Everything else is included — a path absent from the snapshot was clean
|
|
28
|
+
* at launch (this run is what dirtied it), and a path whose hash changed
|
|
29
|
+
* was genuinely touched by this run even though it started out dirty.
|
|
30
|
+
*/
|
|
31
|
+
export declare function excludeUntouchedLaunchResidue(cwd: string, candidatePaths: readonly string[], launchSnapshot: DirtyLaunchSnapshot): ScopedCommitExclusion;
|
|
32
|
+
//# sourceMappingURL=dirty-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dirty-guard.d.ts","sourceRoot":"","sources":["../../../src/platform/orchestration/dirty-guard.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAsCrF,2KAA2K;AAC3K,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYpF;AAED,+GAA+G;AAC/G,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AAyCrE;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAalE;AAED,4FAA4F;AAC5F,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,SAAS,MAAM,EAAE,EACjC,cAAc,EAAE,mBAAmB,GAClC,qBAAqB,CAiBvB"}
|