@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
package/README.md ADDED
@@ -0,0 +1,169 @@
1
+ # @milaidy/plugin-coding-agent
2
+
3
+ Orchestrate CLI-based coding agents (Claude Code, Codex, Gemini CLI, Aider, Pi) via PTY sessions and manage git workspaces for autonomous coding tasks.
4
+
5
+ ## Features
6
+
7
+ - **PTY Session Management**: Spawn, control, and monitor coding agents running in pseudo-terminals
8
+ - **Git Workspace Provisioning**: Clone repos, create worktrees, manage branches
9
+ - **PR Workflow**: Commit changes, push to remote, create pull requests
10
+ - **Multi-Agent Support**: Claude Code, Codex, Gemini CLI, Aider, Pi, or generic shell
11
+
12
+ ## Installation
13
+
14
+ This plugin is part of the Milaidy monorepo. It requires the following peer dependencies:
15
+
16
+ ```bash
17
+ pnpm add pty-manager git-workspace-service
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ### Register the Plugin
23
+
24
+ ```typescript
25
+ import { codingAgentPlugin } from "@milaidy/plugin-coding-agent";
26
+
27
+ // Add to your ElizaOS agent configuration
28
+ const agent = {
29
+ plugins: [codingAgentPlugin],
30
+ // ... other config
31
+ };
32
+ ```
33
+
34
+ ### Actions
35
+
36
+ #### PTY Session Management
37
+
38
+ | Action | Description |
39
+ |--------|-------------|
40
+ | `SPAWN_CODING_AGENT` | Spawn a new coding agent session |
41
+ | `SEND_TO_CODING_AGENT` | Send input or keys to a running agent |
42
+ | `STOP_CODING_AGENT` | Terminate an agent session |
43
+ | `LIST_CODING_AGENTS` | List all active sessions |
44
+
45
+ #### Workspace Management
46
+
47
+ | Action | Description |
48
+ |--------|-------------|
49
+ | `PROVISION_WORKSPACE` | Clone a repo or create a worktree |
50
+ | `FINALIZE_WORKSPACE` | Commit, push, and optionally create PR |
51
+
52
+ ### Example Conversation
53
+
54
+ ```
55
+ User: Spawn Claude Code to fix the auth bug in src/auth.ts
56
+ Agent: Starting claude-code agent in /workspace...
57
+ Session ID: abc123, Status: running
58
+
59
+ User: What coding agents are running?
60
+ Agent: Active sessions:
61
+ 1. claude-code (abc123...) - running
62
+ Working in: /workspace
63
+
64
+ User: Tell it to accept the changes
65
+ Agent: Sent "y" to coding agent.
66
+
67
+ User: Create a PR for the fix
68
+ Agent: Workspace finalized!
69
+ Commit: a1b2c3d4
70
+ PR #42: https://github.com/user/repo/pull/42
71
+ ```
72
+
73
+ ## Services
74
+
75
+ ### PTYService
76
+
77
+ Manages PTY sessions for coding agents.
78
+
79
+ ```typescript
80
+ import { PTYService } from "@milaidy/plugin-coding-agent";
81
+
82
+ // Access via runtime
83
+ const ptyService = runtime.getService("PTY_SERVICE") as PTYService;
84
+
85
+ // Spawn a session
86
+ const session = await ptyService.spawnSession({
87
+ agentType: "claude-code",
88
+ workdir: "/path/to/project",
89
+ initialTask: "Fix the auth bug",
90
+ });
91
+
92
+ // Send input
93
+ await ptyService.sendToSession(session.id, "y");
94
+
95
+ // Check status
96
+ const info = ptyService.getSession(session.id);
97
+ console.log(info.status); // "running" | "blocked" | "completed"
98
+
99
+ // Stop session
100
+ await ptyService.stopSession(session.id);
101
+ ```
102
+
103
+ ### CodingWorkspaceService
104
+
105
+ Manages git workspaces for coding tasks.
106
+
107
+ ```typescript
108
+ import { CodingWorkspaceService } from "@milaidy/plugin-coding-agent";
109
+
110
+ // Access via runtime
111
+ const workspaceService = runtime.getService("CODING_WORKSPACE_SERVICE");
112
+
113
+ // Clone a repo
114
+ const workspace = await workspaceService.provisionWorkspace({
115
+ repoUrl: "https://github.com/user/repo.git",
116
+ branch: "feature/my-feature",
117
+ });
118
+
119
+ // Create worktree for parallel work
120
+ const worktree = await workspaceService.provisionWorkspace({
121
+ useWorktree: true,
122
+ parentWorkspaceId: workspace.id,
123
+ branch: "bugfix/issue-123",
124
+ });
125
+
126
+ // Commit and push
127
+ await workspaceService.commit(workspace.id, {
128
+ message: "fix: resolve auth issue",
129
+ all: true,
130
+ });
131
+ await workspaceService.push(workspace.id, { setUpstream: true });
132
+
133
+ // Create PR
134
+ const pr = await workspaceService.createPR(workspace.id, {
135
+ title: "Fix auth issue",
136
+ body: "Resolves #123",
137
+ });
138
+ ```
139
+
140
+ ## Configuration
141
+
142
+ Configure via runtime settings:
143
+
144
+ ```typescript
145
+ // PTY Service config
146
+ runtime.setSetting("PTY_SERVICE_CONFIG", {
147
+ maxSessions: 5,
148
+ idleTimeoutMs: 30 * 60 * 1000,
149
+ debug: true,
150
+ });
151
+
152
+ // Workspace Service config
153
+ runtime.setSetting("CODING_WORKSPACE_CONFIG", {
154
+ baseDir: "~/.milaidy/workspaces",
155
+ credentials: {
156
+ github: { token: process.env.GITHUB_TOKEN },
157
+ },
158
+ debug: true,
159
+ });
160
+ ```
161
+
162
+ ## Dependencies
163
+
164
+ - `pty-manager` - PTY session management with adapter pattern
165
+ - `git-workspace-service` - Git workspace provisioning and PR creation
166
+
167
+ ## License
168
+
169
+ MIT