@elizaos/plugin-agent-orchestrator 2.0.0-alpha.5 → 2.0.0-alpha.537

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/README.md +233 -0
  2. package/assets/claude-code-skills/eliza-runtime/SKILL.md +123 -0
  3. package/assets/claude-code-skills/eliza-runtime/references/hooks.md +82 -0
  4. package/assets/claude-code-skills/eliza-runtime/references/orchestration.md +68 -0
  5. package/assets/claude-code-skills/eliza-runtime/references/synthesis.md +84 -0
  6. package/assets/claude-code-skills/eliza-runtime/scripts/eliza-context.sh +103 -0
  7. package/assets/claude-code-skills/eliza-runtime/scripts/eliza-decision.sh +48 -0
  8. package/assets/claude-code-skills/eliza-runtime/scripts/eliza-parent.sh +143 -0
  9. package/dist/actions/coding-task-handlers.d.ts +64 -0
  10. package/dist/actions/coding-task-handlers.d.ts.map +1 -0
  11. package/dist/actions/coding-task-helpers.d.ts +35 -0
  12. package/dist/actions/coding-task-helpers.d.ts.map +1 -0
  13. package/dist/actions/eval-metadata.d.ts +11 -0
  14. package/dist/actions/eval-metadata.d.ts.map +1 -0
  15. package/dist/actions/finalize-workspace.d.ts +11 -0
  16. package/dist/actions/finalize-workspace.d.ts.map +1 -0
  17. package/dist/actions/list-agents.d.ts +13 -0
  18. package/dist/actions/list-agents.d.ts.map +1 -0
  19. package/dist/actions/manage-issues.d.ts +11 -0
  20. package/dist/actions/manage-issues.d.ts.map +1 -0
  21. package/dist/actions/provision-workspace.d.ts +11 -0
  22. package/dist/actions/provision-workspace.d.ts.map +1 -0
  23. package/dist/actions/send-to-agent.d.ts +12 -0
  24. package/dist/actions/send-to-agent.d.ts.map +1 -0
  25. package/dist/actions/spawn-agent.d.ts +12 -0
  26. package/dist/actions/spawn-agent.d.ts.map +1 -0
  27. package/dist/actions/start-coding-task.d.ts +69 -0
  28. package/dist/actions/start-coding-task.d.ts.map +1 -0
  29. package/dist/actions/stop-agent.d.ts +12 -0
  30. package/dist/actions/stop-agent.d.ts.map +1 -0
  31. package/dist/actions/task-control.d.ts +3 -0
  32. package/dist/actions/task-control.d.ts.map +1 -0
  33. package/dist/actions/task-history.d.ts +3 -0
  34. package/dist/actions/task-history.d.ts.map +1 -0
  35. package/dist/actions/task-share.d.ts +3 -0
  36. package/dist/actions/task-share.d.ts.map +1 -0
  37. package/dist/actions/task-thread-target.d.ts +11 -0
  38. package/dist/actions/task-thread-target.d.ts.map +1 -0
  39. package/dist/api/agent-routes.d.ts +18 -0
  40. package/dist/api/agent-routes.d.ts.map +1 -0
  41. package/dist/api/bridge-routes.d.ts +32 -0
  42. package/dist/api/bridge-routes.d.ts.map +1 -0
  43. package/dist/api/coordinator-routes.d.ts +22 -0
  44. package/dist/api/coordinator-routes.d.ts.map +1 -0
  45. package/dist/api/hook-routes.d.ts +18 -0
  46. package/dist/api/hook-routes.d.ts.map +1 -0
  47. package/dist/api/issue-routes.d.ts +17 -0
  48. package/dist/api/issue-routes.d.ts.map +1 -0
  49. package/dist/api/parent-context-routes.d.ts +17 -0
  50. package/dist/api/parent-context-routes.d.ts.map +1 -0
  51. package/dist/api/routes.d.ts +37 -0
  52. package/dist/api/routes.d.ts.map +1 -0
  53. package/dist/api/workspace-routes.d.ts +17 -0
  54. package/dist/api/workspace-routes.d.ts.map +1 -0
  55. package/dist/index.d.ts +36 -15
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +19823 -3387
  58. package/dist/index.js.map +72 -22
  59. package/dist/providers/action-examples.d.ts +14 -0
  60. package/dist/providers/action-examples.d.ts.map +1 -0
  61. package/dist/providers/active-workspace-context.d.ts +13 -0
  62. package/dist/providers/active-workspace-context.d.ts.map +1 -0
  63. package/dist/services/agent-credentials.d.ts +23 -0
  64. package/dist/services/agent-credentials.d.ts.map +1 -0
  65. package/dist/services/agent-metrics.d.ts +30 -0
  66. package/dist/services/agent-metrics.d.ts.map +1 -0
  67. package/dist/services/agent-selection.d.ts +53 -0
  68. package/dist/services/agent-selection.d.ts.map +1 -0
  69. package/dist/services/ansi-utils.d.ts +61 -0
  70. package/dist/services/ansi-utils.d.ts.map +1 -0
  71. package/dist/services/claude-code-skill-installer.d.ts +33 -0
  72. package/dist/services/claude-code-skill-installer.d.ts.map +1 -0
  73. package/dist/services/config-env.d.ts +23 -0
  74. package/dist/services/config-env.d.ts.map +1 -0
  75. package/dist/services/coordinator-event-normalizer.d.ts +50 -0
  76. package/dist/services/coordinator-event-normalizer.d.ts.map +1 -0
  77. package/dist/services/custom-validator-runner.d.ts +66 -0
  78. package/dist/services/custom-validator-runner.d.ts.map +1 -0
  79. package/dist/services/debug-capture.d.ts +38 -0
  80. package/dist/services/debug-capture.d.ts.map +1 -0
  81. package/dist/services/pty-auto-response.d.ts +30 -0
  82. package/dist/services/pty-auto-response.d.ts.map +1 -0
  83. package/dist/services/pty-init.d.ts +54 -0
  84. package/dist/services/pty-init.d.ts.map +1 -0
  85. package/dist/services/pty-service.d.ts +206 -0
  86. package/dist/services/pty-service.d.ts.map +1 -0
  87. package/dist/services/pty-session-io.d.ts +49 -0
  88. package/dist/services/pty-session-io.d.ts.map +1 -0
  89. package/dist/services/pty-spawn.d.ts +113 -0
  90. package/dist/services/pty-spawn.d.ts.map +1 -0
  91. package/dist/services/pty-types.d.ts +94 -0
  92. package/dist/services/pty-types.d.ts.map +1 -0
  93. package/dist/services/repo-input.d.ts +16 -0
  94. package/dist/services/repo-input.d.ts.map +1 -0
  95. package/dist/services/session-event-queue.d.ts +25 -0
  96. package/dist/services/session-event-queue.d.ts.map +1 -0
  97. package/dist/services/skill-callback-bridge.d.ts +78 -0
  98. package/dist/services/skill-callback-bridge.d.ts.map +1 -0
  99. package/dist/services/skill-essentials.d.ts +16 -0
  100. package/dist/services/skill-essentials.d.ts.map +1 -0
  101. package/dist/services/skill-lifeops-context-broker.d.ts +20 -0
  102. package/dist/services/skill-lifeops-context-broker.d.ts.map +1 -0
  103. package/dist/services/skill-manifest.d.ts +48 -0
  104. package/dist/services/skill-manifest.d.ts.map +1 -0
  105. package/dist/services/skill-recommender.d.ts +51 -0
  106. package/dist/services/skill-recommender.d.ts.map +1 -0
  107. package/dist/services/stall-classifier.d.ts +69 -0
  108. package/dist/services/stall-classifier.d.ts.map +1 -0
  109. package/dist/services/structured-proof-bridge.d.ts +99 -0
  110. package/dist/services/structured-proof-bridge.d.ts.map +1 -0
  111. package/dist/services/swarm-coordinator-prompts.d.ts +97 -0
  112. package/dist/services/swarm-coordinator-prompts.d.ts.map +1 -0
  113. package/dist/services/swarm-coordinator.d.ts +471 -0
  114. package/dist/services/swarm-coordinator.d.ts.map +1 -0
  115. package/dist/services/swarm-decision-loop.d.ts +52 -0
  116. package/dist/services/swarm-decision-loop.d.ts.map +1 -0
  117. package/dist/services/swarm-event-triage.d.ts +49 -0
  118. package/dist/services/swarm-event-triage.d.ts.map +1 -0
  119. package/dist/services/swarm-history.d.ts +27 -0
  120. package/dist/services/swarm-history.d.ts.map +1 -0
  121. package/dist/services/swarm-idle-watchdog.d.ts +22 -0
  122. package/dist/services/swarm-idle-watchdog.d.ts.map +1 -0
  123. package/dist/services/task-acceptance.d.ts +8 -0
  124. package/dist/services/task-acceptance.d.ts.map +1 -0
  125. package/dist/services/task-agent-auth.d.ts +69 -0
  126. package/dist/services/task-agent-auth.d.ts.map +1 -0
  127. package/dist/services/task-agent-frameworks.d.ts +90 -0
  128. package/dist/services/task-agent-frameworks.d.ts.map +1 -0
  129. package/dist/services/task-kind.d.ts +3 -0
  130. package/dist/services/task-kind.d.ts.map +1 -0
  131. package/dist/services/task-policy.d.ts +17 -0
  132. package/dist/services/task-policy.d.ts.map +1 -0
  133. package/dist/services/task-registry.d.ts +550 -0
  134. package/dist/services/task-registry.d.ts.map +1 -0
  135. package/dist/services/task-share.d.ts +18 -0
  136. package/dist/services/task-share.d.ts.map +1 -0
  137. package/dist/services/task-validation.d.ts +69 -0
  138. package/dist/services/task-validation.d.ts.map +1 -0
  139. package/dist/services/task-verifier-runner.d.ts +5 -0
  140. package/dist/services/task-verifier-runner.d.ts.map +1 -0
  141. package/dist/services/trajectory-context.d.ts +73 -0
  142. package/dist/services/trajectory-context.d.ts.map +1 -0
  143. package/dist/services/trajectory-feedback.d.ts +53 -0
  144. package/dist/services/trajectory-feedback.d.ts.map +1 -0
  145. package/dist/services/workspace-git-ops.d.ts +28 -0
  146. package/dist/services/workspace-git-ops.d.ts.map +1 -0
  147. package/dist/services/workspace-github.d.ts +60 -0
  148. package/dist/services/workspace-github.d.ts.map +1 -0
  149. package/dist/services/workspace-lifecycle.d.ts +18 -0
  150. package/dist/services/workspace-lifecycle.d.ts.map +1 -0
  151. package/dist/services/workspace-service.d.ts +121 -0
  152. package/dist/services/workspace-service.d.ts.map +1 -0
  153. package/dist/services/workspace-types.d.ts +81 -0
  154. package/dist/services/workspace-types.d.ts.map +1 -0
  155. package/package.json +28 -43
  156. package/scripts/ensure-node-pty.mjs +100 -0
  157. package/dist/src/actions/messaging.d.ts +0 -24
  158. package/dist/src/actions/messaging.d.ts.map +0 -1
  159. package/dist/src/actions/subagent-management.d.ts +0 -7
  160. package/dist/src/actions/subagent-management.d.ts.map +0 -1
  161. package/dist/src/actions/task-management.d.ts +0 -9
  162. package/dist/src/actions/task-management.d.ts.map +0 -1
  163. package/dist/src/config.d.ts +0 -4
  164. package/dist/src/config.d.ts.map +0 -1
  165. package/dist/src/providers/orchestrator-config.d.ts +0 -80
  166. package/dist/src/providers/orchestrator-config.d.ts.map +0 -1
  167. package/dist/src/providers/task-context.d.ts +0 -3
  168. package/dist/src/providers/task-context.d.ts.map +0 -1
  169. package/dist/src/services/agent-orchestrator-service.d.ts +0 -59
  170. package/dist/src/services/agent-orchestrator-service.d.ts.map +0 -1
  171. package/dist/src/services/messaging-service.d.ts +0 -111
  172. package/dist/src/services/messaging-service.d.ts.map +0 -1
  173. package/dist/src/services/sandbox-service.d.ts +0 -103
  174. package/dist/src/services/sandbox-service.d.ts.map +0 -1
  175. package/dist/src/services/subagent-service.d.ts +0 -110
  176. package/dist/src/services/subagent-service.d.ts.map +0 -1
  177. package/dist/src/types/index.d.ts +0 -12
  178. package/dist/src/types/index.d.ts.map +0 -1
  179. package/dist/src/types/messaging.d.ts +0 -202
  180. package/dist/src/types/messaging.d.ts.map +0 -1
  181. package/dist/src/types/sandbox.d.ts +0 -228
  182. package/dist/src/types/sandbox.d.ts.map +0 -1
  183. package/dist/src/types/subagent.d.ts +0 -224
  184. package/dist/src/types/subagent.d.ts.map +0 -1
  185. package/dist/src/types.d.ts +0 -113
  186. package/dist/src/types.d.ts.map +0 -1
  187. package/dist/src/utils/index.d.ts +0 -7
  188. package/dist/src/utils/index.d.ts.map +0 -1
  189. package/dist/src/utils/session.d.ts +0 -106
  190. package/dist/src/utils/session.d.ts.map +0 -1
