@elizaos/plugin-agent-orchestrator 0.1.0 → 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20232 -5242
- package/dist/index.js.map +102 -39
- package/dist/src/actions/messaging.d.ts +24 -0
- package/dist/src/actions/messaging.d.ts.map +1 -0
- package/dist/src/actions/peek-subagent.d.ts +3 -0
- package/dist/src/actions/peek-subagent.d.ts.map +1 -0
- package/dist/src/actions/subagent-management.d.ts +7 -0
- package/dist/src/actions/subagent-management.d.ts.map +1 -0
- package/dist/src/actions/task-management.d.ts +9 -0
- package/dist/src/actions/task-management.d.ts.map +1 -0
- package/dist/src/config.d.ts +4 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/providers/orchestrator-config.d.ts +80 -0
- package/dist/src/providers/orchestrator-config.d.ts.map +1 -0
- package/dist/src/providers/task-context.d.ts +3 -0
- package/dist/src/providers/task-context.d.ts.map +1 -0
- package/dist/src/services/agent-orchestrator-service.d.ts +59 -0
- package/dist/src/services/agent-orchestrator-service.d.ts.map +1 -0
- package/dist/src/services/messaging-service.d.ts +111 -0
- package/dist/src/services/messaging-service.d.ts.map +1 -0
- package/dist/src/services/sandbox-service.d.ts +103 -0
- package/dist/src/services/sandbox-service.d.ts.map +1 -0
- package/dist/src/services/subagent-service.d.ts +140 -0
- package/dist/src/services/subagent-service.d.ts.map +1 -0
- package/dist/src/sub-agents/adapter.d.ts +13 -0
- package/dist/src/sub-agents/adapter.d.ts.map +1 -0
- package/dist/src/sub-agents/claude-agent-sdk-sub-agent.d.ts +18 -0
- package/dist/src/sub-agents/claude-agent-sdk-sub-agent.d.ts.map +1 -0
- package/dist/src/sub-agents/codex-sdk-sub-agent.d.ts +18 -0
- package/dist/src/sub-agents/codex-sdk-sub-agent.d.ts.map +1 -0
- package/dist/src/sub-agents/eliza-sub-agent.d.ts +27 -0
- package/dist/src/sub-agents/eliza-sub-agent.d.ts.map +1 -0
- package/dist/src/sub-agents/elizaos-native-sub-agent.d.ts +61 -0
- package/dist/src/sub-agents/elizaos-native-sub-agent.d.ts.map +1 -0
- package/dist/src/sub-agents/index.d.ts +10 -0
- package/dist/src/sub-agents/index.d.ts.map +1 -0
- package/dist/src/sub-agents/opencode-sub-agent.d.ts +44 -0
- package/dist/src/sub-agents/opencode-sub-agent.d.ts.map +1 -0
- package/dist/src/sub-agents/registry.d.ts +3 -0
- package/dist/src/sub-agents/registry.d.ts.map +1 -0
- package/dist/src/sub-agents/sweagent-sub-agent.d.ts +19 -0
- package/dist/src/sub-agents/sweagent-sub-agent.d.ts.map +1 -0
- package/dist/src/sub-agents/tools.d.ts +15 -0
- package/dist/src/sub-agents/tools.d.ts.map +1 -0
- package/dist/src/sub-agents/types.d.ts +170 -0
- package/dist/src/sub-agents/types.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +12 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/messaging.d.ts +202 -0
- package/dist/src/types/messaging.d.ts.map +1 -0
- package/dist/src/types/sandbox.d.ts +228 -0
- package/dist/src/types/sandbox.d.ts.map +1 -0
- package/dist/src/types/subagent.d.ts +232 -0
- package/dist/src/types/subagent.d.ts.map +1 -0
- package/dist/src/types.d.ts +138 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +7 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/session.d.ts +184 -0
- package/dist/src/utils/session.d.ts.map +1 -0
- package/dist/sweagent-sub-agent.js +394 -0
- package/dist/sweagent-sub-agent.js.map +10 -0
- package/package.json +47 -15
- package/README.md +0 -169
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import type { UUID } from "@elizaos/core";
|
|
2
|
+
/**
|
|
3
|
+
* Docker container configuration for sandboxed execution.
|
|
4
|
+
*/
|
|
5
|
+
export interface SandboxDockerConfig {
|
|
6
|
+
/** Docker image to use */
|
|
7
|
+
image: string;
|
|
8
|
+
/** Container name prefix */
|
|
9
|
+
containerPrefix: string;
|
|
10
|
+
/** Working directory inside the container */
|
|
11
|
+
workdir: string;
|
|
12
|
+
/** Whether to remove container after execution */
|
|
13
|
+
autoRemove: boolean;
|
|
14
|
+
/** Memory limit (e.g., "2g") */
|
|
15
|
+
memoryLimit?: string;
|
|
16
|
+
/** CPU limit (e.g., "2") */
|
|
17
|
+
cpuLimit?: string;
|
|
18
|
+
/** Additional environment variables */
|
|
19
|
+
env?: Record<string, string>;
|
|
20
|
+
/** Additional volume mounts */
|
|
21
|
+
mounts?: Array<{
|
|
22
|
+
host: string;
|
|
23
|
+
container: string;
|
|
24
|
+
mode: "ro" | "rw";
|
|
25
|
+
}>;
|
|
26
|
+
/** Network mode */
|
|
27
|
+
network?: "none" | "bridge" | "host";
|
|
28
|
+
/** Additional docker run arguments */
|
|
29
|
+
extraArgs?: string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Tool execution policy for sandboxed environments.
|
|
33
|
+
*/
|
|
34
|
+
export interface SandboxToolPolicy {
|
|
35
|
+
/** Tools explicitly allowed (overrides deny) */
|
|
36
|
+
allow?: string[];
|
|
37
|
+
/** Tools explicitly denied */
|
|
38
|
+
deny?: string[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Browser configuration for sandboxed environments.
|
|
42
|
+
*/
|
|
43
|
+
export interface SandboxBrowserConfig {
|
|
44
|
+
/** Whether sandboxed browser is enabled */
|
|
45
|
+
enabled: boolean;
|
|
46
|
+
/** Docker image for browser container */
|
|
47
|
+
image: string;
|
|
48
|
+
/** Container name prefix */
|
|
49
|
+
containerPrefix: string;
|
|
50
|
+
/** Chrome DevTools Protocol port */
|
|
51
|
+
cdpPort: number;
|
|
52
|
+
/** VNC port for remote viewing */
|
|
53
|
+
vncPort: number;
|
|
54
|
+
/** noVNC web port */
|
|
55
|
+
noVncPort: number;
|
|
56
|
+
/** Run browser headless */
|
|
57
|
+
headless: boolean;
|
|
58
|
+
/** Enable noVNC web interface */
|
|
59
|
+
enableNoVnc: boolean;
|
|
60
|
+
/** Allow host browser control */
|
|
61
|
+
allowHostControl: boolean;
|
|
62
|
+
/** Auto-start browser on sandbox creation */
|
|
63
|
+
autoStart: boolean;
|
|
64
|
+
/** Timeout for auto-start in milliseconds */
|
|
65
|
+
autoStartTimeoutMs: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Workspace access level for sandboxed sessions.
|
|
69
|
+
*/
|
|
70
|
+
export type SandboxWorkspaceAccess = "none" | "ro" | "rw";
|
|
71
|
+
/**
|
|
72
|
+
* Sandbox scope - determines isolation level.
|
|
73
|
+
*/
|
|
74
|
+
export type SandboxScope = "session" | "agent" | "shared";
|
|
75
|
+
/**
|
|
76
|
+
* Sandbox mode - determines when sandboxing applies.
|
|
77
|
+
*/
|
|
78
|
+
export type SandboxMode = "off" | "non-main" | "all";
|
|
79
|
+
/**
|
|
80
|
+
* Pruning configuration for sandbox cleanup.
|
|
81
|
+
*/
|
|
82
|
+
export interface SandboxPruneConfig {
|
|
83
|
+
/** Hours of inactivity before marking as idle */
|
|
84
|
+
idleHours: number;
|
|
85
|
+
/** Maximum age in days before forced cleanup */
|
|
86
|
+
maxAgeDays: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Complete sandbox configuration.
|
|
90
|
+
* Stored in Character.settings.sandbox or world metadata.
|
|
91
|
+
*/
|
|
92
|
+
export interface SandboxConfig {
|
|
93
|
+
/** Sandbox mode */
|
|
94
|
+
mode: SandboxMode;
|
|
95
|
+
/** Isolation scope */
|
|
96
|
+
scope: SandboxScope;
|
|
97
|
+
/** Workspace access level */
|
|
98
|
+
workspaceAccess: SandboxWorkspaceAccess;
|
|
99
|
+
/** Root directory for sandbox workspaces */
|
|
100
|
+
workspaceRoot: string;
|
|
101
|
+
/** Docker configuration */
|
|
102
|
+
docker: SandboxDockerConfig;
|
|
103
|
+
/** Browser configuration */
|
|
104
|
+
browser: SandboxBrowserConfig;
|
|
105
|
+
/** Tool execution policy */
|
|
106
|
+
tools: SandboxToolPolicy;
|
|
107
|
+
/** Pruning configuration */
|
|
108
|
+
prune: SandboxPruneConfig;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Browser context for a sandbox.
|
|
112
|
+
*/
|
|
113
|
+
export interface SandboxBrowserContext {
|
|
114
|
+
/** URL to connect to the browser bridge */
|
|
115
|
+
bridgeUrl: string;
|
|
116
|
+
/** URL for noVNC web interface */
|
|
117
|
+
noVncUrl?: string;
|
|
118
|
+
/** Container name running the browser */
|
|
119
|
+
containerName: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Resolved sandbox context for a session.
|
|
123
|
+
*/
|
|
124
|
+
export interface SandboxContext {
|
|
125
|
+
/** Whether sandboxing is enabled for this session */
|
|
126
|
+
enabled: boolean;
|
|
127
|
+
/** The session key this sandbox is for */
|
|
128
|
+
sessionKey: string;
|
|
129
|
+
/** Eliza room ID associated with this sandbox */
|
|
130
|
+
roomId?: UUID;
|
|
131
|
+
/** Directory where sandbox files are stored */
|
|
132
|
+
workspaceDir: string;
|
|
133
|
+
/** Agent's workspace directory */
|
|
134
|
+
agentWorkspaceDir: string;
|
|
135
|
+
/** Access level for the workspace */
|
|
136
|
+
workspaceAccess: SandboxWorkspaceAccess;
|
|
137
|
+
/** Name of the Docker container */
|
|
138
|
+
containerName: string;
|
|
139
|
+
/** Working directory inside the container */
|
|
140
|
+
containerWorkdir: string;
|
|
141
|
+
/** Docker configuration */
|
|
142
|
+
docker: SandboxDockerConfig;
|
|
143
|
+
/** Tool execution policy */
|
|
144
|
+
tools: SandboxToolPolicy;
|
|
145
|
+
/** Whether host browser control is allowed */
|
|
146
|
+
browserAllowHostControl: boolean;
|
|
147
|
+
/** Browser context if available */
|
|
148
|
+
browser?: SandboxBrowserContext;
|
|
149
|
+
/** When this context was created */
|
|
150
|
+
createdAt: number;
|
|
151
|
+
/** When this context was last accessed */
|
|
152
|
+
lastAccessedAt: number;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Minimal workspace info for sandbox operations.
|
|
156
|
+
*/
|
|
157
|
+
export interface SandboxWorkspaceInfo {
|
|
158
|
+
workspaceDir: string;
|
|
159
|
+
containerWorkdir: string;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Result of a sandboxed command execution.
|
|
163
|
+
*/
|
|
164
|
+
export interface SandboxExecutionResult {
|
|
165
|
+
/** Whether the command succeeded */
|
|
166
|
+
success: boolean;
|
|
167
|
+
/** Exit code of the command */
|
|
168
|
+
exitCode: number;
|
|
169
|
+
/** Standard output */
|
|
170
|
+
stdout: string;
|
|
171
|
+
/** Standard error */
|
|
172
|
+
stderr: string;
|
|
173
|
+
/** Execution duration in milliseconds */
|
|
174
|
+
durationMs: number;
|
|
175
|
+
/** Whether the command timed out */
|
|
176
|
+
timedOut: boolean;
|
|
177
|
+
/** Error message if failed */
|
|
178
|
+
error?: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Parameters for executing a command in a sandbox.
|
|
182
|
+
*/
|
|
183
|
+
export interface SandboxExecuteParams {
|
|
184
|
+
/** Command to execute */
|
|
185
|
+
command: string;
|
|
186
|
+
/** Arguments to pass to the command */
|
|
187
|
+
args?: string[];
|
|
188
|
+
/** Working directory (relative to container workdir) */
|
|
189
|
+
cwd?: string;
|
|
190
|
+
/** Environment variables */
|
|
191
|
+
env?: Record<string, string>;
|
|
192
|
+
/** Timeout in milliseconds */
|
|
193
|
+
timeoutMs?: number;
|
|
194
|
+
/** Standard input to pass to the command */
|
|
195
|
+
stdin?: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Events emitted by the sandbox service.
|
|
199
|
+
*/
|
|
200
|
+
export declare const SandboxEventType: {
|
|
201
|
+
/** Sandbox created */
|
|
202
|
+
readonly CREATED: "SANDBOX_CREATED";
|
|
203
|
+
/** Sandbox destroyed */
|
|
204
|
+
readonly DESTROYED: "SANDBOX_DESTROYED";
|
|
205
|
+
/** Command started */
|
|
206
|
+
readonly COMMAND_STARTED: "SANDBOX_COMMAND_STARTED";
|
|
207
|
+
/** Command completed */
|
|
208
|
+
readonly COMMAND_COMPLETED: "SANDBOX_COMMAND_COMPLETED";
|
|
209
|
+
/** Command failed */
|
|
210
|
+
readonly COMMAND_FAILED: "SANDBOX_COMMAND_FAILED";
|
|
211
|
+
/** Browser started */
|
|
212
|
+
readonly BROWSER_STARTED: "SANDBOX_BROWSER_STARTED";
|
|
213
|
+
/** Browser stopped */
|
|
214
|
+
readonly BROWSER_STOPPED: "SANDBOX_BROWSER_STOPPED";
|
|
215
|
+
};
|
|
216
|
+
export type SandboxEventType = (typeof SandboxEventType)[keyof typeof SandboxEventType];
|
|
217
|
+
/**
|
|
218
|
+
* Payload for sandbox events.
|
|
219
|
+
*/
|
|
220
|
+
export interface SandboxEventPayload {
|
|
221
|
+
sessionKey: string;
|
|
222
|
+
roomId?: UUID;
|
|
223
|
+
containerName?: string;
|
|
224
|
+
command?: string;
|
|
225
|
+
result?: SandboxExecutionResult;
|
|
226
|
+
error?: string;
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../../src/types/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,UAAU,EAAE,OAAO,CAAC;IACpB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC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H,eAAO,MAAM,gBAAgB;IAC3B,sBAAsB;;IAEtB,wBAAwB;;IAExB,sBAAsB;;IAEtB,wBAAwB;;IAExB,qBAAqB;;IAErB,sBAAsB;;IAEtB,sBAAsB;;CAEd,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import type { UUID } from "@elizaos/core";
|
|
2
|
+
/**
|
|
3
|
+
* Parsed components of a session key.
|
|
4
|
+
* Otto session keys follow patterns like:
|
|
5
|
+
* - "agent:mybot:dm:user123"
|
|
6
|
+
* - "agent:mybot:subagent:uuid"
|
|
7
|
+
* - "agent:mybot:group:channelId"
|
|
8
|
+
*/
|
|
9
|
+
export interface ParsedSessionKey {
|
|
10
|
+
agentId: string;
|
|
11
|
+
keyType: "dm" | "subagent" | "group" | "channel" | "unknown";
|
|
12
|
+
identifier: string;
|
|
13
|
+
parentKey?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Delivery context for message routing.
|
|
17
|
+
* Captures the channel and target information for message delivery.
|
|
18
|
+
*/
|
|
19
|
+
export interface DeliveryContext {
|
|
20
|
+
channel?: string;
|
|
21
|
+
accountId?: string;
|
|
22
|
+
to?: string;
|
|
23
|
+
threadId?: string | number;
|
|
24
|
+
groupId?: string;
|
|
25
|
+
groupChannel?: string;
|
|
26
|
+
groupSpace?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Outcome of a subagent run.
|
|
30
|
+
*/
|
|
31
|
+
export interface SubagentRunOutcome {
|
|
32
|
+
status: "ok" | "error" | "timeout" | "unknown";
|
|
33
|
+
error?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Record tracking a subagent run's lifecycle.
|
|
37
|
+
*/
|
|
38
|
+
export interface SubagentRunRecord {
|
|
39
|
+
/** Unique run identifier */
|
|
40
|
+
runId: string;
|
|
41
|
+
/** The subagent's session key / room identifier */
|
|
42
|
+
childSessionKey: string;
|
|
43
|
+
/** The parent session that spawned this subagent */
|
|
44
|
+
requesterSessionKey: string;
|
|
45
|
+
/** Delivery context for announcing results */
|
|
46
|
+
requesterOrigin?: DeliveryContext;
|
|
47
|
+
/** Human-readable display key for the requester */
|
|
48
|
+
requesterDisplayKey: string;
|
|
49
|
+
/** The task description given to the subagent */
|
|
50
|
+
task: string;
|
|
51
|
+
/** Cleanup behavior after completion */
|
|
52
|
+
cleanup: "delete" | "keep";
|
|
53
|
+
/** Optional label for identification */
|
|
54
|
+
label?: string;
|
|
55
|
+
/** When the run was registered */
|
|
56
|
+
createdAt: number;
|
|
57
|
+
/** When execution actually started */
|
|
58
|
+
startedAt?: number;
|
|
59
|
+
/** When execution ended */
|
|
60
|
+
endedAt?: number;
|
|
61
|
+
/** Final outcome */
|
|
62
|
+
outcome?: SubagentRunOutcome;
|
|
63
|
+
/** When to archive/delete this record */
|
|
64
|
+
archiveAtMs?: number;
|
|
65
|
+
/** Whether cleanup has completed */
|
|
66
|
+
cleanupCompletedAt?: number;
|
|
67
|
+
/** Whether cleanup is in progress */
|
|
68
|
+
cleanupHandled?: boolean;
|
|
69
|
+
/** Eliza room ID associated with this subagent */
|
|
70
|
+
roomId?: UUID;
|
|
71
|
+
/** Eliza world ID for context */
|
|
72
|
+
worldId?: UUID;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Parameters for spawning a subagent.
|
|
76
|
+
*/
|
|
77
|
+
export interface SpawnSubagentParams {
|
|
78
|
+
/** The task to execute */
|
|
79
|
+
task: string;
|
|
80
|
+
/** Optional label for identification */
|
|
81
|
+
label?: string;
|
|
82
|
+
/** Target agent ID (defaults to current agent) */
|
|
83
|
+
agentId?: string;
|
|
84
|
+
/** Model override (e.g., "anthropic/claude-3-sonnet") */
|
|
85
|
+
model?: string;
|
|
86
|
+
/** Thinking level override */
|
|
87
|
+
thinking?: string;
|
|
88
|
+
/** Timeout in seconds (0 = no timeout) */
|
|
89
|
+
runTimeoutSeconds?: number;
|
|
90
|
+
/** Cleanup behavior after completion */
|
|
91
|
+
cleanup?: "delete" | "keep";
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Result of spawning a subagent.
|
|
95
|
+
*/
|
|
96
|
+
export interface SpawnSubagentResult {
|
|
97
|
+
status: "accepted" | "forbidden" | "error";
|
|
98
|
+
childSessionKey?: string;
|
|
99
|
+
childRoomId?: UUID;
|
|
100
|
+
runId?: string;
|
|
101
|
+
modelApplied?: boolean;
|
|
102
|
+
warning?: string;
|
|
103
|
+
error?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Parameters for sending a message to another agent/session.
|
|
107
|
+
*/
|
|
108
|
+
export interface SendToAgentParams {
|
|
109
|
+
/** Target session key or room ID */
|
|
110
|
+
sessionKey?: string;
|
|
111
|
+
/** Target by label (alternative to sessionKey) */
|
|
112
|
+
label?: string;
|
|
113
|
+
/** Target agent ID (when using label) */
|
|
114
|
+
agentId?: string;
|
|
115
|
+
/** The message to send */
|
|
116
|
+
message: string;
|
|
117
|
+
/** Timeout in seconds */
|
|
118
|
+
timeoutSeconds?: number;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Result of sending a message to another agent.
|
|
122
|
+
*/
|
|
123
|
+
export interface SendToAgentResult {
|
|
124
|
+
status: "ok" | "accepted" | "timeout" | "forbidden" | "error";
|
|
125
|
+
runId: string;
|
|
126
|
+
sessionKey?: string;
|
|
127
|
+
reply?: string;
|
|
128
|
+
delivery?: {
|
|
129
|
+
status: string;
|
|
130
|
+
mode: string;
|
|
131
|
+
};
|
|
132
|
+
error?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Agent-to-agent communication policy.
|
|
136
|
+
*/
|
|
137
|
+
export interface AgentToAgentPolicy {
|
|
138
|
+
enabled: boolean;
|
|
139
|
+
allowRules: Array<{
|
|
140
|
+
source: string | "*";
|
|
141
|
+
target: string | "*";
|
|
142
|
+
}>;
|
|
143
|
+
isAllowed(sourceAgentId: string, targetAgentId: string): boolean;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Configuration for subagent behavior.
|
|
147
|
+
* Stored in Character.settings.subagents or world metadata.
|
|
148
|
+
*/
|
|
149
|
+
export interface SubagentConfig {
|
|
150
|
+
/** Allow subagent spawning */
|
|
151
|
+
enabled?: boolean;
|
|
152
|
+
/** Default model for subagents */
|
|
153
|
+
model?: string;
|
|
154
|
+
/** Default thinking level */
|
|
155
|
+
thinking?: string;
|
|
156
|
+
/** Timeout in seconds */
|
|
157
|
+
timeoutSeconds?: number;
|
|
158
|
+
/** Allowed agent IDs for cross-agent spawning (* = all) */
|
|
159
|
+
allowAgents?: string[];
|
|
160
|
+
/** Minutes before archiving completed subagent records */
|
|
161
|
+
archiveAfterMinutes?: number;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Event types emitted by the subagent system.
|
|
165
|
+
*/
|
|
166
|
+
export declare const SubagentEventType: {
|
|
167
|
+
/** Subagent spawn requested */
|
|
168
|
+
readonly SPAWN_REQUESTED: "SUBAGENT_SPAWN_REQUESTED";
|
|
169
|
+
/** Subagent run started */
|
|
170
|
+
readonly RUN_STARTED: "SUBAGENT_RUN_STARTED";
|
|
171
|
+
/** Subagent run completed */
|
|
172
|
+
readonly RUN_COMPLETED: "SUBAGENT_RUN_COMPLETED";
|
|
173
|
+
/** Subagent run failed */
|
|
174
|
+
readonly RUN_FAILED: "SUBAGENT_RUN_FAILED";
|
|
175
|
+
/** Subagent run timed out */
|
|
176
|
+
readonly RUN_TIMEOUT: "SUBAGENT_RUN_TIMEOUT";
|
|
177
|
+
/** Subagent announcement sent */
|
|
178
|
+
readonly ANNOUNCE_SENT: "SUBAGENT_ANNOUNCE_SENT";
|
|
179
|
+
/** Agent-to-agent message sent */
|
|
180
|
+
readonly A2A_MESSAGE_SENT: "A2A_MESSAGE_SENT";
|
|
181
|
+
/** Agent-to-agent message received */
|
|
182
|
+
readonly A2A_MESSAGE_RECEIVED: "A2A_MESSAGE_RECEIVED";
|
|
183
|
+
};
|
|
184
|
+
export type SubagentEventType = (typeof SubagentEventType)[keyof typeof SubagentEventType];
|
|
185
|
+
/**
|
|
186
|
+
* Payload for subagent events.
|
|
187
|
+
*/
|
|
188
|
+
export interface SubagentEventPayload {
|
|
189
|
+
runId: string;
|
|
190
|
+
childSessionKey?: string;
|
|
191
|
+
childRoomId?: UUID;
|
|
192
|
+
requesterSessionKey?: string;
|
|
193
|
+
requesterRoomId?: UUID;
|
|
194
|
+
task?: string;
|
|
195
|
+
label?: string;
|
|
196
|
+
status?: string;
|
|
197
|
+
outcome?: SubagentRunOutcome;
|
|
198
|
+
error?: string;
|
|
199
|
+
startedAt?: number;
|
|
200
|
+
endedAt?: number;
|
|
201
|
+
durationMs?: number;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Metadata stored on a room to track subagent context.
|
|
205
|
+
*/
|
|
206
|
+
export interface SubagentRoomMetadata {
|
|
207
|
+
/** Indicates this room is for a subagent */
|
|
208
|
+
isSubagent: true;
|
|
209
|
+
/** Run identifier for lifecycle tracking */
|
|
210
|
+
runId?: string;
|
|
211
|
+
/** The subagent's session key */
|
|
212
|
+
sessionKey: string;
|
|
213
|
+
/** Parent room that spawned this subagent */
|
|
214
|
+
parentRoomId?: UUID;
|
|
215
|
+
/** Parent session key */
|
|
216
|
+
parentSessionKey?: string;
|
|
217
|
+
/** The task this subagent is executing */
|
|
218
|
+
task?: string;
|
|
219
|
+
/** Label for identification */
|
|
220
|
+
label?: string;
|
|
221
|
+
/** When the subagent was spawned */
|
|
222
|
+
spawnedAt: number;
|
|
223
|
+
/** Cleanup behavior */
|
|
224
|
+
cleanup: "delete" | "keep";
|
|
225
|
+
/** Optional completion timestamp */
|
|
226
|
+
endedAt?: number;
|
|
227
|
+
/** Optional serialized outcome JSON */
|
|
228
|
+
outcome?: string;
|
|
229
|
+
/** Optional metadata update timestamp */
|
|
230
|
+
updatedAt?: number;
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=subagent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent.d.ts","sourceRoot":"","sources":["../../../src/types/subagent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,IAAI,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,IAAI,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,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,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,UAAU,EAAE,IAAI,CAAC;IACjB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,OAAO,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC3B,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { Task as CoreTask, UUID } from "@elizaos/core";
|
|
2
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
3
|
+
export type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
};
|
|
6
|
+
export type AgentCapability = string;
|
|
7
|
+
export type TaskStatus = "pending" | "running" | "completed" | "failed" | "paused" | "cancelled";
|
|
8
|
+
/**
|
|
9
|
+
* User-controlled lifecycle status (separate from execution status).
|
|
10
|
+
* Used by UIs to hide/show finished tasks without deleting history.
|
|
11
|
+
*/
|
|
12
|
+
export type TaskUserStatus = "open" | "done";
|
|
13
|
+
export interface TaskStep {
|
|
14
|
+
id: string;
|
|
15
|
+
description: string;
|
|
16
|
+
status: TaskStatus;
|
|
17
|
+
output?: string;
|
|
18
|
+
/** Additional metadata for the step */
|
|
19
|
+
metadata?: Record<string, JsonValue>;
|
|
20
|
+
}
|
|
21
|
+
export interface SubagentRoomMetadata {
|
|
22
|
+
isSubagent: boolean;
|
|
23
|
+
sessionKey: string;
|
|
24
|
+
task: string;
|
|
25
|
+
spawnedAt: number;
|
|
26
|
+
cleanup: "delete" | "keep";
|
|
27
|
+
runId?: string;
|
|
28
|
+
parentRoomId?: UUID;
|
|
29
|
+
parentSessionKey?: string;
|
|
30
|
+
label?: string;
|
|
31
|
+
endedAt?: number;
|
|
32
|
+
outcome?: string;
|
|
33
|
+
updatedAt?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface TaskResult {
|
|
36
|
+
success: boolean;
|
|
37
|
+
summary: string;
|
|
38
|
+
filesModified: string[];
|
|
39
|
+
filesCreated: string[];
|
|
40
|
+
error?: string;
|
|
41
|
+
/** Additional metadata for the result */
|
|
42
|
+
metadata?: Record<string, JsonValue>;
|
|
43
|
+
}
|
|
44
|
+
export type AgentProviderId = string;
|
|
45
|
+
export interface OrchestratedTaskMetadata {
|
|
46
|
+
status: TaskStatus;
|
|
47
|
+
progress: number;
|
|
48
|
+
output: string[];
|
|
49
|
+
steps: TaskStep[];
|
|
50
|
+
result?: TaskResult;
|
|
51
|
+
error?: string;
|
|
52
|
+
createdAt: number;
|
|
53
|
+
startedAt?: number;
|
|
54
|
+
completedAt?: number;
|
|
55
|
+
providerId: AgentProviderId;
|
|
56
|
+
/**
|
|
57
|
+
* Optional label (e.g. "Claude Code", "Codex", "SWE-agent") to show in UIs.
|
|
58
|
+
* Not used for routing execution (use `providerId`).
|
|
59
|
+
*/
|
|
60
|
+
providerLabel?: string;
|
|
61
|
+
/**
|
|
62
|
+
* A working directory string for display/prompting purposes.
|
|
63
|
+
* The orchestrator plugin does not read/verify the filesystem.
|
|
64
|
+
*/
|
|
65
|
+
workingDirectory: string;
|
|
66
|
+
/** Compatibility field for UIs that still refer to "subAgentType". */
|
|
67
|
+
subAgentType?: string;
|
|
68
|
+
/** User-controlled status for UI filtering. */
|
|
69
|
+
userStatus?: TaskUserStatus;
|
|
70
|
+
userStatusUpdatedAt?: number;
|
|
71
|
+
/** Optional result mirrors for UIs. */
|
|
72
|
+
filesCreated?: string[];
|
|
73
|
+
filesModified?: string[];
|
|
74
|
+
/** Capability contract metadata */
|
|
75
|
+
requiredCapabilities?: AgentCapability[];
|
|
76
|
+
declaredCapabilities?: AgentCapability[];
|
|
77
|
+
observedCapabilities?: AgentCapability[];
|
|
78
|
+
capabilityViolations?: AgentCapability[];
|
|
79
|
+
capabilityCheck?: Record<string, JsonValue>;
|
|
80
|
+
lastHeartbeatAt?: number;
|
|
81
|
+
lastProgressMessage?: string;
|
|
82
|
+
stallDetected?: boolean;
|
|
83
|
+
}
|
|
84
|
+
export interface OrchestratedTask extends Omit<CoreTask, "metadata"> {
|
|
85
|
+
metadata: OrchestratedTaskMetadata;
|
|
86
|
+
}
|
|
87
|
+
export interface ProviderTaskExecutionContext {
|
|
88
|
+
runtimeAgentId: UUID;
|
|
89
|
+
roomId?: UUID;
|
|
90
|
+
worldId?: UUID;
|
|
91
|
+
workingDirectory: string;
|
|
92
|
+
/** Best-effort telemetry channels back into task history */
|
|
93
|
+
appendOutput: (line: string) => Promise<void>;
|
|
94
|
+
updateProgress: (progress: number) => Promise<void>;
|
|
95
|
+
updateStep: (stepId: string, status: TaskStatus, output?: string) => Promise<void>;
|
|
96
|
+
/** Cooperative cancellation/pause. Providers should poll these. */
|
|
97
|
+
isCancelled: () => boolean;
|
|
98
|
+
isPaused: () => boolean;
|
|
99
|
+
}
|
|
100
|
+
export interface AgentProvider {
|
|
101
|
+
id: AgentProviderId;
|
|
102
|
+
label: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
capabilities?: AgentCapability[];
|
|
105
|
+
executeTask: (task: OrchestratedTask, ctx: ProviderTaskExecutionContext) => Promise<TaskResult>;
|
|
106
|
+
}
|
|
107
|
+
export interface AgentOrchestratorPluginOptions {
|
|
108
|
+
/**
|
|
109
|
+
* Providers available to the orchestrator.
|
|
110
|
+
*
|
|
111
|
+
* Examples:
|
|
112
|
+
* - "claude-code" (Claude Agent SDK)
|
|
113
|
+
* - "codex" (OpenAI Codex SDK)
|
|
114
|
+
* - "sweagent" (SWE-agent methodology worker)
|
|
115
|
+
* - "eliza+plugin-code" (Eliza worker that has @elizaos/plugin-code)
|
|
116
|
+
* - any custom provider id
|
|
117
|
+
*/
|
|
118
|
+
providers: readonly AgentProvider[];
|
|
119
|
+
/** Default provider id when user hasn’t selected one. */
|
|
120
|
+
defaultProviderId: AgentProviderId;
|
|
121
|
+
/**
|
|
122
|
+
* Function to supply a working directory string.
|
|
123
|
+
* The orchestrator plugin does not verify the path.
|
|
124
|
+
*/
|
|
125
|
+
getWorkingDirectory: () => string;
|
|
126
|
+
/**
|
|
127
|
+
* Environment variable that controls which provider is active for new tasks.
|
|
128
|
+
* Defaults to `ELIZA_CODE_ACTIVE_SUB_AGENT` for compatibility with `examples/code`.
|
|
129
|
+
*/
|
|
130
|
+
activeProviderEnvVar?: string;
|
|
131
|
+
}
|
|
132
|
+
export type TaskEventType = "task:created" | "task:started" | "task:progress" | "task:output" | "task:completed" | "task:failed" | "task:cancelled" | "task:paused" | "task:resumed" | "task:message";
|
|
133
|
+
export interface TaskEvent {
|
|
134
|
+
type: TaskEventType;
|
|
135
|
+
taskId: string;
|
|
136
|
+
data?: Record<string, JsonValue>;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAM5D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC7D,MAAM,MAAM,SAAS,GACjB,aAAa,GACb,SAAS,EAAE,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAA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AE,aAAa,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAClC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session and utility functions for the agent orchestrator.
|
|
3
|
+
*
|
|
4
|
+
* @module utils
|
|
5
|
+
*/
|
|
6
|
+
export { buildAcpSessionKey, buildAgentMainSessionKey, buildAgentPeerSessionKey, buildAgentSessionKey, buildGroupHistoryKey, buildSessionKey, buildSubagentSessionKey, createSendPolicyProvider, createSessionEntry, createSessionProvider, createSessionSkillsProvider, createSubagentSessionKey, deleteSessionEntry, extractAgentIdFromSessionKey, extractSessionContext, formatDurationShort, formatTokenCount, getSessionEntry, getSessionProviders, hashToUUID, isAcpSessionKey, isCoreSubagentSessionKey, isSubagentSessionKey, isValidSessionEntry, listSessionKeys, loadSessionStore, mergeDeliveryContext, mergeSessionEntry, normalizeAccountId, normalizeAgentId, normalizeCoreAgentId, normalizeDeliveryContext, normalizeMainKey, normalizeSessionKey, parseAgentSessionKey, parseSessionKey, resolveAgentIdFromSessionKey, resolveAgentSessionsDir, resolveDefaultSessionStorePath, resolveSessionTranscriptPath, resolveStateDir, resolveStorePath, resolveThreadParentSessionKey, resolveThreadSessionKeys, type SessionDeliveryContext, type SessionEntry, type SessionResolution, SessionStateManager, type SessionStore, saveSessionStore, sessionKeyToRoomId, toAgentRequestSessionKey, toAgentStoreSessionKey, updateSessionStore, updateSessionStoreEntry, upsertSessionEntry, } from "./session.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACL,kBAAkB,EAElB,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,wBAAwB,EAExB,kBAAkB,EAElB,qBAAqB,EACrB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EAEf,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,4BAA4B,EAC5B,uBAAuB,EACvB,8BAA8B,EAC9B,4BAA4B,EAE5B,eAAe,EACf,gBAAgB,EAChB,6BAA6B,EAC7B,wBAAwB,EACxB,KAAK,sBAAsB,EAE3B,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,KAAK,YAAY,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,sBAAsB,EACtB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,cAAc,CAAC"}
|