macro-agent 0.1.8 → 0.1.10
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/CLAUDE.md +166 -33
- package/README.md +781 -131
- package/dist/acp/claude-code-replay.d.ts +11 -0
- package/dist/acp/claude-code-replay.d.ts.map +1 -0
- package/dist/acp/claude-code-replay.js +190 -0
- package/dist/acp/claude-code-replay.js.map +1 -0
- package/dist/acp/macro-agent.d.ts.map +1 -1
- package/dist/acp/macro-agent.js +155 -6
- package/dist/acp/macro-agent.js.map +1 -1
- package/dist/acp/types.d.ts +9 -0
- package/dist/acp/types.d.ts.map +1 -1
- package/dist/acp/types.js.map +1 -1
- package/dist/agent/agent-manager-v2.d.ts +21 -0
- package/dist/agent/agent-manager-v2.d.ts.map +1 -1
- package/dist/agent/agent-manager-v2.js +234 -43
- package/dist/agent/agent-manager-v2.js.map +1 -1
- package/dist/agent/agent-manager.d.ts +12 -0
- package/dist/agent/agent-manager.d.ts.map +1 -1
- package/dist/agent/agent-manager.js.map +1 -1
- package/dist/agent/types.d.ts +15 -2
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/boot-v2.d.ts +41 -0
- package/dist/boot-v2.d.ts.map +1 -1
- package/dist/boot-v2.js +16 -1
- package/dist/boot-v2.js.map +1 -1
- package/dist/cli/index.js +56 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cognitive/macro-agent-backend.d.ts.map +1 -1
- package/dist/cognitive/macro-agent-backend.js +40 -22
- package/dist/cognitive/macro-agent-backend.js.map +1 -1
- package/dist/integrations/skilltree.d.ts.map +1 -1
- package/dist/integrations/skilltree.js +1 -0
- package/dist/integrations/skilltree.js.map +1 -1
- package/dist/lifecycle/cleanup.d.ts +33 -2
- package/dist/lifecycle/cleanup.d.ts.map +1 -1
- package/dist/lifecycle/cleanup.js +28 -6
- package/dist/lifecycle/cleanup.js.map +1 -1
- package/dist/lifecycle/handlers-v2.d.ts +7 -0
- package/dist/lifecycle/handlers-v2.d.ts.map +1 -1
- package/dist/lifecycle/handlers-v2.js +28 -2
- package/dist/lifecycle/handlers-v2.js.map +1 -1
- package/dist/lifecycle/types.d.ts +11 -0
- package/dist/lifecycle/types.d.ts.map +1 -1
- package/dist/lifecycle/types.js.map +1 -1
- package/dist/map/acp-bridge.d.ts +9 -0
- package/dist/map/acp-bridge.d.ts.map +1 -1
- package/dist/map/acp-bridge.js +15 -2
- package/dist/map/acp-bridge.js.map +1 -1
- package/dist/map/cascade-bridge.d.ts +44 -0
- package/dist/map/cascade-bridge.d.ts.map +1 -0
- package/dist/map/cascade-bridge.js +257 -0
- package/dist/map/cascade-bridge.js.map +1 -0
- package/dist/map/lifecycle-bridge.d.ts +1 -1
- package/dist/map/lifecycle-bridge.d.ts.map +1 -1
- package/dist/map/lifecycle-bridge.js +58 -23
- package/dist/map/lifecycle-bridge.js.map +1 -1
- package/dist/map/server.d.ts.map +1 -1
- package/dist/map/server.js +47 -6
- package/dist/map/server.js.map +1 -1
- package/dist/map/sidecar.d.ts.map +1 -1
- package/dist/map/sidecar.js +33 -2
- package/dist/map/sidecar.js.map +1 -1
- package/dist/map/types.d.ts +20 -0
- package/dist/map/types.d.ts.map +1 -1
- package/dist/mcp/tools/done-v2.d.ts.map +1 -1
- package/dist/mcp/tools/done-v2.js +8 -0
- package/dist/mcp/tools/done-v2.js.map +1 -1
- package/dist/teams/team-manager-v2.d.ts.map +1 -1
- package/dist/teams/team-manager-v2.js +26 -0
- package/dist/teams/team-manager-v2.js.map +1 -1
- package/dist/teams/team-runtime-v2.d.ts.map +1 -1
- package/dist/teams/team-runtime-v2.js +16 -3
- package/dist/teams/team-runtime-v2.js.map +1 -1
- package/dist/workspace/config.d.ts +10 -10
- package/dist/workspace/config.d.ts.map +1 -1
- package/dist/workspace/config.js +4 -4
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/git-cascade-adapter.d.ts +510 -0
- package/dist/workspace/git-cascade-adapter.d.ts.map +1 -0
- package/dist/workspace/git-cascade-adapter.js +908 -0
- package/dist/workspace/git-cascade-adapter.js.map +1 -0
- package/dist/workspace/index.d.ts +3 -3
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +4 -4
- package/dist/workspace/index.js.map +1 -1
- package/dist/workspace/landing/direct-push.d.ts +20 -0
- package/dist/workspace/landing/direct-push.d.ts.map +1 -0
- package/dist/workspace/landing/direct-push.js +74 -0
- package/dist/workspace/landing/direct-push.js.map +1 -0
- package/dist/workspace/landing/index.d.ts +29 -0
- package/dist/workspace/landing/index.d.ts.map +1 -0
- package/dist/workspace/landing/index.js +37 -0
- package/dist/workspace/landing/index.js.map +1 -0
- package/dist/workspace/landing/merge-to-parent.d.ts +41 -0
- package/dist/workspace/landing/merge-to-parent.d.ts.map +1 -0
- package/dist/workspace/landing/merge-to-parent.js +185 -0
- package/dist/workspace/landing/merge-to-parent.js.map +1 -0
- package/dist/workspace/landing/optimistic-push.d.ts +16 -0
- package/dist/workspace/landing/optimistic-push.d.ts.map +1 -0
- package/dist/workspace/landing/optimistic-push.js +27 -0
- package/dist/workspace/landing/optimistic-push.js.map +1 -0
- package/dist/workspace/landing/queue-to-branch.d.ts +24 -0
- package/dist/workspace/landing/queue-to-branch.d.ts.map +1 -0
- package/dist/workspace/landing/queue-to-branch.js +79 -0
- package/dist/workspace/landing/queue-to-branch.js.map +1 -0
- package/dist/workspace/merge-queue/merge-queue.d.ts +10 -0
- package/dist/workspace/merge-queue/merge-queue.d.ts.map +1 -1
- package/dist/workspace/merge-queue/merge-queue.js +10 -0
- package/dist/workspace/merge-queue/merge-queue.js.map +1 -1
- package/dist/workspace/merge-queue/types.d.ts +16 -2
- package/dist/workspace/merge-queue/types.d.ts.map +1 -1
- package/dist/workspace/merge-queue/types.js +9 -0
- package/dist/workspace/merge-queue/types.js.map +1 -1
- package/dist/workspace/pool/types.d.ts +1 -0
- package/dist/workspace/pool/types.d.ts.map +1 -1
- package/dist/workspace/pool/worktree-pool.d.ts.map +1 -1
- package/dist/workspace/pool/worktree-pool.js +1 -0
- package/dist/workspace/pool/worktree-pool.js.map +1 -1
- package/dist/workspace/recovery/abandon.d.ts +15 -0
- package/dist/workspace/recovery/abandon.d.ts.map +1 -0
- package/dist/workspace/recovery/abandon.js +45 -0
- package/dist/workspace/recovery/abandon.js.map +1 -0
- package/dist/workspace/recovery/auto-resolve.d.ts +27 -0
- package/dist/workspace/recovery/auto-resolve.d.ts.map +1 -0
- package/dist/workspace/recovery/auto-resolve.js +99 -0
- package/dist/workspace/recovery/auto-resolve.js.map +1 -0
- package/dist/workspace/recovery/defer.d.ts +15 -0
- package/dist/workspace/recovery/defer.d.ts.map +1 -0
- package/dist/workspace/recovery/defer.js +16 -0
- package/dist/workspace/recovery/defer.js.map +1 -0
- package/dist/workspace/recovery/escalate.d.ts +16 -0
- package/dist/workspace/recovery/escalate.d.ts.map +1 -0
- package/dist/workspace/recovery/escalate.js +24 -0
- package/dist/workspace/recovery/escalate.js.map +1 -0
- package/dist/workspace/recovery/index.d.ts +32 -0
- package/dist/workspace/recovery/index.d.ts.map +1 -0
- package/dist/workspace/recovery/index.js +45 -0
- package/dist/workspace/recovery/index.js.map +1 -0
- package/dist/workspace/recovery/spawn-resolver.d.ts +45 -0
- package/dist/workspace/recovery/spawn-resolver.d.ts.map +1 -0
- package/dist/workspace/recovery/spawn-resolver.js +111 -0
- package/dist/workspace/recovery/spawn-resolver.js.map +1 -0
- package/dist/workspace/recovery/types.d.ts +63 -0
- package/dist/workspace/recovery/types.d.ts.map +1 -0
- package/dist/workspace/recovery/types.js +12 -0
- package/dist/workspace/recovery/types.js.map +1 -0
- package/dist/workspace/topology/index.d.ts +9 -0
- package/dist/workspace/topology/index.d.ts.map +1 -0
- package/dist/workspace/topology/index.js +8 -0
- package/dist/workspace/topology/index.js.map +1 -0
- package/dist/workspace/topology/no-workspace.d.ts +18 -0
- package/dist/workspace/topology/no-workspace.d.ts.map +1 -0
- package/dist/workspace/topology/no-workspace.js +25 -0
- package/dist/workspace/topology/no-workspace.js.map +1 -0
- package/dist/workspace/topology/types.d.ts +97 -0
- package/dist/workspace/topology/types.d.ts.map +1 -0
- package/dist/workspace/topology/types.js +20 -0
- package/dist/workspace/topology/types.js.map +1 -0
- package/dist/workspace/topology/yaml-driven.d.ts +69 -0
- package/dist/workspace/topology/yaml-driven.d.ts.map +1 -0
- package/dist/workspace/topology/yaml-driven.js +273 -0
- package/dist/workspace/topology/yaml-driven.js.map +1 -0
- package/dist/workspace/types-v3.d.ts +110 -0
- package/dist/workspace/types-v3.d.ts.map +1 -0
- package/dist/workspace/types-v3.js +20 -0
- package/dist/workspace/types-v3.js.map +1 -0
- package/dist/workspace/types.d.ts +145 -17
- package/dist/workspace/types.d.ts.map +1 -1
- package/dist/workspace/workspace-manager.d.ts +92 -13
- package/dist/workspace/workspace-manager.d.ts.map +1 -1
- package/dist/workspace/workspace-manager.js +373 -13
- package/dist/workspace/workspace-manager.js.map +1 -1
- package/dist/workspace/yaml-schema.d.ts +254 -0
- package/dist/workspace/yaml-schema.d.ts.map +1 -0
- package/dist/workspace/yaml-schema.js +170 -0
- package/dist/workspace/yaml-schema.js.map +1 -0
- package/docs/conflict-recovery.md +472 -0
- package/docs/git-cascade-integration-gaps.md +678 -0
- package/docs/workspace-interfaces.md +731 -0
- package/docs/workspace-redesign-plan.md +302 -0
- package/package.json +4 -4
- package/src/__tests__/e2e/auto-sync.e2e.test.ts +257 -0
- package/src/__tests__/e2e/cascade-rebase.e2e.test.ts +254 -0
- package/src/__tests__/e2e/cli-run.e2e.test.ts +167 -0
- package/src/__tests__/e2e/self-driving-v3.e2e.test.ts +197 -0
- package/src/__tests__/e2e/spawn-resolver.e2e.test.ts +200 -0
- package/src/__tests__/e2e/workspace-lifecycle.e2e.test.ts +30 -22
- package/src/__tests__/e2e/workspace-v3.e2e.test.ts +413 -0
- package/src/acp/__tests__/claude-code-replay.test.ts +225 -0
- package/src/acp/__tests__/macro-agent.test.ts +39 -1
- package/src/acp/claude-code-replay.ts +208 -0
- package/src/acp/macro-agent.ts +167 -9
- package/src/acp/types.ts +10 -0
- package/src/agent/__tests__/agent-manager-topology.test.ts +73 -0
- package/src/agent/__tests__/agent-manager-v2.test.ts +66 -0
- package/src/agent/__tests__/task-ref-resolution.test.ts +231 -0
- package/src/agent/agent-manager-v2.ts +293 -48
- package/src/agent/agent-manager.ts +14 -0
- package/src/agent/types.ts +16 -2
- package/src/boot-v2.ts +68 -1
- package/src/cli/index.ts +61 -0
- package/src/cognitive/macro-agent-backend.ts +45 -29
- package/src/integrations/skilltree.ts +1 -0
- package/src/lifecycle/cleanup.ts +52 -3
- package/src/lifecycle/handlers-v2.ts +40 -3
- package/src/lifecycle/types.ts +12 -0
- package/src/map/__tests__/cascade-bridge.test.ts +229 -0
- package/src/map/__tests__/lifecycle-bridge.test.ts +86 -10
- package/src/map/acp-bridge.ts +26 -3
- package/src/map/cascade-bridge.ts +301 -0
- package/src/map/lifecycle-bridge.ts +52 -17
- package/src/map/server.ts +47 -6
- package/src/map/sidecar.ts +31 -1
- package/src/map/types.ts +20 -0
- package/src/mcp/tools/done-v2.ts +9 -0
- package/src/teams/team-manager-v2.ts +37 -0
- package/src/teams/team-runtime-v2.ts +23 -3
- package/src/workspace/__tests__/{dataplane-adapter.test.ts → git-cascade-adapter.test.ts} +209 -14
- package/src/workspace/__tests__/self-driving-yaml.test.ts +114 -0
- package/src/workspace/__tests__/shared-worktree-refcount.test.ts +154 -0
- package/src/workspace/__tests__/standalone-mode.test.ts +118 -0
- package/src/workspace/__tests__/workspace-manager-v3.test.ts +245 -0
- package/src/workspace/__tests__/yaml-schema.test.ts +210 -0
- package/src/workspace/config.ts +11 -11
- package/src/workspace/git-cascade-adapter.ts +1186 -0
- package/src/workspace/index.ts +11 -11
- package/src/workspace/landing/__tests__/strategies.test.ts +142 -0
- package/src/workspace/landing/direct-push.ts +91 -0
- package/src/workspace/landing/index.ts +40 -0
- package/src/workspace/landing/merge-to-parent.ts +228 -0
- package/src/workspace/landing/optimistic-push.ts +36 -0
- package/src/workspace/landing/queue-to-branch.ts +108 -0
- package/src/workspace/merge-queue/merge-queue.ts +10 -0
- package/src/workspace/merge-queue/types.ts +16 -2
- package/src/workspace/pool/__tests__/worktree-pool.integration.test.ts +5 -5
- package/src/workspace/pool/types.ts +1 -0
- package/src/workspace/pool/worktree-pool.ts +1 -0
- package/src/workspace/recovery/__tests__/auto-resolve-integration.test.ts +127 -0
- package/src/workspace/recovery/__tests__/spawn-resolver.test.ts +139 -0
- package/src/workspace/recovery/__tests__/strategies.test.ts +145 -0
- package/src/workspace/recovery/abandon.ts +51 -0
- package/src/workspace/recovery/auto-resolve.ts +119 -0
- package/src/workspace/recovery/defer.ts +23 -0
- package/src/workspace/recovery/escalate.ts +30 -0
- package/src/workspace/recovery/index.ts +58 -0
- package/src/workspace/recovery/spawn-resolver.ts +145 -0
- package/src/workspace/recovery/types.ts +54 -0
- package/src/workspace/topology/__tests__/yaml-driven.test.ts +345 -0
- package/src/workspace/topology/index.ts +18 -0
- package/src/workspace/topology/no-workspace.ts +39 -0
- package/src/workspace/topology/types.ts +116 -0
- package/src/workspace/topology/yaml-driven.ts +316 -0
- package/src/workspace/types-v3.ts +155 -0
- package/src/workspace/types.ts +191 -20
- package/src/workspace/workspace-manager.ts +474 -19
- package/src/workspace/yaml-schema.ts +216 -0
- package/src/workspace/dataplane-adapter.ts +0 -546
package/src/workspace/types.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type TaskId = string;
|
|
|
29
29
|
/**
|
|
30
30
|
* Agent role types that require workspaces
|
|
31
31
|
*/
|
|
32
|
-
export type WorkspaceRole = 'worker' | 'integrator' | 'coordinator';
|
|
32
|
+
export type WorkspaceRole = 'worker' | 'integrator' | 'coordinator' | 'v3';
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Workspace represents an isolated git worktree assigned to an agent.
|
|
@@ -162,18 +162,22 @@ export interface CleanupStatus {
|
|
|
162
162
|
/**
|
|
163
163
|
* WorkspaceManager interface for managing agent workspaces.
|
|
164
164
|
*
|
|
165
|
-
* Bridges macro-agent roles to
|
|
165
|
+
* Bridges macro-agent roles to git-cascade streams and worktrees.
|
|
166
166
|
*
|
|
167
167
|
* @see [[s-7ktd]] WorkspaceManager API section
|
|
168
168
|
*/
|
|
169
169
|
export interface WorkspaceManager {
|
|
170
170
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
171
|
-
// Stream Management
|
|
171
|
+
// Stream Management (role-shaped; coexists with V3 stream-first surface below)
|
|
172
172
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
175
|
* Create an integration stream for a coordinator.
|
|
176
176
|
*
|
|
177
|
+
* Role-shaped convenience method. For stream-first semantics (fork from
|
|
178
|
+
* another stream, pseudo-principal ownership, richer metadata), prefer
|
|
179
|
+
* `createStreamV3({ name, ownerId, forkFrom, parent?, metadata? })`.
|
|
180
|
+
*
|
|
177
181
|
* @param coordinatorId - ID of the coordinator agent
|
|
178
182
|
* @param config - Stream configuration
|
|
179
183
|
* @returns Stream ID
|
|
@@ -189,16 +193,14 @@ export interface WorkspaceManager {
|
|
|
189
193
|
getStream(streamId: StreamId): Stream | null;
|
|
190
194
|
|
|
191
195
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
192
|
-
// Worktree Management
|
|
196
|
+
// Worktree Management (role-shaped; V3 `allocateWorktree` is role-neutral)
|
|
193
197
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
194
198
|
|
|
195
199
|
/**
|
|
196
200
|
* Create a workspace for a worker agent.
|
|
197
201
|
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
* @param streamId - ID of the integration stream
|
|
201
|
-
* @returns Worker workspace
|
|
202
|
+
* Role-shaped convenience. For role-neutral allocation, prefer
|
|
203
|
+
* `allocateWorktree({ agentId, streamId })`.
|
|
202
204
|
*/
|
|
203
205
|
createWorkerWorkspace(
|
|
204
206
|
workerId: AgentId,
|
|
@@ -209,9 +211,8 @@ export interface WorkspaceManager {
|
|
|
209
211
|
/**
|
|
210
212
|
* Create a workspace for an integrator agent.
|
|
211
213
|
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
* @returns Integrator workspace
|
|
214
|
+
* Role-shaped convenience. For role-neutral allocation, prefer
|
|
215
|
+
* `allocateWorktree({ agentId, streamId })`.
|
|
215
216
|
*/
|
|
216
217
|
createIntegratorWorkspace(
|
|
217
218
|
integratorId: AgentId,
|
|
@@ -221,9 +222,8 @@ export interface WorkspaceManager {
|
|
|
221
222
|
/**
|
|
222
223
|
* Create a workspace for a coordinator agent.
|
|
223
224
|
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* @returns Coordinator workspace
|
|
225
|
+
* Role-shaped convenience. For role-neutral allocation, prefer
|
|
226
|
+
* `allocateWorktree({ agentId, streamId })`.
|
|
227
227
|
*/
|
|
228
228
|
createCoordinatorWorkspace(
|
|
229
229
|
coordinatorId: AgentId,
|
|
@@ -238,12 +238,15 @@ export interface WorkspaceManager {
|
|
|
238
238
|
deallocateWorkspace(agentId: AgentId): void;
|
|
239
239
|
|
|
240
240
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
241
|
-
// Task Management
|
|
241
|
+
// Task Management (LEGACY — git-cascade task semantics; not used by V3)
|
|
242
242
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
243
243
|
|
|
244
244
|
/**
|
|
245
245
|
* Create a task under a stream.
|
|
246
246
|
*
|
|
247
|
+
* @deprecated V3 does not use git-cascade's `workerTasks` layer for
|
|
248
|
+
* task tracking; use opentasks via `TasksAdapter` instead. This method
|
|
249
|
+
* exists only for the legacy capability-based dispatch path.
|
|
247
250
|
* @param streamId - ID of the integration stream
|
|
248
251
|
* @param options - Task creation options
|
|
249
252
|
* @returns Task ID
|
|
@@ -253,6 +256,10 @@ export interface WorkspaceManager {
|
|
|
253
256
|
/**
|
|
254
257
|
* Claim a task for a worker.
|
|
255
258
|
*
|
|
259
|
+
* @deprecated See `createTask` — V3 uses opentasks. This method cuts the
|
|
260
|
+
* git-cascade worker branch via `startTask`; V3 equivalent is
|
|
261
|
+
* `allocateWorktree({ agentId, streamId })` + `commitChanges` on the
|
|
262
|
+
* stream branch directly.
|
|
256
263
|
* @param taskId - ID of the task to claim
|
|
257
264
|
* @param workerId - ID of the worker agent
|
|
258
265
|
* @param worktree - Path to the worker's worktree
|
|
@@ -263,6 +270,8 @@ export interface WorkspaceManager {
|
|
|
263
270
|
/**
|
|
264
271
|
* Get the next available task for a stream.
|
|
265
272
|
*
|
|
273
|
+
* @deprecated Use opentasks for task queueing; git-cascade's worker task
|
|
274
|
+
* layer is redundant in V3.
|
|
266
275
|
* @param streamId - ID of the integration stream
|
|
267
276
|
* @returns Next task or null if none available
|
|
268
277
|
*/
|
|
@@ -308,13 +317,146 @@ export interface WorkspaceManager {
|
|
|
308
317
|
/**
|
|
309
318
|
* Get the merge queue for coordinating worker merges.
|
|
310
319
|
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
320
|
+
* @deprecated Use git-cascade's built-in queue via the V3 surface —
|
|
321
|
+
* `workspaceManager.addToMergeQueue` (when exposed) or the
|
|
322
|
+
* `queue-to-branch` `LandingStrategy`. This method returns the legacy
|
|
323
|
+
* macro-agent MergeQueue that duplicates git-cascade's schema; kept for
|
|
324
|
+
* legacy callers until teams migrate to `macro_agent.workspace` YAML.
|
|
313
325
|
*
|
|
314
|
-
* @returns MergeQueue instance
|
|
326
|
+
* @returns Legacy MergeQueue instance (duplicate of git-cascade's queue)
|
|
315
327
|
*/
|
|
316
328
|
getMergeQueue(): MergeQueueInterface;
|
|
317
329
|
|
|
330
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
331
|
+
// V3 — Stream-first surface (additive; coexists with role-shaped methods above)
|
|
332
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Create a new stream. Stream-first equivalent of `createIntegrationStream`;
|
|
336
|
+
* does not require a coordinator owner — any `Principal` (including pseudo
|
|
337
|
+
* principals like `team:<name>`) can own.
|
|
338
|
+
*
|
|
339
|
+
* @see docs/workspace-interfaces.md §5
|
|
340
|
+
*/
|
|
341
|
+
createStreamV3(spec: import('./types-v3.js').StreamSpec): StreamId;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Fork a child stream from a parent. Enables stacking workflows (solo stack,
|
|
345
|
+
* long-lived feature + subtasks).
|
|
346
|
+
*/
|
|
347
|
+
forkStream(opts: {
|
|
348
|
+
parentStreamId: StreamId;
|
|
349
|
+
name: string;
|
|
350
|
+
ownerId: import('./types-v3.js').Principal;
|
|
351
|
+
metadata?: Record<string, unknown>;
|
|
352
|
+
}): StreamId;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Merge a source stream into a target stream.
|
|
356
|
+
*/
|
|
357
|
+
mergeStream(opts: {
|
|
358
|
+
sourceStreamId: StreamId;
|
|
359
|
+
targetStreamId: StreamId;
|
|
360
|
+
agentId: import('./types-v3.js').Principal;
|
|
361
|
+
worktree: string;
|
|
362
|
+
}): import('./types-v3.js').MergeResult;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Rebase a stream onto its parent.
|
|
366
|
+
*/
|
|
367
|
+
syncWithParent(opts: {
|
|
368
|
+
streamId: StreamId;
|
|
369
|
+
agentId: import('./types-v3.js').Principal;
|
|
370
|
+
worktree: string;
|
|
371
|
+
onConflict?: import('./types-v3.js').ConflictStrategy;
|
|
372
|
+
}): import('./types-v3.js').RebaseResult;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Lifecycle transitions for streams.
|
|
376
|
+
*/
|
|
377
|
+
abandonStream(streamId: StreamId, opts?: { cascade?: boolean; reason?: string }): void;
|
|
378
|
+
pauseStream(streamId: StreamId, reason?: string): void;
|
|
379
|
+
resumeStream(streamId: StreamId): void;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Stream queries.
|
|
383
|
+
*/
|
|
384
|
+
listStreams(filter?: {
|
|
385
|
+
ownerId?: import('./types-v3.js').Principal;
|
|
386
|
+
status?: import('./types-v3.js').Stream['status'];
|
|
387
|
+
}): import('./types-v3.js').Stream[];
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Commit with Change-Id tracking. Use this instead of raw `git commit` when
|
|
391
|
+
* committing on behalf of a streamed agent.
|
|
392
|
+
*/
|
|
393
|
+
commitChanges(opts: {
|
|
394
|
+
agentId: import('./types-v3.js').Principal;
|
|
395
|
+
streamId: StreamId;
|
|
396
|
+
worktree: string;
|
|
397
|
+
message: string;
|
|
398
|
+
}): { commit: string; changeId: import('./types-v3.js').ChangeId };
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Mark a set of changes as merged (e.g., after a landing strategy completes).
|
|
402
|
+
*/
|
|
403
|
+
markChangesMerged(changeIds: import('./types-v3.js').ChangeId[]): void;
|
|
404
|
+
|
|
405
|
+
getChange(changeId: import('./types-v3.js').ChangeId): import('./types-v3.js').Change | null;
|
|
406
|
+
getChangeByCommit(commit: string): import('./types-v3.js').Change | null;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Allocate a worktree for an agent, optionally attached to a stream.
|
|
410
|
+
* Stream-first equivalent of `createWorker/Integrator/CoordinatorWorkspace`.
|
|
411
|
+
*/
|
|
412
|
+
allocateWorktree(opts: import('./types-v3.js').AllocateWorktreeOpts): import('./types-v3.js').Worktree;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Get the worktree owned by a principal (if any).
|
|
416
|
+
*/
|
|
417
|
+
getWorktreeForAgent(agentId: import('./types-v3.js').Principal): import('./types-v3.js').Worktree | null;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Register a landing strategy. Registered strategies can be referenced by
|
|
421
|
+
* name from role YAML (see Phase 5 — `LandingStrategy` integration).
|
|
422
|
+
*/
|
|
423
|
+
registerLandingStrategy(strategy: import('./types-v3.js').LandingStrategy): void;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Run macro-level reconciliation:
|
|
427
|
+
* - Delegates to git-cascade's `reconcile()` for stream↔git sync.
|
|
428
|
+
* - Cleans up orphan worktrees and stale pool entries.
|
|
429
|
+
* Intended to be called once on boot.
|
|
430
|
+
*/
|
|
431
|
+
reconcileV3(): import('./types-v3.js').MacroReconcileResult;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Resolve a conflict record (typically called by a resolver agent via the
|
|
435
|
+
* `resolve_conflict` MCP tool after it fixes conflict markers and commits).
|
|
436
|
+
* Emits `conflict:resolved` event.
|
|
437
|
+
*/
|
|
438
|
+
resolveConflict(opts: {
|
|
439
|
+
conflictId: string;
|
|
440
|
+
resolvedBy: import('./types-v3.js').Principal;
|
|
441
|
+
resolutionCommit?: string;
|
|
442
|
+
/** How the conflict was resolved. Default 'agent'. */
|
|
443
|
+
method?:
|
|
444
|
+
| 'ours'
|
|
445
|
+
| 'theirs'
|
|
446
|
+
| 'manual'
|
|
447
|
+
| 'agent'
|
|
448
|
+
| 'auto-resolve'
|
|
449
|
+
| 'spawn-resolver'
|
|
450
|
+
| 'abandoned';
|
|
451
|
+
/** Human-readable resolution summary. */
|
|
452
|
+
summary?: string;
|
|
453
|
+
}): void;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Subscribe to workspace events. Returns an unsubscribe function.
|
|
457
|
+
*/
|
|
458
|
+
onEvent(callback: WorkspaceEventCallback): () => void;
|
|
459
|
+
|
|
318
460
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
319
461
|
// Lifecycle
|
|
320
462
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -326,14 +468,43 @@ export interface WorkspaceManager {
|
|
|
326
468
|
}
|
|
327
469
|
|
|
328
470
|
/**
|
|
329
|
-
* Events emitted by WorkspaceManager
|
|
471
|
+
* Events emitted by WorkspaceManager.
|
|
472
|
+
*
|
|
473
|
+
* Legacy events (`workspace:*`, `child:*`, `branches:*`, `branch:*`) drive the
|
|
474
|
+
* existing role-shaped lifecycle. V3 events (`stream:*`, `worktree:*`,
|
|
475
|
+
* `change:*`, `conflict:*`, `landing:*`, `cascade:*`, `mergeQueue:*`) drive the
|
|
476
|
+
* stream-first redesign and are re-emitted from the underlying git-cascade
|
|
477
|
+
* adapter. Consumers narrow on the type string.
|
|
330
478
|
*/
|
|
331
479
|
export type WorkspaceEventType =
|
|
332
480
|
| 'workspace:created'
|
|
333
481
|
| 'workspace:deallocated'
|
|
334
482
|
| 'child:registered'
|
|
335
483
|
| 'branches:cleaned'
|
|
336
|
-
| 'branch:deleted'
|
|
484
|
+
| 'branch:deleted'
|
|
485
|
+
// V3 additions — stream-first lifecycle
|
|
486
|
+
| 'stream:created'
|
|
487
|
+
| 'stream:forked'
|
|
488
|
+
| 'stream:committed'
|
|
489
|
+
| 'stream:merged'
|
|
490
|
+
| 'stream:conflicted'
|
|
491
|
+
| 'stream:abandoned'
|
|
492
|
+
| 'stream:paused'
|
|
493
|
+
| 'stream:resumed'
|
|
494
|
+
| 'worktree:allocated'
|
|
495
|
+
| 'worktree:shared'
|
|
496
|
+
| 'worktree:released'
|
|
497
|
+
| 'change:merged'
|
|
498
|
+
| 'change:dropped'
|
|
499
|
+
| 'conflict:created'
|
|
500
|
+
| 'conflict:resolved'
|
|
501
|
+
| 'landing:started'
|
|
502
|
+
| 'landing:completed'
|
|
503
|
+
| 'cascade:completed'
|
|
504
|
+
| 'mergeQueue:added'
|
|
505
|
+
| 'mergeQueue:ready'
|
|
506
|
+
| 'mergeQueue:cancelled'
|
|
507
|
+
| 'mergeQueue:removed';
|
|
337
508
|
|
|
338
509
|
/**
|
|
339
510
|
* Event payload for workspace events
|