@elizaos/plugin-agent-orchestrator 0.3.6 → 0.3.7
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/actions/coding-task-handlers.d.ts +46 -0
- package/dist/actions/coding-task-handlers.d.ts.map +1 -0
- package/dist/actions/coding-task-helpers.d.ts +27 -0
- package/dist/actions/coding-task-helpers.d.ts.map +1 -0
- package/dist/actions/finalize-workspace.d.ts +11 -0
- package/dist/actions/finalize-workspace.d.ts.map +1 -0
- package/dist/actions/list-agents.d.ts +11 -0
- package/dist/actions/list-agents.d.ts.map +1 -0
- package/dist/actions/manage-issues.d.ts +11 -0
- package/dist/actions/manage-issues.d.ts.map +1 -0
- package/dist/actions/provision-workspace.d.ts +11 -0
- package/dist/actions/provision-workspace.d.ts.map +1 -0
- package/dist/actions/send-to-agent.d.ts +11 -0
- package/dist/actions/send-to-agent.d.ts.map +1 -0
- package/dist/actions/spawn-agent.d.ts +11 -0
- package/dist/actions/spawn-agent.d.ts.map +1 -0
- package/dist/actions/start-coding-task.d.ts +17 -0
- package/dist/actions/start-coding-task.d.ts.map +1 -0
- package/dist/actions/stop-agent.d.ts +11 -0
- package/dist/actions/stop-agent.d.ts.map +1 -0
- package/dist/api/agent-routes.d.ts +18 -0
- package/dist/api/agent-routes.d.ts.map +1 -0
- package/dist/api/coordinator-routes.d.ts +22 -0
- package/dist/api/coordinator-routes.d.ts.map +1 -0
- package/dist/api/issue-routes.d.ts +17 -0
- package/dist/api/issue-routes.d.ts.map +1 -0
- package/dist/api/routes.d.ts +36 -0
- package/dist/api/routes.d.ts.map +1 -0
- package/dist/api/workspace-routes.d.ts +17 -0
- package/dist/api/workspace-routes.d.ts.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -3
- package/dist/index.js.map +4 -4
- package/dist/providers/action-examples.d.ts +13 -0
- package/dist/providers/action-examples.d.ts.map +1 -0
- package/dist/providers/active-workspace-context.d.ts +13 -0
- package/dist/providers/active-workspace-context.d.ts.map +1 -0
- package/dist/services/agent-metrics.d.ts +28 -0
- package/dist/services/agent-metrics.d.ts.map +1 -0
- package/dist/services/agent-selection.d.ts +53 -0
- package/dist/services/agent-selection.d.ts.map +1 -0
- package/dist/services/ansi-utils.d.ts +48 -0
- package/dist/services/ansi-utils.d.ts.map +1 -0
- package/dist/services/pty-auto-response.d.ts +30 -0
- package/dist/services/pty-auto-response.d.ts.map +1 -0
- package/dist/services/pty-init.d.ts +47 -0
- package/dist/services/pty-init.d.ts.map +1 -0
- package/dist/services/pty-service.d.ts +92 -0
- package/dist/services/pty-service.d.ts.map +1 -0
- package/dist/services/pty-session-io.d.ts +49 -0
- package/dist/services/pty-session-io.d.ts.map +1 -0
- package/dist/services/pty-spawn.d.ts +50 -0
- package/dist/services/pty-spawn.d.ts.map +1 -0
- package/dist/services/pty-types.d.ts +80 -0
- package/dist/services/pty-types.d.ts.map +1 -0
- package/dist/services/stall-classifier.d.ts +67 -0
- package/dist/services/stall-classifier.d.ts.map +1 -0
- package/dist/services/swarm-coordinator-prompts.d.ts +75 -0
- package/dist/services/swarm-coordinator-prompts.d.ts.map +1 -0
- package/dist/services/swarm-coordinator.d.ts +200 -0
- package/dist/services/swarm-coordinator.d.ts.map +1 -0
- package/dist/services/swarm-decision-loop.d.ts +44 -0
- package/dist/services/swarm-decision-loop.d.ts.map +1 -0
- package/dist/services/swarm-event-triage.d.ts +49 -0
- package/dist/services/swarm-event-triage.d.ts.map +1 -0
- package/dist/services/swarm-idle-watchdog.d.ts +22 -0
- package/dist/services/swarm-idle-watchdog.d.ts.map +1 -0
- package/dist/services/workspace-git-ops.d.ts +28 -0
- package/dist/services/workspace-git-ops.d.ts.map +1 -0
- package/dist/services/workspace-github.d.ts +58 -0
- package/dist/services/workspace-github.d.ts.map +1 -0
- package/dist/services/workspace-lifecycle.d.ts +18 -0
- package/dist/services/workspace-lifecycle.d.ts.map +1 -0
- package/dist/services/workspace-service.d.ts +84 -0
- package/dist/services/workspace-service.d.ts.map +1 -0
- package/dist/services/workspace-types.d.ts +81 -0
- package/dist/services/workspace-types.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt construction and response parsing for the Swarm Coordinator's
|
|
3
|
+
* LLM-driven coordination decisions.
|
|
4
|
+
*
|
|
5
|
+
* Pure functions — no side effects, easy to test.
|
|
6
|
+
* Pattern follows stall-classifier.ts:buildStallClassificationPrompt().
|
|
7
|
+
*
|
|
8
|
+
* @module services/swarm-coordinator-prompts
|
|
9
|
+
*/
|
|
10
|
+
/** Per-session task context provided to the LLM for decision-making. */
|
|
11
|
+
export interface TaskContextSummary {
|
|
12
|
+
sessionId: string;
|
|
13
|
+
agentType: string;
|
|
14
|
+
label: string;
|
|
15
|
+
originalTask: string;
|
|
16
|
+
workdir: string;
|
|
17
|
+
repo?: string;
|
|
18
|
+
}
|
|
19
|
+
/** A previous coordination decision, included for context continuity. */
|
|
20
|
+
export interface DecisionHistoryEntry {
|
|
21
|
+
event: string;
|
|
22
|
+
promptText: string;
|
|
23
|
+
action: string;
|
|
24
|
+
response?: string;
|
|
25
|
+
reasoning: string;
|
|
26
|
+
}
|
|
27
|
+
/** Parsed LLM response for a coordination decision. */
|
|
28
|
+
export interface CoordinationLLMResponse {
|
|
29
|
+
action: "respond" | "escalate" | "ignore" | "complete";
|
|
30
|
+
/** Text to send (for action=respond with plain text input). */
|
|
31
|
+
response?: string;
|
|
32
|
+
/** Whether to use sendKeysToSession instead of sendToSession. */
|
|
33
|
+
useKeys?: boolean;
|
|
34
|
+
/** Key sequence to send (for TUI interactions). e.g. ["enter"] or ["down","enter"]. */
|
|
35
|
+
keys?: string[];
|
|
36
|
+
/** LLM's reasoning for the decision. */
|
|
37
|
+
reasoning: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Build the LLM prompt for making a coordination decision about a blocked agent.
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildCoordinationPrompt(taskCtx: TaskContextSummary, promptText: string, recentOutput: string, decisionHistory: DecisionHistoryEntry[]): string;
|
|
43
|
+
/**
|
|
44
|
+
* Build the LLM prompt for checking on an idle session that hasn't
|
|
45
|
+
* produced any events for a while.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildIdleCheckPrompt(taskCtx: TaskContextSummary, recentOutput: string, idleMinutes: number, idleCheckNumber: number, maxIdleChecks: number, decisionHistory: DecisionHistoryEntry[]): string;
|
|
48
|
+
/**
|
|
49
|
+
* Build the LLM prompt for assessing whether a completed turn means the
|
|
50
|
+
* overall task is done, or if the agent needs more turns.
|
|
51
|
+
*
|
|
52
|
+
* Called when the adapter detects "task_complete" (agent finished a turn and
|
|
53
|
+
* returned to the idle prompt). The LLM decides whether to stop the session
|
|
54
|
+
* or send a follow-up instruction.
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildTurnCompletePrompt(taskCtx: TaskContextSummary, turnOutput: string, decisionHistory: DecisionHistoryEntry[]): string;
|
|
57
|
+
/**
|
|
58
|
+
* Build a natural language event message describing a blocked agent, intended
|
|
59
|
+
* to be processed by Milaidy's full ElizaOS pipeline (with conversation memory,
|
|
60
|
+
* personality, and actions). Unlike buildCoordinationPrompt(), this omits the
|
|
61
|
+
* "You are Milady" preamble (she already IS Milady in the pipeline) and asks
|
|
62
|
+
* for a fenced JSON action block at the end of her response.
|
|
63
|
+
*/
|
|
64
|
+
export declare function buildBlockedEventMessage(taskCtx: TaskContextSummary, promptText: string, recentOutput: string, decisionHistory: DecisionHistoryEntry[]): string;
|
|
65
|
+
/**
|
|
66
|
+
* Build a natural language event message describing a turn completion, intended
|
|
67
|
+
* to be processed by Milaidy's full ElizaOS pipeline.
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildTurnCompleteEventMessage(taskCtx: TaskContextSummary, turnOutput: string, decisionHistory: DecisionHistoryEntry[]): string;
|
|
70
|
+
/**
|
|
71
|
+
* Parse the LLM's coordination response from raw text output.
|
|
72
|
+
* Returns null if the response is invalid or unparseable.
|
|
73
|
+
*/
|
|
74
|
+
export declare function parseCoordinationResponse(llmOutput: string): CoordinationLLMResponse | null;
|
|
75
|
+
//# sourceMappingURL=swarm-coordinator-prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swarm-coordinator-prompts.d.ts","sourceRoot":"","sources":["../../src/services/swarm-coordinator-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wEAAwE;AACxE,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,yEAAyE;AACzE,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,uDAAuD;AACvD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC;IACvD,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,oBAAoB,EAAE,GACtC,MAAM,CA0DR;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,kBAAkB,EAC3B,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,MAAM,EACvB,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,oBAAoB,EAAE,GACtC,MAAM,CAiDR;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,oBAAoB,EAAE,GACtC,MAAM,CAgER;AAID;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,oBAAoB,EAAE,GACtC,MAAM,CAoCR;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,oBAAoB,EAAE,GACtC,MAAM,CAoCR;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,GAChB,uBAAuB,GAAG,IAAI,CA+BhC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
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" | "stopped";
|
|
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
|
+
/** Buffered task_complete events that arrived while an in-flight decision was running. */
|
|
88
|
+
readonly pendingTurnComplete: Map<string, unknown>;
|
|
89
|
+
/** Last-seen output snapshot per session — used by idle watchdog. */
|
|
90
|
+
readonly lastSeenOutput: Map<string, string>;
|
|
91
|
+
/** Timestamp of last tool_running chat notification per session — for throttling. */
|
|
92
|
+
readonly lastToolNotification: Map<string, number>;
|
|
93
|
+
/** Whether LLM decisions are paused (user sent a chat message). */
|
|
94
|
+
readonly isPaused: boolean;
|
|
95
|
+
broadcast(event: SwarmEvent): void;
|
|
96
|
+
sendChatMessage(text: string, source?: string): void;
|
|
97
|
+
log(message: string): void;
|
|
98
|
+
getSupervisionLevel(): SupervisionLevel;
|
|
99
|
+
getAgentDecisionCallback(): AgentDecisionCallback | null;
|
|
100
|
+
}
|
|
101
|
+
export declare class SwarmCoordinator implements SwarmCoordinatorContext {
|
|
102
|
+
static serviceType: string;
|
|
103
|
+
readonly runtime: IAgentRuntime;
|
|
104
|
+
ptyService: PTYService | null;
|
|
105
|
+
private unsubscribeEvents;
|
|
106
|
+
/** Per-session task context. */
|
|
107
|
+
readonly tasks: Map<string, TaskContext>;
|
|
108
|
+
/** SSE clients receiving live events. */
|
|
109
|
+
private sseClients;
|
|
110
|
+
/** Supervision level (default: autonomous). */
|
|
111
|
+
private supervisionLevel;
|
|
112
|
+
/** Pending confirmations for "confirm" mode. */
|
|
113
|
+
readonly pendingDecisions: Map<string, PendingDecision>;
|
|
114
|
+
/** In-flight decision lock — prevents parallel LLM calls for same session. */
|
|
115
|
+
readonly inFlightDecisions: Set<string>;
|
|
116
|
+
/** Buffered task_complete events that arrived while an in-flight decision was running. */
|
|
117
|
+
readonly pendingTurnComplete: Map<string, unknown>;
|
|
118
|
+
/** Callback to send chat messages to the user's conversation UI. */
|
|
119
|
+
private chatCallback;
|
|
120
|
+
/** Callback to relay coordinator events to WebSocket clients. */
|
|
121
|
+
private wsBroadcast;
|
|
122
|
+
/** Callback to route coordinator events through Milaidy's full pipeline. */
|
|
123
|
+
private agentDecisionCb;
|
|
124
|
+
/** Buffer for events arriving before task registration. */
|
|
125
|
+
private unregisteredBuffer;
|
|
126
|
+
/** Idle watchdog timer handle. */
|
|
127
|
+
private idleWatchdogTimer;
|
|
128
|
+
/** Last-seen output snapshot per session — used by idle watchdog to detect data flow. */
|
|
129
|
+
readonly lastSeenOutput: Map<string, string>;
|
|
130
|
+
/** Timestamp of last tool_running chat notification per session — for throttling. */
|
|
131
|
+
readonly lastToolNotification: Map<string, number>;
|
|
132
|
+
/** Whether LLM decisions are paused (user sent a chat message). */
|
|
133
|
+
private _paused;
|
|
134
|
+
/** Buffered events during pause — replayed on resume. */
|
|
135
|
+
private pauseBuffer;
|
|
136
|
+
/** Auto-resume timeout handle. */
|
|
137
|
+
private pauseTimeout;
|
|
138
|
+
constructor(runtime: IAgentRuntime);
|
|
139
|
+
/** Inject a callback (from server.ts) to route messages to the user's chat UI. */
|
|
140
|
+
setChatCallback(cb: ChatMessageCallback): void;
|
|
141
|
+
/** Inject a callback (from server.ts) to relay events to WebSocket clients. */
|
|
142
|
+
setWsBroadcast(cb: WsBroadcastCallback): void;
|
|
143
|
+
/** Inject a callback (from server.ts) to route events through Milaidy's pipeline. */
|
|
144
|
+
setAgentDecisionCallback(cb: AgentDecisionCallback): void;
|
|
145
|
+
/** Return the agent decision callback (if wired). */
|
|
146
|
+
getAgentDecisionCallback(): AgentDecisionCallback | null;
|
|
147
|
+
/** Null-safe wrapper — sends a message to the user's conversation if callback is set. */
|
|
148
|
+
sendChatMessage(text: string, source?: string): void;
|
|
149
|
+
/**
|
|
150
|
+
* Initialize the coordinator by subscribing to PTY session events.
|
|
151
|
+
* Called from plugin init after services are ready.
|
|
152
|
+
*/
|
|
153
|
+
start(ptyService: PTYService): void;
|
|
154
|
+
stop(): void;
|
|
155
|
+
/** Whether the coordinator is currently paused. */
|
|
156
|
+
get isPaused(): boolean;
|
|
157
|
+
/** Pause LLM-based decisions. Auto-responses and broadcasts continue. */
|
|
158
|
+
pause(): void;
|
|
159
|
+
/** Resume LLM-based decisions and replay buffered events. */
|
|
160
|
+
resume(): void;
|
|
161
|
+
registerTask(sessionId: string, context: {
|
|
162
|
+
agentType: CodingAgentType;
|
|
163
|
+
label: string;
|
|
164
|
+
originalTask: string;
|
|
165
|
+
workdir: string;
|
|
166
|
+
repo?: string;
|
|
167
|
+
}): void;
|
|
168
|
+
/**
|
|
169
|
+
* Return the repo URL from the most recently registered task that had one.
|
|
170
|
+
* Useful as a fallback when the user says "in the same repo" without a URL.
|
|
171
|
+
*/
|
|
172
|
+
getLastUsedRepo(): string | undefined;
|
|
173
|
+
getTaskContext(sessionId: string): TaskContext | undefined;
|
|
174
|
+
getAllTaskContexts(): TaskContext[];
|
|
175
|
+
/**
|
|
176
|
+
* Register an SSE client. Returns an unsubscribe function.
|
|
177
|
+
* Sends a snapshot of current state on connect.
|
|
178
|
+
*/
|
|
179
|
+
addSseClient(res: ServerResponse): () => void;
|
|
180
|
+
broadcast(event: SwarmEvent): void;
|
|
181
|
+
private writeSseEvent;
|
|
182
|
+
handleSessionEvent(sessionId: string, event: string, data: unknown): Promise<void>;
|
|
183
|
+
makeCoordinationDecision(taskCtx: TaskContext, promptText: string, recentOutput: string): Promise<CoordinationLLMResponse | null>;
|
|
184
|
+
executeDecision(sessionId: string, decision: CoordinationLLMResponse): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Public entry point for external callers (e.g. server.ts) to execute
|
|
187
|
+
* a coordination decision on a session. Wraps the internal executeDecision.
|
|
188
|
+
*/
|
|
189
|
+
executeEventDecision(sessionId: string, decision: CoordinationLLMResponse): Promise<void>;
|
|
190
|
+
setSupervisionLevel(level: SupervisionLevel): void;
|
|
191
|
+
getSupervisionLevel(): SupervisionLevel;
|
|
192
|
+
getPendingConfirmations(): PendingDecision[];
|
|
193
|
+
confirmDecision(sessionId: string, approved: boolean, override?: {
|
|
194
|
+
response?: string;
|
|
195
|
+
useKeys?: boolean;
|
|
196
|
+
keys?: string[];
|
|
197
|
+
}): Promise<void>;
|
|
198
|
+
log(message: string): void;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=swarm-coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swarm-coordinator.d.ts","sourceRoot":"","sources":["../../src/services/swarm-coordinator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,K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.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
|
|
@@ -0,0 +1 @@
|
|
|
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;AAqExC,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,CAqEf;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,CA0Jf;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,CAoKf;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,CAyGf"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,aAAa;IAC5B,OAAO,EAAE,aAAa,CAAC;IACvB,YAAY,EAAE,eAAe,GAAG,IAAI,CAAC;IACrC,eAAe,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IACnD,oBAAoB,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC;IACtD,uBAAuB,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACtE,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC9C,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5B;AAID,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAOA;AAID,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,aAAa,GACjB,OAAO,CAAC,eAAe,CAAC,CAsC1B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,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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,KA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