@elizaos/plugin-agent-orchestrator 0.3.0 → 0.3.3
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/index.js +684 -393
- package/dist/index.js.map +9 -9
- package/dist/services/pty-service.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/actions/coding-task-handlers.d.ts +0 -44
- package/dist/actions/coding-task-handlers.d.ts.map +0 -1
- package/dist/actions/coding-task-helpers.d.ts +0 -27
- package/dist/actions/coding-task-helpers.d.ts.map +0 -1
- package/dist/actions/finalize-workspace.d.ts +0 -11
- package/dist/actions/finalize-workspace.d.ts.map +0 -1
- package/dist/actions/list-agents.d.ts +0 -11
- package/dist/actions/list-agents.d.ts.map +0 -1
- package/dist/actions/manage-issues.d.ts +0 -11
- package/dist/actions/manage-issues.d.ts.map +0 -1
- package/dist/actions/provision-workspace.d.ts +0 -11
- package/dist/actions/provision-workspace.d.ts.map +0 -1
- package/dist/actions/send-to-agent.d.ts +0 -11
- package/dist/actions/send-to-agent.d.ts.map +0 -1
- package/dist/actions/spawn-agent.d.ts +0 -11
- package/dist/actions/spawn-agent.d.ts.map +0 -1
- package/dist/actions/start-coding-task.d.ts +0 -17
- package/dist/actions/start-coding-task.d.ts.map +0 -1
- package/dist/actions/stop-agent.d.ts +0 -11
- package/dist/actions/stop-agent.d.ts.map +0 -1
- package/dist/api/agent-routes.d.ts +0 -18
- package/dist/api/agent-routes.d.ts.map +0 -1
- package/dist/api/coordinator-routes.d.ts +0 -22
- package/dist/api/coordinator-routes.d.ts.map +0 -1
- package/dist/api/issue-routes.d.ts +0 -17
- package/dist/api/issue-routes.d.ts.map +0 -1
- package/dist/api/routes.d.ts +0 -36
- package/dist/api/routes.d.ts.map +0 -1
- package/dist/api/workspace-routes.d.ts +0 -17
- package/dist/api/workspace-routes.d.ts.map +0 -1
- package/dist/index.d.ts +0 -33
- package/dist/index.d.ts.map +0 -1
- package/dist/providers/action-examples.d.ts +0 -13
- package/dist/providers/action-examples.d.ts.map +0 -1
- package/dist/providers/active-workspace-context.d.ts +0 -13
- package/dist/providers/active-workspace-context.d.ts.map +0 -1
- package/dist/services/agent-metrics.d.ts +0 -28
- package/dist/services/agent-metrics.d.ts.map +0 -1
- package/dist/services/agent-selection.d.ts +0 -53
- package/dist/services/agent-selection.d.ts.map +0 -1
- package/dist/services/ansi-utils.d.ts +0 -48
- package/dist/services/ansi-utils.d.ts.map +0 -1
- package/dist/services/pty-auto-response.d.ts +0 -30
- package/dist/services/pty-auto-response.d.ts.map +0 -1
- package/dist/services/pty-init.d.ts +0 -45
- package/dist/services/pty-init.d.ts.map +0 -1
- package/dist/services/pty-service.d.ts +0 -92
- package/dist/services/pty-session-io.d.ts +0 -46
- package/dist/services/pty-session-io.d.ts.map +0 -1
- package/dist/services/pty-spawn.d.ts +0 -50
- package/dist/services/pty-spawn.d.ts.map +0 -1
- package/dist/services/pty-types.d.ts +0 -80
- package/dist/services/pty-types.d.ts.map +0 -1
- package/dist/services/stall-classifier.d.ts +0 -44
- package/dist/services/stall-classifier.d.ts.map +0 -1
- package/dist/services/swarm-coordinator-prompts.d.ts +0 -75
- package/dist/services/swarm-coordinator-prompts.d.ts.map +0 -1
- package/dist/services/swarm-coordinator.d.ts +0 -196
- package/dist/services/swarm-coordinator.d.ts.map +0 -1
- package/dist/services/swarm-decision-loop.d.ts +0 -44
- package/dist/services/swarm-decision-loop.d.ts.map +0 -1
- package/dist/services/swarm-event-triage.d.ts +0 -49
- package/dist/services/swarm-event-triage.d.ts.map +0 -1
- package/dist/services/swarm-idle-watchdog.d.ts +0 -22
- package/dist/services/swarm-idle-watchdog.d.ts.map +0 -1
- package/dist/services/workspace-git-ops.d.ts +0 -28
- package/dist/services/workspace-git-ops.d.ts.map +0 -1
- package/dist/services/workspace-github.d.ts +0 -58
- package/dist/services/workspace-github.d.ts.map +0 -1
- package/dist/services/workspace-lifecycle.d.ts +0 -18
- package/dist/services/workspace-lifecycle.d.ts.map +0 -1
- package/dist/services/workspace-service.d.ts +0 -84
- package/dist/services/workspace-service.d.ts.map +0 -1
- package/dist/services/workspace-types.d.ts +0 -81
- package/dist/services/workspace-types.d.ts.map +0 -1
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auto-response rule management for PTY sessions.
|
|
3
|
-
*
|
|
4
|
-
* Contains logic for pushing default auto-response rules per agent type
|
|
5
|
-
* and handling Gemini authentication flow.
|
|
6
|
-
*
|
|
7
|
-
* @module services/pty-auto-response
|
|
8
|
-
*/
|
|
9
|
-
import type { IAgentRuntime } from "@elizaos/core";
|
|
10
|
-
import type { BunCompatiblePTYManager, PTYManager } from "pty-manager";
|
|
11
|
-
export interface AutoResponseContext {
|
|
12
|
-
manager: PTYManager | BunCompatiblePTYManager;
|
|
13
|
-
usingBunWorker: boolean;
|
|
14
|
-
runtime: IAgentRuntime;
|
|
15
|
-
log: (msg: string) => void;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Push session-specific auto-response rules that depend on runtime config.
|
|
19
|
-
* Trust prompts, update notices, and other static rules are handled by
|
|
20
|
-
* adapter built-in rules (coding-agent-adapters). This only pushes rules
|
|
21
|
-
* that need runtime values (e.g. API keys).
|
|
22
|
-
*/
|
|
23
|
-
export declare function pushDefaultRules(ctx: AutoResponseContext, sessionId: string, agentType: string): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Handle Gemini authentication when login_required fires.
|
|
26
|
-
* Sends /auth to start the auth flow — auto-response rules
|
|
27
|
-
* then handle menu selection and API key input.
|
|
28
|
-
*/
|
|
29
|
-
export declare function handleGeminiAuth(ctx: AutoResponseContext, sessionId: string, sendKeysToSession: (sessionId: string, keys: string | string[]) => Promise<void>): Promise<void>;
|
|
30
|
-
//# sourceMappingURL=pty-auto-response.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pty-auto-response.d.ts","sourceRoot":"","sources":["../../src/services/pty-auto-response.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAEV,uBAAuB,EACvB,UAAU,EACX,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,UAAU,GAAG,uBAAuB,CAAC;IAC9C,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,aAAa,CAAC;IACvB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,mBAAmB,EACxB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAwFf;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,mBAAmB,EACxB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,CACjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,KACpB,OAAO,CAAC,IAAI,CAAC,GACjB,OAAO,CAAC,IAAI,CAAC,CAwBf"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PTY manager initialization — extracted from PTYService.initialize().
|
|
3
|
-
*
|
|
4
|
-
* Creates either a BunCompatiblePTYManager (for Bun runtime) or PTYManager
|
|
5
|
-
* (for Node), wires up event handlers, and returns the configured manager.
|
|
6
|
-
*
|
|
7
|
-
* @module services/pty-init
|
|
8
|
-
*/
|
|
9
|
-
import { BunCompatiblePTYManager, PTYManager, type StallClassification } from "pty-manager";
|
|
10
|
-
import type { PTYServiceConfig } from "./pty-types.js";
|
|
11
|
-
/**
|
|
12
|
-
* All callbacks and state that the initialization logic needs
|
|
13
|
-
* from the surrounding PTYService instance.
|
|
14
|
-
*/
|
|
15
|
-
export interface InitContext {
|
|
16
|
-
serviceConfig: PTYServiceConfig;
|
|
17
|
-
classifyStall: (sessionId: string, recentOutput: string) => Promise<StallClassification | null>;
|
|
18
|
-
emitEvent: (sessionId: string, event: string, data: unknown) => void;
|
|
19
|
-
handleGeminiAuth: (sessionId: string) => void;
|
|
20
|
-
sessionOutputBuffers: Map<string, string[]>;
|
|
21
|
-
taskResponseMarkers: Map<string, number>;
|
|
22
|
-
metricsTracker: {
|
|
23
|
-
recordCompletion(type: string, method: string, durationMs: number): void;
|
|
24
|
-
};
|
|
25
|
-
traceEntries: Array<string | Record<string, unknown>>;
|
|
26
|
-
maxTraceEntries: number;
|
|
27
|
-
log: (msg: string) => void;
|
|
28
|
-
/** Check if a session has an active task in the coordinator. */
|
|
29
|
-
hasActiveTask?: (sessionId: string) => boolean;
|
|
30
|
-
}
|
|
31
|
-
/** Value returned by {@link initializePTYManager}. */
|
|
32
|
-
export interface InitResult {
|
|
33
|
-
manager: PTYManager | BunCompatiblePTYManager;
|
|
34
|
-
usingBunWorker: boolean;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Create and configure a PTY manager for the current runtime.
|
|
38
|
-
*
|
|
39
|
-
* - **Bun**: instantiates a {@link BunCompatiblePTYManager} that spawns a
|
|
40
|
-
* Node worker process and communicates via JSON-RPC over stdio.
|
|
41
|
-
* - **Node**: instantiates a {@link PTYManager} directly and registers
|
|
42
|
-
* all built-in adapters in-process.
|
|
43
|
-
*/
|
|
44
|
-
export declare function initializePTYManager(ctx: InitContext): Promise<InitResult>;
|
|
45
|
-
//# sourceMappingURL=pty-init.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pty-init.d.ts","sourceRoot":"","sources":["../../src/services/pty-init.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EACL,uBAAuB,EAEvB,UAAU,EAKV,KAAK,mBAAmB,EAGzB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;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type AgentFileDescriptor, type ApprovalConfig, type ApprovalPreset, type PreflightResult, type WriteMemoryOptions } from "coding-agent-adapters";
|
|
4
|
-
import { PTYConsoleBridge } from "pty-console";
|
|
5
|
-
import type { SessionFilter, SessionMessage } from "pty-manager";
|
|
6
|
-
import { type AgentSelectionStrategy } from "./agent-selection.js";
|
|
7
|
-
import type { CodingAgentType, PTYServiceConfig, SessionEventCallback, SessionInfo, SpawnSessionOptions } from "./pty-types.js";
|
|
8
|
-
import { SwarmCoordinator } from "./swarm-coordinator.js";
|
|
9
|
-
export type { CodingAgentType, PTYServiceConfig, SessionEventName, SessionInfo, SpawnSessionOptions, } from "./pty-types.js";
|
|
10
|
-
export { normalizeAgentType } from "./pty-types.js";
|
|
11
|
-
/**
|
|
12
|
-
* Retrieve the SwarmCoordinator from the PTYService registered on the runtime.
|
|
13
|
-
* Returns undefined if PTYService or coordinator is not available.
|
|
14
|
-
*/
|
|
15
|
-
export declare function getCoordinator(runtime: IAgentRuntime): SwarmCoordinator | undefined;
|
|
16
|
-
export declare class PTYService {
|
|
17
|
-
static serviceType: string;
|
|
18
|
-
capabilityDescription: string;
|
|
19
|
-
private runtime;
|
|
20
|
-
private manager;
|
|
21
|
-
private usingBunWorker;
|
|
22
|
-
private serviceConfig;
|
|
23
|
-
private sessionMetadata;
|
|
24
|
-
private sessionWorkdirs;
|
|
25
|
-
private eventCallbacks;
|
|
26
|
-
private outputUnsubscribers;
|
|
27
|
-
private sessionOutputBuffers;
|
|
28
|
-
private adapterCache;
|
|
29
|
-
/** Tracks the buffer index when a task was sent, so we can capture the response on completion */
|
|
30
|
-
private taskResponseMarkers;
|
|
31
|
-
/** Captures "Task completion trace" log entries from worker stderr (rolling, capped at 200) */
|
|
32
|
-
private traceEntries;
|
|
33
|
-
private static readonly MAX_TRACE_ENTRIES;
|
|
34
|
-
/** Lightweight per-agent-type metrics for observability */
|
|
35
|
-
private metricsTracker;
|
|
36
|
-
/** Console bridge for terminal output streaming and buffered hydration */
|
|
37
|
-
consoleBridge: PTYConsoleBridge | null;
|
|
38
|
-
/** Swarm coordinator instance (if active). Accessed via getCoordinator(runtime). */
|
|
39
|
-
coordinator: SwarmCoordinator | null;
|
|
40
|
-
constructor(runtime: IAgentRuntime, config?: PTYServiceConfig);
|
|
41
|
-
static start(runtime: IAgentRuntime): Promise<PTYService>;
|
|
42
|
-
static stopRuntime(runtime: IAgentRuntime): Promise<void>;
|
|
43
|
-
private initialize;
|
|
44
|
-
stop(): Promise<void>;
|
|
45
|
-
private generateSessionId;
|
|
46
|
-
/** Build a SessionIOContext from current instance state. */
|
|
47
|
-
private ioContext;
|
|
48
|
-
/**
|
|
49
|
-
* Spawn a new PTY session for a coding agent
|
|
50
|
-
*/
|
|
51
|
-
spawnSession(options: SpawnSessionOptions): Promise<SessionInfo>;
|
|
52
|
-
private autoResponseContext;
|
|
53
|
-
private pushDefaultRules;
|
|
54
|
-
private handleGeminiAuth;
|
|
55
|
-
sendToSession(sessionId: string, input: string): Promise<SessionMessage | undefined>;
|
|
56
|
-
sendKeysToSession(sessionId: string, keys: string | string[]): Promise<void>;
|
|
57
|
-
stopSession(sessionId: string): Promise<void>;
|
|
58
|
-
/** Default approval preset — runtime env var takes precedence over config. */
|
|
59
|
-
get defaultApprovalPreset(): ApprovalPreset;
|
|
60
|
-
/** Agent selection strategy — env var takes precedence. */
|
|
61
|
-
get agentSelectionStrategy(): AgentSelectionStrategy;
|
|
62
|
-
/** Default agent type when strategy is "fixed" — env var takes precedence. */
|
|
63
|
-
get defaultAgentType(): AdapterType;
|
|
64
|
-
/**
|
|
65
|
-
* Resolve which agent type to use when the caller didn't specify one.
|
|
66
|
-
*
|
|
67
|
-
* - **fixed**: returns `defaultAgentType` immediately
|
|
68
|
-
* - **ranked**: fetches preflight data, scores installed agents via
|
|
69
|
-
* metrics, and returns the highest scorer
|
|
70
|
-
*/
|
|
71
|
-
resolveAgentType(): Promise<string>;
|
|
72
|
-
getSession(sessionId: string): SessionInfo | undefined;
|
|
73
|
-
listSessions(filter?: SessionFilter): Promise<SessionInfo[]>;
|
|
74
|
-
subscribeToOutput(sessionId: string, callback: (data: string) => void): () => void;
|
|
75
|
-
getSessionOutput(sessionId: string, lines?: number): Promise<string>;
|
|
76
|
-
isSessionBlocked(sessionId: string): boolean;
|
|
77
|
-
checkAvailableAgents(types?: AdapterType[]): Promise<PreflightResult[]>;
|
|
78
|
-
getSupportedAgentTypes(): CodingAgentType[];
|
|
79
|
-
private classifyStall;
|
|
80
|
-
private getAdapter;
|
|
81
|
-
getWorkspaceFiles(agentType: AdapterType): AgentFileDescriptor[];
|
|
82
|
-
getMemoryFilePath(agentType: AdapterType): string;
|
|
83
|
-
getApprovalConfig(agentType: AdapterType, preset: ApprovalPreset): ApprovalConfig;
|
|
84
|
-
writeMemoryFile(agentType: AdapterType, workspacePath: string, content: string, options?: WriteMemoryOptions): Promise<string>;
|
|
85
|
-
onSessionEvent(callback: SessionEventCallback): () => void;
|
|
86
|
-
registerAdapter(adapter: unknown): void;
|
|
87
|
-
private toSessionInfo;
|
|
88
|
-
private emitEvent;
|
|
89
|
-
getAgentMetrics(): Record<string, Omit<import("./agent-metrics.js").AgentMetrics, "totalCompletionMs">>;
|
|
90
|
-
private log;
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=pty-service.d.ts.map
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session I/O helpers — extracted from PTYService for maintainability.
|
|
3
|
-
*
|
|
4
|
-
* Standalone functions for sending input/keys to sessions and stopping
|
|
5
|
-
* sessions. Each function takes a {@link SessionIOContext} that provides
|
|
6
|
-
* the manager instance and shared state maps.
|
|
7
|
-
*
|
|
8
|
-
* @module services/pty-session-io
|
|
9
|
-
*/
|
|
10
|
-
import type { BunCompatiblePTYManager, PTYManager, SessionMessage } from "pty-manager";
|
|
11
|
-
/**
|
|
12
|
-
* Shared context required by all session I/O functions.
|
|
13
|
-
* Built inline from PTYService instance fields.
|
|
14
|
-
*/
|
|
15
|
-
export interface SessionIOContext {
|
|
16
|
-
manager: PTYManager | BunCompatiblePTYManager;
|
|
17
|
-
usingBunWorker: boolean;
|
|
18
|
-
sessionOutputBuffers: Map<string, string[]>;
|
|
19
|
-
taskResponseMarkers: Map<string, number>;
|
|
20
|
-
outputUnsubscribers: Map<string, () => void>;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Send text input to a session.
|
|
24
|
-
*
|
|
25
|
-
* Marks the buffer position for task response capture, then writes the
|
|
26
|
-
* input via the appropriate manager API.
|
|
27
|
-
*/
|
|
28
|
-
export declare function sendToSession(ctx: SessionIOContext, sessionId: string, input: string): Promise<SessionMessage | undefined>;
|
|
29
|
-
/**
|
|
30
|
-
* Send key sequences to a session (for special keys like arrows, enter, etc.).
|
|
31
|
-
*/
|
|
32
|
-
export declare function sendKeysToSession(ctx: SessionIOContext, sessionId: string, keys: string | string[]): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Stop a PTY session and clean up all associated state.
|
|
35
|
-
*/
|
|
36
|
-
export declare function stopSession(ctx: SessionIOContext, sessionId: string, sessionMetadata: Map<string, Record<string, unknown>>, sessionWorkdirs: Map<string, string>, log: (msg: string) => void): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Subscribe to live output from a session.
|
|
39
|
-
* Returns an unsubscribe function.
|
|
40
|
-
*/
|
|
41
|
-
export declare function subscribeToOutput(ctx: SessionIOContext, sessionId: string, callback: (data: string) => void): () => void;
|
|
42
|
-
/**
|
|
43
|
-
* Get buffered or logged output from a session.
|
|
44
|
-
*/
|
|
45
|
-
export declare function getSessionOutput(ctx: SessionIOContext, sessionId: string, lines?: number): Promise<string>;
|
|
46
|
-
//# sourceMappingURL=pty-session-io.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pty-session-io.d.ts","sourceRoot":"","sources":["../../src/services/pty-session-io.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAA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AAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAejB"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PTY session spawning logic — extracted from PTYService for maintainability.
|
|
3
|
-
*
|
|
4
|
-
* Contains the deferred task delivery, retry logic, per-agent settle delays,
|
|
5
|
-
* and session buffer setup that runs during spawnSession().
|
|
6
|
-
*
|
|
7
|
-
* @module services/pty-spawn
|
|
8
|
-
*/
|
|
9
|
-
import type { AdapterType, BaseCodingAdapter } from "coding-agent-adapters";
|
|
10
|
-
import type { BunCompatiblePTYManager, PTYManager, SessionHandle, SpawnConfig, WorkerSessionHandle } from "pty-manager";
|
|
11
|
-
import type { PTYServiceConfig, SessionInfo, SpawnSessionOptions } from "./pty-types.js";
|
|
12
|
-
/**
|
|
13
|
-
* Build a sanitized base environment from process.env, keeping only
|
|
14
|
-
* safe system variables. Agent-specific credentials are injected
|
|
15
|
-
* separately by the adapter's getEnv().
|
|
16
|
-
*/
|
|
17
|
-
export declare function buildSanitizedBaseEnv(): Record<string, string>;
|
|
18
|
-
export interface SpawnContext {
|
|
19
|
-
manager: PTYManager | BunCompatiblePTYManager;
|
|
20
|
-
usingBunWorker: boolean;
|
|
21
|
-
serviceConfig: PTYServiceConfig;
|
|
22
|
-
sessionMetadata: Map<string, Record<string, unknown>>;
|
|
23
|
-
sessionWorkdirs: Map<string, string>;
|
|
24
|
-
sessionOutputBuffers: Map<string, string[]>;
|
|
25
|
-
outputUnsubscribers: Map<string, () => void>;
|
|
26
|
-
taskResponseMarkers: Map<string, number>;
|
|
27
|
-
getAdapter: (agentType: AdapterType) => BaseCodingAdapter;
|
|
28
|
-
sendToSession: (sessionId: string, input: string) => Promise<unknown>;
|
|
29
|
-
sendKeysToSession: (sessionId: string, keys: string | string[]) => Promise<void>;
|
|
30
|
-
pushDefaultRules: (sessionId: string, agentType: string) => Promise<void>;
|
|
31
|
-
toSessionInfo: (session: SessionHandle | WorkerSessionHandle, workdir?: string) => SessionInfo;
|
|
32
|
-
log: (msg: string) => void;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Set up session output buffering for Bun worker path.
|
|
36
|
-
*/
|
|
37
|
-
export declare function setupOutputBuffer(ctx: SpawnContext, sessionId: string): void;
|
|
38
|
-
/**
|
|
39
|
-
* Set up deferred task delivery with retry logic.
|
|
40
|
-
* IMPORTANT: Must be called BEFORE pushDefaultRules (which has a 1500ms sleep),
|
|
41
|
-
* otherwise session_ready fires during pushDefaultRules and the listener misses it.
|
|
42
|
-
*/
|
|
43
|
-
export declare function setupDeferredTaskDelivery(ctx: SpawnContext, session: SessionHandle | WorkerSessionHandle, task: string, agentType: string): void;
|
|
44
|
-
/**
|
|
45
|
-
* Build the SpawnConfig and env vars from SpawnSessionOptions.
|
|
46
|
-
*/
|
|
47
|
-
export declare function buildSpawnConfig(sessionId: string, options: SpawnSessionOptions, workdir: string): SpawnConfig & {
|
|
48
|
-
id: string;
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=pty-spawn.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pty-spawn.d.ts","sourceRoot":"","sources":["../../src/services/pty-spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EACV,uBAAuB,EACvB,UAAU,EACV,aAAa,EACb,WAAW,EACX,mBAAmB,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAsBxB;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO9D;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE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M,EACZ,SAAS,EAAE,MAAM,GAChB,IAAI,CAkFN;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,MAAM,GACd,WAAW,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CA2C9B"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared types and helpers for the PTY service layer.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from pty-service.ts to keep that module lean and allow
|
|
5
|
-
* other modules (pty-spawn, pty-init, actions) to import lightweight
|
|
6
|
-
* type-only dependencies without pulling in the full PTYService class.
|
|
7
|
-
*
|
|
8
|
-
* @module services/pty-types
|
|
9
|
-
*/
|
|
10
|
-
import type { AdapterType, AgentCredentials, ApprovalPreset } from "coding-agent-adapters";
|
|
11
|
-
import type { SessionHandle } from "pty-manager";
|
|
12
|
-
export interface PTYServiceConfig {
|
|
13
|
-
/** Maximum output lines to keep per session (default: 1000) */
|
|
14
|
-
maxLogLines?: number;
|
|
15
|
-
/** Enable debug logging */
|
|
16
|
-
debug?: boolean;
|
|
17
|
-
/** Auto-register coding agent adapters (default: true) */
|
|
18
|
-
registerCodingAdapters?: boolean;
|
|
19
|
-
/** Maximum concurrent PTY sessions (default: 8) */
|
|
20
|
-
maxConcurrentSessions?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Default approval preset for coding agents when not specified per-spawn.
|
|
23
|
-
* Controls what tools the agent can use without asking for permission.
|
|
24
|
-
* - "readonly" — Read-only tools only
|
|
25
|
-
* - "standard" — Read + write, asks for shell/network
|
|
26
|
-
* - "permissive" — Most tools auto-approved, asks for destructive ops
|
|
27
|
-
* - "autonomous" — All tools auto-approved (yolo mode)
|
|
28
|
-
* Default: "permissive"
|
|
29
|
-
*/
|
|
30
|
-
defaultApprovalPreset?: ApprovalPreset;
|
|
31
|
-
}
|
|
32
|
-
/** Available coding agent types */
|
|
33
|
-
export type CodingAgentType = "shell" | "pi" | AdapterType;
|
|
34
|
-
/** True when the user requested the Pi coding agent. */
|
|
35
|
-
export declare const isPiAgentType: (input: string | undefined | null) => boolean;
|
|
36
|
-
/** Normalize user-provided agent type string to a valid CodingAgentType */
|
|
37
|
-
export declare const normalizeAgentType: (input: string) => CodingAgentType;
|
|
38
|
-
/** Build the initial shell command for Pi agent sessions. */
|
|
39
|
-
export declare const toPiCommand: (task: string | undefined) => string;
|
|
40
|
-
export interface SpawnSessionOptions {
|
|
41
|
-
/** Human-readable session name */
|
|
42
|
-
name: string;
|
|
43
|
-
/** Adapter type: "shell" | "pi" | "claude" | "gemini" | "codex" | "aider" */
|
|
44
|
-
agentType: CodingAgentType;
|
|
45
|
-
/** Working directory for the session */
|
|
46
|
-
workdir?: string;
|
|
47
|
-
/** Initial command/task to send */
|
|
48
|
-
initialTask?: string;
|
|
49
|
-
/** Environment variables */
|
|
50
|
-
env?: Record<string, string>;
|
|
51
|
-
/** Session metadata for tracking */
|
|
52
|
-
metadata?: Record<string, unknown>;
|
|
53
|
-
/** Credentials for coding agents (API keys, tokens) */
|
|
54
|
-
credentials?: AgentCredentials;
|
|
55
|
-
/** Memory/instructions content to write to the agent's memory file before spawning */
|
|
56
|
-
memoryContent?: string;
|
|
57
|
-
/** Approval preset controlling tool permissions (readonly, standard, permissive, autonomous) */
|
|
58
|
-
approvalPreset?: ApprovalPreset;
|
|
59
|
-
/** Custom credentials for MCP servers or other integrations */
|
|
60
|
-
customCredentials?: Record<string, string>;
|
|
61
|
-
/** When true, adapter-level blocking prompts (tool permissions, file access)
|
|
62
|
-
* are emitted with autoResponded=false instead of being auto-handled.
|
|
63
|
-
* Used by the swarm coordinator to route decisions through its LLM loop. */
|
|
64
|
-
skipAdapterAutoResponse?: boolean;
|
|
65
|
-
}
|
|
66
|
-
export interface SessionInfo {
|
|
67
|
-
id: string;
|
|
68
|
-
name: string;
|
|
69
|
-
agentType: string;
|
|
70
|
-
workdir: string;
|
|
71
|
-
status: SessionHandle["status"];
|
|
72
|
-
createdAt: Date;
|
|
73
|
-
lastActivityAt: Date;
|
|
74
|
-
metadata?: Record<string, unknown>;
|
|
75
|
-
}
|
|
76
|
-
/** Known event names emitted by the PTY layer. */
|
|
77
|
-
export type SessionEventName = "ready" | "blocked" | "login_required" | "task_complete" | "tool_running" | "stopped" | "error" | "message";
|
|
78
|
-
type SessionEventCallback = (sessionId: string, event: string, data: unknown) => void;
|
|
79
|
-
export type { SessionEventCallback };
|
|
80
|
-
//# sourceMappingURL=pty-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pty-types.d.ts","sourceRoot":"","sources":["../../src/services/pty-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,cAAc,EACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0DAA0D;IAC1D,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,mDAAmD;IACnD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;;OAQG;IACH,qBAAqB,CAAC,EAAE,cAAc,CAAC;CACxC;AAED,mCAAmC;AACnC,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,IAAI,GAAG,WAAW,CAAC;AAU3D,wDAAwD;AACxD,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,GAAG,SAAS,GAAG,IAAI,KAAG,OAGhE,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,KAAG,eAoBlD,CAAC;AAEF,6DAA6D;AAC7D,eAAO,MAAM,WAAW,GAAI,MAAM,MA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,EACjB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,OAAO,KACV,IAAI,CAAC;AAEV,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Stall classification subsystem — determines what a "stalled" coding agent
|
|
3
|
-
* session is doing (finished, waiting for input, still working, or errored).
|
|
4
|
-
*
|
|
5
|
-
* Extracted as standalone functions that receive dependencies as parameters,
|
|
6
|
-
* making them easy to test without coupling to PTYService.
|
|
7
|
-
*
|
|
8
|
-
* @module services/stall-classifier
|
|
9
|
-
*/
|
|
10
|
-
import { type IAgentRuntime } from "@elizaos/core";
|
|
11
|
-
import { type StallClassification } from "pty-manager";
|
|
12
|
-
import type { AgentMetricsTracker } from "./agent-metrics.js";
|
|
13
|
-
/** Everything the classifier needs, passed in from PTYService. */
|
|
14
|
-
export interface StallClassifierContext {
|
|
15
|
-
sessionId: string;
|
|
16
|
-
recentOutput: string;
|
|
17
|
-
agentType: string;
|
|
18
|
-
buffers: Map<string, string[]>;
|
|
19
|
-
traceEntries: Array<string | Record<string, unknown>>;
|
|
20
|
-
runtime: IAgentRuntime;
|
|
21
|
-
manager: {
|
|
22
|
-
get(id: string): {
|
|
23
|
-
startedAt?: string | Date;
|
|
24
|
-
} | null | undefined;
|
|
25
|
-
} | null;
|
|
26
|
-
metricsTracker: AgentMetricsTracker;
|
|
27
|
-
/** Write debug snapshots to ~/.milady/debug/ on stall (default: false) */
|
|
28
|
-
debugSnapshots?: boolean;
|
|
29
|
-
log: (msg: string) => void;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Build the LLM system prompt used to classify stalled output.
|
|
33
|
-
*/
|
|
34
|
-
export declare function buildStallClassificationPrompt(agentType: string, sessionId: string, output: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* Write a debug snapshot to ~/.milady/debug/ for offline stall analysis.
|
|
37
|
-
*/
|
|
38
|
-
export declare function writeStallSnapshot(sessionId: string, agentType: string, recentOutput: string, effectiveOutput: string, buffers: Map<string, string[]>, traceEntries: Array<string | Record<string, unknown>>, log: (msg: string) => void): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Main stall classification logic. Determines what a stalled session is doing
|
|
41
|
-
* by checking the buffer, building a prompt, and asking the LLM.
|
|
42
|
-
*/
|
|
43
|
-
export declare function classifyStallOutput(ctx: StallClassifierContext): Promise<StallClassification | null>;
|
|
44
|
-
//# sourceMappingURL=stall-classifier.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stall-classifier.d.ts","sourceRoot":"","sources":["../../src/services/stall-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,eAAe,CAAC;AAC9D,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,kEAAkE;AAClE,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/B,YAAY,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,OAAO,EAAE,aAAa,CAAC;IACvB,OAAO,EAAE;QACP,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG;YAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,GAAG,SAAS,CAAC;KACnE,GAAG,IAAI,CAAC;IACT,cAAc,EAAE,mBAAmB,CAAC;IACpC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,MAAM,CAmCR;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAC9B,YAAY,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACrD,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GACzB,OAAO,CAAC,IAAI,CAAC,CA8Cf;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,sBAAsB,GAC1B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAiGrC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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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