@elizaos/plugin-agent-orchestrator 2.0.0-alpha.9 → 2.0.0-beta.1
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/CHANGELOG.md +62 -0
- package/LICENSE +21 -0
- package/PROJECT.md +119 -0
- package/README.md +160 -0
- package/dist/browser/index.browser.js +21051 -0
- package/dist/browser/index.browser.js.map +29 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.node.cjs +20491 -0
- package/dist/cjs/index.node.js.map +72 -0
- package/dist/index.d.ts +2 -21
- package/dist/node/index.browser.d.ts +3 -0
- package/dist/node/index.browser.d.ts.map +1 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.node.d.ts +4 -0
- package/dist/node/index.node.d.ts.map +1 -0
- package/dist/node/index.node.js +20471 -0
- package/dist/node/index.node.js.map +72 -0
- package/dist/node/src/actions/cancel-task.d.ts +3 -0
- package/dist/node/src/actions/cancel-task.d.ts.map +1 -0
- package/dist/node/src/actions/coding-task-handlers.d.ts +69 -0
- package/dist/node/src/actions/coding-task-handlers.d.ts.map +1 -0
- package/dist/node/src/actions/coding-task-helpers.d.ts +35 -0
- package/dist/node/src/actions/coding-task-helpers.d.ts.map +1 -0
- package/dist/node/src/actions/common.d.ts +56 -0
- package/dist/node/src/actions/common.d.ts.map +1 -0
- package/dist/node/src/actions/create-task.d.ts +8 -0
- package/dist/node/src/actions/create-task.d.ts.map +1 -0
- package/dist/node/src/actions/eval-metadata.d.ts +11 -0
- package/dist/node/src/actions/eval-metadata.d.ts.map +1 -0
- package/dist/node/src/actions/finalize-workspace.d.ts +11 -0
- package/dist/node/src/actions/finalize-workspace.d.ts.map +1 -0
- package/dist/node/src/actions/list-agents.d.ts +4 -0
- package/dist/node/src/actions/list-agents.d.ts.map +1 -0
- package/dist/node/src/actions/manage-issues.d.ts +11 -0
- package/dist/node/src/actions/manage-issues.d.ts.map +1 -0
- package/dist/node/src/actions/provision-workspace.d.ts +11 -0
- package/dist/node/src/actions/provision-workspace.d.ts.map +1 -0
- package/dist/node/src/actions/sandbox-stub.d.ts +21 -0
- package/dist/node/src/actions/sandbox-stub.d.ts.map +1 -0
- package/dist/node/src/actions/send-to-agent.d.ts +4 -0
- package/dist/node/src/actions/send-to-agent.d.ts.map +1 -0
- package/dist/node/src/actions/spawn-agent.d.ts +8 -0
- package/dist/node/src/actions/spawn-agent.d.ts.map +1 -0
- package/dist/node/src/actions/stop-agent.d.ts +4 -0
- package/dist/node/src/actions/stop-agent.d.ts.map +1 -0
- package/dist/node/src/actions/task-control.d.ts +3 -0
- package/dist/node/src/actions/task-control.d.ts.map +1 -0
- package/dist/node/src/actions/task-history.d.ts +3 -0
- package/dist/node/src/actions/task-history.d.ts.map +1 -0
- package/dist/node/src/actions/task-share.d.ts +3 -0
- package/dist/node/src/actions/task-share.d.ts.map +1 -0
- package/dist/node/src/actions/task-thread-target.d.ts +11 -0
- package/dist/node/src/actions/task-thread-target.d.ts.map +1 -0
- package/dist/node/src/actions/tasks.d.ts +88 -0
- package/dist/node/src/actions/tasks.d.ts.map +1 -0
- package/dist/node/src/api/agent-routes.d.ts +18 -0
- package/dist/node/src/api/agent-routes.d.ts.map +1 -0
- package/dist/node/src/api/bridge-routes.d.ts +32 -0
- package/dist/node/src/api/bridge-routes.d.ts.map +1 -0
- package/dist/node/src/api/coordinator-routes.d.ts +22 -0
- package/dist/node/src/api/coordinator-routes.d.ts.map +1 -0
- package/dist/node/src/api/hook-routes.d.ts +18 -0
- package/dist/node/src/api/hook-routes.d.ts.map +1 -0
- package/dist/node/src/api/issue-routes.d.ts +17 -0
- package/dist/node/src/api/issue-routes.d.ts.map +1 -0
- package/dist/node/src/api/parent-context-routes.d.ts +17 -0
- package/dist/node/src/api/parent-context-routes.d.ts.map +1 -0
- package/dist/node/src/api/route-utils.d.ts +18 -0
- package/dist/node/src/api/route-utils.d.ts.map +1 -0
- package/dist/node/src/api/routes.d.ts +23 -0
- package/dist/node/src/api/routes.d.ts.map +1 -0
- package/dist/node/src/api/workspace-routes.d.ts +17 -0
- package/dist/node/src/api/workspace-routes.d.ts.map +1 -0
- package/dist/node/src/index.d.ts +32 -0
- package/dist/node/src/index.d.ts.map +1 -0
- package/dist/node/src/providers/action-examples.d.ts +14 -0
- package/dist/node/src/providers/action-examples.d.ts.map +1 -0
- package/dist/node/src/providers/active-sub-agents.d.ts +15 -0
- package/dist/node/src/providers/active-sub-agents.d.ts.map +1 -0
- package/dist/node/src/providers/active-workspace-context.d.ts +13 -0
- package/dist/node/src/providers/active-workspace-context.d.ts.map +1 -0
- package/dist/node/src/providers/available-agents.d.ts +4 -0
- package/dist/node/src/providers/available-agents.d.ts.map +1 -0
- package/dist/node/src/register-routes.d.ts +11 -0
- package/dist/node/src/register-routes.d.ts.map +1 -0
- package/dist/node/src/routes/coding-agents-fallback-routes.d.ts +19 -0
- package/dist/node/src/routes/coding-agents-fallback-routes.d.ts.map +1 -0
- package/dist/node/src/services/acp-service.d.ts +61 -0
- package/dist/node/src/services/acp-service.d.ts.map +1 -0
- package/dist/node/src/services/acpx-subprocess.d.ts +3 -0
- package/dist/node/src/services/acpx-subprocess.d.ts.map +1 -0
- package/dist/node/src/services/agent-credentials.d.ts +23 -0
- package/dist/node/src/services/agent-credentials.d.ts.map +1 -0
- package/dist/node/src/services/agent-metrics.d.ts +30 -0
- package/dist/node/src/services/agent-metrics.d.ts.map +1 -0
- package/dist/node/src/services/agent-selection.d.ts +53 -0
- package/dist/node/src/services/agent-selection.d.ts.map +1 -0
- package/dist/node/src/services/ansi-utils.d.ts +64 -0
- package/dist/node/src/services/ansi-utils.d.ts.map +1 -0
- package/dist/node/src/services/claude-code-skill-installer.d.ts +33 -0
- package/dist/node/src/services/claude-code-skill-installer.d.ts.map +1 -0
- package/dist/node/src/services/config-env.d.ts +23 -0
- package/dist/node/src/services/config-env.d.ts.map +1 -0
- package/dist/node/src/services/coordinator-event-normalizer.d.ts +50 -0
- package/dist/node/src/services/coordinator-event-normalizer.d.ts.map +1 -0
- package/dist/node/src/services/custom-validator-runner.d.ts +66 -0
- package/dist/node/src/services/custom-validator-runner.d.ts.map +1 -0
- package/dist/node/src/services/debug-capture.d.ts +38 -0
- package/dist/node/src/services/debug-capture.d.ts.map +1 -0
- package/dist/node/src/services/json-model-output.d.ts +2 -0
- package/dist/node/src/services/json-model-output.d.ts.map +1 -0
- package/dist/node/src/services/parent-agent-broker.d.ts +21 -0
- package/dist/node/src/services/parent-agent-broker.d.ts.map +1 -0
- package/dist/node/src/services/pty-auto-response.d.ts +30 -0
- package/dist/node/src/services/pty-auto-response.d.ts.map +1 -0
- package/dist/node/src/services/pty-init.d.ts +55 -0
- package/dist/node/src/services/pty-init.d.ts.map +1 -0
- package/dist/node/src/services/pty-service.d.ts +218 -0
- package/dist/node/src/services/pty-service.d.ts.map +1 -0
- package/dist/node/src/services/pty-session-io.d.ts +49 -0
- package/dist/node/src/services/pty-session-io.d.ts.map +1 -0
- package/dist/node/src/services/pty-spawn.d.ts +104 -0
- package/dist/node/src/services/pty-spawn.d.ts.map +1 -0
- package/dist/node/src/services/pty-types.d.ts +94 -0
- package/dist/node/src/services/pty-types.d.ts.map +1 -0
- package/dist/node/src/services/repo-input.d.ts +16 -0
- package/dist/node/src/services/repo-input.d.ts.map +1 -0
- package/dist/node/src/services/session-event-queue.d.ts +25 -0
- package/dist/node/src/services/session-event-queue.d.ts.map +1 -0
- package/dist/node/src/services/session-store.d.ts +107 -0
- package/dist/node/src/services/session-store.d.ts.map +1 -0
- package/dist/node/src/services/skill-callback-bridge.d.ts +78 -0
- package/dist/node/src/services/skill-callback-bridge.d.ts.map +1 -0
- package/dist/node/src/services/skill-essentials.d.ts +16 -0
- package/dist/node/src/services/skill-essentials.d.ts.map +1 -0
- package/dist/node/src/services/skill-lifeops-context-broker.d.ts +20 -0
- package/dist/node/src/services/skill-lifeops-context-broker.d.ts.map +1 -0
- package/dist/node/src/services/skill-manifest.d.ts +48 -0
- package/dist/node/src/services/skill-manifest.d.ts.map +1 -0
- package/dist/node/src/services/skill-recommender.d.ts +51 -0
- package/dist/node/src/services/skill-recommender.d.ts.map +1 -0
- package/dist/node/src/services/spawn-trajectory.d.ts +23 -0
- package/dist/node/src/services/spawn-trajectory.d.ts.map +1 -0
- package/dist/node/src/services/stall-classifier.d.ts +69 -0
- package/dist/node/src/services/stall-classifier.d.ts.map +1 -0
- package/dist/node/src/services/structured-proof-bridge.d.ts +99 -0
- package/dist/node/src/services/structured-proof-bridge.d.ts.map +1 -0
- package/dist/node/src/services/sub-agent-router.d.ts +38 -0
- package/dist/node/src/services/sub-agent-router.d.ts.map +1 -0
- package/dist/node/src/services/swarm-coordinator-prompts.d.ts +93 -0
- package/dist/node/src/services/swarm-coordinator-prompts.d.ts.map +1 -0
- package/dist/node/src/services/swarm-coordinator.d.ts +473 -0
- package/dist/node/src/services/swarm-coordinator.d.ts.map +1 -0
- package/dist/node/src/services/swarm-decision-loop.d.ts +69 -0
- package/dist/node/src/services/swarm-decision-loop.d.ts.map +1 -0
- package/dist/node/src/services/swarm-event-triage.d.ts +49 -0
- package/dist/node/src/services/swarm-event-triage.d.ts.map +1 -0
- package/dist/node/src/services/swarm-history.d.ts +27 -0
- package/dist/node/src/services/swarm-history.d.ts.map +1 -0
- package/dist/node/src/services/swarm-idle-watchdog.d.ts +22 -0
- package/dist/node/src/services/swarm-idle-watchdog.d.ts.map +1 -0
- package/dist/node/src/services/task-acceptance.d.ts +8 -0
- package/dist/node/src/services/task-acceptance.d.ts.map +1 -0
- package/dist/node/src/services/task-agent-auth.d.ts +69 -0
- package/dist/node/src/services/task-agent-auth.d.ts.map +1 -0
- package/dist/node/src/services/task-agent-frameworks.d.ts +90 -0
- package/dist/node/src/services/task-agent-frameworks.d.ts.map +1 -0
- package/dist/node/src/services/task-kind.d.ts +3 -0
- package/dist/node/src/services/task-kind.d.ts.map +1 -0
- package/dist/node/src/services/task-policy.d.ts +17 -0
- package/dist/node/src/services/task-policy.d.ts.map +1 -0
- package/dist/node/src/services/task-registry.d.ts +550 -0
- package/dist/node/src/services/task-registry.d.ts.map +1 -0
- package/dist/node/src/services/task-share.d.ts +18 -0
- package/dist/node/src/services/task-share.d.ts.map +1 -0
- package/dist/node/src/services/task-validation.d.ts +69 -0
- package/dist/node/src/services/task-validation.d.ts.map +1 -0
- package/dist/node/src/services/task-verifier-runner.d.ts +5 -0
- package/dist/node/src/services/task-verifier-runner.d.ts.map +1 -0
- package/dist/node/src/services/trajectory-context.d.ts +73 -0
- package/dist/node/src/services/trajectory-context.d.ts.map +1 -0
- package/dist/node/src/services/trajectory-feedback.d.ts +53 -0
- package/dist/node/src/services/trajectory-feedback.d.ts.map +1 -0
- package/dist/node/src/services/types.d.ts +152 -0
- package/dist/node/src/services/types.d.ts.map +1 -0
- package/dist/node/src/services/workspace-git-ops.d.ts +28 -0
- package/dist/node/src/services/workspace-git-ops.d.ts.map +1 -0
- package/dist/node/src/services/workspace-github.d.ts +60 -0
- package/dist/node/src/services/workspace-github.d.ts.map +1 -0
- package/dist/node/src/services/workspace-lifecycle.d.ts +18 -0
- package/dist/node/src/services/workspace-lifecycle.d.ts.map +1 -0
- package/dist/node/src/services/workspace-service.d.ts +122 -0
- package/dist/node/src/services/workspace-service.d.ts.map +1 -0
- package/dist/node/src/services/workspace-types.d.ts +81 -0
- package/dist/node/src/services/workspace-types.d.ts.map +1 -0
- package/dist/node/src/setup-routes.d.ts +9 -0
- package/dist/node/src/setup-routes.d.ts.map +1 -0
- package/dist/node/vitest.config.d.ts +3 -0
- package/dist/node/vitest.config.d.ts.map +1 -0
- package/docs/default-eliza-skills-and-agent-bridge-plan.md +231 -0
- package/docs/sub-agent-routing.md +197 -0
- package/package.json +113 -37
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -21120
- package/dist/index.js.map +0 -109
- package/dist/src/actions/messaging.d.ts +0 -24
- package/dist/src/actions/messaging.d.ts.map +0 -1
- package/dist/src/actions/peek-subagent.d.ts +0 -3
- package/dist/src/actions/peek-subagent.d.ts.map +0 -1
- package/dist/src/actions/subagent-management.d.ts +0 -7
- package/dist/src/actions/subagent-management.d.ts.map +0 -1
- package/dist/src/actions/task-management.d.ts +0 -9
- package/dist/src/actions/task-management.d.ts.map +0 -1
- package/dist/src/config.d.ts +0 -4
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/providers/orchestrator-config.d.ts +0 -80
- package/dist/src/providers/orchestrator-config.d.ts.map +0 -1
- package/dist/src/providers/task-context.d.ts +0 -3
- package/dist/src/providers/task-context.d.ts.map +0 -1
- package/dist/src/services/agent-orchestrator-service.d.ts +0 -59
- package/dist/src/services/agent-orchestrator-service.d.ts.map +0 -1
- package/dist/src/services/messaging-service.d.ts +0 -111
- package/dist/src/services/messaging-service.d.ts.map +0 -1
- package/dist/src/services/sandbox-service.d.ts +0 -103
- package/dist/src/services/sandbox-service.d.ts.map +0 -1
- package/dist/src/services/subagent-service.d.ts +0 -140
- package/dist/src/services/subagent-service.d.ts.map +0 -1
- package/dist/src/sub-agents/adapter.d.ts +0 -13
- package/dist/src/sub-agents/adapter.d.ts.map +0 -1
- package/dist/src/sub-agents/claude-agent-sdk-sub-agent.d.ts +0 -18
- package/dist/src/sub-agents/claude-agent-sdk-sub-agent.d.ts.map +0 -1
- package/dist/src/sub-agents/codex-sdk-sub-agent.d.ts +0 -18
- package/dist/src/sub-agents/codex-sdk-sub-agent.d.ts.map +0 -1
- package/dist/src/sub-agents/eliza-sub-agent.d.ts +0 -27
- package/dist/src/sub-agents/eliza-sub-agent.d.ts.map +0 -1
- package/dist/src/sub-agents/elizaos-native-sub-agent.d.ts +0 -61
- package/dist/src/sub-agents/elizaos-native-sub-agent.d.ts.map +0 -1
- package/dist/src/sub-agents/index.d.ts +0 -10
- package/dist/src/sub-agents/index.d.ts.map +0 -1
- package/dist/src/sub-agents/opencode-sub-agent.d.ts +0 -44
- package/dist/src/sub-agents/opencode-sub-agent.d.ts.map +0 -1
- package/dist/src/sub-agents/registry.d.ts +0 -3
- package/dist/src/sub-agents/registry.d.ts.map +0 -1
- package/dist/src/sub-agents/sweagent-sub-agent.d.ts +0 -19
- package/dist/src/sub-agents/sweagent-sub-agent.d.ts.map +0 -1
- package/dist/src/sub-agents/tools.d.ts +0 -15
- package/dist/src/sub-agents/tools.d.ts.map +0 -1
- package/dist/src/sub-agents/types.d.ts +0 -170
- package/dist/src/sub-agents/types.d.ts.map +0 -1
- package/dist/src/types/index.d.ts +0 -12
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/messaging.d.ts +0 -202
- package/dist/src/types/messaging.d.ts.map +0 -1
- package/dist/src/types/sandbox.d.ts +0 -228
- package/dist/src/types/sandbox.d.ts.map +0 -1
- package/dist/src/types/subagent.d.ts +0 -232
- package/dist/src/types/subagent.d.ts.map +0 -1
- package/dist/src/types.d.ts +0 -138
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts +0 -7
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/session.d.ts +0 -184
- package/dist/src/utils/session.d.ts.map +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the Coding Workspace Service.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from workspace-service.ts to reduce module size.
|
|
5
|
+
*
|
|
6
|
+
* @module services/workspace-types
|
|
7
|
+
*/
|
|
8
|
+
import type { WorkspaceStatus } from "git-workspace-service";
|
|
9
|
+
export interface CodingWorkspaceConfig {
|
|
10
|
+
/** Base directory for workspaces (default: ~/.eliza/workspaces) */
|
|
11
|
+
baseDir?: string;
|
|
12
|
+
/** Branch prefix (default: "eliza") */
|
|
13
|
+
branchPrefix?: string;
|
|
14
|
+
/** Enable debug logging */
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
/** Max age for orphaned workspace directories in ms (default: 24 hours). Set to 0 to disable GC. */
|
|
17
|
+
workspaceTtlMs?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ProvisionWorkspaceOptions {
|
|
20
|
+
/** Git repository URL */
|
|
21
|
+
repo: string;
|
|
22
|
+
/** Base branch to create from (default: "main") */
|
|
23
|
+
baseBranch?: string;
|
|
24
|
+
/** Exact branch name to use (overrides auto-generated name) */
|
|
25
|
+
branchName?: string;
|
|
26
|
+
/** Use worktree instead of clone */
|
|
27
|
+
useWorktree?: boolean;
|
|
28
|
+
/** Parent workspace ID for worktree */
|
|
29
|
+
parentWorkspaceId?: string;
|
|
30
|
+
/** Execution context */
|
|
31
|
+
execution?: {
|
|
32
|
+
id: string;
|
|
33
|
+
patternName: string;
|
|
34
|
+
};
|
|
35
|
+
/** Task context */
|
|
36
|
+
task?: {
|
|
37
|
+
id: string;
|
|
38
|
+
role: string;
|
|
39
|
+
slug?: string;
|
|
40
|
+
};
|
|
41
|
+
/** User-provided credentials */
|
|
42
|
+
userCredentials?: {
|
|
43
|
+
type: "pat" | "oauth" | "ssh";
|
|
44
|
+
token?: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export interface WorkspaceResult {
|
|
48
|
+
id: string;
|
|
49
|
+
path: string;
|
|
50
|
+
branch: string;
|
|
51
|
+
baseBranch: string;
|
|
52
|
+
isWorktree: boolean;
|
|
53
|
+
repo: string;
|
|
54
|
+
status: WorkspaceStatus;
|
|
55
|
+
/** Semantic label for referencing this workspace (e.g. "auth-bugfix", "api-tests") */
|
|
56
|
+
label?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface CommitOptions {
|
|
59
|
+
message: string;
|
|
60
|
+
all?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface PushOptions {
|
|
63
|
+
setUpstream?: boolean;
|
|
64
|
+
force?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface PROptions {
|
|
67
|
+
title: string;
|
|
68
|
+
body: string;
|
|
69
|
+
base?: string;
|
|
70
|
+
draft?: boolean;
|
|
71
|
+
labels?: string[];
|
|
72
|
+
reviewers?: string[];
|
|
73
|
+
}
|
|
74
|
+
export interface WorkspaceStatusResult {
|
|
75
|
+
branch: string;
|
|
76
|
+
clean: boolean;
|
|
77
|
+
modified: string[];
|
|
78
|
+
staged: string[];
|
|
79
|
+
untracked: string[];
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=workspace-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-types.d.ts","sourceRoot":"","sources":["../../../../src/services/workspace-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,WAAW,qBAAqB;IACpC,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oGAAoG;IACpG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,yBAAyB;IACxC,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uCAAuC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wBAAwB;IACxB,SAAS,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,mBAAmB;IACnB,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,gCAAgC;IAChC,eAAe,CAAC,EAAE;QAAE,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrE;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coding-agent orchestrator HTTP routes — Plugin route registration.
|
|
3
|
+
*
|
|
4
|
+
* Mounts `/api/coding-agents/*`, `/api/workspace/*`, and `/api/issues/*`
|
|
5
|
+
* through `Plugin.routes` with `rawPath: true`.
|
|
6
|
+
*/
|
|
7
|
+
import type { Plugin } from "@elizaos/core";
|
|
8
|
+
export declare const codingAgentRoutePlugin: Plugin;
|
|
9
|
+
//# sourceMappingURL=setup-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-routes.d.ts","sourceRoot":"","sources":["../../../src/setup-routes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAiB,MAAM,EAAS,MAAM,eAAe,CAAC;AAuIlE,eAAO,MAAM,sBAAsB,EAAE,MAMpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../../vitest.config.ts"],"names":[],"mappings":";AAEA,wBAQG"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Default Eliza Skills And Agent Bridge Plan
|
|
2
|
+
|
|
3
|
+
Date: 2026-05-10
|
|
4
|
+
|
|
5
|
+
## Goal
|
|
6
|
+
|
|
7
|
+
Make Eliza's default task workers self-sufficient:
|
|
8
|
+
|
|
9
|
+
- They should receive editable, repo-owned default skills for Eliza, elizaOS plugin/app development, Eliza Cloud APIs, and monetization.
|
|
10
|
+
- Claude, Codex, OpenCode, Gemini, Aider, and other orchestrated workers should receive those defaults through the agent orchestrator.
|
|
11
|
+
- Applications should be able to override defaults without forking the shipped skill package.
|
|
12
|
+
- Workers should be able to ask the running parent Eliza agent for context or actions that only the parent can perform.
|
|
13
|
+
- Paid, private, or destructive operations should remain mediated by the parent agent and its confirmation flow.
|
|
14
|
+
|
|
15
|
+
## Current Inventory
|
|
16
|
+
|
|
17
|
+
### Shipped skills
|
|
18
|
+
|
|
19
|
+
Repo-owned default skills live under:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
packages/skills/skills/<slug>/SKILL.md
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The `@elizaos/skills` package publishes those files. Runtime startup wires bundled, workspace, and extra skill roots through `packages/agent/src/runtime/eliza.ts`. Managed/workspace copies override bundled defaults.
|
|
26
|
+
|
|
27
|
+
Relevant shipped skills now include:
|
|
28
|
+
|
|
29
|
+
- `eliza` for the running Eliza app, parent-agent callback protocol, capabilities, and lifecycle.
|
|
30
|
+
- `elizaos` for upstream runtime/plugin abstractions.
|
|
31
|
+
- `eliza-app-development` for this app repo's build and edit workflow.
|
|
32
|
+
- `eliza-cloud` for Cloud APIs, apps, credits, billing, containers, domains, auth, and earnings.
|
|
33
|
+
- `build-monetized-app` for the new-app deploy and monetization loop.
|
|
34
|
+
- `task-agent-eliza-bridge` for low-level task-agent bridge details.
|
|
35
|
+
|
|
36
|
+
### Agent orchestration
|
|
37
|
+
|
|
38
|
+
The task agent infrastructure is in `plugins/plugin-agent-orchestrator`.
|
|
39
|
+
|
|
40
|
+
Important surfaces:
|
|
41
|
+
|
|
42
|
+
- `src/services/pty-service.ts` spawns agents, writes adapter memory files, injects parent runtime loopback context, and manages session lifecycle.
|
|
43
|
+
- `src/actions/coding-task-handlers.ts` prepares `SKILLS.md`, recommends skills, spawns task sessions, and registers per-session skill allow-lists.
|
|
44
|
+
- `src/services/skill-manifest.ts` renders the task-local manifest and virtual broker skills.
|
|
45
|
+
- `src/services/skill-callback-bridge.ts` listens for child output lines matching `USE_SKILL <slug> <json_args>` and routes them back to the parent runtime.
|
|
46
|
+
- `src/services/skill-lifeops-context-broker.ts` already exposes task-scoped LifeOps context.
|
|
47
|
+
|
|
48
|
+
### Cloud and monetization
|
|
49
|
+
|
|
50
|
+
Current Cloud source-of-truth files:
|
|
51
|
+
|
|
52
|
+
- OpenAPI: `cloud/apps/api/openapi.json/route.ts`
|
|
53
|
+
- SDK: `cloud/packages/sdk/src/client.ts`
|
|
54
|
+
- billing/pricing: `cloud/packages/lib/services/ai-billing.ts`, `ai-pricing.ts`, `credits.ts`
|
|
55
|
+
- app chat: `cloud/apps/api/v1/apps/[id]/chat/route.ts`
|
|
56
|
+
- OpenAI-compatible chat: `cloud/apps/api/v1/chat/completions/route.ts`
|
|
57
|
+
- app monetization: `cloud/apps/api/v1/apps/[id]/monetization/route.ts`
|
|
58
|
+
- app credits: `cloud/packages/lib/services/app-credits.ts`
|
|
59
|
+
- container billing: `cloud/apps/api/cron/container-billing/route.ts`
|
|
60
|
+
|
|
61
|
+
Active app monetization is markup/share based. Inference in the current app-chat path debits the caller/user org credits and credits creator markup to redeemable earnings. App-credit purchase/share flows exist, but should not be assumed to fund inference unless the endpoint being edited explicitly does so.
|
|
62
|
+
|
|
63
|
+
## Implemented Architecture
|
|
64
|
+
|
|
65
|
+
### Default editable skills
|
|
66
|
+
|
|
67
|
+
Default skills remain bundled in `@elizaos/skills` and are seeded into the managed skills directory only when the user does not already have an editable copy.
|
|
68
|
+
|
|
69
|
+
Applications and workspaces can override defaults by placing a same-slug skill in a higher-priority skill root. This preserves:
|
|
70
|
+
|
|
71
|
+
- global defaults included with Eliza
|
|
72
|
+
- user/application customization
|
|
73
|
+
- stable slugs for orchestrator recommendation and invocation
|
|
74
|
+
- short `SKILL.md` bodies with longer references under `references/`
|
|
75
|
+
|
|
76
|
+
The root `scripts/ensure-skills.mjs` now resolves the shipped skill tree from `@elizaos/skills`, then falls back to `packages/skills/skills`, then legacy `skills/`.
|
|
77
|
+
|
|
78
|
+
### Parent-agent broker
|
|
79
|
+
|
|
80
|
+
A new virtual broker skill, `parent-agent`, lets a child ask the running parent Eliza agent to use its loaded capabilities:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
USE_SKILL parent-agent {"request":"Find the next open 30 minute slot on my calendar tomorrow afternoon"}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The broker builds a synthetic message memory and sends it through the parent's normal `messageService.handleMessage(...)` pipeline with `continueAfterActions: true`. This means the parent can use the same actions, providers, services, connectors, model handlers, confirmation policies, and user approval flow it already uses for normal chat.
|
|
87
|
+
|
|
88
|
+
It also supports action discovery:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
USE_SKILL parent-agent {"mode":"list-actions","query":"github","limit":25}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Sensitive broker access is session allow-listed. The orchestrator includes `parent-agent` in generated manifests for coding-task sessions and registers the manifest slugs as the session allow-list.
|
|
95
|
+
|
|
96
|
+
### Worker manifest
|
|
97
|
+
|
|
98
|
+
`SKILLS.md` now tells workers to emit a standalone `USE_SKILL <slug> <json_args>` line. The orchestrator writes this manifest into the workspace and sets `ELIZA_SKILLS_MANIFEST`, so Codex/Claude/Gemini/Aider-style workers can discover skill protocol without hardcoding.
|
|
99
|
+
|
|
100
|
+
The injected parent runtime memory also now explains:
|
|
101
|
+
|
|
102
|
+
- read-only loopback endpoints
|
|
103
|
+
- `ELIZA_SKILLS_MANIFEST` / `SKILLS.md`
|
|
104
|
+
- `USE_SKILL parent-agent`
|
|
105
|
+
- `USE_SKILL lifeops-context`
|
|
106
|
+
- when to ask the parent for connector/private/paid actions
|
|
107
|
+
|
|
108
|
+
### Git hygiene
|
|
109
|
+
|
|
110
|
+
The orchestrator-managed gitignore block now includes common generated agent files:
|
|
111
|
+
|
|
112
|
+
- `CLAUDE.md`
|
|
113
|
+
- `.claude/`
|
|
114
|
+
- `AGENTS.md`
|
|
115
|
+
- `.codex/`
|
|
116
|
+
- `GEMINI.md`
|
|
117
|
+
- `.gemini/`
|
|
118
|
+
- `.aider*`
|
|
119
|
+
- `.opencode/`
|
|
120
|
+
- `SKILLS.md`
|
|
121
|
+
|
|
122
|
+
Tracked repo files with the same names still need care; ignore rules only prevent new untracked files from being committed.
|
|
123
|
+
|
|
124
|
+
## Security Model
|
|
125
|
+
|
|
126
|
+
The child worker never receives the parent API key, full memory dump, or raw connector credentials.
|
|
127
|
+
|
|
128
|
+
Allowed paths:
|
|
129
|
+
|
|
130
|
+
- read-only loopback endpoints for bounded parent context
|
|
131
|
+
- `USE_SKILL` directives for session allow-listed skill/broker slugs
|
|
132
|
+
- parent-agent requests mediated by the parent message pipeline
|
|
133
|
+
- parent confirmation flow for paid, destructive, private, or external operations
|
|
134
|
+
|
|
135
|
+
Denied or discouraged paths:
|
|
136
|
+
|
|
137
|
+
- ad hoc POSTs to loopback context endpoints
|
|
138
|
+
- bypassing Cloud/user confirmation for paid steps
|
|
139
|
+
- directly recreating parent credentials inside a child workspace
|
|
140
|
+
- treating task-agent output as a persistent authenticated identity
|
|
141
|
+
|
|
142
|
+
## Five-Pass Implementation Plan
|
|
143
|
+
|
|
144
|
+
### Pass 1: Prep
|
|
145
|
+
|
|
146
|
+
- Inventory shipped skills and confirm `@elizaos/skills` is the bundled default source.
|
|
147
|
+
- Inventory orchestrator spawn/memory/manifest/callback code.
|
|
148
|
+
- Inventory Cloud billing, monetization, app chat, SDK, and container deploy source-of-truth files.
|
|
149
|
+
- Decide stable slugs and default override model.
|
|
150
|
+
- Define task-scoped broker protocol and sensitive-broker allow-list behavior.
|
|
151
|
+
|
|
152
|
+
Status: implemented for the default skill and broker surfaces.
|
|
153
|
+
|
|
154
|
+
### Pass 2: Implementation
|
|
155
|
+
|
|
156
|
+
- Add `eliza` default skill and references.
|
|
157
|
+
- Expand app-development, Cloud, monetization, and task-agent bridge skills.
|
|
158
|
+
- Fix root shipped-skill seeding to resolve `@elizaos/skills`.
|
|
159
|
+
- Add `parent-agent` virtual broker.
|
|
160
|
+
- Include `parent-agent` in `SKILLS.md` and the session allow-list.
|
|
161
|
+
- Update worker memory injection and manifest protocol text.
|
|
162
|
+
- Add generated agent files to orchestrator gitignore.
|
|
163
|
+
|
|
164
|
+
Status: implemented.
|
|
165
|
+
|
|
166
|
+
### Pass 3: Cleanup
|
|
167
|
+
|
|
168
|
+
- Keep skill prose short and push details into references.
|
|
169
|
+
- Remove stale "read-only only / no action delegation" wording from task-agent bridge docs.
|
|
170
|
+
- Correct monetization docs where they implied app-specific inference balances in the active route.
|
|
171
|
+
- Align Cloud skill references to current implementation files.
|
|
172
|
+
|
|
173
|
+
Status: implemented.
|
|
174
|
+
|
|
175
|
+
### Pass 4: Review And Fixing
|
|
176
|
+
|
|
177
|
+
Review focus:
|
|
178
|
+
|
|
179
|
+
- Type correctness around synthetic `Memory` construction and `messageService.handleMessage`.
|
|
180
|
+
- Session allow-list behavior for virtual brokers.
|
|
181
|
+
- Whether all spawned adapter types can see `SKILLS.md` and parent memory text.
|
|
182
|
+
- Whether tracked `AGENTS.md` repos need a safer memory-file strategy than writing in the workspace root.
|
|
183
|
+
- Whether OpenCode should become a first-class adapter type instead of shell-compatible spawn.
|
|
184
|
+
|
|
185
|
+
Status: partially implemented. The first three are covered by code/tests; the last two remain follow-up design items.
|
|
186
|
+
|
|
187
|
+
### Pass 5: Testing, Verification, Validation
|
|
188
|
+
|
|
189
|
+
Minimum local tests:
|
|
190
|
+
|
|
191
|
+
- unit test `parent-agent` broker list-actions, missing request, and message pipeline callback capture
|
|
192
|
+
- unit test `USE_SKILL` directive parsing and sensitive broker routing if practical
|
|
193
|
+
- typecheck `plugin-agent-orchestrator`
|
|
194
|
+
- test `packages/skills` loader/frontmatter paths
|
|
195
|
+
- run `scripts/ensure-skills.mjs` against a temporary `ELIZA_STATE_DIR`
|
|
196
|
+
|
|
197
|
+
Live validation:
|
|
198
|
+
|
|
199
|
+
- Start a parent Eliza runtime with agent skills and orchestrator loaded.
|
|
200
|
+
- Spawn Codex and Claude workers and verify they read `SKILLS.md`.
|
|
201
|
+
- Spawn OpenCode using Eliza Cloud with Cerebras OpenAI `gpt-oss-120b` and verify it can emit `USE_SKILL parent-agent ...`.
|
|
202
|
+
- Simulate:
|
|
203
|
+
- action listing
|
|
204
|
+
- parent memory search
|
|
205
|
+
- calendar/GitHub/browser-style parent request
|
|
206
|
+
- confirmation-required paid Cloud/domain request
|
|
207
|
+
- denied broker when not allow-listed
|
|
208
|
+
- task continuation after a returned parent result
|
|
209
|
+
- Run existing SWE/orchestrator benchmarks with and without the broker skill hint.
|
|
210
|
+
|
|
211
|
+
Status: local unit/type/skills tests are implemented and passing. Live OpenCode/Cerebras/SWE benchmarking requires running services and credentials, so it remains follow-up unless the environment already has them active.
|
|
212
|
+
|
|
213
|
+
## Remaining Gaps
|
|
214
|
+
|
|
215
|
+
- OpenCode is currently treated through shell-compatible spawn paths in parts of the orchestrator. It should become a first-class memory/config adapter if the project wants equivalent behavior to Claude/Codex/Gemini.
|
|
216
|
+
- `PARALLAX_DEFAULT_AGENT_TYPE` fixed-default parsing still only accepts `claude`, `gemini`, `codex`, and `aider`. Routing can rank OpenCode, but fixed default should be extended after type/API review.
|
|
217
|
+
- Writing adapter memory files named `AGENTS.md` can collide with repos that already track `AGENTS.md`. A safer strategy is needed for Codex memory injection in tracked-repo workspaces.
|
|
218
|
+
- Live agent benchmarking against OpenCode + Eliza Cloud + Cerebras requires credentials and running infrastructure.
|
|
219
|
+
- The parent-agent broker currently asks through the normal parent message pipeline. Direct action invocation APIs could be added later, but the message path is more flexible and preserves confirmation behavior.
|
|
220
|
+
|
|
221
|
+
## AGI-Level Direction
|
|
222
|
+
|
|
223
|
+
The long-term target is not a hardcoded "agent helper" action. It is a capability broker:
|
|
224
|
+
|
|
225
|
+
- the parent runtime exposes a typed capability graph derived from loaded plugins, actions, providers, services, connectors, and policies
|
|
226
|
+
- workers receive task-scoped manifests and can request capabilities without knowing implementation details
|
|
227
|
+
- the parent decides whether to answer, execute, request confirmation, redact, or deny
|
|
228
|
+
- applications override skills and policies by configuration rather than editing orchestrator code
|
|
229
|
+
- benchmarks measure whether workers solve more repo tasks with fewer human interventions and fewer credential leaks
|
|
230
|
+
|
|
231
|
+
The current implementation establishes the default skill surface and the child-to-parent request path needed for that architecture.
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Sub-agent routing
|
|
2
|
+
|
|
3
|
+
> Canonical orchestration path for ACPX sub-agents. ACP-spawned sessions
|
|
4
|
+
> route through `AcpService` and `SubAgentRouter`; PTY-spawned sessions keep
|
|
5
|
+
> using the coordinator modules that ship in this package.
|
|
6
|
+
|
|
7
|
+
## Goals
|
|
8
|
+
|
|
9
|
+
1. **Origin tracking.** When the main agent spawns a sub-agent in response to
|
|
10
|
+
a user message in room R, the sub-agent's terminal output (`task_complete`,
|
|
11
|
+
`error`, `blocked`) lands back in room R, addressed appropriately.
|
|
12
|
+
2. **Main-agent-in-the-loop.** When a sub-agent reports done, the **main
|
|
13
|
+
agent** — not a separate coordinator — decides whether to:
|
|
14
|
+
- reply to the user (sub-agent finished, here's the result),
|
|
15
|
+
- reply to the sub-agent via `SEND_TO_AGENT` (proof not satisfying; keep
|
|
16
|
+
going),
|
|
17
|
+
- or both in one turn.
|
|
18
|
+
3. **Cache friendliness.** Sub-agent updates should not invalidate the
|
|
19
|
+
stable provider/system prefix on every event.
|
|
20
|
+
|
|
21
|
+
## Components
|
|
22
|
+
|
|
23
|
+
### `AcpService` (existing)
|
|
24
|
+
|
|
25
|
+
Spawn surface. TASKS op=create records origin context in
|
|
26
|
+
`session.metadata` at spawn time:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
{
|
|
30
|
+
messageId: message.id, // parent message UUID
|
|
31
|
+
roomId: message.roomId,
|
|
32
|
+
worldId: message.worldId,
|
|
33
|
+
userId: message.entityId,
|
|
34
|
+
label,
|
|
35
|
+
source: content.source,
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### `SubAgentRouter` (new — `services/sub-agent-router.ts`)
|
|
40
|
+
|
|
41
|
+
Subscribes to `AcpService.onSessionEvent`. On `task_complete`, `error`, or
|
|
42
|
+
`blocked` (boundary events only — not streaming chunks), it:
|
|
43
|
+
|
|
44
|
+
1. Reads `session.metadata` for origin keys.
|
|
45
|
+
2. Constructs a synthetic `Memory` with:
|
|
46
|
+
- `entityId` = a deterministic per-session sub-agent UUID derived locally
|
|
47
|
+
via SHA1 of `<runtime.agentId>:acpx:sub-agent:<sessionId>` (no runtime
|
|
48
|
+
dependency on `@elizaos/core`'s `createUniqueUuid` so the router stays
|
|
49
|
+
type-only on core),
|
|
50
|
+
- `agentId` = `runtime.agentId`,
|
|
51
|
+
- `roomId` = origin `roomId`,
|
|
52
|
+
- `content.source` = `"sub_agent"`,
|
|
53
|
+
- `content.inReplyTo` = origin `messageId`,
|
|
54
|
+
- `content.metadata.subAgent*` carries the structured event
|
|
55
|
+
(`subAgentSessionId`, `subAgentLabel`, `subAgentEvent`,
|
|
56
|
+
`subAgentStatus`, `subAgentAgentType`, `subAgentRoundTrip`,
|
|
57
|
+
`subAgentRoundTripCap`, `subAgentCapExceeded`, `originUserId`,
|
|
58
|
+
`originMessageId`, `originSource`).
|
|
59
|
+
3. Persists the memory via `runtime.createMemory(..., "messages")`.
|
|
60
|
+
4. Delivers via `runtime.messageService.handleMessage(runtime, memory)`.
|
|
61
|
+
|
|
62
|
+
The runtime's connector hooks (`outgoing_before_deliver`) handle delivery to
|
|
63
|
+
Telegram/Discord/UI — same path a real user message would follow. There is
|
|
64
|
+
no callback held by the router.
|
|
65
|
+
|
|
66
|
+
#### Why only boundary events
|
|
67
|
+
|
|
68
|
+
Streaming events (`agent_message_chunk`, `tool_running`, `ready`) would
|
|
69
|
+
re-fire the planner constantly and burn the prompt cache. Live status is
|
|
70
|
+
exposed via the provider instead. The router is the channel for events
|
|
71
|
+
that warrant an action decision.
|
|
72
|
+
|
|
73
|
+
#### Dedup / idempotency
|
|
74
|
+
|
|
75
|
+
Events are deduped in-memory by
|
|
76
|
+
`<sessionId>|<event>|<status>|<short hash of payload>`. Same sub-agent
|
|
77
|
+
re-emitting the same `task_complete` payload posts once. A different
|
|
78
|
+
response payload posts again — that's "the sub-agent did more work and
|
|
79
|
+
reported a new state".
|
|
80
|
+
|
|
81
|
+
#### Disable switch
|
|
82
|
+
|
|
83
|
+
`ACPX_SUB_AGENT_ROUTER_DISABLED=1` keeps the service registered but unbound
|
|
84
|
+
(useful for tests, headless backfills, or staging where you want spawning
|
|
85
|
+
without runtime injection).
|
|
86
|
+
|
|
87
|
+
#### Round-trip cap
|
|
88
|
+
|
|
89
|
+
To prevent ping-pong loops where the main agent and a sub-agent endlessly
|
|
90
|
+
ask each other to keep going, the router tracks per-session inject count.
|
|
91
|
+
When the count exceeds `ACPX_SUB_AGENT_ROUND_TRIP_CAP` (default 32) the
|
|
92
|
+
router force-stops the session and emits a single
|
|
93
|
+
`round_trip_cap_exceeded` memory carrying `subAgentRoundTrip`,
|
|
94
|
+
`subAgentRoundTripCap`, and `subAgentCapExceeded: true`. Subsequent events
|
|
95
|
+
from the same capped session are suppressed.
|
|
96
|
+
|
|
97
|
+
Set `ACPX_SUB_AGENT_ROUND_TRIP_CAP=N` in the runtime config to override.
|
|
98
|
+
The default of 32 is generous; a typical sub-agent task hits 1–5
|
|
99
|
+
round-trips before terminal completion.
|
|
100
|
+
|
|
101
|
+
### `activeSubAgentsProvider` (new — `providers/active-sub-agents.ts`)
|
|
102
|
+
|
|
103
|
+
Cache-friendly view of live sub-agent sessions. Filters to:
|
|
104
|
+
|
|
105
|
+
- sessions whose `metadata.roomId` is set (i.e. routed by `createTaskAction`),
|
|
106
|
+
- sessions not in a terminal status (`stopped`, `completed`, `error`,
|
|
107
|
+
`errored`, `cancelled`).
|
|
108
|
+
|
|
109
|
+
The text is **structural only** — id, label, agentType, bucketed status,
|
|
110
|
+
last two workdir segments. No timestamps, no message excerpts. Sorted by
|
|
111
|
+
`sessionId` so the rendered text is byte-stable across turns when the
|
|
112
|
+
active set is unchanged.
|
|
113
|
+
|
|
114
|
+
Status bucketing: `ready`, `running`, `busy`, `tool_running`, and
|
|
115
|
+
`authenticating` all collapse to the literal string `"active"` in the
|
|
116
|
+
provider text. `blocked` is preserved as a distinct value (the planner
|
|
117
|
+
needs to know a session is waiting for input). Terminal statuses
|
|
118
|
+
(`stopped`, `completed`, `error`, `errored`, `cancelled`) cause the
|
|
119
|
+
session to be filtered out entirely. This keeps the cached provider
|
|
120
|
+
segment byte-identical across transient status flips like
|
|
121
|
+
`ready → tool_running → ready`, which would otherwise invalidate the
|
|
122
|
+
prefix cache on every tool call.
|
|
123
|
+
|
|
124
|
+
This is the live status channel. The synthetic Memory posted by the router
|
|
125
|
+
is the per-event channel.
|
|
126
|
+
|
|
127
|
+
### Action set
|
|
128
|
+
|
|
129
|
+
The main agent's planner sees:
|
|
130
|
+
|
|
131
|
+
- **`REPLY`** (from the bootstrap action set) — replies to the user in
|
|
132
|
+
current room.
|
|
133
|
+
- **`SEND_TO_AGENT { sessionId, text }`** — pushes a follow-up to a
|
|
134
|
+
live sub-agent. Use when the sub-agent's proof is unsatisfying or it
|
|
135
|
+
asked a clarifying question.
|
|
136
|
+
- **`STOP_AGENT { sessionId }`** — terminates. Use when the sub-agent's
|
|
137
|
+
output is clearly final and you don't want it idling.
|
|
138
|
+
- **`ACPX_CREATE_TASK`** — spawn additional sub-agents.
|
|
139
|
+
|
|
140
|
+
Multi-action plans (e.g. `[REPLY, SEND_TO_AGENT]`) are supported by the
|
|
141
|
+
planner and execute sequentially in one turn.
|
|
142
|
+
|
|
143
|
+
## Cache discipline
|
|
144
|
+
|
|
145
|
+
Anthropic prompt caching breaks at segment boundaries (see
|
|
146
|
+
`plugin-anthropic/models/text.ts`). The plugin marks providers and action
|
|
147
|
+
examples as `stable: true`. Sub-agent flow is designed around this:
|
|
148
|
+
|
|
149
|
+
- **Stable prefix (cached):** system prompt, character bio, action examples,
|
|
150
|
+
active-sub-agents provider text (structural only, sorted, deterministic).
|
|
151
|
+
- **Volatile suffix (re-tokenized):** the sub-agent's synthetic message
|
|
152
|
+
text (the per-event narration).
|
|
153
|
+
|
|
154
|
+
Each new sub-agent event invalidates only the message tail. The provider
|
|
155
|
+
text changes only when a session enters or leaves the active set, not on
|
|
156
|
+
every chunk.
|
|
157
|
+
|
|
158
|
+
A per-session router invocation is one cache-miss tail; everything before
|
|
159
|
+
the most recent turn stays warm.
|
|
160
|
+
|
|
161
|
+
## Loop safety
|
|
162
|
+
|
|
163
|
+
- The router emits **inbound** memories with `entityId` set to the
|
|
164
|
+
sub-agent's pseudo-UUID (not `runtime.agentId`), so the runtime processes
|
|
165
|
+
them as messages from another entity, not as the agent's own outputs.
|
|
166
|
+
- The main agent's reply via `SEND_TO_AGENT` does not directly trigger a
|
|
167
|
+
new `task_complete`. The sub-agent has to actually do work first, which
|
|
168
|
+
bounds re-entry.
|
|
169
|
+
- Dedup prevents accidental double-injection from event re-emission.
|
|
170
|
+
- The round-trip cap (above) is the hard ceiling for ping-pong loops.
|
|
171
|
+
|
|
172
|
+
## Coordinator Boundary
|
|
173
|
+
|
|
174
|
+
`plugin-agent-orchestrator`'s `swarm-coordinator.ts` and
|
|
175
|
+
`swarm-decision-loop.ts` are bound to `PTYService` only. Sessions spawned
|
|
176
|
+
through `AcpService` bypass them entirely.
|
|
177
|
+
|
|
178
|
+
The swarm coordinator's autonomous decision logic
|
|
179
|
+
(`makeCoordinationDecision`, `buildTurnCompletePrompt`,
|
|
180
|
+
`buildBlockedEventMessage`) is replaced by the main agent's normal action
|
|
181
|
+
selection over the synthetic Memory.
|
|
182
|
+
|
|
183
|
+
## Testing
|
|
184
|
+
|
|
185
|
+
- `__tests__/unit/sub-agent-router.test.ts` — origin tracking, dedup,
|
|
186
|
+
streaming-event filtering, disable switch, error narration, fallback
|
|
187
|
+
emit, unsubscribe.
|
|
188
|
+
- `__tests__/unit/active-sub-agents.test.ts` — origin filtering, terminal
|
|
189
|
+
exclusion, deterministic sort, no volatile fields, action-hint text.
|
|
190
|
+
|
|
191
|
+
## Related files
|
|
192
|
+
|
|
193
|
+
- [src/services/sub-agent-router.ts](../src/services/sub-agent-router.ts)
|
|
194
|
+
- [src/providers/active-sub-agents.ts](../src/providers/active-sub-agents.ts)
|
|
195
|
+
- [src/services/acp-service.ts](../src/services/acp-service.ts)
|
|
196
|
+
- [src/actions/create-task.ts](../src/actions/create-task.ts)
|
|
197
|
+
- [src/actions/send-to-agent.ts](../src/actions/send-to-agent.ts)
|