@@ -0,0 +1,206 @@
1
+ /** @module services/pty-service */
2
+ import { type IAgentRuntime } from "@elizaos/core";
3
+ import { type AdapterType, 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 CoordinatorNormalizedEvent } from "./coordinator-event-normalizer.js";
8
+ import type { CodingAgentType, PTYServiceConfig, SessionEventCallback, SessionInfo, SpawnSessionOptions } from "./pty-types.js";
9
+ import { SwarmCoordinator } from "./swarm-coordinator.js";
10
+ import { type TaskAgentAuthLaunchResult, type TaskAgentAuthStatus } from "./task-agent-auth.js";
11
+ import { type SupportedTaskAgentAdapter, type TaskAgentFrameworkState, type TaskAgentTaskProfileInput } from "./task-agent-frameworks.js";
12
+ export type { CodingAgentType, PTYServiceConfig, SessionEventName, SessionInfo, SpawnSessionOptions, } from "./pty-types.js";
13
+ export { normalizeAgentType } from "./pty-types.js";
14
+ /**
15
+ * Pre-accept Claude Code's one-time trust dialog for a workdir by writing
16
+ * `hasTrustDialogAccepted: true` into `~/.claude.json`'s `projects` map.
17
+ *
18
+ * Why: Claude Code shows a Bypass Permissions / Trust dialog the first time
19
+ * it runs in any unrecognised directory. On a fresh scratch workdir that
20
+ * dialog is blocking: the auto-response path ends up pressing Enter, which
21
+ * defaults to "No, exit" and kills the subagent with exit code 1 before any
22
+ * work happens. Seeding the trust entry upfront skips the dialog entirely.
23
+ *
24
+ * Idempotent and best-effort: returns without throwing if the config file
25
+ * does not yet exist, is unreadable, or is not valid JSON. In those cases
26
+ * claude will show the dialog the normal way, which is no worse than before.
27
+ *
28
+ * Concurrency: serialized per config path via `claudeConfigWriteQueue` so
29
+ * parallel swarm spawns don't clobber each other's trust entries.
30
+ */
31
+ declare function seedClaudeTrustForWorkdir(workdir: string, overrideConfigPath?: string): Promise<void>;
32
+ export declare const seedClaudeTrustForWorkdirForTesting: typeof seedClaudeTrustForWorkdir;
33
+ /**
34
+ * Retrieve the SwarmCoordinator from the PTYService registered on the runtime.
35
+ * Returns undefined if PTYService or coordinator is not available.
36
+ */
37
+ export declare function getCoordinator(runtime: IAgentRuntime): SwarmCoordinator | undefined;
38
+ export declare class PTYService {
39
+ static serviceType: string;
40
+ capabilityDescription: string;
41
+ private runtime;
42
+ private manager;
43
+ private usingBunWorker;
44
+ private serviceConfig;
45
+ private sessionNames;
46
+ private sessionMetadata;
47
+ private sessionWorkdirs;
48
+ private eventCallbacks;
49
+ private normalizedEventCallbacks;
50
+ private outputUnsubscribers;
51
+ private transcriptUnsubscribers;
52
+ private sessionOutputBuffers;
53
+ private completionReconcileTimers;
54
+ private completionSignalSince;
55
+ private terminalSessionStates;
56
+ private adapterCache;
57
+ /** Tracks the buffer index when a task was sent, so we can capture the response on completion */
58
+ private taskResponseMarkers;
59
+ /** Captures "Task completion trace" log entries from worker stderr (rolling, capped at 200) */
60
+ private traceEntries;
61
+ private static readonly MAX_TRACE_ENTRIES;
62
+ /** Lightweight per-agent-type metrics for observability */
63
+ private metricsTracker;
64
+ /** Active provider auth helper processes keyed by agent type. */
65
+ private activeAuthFlows;
66
+ private pendingBunList;
67
+ private coalescedBunList;
68
+ /** Pending task_complete → auto-stop timers, cancellable by the coordinator. */
69
+ private taskCompleteAutoStopTimers;
70
+ /** Background auth-recovery watchers keyed by blocked session id. */
71
+ private authRecoveryTimers;
72
+ /** Console bridge for terminal output streaming and buffered hydration */
73
+ consoleBridge: PTYConsoleBridge | null;
74
+ /** Swarm coordinator instance (if active). Accessed via getCoordinator(runtime). */
75
+ coordinator: SwarmCoordinator | null;
76
+ constructor(runtime: IAgentRuntime, config?: PTYServiceConfig);
77
+ static start(runtime: IAgentRuntime): Promise<PTYService>;
78
+ static stopRuntime(runtime: IAgentRuntime): Promise<void>;
79
+ private initialize;
80
+ stop(): Promise<void>;
81
+ private generateSessionId;
82
+ /** Build a SessionIOContext from current instance state. */
83
+ private ioContext;
84
+ /**
85
+ * Spawn a new PTY session for a coding agent
86
+ */
87
+ spawnSession(options: SpawnSessionOptions): Promise<SessionInfo>;
88
+ private autoResponseContext;
89
+ private pushDefaultRules;
90
+ private handleGeminiAuth;
91
+ sendToSession(sessionId: string, input: string): Promise<SessionMessage | undefined>;
92
+ sendKeysToSession(sessionId: string, keys: string | string[]): Promise<void>;
93
+ /**
94
+ * Cancel a pending task_complete auto-stop for this session. Returns true
95
+ * if a timer was cancelled, false if none was pending. Safe to call any
96
+ * number of times. Intended for the swarm coordinator's task_complete
97
+ * handler so the assessment LLM has time to decide whether to keep the
98
+ * session alive (respond) or stop it (complete/escalate/ignore).
99
+ */
100
+ cancelTaskCompleteAutoStop(sessionId: string): boolean;
101
+ stopSession(sessionId: string, force?: boolean): Promise<void>;
102
+ /** Default approval preset. Runtime env var takes precedence over config. */
103
+ get defaultApprovalPreset(): ApprovalPreset;
104
+ /** Agent selection strategy. Env var takes precedence. */
105
+ get agentSelectionStrategy(): AgentSelectionStrategy;
106
+ /**
107
+ * Default agent type when strategy is "fixed".
108
+ * Precedence: config file (`eliza.json` env section, written by the UI)
109
+ * > runtime/env setting > "claude" fallback.
110
+ */
111
+ get defaultAgentType(): AdapterType;
112
+ private get explicitDefaultAgentType();
113
+ /**
114
+ * Resolve which agent type to use when the caller didn't specify one.
115
+ *
116
+ * When the caller explicitly configured a fixed default agent type, fixed
117
+ * mode returns that pinned framework. Otherwise the resolver scores the
118
+ * available frameworks from task shape, auth/install state, and recent
119
+ * metrics so dynamic routing still works on unconfigured installs.
120
+ */
121
+ resolveAgentType(selection?: TaskAgentTaskProfileInput): Promise<string>;
122
+ getFrameworkState(selection?: TaskAgentTaskProfileInput): Promise<TaskAgentFrameworkState>;
123
+ getSession(sessionId: string): SessionInfo | undefined;
124
+ listSessions(filter?: SessionFilter): Promise<SessionInfo[]>;
125
+ subscribeToOutput(sessionId: string, callback: (data: string) => void): () => void;
126
+ getSessionOutput(sessionId: string, lines?: number): Promise<string>;
127
+ /**
128
+ * Whether the adapter currently classifies the session as actively
129
+ * processing work (e.g. Codex's "esc to interrupt" status row).
130
+ *
131
+ * The swarm idle watchdog consults this before assuming a session is
132
+ * idle based on output byte diffs, which are fooled by TUIs that
133
+ * redraw the same status row in place via cursor positioning.
134
+ *
135
+ * Returns `false` for unknown sessions or adapters that don't
136
+ * implement `detectLoading`. For Bun-compat mode this round-trips to
137
+ * the worker; for in-process mode it reads the session directly.
138
+ */
139
+ isSessionLoading(sessionId: string): Promise<boolean>;
140
+ private clearTranscriptCapture;
141
+ private resolveTaskThreadId;
142
+ private persistTranscript;
143
+ private wireTranscriptCapture;
144
+ isSessionBlocked(sessionId: string): boolean;
145
+ /**
146
+ * Find a PTY session ID by its working directory.
147
+ * Used by the HTTP hooks endpoint to correlate Claude's cwd with our session.
148
+ */
149
+ findSessionIdByCwd(cwd: string): string | undefined;
150
+ /**
151
+ * Handle an incoming hook event from Claude Code's HTTP hooks.
152
+ * Translates hook events into PTY service events.
153
+ */
154
+ handleHookEvent(sessionId: string, event: string, data: Record<string, unknown>): void;
155
+ checkAvailableAgents(types?: AdapterType[]): Promise<PreflightResult[]>;
156
+ getAgentAuthStatus(agentType: SupportedTaskAgentAdapter): Promise<TaskAgentAuthStatus>;
157
+ triggerAgentAuth(agentType: SupportedTaskAgentAdapter): Promise<TaskAgentAuthLaunchResult>;
158
+ startSessionAuthRecovery(sessionId: string, agentType: SupportedTaskAgentAdapter, login: {
159
+ instructions?: string;
160
+ url?: string;
161
+ deviceCode?: string;
162
+ method?: string;
163
+ promptSnippet?: string;
164
+ }): Promise<TaskAgentAuthLaunchResult & {
165
+ recoveryStarted: boolean;
166
+ status: "recovered" | "recovering" | "failed";
167
+ }>;
168
+ private monitorSessionAuthRecovery;
169
+ private resumeSessionAfterRecoveredAuth;
170
+ getSupportedAgentTypes(): CodingAgentType[];
171
+ private classifyStall;
172
+ private getAdapter;
173
+ getWorkspaceFiles(agentType: AdapterType): AgentFileDescriptor[];
174
+ getMemoryFilePath(agentType: AdapterType): string;
175
+ getApprovalConfig(agentType: AdapterType, preset: ApprovalPreset): ApprovalConfig;
176
+ writeMemoryFile(agentType: AdapterType, workspacePath: string, content: string, options?: WriteMemoryOptions): Promise<string>;
177
+ /** Marker comment used to detect orchestrator-managed gitignore entries. */
178
+ private static readonly GITIGNORE_MARKER;
179
+ /** Per-path lock to serialize concurrent gitignore updates for the same workdir. */
180
+ private static gitignoreLocks;
181
+ /**
182
+ * Ensure that orchestrator-injected files (CLAUDE.md, .claude/, GEMINI.md, etc.)
183
+ * are listed in the workspace .gitignore so agents don't commit them.
184
+ * Appends to an existing .gitignore or creates one. Idempotent: skips if
185
+ * the marker comment is already present. Serialized per-path to prevent
186
+ * duplicate entries from concurrent spawns.
187
+ */
188
+ private ensureOrchestratorGitignore;
189
+ private doEnsureGitignore;
190
+ onSessionEvent(callback: SessionEventCallback): () => void;
191
+ onNormalizedSessionEvent(callback: (event: CoordinatorNormalizedEvent) => void): () => void;
192
+ registerAdapter(adapter: unknown): void;
193
+ private toSessionInfo;
194
+ private toTerminalSessionInfo;
195
+ private emitEvent;
196
+ getAgentMetrics(): Record<string, Omit<import("./agent-metrics.js").AgentMetrics, "totalCompletionMs">>;
197
+ private log;
198
+ private handleWorkerExit;
199
+ private clearCompletionReconcile;
200
+ private scheduleCompletionReconcile;
201
+ private isAdapterBackedAgentType;
202
+ private shouldSuppressBlockedEvent;
203
+ private responseLooksMeaningful;
204
+ private reconcileBusySessionFromOutput;
205
+ }
206
+ //# sourceMappingURL=pty-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pty-service.d.ts","sourceRoot":"","sources":["../../src/services/pty-service.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAWnC,OAAO,EAAE,KAAK,aAAa,EAAwB,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,cAAc,EAKnB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAGV,aAAa,EAEb,cAAc,EAIf,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AASnE,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,mCAAmC,CAAC;AAyB3C,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAaxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAQL,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAML,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC/B,MAAM,4BAA4B,CAAC;AAgNpC,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,mBAAmB,G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OAAO,GAAG,IAAI;IAkBvC,OAAO,CAAC,aAAa;IA6BrB,OAAO,CAAC,qBAAqB;IA4B7B,OAAO,CAAC,SAAS;IAkEjB,eAAe;IAIf,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,gBAAgB;IAgCxB,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,wBAAwB;IAUhC,OAAO,CAAC,0BAA0B;IA6DlC,OAAO,CAAC,uBAAuB;YAmCjB,8BAA8B;CAuG7C"}
@@ -0,0 +1,49 @@
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
+ * @param force - When true, sends SIGKILL immediately instead of SIGTERM.
37
+ * Use for sessions whose task is already complete — there's nothing to save.
38
+ */
39
+ export declare function stopSession(ctx: SessionIOContext, sessionId: string, sessionMetadata: Map<string, Record<string, unknown>>, sessionWorkdirs: Map<string, string>, log: (msg: string) => void, force?: boolean): Promise<void>;
40
+ /**
41
+ * Subscribe to live output from a session.
42
+ * Returns an unsubscribe function.
43
+ */
44
+ export declare function subscribeToOutput(ctx: SessionIOContext, sessionId: string, callback: (data: string) => void): () => void;
45
+ /**
46
+ * Get buffered or logged output from a session.
47
+ */
48
+ export declare function getSessionOutput(ctx: SessionIOContext, sessionId: string, lines?: number): Promise<string>;
49
+ //# sourceMappingURL=pty-session-io.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pty-session-io.d.ts","sourceRoot":"","sources":["../../src/services/pty-session-io.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EACV,uBAAuB,EACvB,UAAU,EACV,cAAc,EACf,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,UAAU,GAAG,uBAAuB,CAAC;IAC9C,cAAc,EAAE,OAAO,CAAC;IACxB,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC5C,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC;CAC9C;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAoBrC;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GACtB,OAAO,CAAC,IAAI,CAAC,CAUf;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACrD,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EAC1B,KAAK,UAAQ,GACZ,OAAO,CAAC,IAAI,CAAC,CAqDf;AAkCD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAC/B,MAAM,IAAI,CAiBZ;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAejB"}
@@ -0,0 +1,113 @@
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
+ interface OrchestratorPoolShim {
13
+ pickAnthropicTokenForSpawn(opts: {
14
+ sessionKey: string;
15
+ }): Promise<{
16
+ accessToken: string;
17
+ accountId: string;
18
+ } | null>;
19
+ markRateLimited(accountId: string, untilMs: number, detail?: string): void;
20
+ markInvalid(accountId: string, detail?: string): void;
21
+ markNeedsReauth(accountId: string, detail?: string): void;
22
+ }
23
+ export declare function getOrchestratorAccountPoolShim(): OrchestratorPoolShim | undefined;
24
+ /**
25
+ * Inspect a chunk of session output for auth-related failure signatures.
26
+ * Returns the kind of failure detected (or null) so the caller can mark
27
+ * the supplied `accountId` via the pool. Pattern matching is best-effort
28
+ * and intentionally narrow: we only flag accounts when we're confident
29
+ * the subprocess saw a real auth error.
30
+ */
31
+ export declare function detectAuthFailureKind(data: string): "rate-limited" | "invalid" | "needs-reauth" | null;
32
+ /**
33
+ * Build a sanitized base environment from process.env, keeping only
34
+ * safe system variables. Agent-specific credentials are injected
35
+ * separately by the adapter's getEnv().
36
+ *
37
+ * On Windows, the sanitized env may have lost the per-package-manager bin
38
+ * directories that hold `claude.cmd` / `codex.cmd` (npm global, Codex
39
+ * managed install, scoop shims, chocolatey bin). Route through
40
+ * `appendWindowsPathFallbacks` to add those back after the allowlist copy.
41
+ */
42
+ export declare function buildSanitizedBaseEnv(): Record<string, string>;
43
+ /**
44
+ * Directories that Windows package managers drop `claude.cmd` / `codex.cmd`
45
+ * / `codex.exe` into. We append these to the sanitized PATH so `cmd.exe`
46
+ * (via the `shell: true` flag on execFile/spawn for win32) can resolve the
47
+ * CLI binaries even when the user's PATH has been stripped down by the
48
+ * ENV_ALLOWLIST-then-systemd-unit chain or otherwise missing the install
49
+ * location. Each entry is a no-op on non-Windows and a no-op when the
50
+ * parent env var the path depends on is unset.
51
+ *
52
+ * Coverage, in order of popularity for claude/codex installs:
53
+ * - npm global (%APPDATA%\npm) — the official CLAUDE_CODE install path
54
+ * - Codex managed install (%LOCALAPPDATA%\OpenAI\Codex\bin)
55
+ * - Scoop (%USERPROFILE%\scoop\shims)
56
+ * - Chocolatey (%ProgramData%\chocolatey\bin)
57
+ * - Bun global (%USERPROFILE%\.bun\bin)
58
+ */
59
+ export declare function getWindowsPathFallbacks(): string[];
60
+ /**
61
+ * Append each fallback path to `currentPath` if it isn't already present.
62
+ * Windows PATH matching is case-insensitive, so dedupe on the lowercased
63
+ * form but preserve the original casing in the output. Returns `undefined`
64
+ * when the resulting PATH would be empty (neither argument had content), so
65
+ * callers can skip assigning an empty string.
66
+ */
67
+ export declare function appendWindowsPathFallbacks(currentPath: string | undefined): string | undefined;
68
+ /**
69
+ * Pure PATH-merge helper: dedupe existing + extras, preserve insertion
70
+ * order and casing. Exported for unit tests so we can exercise the merge
71
+ * logic without stubbing `process.platform`.
72
+ */
73
+ export declare function mergePathEntries(currentPath: string | undefined, extras: readonly string[], opts: {
74
+ delimiter: string;
75
+ caseInsensitive: boolean;
76
+ }): string | undefined;
77
+ export interface SpawnContext {
78
+ manager: PTYManager | BunCompatiblePTYManager;
79
+ usingBunWorker: boolean;
80
+ serviceConfig: PTYServiceConfig;
81
+ sessionMetadata: Map<string, Record<string, unknown>>;
82
+ sessionWorkdirs: Map<string, string>;
83
+ sessionOutputBuffers: Map<string, string[]>;
84
+ outputUnsubscribers: Map<string, () => void>;
85
+ taskResponseMarkers: Map<string, number>;
86
+ getAdapter: (agentType: AdapterType) => BaseCodingAdapter;
87
+ sendToSession: (sessionId: string, input: string) => Promise<unknown>;
88
+ sendKeysToSession: (sessionId: string, keys: string | string[]) => Promise<void>;
89
+ writeRawToSession: (sessionId: string, data: string) => Promise<void>;
90
+ pushDefaultRules: (sessionId: string, agentType: string) => Promise<void>;
91
+ toSessionInfo: (session: SessionHandle | WorkerSessionHandle, workdir?: string) => SessionInfo;
92
+ log: (msg: string) => void;
93
+ /** Mark a session's task as delivered in the coordinator. */
94
+ markTaskDelivered: (sessionId: string) => void;
95
+ }
96
+ /**
97
+ * Set up session output buffering for Bun worker path.
98
+ */
99
+ export declare function setupOutputBuffer(ctx: SpawnContext, sessionId: string): void;
100
+ /**
101
+ * Set up deferred task delivery with retry logic.
102
+ * IMPORTANT: Must be called BEFORE pushDefaultRules (which has a 1500ms sleep),
103
+ * otherwise session_ready fires during pushDefaultRules and the listener misses it.
104
+ */
105
+ export declare function setupDeferredTaskDelivery(ctx: SpawnContext, session: SessionHandle | WorkerSessionHandle, task: string, agentType: string): void;
106
+ /**
107
+ * Build the SpawnConfig and env vars from SpawnSessionOptions.
108
+ */
109
+ export declare function buildSpawnConfig(sessionId: string, options: SpawnSessionOptions, workdir: string): SpawnConfig & {
110
+ id: string;
111
+ };
112
+ export {};
113
+ //# sourceMappingURL=pty-spawn.d.ts.map
@@ -0,0 +1 @@
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;AAErB,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAwDxB,UAAU,oBAAoB;IAC5B,0BAA0B,CAAC,IAAI,EAAE;QAC/B,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAC/D,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3E,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtD,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3D;AAED,wBAAgB,8BAA8B,IAC1C,oBAAoB,GACpB,SAAS,CAMZ;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,GACX,cAAc,GAAG,SAAS,GAAG,cAAc,GAAG,IAAI,CAQpD;AAmCD;;;;;;;;;GASG;AACH,wBAAgB,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CAAC;IACnB,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,aAAa,EAAE,CACb,OAAO,EAAE,aAAa,GAAG,mBAAmB,EAC5C,OAAO,CAAC,EAAE,MAAM,KACb,WAAW,CAAC;IACjB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3B,6DAA6D;IAC7D,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAuBD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAe5E;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,aAAa,GAAG,mBAAmB,EAC5C,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,IAAI,CAyJN;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,CAkD9B"}
@@ -0,0 +1,94 @@
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 task-agent adapters (default: true) */
18
+ registerCodingAdapters?: boolean;
19
+ /** Maximum concurrent PTY sessions (default: 8) */
20
+ maxConcurrentSessions?: number;
21
+ /**
22
+ * Default approval preset for task 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: "autonomous"
29
+ */
30
+ defaultApprovalPreset?: ApprovalPreset;
31
+ }
32
+ /** Available task-agent types */
33
+ export type CodingAgentType = "shell" | "pi" | "opencode" | AdapterType;
34
+ /** True when the user requested the Pi coding agent. */
35
+ export declare const isPiAgentType: (input: string | undefined | null) => boolean;
36
+ /** True when the user requested the OpenCode agent. */
37
+ export declare const isOpencodeAgentType: (input: string | undefined | null) => boolean;
38
+ /** Normalize user-provided agent type string to a valid CodingAgentType */
39
+ export declare const normalizeAgentType: (input: string) => CodingAgentType;
40
+ /** Build the initial shell command for Pi agent sessions. */
41
+ export declare const toPiCommand: (task: string | undefined) => string;
42
+ /**
43
+ * Build the initial shell command for OpenCode agent sessions.
44
+ *
45
+ * `--dangerously-skip-permissions` is a flag of the `run` subcommand
46
+ * (NOT the top-level opencode command), so it must come AFTER `run` —
47
+ * verified live with opencode 1.14.33 + ollama qwen2.5-coder:0.5b.
48
+ *
49
+ * Model + provider selection comes from the OPENCODE_CONFIG_CONTENT env
50
+ * var that the spawn pipeline injects — see buildOpencodeSpawnConfig in
51
+ * `agent-credentials.ts`.
52
+ */
53
+ export declare const toOpencodeCommand: (task: string | undefined) => string;
54
+ export interface SpawnSessionOptions {
55
+ /** Human-readable session name */
56
+ name: string;
57
+ /** Adapter type: "shell" | "pi" | "opencode" | "claude" | "gemini" | "codex" | "aider" */
58
+ agentType: CodingAgentType;
59
+ /** Working directory for the session */
60
+ workdir?: string;
61
+ /** Initial command/task to send */
62
+ initialTask?: string;
63
+ /** Environment variables */
64
+ env?: Record<string, string>;
65
+ /** Session metadata for tracking */
66
+ metadata?: Record<string, unknown>;
67
+ /** Credentials for coding agents (API keys, tokens) */
68
+ credentials?: AgentCredentials;
69
+ /** Memory/instructions content to write to the agent's memory file before spawning */
70
+ memoryContent?: string;
71
+ /** Approval preset controlling tool permissions (readonly, standard, permissive, autonomous) */
72
+ approvalPreset?: ApprovalPreset;
73
+ /** Custom credentials for MCP servers or other integrations */
74
+ customCredentials?: Record<string, string>;
75
+ /** When true, adapter-level blocking prompts (tool permissions, file access)
76
+ * are emitted with autoResponded=false instead of being auto-handled.
77
+ * Used by the swarm coordinator to route decisions through its LLM loop. */
78
+ skipAdapterAutoResponse?: boolean;
79
+ }
80
+ export interface SessionInfo {
81
+ id: string;
82
+ name: string;
83
+ agentType: string;
84
+ workdir: string;
85
+ status: SessionHandle["status"];
86
+ createdAt: Date;
87
+ lastActivityAt: Date;
88
+ metadata?: Record<string, unknown>;
89
+ }
90
+ /** Known event names emitted by the PTY layer. */
91
+ export type SessionEventName = "ready" | "blocked" | "login_required" | "task_complete" | "tool_running" | "stopped" | "error" | "message";
92
+ type SessionEventCallback = (sessionId: string, event: string, data: unknown) => void;
93
+ export type { SessionEventCallback };
94
+ //# sourceMappingURL=pty-types.d.ts.map
@@ -0,0 +1 @@
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,E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AAC;IACvB,gGAAgG;IAChG,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C;;iFAE6E;IAC7E,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,SAAS,EAAE,IAAI,CAAC;IAChB,cAAc,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,kDAAkD;AAClD,MAAM,MAAM,gBAAgB,GACxB,OAAO,GACP,SAAS,GACT,gBAAgB,GAChB,eAAe,GACf,cAAc,GACd,SAAS,GACT,OAAO,GACP,SAAS,CAAC;AAEd,KAAK,oBAAoB,GAAG,CAC1B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,OAAO,KACV,IAAI,CAAC;AAEV,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Repository input normalization for coding task workspaces.
3
+ *
4
+ * Accepts canonical clone URLs plus common shorthand forms such as:
5
+ * - owner/repo
6
+ * - github.com/owner/repo
7
+ * - https://github.com/owner/repo
8
+ *
9
+ * Bare owner/repo inputs default to GitHub because the coding workspace
10
+ * flows in this plugin are GitHub-centric.
11
+ *
12
+ * @module services/repo-input
13
+ */
14
+ export declare function normalizeRepositoryInput(repo: string): string;
15
+ export declare function diagnoseWorkspaceBootstrapFailure(repo: string, errorMessage: string): string;
16
+ //# sourceMappingURL=repo-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-input.d.ts","sourceRoot":"","sources":["../../src/services/repo-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAoBH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAqD7D;AAED,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,GACnB,MAAM,CAmDR"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Per-session async serialization queue.
3
+ * Ensures only one event is processed at a time per session.
4
+ */
5
+ export interface QueuedEvent {
6
+ sessionId: string;
7
+ type: "blocked" | "turn_complete";
8
+ data: unknown;
9
+ enqueuedAt: number;
10
+ }
11
+ export declare class SessionEventQueue {
12
+ private queues;
13
+ private processing;
14
+ private handler;
15
+ private logger;
16
+ constructor(handler: (event: QueuedEvent) => Promise<void>, logger?: {
17
+ warn: (msg: string) => void;
18
+ });
19
+ enqueue(event: QueuedEvent): void;
20
+ isProcessing(sessionId: string): boolean;
21
+ clear(sessionId?: string): void;
22
+ pendingCount(sessionId: string): number;
23
+ private processLoop;
24
+ }
25
+ //# sourceMappingURL=session-event-queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-event-queue.d.ts","sourceRoot":"","sources":["../../src/services/session-event-queue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,GAAG,eAAe,CAAC;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAyC;IACvD,OAAO,CAAC,UAAU,CAA0B;IAC5C,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,MAAM,CAAkC;gBAG9C,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,EAC9C,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE;IAM1C,OAAO,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAajC,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAIxC,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ/B,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;YAIzB,WAAW;CA6B1B"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Skill callback bridge — child→parent USE_SKILL routing.
3
+ *
4
+ * Spawned task agents (Claude Code, Codex, Gemini CLI, etc.) cannot directly
5
+ * invoke parent skills. The bridge listens to PTY session output and, when
6
+ * the child emits a directive of the form
7
+ *
8
+ * USE_SKILL <slug> <json_args>
9
+ *
10
+ * dispatches to the parent's USE_SKILL action and pipes the result back into
11
+ * the same session via `ptyService.sendToSession`.
12
+ *
13
+ * Default-on per the Hermes-style project direction. Disable by setting
14
+ * `ELIZA_ENABLE_CHILD_SKILL_CALLBACK=0`.
15
+ *
16
+ * @module services/skill-callback-bridge
17
+ */
18
+ import type { IAgentRuntime } from "@elizaos/core";
19
+ import type { PTYService } from "./pty-service.js";
20
+ interface SkillCallbackInvocation {
21
+ slug: string;
22
+ args: unknown;
23
+ }
24
+ /**
25
+ * Parse the first USE_SKILL directive in a chunk of agent output, if any.
26
+ * The directive must be on its own line (after optional whitespace).
27
+ */
28
+ export declare function parseUseSkillDirective(text: string): SkillCallbackInvocation | null;
29
+ interface BridgeDeps {
30
+ runtime: IAgentRuntime;
31
+ ptyService: PTYService;
32
+ /**
33
+ * Optional: per-session allow-list of skill slugs. The bridge consults the
34
+ * registry below when dispatching a child USE_SKILL directive. A directive
35
+ * whose slug is not on the session's allow-list is rejected back into the
36
+ * child with an error message listing the recommended slugs.
37
+ *
38
+ * If omitted (or no entry is registered for the session), the bridge falls
39
+ * back to permissive behavior — any enabled skill may be invoked. This
40
+ * preserves backwards-compatible behavior for callers that do not yet wire
41
+ * per-spawn recommendations.
42
+ */
43
+ sessionAllowList?: SkillSessionAllowList;
44
+ }
45
+ /**
46
+ * Session-scoped allow-list registry. Callers register a session's allow-list
47
+ * at spawn time (see `coding-task-handlers.ts` after
48
+ * `recommendSkillsForTask`). The bridge reads the entry when a USE_SKILL
49
+ * directive arrives.
50
+ *
51
+ * Using a plain Map instead of a WeakMap — the key is the PTY sessionId
52
+ * string assigned at spawn time, which we must explicitly clear on session
53
+ * teardown to avoid leaks.
54
+ */
55
+ export interface SkillSessionAllowList {
56
+ register: (sessionId: string, slugs: readonly string[]) => void;
57
+ clear: (sessionId: string) => void;
58
+ get: (sessionId: string) => readonly string[] | undefined;
59
+ }
60
+ export declare function createSkillSessionAllowList(): SkillSessionAllowList;
61
+ /**
62
+ * Ensure the bridge is installed exactly once for this runtime+PTY pair.
63
+ * Safe to call from every task spawn — subsequent calls are no-ops. The
64
+ * session allow-list registry, when supplied, is attached on the first
65
+ * install and reused thereafter; callers can look up the registry they
66
+ * passed in to register per-session slugs.
67
+ */
68
+ export declare function ensureSkillCallbackBridge(deps: BridgeDeps): void;
69
+ /**
70
+ * Install the child→parent USE_SKILL bridge for the given PTY service. Safe
71
+ * to call multiple times — duplicate listeners are idempotent because the
72
+ * unsubscribe handle is returned to the caller.
73
+ *
74
+ * Returns a teardown function. Call it on shutdown to remove the listener.
75
+ */
76
+ export declare function installSkillCallbackBridge(deps: BridgeDeps): () => void;
77
+ export {};
78
+ //# sourceMappingURL=skill-callback-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-callback-bridge.d.ts","sourceRoot":"","sources":["../../src/services/skill-callback-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAU,aAAa,EAAU,MAAM,eAAe,CAAC;AAKnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAiBnD,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAsBD;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,GACX,uBAAuB,GAAG,IAAI,CAmBhC;AAkCD,UAAU,UAAU;IAClB,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;CAC1C;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,CAAC;IAChE,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,GAAG,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC3D;AAED,wBAAgB,2BAA2B,IAAI,qBAAqB,CAWnE;AASD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAKhE;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,IAAI,CA0JvE"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Auto-injected subset of `assets/claude-code-skills/eliza-runtime/SKILL.md`
3
+ * that ships verbatim in the workspace-lock brief for claude sub-agents.
4
+ *
5
+ * Why a separate constant (and not just a Read of SKILL.md at runtime):
6
+ * sub-agents on the Claude.ai consumer-tier OAuth do not have the `Skill`
7
+ * tool, so the skill auto-load mechanism is unavailable to them. Inlining
8
+ * the must-have sections into the spawn brief gives them the operating
9
+ * manual upfront with zero file I/O.
10
+ *
11
+ * Keep this in sync with SKILL.md: when you edit one, edit both. SKILL.md
12
+ * remains the canonical / extended manual (spawn-variants table, helper
13
+ * scripts, references). This constant is the always-injected minimum.
14
+ */
15
+ export declare const CLAUDE_SKILL_ESSENTIALS = "Tool availability varies by Claude Code build and account tier \u2014 enumerate your actual tools (read `.claude/settings.json`'s `permissions.allow`, or use `ToolSearch` if present) before deciding you can't do a thing.\n\n# DECISION protocol\n\nThe orchestrator greps your stdout for lines starting with `DECISION:`. Use them when you make an architectural choice not covered by the brief, or when reporting a hard limitation. Examples:\n\n```\nDECISION: chose /api/v1/messages/ over /messages/ to match existing eliza-cloud route prefix.\nDECISION: cannot run shell commands \u2014 this session has Read/Grep/Glob but no Bash, Monitor, or run_shell_command. Reported what I could find statically.\n```\n\nALWAYS-on, no shell tool required \u2014 just print the line.\n\n# What you should NEVER do\n\n- Refuse a task as \"no shell available\" without first enumerating your actual tool list (settings.json + ToolSearch). Different tiers ship different shell tools \u2014 `Bash`, `Monitor`, `run_shell_command` \u2014 at least one is usually present.\n- Say \"use the `!` prefix\" or \"run this in your terminal\" \u2014 there is no terminal in your face.\n- Ask the human to clarify or provide input \u2014 there is no human in your session.\n- Push to remotes, write outside workdir, print env tokens.\n- Treat partial information as a blocker \u2014 produce the best output you can with what you have.\n\n# Bridge endpoints (parent state, read-only)\n\nWhen HTTP hooks are wired (variants `swarm` and `repo`), GET these to query parent state:\n- `http://localhost:${ELIZA_HOOK_PORT:-2138}/api/coding-agents/$PARALLAX_SESSION_ID/parent-context` \u2014 agent character, originating room, original task\n- `.../memory?q=<query>&limit=<N>` \u2014 recent messages from the originating room\n- `.../active-workspaces` \u2014 sibling sub-agents (swarm only)\n\nAuth is the path-embedded session id. Loopback-only, GET-only, read-only.\n\n# Constraints\n\n- Sealed env: only an allowlist of vars is forwarded (PATH, HOME, USER, SHELL, ANTHROPIC_MODEL, GITHUB_TOKEN, PARALLAX_SESSION_ID, ELIZA_HOOK_PORT, etc.).\n- Workspace-only writes: write only inside your workdir.\n- Don't push to git remotes \u2014 Eliza handles git push, PR creation, cross-repo coordination.\n- Don't print secrets \u2014 PTY output is captured. Reference secrets by env-var name.\n\nFor deeper context (spawn-variants table, helper scripts, references) see `~/.claude/skills/eliza-runtime/SKILL.md`.";
16
+ //# sourceMappingURL=skill-essentials.d.ts.map