@pellux/goodvibes-sdk 0.37.1 → 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/control-plane/approval-broker.d.ts +1 -0
- package/dist/platform/control-plane/approval-broker.d.ts.map +1 -1
- package/dist/platform/control-plane/approval-broker.js +2 -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/dist/platform/workspace/checkpoint/side-git.d.ts +20 -8
- package/dist/platform/workspace/checkpoint/side-git.d.ts.map +1 -1
- package/dist/platform/workspace/checkpoint/side-git.js +21 -11
- package/package.json +17 -9
|
@@ -0,0 +1,165 @@
|
|
|
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 type { ExecutionStrategy } from './adaptive-planner.js';
|
|
20
|
+
import type { PlanItem } from './execution-plan.js';
|
|
21
|
+
import type { ProjectPlanningState } from '../knowledge/project-planning/types.js';
|
|
22
|
+
/** Archetypes a work item can suggest for its executing agent. Open-ended by design. */
|
|
23
|
+
export type WorkItemArchetype = 'engineer' | 'reviewer' | 'tester' | 'researcher' | 'integrator' | string;
|
|
24
|
+
/**
|
|
25
|
+
* A single unit of work inside a proposal.
|
|
26
|
+
*
|
|
27
|
+
* Field shapes deliberately mirror three existing types so downstream bridges
|
|
28
|
+
* are near-1:1 maps rather than translations:
|
|
29
|
+
* - knowledge `ProjectPlanningTask` (approval-render bridge)
|
|
30
|
+
* - knowledge `ProjectWorkPlanTask` (phaseId/dependency naming)
|
|
31
|
+
* - core `PlanItem` (persistence bridge)
|
|
32
|
+
*/
|
|
33
|
+
export interface WorkItem {
|
|
34
|
+
id: string;
|
|
35
|
+
title: string;
|
|
36
|
+
brief: string;
|
|
37
|
+
phaseId: string;
|
|
38
|
+
dependsOn: string[];
|
|
39
|
+
suggestedArchetype?: WorkItemArchetype | undefined;
|
|
40
|
+
likelyFiles?: string[] | undefined;
|
|
41
|
+
verification?: string[] | undefined;
|
|
42
|
+
canRunConcurrently?: boolean | undefined;
|
|
43
|
+
needsReview?: boolean | undefined;
|
|
44
|
+
}
|
|
45
|
+
export interface Phase {
|
|
46
|
+
id: string;
|
|
47
|
+
title: string;
|
|
48
|
+
description?: string | undefined;
|
|
49
|
+
order: number;
|
|
50
|
+
}
|
|
51
|
+
/** Where a proposal's decomposition came from. */
|
|
52
|
+
export type PlanProposalSource = 'planner-agent' | 'single-item-fallback' | 'caller-supplied';
|
|
53
|
+
export interface PlanProposal {
|
|
54
|
+
id: string;
|
|
55
|
+
task: string;
|
|
56
|
+
strategy: ExecutionStrategy;
|
|
57
|
+
rationale: string;
|
|
58
|
+
phases: Phase[];
|
|
59
|
+
workItems: WorkItem[];
|
|
60
|
+
createdAt: number;
|
|
61
|
+
source: PlanProposalSource;
|
|
62
|
+
}
|
|
63
|
+
/** The loose JSON shape a planning agent (or a caller) emits, pre-validation. */
|
|
64
|
+
export interface RawDecompositionPhase {
|
|
65
|
+
title: string;
|
|
66
|
+
description?: string | undefined;
|
|
67
|
+
}
|
|
68
|
+
export interface RawDecompositionWorkItem {
|
|
69
|
+
title: string;
|
|
70
|
+
brief: string;
|
|
71
|
+
phase: string;
|
|
72
|
+
dependsOn?: string[] | undefined;
|
|
73
|
+
suggestedArchetype?: string | undefined;
|
|
74
|
+
likelyFiles?: string[] | undefined;
|
|
75
|
+
verification?: string[] | undefined;
|
|
76
|
+
canRunConcurrently?: boolean | undefined;
|
|
77
|
+
needsReview?: boolean | undefined;
|
|
78
|
+
}
|
|
79
|
+
export interface RawDecomposition {
|
|
80
|
+
phases: RawDecompositionPhase[];
|
|
81
|
+
workItems: RawDecompositionWorkItem[];
|
|
82
|
+
}
|
|
83
|
+
/** Kinds of honest-partial issues `assemblePlanProposal` can flag without throwing. */
|
|
84
|
+
export type PlanProposalIssueKind = 'dangling-dependency' | 'dependency-cycle' | 'unresolved-phase';
|
|
85
|
+
export interface PlanProposalIssue {
|
|
86
|
+
readonly kind: PlanProposalIssueKind;
|
|
87
|
+
readonly workItemTitle: string;
|
|
88
|
+
readonly message: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Turn a raw decomposition into a validated, typed `PlanProposal`.
|
|
92
|
+
*
|
|
93
|
+
* Never throws. Malformed input degrades to an honest partial result: an
|
|
94
|
+
* unresolved phase reference lands its work item in a synthesized "Unphased"
|
|
95
|
+
* bucket; an unresolved dependency reference is dropped; a dependency cycle
|
|
96
|
+
* is flagged but left in place (no silent edge removal). Every problem is
|
|
97
|
+
* reported via the returned `issues` list rather than an exception.
|
|
98
|
+
*
|
|
99
|
+
* Dependency resolution mirrors `ExecutionPlanManager.replaceItems` exactly:
|
|
100
|
+
* a dep that already looks like a UUID passes through unchecked, otherwise
|
|
101
|
+
* it is resolved by case-insensitive title match, otherwise it is dropped.
|
|
102
|
+
*
|
|
103
|
+
* `source` defaults to `'planner-agent'` (the expected majority caller —
|
|
104
|
+
* `AdaptivePlanner.proposeWorkstream`). Pass `'caller-supplied'` when a
|
|
105
|
+
* non-agent caller hands in its own decomposition directly.
|
|
106
|
+
*/
|
|
107
|
+
export declare function assemblePlanProposal(task: string, strategy: ExecutionStrategy, raw: RawDecomposition, source?: Extract<PlanProposalSource, 'planner-agent' | 'caller-supplied'>): {
|
|
108
|
+
proposal: PlanProposal;
|
|
109
|
+
issues: PlanProposalIssue[];
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* The honest fallback: one phase ("Execute"), one work item whose title and
|
|
113
|
+
* brief both equal the task text, no dependencies. Used whenever decomposition
|
|
114
|
+
* was not warranted (see `AdaptivePlanner.shouldDecompose`) or no raw
|
|
115
|
+
* decomposition is available yet.
|
|
116
|
+
*/
|
|
117
|
+
export declare function singleItemProposal(task: string): PlanProposal;
|
|
118
|
+
/**
|
|
119
|
+
* Project a `PlanProposal` into the existing `/plan approve` seam. This is
|
|
120
|
+
* data-only — no store is written here. The caller feeds the result into
|
|
121
|
+
* `ProjectPlanningService.upsertState` (or an equivalent), which is what
|
|
122
|
+
* actually persists it and evaluates readiness.
|
|
123
|
+
*
|
|
124
|
+
* Direction convention for the emitted `ProjectPlanningDependency` records
|
|
125
|
+
* (this type has no prior producer in the codebase to inherit a convention
|
|
126
|
+
* from, so it is fixed here): `fromTaskId` depends on `toTaskId`, i.e. the
|
|
127
|
+
* edge reads "fromTaskId depends on toTaskId" the same way `WorkItem.dependsOn`
|
|
128
|
+
* reads "this item depends on these ids".
|
|
129
|
+
*
|
|
130
|
+
* `ProjectPlanningTask` has no first-class phase concept, so phase
|
|
131
|
+
* membership is preserved in `metadata` rather than dropped silently.
|
|
132
|
+
*
|
|
133
|
+
* `executionApproved` is always `false` here — approval is a separate,
|
|
134
|
+
* explicit step owned by `/plan approve` (planning-runtime.ts), never implied
|
|
135
|
+
* by proposing.
|
|
136
|
+
*/
|
|
137
|
+
export declare function planProposalToPlanningState(proposal: PlanProposal): Partial<ProjectPlanningState>;
|
|
138
|
+
/**
|
|
139
|
+
* Project a `PlanProposal` into the plain items `ExecutionPlanManager` deals
|
|
140
|
+
* in. This is a deliberately lossy projection: `PlanItem` has no room for
|
|
141
|
+
* verification/likelyFiles/suggestedArchetype, and those stay in the
|
|
142
|
+
* full-fidelity `ProjectPlanningState` render above. It exists purely so a
|
|
143
|
+
* caller can hand a proposal's items to `ExecutionPlanManager` without
|
|
144
|
+
* re-deriving the phase/description/dependency shape by hand.
|
|
145
|
+
*
|
|
146
|
+
* Dependencies are expressed as WORK ITEM TITLES, not ids, because
|
|
147
|
+
* `ExecutionPlanManager.create()` does not resolve dependency references —
|
|
148
|
+
* only `ExecutionPlanManager.replaceItems()` does, by case-insensitive
|
|
149
|
+
* description match. The intended call sequence at instantiation is
|
|
150
|
+
* therefore:
|
|
151
|
+
*
|
|
152
|
+
* const plan = planManager.create(title, []);
|
|
153
|
+
* const { items } = planProposalToExecutionPlanItems(proposal);
|
|
154
|
+
* planManager.replaceItems(plan.id, items);
|
|
155
|
+
*
|
|
156
|
+
* which reuses `replaceItems`' existing dependency resolver end-to-end
|
|
157
|
+
* instead of re-implementing dependency resolution here. This module defines
|
|
158
|
+
* no scheduler of its own — ready-to-run item selection stays
|
|
159
|
+
* `ExecutionPlanManager.getNextItems`'s job.
|
|
160
|
+
*/
|
|
161
|
+
export declare function planProposalToExecutionPlanItems(proposal: PlanProposal): {
|
|
162
|
+
title: string;
|
|
163
|
+
items: Array<Omit<PlanItem, 'id' | 'status'>>;
|
|
164
|
+
};
|
|
165
|
+
//# sourceMappingURL=plan-proposal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-proposal.d.ts","sourceRoot":"","sources":["../../../src/platform/core/plan-proposal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAEV,oBAAoB,EAErB,MAAM,wCAAwC,CAAC;AAMhD,wFAAwF;AACxF,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,GAAG,MAAM,CAAC;AAE1G;;;;;;;;GAQG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,kBAAkB,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACnD,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACpC,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACzC,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,KAAK;IAC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,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AAEpG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAkDD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,iBAAiB,EAC3B,GAAG,EAAE,gBAAgB,EACrB,MAAM,GAAE,OAAO,CAAC,kBAAkB,EAAE,eAAe,GAAG,iBAAiB,CAAmB,GACzF;IAAE,QAAQ,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAwGzD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAkB7D;AAMD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAoCjG;AAMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,YAAY,GACrB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAA;CAAE,CAalE"}
|
|
@@ -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,C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AC,6BAA6B,CAAC,CAAC,CAAC;QACpH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC,gBAAgB,CAAC,2BAA2B,CAAC,CAAC,CAAC;QACpF,OAAO,CAAC,KAAK,CAAC,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
|
+
}
|