@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,199 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
/**
|
|
3
|
+
* Fleet types — the normalized process-tree contract for the live process
|
|
4
|
+
* registry (W2.1). One queryable + subscribable aggregation surface that
|
|
5
|
+
* enumerates every live/completed runtime process (agents incl. WRFC roles,
|
|
6
|
+
* WRFC chains + subtasks, workflow-tool FSMs/triggers/schedules, watchers,
|
|
7
|
+
* background processes) as flat `ProcessNode` records with parentId edges.
|
|
8
|
+
*
|
|
9
|
+
* Consumers (the TUI fleet tree, Wave-3 session tabs, Wave-4 orchestration
|
|
10
|
+
* nesting) build the tree from the flat list — this keeps the registry cheap
|
|
11
|
+
* and lets each surface reorder/filter independently.
|
|
12
|
+
*/
|
|
13
|
+
/** The source family a ProcessNode was adapted from. */
|
|
14
|
+
export type ProcessKind = 'agent' | 'wrfc-chain' | 'wrfc-subtask' | 'workflow' | 'trigger' | 'schedule' | 'watcher' | 'background-process' | 'workstream' | 'phase' | 'work-item' | 'code-index';
|
|
15
|
+
/**
|
|
16
|
+
* Derived fine-grained process state.
|
|
17
|
+
*
|
|
18
|
+
* Superset of the coarse manager statuses: `idle` and `queued` exist because
|
|
19
|
+
* ScheduleEntry-between-runs and pending agents need honest states rather
|
|
20
|
+
* than being force-fit into an active state.
|
|
21
|
+
*
|
|
22
|
+
* `interrupted` (Wave-3 verb formalization) is a distinct TERMINAL outcome
|
|
23
|
+
* from `killed`: both come from AgentManager.cancel(), but a graceful
|
|
24
|
+
* interrupt request and a hard kill are display-distinguishable via
|
|
25
|
+
* AgentRecord.terminationKind. There is no resume path — `cancel()` is
|
|
26
|
+
* terminal in the current SDK, so 'interrupted' does NOT mean "process still
|
|
27
|
+
* alive"; it means "the operator asked nicely" vs. "the operator killed it".
|
|
28
|
+
*
|
|
29
|
+
* `paused` (Wave 6, wo-F item d2) is NOT terminal and NOT the same as
|
|
30
|
+
* `killed`: a disabled trigger/schedule/automation-job still exists and can
|
|
31
|
+
* be re-armed via `ProcessRegistry.resume()` — collapsing it into `killed`
|
|
32
|
+
* (the pre-Wave-6 behavior) was dishonest, since `killed` implies the
|
|
33
|
+
* process is gone for good. See ProcessCapabilities.resumable.
|
|
34
|
+
*/
|
|
35
|
+
export type ProcessState = 'thinking' | 'executing-tool' | 'awaiting-approval' | 'streaming' | 'stalled' | 'retrying' | 'done' | 'failed' | 'killed' | 'interrupted' | 'idle' | 'queued' | 'paused';
|
|
36
|
+
/** Token/call usage aggregated onto a node. Mirrors AgentRecord.usage + toolCallCount. */
|
|
37
|
+
export interface ProcessUsage {
|
|
38
|
+
readonly inputTokens: number;
|
|
39
|
+
readonly outputTokens: number;
|
|
40
|
+
readonly cacheReadTokens: number;
|
|
41
|
+
readonly cacheWriteTokens: number;
|
|
42
|
+
readonly reasoningTokens?: number | undefined;
|
|
43
|
+
readonly llmCallCount: number;
|
|
44
|
+
readonly turnCount: number;
|
|
45
|
+
readonly toolCallCount: number;
|
|
46
|
+
}
|
|
47
|
+
/** The most recent observable activity on a node (tool call, output line, or phase label). */
|
|
48
|
+
export interface ProcessActivity {
|
|
49
|
+
readonly kind: 'tool' | 'output-line' | 'phase';
|
|
50
|
+
readonly text: string;
|
|
51
|
+
readonly toolName?: string | undefined;
|
|
52
|
+
/** Epoch ms when this activity was observed. Stable per activity (not per query). */
|
|
53
|
+
readonly at: number;
|
|
54
|
+
}
|
|
55
|
+
/** Which control operations the registry can dispatch for this node. */
|
|
56
|
+
export interface ProcessCapabilities {
|
|
57
|
+
readonly interruptible: boolean;
|
|
58
|
+
readonly killable: boolean;
|
|
59
|
+
readonly pausable: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Wave 6 (wo-F item d2): whether `ProcessRegistry.resume()` can re-arm
|
|
62
|
+
* this node. True only for a node currently in the `paused` state whose
|
|
63
|
+
* source manager exposes an `enable` control (trigger, schedule,
|
|
64
|
+
* automation job) — false for every other kind/state, including a
|
|
65
|
+
* `killed` node (kill is one-way; there is no un-kill).
|
|
66
|
+
*/
|
|
67
|
+
readonly resumable: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Wave-3: whether `ProcessRegistry.steer()` can queue a message for this
|
|
70
|
+
* node. True only for a live in-process agent (or a wrfc-subtask with a
|
|
71
|
+
* live member agent) AND only when the registry was constructed with a
|
|
72
|
+
* `messageBus` dep — false everywhere when that dep is absent (graceful
|
|
73
|
+
* degrade, no crash). Terminal nodes and non-conversational kinds
|
|
74
|
+
* (wrfc-chain, workflow, trigger, schedule, watcher, background-process)
|
|
75
|
+
* are never steerable.
|
|
76
|
+
*/
|
|
77
|
+
readonly steerable: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** Wave-3 tab attach point: session/agent identity for transcript drill-downs. */
|
|
80
|
+
export interface ProcessSessionRef {
|
|
81
|
+
readonly sessionId?: string | undefined;
|
|
82
|
+
readonly agentId?: string | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Whether `costUsd` is a real reading.
|
|
86
|
+
* - 'priced' — every contributing usage record resolved to catalog pricing.
|
|
87
|
+
* - 'unpriced' — no pricing available; `costUsd` is null, never a fabricated zero.
|
|
88
|
+
* - 'estimated' — partial: some contributors priced, some not (aggregate nodes only).
|
|
89
|
+
*/
|
|
90
|
+
export type ProcessCostState = 'priced' | 'unpriced' | 'estimated';
|
|
91
|
+
/** One normalized process in the fleet. Flat record; `parentId` expresses the tree. */
|
|
92
|
+
export interface ProcessNode {
|
|
93
|
+
readonly id: string;
|
|
94
|
+
readonly kind: ProcessKind;
|
|
95
|
+
readonly parentId?: string | undefined;
|
|
96
|
+
readonly label: string;
|
|
97
|
+
readonly task?: string | undefined;
|
|
98
|
+
readonly state: ProcessState;
|
|
99
|
+
readonly startedAt?: number | undefined;
|
|
100
|
+
readonly completedAt?: number | undefined;
|
|
101
|
+
/** (completedAt ?? now) - startedAt when startedAt is known, else 0. */
|
|
102
|
+
readonly elapsedMs: number;
|
|
103
|
+
readonly usage?: ProcessUsage | undefined;
|
|
104
|
+
readonly model?: string | undefined;
|
|
105
|
+
readonly provider?: string | undefined;
|
|
106
|
+
readonly costUsd?: number | null | undefined;
|
|
107
|
+
readonly costState: ProcessCostState;
|
|
108
|
+
readonly currentActivity?: ProcessActivity | undefined;
|
|
109
|
+
readonly capabilities: ProcessCapabilities;
|
|
110
|
+
readonly sessionRef?: ProcessSessionRef | undefined;
|
|
111
|
+
/** Opaque source record (AgentRecord, WrfcChain, …) for drill-downs. */
|
|
112
|
+
readonly raw?: unknown;
|
|
113
|
+
}
|
|
114
|
+
/** A point-in-time capture of the whole fleet. */
|
|
115
|
+
export interface FleetSnapshot {
|
|
116
|
+
readonly capturedAt: number;
|
|
117
|
+
readonly nodes: readonly ProcessNode[];
|
|
118
|
+
}
|
|
119
|
+
/** Optional narrowing for `query()`. Omitted fields mean "no constraint". */
|
|
120
|
+
export interface FleetQueryFilter {
|
|
121
|
+
readonly kinds?: readonly ProcessKind[] | undefined;
|
|
122
|
+
readonly states?: readonly ProcessState[] | undefined;
|
|
123
|
+
}
|
|
124
|
+
/** Options for `ProcessRegistry.kill()`. */
|
|
125
|
+
export interface ProcessKillOptions {
|
|
126
|
+
/** Also kill all killable descendant nodes (children first). Default false. */
|
|
127
|
+
readonly cascade?: boolean | undefined;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Result of `ProcessRegistry.steer()`.
|
|
131
|
+
*
|
|
132
|
+
* `queued: true` means the message was accepted onto the target's inbox —
|
|
133
|
+
* NOT that the agent has seen it yet. Consumption (drained at the target's
|
|
134
|
+
* next turn boundary) is a separate, later, honest signal: a
|
|
135
|
+
* `COMMUNICATION_CONSUMED` runtime-bus event on the `communication` domain
|
|
136
|
+
* carrying the same `messageId`.
|
|
137
|
+
*/
|
|
138
|
+
export type SteerResult = {
|
|
139
|
+
readonly queued: true;
|
|
140
|
+
readonly messageId: string;
|
|
141
|
+
} | {
|
|
142
|
+
readonly queued: false;
|
|
143
|
+
readonly reason: string;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* The live process registry surface.
|
|
147
|
+
*
|
|
148
|
+
* `query()` is a cheap idempotent aggregate-on-read over the already-composed
|
|
149
|
+
* managers (no owned store state). `subscribe()` is an in-registry callback
|
|
150
|
+
* fed by a coalesced tick — it is NOT a runtime-bus event contract.
|
|
151
|
+
*/
|
|
152
|
+
export interface ProcessRegistry {
|
|
153
|
+
/** Snapshot the fleet now. Cheap O(n) in-memory scans; safe to call per render tick. */
|
|
154
|
+
query(filter?: FleetQueryFilter): FleetSnapshot;
|
|
155
|
+
/** Find one node by id, or null. */
|
|
156
|
+
getNode(id: string): ProcessNode | null;
|
|
157
|
+
/**
|
|
158
|
+
* Be notified with a fresh snapshot whenever the fleet materially changes
|
|
159
|
+
* (coalesced ~tick granularity; unchanged ticks are silent).
|
|
160
|
+
* Returns an unsubscribe function.
|
|
161
|
+
*/
|
|
162
|
+
subscribe(listener: (snapshot: FleetSnapshot) => void): () => void;
|
|
163
|
+
/**
|
|
164
|
+
* Graceful interruption where the source supports one:
|
|
165
|
+
* agents → AgentManager.cancel; triggers/schedules → disable (pause).
|
|
166
|
+
* Returns true when an owning control accepted the request.
|
|
167
|
+
*/
|
|
168
|
+
interrupt(id: string): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Wave 6 (wo-F item d2): re-arm a `paused` node — triggers/schedules via
|
|
171
|
+
* their manager's `enable()`, the inverse of `interrupt()`'s disable.
|
|
172
|
+
* Honest refusal (returns false, no throw) for a node that is not
|
|
173
|
+
* resumable: not found, not currently `paused`, or a kind whose source
|
|
174
|
+
* manager exposes no `enable` control (e.g. an agent — there is no
|
|
175
|
+
* resume path once cancelled, see ProcessState's `paused` doc).
|
|
176
|
+
*/
|
|
177
|
+
resume(id: string): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Hard stop. Dispatches to the owning manager's control fn
|
|
180
|
+
* (agent → cancel, background process → stop, watcher → stopWatcher,
|
|
181
|
+
* workflow → cancel, trigger/schedule → remove). WRFC chain kill is
|
|
182
|
+
* DERIVED, not native: it cascades AgentManager.cancel over the chain's
|
|
183
|
+
* member agents. Returns the node ids that were actually acted on.
|
|
184
|
+
*/
|
|
185
|
+
kill(id: string, opts?: ProcessKillOptions): readonly string[];
|
|
186
|
+
/**
|
|
187
|
+
* Queue a human message for a live in-process agent (or the current live
|
|
188
|
+
* member agent of a wrfc-subtask), delivered at the target's next turn
|
|
189
|
+
* boundary (next tool round / turn top) — never mid-token. Honest refusal
|
|
190
|
+
* (`queued: false`) for anything that cannot take mid-run input: terminal
|
|
191
|
+
* nodes, non-agent kinds, the wrfc-chain coordinator itself (steer its
|
|
192
|
+
* member subtask instead), and any target when the registry has no
|
|
193
|
+
* `messageBus` dep configured.
|
|
194
|
+
*/
|
|
195
|
+
steer(id: string, text: string): SteerResult;
|
|
196
|
+
/** Stop the tick, detach runtime-bus taps, drop all listeners. Idempotent. */
|
|
197
|
+
dispose(): void;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/platform/runtime/fleet/types.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;;;;;;;;GAUG;AAEH,wDAAwD;AACxD,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,YAAY,GACZ,cAAc,GACd,UAAU,GACV,SAAS,GACT,UAAU,GACV,SAAS,GACT,oBAAoB,GAGpB,YAAY,GACZ,OAAO,GACP,WAAW,GAKX,YAAY,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,gBAAgB,GAChB,mBAAmB,GACnB,WAAW,GACX,SAAS,GACT,UAAU,GACV,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,aAAa,GACb,MAAM,GACN,QAAQ,GACR,QAAQ,CAAC;AAEb,0FAA0F;AAC1F,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,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Q,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtI;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,wFAAwF;IACxF,KAAK,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,aAAa,CAAC;IAChD,oCAAoC;IACpC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;IACxC;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACnE;;;;OAIG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,kBAAkB,GAAG,SAAS,MAAM,EAAE,CAAC;IAC/D;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC7C,8EAA8E;IAC9E,OAAO,IAAI,IAAI,CAAC;CACjB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type KnowledgeApi } from '../knowledge/knowledge-api.js';
|
|
2
2
|
import type { RuntimeServices } from './services.js';
|
|
3
|
-
export interface RuntimeKnowledgeApiServices extends Pick<RuntimeServices, 'knowledgeService' | 'memoryRegistry'> {
|
|
3
|
+
export interface RuntimeKnowledgeApiServices extends Pick<RuntimeServices, 'knowledgeService' | 'memoryRegistry' | 'codeIndexStore'> {
|
|
4
4
|
}
|
|
5
5
|
export declare function createRuntimeKnowledgeApi(runtimeServices: RuntimeKnowledgeApiServices): KnowledgeApi;
|
|
6
6
|
//# sourceMappingURL=runtime-knowledge-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-knowledge-api.d.ts","sourceRoot":"","sources":["../../../src/platform/runtime/runtime-knowledge-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACtH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,2BACf,SAAQ,IAAI,CAAC,eAAe,EAAE,kBAAkB,GAAG,gBAAgB,CAAC;CAAG;
|
|
1
|
+
{"version":3,"file":"runtime-knowledge-api.d.ts","sourceRoot":"","sources":["../../../src/platform/runtime/runtime-knowledge-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACtH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,2BACf,SAAQ,IAAI,CAAC,eAAe,EAAE,kBAAkB,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;CAAG;AAE5F,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,2BAA2B,GAC3C,YAAY,CAMd"}
|
|
@@ -2,6 +2,7 @@ import { createKnowledgeApi } from '../knowledge/knowledge-api.js';
|
|
|
2
2
|
export function createRuntimeKnowledgeApi(runtimeServices) {
|
|
3
3
|
const options = {
|
|
4
4
|
memoryRegistry: runtimeServices.memoryRegistry,
|
|
5
|
+
codeIndexStore: runtimeServices.codeIndexStore,
|
|
5
6
|
};
|
|
6
7
|
return createKnowledgeApi(runtimeServices.knowledgeService, options);
|
|
7
8
|
}
|
|
@@ -22,6 +22,7 @@ import { FileUndoManager } from '../state/file-undo.js';
|
|
|
22
22
|
import { WorkspaceCheckpointManager } from '../workspace/checkpoint/index.js';
|
|
23
23
|
import { MemoryRegistry } from '../state/memory-registry.js';
|
|
24
24
|
import { MemoryStore } from '../state/memory-store.js';
|
|
25
|
+
import { CodeIndexStore } from '../state/code-index-store.js';
|
|
25
26
|
import type { RuntimeEventBus } from './events/index.js';
|
|
26
27
|
import type { DomainDispatch, RuntimeStore } from './store/index.js';
|
|
27
28
|
import { DistributedRuntimeManager } from './remote/distributed-runtime-manager.js';
|
|
@@ -65,6 +66,8 @@ import type { FeatureFlagManager } from './feature-flags/index.js';
|
|
|
65
66
|
import { PolicyRuntimeState } from './permissions/policy-runtime.js';
|
|
66
67
|
import { type KeybindingsManagerLike, type PanelManagerLike } from './host-ui.js';
|
|
67
68
|
import { type WorkflowServices } from '../tools/workflow/index.js';
|
|
69
|
+
import { type ProcessRegistry } from './fleet/index.js';
|
|
70
|
+
import { type OrchestrationEngine } from '../orchestration/index.js';
|
|
68
71
|
export interface RuntimeServicesOptions {
|
|
69
72
|
readonly runtimeBus: RuntimeEventBus;
|
|
70
73
|
readonly runtimeStore: RuntimeStore;
|
|
@@ -76,6 +79,16 @@ export interface RuntimeServicesOptions {
|
|
|
76
79
|
readonly homeDirectory: string;
|
|
77
80
|
readonly panelManager?: PanelManagerLike | undefined;
|
|
78
81
|
readonly keybindingsManager?: KeybindingsManagerLike | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Opt-in: kick off the repo source-tree code index's initial build
|
|
84
|
+
* (Wave-5 wo802, W5.3 Stage A) right after construction. Fire-and-forget —
|
|
85
|
+
* never awaited here, never blocks this call. Defaults to false/undefined
|
|
86
|
+
* so constructing RuntimeServices never surprises a caller (including the
|
|
87
|
+
* many test fixtures that build RuntimeServices against a real directory)
|
|
88
|
+
* with an unrequested full source-tree walk. A real product entry point
|
|
89
|
+
* (an interactive session bootstrap) should pass `true`.
|
|
90
|
+
*/
|
|
91
|
+
readonly autoStartCodeIndex?: boolean | undefined;
|
|
79
92
|
}
|
|
80
93
|
export interface RuntimeServices {
|
|
81
94
|
readonly workingDirectory: string;
|
|
@@ -105,6 +118,18 @@ export interface RuntimeServices {
|
|
|
105
118
|
readonly projectPlanningService: ProjectPlanningService;
|
|
106
119
|
readonly memoryStore: MemoryStore;
|
|
107
120
|
readonly memoryRegistry: MemoryRegistry;
|
|
121
|
+
/**
|
|
122
|
+
* Repo source-tree code index (Wave-5 wo802, W5.3 Stage A). Constructed and
|
|
123
|
+
* schema-initialized eagerly like memoryStore, but the actual walk/chunk/
|
|
124
|
+
* embed build is NOT auto-triggered here — call `.scheduleBuild()` from an
|
|
125
|
+
* explicit call site (a `/codebase reindex` command, a session-start hook,
|
|
126
|
+
* etc.) once one exists. Auto-triggering from every RuntimeServices
|
|
127
|
+
* construction would run a full source-tree walk against whatever
|
|
128
|
+
* workingDirectory a caller passes in — including the hundreds of existing
|
|
129
|
+
* tests that build RuntimeServices fixtures — which is both slow and
|
|
130
|
+
* surprising for embedders that never asked for it.
|
|
131
|
+
*/
|
|
132
|
+
readonly codeIndexStore: CodeIndexStore;
|
|
108
133
|
readonly serviceRegistry: ServiceRegistry;
|
|
109
134
|
readonly secretsManager: SecretsManager;
|
|
110
135
|
readonly subscriptionManager: SubscriptionManager;
|
|
@@ -157,7 +182,28 @@ export interface RuntimeServices {
|
|
|
157
182
|
readonly agentMessageBus: AgentMessageBus;
|
|
158
183
|
readonly agentOrchestrator: AgentOrchestrator;
|
|
159
184
|
readonly wrfcController: WrfcController;
|
|
185
|
+
/**
|
|
186
|
+
* Orchestration engine (Wave 4, wo701) — ships ALONGSIDE wrfcController,
|
|
187
|
+
* stage 1 of the 3-stage migration (see platform/orchestration/
|
|
188
|
+
* controller-compat.ts). WrfcController is unchanged; this is a new,
|
|
189
|
+
* opt-in surface for callers that want the pipeline/capacity-matching
|
|
190
|
+
* scheduler instead of WrfcController's pairwise engineer<->reviewer
|
|
191
|
+
* chain. Not auto-started — callers call orchestrationEngine.start(id)
|
|
192
|
+
* (or resumeAllFromDisk()) once they have a workstream to run.
|
|
193
|
+
*/
|
|
194
|
+
readonly orchestrationEngine: OrchestrationEngine;
|
|
160
195
|
readonly processManager: ProcessManager;
|
|
196
|
+
/**
|
|
197
|
+
* Live process registry (W2.1): queryable + subscribable fleet aggregation
|
|
198
|
+
* over agentManager/wrfcController/processManager/watcherRegistry/workflow.
|
|
199
|
+
* LIFECYCLE NOTE: RuntimeServices has no shutdown/dispose seam today, so
|
|
200
|
+
* nothing calls processRegistry.dispose() here — the registry's coalesced
|
|
201
|
+
* tick is timer.unref()'d and only runs while subscribers exist, so an
|
|
202
|
+
* undisposed registry cannot pin the event loop. Hosts that tear down a
|
|
203
|
+
* runtime (tests, embedders) should call processRegistry.dispose()
|
|
204
|
+
* themselves; when a RuntimeServices-wide dispose seam lands, wire this in.
|
|
205
|
+
*/
|
|
206
|
+
readonly processRegistry: ProcessRegistry;
|
|
161
207
|
readonly modeManager: ModeManager;
|
|
162
208
|
readonly fileUndoManager: FileUndoManager;
|
|
163
209
|
readonly workspaceCheckpointManager: WorkspaceCheckpointManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../src/platform/runtime/services.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAwB,MAAM,wBAAwB,CAAC;AAC5G,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACzH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;A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AAE,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC,GACvD,MAAM,IAAI,CAOZ;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,eAAe,CAojBtF"}
|
|
@@ -27,6 +27,7 @@ import { FileUndoManager } from '../state/file-undo.js';
|
|
|
27
27
|
import { WorkspaceCheckpointManager } from '../workspace/checkpoint/index.js';
|
|
28
28
|
import { MemoryRegistry } from '../state/memory-registry.js';
|
|
29
29
|
import { MemoryStore } from '../state/memory-store.js';
|
|
30
|
+
import { CodeIndexStore } from '../state/code-index-store.js';
|
|
30
31
|
import { createDomainDispatch } from './store/index.js';
|
|
31
32
|
import { DistributedRuntimeManager } from './remote/distributed-runtime-manager.js';
|
|
32
33
|
import { RemoteRunnerRegistry, RemoteSupervisor } from './remote/index.js';
|
|
@@ -72,6 +73,8 @@ import { PolicyRuntimeState } from './permissions/policy-runtime.js';
|
|
|
72
73
|
import { requireSurfaceRoot } from './surface-root.js';
|
|
73
74
|
import { createNoopKeybindingsManager, createNoopPanelManager, } from './host-ui.js';
|
|
74
75
|
import { createWorkflowServices, } from '../tools/workflow/index.js';
|
|
76
|
+
import { createProcessRegistry } from './fleet/index.js';
|
|
77
|
+
import { createOrchestrationEngine } from '../orchestration/index.js';
|
|
75
78
|
export function bindProviderOptimizerFeatureFlag(featureFlags, providerOptimizer) {
|
|
76
79
|
providerOptimizer.setEnabled(featureFlags.isEnabled('provider-optimizer'));
|
|
77
80
|
return featureFlags.subscribe((flagId, state) => {
|
|
@@ -172,6 +175,20 @@ export function createRuntimeServices(options) {
|
|
|
172
175
|
executor: agentOrchestrator,
|
|
173
176
|
configManager,
|
|
174
177
|
});
|
|
178
|
+
// Wave-3 Part C6 bridge: AgentOrchestrator is constructed before
|
|
179
|
+
// AgentManager exists, so the conversation-snapshot sink is wired here via
|
|
180
|
+
// setConversationSink rather than as a constructor dependency (same
|
|
181
|
+
// ordering constraint as setRuntimeBus above).
|
|
182
|
+
agentOrchestrator.setConversationSink({
|
|
183
|
+
register: (agentId, source) => agentManager.registerConversationSource(agentId, source),
|
|
184
|
+
release: (agentId) => agentManager.releaseConversationSource(agentId),
|
|
185
|
+
});
|
|
186
|
+
// Wave-4 cooperative cancellation bridge (wo701): same ordering constraint
|
|
187
|
+
// and setter pattern as setConversationSink above — AgentOrchestrator is
|
|
188
|
+
// constructed before AgentManager exists.
|
|
189
|
+
agentOrchestrator.setCancellationSource({
|
|
190
|
+
get: (agentId) => agentManager.getCancellationSignal(agentId),
|
|
191
|
+
});
|
|
175
192
|
agentManager.setRuntimeBus(options.runtimeBus);
|
|
176
193
|
const wrfcController = new WrfcController(options.runtimeBus, agentMessageBus, {
|
|
177
194
|
agentManager,
|
|
@@ -211,6 +228,16 @@ export function createRuntimeServices(options) {
|
|
|
211
228
|
embeddingRegistry: memoryEmbeddingRegistry,
|
|
212
229
|
});
|
|
213
230
|
const memoryRegistry = new MemoryRegistry(memoryStore);
|
|
231
|
+
// Repo source-tree code index (Wave-5 wo802, W5.3 Stage A) — shares
|
|
232
|
+
// memoryEmbeddingRegistry so code + memory embeddings use one provider and
|
|
233
|
+
// one dimensionality. Schema init only; build is not auto-triggered here
|
|
234
|
+
// (see the RuntimeServices.codeIndexStore doc comment).
|
|
235
|
+
const codeIndexDbPath = join(workingDirectory, '.goodvibes', surfaceRoot, 'code-index.sqlite');
|
|
236
|
+
const codeIndexStore = new CodeIndexStore(workingDirectory, codeIndexDbPath, memoryEmbeddingRegistry);
|
|
237
|
+
codeIndexStore.init();
|
|
238
|
+
if (options.autoStartCodeIndex) {
|
|
239
|
+
codeIndexStore.scheduleBuild();
|
|
240
|
+
}
|
|
214
241
|
const deliveryManager = new AutomationDeliveryManager({
|
|
215
242
|
configManager,
|
|
216
243
|
secretsManager,
|
|
@@ -435,6 +462,50 @@ export function createRuntimeServices(options) {
|
|
|
435
462
|
sandboxSessionRegistry,
|
|
436
463
|
workflowServices: workflow,
|
|
437
464
|
});
|
|
465
|
+
// Honest-unpriced: only price models the catalog actually knows; an
|
|
466
|
+
// unknown model yields null (costState 'unpriced'), never a fabricated $0.
|
|
467
|
+
// SHARED between the fleet registry and the orchestration engine — the
|
|
468
|
+
// single cost source of truth so budget checks and fleet cost totals can
|
|
469
|
+
// never double-count against each other.
|
|
470
|
+
const priceUsage = (model, usage) => {
|
|
471
|
+
if (!model)
|
|
472
|
+
return null;
|
|
473
|
+
const catalogModels = providerRegistry.getRawCatalogModels();
|
|
474
|
+
const known = catalogModels.some((entry) => model === entry.id || model.startsWith(entry.id) || model.includes(entry.id));
|
|
475
|
+
if (!known && !model.endsWith(':free'))
|
|
476
|
+
return null;
|
|
477
|
+
const pricing = providerRegistry.getCostFromCatalog(model);
|
|
478
|
+
return (usage.inputTokens * pricing.input + usage.outputTokens * pricing.output) / 1_000_000;
|
|
479
|
+
};
|
|
480
|
+
// Orchestration engine (Wave 4, wo701) — ships alongside wrfcController,
|
|
481
|
+
// untouched by this change. See the RuntimeServices interface comment.
|
|
482
|
+
const orchestrationEngine = createOrchestrationEngine({
|
|
483
|
+
agentManager,
|
|
484
|
+
configManager,
|
|
485
|
+
runtimeBus: options.runtimeBus,
|
|
486
|
+
projectRoot: workingDirectory,
|
|
487
|
+
priceUsage,
|
|
488
|
+
});
|
|
489
|
+
// Live process registry (W2.1) — narrow structural deps only, constructed
|
|
490
|
+
// after every source manager exists. See the RuntimeServices interface
|
|
491
|
+
// comment for the dispose story (no RuntimeServices-wide shutdown seam yet).
|
|
492
|
+
const processRegistry = createProcessRegistry({
|
|
493
|
+
agentManager,
|
|
494
|
+
wrfcController,
|
|
495
|
+
orchestrationEngine,
|
|
496
|
+
processManager,
|
|
497
|
+
watcherRegistry,
|
|
498
|
+
workflow: {
|
|
499
|
+
workflowManager: workflow.workflowManager,
|
|
500
|
+
triggerManager: workflow.triggerManager,
|
|
501
|
+
scheduleManager: workflow.scheduleManager,
|
|
502
|
+
},
|
|
503
|
+
approvalBroker,
|
|
504
|
+
sessionBroker,
|
|
505
|
+
runtimeBus: options.runtimeBus,
|
|
506
|
+
priceUsage,
|
|
507
|
+
codeIndexService: codeIndexStore,
|
|
508
|
+
});
|
|
438
509
|
return {
|
|
439
510
|
workingDirectory,
|
|
440
511
|
homeDirectory,
|
|
@@ -463,6 +534,7 @@ export function createRuntimeServices(options) {
|
|
|
463
534
|
projectPlanningService,
|
|
464
535
|
memoryStore,
|
|
465
536
|
memoryRegistry,
|
|
537
|
+
codeIndexStore,
|
|
466
538
|
serviceRegistry,
|
|
467
539
|
secretsManager,
|
|
468
540
|
subscriptionManager,
|
|
@@ -515,7 +587,9 @@ export function createRuntimeServices(options) {
|
|
|
515
587
|
agentMessageBus,
|
|
516
588
|
agentOrchestrator,
|
|
517
589
|
wrfcController,
|
|
590
|
+
orchestrationEngine,
|
|
518
591
|
processManager,
|
|
592
|
+
processRegistry,
|
|
519
593
|
modeManager,
|
|
520
594
|
fileUndoManager,
|
|
521
595
|
workspaceCheckpointManager,
|
|
@@ -524,6 +598,10 @@ export function createRuntimeServices(options) {
|
|
|
524
598
|
// Step 1: Re-root MemoryStore — close existing SQLite/vector handles, reopen at new path.
|
|
525
599
|
const newMemoryDbPath = join(newWorkingDir, '.goodvibes', surfaceRoot, 'memory.sqlite');
|
|
526
600
|
await memoryStore.reroot(newMemoryDbPath);
|
|
601
|
+
// Step 1b: Re-root the code index alongside memory — otherwise it keeps
|
|
602
|
+
// pointing at the old tree after a workspace swap (Wave-5 wo802 risk #7).
|
|
603
|
+
const newCodeIndexDbPath = join(newWorkingDir, '.goodvibes', surfaceRoot, 'code-index.sqlite');
|
|
604
|
+
await codeIndexStore.reroot(newWorkingDir, newCodeIndexDbPath);
|
|
527
605
|
// Step 2: Re-root ProjectIndex — flush current path, reset, load from new directory.
|
|
528
606
|
await projectIndex.reroot(newWorkingDir);
|
|
529
607
|
// Step 3: Subsystems that cannot be live-rerooted emit a warn log.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
import type { SymbolInfo } from '../intelligence/tree-sitter/queries.js';
|
|
3
|
+
/** One chunk of source: either a top-level tree-sitter symbol or a fixed-size line window. */
|
|
4
|
+
export interface CodeChunk {
|
|
5
|
+
readonly chunkId: string;
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly lang: string;
|
|
8
|
+
readonly symbol: string;
|
|
9
|
+
readonly kind: string;
|
|
10
|
+
readonly startLine: number;
|
|
11
|
+
readonly endLine: number;
|
|
12
|
+
readonly contentHash: string;
|
|
13
|
+
readonly mtimeMs: number;
|
|
14
|
+
readonly fileHash: string;
|
|
15
|
+
}
|
|
16
|
+
/** How a file's chunks were produced. 'window' means "never silently dropped" fell back to fixed-size windows. */
|
|
17
|
+
export type CodeChunkMode = 'symbols' | 'window' | 'empty' | 'unchanged';
|
|
18
|
+
/** A chunk plus the exact text its embedding is computed from. */
|
|
19
|
+
export interface DraftChunk {
|
|
20
|
+
readonly chunk: CodeChunk;
|
|
21
|
+
readonly embedText: string;
|
|
22
|
+
}
|
|
23
|
+
/** The minimal tree-sitter surface chunking needs (structural, so tests can fake it). */
|
|
24
|
+
export interface ChunkingIntelligence {
|
|
25
|
+
detectLanguage(filePath: string): string | null;
|
|
26
|
+
getSymbols(filePath: string, content: string): Promise<SymbolInfo[]>;
|
|
27
|
+
}
|
|
28
|
+
export declare const DEFAULT_WINDOW_LINES = 60;
|
|
29
|
+
export declare const DEFAULT_WINDOW_OVERLAP_LINES = 10;
|
|
30
|
+
export declare function sha256(text: string): string;
|
|
31
|
+
export interface ChunkFileInput {
|
|
32
|
+
readonly intelligence: ChunkingIntelligence;
|
|
33
|
+
readonly absPath: string;
|
|
34
|
+
readonly relPath: string;
|
|
35
|
+
readonly content: string;
|
|
36
|
+
readonly fileHash: string;
|
|
37
|
+
readonly mtimeMs: number;
|
|
38
|
+
readonly windowLines?: number | undefined;
|
|
39
|
+
readonly windowOverlapLines?: number | undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Chunk one file's content. The caller is responsible for having initialized
|
|
43
|
+
* the intelligence facade (tree-sitter grammars) before calling.
|
|
44
|
+
*/
|
|
45
|
+
export declare function chunkFileContent(input: ChunkFileInput): Promise<{
|
|
46
|
+
drafts: DraftChunk[];
|
|
47
|
+
mode: CodeChunkMode;
|
|
48
|
+
}>;
|
|
49
|
+
//# sourceMappingURL=code-index-chunking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-index-chunking.d.ts","sourceRoot":"","sources":["../../../src/platform/state/code-index-chunking.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAsBrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAEzE,8FAA8F;AAC9F,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,kHAAkH;AAClH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAC;AAEzE,kEAAkE;AAClE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,yFAAyF;AACzF,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChD,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;CACtE;AAED,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAI/C,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClD;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC;IAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,CA+BxD"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
/**
|
|
3
|
+
* Code-index chunking — pure content → chunk transformation for CodeIndexStore
|
|
4
|
+
* (Wave-5, W5.3 Stage A; extracted from code-index-store.ts to keep that file
|
|
5
|
+
* within the 800-line source discipline).
|
|
6
|
+
*
|
|
7
|
+
* Everything here is side-effect-free with respect to the store: given file
|
|
8
|
+
* content plus a tree-sitter surface (ChunkingIntelligence), produce DraftChunk
|
|
9
|
+
* lists deterministically. The store owns storage, embedding, and lifecycle.
|
|
10
|
+
*
|
|
11
|
+
* Chunking contract (unchanged from the original in-store implementation):
|
|
12
|
+
* - Files with top-level tree-sitter symbols chunk one-per-symbol ('symbols').
|
|
13
|
+
* - Unsupported languages, parse failures, and symbol-less files fall back to
|
|
14
|
+
* fixed-size line windows ('window') — a non-empty file is never silently
|
|
15
|
+
* dropped.
|
|
16
|
+
* - Whitespace-only content yields zero chunks ('empty').
|
|
17
|
+
* - chunk_id is a deterministic function of path + line span + content hash,
|
|
18
|
+
* so identical trees always chunk identically.
|
|
19
|
+
*/
|
|
20
|
+
import { createHash } from 'node:crypto';
|
|
21
|
+
export const DEFAULT_WINDOW_LINES = 60;
|
|
22
|
+
export const DEFAULT_WINDOW_OVERLAP_LINES = 10;
|
|
23
|
+
/** Languages extractSymbols() actually understands (tree-sitter/queries.ts extractSymbols). Everything else always falls back to windowed chunking. */
|
|
24
|
+
const SYMBOL_SUPPORTED_LANGS = new Set(['typescript', 'tsx', 'javascript', 'python']);
|
|
25
|
+
export function sha256(text) {
|
|
26
|
+
return createHash('sha256').update(text).digest('hex');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Chunk one file's content. The caller is responsible for having initialized
|
|
30
|
+
* the intelligence facade (tree-sitter grammars) before calling.
|
|
31
|
+
*/
|
|
32
|
+
export async function chunkFileContent(input) {
|
|
33
|
+
const { intelligence, absPath, relPath, content, fileHash, mtimeMs } = input;
|
|
34
|
+
if (!content.trim())
|
|
35
|
+
return { drafts: [], mode: 'empty' };
|
|
36
|
+
const lang = intelligence.detectLanguage(absPath) ?? 'unknown';
|
|
37
|
+
let symbols = [];
|
|
38
|
+
if (SYMBOL_SUPPORTED_LANGS.has(lang)) {
|
|
39
|
+
symbols = await intelligence.getSymbols(absPath, content);
|
|
40
|
+
}
|
|
41
|
+
const topLevel = symbols.filter((symbol) => !symbol.container);
|
|
42
|
+
if (topLevel.length > 0) {
|
|
43
|
+
const lines = content.split('\n');
|
|
44
|
+
const drafts = topLevel.map((symbol) => makeSymbolChunk(relPath, lang, symbol, lines, fileHash, mtimeMs));
|
|
45
|
+
return { drafts, mode: 'symbols' };
|
|
46
|
+
}
|
|
47
|
+
// Unsupported language, parse failure, or a supported-language file with
|
|
48
|
+
// zero top-level declarations (e.g. a pure re-export barrel) — the index
|
|
49
|
+
// must never silently drop a non-empty file, so it falls back to windows.
|
|
50
|
+
const drafts = makeWindowChunks(relPath, lang, content, fileHash, mtimeMs, input.windowLines, input.windowOverlapLines);
|
|
51
|
+
return { drafts, mode: 'window' };
|
|
52
|
+
}
|
|
53
|
+
function makeSymbolChunk(relPath, lang, symbol, lines, fileHash, mtimeMs) {
|
|
54
|
+
const startLine = symbol.line;
|
|
55
|
+
const endLine = Math.max(symbol.endLine, symbol.line);
|
|
56
|
+
const slice = lines.slice(Math.max(0, startLine - 1), endLine).join('\n');
|
|
57
|
+
const embedText = `${lang} ${symbol.kind} ${symbol.name}\n${slice}`;
|
|
58
|
+
const contentHash = sha256(embedText);
|
|
59
|
+
const chunkId = sha256(`${relPath}:${startLine}-${endLine}:${contentHash}`);
|
|
60
|
+
return {
|
|
61
|
+
embedText,
|
|
62
|
+
chunk: {
|
|
63
|
+
chunkId,
|
|
64
|
+
path: relPath,
|
|
65
|
+
lang,
|
|
66
|
+
symbol: symbol.name,
|
|
67
|
+
kind: symbol.kind,
|
|
68
|
+
startLine,
|
|
69
|
+
endLine,
|
|
70
|
+
contentHash,
|
|
71
|
+
mtimeMs,
|
|
72
|
+
fileHash,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function makeWindowChunks(relPath, lang, content, fileHash, mtimeMs, windowLinesOption, windowOverlapOption) {
|
|
77
|
+
const lines = content.split('\n');
|
|
78
|
+
const windowSize = Math.max(1, windowLinesOption ?? DEFAULT_WINDOW_LINES);
|
|
79
|
+
const overlap = Math.max(0, Math.min(windowSize - 1, windowOverlapOption ?? DEFAULT_WINDOW_OVERLAP_LINES));
|
|
80
|
+
const step = Math.max(1, windowSize - overlap);
|
|
81
|
+
const drafts = [];
|
|
82
|
+
for (let start = 0; start < lines.length; start += step) {
|
|
83
|
+
const end = Math.min(lines.length, start + windowSize);
|
|
84
|
+
const slice = lines.slice(start, end).join('\n');
|
|
85
|
+
if (slice.trim()) {
|
|
86
|
+
const startLine = start + 1;
|
|
87
|
+
const endLine = end;
|
|
88
|
+
const embedText = `${lang} window ${relPath}\n${slice}`;
|
|
89
|
+
const contentHash = sha256(embedText);
|
|
90
|
+
const chunkId = sha256(`${relPath}:${startLine}-${endLine}:${contentHash}`);
|
|
91
|
+
drafts.push({
|
|
92
|
+
embedText,
|
|
93
|
+
chunk: {
|
|
94
|
+
chunkId,
|
|
95
|
+
path: relPath,
|
|
96
|
+
lang,
|
|
97
|
+
symbol: '',
|
|
98
|
+
kind: 'window',
|
|
99
|
+
startLine,
|
|
100
|
+
endLine,
|
|
101
|
+
contentHash,
|
|
102
|
+
mtimeMs,
|
|
103
|
+
fileHash,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (end >= lines.length)
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
return drafts;
|
|
111
|
+
}
|