@elizaos/plugin-coding-agent 0.1.0-next.0

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 (79) hide show
  1. package/README.md +169 -0
  2. package/dist/index.js +5788 -0
  3. package/dist/index.js.map +45 -0
  4. package/dist/src/actions/coding-task-handlers.d.ts +44 -0
  5. package/dist/src/actions/coding-task-handlers.d.ts.map +1 -0
  6. package/dist/src/actions/coding-task-helpers.d.ts +27 -0
  7. package/dist/src/actions/coding-task-helpers.d.ts.map +1 -0
  8. package/dist/src/actions/finalize-workspace.d.ts +11 -0
  9. package/dist/src/actions/finalize-workspace.d.ts.map +1 -0
  10. package/dist/src/actions/list-agents.d.ts +11 -0
  11. package/dist/src/actions/list-agents.d.ts.map +1 -0
  12. package/dist/src/actions/manage-issues.d.ts +11 -0
  13. package/dist/src/actions/manage-issues.d.ts.map +1 -0
  14. package/dist/src/actions/provision-workspace.d.ts +11 -0
  15. package/dist/src/actions/provision-workspace.d.ts.map +1 -0
  16. package/dist/src/actions/send-to-agent.d.ts +11 -0
  17. package/dist/src/actions/send-to-agent.d.ts.map +1 -0
  18. package/dist/src/actions/spawn-agent.d.ts +11 -0
  19. package/dist/src/actions/spawn-agent.d.ts.map +1 -0
  20. package/dist/src/actions/start-coding-task.d.ts +17 -0
  21. package/dist/src/actions/start-coding-task.d.ts.map +1 -0
  22. package/dist/src/actions/stop-agent.d.ts +11 -0
  23. package/dist/src/actions/stop-agent.d.ts.map +1 -0
  24. package/dist/src/api/agent-routes.d.ts +18 -0
  25. package/dist/src/api/agent-routes.d.ts.map +1 -0
  26. package/dist/src/api/coordinator-routes.d.ts +22 -0
  27. package/dist/src/api/coordinator-routes.d.ts.map +1 -0
  28. package/dist/src/api/issue-routes.d.ts +17 -0
  29. package/dist/src/api/issue-routes.d.ts.map +1 -0
  30. package/dist/src/api/routes.d.ts +36 -0
  31. package/dist/src/api/routes.d.ts.map +1 -0
  32. package/dist/src/api/workspace-routes.d.ts +17 -0
  33. package/dist/src/api/workspace-routes.d.ts.map +1 -0
  34. package/dist/src/index.d.ts +32 -0
  35. package/dist/src/index.d.ts.map +1 -0
  36. package/dist/src/providers/action-examples.d.ts +13 -0
  37. package/dist/src/providers/action-examples.d.ts.map +1 -0
  38. package/dist/src/providers/active-workspace-context.d.ts +13 -0
  39. package/dist/src/providers/active-workspace-context.d.ts.map +1 -0
  40. package/dist/src/services/agent-metrics.d.ts +28 -0
  41. package/dist/src/services/agent-metrics.d.ts.map +1 -0
  42. package/dist/src/services/agent-selection.d.ts +53 -0
  43. package/dist/src/services/agent-selection.d.ts.map +1 -0
  44. package/dist/src/services/ansi-utils.d.ts +48 -0
  45. package/dist/src/services/ansi-utils.d.ts.map +1 -0
  46. package/dist/src/services/pty-auto-response.d.ts +30 -0
  47. package/dist/src/services/pty-auto-response.d.ts.map +1 -0
  48. package/dist/src/services/pty-init.d.ts +43 -0
  49. package/dist/src/services/pty-init.d.ts.map +1 -0
  50. package/dist/src/services/pty-service.d.ts +92 -0
  51. package/dist/src/services/pty-service.d.ts.map +1 -0
  52. package/dist/src/services/pty-session-io.d.ts +46 -0
  53. package/dist/src/services/pty-session-io.d.ts.map +1 -0
  54. package/dist/src/services/pty-spawn.d.ts +44 -0
  55. package/dist/src/services/pty-spawn.d.ts.map +1 -0
  56. package/dist/src/services/pty-types.d.ts +80 -0
  57. package/dist/src/services/pty-types.d.ts.map +1 -0
  58. package/dist/src/services/stall-classifier.d.ts +44 -0
  59. package/dist/src/services/stall-classifier.d.ts.map +1 -0
  60. package/dist/src/services/swarm-coordinator-prompts.d.ts +61 -0
  61. package/dist/src/services/swarm-coordinator-prompts.d.ts.map +1 -0
  62. package/dist/src/services/swarm-coordinator.d.ts +155 -0
  63. package/dist/src/services/swarm-coordinator.d.ts.map +1 -0
  64. package/dist/src/services/swarm-decision-loop.d.ts +37 -0
  65. package/dist/src/services/swarm-decision-loop.d.ts.map +1 -0
  66. package/dist/src/services/swarm-idle-watchdog.d.ts +22 -0
  67. package/dist/src/services/swarm-idle-watchdog.d.ts.map +1 -0
  68. package/dist/src/services/workspace-git-ops.d.ts +28 -0
  69. package/dist/src/services/workspace-git-ops.d.ts.map +1 -0
  70. package/dist/src/services/workspace-github.d.ts +58 -0
  71. package/dist/src/services/workspace-github.d.ts.map +1 -0
  72. package/dist/src/services/workspace-lifecycle.d.ts +18 -0
  73. package/dist/src/services/workspace-lifecycle.d.ts.map +1 -0
  74. package/dist/src/services/workspace-service.d.ts +84 -0
  75. package/dist/src/services/workspace-service.d.ts.map +1 -0
  76. package/dist/src/services/workspace-types.d.ts +81 -0
  77. package/dist/src/services/workspace-types.d.ts.map +1 -0
  78. package/dist/tsconfig.build.tsbuildinfo +1 -0
  79. package/package.json +66 -0
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Handler logic for the START_CODING_TASK action.
3
+ *
4
+ * - handleMultiAgent() -- Multi-agent mode (pipe-delimited `agents` param)
5
+ * - handleSingleAgent() -- Single-agent mode (standard handler path)
6
+ *
7
+ * @module actions/coding-task-handlers
8
+ */
9
+ import { type ActionResult, type HandlerCallback, type IAgentRuntime, type Memory, type State } from "@elizaos/core";
10
+ import type { AgentCredentials } from "coding-agent-adapters";
11
+ import type { PTYService } from "../services/pty-service.js";
12
+ import { type CodingAgentType } from "../services/pty-types.js";
13
+ import type { CodingWorkspaceService } from "../services/workspace-service.js";
14
+ /** Shared context passed to both multi-agent and single-agent handlers */
15
+ export interface CodingTaskContext {
16
+ runtime: IAgentRuntime;
17
+ ptyService: PTYService;
18
+ wsService: CodingWorkspaceService | undefined;
19
+ credentials: AgentCredentials;
20
+ customCredentials: Record<string, string> | undefined;
21
+ callback: HandlerCallback | undefined;
22
+ message: Memory;
23
+ state: State | undefined;
24
+ repo: string | undefined;
25
+ defaultAgentType: CodingAgentType;
26
+ rawAgentType: string;
27
+ memoryContent: string | undefined;
28
+ approvalPreset: string | undefined;
29
+ explicitLabel: string | undefined;
30
+ }
31
+ /**
32
+ * Multi-agent mode handler.
33
+ *
34
+ * Parses pipe-delimited agent specs and spawns each agent in its own
35
+ * workspace clone (or scratch directory).
36
+ */
37
+ export declare function handleMultiAgent(ctx: CodingTaskContext, agentsParam: string): Promise<ActionResult | undefined>;
38
+ /**
39
+ * Single-agent mode handler.
40
+ *
41
+ * Provisions a workspace (clone or scratch) and spawns a single coding agent.
42
+ */
43
+ export declare function handleSingleAgent(ctx: CodingTaskContext, task: string | undefined): Promise<ActionResult | undefined>;
44
+ //# sourceMappingURL=coding-task-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coding-task-handlers.d.ts","sourceRoot":"","sources":["../../../src/actions/coding-task-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAElB,KAAK,MAAM,EACX,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EACL,KAAK,eAAe,EAKrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAU/E,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC9C,WAAW,EAAE,gBAAgB,CAAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACtD,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,gBAAgB,EAAE,eAAe,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,iBAAiB,EACtB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CA0PnC;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,iBAAiB,EACtB,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAmMnC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Helper functions for the START_CODING_TASK action.
3
+ *
4
+ * - createScratchDir() -- Creates a scratch sandbox directory for non-repo tasks
5
+ * - generateLabel() -- Generate a short semantic label from repo URL and/or task description
6
+ * - registerSessionEvents() -- Register lifecycle event handlers for a spawned session
7
+ *
8
+ * @module actions/coding-task-helpers
9
+ */
10
+ import { type HandlerCallback, type IAgentRuntime } from "@elizaos/core";
11
+ import type { PTYService } from "../services/pty-service.js";
12
+ /** Create a scratch sandbox directory for non-repo tasks */
13
+ export declare function createScratchDir(): string;
14
+ /**
15
+ * Generate a short semantic label from repo URL and/or task description.
16
+ * e.g. "git-workspace-service-testbed/hello-mima" or "scratch/react-research"
17
+ */
18
+ export declare function generateLabel(repo: string | undefined, task: string | undefined): string;
19
+ /**
20
+ * Register lifecycle event handlers for a spawned session.
21
+ *
22
+ * When `coordinatorActive` is true the SwarmCoordinator owns chat messaging
23
+ * and session lifecycle for blocked / task_complete / error events.
24
+ * This listener still handles scratch-dir cleanup regardless.
25
+ */
26
+ export declare function registerSessionEvents(ptyService: PTYService, runtime: IAgentRuntime, sessionId: string, label: string, scratchDir: string | null, callback?: HandlerCallback, coordinatorActive?: boolean): void;
27
+ //# sourceMappingURL=coding-task-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coding-task-helpers.d.ts","sourceRoot":"","sources":["../../../src/actions/coding-task-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAEnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAG7D,4DAA4D;AAC5D,wBAAgB,gBAAgB,IAAI,MAAM,CAMzC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,MAAM,CA4BR;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,QAAQ,CAAC,EAAE,eAAe,EAC1B,iBAAiB,UAAQ,GACxB,IAAI,CAsDN"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * FINALIZE_WORKSPACE action - Commit, push, and create PR for workspace changes
3
+ *
4
+ * Completes a coding task by committing changes, pushing to remote,
5
+ * and optionally creating a pull request.
6
+ *
7
+ * @module actions/finalize-workspace
8
+ */
9
+ import type { Action } from "@elizaos/core";
10
+ export declare const finalizeWorkspaceAction: Action;
11
+ //# sourceMappingURL=finalize-workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finalize-workspace.d.ts","sourceRoot":"","sources":["../../../src/actions/finalize-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,MAAM,EAOP,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,uBAAuB,EAAE,MAgPrC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * LIST_CODING_AGENTS action - List active coding agent sessions
3
+ *
4
+ * Returns information about all running PTY sessions,
5
+ * including their status, agent type, and working directory.
6
+ *
7
+ * @module actions/list-agents
8
+ */
9
+ import type { Action } from "@elizaos/core";
10
+ export declare const listAgentsAction: Action;
11
+ //# sourceMappingURL=list-agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-agents.d.ts","sourceRoot":"","sources":["../../../src/actions/list-agents.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,MAAM,EAOP,MAAM,eAAe,CAAC;AAIvB,eAAO,MAAM,gBAAgB,EAAE,MA6H9B,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * MANAGE_ISSUES action - Create, list, update, and close GitHub issues
3
+ *
4
+ * Provides full issue lifecycle management through the CodingWorkspaceService.
5
+ * Supports creating issues, listing issues, adding comments, closing, and reopening.
6
+ *
7
+ * @module actions/manage-issues
8
+ */
9
+ import type { Action } from "@elizaos/core";
10
+ export declare const manageIssuesAction: Action;
11
+ //# sourceMappingURL=manage-issues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manage-issues.d.ts","sourceRoot":"","sources":["../../../src/actions/manage-issues.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,MAAM,EAOP,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,kBAAkB,EAAE,MAkMhC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * PROVISION_WORKSPACE action - Create a git workspace for coding tasks
3
+ *
4
+ * Clones a repository or creates a worktree for isolated development.
5
+ * Useful for setting up a clean environment before spawning a coding agent.
6
+ *
7
+ * @module actions/provision-workspace
8
+ */
9
+ import type { Action } from "@elizaos/core";
10
+ export declare const provisionWorkspaceAction: Action;
11
+ //# sourceMappingURL=provision-workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provision-workspace.d.ts","sourceRoot":"","sources":["../../../src/actions/provision-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,MAAM,EAOP,MAAM,eAAe,CAAC;AAMvB,eAAO,MAAM,wBAAwB,EAAE,MAiNtC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * SEND_TO_CODING_AGENT action - Send input to a running coding agent
3
+ *
4
+ * Allows sending text or commands to an active PTY session.
5
+ * Useful for responding to prompts, providing feedback, or giving new instructions.
6
+ *
7
+ * @module actions/send-to-agent
8
+ */
9
+ import type { Action } from "@elizaos/core";
10
+ export declare const sendToAgentAction: Action;
11
+ //# sourceMappingURL=send-to-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-to-agent.d.ts","sourceRoot":"","sources":["../../../src/actions/send-to-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,MAAM,EAOP,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,iBAAiB,EAAE,MAiM/B,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * SPAWN_CODING_AGENT action - Spawns a CLI coding agent
3
+ *
4
+ * Creates a new PTY session for a coding agent (Claude Code, Codex, etc.)
5
+ * and returns a session ID for subsequent interactions.
6
+ *
7
+ * @module actions/spawn-agent
8
+ */
9
+ import { type Action } from "@elizaos/core";
10
+ export declare const spawnAgentAction: Action;
11
+ //# sourceMappingURL=spawn-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn-agent.d.ts","sourceRoot":"","sources":["../../../src/actions/spawn-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EACL,KAAK,MAAM,EAQZ,MAAM,eAAe,CAAC;AAavB,eAAO,MAAM,gBAAgB,EAAE,MAyV9B,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * START_CODING_TASK action - Unified action to set up and launch coding agents
3
+ *
4
+ * Combines workspace provisioning and agent spawning into a single atomic action.
5
+ * - If a repo URL is provided, clones it into a fresh workspace
6
+ * - If no repo, creates a scratch sandbox directory
7
+ * - Spawns the specified coding agent(s) in that workspace with the given task
8
+ * - Supports multi-agent mode via pipe-delimited `agents` param
9
+ *
10
+ * This eliminates the need for multi-action chaining (PROVISION_WORKSPACE -> SPAWN_CODING_AGENT)
11
+ * and ensures agents always run in an isolated directory.
12
+ *
13
+ * @module actions/start-coding-task
14
+ */
15
+ import type { Action } from "@elizaos/core";
16
+ export declare const startCodingTaskAction: Action;
17
+ //# sourceMappingURL=start-coding-task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start-coding-task.d.ts","sourceRoot":"","sources":["../../../src/actions/start-coding-task.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,MAAM,EAOP,MAAM,eAAe,CAAC;AAWvB,eAAO,MAAM,qBAAqB,EAAE,MA+NnC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * STOP_CODING_AGENT action - Stop a running coding agent session
3
+ *
4
+ * Terminates an active PTY session. Use when the agent is done,
5
+ * stuck, or needs to be cancelled.
6
+ *
7
+ * @module actions/stop-agent
8
+ */
9
+ import { type Action } from "@elizaos/core";
10
+ export declare const stopAgentAction: Action;
11
+ //# sourceMappingURL=stop-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stop-agent.d.ts","sourceRoot":"","sources":["../../../src/actions/stop-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,MAAM,EAQZ,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,eAAe,EAAE,MA4M7B,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Coding Agent Route Handlers
3
+ *
4
+ * Handles routes for PTY-based coding agent management:
5
+ * - Preflight checks, metrics, workspace files
6
+ * - Approval presets and config
7
+ * - Agent CRUD: list, spawn, get, send, stop, output
8
+ *
9
+ * @module api/agent-routes
10
+ */
11
+ import type { IncomingMessage, ServerResponse } from "node:http";
12
+ import type { RouteContext } from "./routes.js";
13
+ /**
14
+ * Handle coding agent routes (/api/coding-agents/*)
15
+ * Returns true if the route was handled, false otherwise
16
+ */
17
+ export declare function handleAgentRoutes(req: IncomingMessage, res: ServerResponse, pathname: string, ctx: RouteContext): Promise<boolean>;
18
+ //# sourceMappingURL=agent-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-routes.d.ts","sourceRoot":"","sources":["../../../src/api/agent-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AASjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAWhD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,YAAY,GAChB,OAAO,CAAC,OAAO,CAAC,CAwdlB"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Swarm Coordinator Route Handlers
3
+ *
4
+ * Provides SSE streaming and HTTP API for the coordination layer:
5
+ * - SSE event stream for real-time dashboard
6
+ * - Task status and context queries
7
+ * - Pending confirmation management
8
+ * - Supervision level control
9
+ *
10
+ * @module api/coordinator-routes
11
+ */
12
+ import type { IncomingMessage, ServerResponse } from "node:http";
13
+ import type { SwarmCoordinator } from "../services/swarm-coordinator.js";
14
+ import type { RouteContext } from "./routes.js";
15
+ /**
16
+ * Handle coordinator routes (/api/coding-agents/coordinator/*)
17
+ * Returns true if the route was handled, false otherwise.
18
+ */
19
+ export declare function handleCoordinatorRoutes(req: IncomingMessage, res: ServerResponse, pathname: string, ctx: RouteContext & {
20
+ coordinator?: SwarmCoordinator;
21
+ }): Promise<boolean>;
22
+ //# sourceMappingURL=coordinator-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinator-routes.d.ts","sourceRoot":"","sources":["../../../src/api/coordinator-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAahD;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,YAAY,GAAG;IAAE,WAAW,CAAC,EAAE,gBAAgB,CAAA;CAAE,GACrD,OAAO,CAAC,OAAO,CAAC,CAyNlB"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Issue Route Handlers
3
+ *
4
+ * Handles routes for GitHub issue management:
5
+ * - List issues, create issue
6
+ * - Get issue, comment on issue, close issue
7
+ *
8
+ * @module api/issue-routes
9
+ */
10
+ import type { IncomingMessage, ServerResponse } from "node:http";
11
+ import type { RouteContext } from "./routes.js";
12
+ /**
13
+ * Handle issue routes (/api/issues/*)
14
+ * Returns true if the route was handled, false otherwise
15
+ */
16
+ export declare function handleIssueRoutes(req: IncomingMessage, res: ServerResponse, pathname: string, ctx: RouteContext): Promise<boolean>;
17
+ //# sourceMappingURL=issue-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issue-routes.d.ts","sourceRoot":"","sources":["../../../src/api/issue-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAWhD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,YAAY,GAChB,OAAO,CAAC,OAAO,CAAC,CA+JlB"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Coding Agent API Routes — Dispatcher
3
+ *
4
+ * Provides shared helpers (parseBody, sendJson, sendError), types, and the
5
+ * top-level route dispatcher that delegates to domain-specific route modules.
6
+ *
7
+ * @module api/routes
8
+ */
9
+ import type { IncomingMessage, ServerResponse } from "node:http";
10
+ import type { IAgentRuntime } from "@elizaos/core";
11
+ import type { PTYService } from "../services/pty-service.js";
12
+ import type { SwarmCoordinator } from "../services/swarm-coordinator.js";
13
+ import type { CodingWorkspaceService } from "../services/workspace-service.js";
14
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
15
+ [key: string]: JsonValue;
16
+ };
17
+ export interface RouteContext {
18
+ runtime: IAgentRuntime;
19
+ ptyService: PTYService | null;
20
+ workspaceService: CodingWorkspaceService | null;
21
+ coordinator?: SwarmCoordinator;
22
+ }
23
+ export declare const MAX_BODY_SIZE: number;
24
+ export declare function parseBody(req: IncomingMessage): Promise<Record<string, unknown>>;
25
+ export declare function sendJson(res: ServerResponse, data: JsonValue, status?: number): void;
26
+ export declare function sendError(res: ServerResponse, message: string, status?: number): void;
27
+ /**
28
+ * Handle coding agent routes
29
+ * Returns true if the route was handled, false otherwise
30
+ */
31
+ export declare function handleCodingAgentRoutes(req: IncomingMessage, res: ServerResponse, pathname: string, ctx: RouteContext): Promise<boolean>;
32
+ /**
33
+ * Create route handler with services from runtime
34
+ */
35
+ export declare function createCodingAgentRouteHandler(runtime: IAgentRuntime, coordinator?: SwarmCoordinator): (req: IncomingMessage, res: ServerResponse, pathname: string) => Promise<boolean>;
36
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/api/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAM/E,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEjC,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,gBAAgB,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAChD,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAGD,eAAO,MAAM,aAAa,QAAc,CAAC;AAGzC,wBAAsB,SAAS,CAC7B,GAAG,EAAE,eAAe,GACnB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAsBlC;AAGD,wBAAgB,QAAQ,CACtB,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,SAAS,EACf,MAAM,SAAM,GACX,IAAI,CAGN;AAGD,wBAAgB,SAAS,CACvB,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,MAAM,EACf,MAAM,SAAM,GACX,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,YAAY,GAChB,OAAO,CAAC,OAAO,CAAC,CAuBlB;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,aAAa,EACtB,WAAW,CAAC,EAAE,gBAAgB,IAgBtB,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,UAAU,MAAM,sBAEpE"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Workspace Route Handlers
3
+ *
4
+ * Handles routes for git workspace management:
5
+ * - Provision (clone repos, create worktrees)
6
+ * - Get status, commit, push, create PR, delete
7
+ *
8
+ * @module api/workspace-routes
9
+ */
10
+ import type { IncomingMessage, ServerResponse } from "node:http";
11
+ import type { RouteContext } from "./routes.js";
12
+ /**
13
+ * Handle workspace routes (/api/workspace/*)
14
+ * Returns true if the route was handled, false otherwise
15
+ */
16
+ export declare function handleWorkspaceRoutes(req: IncomingMessage, res: ServerResponse, pathname: string, ctx: RouteContext): Promise<boolean>;
17
+ //# sourceMappingURL=workspace-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-routes.d.ts","sourceRoot":"","sources":["../../../src/api/workspace-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAWhD;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,YAAY,GAChB,OAAO,CAAC,OAAO,CAAC,CAkLlB"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Coding Agent Plugin for Milaidy
3
+ *
4
+ * Provides orchestration capabilities for CLI-based coding agents:
5
+ * - PTY session management (spawn, control, monitor coding agents)
6
+ * - Git workspace provisioning (clone, branch, PR creation)
7
+ * - GitHub issue management (create, list, update, close)
8
+ * - Integration with Claude Code, Codex, Gemini CLI, Aider, Pi, etc.
9
+ *
10
+ * @module @milaidy/plugin-coding-agent
11
+ */
12
+ import type { Plugin } from "@elizaos/core";
13
+ export declare const codingAgentPlugin: Plugin;
14
+ export default codingAgentPlugin;
15
+ export type { AdapterType, AgentCredentials, AgentFileDescriptor, ApprovalConfig, ApprovalPreset, PreflightResult, PresetDefinition, RiskLevel, ToolCategory, WriteMemoryOptions, } from "coding-agent-adapters";
16
+ export { finalizeWorkspaceAction } from "./actions/finalize-workspace.js";
17
+ export { listAgentsAction } from "./actions/list-agents.js";
18
+ export { manageIssuesAction } from "./actions/manage-issues.js";
19
+ export { provisionWorkspaceAction } from "./actions/provision-workspace.js";
20
+ export { sendToAgentAction } from "./actions/send-to-agent.js";
21
+ export { spawnAgentAction } from "./actions/spawn-agent.js";
22
+ export { startCodingTaskAction } from "./actions/start-coding-task.js";
23
+ export { stopAgentAction } from "./actions/stop-agent.js";
24
+ export { createCodingAgentRouteHandler, handleCodingAgentRoutes, } from "./api/routes.js";
25
+ export type { CodingAgentType, PTYServiceConfig, SessionEventName, SessionInfo, SpawnSessionOptions, } from "./services/pty-service.js";
26
+ export { getCoordinator, PTYService } from "./services/pty-service.js";
27
+ export type { ChatMessageCallback, CoordinationDecision, PendingDecision, SupervisionLevel, SwarmEvent, TaskContext, WsBroadcastCallback, } from "./services/swarm-coordinator.js";
28
+ export { SwarmCoordinator } from "./services/swarm-coordinator.js";
29
+ export type { CoordinationLLMResponse } from "./services/swarm-coordinator-prompts.js";
30
+ export type { AuthPromptCallback, CodingWorkspaceConfig, CommitOptions, ProvisionWorkspaceOptions, PushOptions, WorkspaceResult, } from "./services/workspace-service.js";
31
+ export { CodingWorkspaceService } from "./services/workspace-service.js";
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAoB5C,eAAO,MAAM,iBAAiB,EAAE,MAsC/B,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAGjC,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvE,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,mBAAmB,GACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,YAAY,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AACvF,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,EACb,yBAAyB,EACzB,WAAW,EACX,eAAe,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Provider that injects structured action call examples into the prompt context.
3
+ *
4
+ * ElizaOS core only shows exampleCalls from its static action-docs registry,
5
+ * which doesn't include custom plugin actions. This provider bridges the gap
6
+ * by formatting our coding agent action examples in the same structured format
7
+ * the model sees for core actions.
8
+ *
9
+ * @module providers/action-examples
10
+ */
11
+ import type { Provider } from "@elizaos/core";
12
+ export declare const codingAgentExamplesProvider: Provider;
13
+ //# sourceMappingURL=action-examples.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-examples.d.ts","sourceRoot":"","sources":["../../../src/providers/action-examples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAyB,QAAQ,EAAS,MAAM,eAAe,CAAC;AAyG5E,eAAO,MAAM,2BAA2B,EAAE,QAsCzC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Provider that injects active workspace and session context into every prompt.
3
+ *
4
+ * Mima needs to know what workspaces exist, which agents are running, and their
5
+ * current status — without having to call LIST_AGENTS every message. This provider
6
+ * reads from both the workspace service and PTY service to build a live context
7
+ * summary that's always available in the prompt.
8
+ *
9
+ * @module providers/active-workspace-context
10
+ */
11
+ import type { Provider } from "@elizaos/core";
12
+ export declare const activeWorkspaceContextProvider: Provider;
13
+ //# sourceMappingURL=active-workspace-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"active-workspace-context.d.ts","sourceRoot":"","sources":["../../../src/providers/active-workspace-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAyB,QAAQ,EAAS,MAAM,eAAe,CAAC;AA2C5E,eAAO,MAAM,8BAA8B,EAAE,QA+H5C,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Lightweight per-agent-type metrics for observability.
3
+ *
4
+ * Self-contained tracker — no dependencies on PTYService state.
5
+ *
6
+ * @module services/agent-metrics
7
+ */
8
+ export interface AgentMetrics {
9
+ spawned: number;
10
+ completed: number;
11
+ completedViaFastPath: number;
12
+ completedViaClassifier: number;
13
+ stallCount: number;
14
+ avgCompletionMs: number;
15
+ totalCompletionMs: number;
16
+ }
17
+ export declare class AgentMetricsTracker {
18
+ private metrics;
19
+ /** Get (or lazily initialize) metrics for a given agent type. */
20
+ get(agentType: string): AgentMetrics;
21
+ /** Record a task completion and update rolling average duration. */
22
+ recordCompletion(agentType: string, method: "fast-path" | "classifier", durationMs: number): void;
23
+ /** Increment the stall counter for an agent type. */
24
+ incrementStalls(agentType: string): void;
25
+ /** Return a serializable copy of all metrics (for API endpoints). */
26
+ getAll(): Record<string, Omit<AgentMetrics, "totalCompletionMs">>;
27
+ }
28
+ //# sourceMappingURL=agent-metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-metrics.d.ts","sourceRoot":"","sources":["../../../src/services/agent-metrics.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,OAAO,CAAwC;IAEvD,iEAAiE;IACjE,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY;IAiBpC,oEAAoE;IACpE,gBAAgB,CACd,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,GAAG,YAAY,EAClC,UAAU,EAAE,MAAM,GACjB,IAAI;IASP,qDAAqD;IACrD,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIxC,qEAAqE;IACrE,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,mBAAmB,CAAC,CAAC;CAQlE"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Dynamic agent selection strategy.
3
+ *
4
+ * Chooses which coding-agent CLI to spawn when the caller does not
5
+ * specify an explicit `agentType`.
6
+ *
7
+ * - **fixed** — always returns `config.fixedAgentType`
8
+ * - **ranked** — scores each installed agent on success rate,
9
+ * stall frequency, and completion speed, then
10
+ * returns the highest-scoring one
11
+ *
12
+ * @module services/agent-selection
13
+ */
14
+ import type { AdapterType, PreflightResult } from "coding-agent-adapters";
15
+ export type AgentSelectionStrategy = "fixed" | "ranked";
16
+ /** Subset of AgentMetrics fields used for scoring. */
17
+ export interface AgentScoreInput {
18
+ spawned: number;
19
+ completed: number;
20
+ stallCount: number;
21
+ avgCompletionMs: number;
22
+ }
23
+ export interface AgentSelectionConfig {
24
+ strategy: AgentSelectionStrategy;
25
+ fixedAgentType: AdapterType;
26
+ }
27
+ export interface AgentSelectionContext {
28
+ config: AgentSelectionConfig;
29
+ /** Per-agent-type metrics snapshot (may be empty). */
30
+ metrics: Record<string, AgentScoreInput>;
31
+ /** Preflight results — only the `installed` ones are candidates. */
32
+ installedAgents: PreflightResult[];
33
+ }
34
+ /**
35
+ * Compute a 0–1 score for a single agent based on its metrics.
36
+ *
37
+ * - `successRate` = completed / spawned (0.5 neutral prior when no data)
38
+ * - `volumeWeight` = min(1, spawned / 5) — blends toward neutral at low N
39
+ * - `stallPenalty` = (stallCount / spawned) * 0.3
40
+ * - `speedPenalty` = min(avgCompletionMs / 300_000, 1) * 0.1 — weak tiebreaker
41
+ *
42
+ * Cold-start (no spawns): returns 0.5 so all agents are equal.
43
+ */
44
+ export declare function computeAgentScore(metrics: AgentScoreInput | undefined): number;
45
+ /**
46
+ * Select the best agent type given the current strategy, metrics, and
47
+ * installed agents.
48
+ *
49
+ * Explicit user choice (`params.agentType`) should be resolved by the
50
+ * caller *before* reaching this function.
51
+ */
52
+ export declare function selectAgentType(ctx: AgentSelectionContext): AdapterType;
53
+ //# sourceMappingURL=agent-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-selection.d.ts","sourceRoot":"","sources":["../../../src/services/agent-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG1E,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAExD,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,cAAc,EAAE,WAAW,CAAC;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACzC,oEAAoE;IACpE,eAAe,EAAE,eAAe,EAAE,CAAC;CACpC;AAID;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,eAAe,GAAG,SAAS,GACnC,MAAM,CAaR;AAOD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,qBAAqB,GAAG,WAAW,CA8BvE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * ANSI/terminal utility functions for processing PTY output.
3
+ *
4
+ * Pure functions — no state, no dependencies beyond the standard library.
5
+ *
6
+ * @module services/ansi-utils
7
+ */
8
+ /**
9
+ * Strip ANSI escape sequences from raw terminal output for readable text.
10
+ * Replaces cursor-forward codes with spaces (TUI uses these instead of actual spaces).
11
+ */
12
+ export declare function stripAnsi(raw: string): string;
13
+ /**
14
+ * Clean terminal output for display in chat messages.
15
+ *
16
+ * Goes beyond {@link stripAnsi} by also removing:
17
+ * - Unicode spinner/box-drawing/decorative characters from CLI TUIs
18
+ * - Lines that are only loading/thinking status text
19
+ * - Spinner status bar metadata (token counts, timing)
20
+ * - Consecutive blank lines (collapsed to one)
21
+ */
22
+ export declare function cleanForChat(raw: string): string;
23
+ /**
24
+ * Extract meaningful artifacts (PR URLs, commit hashes, key results) from raw
25
+ * terminal output. Returns a compact summary suitable for chat messages,
26
+ * without dumping raw TUI output.
27
+ */
28
+ export declare function extractCompletionSummary(raw: string): string;
29
+ /**
30
+ * Extract a dev server URL from recent terminal output, if present.
31
+ *
32
+ * Looks for common patterns like:
33
+ * - http://localhost:3000
34
+ * - http://127.0.0.1:8080
35
+ * - http://0.0.0.0:5173
36
+ * - https://localhost:4200
37
+ *
38
+ * Returns the first match, or null if no dev server URL is found.
39
+ */
40
+ export declare function extractDevServerUrl(raw: string): string | null;
41
+ /**
42
+ * Capture the agent's output since the last task was sent, cleaned for chat display.
43
+ * Returns readable text with TUI noise removed, or empty string if no marker exists.
44
+ *
45
+ * Mutates `markers` by deleting the entry for `sessionId` after capture.
46
+ */
47
+ export declare function captureTaskResponse(sessionId: string, buffers: Map<string, string[]>, markers: Map<string, number>): string;
48
+ //# sourceMappingURL=ansi-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ansi-utils.d.ts","sourceRoot":"","sources":["../../../src/services/ansi-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwCH;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAgBD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAoBhD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAmC5D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO9D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAC9B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,MAAM,CASR"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Auto-response rule management for PTY sessions.
3
+ *
4
+ * Contains logic for pushing default auto-response rules per agent type
5
+ * and handling Gemini authentication flow.
6
+ *
7
+ * @module services/pty-auto-response
8
+ */
9
+ import type { IAgentRuntime } from "@elizaos/core";
10
+ import type { BunCompatiblePTYManager, PTYManager } from "pty-manager";
11
+ export interface AutoResponseContext {
12
+ manager: PTYManager | BunCompatiblePTYManager;
13
+ usingBunWorker: boolean;
14
+ runtime: IAgentRuntime;
15
+ log: (msg: string) => void;
16
+ }
17
+ /**
18
+ * Push session-specific auto-response rules that depend on runtime config.
19
+ * Trust prompts, update notices, and other static rules are handled by
20
+ * adapter built-in rules (coding-agent-adapters). This only pushes rules
21
+ * that need runtime values (e.g. API keys).
22
+ */
23
+ export declare function pushDefaultRules(ctx: AutoResponseContext, sessionId: string, agentType: string): Promise<void>;
24
+ /**
25
+ * Handle Gemini authentication when login_required fires.
26
+ * Sends /auth to start the auth flow — auto-response rules
27
+ * then handle menu selection and API key input.
28
+ */
29
+ export declare function handleGeminiAuth(ctx: AutoResponseContext, sessionId: string, sendKeysToSession: (sessionId: string, keys: string | string[]) => Promise<void>): Promise<void>;
30
+ //# sourceMappingURL=pty-auto-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pty-auto-response.d.ts","sourceRoot":"","sources":["../../../src/services/pty-auto-response.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAEV,uBAAuB,EACvB,UAAU,EACX,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,UAAU,GAAG,uBAAuB,CAAC;IAC9C,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,aAAa,CAAC;IACvB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,mBAAmB,EACxB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAwFf;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,mBAAmB,EACxB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,CACjB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,KACpB,OAAO,CAAC,IAAI,CAAC,GACjB,OAAO,CAAC,IAAI,CAAC,CAwBf"}