@elizaos/plugin-agent-orchestrator 0.3.0 → 0.3.2

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.
Files changed (79) hide show
  1. package/dist/index.js +58 -37
  2. package/dist/index.js.map +9 -9
  3. package/package.json +1 -1
  4. package/dist/actions/coding-task-handlers.d.ts +0 -44
  5. package/dist/actions/coding-task-handlers.d.ts.map +0 -1
  6. package/dist/actions/coding-task-helpers.d.ts +0 -27
  7. package/dist/actions/coding-task-helpers.d.ts.map +0 -1
  8. package/dist/actions/finalize-workspace.d.ts +0 -11
  9. package/dist/actions/finalize-workspace.d.ts.map +0 -1
  10. package/dist/actions/list-agents.d.ts +0 -11
  11. package/dist/actions/list-agents.d.ts.map +0 -1
  12. package/dist/actions/manage-issues.d.ts +0 -11
  13. package/dist/actions/manage-issues.d.ts.map +0 -1
  14. package/dist/actions/provision-workspace.d.ts +0 -11
  15. package/dist/actions/provision-workspace.d.ts.map +0 -1
  16. package/dist/actions/send-to-agent.d.ts +0 -11
  17. package/dist/actions/send-to-agent.d.ts.map +0 -1
  18. package/dist/actions/spawn-agent.d.ts +0 -11
  19. package/dist/actions/spawn-agent.d.ts.map +0 -1
  20. package/dist/actions/start-coding-task.d.ts +0 -17
  21. package/dist/actions/start-coding-task.d.ts.map +0 -1
  22. package/dist/actions/stop-agent.d.ts +0 -11
  23. package/dist/actions/stop-agent.d.ts.map +0 -1
  24. package/dist/api/agent-routes.d.ts +0 -18
  25. package/dist/api/agent-routes.d.ts.map +0 -1
  26. package/dist/api/coordinator-routes.d.ts +0 -22
  27. package/dist/api/coordinator-routes.d.ts.map +0 -1
  28. package/dist/api/issue-routes.d.ts +0 -17
  29. package/dist/api/issue-routes.d.ts.map +0 -1
  30. package/dist/api/routes.d.ts +0 -36
  31. package/dist/api/routes.d.ts.map +0 -1
  32. package/dist/api/workspace-routes.d.ts +0 -17
  33. package/dist/api/workspace-routes.d.ts.map +0 -1
  34. package/dist/index.d.ts +0 -33
  35. package/dist/index.d.ts.map +0 -1
  36. package/dist/providers/action-examples.d.ts +0 -13
  37. package/dist/providers/action-examples.d.ts.map +0 -1
  38. package/dist/providers/active-workspace-context.d.ts +0 -13
  39. package/dist/providers/active-workspace-context.d.ts.map +0 -1
  40. package/dist/services/agent-metrics.d.ts +0 -28
  41. package/dist/services/agent-metrics.d.ts.map +0 -1
  42. package/dist/services/agent-selection.d.ts +0 -53
  43. package/dist/services/agent-selection.d.ts.map +0 -1
  44. package/dist/services/ansi-utils.d.ts +0 -48
  45. package/dist/services/ansi-utils.d.ts.map +0 -1
  46. package/dist/services/pty-auto-response.d.ts +0 -30
  47. package/dist/services/pty-auto-response.d.ts.map +0 -1
  48. package/dist/services/pty-init.d.ts +0 -45
  49. package/dist/services/pty-init.d.ts.map +0 -1
  50. package/dist/services/pty-service.d.ts +0 -92
  51. package/dist/services/pty-service.d.ts.map +0 -1
  52. package/dist/services/pty-session-io.d.ts +0 -46
  53. package/dist/services/pty-session-io.d.ts.map +0 -1
  54. package/dist/services/pty-spawn.d.ts +0 -50
  55. package/dist/services/pty-spawn.d.ts.map +0 -1
  56. package/dist/services/pty-types.d.ts +0 -80
  57. package/dist/services/pty-types.d.ts.map +0 -1
  58. package/dist/services/stall-classifier.d.ts +0 -44
  59. package/dist/services/stall-classifier.d.ts.map +0 -1
  60. package/dist/services/swarm-coordinator-prompts.d.ts +0 -75
  61. package/dist/services/swarm-coordinator-prompts.d.ts.map +0 -1
  62. package/dist/services/swarm-coordinator.d.ts +0 -196
  63. package/dist/services/swarm-coordinator.d.ts.map +0 -1
  64. package/dist/services/swarm-decision-loop.d.ts +0 -44
  65. package/dist/services/swarm-decision-loop.d.ts.map +0 -1
  66. package/dist/services/swarm-event-triage.d.ts +0 -49
  67. package/dist/services/swarm-event-triage.d.ts.map +0 -1
  68. package/dist/services/swarm-idle-watchdog.d.ts +0 -22
  69. package/dist/services/swarm-idle-watchdog.d.ts.map +0 -1
  70. package/dist/services/workspace-git-ops.d.ts +0 -28
  71. package/dist/services/workspace-git-ops.d.ts.map +0 -1
  72. package/dist/services/workspace-github.d.ts +0 -58
  73. package/dist/services/workspace-github.d.ts.map +0 -1
  74. package/dist/services/workspace-lifecycle.d.ts +0 -18
  75. package/dist/services/workspace-lifecycle.d.ts.map +0 -1
  76. package/dist/services/workspace-service.d.ts +0 -84
  77. package/dist/services/workspace-service.d.ts.map +0 -1
  78. package/dist/services/workspace-types.d.ts +0 -81
  79. package/dist/services/workspace-types.d.ts.map +0 -1
@@ -1,196 +0,0 @@
1
- /**
2
- * Swarm Coordinator — Event Bridge & Autonomous Coordination Loop
3
- *
4
- * Bridges PTY session events to:
5
- * 1. SSE clients (frontend dashboard) for real-time status
6
- * 2. LLM coordination decisions for unhandled blocking prompts
7
- *
8
- * The coordinator subscribes to PTYService session events and:
9
- * - Skips events already handled by auto-response rules (autoResponded=true)
10
- * - Routes unhandled blocking prompts through supervision levels:
11
- * - autonomous: LLM decides immediately
12
- * - confirm: queued for human approval
13
- * - notify: broadcast only (no action)
14
- *
15
- * Heavy logic is extracted into:
16
- * - swarm-decision-loop.ts (blocked, turn-complete, LLM decisions)
17
- * - swarm-idle-watchdog.ts (idle session scanning)
18
- *
19
- * @module services/swarm-coordinator
20
- */
21
- import type { ServerResponse } from "node:http";
22
- import type { IAgentRuntime } from "@elizaos/core";
23
- import type { PTYService } from "./pty-service.js";
24
- import type { CodingAgentType } from "./pty-types.js";
25
- import type { CoordinationLLMResponse } from "./swarm-coordinator-prompts.js";
26
- /** Callback injected by server.ts to route chat messages to the user's conversation. */
27
- export type ChatMessageCallback = (text: string, source?: string) => Promise<void>;
28
- /** Callback injected by server.ts to relay coordinator events to WebSocket clients. */
29
- export type WsBroadcastCallback = (event: SwarmEvent) => void;
30
- /**
31
- * Callback injected by server.ts to route coordinator events through
32
- * Milaidy's full ElizaOS pipeline (conversation memory, personality, actions).
33
- * Returns a CoordinationLLMResponse parsed from Milaidy's natural language
34
- * response, or null if no actionable JSON block was found.
35
- */
36
- export type AgentDecisionCallback = (eventDescription: string, sessionId: string, taskContext: TaskContext) => Promise<CoordinationLLMResponse | null>;
37
- export type SupervisionLevel = "autonomous" | "confirm" | "notify";
38
- export interface TaskContext {
39
- sessionId: string;
40
- agentType: CodingAgentType;
41
- label: string;
42
- originalTask: string;
43
- workdir: string;
44
- /** Repository URL if provided, undefined for scratch directory tasks. */
45
- repo?: string;
46
- status: "active" | "completed" | "error" | "stopped";
47
- decisions: CoordinationDecision[];
48
- autoResolvedCount: number;
49
- registeredAt: number;
50
- /** Timestamp of the last session event (any type). Used by idle watchdog. */
51
- lastActivityAt: number;
52
- /** How many idle checks have been performed on this session. */
53
- idleCheckCount: number;
54
- }
55
- export interface CoordinationDecision {
56
- timestamp: number;
57
- event: string;
58
- promptText: string;
59
- decision: "respond" | "escalate" | "ignore" | "complete" | "auto_resolved";
60
- response?: string;
61
- reasoning: string;
62
- }
63
- export interface SwarmEvent {
64
- type: string;
65
- sessionId: string;
66
- timestamp: number;
67
- data: unknown;
68
- }
69
- export interface PendingDecision {
70
- sessionId: string;
71
- promptText: string;
72
- recentOutput: string;
73
- llmDecision: CoordinationLLMResponse;
74
- taskContext: TaskContext;
75
- createdAt: number;
76
- }
77
- /**
78
- * Context interface exposing internal state and helpers to extracted modules.
79
- * Implemented by SwarmCoordinator — passed as `this` to module-level functions.
80
- */
81
- export interface SwarmCoordinatorContext {
82
- readonly runtime: IAgentRuntime;
83
- readonly ptyService: PTYService | null;
84
- readonly tasks: Map<string, TaskContext>;
85
- readonly inFlightDecisions: Set<string>;
86
- readonly pendingDecisions: Map<string, PendingDecision>;
87
- /** Last-seen output snapshot per session — used by idle watchdog. */
88
- readonly lastSeenOutput: Map<string, string>;
89
- /** Timestamp of last tool_running chat notification per session — for throttling. */
90
- readonly lastToolNotification: Map<string, number>;
91
- /** Whether LLM decisions are paused (user sent a chat message). */
92
- readonly isPaused: boolean;
93
- broadcast(event: SwarmEvent): void;
94
- sendChatMessage(text: string, source?: string): void;
95
- log(message: string): void;
96
- getSupervisionLevel(): SupervisionLevel;
97
- getAgentDecisionCallback(): AgentDecisionCallback | null;
98
- }
99
- export declare class SwarmCoordinator implements SwarmCoordinatorContext {
100
- static serviceType: string;
101
- readonly runtime: IAgentRuntime;
102
- ptyService: PTYService | null;
103
- private unsubscribeEvents;
104
- /** Per-session task context. */
105
- readonly tasks: Map<string, TaskContext>;
106
- /** SSE clients receiving live events. */
107
- private sseClients;
108
- /** Supervision level (default: autonomous). */
109
- private supervisionLevel;
110
- /** Pending confirmations for "confirm" mode. */
111
- readonly pendingDecisions: Map<string, PendingDecision>;
112
- /** In-flight decision lock — prevents parallel LLM calls for same session. */
113
- readonly inFlightDecisions: Set<string>;
114
- /** Callback to send chat messages to the user's conversation UI. */
115
- private chatCallback;
116
- /** Callback to relay coordinator events to WebSocket clients. */
117
- private wsBroadcast;
118
- /** Callback to route coordinator events through Milaidy's full pipeline. */
119
- private agentDecisionCb;
120
- /** Buffer for events arriving before task registration. */
121
- private unregisteredBuffer;
122
- /** Idle watchdog timer handle. */
123
- private idleWatchdogTimer;
124
- /** Last-seen output snapshot per session — used by idle watchdog to detect data flow. */
125
- readonly lastSeenOutput: Map<string, string>;
126
- /** Timestamp of last tool_running chat notification per session — for throttling. */
127
- readonly lastToolNotification: Map<string, number>;
128
- /** Whether LLM decisions are paused (user sent a chat message). */
129
- private _paused;
130
- /** Buffered events during pause — replayed on resume. */
131
- private pauseBuffer;
132
- /** Auto-resume timeout handle. */
133
- private pauseTimeout;
134
- constructor(runtime: IAgentRuntime);
135
- /** Inject a callback (from server.ts) to route messages to the user's chat UI. */
136
- setChatCallback(cb: ChatMessageCallback): void;
137
- /** Inject a callback (from server.ts) to relay events to WebSocket clients. */
138
- setWsBroadcast(cb: WsBroadcastCallback): void;
139
- /** Inject a callback (from server.ts) to route events through Milaidy's pipeline. */
140
- setAgentDecisionCallback(cb: AgentDecisionCallback): void;
141
- /** Return the agent decision callback (if wired). */
142
- getAgentDecisionCallback(): AgentDecisionCallback | null;
143
- /** Null-safe wrapper — sends a message to the user's conversation if callback is set. */
144
- sendChatMessage(text: string, source?: string): void;
145
- /**
146
- * Initialize the coordinator by subscribing to PTY session events.
147
- * Called from plugin init after services are ready.
148
- */
149
- start(ptyService: PTYService): void;
150
- stop(): void;
151
- /** Whether the coordinator is currently paused. */
152
- get isPaused(): boolean;
153
- /** Pause LLM-based decisions. Auto-responses and broadcasts continue. */
154
- pause(): void;
155
- /** Resume LLM-based decisions and replay buffered events. */
156
- resume(): void;
157
- registerTask(sessionId: string, context: {
158
- agentType: CodingAgentType;
159
- label: string;
160
- originalTask: string;
161
- workdir: string;
162
- repo?: string;
163
- }): void;
164
- /**
165
- * Return the repo URL from the most recently registered task that had one.
166
- * Useful as a fallback when the user says "in the same repo" without a URL.
167
- */
168
- getLastUsedRepo(): string | undefined;
169
- getTaskContext(sessionId: string): TaskContext | undefined;
170
- getAllTaskContexts(): TaskContext[];
171
- /**
172
- * Register an SSE client. Returns an unsubscribe function.
173
- * Sends a snapshot of current state on connect.
174
- */
175
- addSseClient(res: ServerResponse): () => void;
176
- broadcast(event: SwarmEvent): void;
177
- private writeSseEvent;
178
- handleSessionEvent(sessionId: string, event: string, data: unknown): Promise<void>;
179
- makeCoordinationDecision(taskCtx: TaskContext, promptText: string, recentOutput: string): Promise<CoordinationLLMResponse | null>;
180
- executeDecision(sessionId: string, decision: CoordinationLLMResponse): Promise<void>;
181
- /**
182
- * Public entry point for external callers (e.g. server.ts) to execute
183
- * a coordination decision on a session. Wraps the internal executeDecision.
184
- */
185
- executeEventDecision(sessionId: string, decision: CoordinationLLMResponse): Promise<void>;
186
- setSupervisionLevel(level: SupervisionLevel): void;
187
- getSupervisionLevel(): SupervisionLevel;
188
- getPendingConfirmations(): PendingDecision[];
189
- confirmDecision(sessionId: string, approved: boolean, override?: {
190
- response?: string;
191
- useKeys?: boolean;
192
- keys?: string[];
193
- }): Promise<void>;
194
- log(message: string): void;
195
- }
196
- //# sourceMappingURL=swarm-coordinator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"swarm-coordinator.d.ts","sourceRoot":"","sources":["../../src/services/swarm-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAW9E,wFAAwF;AACxF,MAAM,MAAM,mBAAmB,GAAG,CAChC,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,MAAM,KACZ,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,uFAAuF;AACvF,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAClC,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,WAAW,KACrB,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC;AAE7C,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEnE,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,eAAe,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,CAAC;IACrD,SAAS,EAAE,o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GAAG,WAAW,GAAG,SAAS;IAI1D,kBAAkB,IAAI,WAAW,EAAE;IAMnC;;;OAGG;IACH,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,IAAI;IAyB7C,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAiBlC,OAAO,CAAC,aAAa;IAUf,kBAAkB,CACtB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,IAAI,CAAC;IAmNV,wBAAwB,CAC5B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC;IAQpC,eAAe,CACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,uBAAuB,GAChC,OAAO,CAAC,IAAI,CAAC;IAIhB;;;OAGG;IACG,oBAAoB,CACxB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,uBAAuB,GAChC,OAAO,CAAC,IAAI,CAAC;IAMhB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAWlD,mBAAmB,IAAI,gBAAgB;IAMvC,uBAAuB,IAAI,eAAe,EAAE;IAItC,eAAe,CACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EACjB,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GACnE,OAAO,CAAC,IAAI,CAAC;IA0EhB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG3B"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Swarm Coordinator — Decision Loop & Blocked/Turn-Complete Handlers
3
- *
4
- * Extracted from swarm-coordinator.ts for modularity.
5
- * All functions are pure async helpers that receive a SwarmCoordinatorContext
6
- * to access shared state and services.
7
- *
8
- * @module services/swarm-decision-loop
9
- */
10
- import type { SwarmCoordinatorContext, TaskContext } from "./swarm-coordinator.js";
11
- import { type CoordinationLLMResponse } from "./swarm-coordinator-prompts.js";
12
- /** Check if a permission prompt references paths outside the workspace. */
13
- export declare function isOutOfScopeAccess(promptText: string, workdir: string): boolean;
14
- /**
15
- * Check if all registered tasks have reached a terminal state.
16
- * If so, send a swarm-wide summary message to the chat.
17
- */
18
- export declare function checkAllTasksComplete(ctx: SwarmCoordinatorContext): void;
19
- /**
20
- * Ask the LLM to make a coordination decision about a blocked agent.
21
- */
22
- export declare function makeCoordinationDecision(ctx: SwarmCoordinatorContext, taskCtx: TaskContext, promptText: string, recentOutput: string): Promise<CoordinationLLMResponse | null>;
23
- /**
24
- * Execute a coordination decision — send response, complete session, escalate, or ignore.
25
- */
26
- export declare function executeDecision(ctx: SwarmCoordinatorContext, sessionId: string, decision: CoordinationLLMResponse): Promise<void>;
27
- /**
28
- * Handle a "blocked" session event — auto-resolved, escalated, or routed to decision loop.
29
- */
30
- export declare function handleBlocked(ctx: SwarmCoordinatorContext, sessionId: string, taskCtx: TaskContext, data: unknown): Promise<void>;
31
- /**
32
- * Handle a turn completion event. Instead of immediately stopping the session,
33
- * ask the LLM whether the overall task is done or the agent needs more turns.
34
- */
35
- export declare function handleTurnComplete(ctx: SwarmCoordinatorContext, sessionId: string, taskCtx: TaskContext, data: unknown): Promise<void>;
36
- /**
37
- * Handle an autonomous decision for a blocked session — call the LLM and execute immediately.
38
- */
39
- export declare function handleAutonomousDecision(ctx: SwarmCoordinatorContext, sessionId: string, taskCtx: TaskContext, promptText: string, recentOutput: string, promptType?: string): Promise<void>;
40
- /**
41
- * Handle a confirm-mode decision — call LLM, then queue for human approval.
42
- */
43
- export declare function handleConfirmDecision(ctx: SwarmCoordinatorContext, sessionId: string, taskCtx: TaskContext, promptText: string, recentOutput: string, promptType?: string): Promise<void>;
44
- //# sourceMappingURL=swarm-decision-loop.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"swarm-decision-loop.d.ts","sourceRoot":"","sources":["../../src/services/swarm-decision-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EACV,uBAAuB,EACvB,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAKL,KAAK,uBAAuB,EAI7B,MAAM,gCAAgC,CAAC;AAiDxC,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CA2BT;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,uBAAuB,GAAG,IAAI,CAuCxE;AAkBD;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,uBAAuB,EAC5B,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAiBzC;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,uBAAuB,EAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,uBAAuB,GAChC,OAAO,CAAC,IAAI,CAAC,CAmEf;AAID;;GAEG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,uBAAuB,EAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,IAAI,CAAC,CAgJf;AAID;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,uBAAuB,EAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,IAAI,CAAC,CAsJf;AAID;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,uBAAuB,EAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAmKf;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,uBAAuB,EAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAwGf"}
@@ -1,49 +0,0 @@
1
- /**
2
- * Event Triage — classifies coordinator events as "routine" or "creative"
3
- * to route them to the fast small-LLM path or the full Milaidy pipeline.
4
- *
5
- * Tier 1 (auto-response rules at PTY worker) already handled before we get here.
6
- * This module splits the remaining events into:
7
- * - "routine": simple approvals, permissions, config prompts → small LLM (~1-2s)
8
- * - "creative": error recovery, design questions, task evaluation → Milaidy (~5-10s)
9
- *
10
- * Pure functions — no side effects, same pattern as stall-classifier.ts.
11
- *
12
- * @module services/swarm-event-triage
13
- */
14
- import { type IAgentRuntime } from "@elizaos/core";
15
- export type TriageTier = "routine" | "creative";
16
- export interface TriageContext {
17
- /** "blocked" or "turn_complete" */
18
- eventType: "blocked" | "turn_complete";
19
- /** The blocking prompt text (empty for turn completions). */
20
- promptText: string;
21
- /** Adapter's promptInfo.type if available. */
22
- promptType?: string;
23
- /** Recent terminal output (for turn completions). */
24
- recentOutput?: string;
25
- /** The original task description. */
26
- originalTask: string;
27
- }
28
- /**
29
- * Classify an event tier using only heuristics (prompt type + regex).
30
- * Returns null if inconclusive.
31
- */
32
- export declare function classifyByHeuristic(ctx: TriageContext): TriageTier | null;
33
- /**
34
- * Build a short classifier prompt for ambiguous events.
35
- */
36
- export declare function buildTriagePrompt(ctx: TriageContext): string;
37
- /**
38
- * Parse the LLM's triage response. Returns null on failure.
39
- */
40
- export declare function parseTriageResponse(llmOutput: string): TriageTier | null;
41
- /**
42
- * Main entry point: classify an event as routine or creative.
43
- *
44
- * 1. Heuristics (0ms)
45
- * 2. Small LLM classifier (~500ms-1s) if heuristics are inconclusive
46
- * 3. Default to "creative" if classifier fails (safe default)
47
- */
48
- export declare function classifyEventTier(runtime: IAgentRuntime, ctx: TriageContext, log: (msg: string) => void): Promise<TriageTier>;
49
- //# sourceMappingURL=swarm-event-triage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"swarm-event-triage.d.ts","sourceRoot":"","sources":["../../src/services/swarm-event-triage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,eAAe,CAAC;AAI9D,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,SAAS,EAAE,SAAS,GAAG,eAAe,CAAC;IACvC,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;CACtB;AAmED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,UAAU,GAAG,IAAI,CAgCzE;AAID;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAc5D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAaxE;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACzB,OAAO,CAAC,UAAU,CAAC,CAwBrB"}
@@ -1,22 +0,0 @@
1
- /**
2
- * Swarm Coordinator — Idle Watchdog
3
- *
4
- * Extracted from swarm-coordinator.ts for modularity.
5
- * Scans active sessions for idle ones and asks the LLM to assess their state.
6
- *
7
- * @module services/swarm-idle-watchdog
8
- */
9
- import type { SwarmCoordinatorContext, TaskContext } from "./swarm-coordinator.js";
10
- /** How long a session can be idle before the watchdog checks on it (ms). */
11
- export declare const IDLE_THRESHOLD_MS: number;
12
- /** Max idle checks before force-escalating a session. */
13
- export declare const MAX_IDLE_CHECKS = 4;
14
- /**
15
- * Scan all active sessions for idle ones. Called periodically by the watchdog timer.
16
- */
17
- export declare function scanIdleSessions(ctx: SwarmCoordinatorContext): Promise<void>;
18
- /**
19
- * Handle an idle session by asking the LLM to assess its state.
20
- */
21
- export declare function handleIdleCheck(ctx: SwarmCoordinatorContext, taskCtx: TaskContext, idleMinutes: number): Promise<void>;
22
- //# sourceMappingURL=swarm-idle-watchdog.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"swarm-idle-watchdog.d.ts","sourceRoot":"","sources":["../../src/services/swarm-idle-watchdog.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EACV,uBAAuB,EACvB,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAYhC,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,QAAgB,CAAC;AAE/C,yDAAyD;AACzD,eAAO,MAAM,eAAe,IAAI,CAAC;AAIjC;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,uBAAuB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA6Hf;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,uBAAuB,EAC5B,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAoHf"}
@@ -1,28 +0,0 @@
1
- /**
2
- * Git operations for Coding Workspace Service
3
- *
4
- * Extracted from workspace-service.ts — provides git status, commit, push,
5
- * and PR creation as standalone functions operating on workspace paths.
6
- *
7
- * @module services/workspace-git-ops
8
- */
9
- import type { PullRequestInfo, WorkspaceService } from "git-workspace-service";
10
- import type { CommitOptions, PROptions, PushOptions, WorkspaceResult, WorkspaceStatusResult } from "./workspace-service.js";
11
- /**
12
- * Get workspace git status (branch, staged/modified/untracked files).
13
- */
14
- export declare function getStatus(workspacePath: string): Promise<WorkspaceStatusResult>;
15
- /**
16
- * Commit changes in a workspace directory.
17
- * Returns the commit hash.
18
- */
19
- export declare function commit(workspacePath: string, options: CommitOptions, log: (msg: string) => void): Promise<string>;
20
- /**
21
- * Push changes to remote for a workspace.
22
- */
23
- export declare function push(workspacePath: string, branch: string, options: PushOptions | undefined, log: (msg: string) => void): Promise<void>;
24
- /**
25
- * Create a pull request for a workspace via the underlying WorkspaceService.
26
- */
27
- export declare function createPR(workspaceService: WorkspaceService, workspace: WorkspaceResult, workspaceId: string, options: PROptions, log: (msg: string) => void): Promise<PullRequestInfo>;
28
- //# sourceMappingURL=workspace-git-ops.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace-git-ops.d.ts","sourceRoot":"","sources":["../../src/services/workspace-git-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,eAAe,EAEf,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,WAAW,EACX,eAAe,EACf,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,wBAAsB,SAAS,CAC7B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,qBAAqB,CAAC,CAuChC;AAED;;;GAGG;AACH,wBAAsB,MAAM,CAC1B,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACzB,OAAO,CAAC,MAAM,CAAC,CAkBjB;AAED;;GAEG;AACH,wBAAsB,IAAI,CACxB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACzB,OAAO,CAAC,IAAI,CAAC,CAaf;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC5B,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,eAAe,EAC1B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,SAAS,EAClB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACzB,OAAO,CAAC,eAAe,CAAC,CAsB1B"}
@@ -1,58 +0,0 @@
1
- /**
2
- * GitHub integration for Coding Workspace Service
3
- *
4
- * Extracted from workspace-service.ts — provides GitHub API access
5
- * via PAT or OAuth device flow, plus all issue management operations.
6
- *
7
- * @module services/workspace-github
8
- */
9
- import type { IAgentRuntime } from "@elizaos/core";
10
- import { type CreateIssueOptions, GitHubPatClient, type IssueComment, type IssueInfo, type IssueState } from "git-workspace-service";
11
- /**
12
- * Callback for surfacing auth prompts to the user.
13
- * Returns the auth prompt text so Milady can relay it through chat.
14
- */
15
- export type AuthPromptCallback = (prompt: {
16
- verificationUri: string;
17
- userCode: string;
18
- expiresIn: number;
19
- }) => void;
20
- /**
21
- * Context object passed by CodingWorkspaceService into every GitHub function.
22
- * Lets us keep the extracted functions stateless while still mutating shared state.
23
- */
24
- export interface GitHubContext {
25
- runtime: IAgentRuntime;
26
- githubClient: GitHubPatClient | null;
27
- setGithubClient: (client: GitHubPatClient) => void;
28
- githubAuthInProgress: Promise<GitHubPatClient> | null;
29
- setGithubAuthInProgress: (p: Promise<GitHubPatClient> | null) => void;
30
- authPromptCallback: AuthPromptCallback | null;
31
- log: (msg: string) => void;
32
- }
33
- export declare function parseOwnerRepo(repo: string): {
34
- owner: string;
35
- repo: string;
36
- };
37
- export declare function ensureGitHubClient(ctx: GitHubContext): Promise<GitHubPatClient>;
38
- export declare function performOAuthFlow(ctx: GitHubContext, clientId: string): Promise<GitHubPatClient>;
39
- export declare function createIssue(ctx: GitHubContext, repo: string, options: CreateIssueOptions): Promise<IssueInfo>;
40
- export declare function getIssue(ctx: GitHubContext, repo: string, issueNumber: number): Promise<IssueInfo>;
41
- export declare function listIssues(ctx: GitHubContext, repo: string, options?: {
42
- state?: IssueState | "all";
43
- labels?: string[];
44
- assignee?: string;
45
- }): Promise<IssueInfo[]>;
46
- export declare function updateIssue(ctx: GitHubContext, repo: string, issueNumber: number, options: {
47
- title?: string;
48
- body?: string;
49
- state?: IssueState;
50
- labels?: string[];
51
- assignees?: string[];
52
- }): Promise<IssueInfo>;
53
- export declare function addComment(ctx: GitHubContext, repo: string, issueNumber: number, body: string): Promise<IssueComment>;
54
- export declare function listComments(ctx: GitHubContext, repo: string, issueNumber: number): Promise<IssueComment[]>;
55
- export declare function closeIssue(ctx: GitHubContext, repo: string, issueNumber: number): Promise<IssueInfo>;
56
- export declare function reopenIssue(ctx: GitHubContext, repo: string, issueNumber: number): Promise<IssueInfo>;
57
- export declare function addLabels(ctx: GitHubContext, repo: string, issueNumber: number, labels: string[]): Promise<void>;
58
- //# sourceMappingURL=workspace-github.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace-github.d.ts","sourceRoot":"","sources":["../../src/services/workspace-github.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,KAAK,kBAAkB,EACvB,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,UAAU,EAEhB,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,KAAK,IAAI,CAAC;AAEX;;;GAGG;AACH,MAAM,WAAW,aAA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,EAAE,CAAC,CAItB;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IACP,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,GACA,OAAO,CAAC,SAAS,CAAC,CAIpB;AAED,wBAAsB,UAAU,CAC9B,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,YAAY,CAAC,CAIvB;AAED,wBAAsB,YAAY,CAChC,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,YAAY,EAAE,CAAC,CAIzB;AAED,wBAAsB,UAAU,CAC9B,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,SAAS,CAAC,CAMpB;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,SAAS,CAAC,CAIpB;AAED,wBAAsB,SAAS,CAC7B,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,IAAI,CAAC,CAIf"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Workspace lifecycle utilities — garbage collection and scratch directory cleanup.
3
- *
4
- * Extracted from workspace-service.ts to reduce module size.
5
- *
6
- * @module services/workspace-lifecycle
7
- */
8
- /**
9
- * Remove a scratch directory (non-git workspace used for ad-hoc tasks).
10
- * Safe to call for any path under the workspaces base dir.
11
- */
12
- export declare function removeScratchDir(dirPath: string, baseDir: string, log: (msg: string) => void): Promise<void>;
13
- /**
14
- * Garbage-collect orphaned workspace directories.
15
- * Removes directories older than the given TTL that aren't tracked by the current session.
16
- */
17
- export declare function gcOrphanedWorkspaces(baseDir: string, workspaceTtlMs: number, trackedWorkspaceIds: Set<string>, log: (msg: string) => void): Promise<void>;
18
- //# sourceMappingURL=workspace-lifecycle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace-lifecycle.d.ts","sourceRoot":"","sources":["../../src/services/workspace-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACzB,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,EACtB,mBAAmB,EAAE,GAAG,CAAC,MAAM,CAAC,EAChC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACzB,OAAO,CAAC,IAAI,CAAC,CAkDf"}
@@ -1,84 +0,0 @@
1
- /**
2
- * Coding Workspace Service - Manages git workspaces for coding tasks
3
- *
4
- * Delegates to:
5
- * - workspace-github.ts (issue management, OAuth, PAT auth)
6
- * - workspace-git-ops.ts (status, commit, push, PR creation)
7
- * - workspace-lifecycle.ts (GC, scratch dir cleanup)
8
- * - workspace-types.ts (shared interface definitions)
9
- *
10
- * @module services/workspace-service
11
- */
12
- import type { IAgentRuntime } from "@elizaos/core";
13
- import { type CreateIssueOptions, type IssueComment, type IssueInfo, type IssueState, type PullRequestInfo, type WorkspaceEvent } from "git-workspace-service";
14
- import type { AuthPromptCallback } from "./workspace-github.js";
15
- export type { AuthPromptCallback } from "./workspace-github.js";
16
- export type { CodingWorkspaceConfig, CommitOptions, PROptions, ProvisionWorkspaceOptions, PushOptions, WorkspaceResult, WorkspaceStatusResult, } from "./workspace-types.js";
17
- import type { CodingWorkspaceConfig, CommitOptions, PROptions, ProvisionWorkspaceOptions, PushOptions, WorkspaceResult, WorkspaceStatusResult } from "./workspace-types.js";
18
- type WorkspaceEventCallback = (event: WorkspaceEvent) => void;
19
- export declare class CodingWorkspaceService {
20
- static serviceType: string;
21
- capabilityDescription: string;
22
- private runtime;
23
- private workspaceService;
24
- private credentialService;
25
- private githubClient;
26
- private githubAuthInProgress;
27
- private serviceConfig;
28
- private workspaces;
29
- private labels;
30
- private eventCallbacks;
31
- private authPromptCallback;
32
- constructor(runtime: IAgentRuntime, config?: CodingWorkspaceConfig);
33
- static start(runtime: IAgentRuntime): Promise<CodingWorkspaceService>;
34
- static stopRuntime(runtime: IAgentRuntime): Promise<void>;
35
- private initialize;
36
- stop(): Promise<void>;
37
- /** Provision a new workspace */
38
- provisionWorkspace(options: ProvisionWorkspaceOptions): Promise<WorkspaceResult>;
39
- getWorkspace(id: string): WorkspaceResult | undefined;
40
- listWorkspaces(): WorkspaceResult[];
41
- /**
42
- * Assign a semantic label to a workspace (e.g. "auth-bugfix").
43
- * If the label already exists, it is reassigned to the new workspace.
44
- */
45
- setLabel(workspaceId: string, label: string): void;
46
- getWorkspaceByLabel(label: string): WorkspaceResult | undefined;
47
- /** Resolve a workspace by label or ID. */
48
- resolveWorkspace(labelOrId: string): WorkspaceResult | undefined;
49
- getStatus(workspaceId: string): Promise<WorkspaceStatusResult>;
50
- commit(workspaceId: string, options: CommitOptions): Promise<string>;
51
- push(workspaceId: string, options?: PushOptions): Promise<void>;
52
- createPR(workspaceId: string, options: PROptions): Promise<PullRequestInfo>;
53
- private getGitHubContext;
54
- /** Set a callback to surface OAuth auth prompts to the user. */
55
- setAuthPromptCallback(callback: AuthPromptCallback): void;
56
- createIssue(repo: string, options: CreateIssueOptions): Promise<IssueInfo>;
57
- getIssue(repo: string, issueNumber: number): Promise<IssueInfo>;
58
- listIssues(repo: string, options?: {
59
- state?: IssueState | "all";
60
- labels?: string[];
61
- assignee?: string;
62
- }): Promise<IssueInfo[]>;
63
- updateIssue(repo: string, issueNumber: number, options: {
64
- title?: string;
65
- body?: string;
66
- state?: IssueState;
67
- labels?: string[];
68
- assignees?: string[];
69
- }): Promise<IssueInfo>;
70
- addComment(repo: string, issueNumber: number, body: string): Promise<IssueComment>;
71
- listComments(repo: string, issueNumber: number): Promise<IssueComment[]>;
72
- closeIssue(repo: string, issueNumber: number): Promise<IssueInfo>;
73
- reopenIssue(repo: string, issueNumber: number): Promise<IssueInfo>;
74
- addLabels(repo: string, issueNumber: number, labels: string[]): Promise<void>;
75
- removeWorkspace(workspaceId: string): Promise<void>;
76
- onEvent(callback: WorkspaceEventCallback): () => void;
77
- private emitEvent;
78
- /** Remove a scratch directory (non-git workspace) under the workspaces base dir. */
79
- removeScratchDir(dirPath: string): Promise<void>;
80
- /** GC orphaned workspace directories older than workspaceTtlMs. */
81
- private gcOrphanedWorkspaces;
82
- private log;
83
- }
84
- //# sourceMappingURL=workspace-service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace-service.d.ts","sourceRoot":"","sources":["../../src/services/workspace-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,KAAK,kBAAkB,EAGvB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,UAAU,EAEf,KAAK,eAAe,EAEpB,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAchE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAchE,YAAY,EACV,qBAAqB,EACrB,aAAa,EACb,SAAS,EACT,yBA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KACtB,GACA,OAAO,CAAC,SAAS,CAAC;IAIf,UAAU,CACd,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,YAAY,CAAC;IAIlB,YAAY,CAChB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,YAAY,EAAE,CAAC;IAIpB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAIjE,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAIlE,SAAS,CACb,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,IAAI,CAAC;IAMV,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAazD,OAAO,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,IAAI;IAUrD,OAAO,CAAC,SAAS;IAUjB,oFAAoF;IAC9E,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtD,mEAAmE;YACrD,oBAAoB;IASlC,OAAO,CAAC,GAAG;CAKZ"}
@@ -1,81 +0,0 @@
1
- /**
2
- * Type definitions for the Coding Workspace Service.
3
- *
4
- * Extracted from workspace-service.ts to reduce module size.
5
- *
6
- * @module services/workspace-types
7
- */
8
- import type { WorkspaceStatus } from "git-workspace-service";
9
- export interface CodingWorkspaceConfig {
10
- /** Base directory for workspaces (default: ~/.milady/workspaces) */
11
- baseDir?: string;
12
- /** Branch prefix (default: "milady") */
13
- branchPrefix?: string;
14
- /** Enable debug logging */
15
- debug?: boolean;
16
- /** Max age for orphaned workspace directories in ms (default: 24 hours). Set to 0 to disable GC. */
17
- workspaceTtlMs?: number;
18
- }
19
- export interface ProvisionWorkspaceOptions {
20
- /** Git repository URL */
21
- repo: string;
22
- /** Base branch to create from (default: "main") */
23
- baseBranch?: string;
24
- /** Exact branch name to use (overrides auto-generated name) */
25
- branchName?: string;
26
- /** Use worktree instead of clone */
27
- useWorktree?: boolean;
28
- /** Parent workspace ID for worktree */
29
- parentWorkspaceId?: string;
30
- /** Execution context */
31
- execution?: {
32
- id: string;
33
- patternName: string;
34
- };
35
- /** Task context */
36
- task?: {
37
- id: string;
38
- role: string;
39
- slug?: string;
40
- };
41
- /** User-provided credentials */
42
- userCredentials?: {
43
- type: "pat" | "oauth" | "ssh";
44
- token?: string;
45
- };
46
- }
47
- export interface WorkspaceResult {
48
- id: string;
49
- path: string;
50
- branch: string;
51
- baseBranch: string;
52
- isWorktree: boolean;
53
- repo: string;
54
- status: WorkspaceStatus;
55
- /** Semantic label for referencing this workspace (e.g. "auth-bugfix", "api-tests") */
56
- label?: string;
57
- }
58
- export interface CommitOptions {
59
- message: string;
60
- all?: boolean;
61
- }
62
- export interface PushOptions {
63
- setUpstream?: boolean;
64
- force?: boolean;
65
- }
66
- export interface PROptions {
67
- title: string;
68
- body: string;
69
- base?: string;
70
- draft?: boolean;
71
- labels?: string[];
72
- reviewers?: string[];
73
- }
74
- export interface WorkspaceStatusResult {
75
- branch: string;
76
- clean: boolean;
77
- modified: string[];
78
- staged: string[];
79
- untracked: string[];
80
- }
81
- //# sourceMappingURL=workspace-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace-types.d.ts","sourceRoot":"","sources":["../../src/services/workspace-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,WAAW,qBAAqB;IACpC,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAA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