paean 0.4.2 → 0.6.2

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 (67) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/dist/cli.js +2 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/worker.d.ts +7 -0
  5. package/dist/commands/worker.d.ts.map +1 -0
  6. package/dist/commands/worker.js +321 -0
  7. package/dist/commands/worker.js.map +1 -0
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +4 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/mcp/system.d.ts +30 -0
  13. package/dist/mcp/system.d.ts.map +1 -0
  14. package/dist/mcp/system.js +530 -0
  15. package/dist/mcp/system.js.map +1 -0
  16. package/dist/mcp/tools.d.ts +1 -1
  17. package/dist/mcp/tools.d.ts.map +1 -1
  18. package/dist/mcp/tools.js +5 -1
  19. package/dist/mcp/tools.js.map +1 -1
  20. package/dist/ui/theme/branding.d.ts.map +1 -1
  21. package/dist/ui/theme/branding.js +2 -7
  22. package/dist/ui/theme/branding.js.map +1 -1
  23. package/dist/worker/executors/claude.d.ts +29 -0
  24. package/dist/worker/executors/claude.d.ts.map +1 -0
  25. package/dist/worker/executors/claude.js +114 -0
  26. package/dist/worker/executors/claude.js.map +1 -0
  27. package/dist/worker/executors/codex.d.ts +29 -0
  28. package/dist/worker/executors/codex.d.ts.map +1 -0
  29. package/dist/worker/executors/codex.js +126 -0
  30. package/dist/worker/executors/codex.js.map +1 -0
  31. package/dist/worker/executors/cursor.d.ts +29 -0
  32. package/dist/worker/executors/cursor.d.ts.map +1 -0
  33. package/dist/worker/executors/cursor.js +136 -0
  34. package/dist/worker/executors/cursor.js.map +1 -0
  35. package/dist/worker/executors/gemini.d.ts +29 -0
  36. package/dist/worker/executors/gemini.d.ts.map +1 -0
  37. package/dist/worker/executors/gemini.js +129 -0
  38. package/dist/worker/executors/gemini.js.map +1 -0
  39. package/dist/worker/executors/index.d.ts +56 -0
  40. package/dist/worker/executors/index.d.ts.map +1 -0
  41. package/dist/worker/executors/index.js +108 -0
  42. package/dist/worker/executors/index.js.map +1 -0
  43. package/dist/worker/executors/internal.d.ts +23 -0
  44. package/dist/worker/executors/internal.d.ts.map +1 -0
  45. package/dist/worker/executors/internal.js +77 -0
  46. package/dist/worker/executors/internal.js.map +1 -0
  47. package/dist/worker/executors/opencode.d.ts +31 -0
  48. package/dist/worker/executors/opencode.d.ts.map +1 -0
  49. package/dist/worker/executors/opencode.js +129 -0
  50. package/dist/worker/executors/opencode.js.map +1 -0
  51. package/dist/worker/index.d.ts +14 -0
  52. package/dist/worker/index.d.ts.map +1 -0
  53. package/dist/worker/index.js +17 -0
  54. package/dist/worker/index.js.map +1 -0
  55. package/dist/worker/service.d.ts +72 -0
  56. package/dist/worker/service.d.ts.map +1 -0
  57. package/dist/worker/service.js +435 -0
  58. package/dist/worker/service.js.map +1 -0
  59. package/dist/worker/supervisor.d.ts +83 -0
  60. package/dist/worker/supervisor.d.ts.map +1 -0
  61. package/dist/worker/supervisor.js +412 -0
  62. package/dist/worker/supervisor.js.map +1 -0
  63. package/dist/worker/types.d.ts +278 -0
  64. package/dist/worker/types.d.ts.map +1 -0
  65. package/dist/worker/types.js +71 -0
  66. package/dist/worker/types.js.map +1 -0
  67. package/package.json +2 -2
@@ -0,0 +1,278 @@
1
+ /**
2
+ * Worker Types
3
+ * Type definitions for the Local Autonomous Worker
4
+ */
5
+ import type { TodoItem } from '../api/todo.js';
6
+ /**
7
+ * Worker configuration options
8
+ */
9
+ export interface WorkerConfig {
10
+ /** Interval between task polling (ms) */
11
+ pollInterval: number;
12
+ /** Maximum retry attempts per task */
13
+ maxRetries: number;
14
+ /** Timeout for single task execution (ms) */
15
+ taskTimeout: number;
16
+ /** Cooldown period after error (ms) */
17
+ cooldownOnError: number;
18
+ /** Enable verification step after task completion */
19
+ verificationEnabled: boolean;
20
+ /** Working directory for agent execution */
21
+ workingDirectory?: string;
22
+ /** Enable debug logging */
23
+ debug?: boolean;
24
+ /** Autonomous mode (auto-execute whitelisted commands) */
25
+ autonomousMode?: boolean;
26
+ }
27
+ /**
28
+ * Default worker configuration
29
+ */
30
+ export declare const DEFAULT_WORKER_CONFIG: WorkerConfig;
31
+ /**
32
+ * Task execution context
33
+ */
34
+ export interface TaskContext {
35
+ /** The task being executed */
36
+ task: TodoItem;
37
+ /** Current attempt number (1-based) */
38
+ attempt: number;
39
+ /** Summary from previous failure (for retry context) */
40
+ previousFailureSummary?: string;
41
+ /** Timestamp when task execution started */
42
+ startedAt: Date;
43
+ /** Conversation ID for agent session */
44
+ conversationId?: string;
45
+ }
46
+ /**
47
+ * Worker execution state
48
+ */
49
+ export type WorkerStatus = 'idle' | 'running' | 'paused' | 'stopping' | 'error';
50
+ /**
51
+ * Worker state snapshot
52
+ */
53
+ export interface WorkerState {
54
+ /** Current worker status */
55
+ status: WorkerStatus;
56
+ /** Currently executing task context */
57
+ currentTask?: TaskContext;
58
+ /** Number of successfully completed tasks */
59
+ completedCount: number;
60
+ /** Number of failed tasks (after all retries) */
61
+ failedCount: number;
62
+ /** Timestamp when worker started */
63
+ startedAt?: Date;
64
+ /** Last error message */
65
+ lastError?: string;
66
+ /** Last poll timestamp */
67
+ lastPollAt?: Date;
68
+ }
69
+ /**
70
+ * Task execution result
71
+ */
72
+ export interface TaskResult {
73
+ success: boolean;
74
+ message?: string;
75
+ verificationPassed?: boolean;
76
+ error?: string;
77
+ durationMs?: number;
78
+ }
79
+ /**
80
+ * Worker event types
81
+ */
82
+ export type WorkerEvent = {
83
+ type: 'started';
84
+ } | {
85
+ type: 'stopped';
86
+ } | {
87
+ type: 'paused';
88
+ } | {
89
+ type: 'resumed';
90
+ } | {
91
+ type: 'task_claimed';
92
+ task: TodoItem;
93
+ } | {
94
+ type: 'task_started';
95
+ task: TodoItem;
96
+ attempt: number;
97
+ } | {
98
+ type: 'task_completed';
99
+ task: TodoItem;
100
+ duration: number;
101
+ } | {
102
+ type: 'task_failed';
103
+ task: TodoItem;
104
+ error: string;
105
+ willRetry: boolean;
106
+ } | {
107
+ type: 'task_verification_failed';
108
+ task: TodoItem;
109
+ } | {
110
+ type: 'poll_empty';
111
+ } | {
112
+ type: 'error';
113
+ error: string;
114
+ };
115
+ /**
116
+ * Worker event handler
117
+ */
118
+ export type WorkerEventHandler = (event: WorkerEvent) => void;
119
+ /**
120
+ * Executor types for multi-agent dispatch
121
+ */
122
+ export type ExecutorType = 'internal' | 'claude' | 'gemini' | 'cursor' | 'codex' | 'opencode' | 'shell';
123
+ /**
124
+ * Executor configuration
125
+ */
126
+ export interface ExecutorConfig {
127
+ type: ExecutorType;
128
+ enabled: boolean;
129
+ /** Custom binary path */
130
+ path?: string;
131
+ /** Default CLI arguments */
132
+ defaultArgs?: string[];
133
+ /** Override default timeout (ms) */
134
+ timeout?: number;
135
+ }
136
+ /**
137
+ * Executor execution options
138
+ */
139
+ export interface ExecutorOptions {
140
+ /** Working directory */
141
+ cwd?: string;
142
+ /** Execution timeout (ms) */
143
+ timeout?: number;
144
+ /** Additional CLI arguments */
145
+ args?: string[];
146
+ /** Environment variables */
147
+ env?: Record<string, string>;
148
+ /** Skip permission prompts (dangerous mode) */
149
+ skipPermissions?: boolean;
150
+ /** Capture output for parsing */
151
+ captureOutput?: boolean;
152
+ /** Real-time output callback for streaming display */
153
+ onOutput?: (text: string, stream: 'stdout' | 'stderr') => void;
154
+ /** Progress message callback */
155
+ onProgress?: (message: string) => void;
156
+ }
157
+ /**
158
+ * Executor execution result
159
+ */
160
+ export interface ExecutorResult {
161
+ success: boolean;
162
+ output: string;
163
+ error?: string;
164
+ exitCode?: number;
165
+ durationMs: number;
166
+ /** Parsed structured output if available */
167
+ structured?: Record<string, unknown>;
168
+ }
169
+ /**
170
+ * Supervisor decision for task routing
171
+ */
172
+ export interface SupervisorDecision {
173
+ /** Selected executor for the task */
174
+ selectedExecutor: ExecutorType;
175
+ /** Confidence score (0-1) */
176
+ confidence: number;
177
+ /** Reasoning for the selection */
178
+ reasoning: string;
179
+ /** Groomed/structured prompt for the executor */
180
+ groomedPrompt: string;
181
+ /** Subtasks for complex task breakdown */
182
+ subtasks?: string[];
183
+ /** Suggested verification strategy */
184
+ verificationStrategy?: 'test' | 'lint' | 'build' | 'diff' | 'manual' | 'none';
185
+ /** Task tags for routing hints */
186
+ tags?: string[];
187
+ }
188
+ /**
189
+ * Verification result from semantic analysis
190
+ */
191
+ export interface VerificationResult {
192
+ passed: boolean;
193
+ /** Confidence in the verification (0-1) */
194
+ confidence: number;
195
+ /** Summary of what was verified */
196
+ summary: string;
197
+ /** Specific issues found */
198
+ issues?: string[];
199
+ /** Suggestions for improvement */
200
+ suggestions?: string[];
201
+ }
202
+ /**
203
+ * Recovery strategy after task failure
204
+ */
205
+ export interface RecoveryStrategy {
206
+ /** Recommended action */
207
+ action: 'retry' | 'switch_executor' | 'split_task' | 'escalate' | 'abort';
208
+ /** Target executor if switching */
209
+ targetExecutor?: ExecutorType;
210
+ /** Modified prompt for retry */
211
+ modifiedPrompt?: string;
212
+ /** Subtasks if splitting */
213
+ subtasks?: string[];
214
+ /** Reason for the recommendation */
215
+ reason: string;
216
+ }
217
+ /**
218
+ * Prompt command options
219
+ */
220
+ export interface PromptCommandOptions {
221
+ /** Natural language prompt */
222
+ prompt: string;
223
+ /** Force specific executor */
224
+ executor?: ExecutorType;
225
+ /** Skip confirmation prompts */
226
+ autoApprove?: boolean;
227
+ /** Show plan without execution */
228
+ dryRun?: boolean;
229
+ /** Enable verbose logging */
230
+ verbose?: boolean;
231
+ /** Working directory */
232
+ workspace?: string;
233
+ /** Create as persistent task */
234
+ createTask?: boolean;
235
+ /** Task priority if creating */
236
+ priority?: 'high' | 'medium' | 'low';
237
+ }
238
+ /**
239
+ * Prompt execution result
240
+ */
241
+ export interface PromptResult {
242
+ success: boolean;
243
+ /** Supervisor decision */
244
+ decision: SupervisorDecision;
245
+ /** Execution result if executed */
246
+ execution?: ExecutorResult;
247
+ /** Created task ID if applicable */
248
+ taskId?: string;
249
+ /** Total duration */
250
+ durationMs: number;
251
+ }
252
+ /**
253
+ * Extended worker configuration with executor support
254
+ */
255
+ export interface WorkerExecutorConfig {
256
+ /** Default executor to use */
257
+ defaultExecutor: ExecutorType;
258
+ /** Per-executor configurations */
259
+ executors: Partial<Record<ExecutorType, ExecutorConfig>>;
260
+ /** Supervisor configuration */
261
+ supervisor: {
262
+ /** LLM model for supervisor */
263
+ model?: string;
264
+ /** Use cloud-based supervisor */
265
+ cloudEnabled?: boolean;
266
+ /** Auto-approve executor switches */
267
+ autoSwitch?: boolean;
268
+ };
269
+ }
270
+ /**
271
+ * Default executor configuration
272
+ */
273
+ export declare const DEFAULT_EXECUTOR_CONFIG: WorkerExecutorConfig;
274
+ /**
275
+ * Prompt template for autonomous task execution
276
+ */
277
+ export declare function buildTaskPrompt(ctx: TaskContext): string;
278
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/worker/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,eAAe,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0DAA0D;IAC1D,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAOnC,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AAM,CAAC;IAChB,qBAAqB;IACrB,UAAU,EAAE,MAAM,CAAC;CACtB;AAMD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,8BAA8B;IAC9B,eAAe,EAAE,YAAY,CAAC;IAC9B,kCAAkC;IAClC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;IACzD,+BAA+B;IAC/B,UAAU,EAAE;QACR,+BAA+B;QAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,iCAAiC;QACjC,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,qCAAqC;QACrC,UAAU,CAAC,EAAE,OAAO,CAAC;KACxB,CAAC;CACL;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,oBAcrC,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CAmCxD"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Worker Types
3
+ * Type definitions for the Local Autonomous Worker
4
+ */
5
+ /**
6
+ * Default worker configuration
7
+ */
8
+ export const DEFAULT_WORKER_CONFIG = {
9
+ pollInterval: 30000, // 30 seconds
10
+ maxRetries: 3,
11
+ taskTimeout: 600000, // 10 minutes
12
+ cooldownOnError: 60000, // 1 minute
13
+ verificationEnabled: true,
14
+ autonomousMode: true,
15
+ };
16
+ /**
17
+ * Default executor configuration
18
+ */
19
+ export const DEFAULT_EXECUTOR_CONFIG = {
20
+ defaultExecutor: 'internal',
21
+ executors: {
22
+ internal: { type: 'internal', enabled: true },
23
+ claude: { type: 'claude', enabled: true, timeout: 900000 },
24
+ gemini: { type: 'gemini', enabled: true, timeout: 600000 },
25
+ cursor: { type: 'cursor', enabled: true, timeout: 600000 },
26
+ codex: { type: 'codex', enabled: true, timeout: 600000 },
27
+ opencode: { type: 'opencode', enabled: true, timeout: 600000 },
28
+ },
29
+ supervisor: {
30
+ cloudEnabled: true,
31
+ autoSwitch: false,
32
+ },
33
+ };
34
+ /**
35
+ * Prompt template for autonomous task execution
36
+ */
37
+ export function buildTaskPrompt(ctx) {
38
+ const basePrompt = `You are an autonomous coding agent. Execute the following task completely.
39
+
40
+ ## Task
41
+ ID: ${ctx.task.id}
42
+ Content: ${ctx.task.content}
43
+ Priority: ${ctx.task.priority}
44
+ ${ctx.task.description ? `\nDescription: ${ctx.task.description}` : ''}
45
+ ${ctx.task.tags?.length ? `\nTags: ${ctx.task.tags.join(', ')}` : ''}
46
+
47
+ ## Instructions
48
+ 1. Analyze the task requirements
49
+ 2. Plan your approach
50
+ 3. Execute the necessary steps using available tools
51
+ 4. Verify your changes work correctly
52
+ 5. When complete, call paean_complete_task with the task ID
53
+
54
+ ## Important
55
+ - Use local MCP tools for file operations and shell commands
56
+ - Run tests to verify your changes when applicable
57
+ - If you encounter errors, try to fix them before giving up
58
+ - Call paean_complete_task when the task is fully done
59
+ `;
60
+ if (ctx.attempt > 1 && ctx.previousFailureSummary) {
61
+ return `${basePrompt}
62
+
63
+ ## Previous Attempt Failed (Attempt ${ctx.attempt}/${3})
64
+ ${ctx.previousFailureSummary}
65
+
66
+ Please review the previous failure and try a different approach.
67
+ `;
68
+ }
69
+ return basePrompt;
70
+ }
71
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/worker/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA0BH;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IAC/C,YAAY,EAAE,KAAK,EAAQ,aAAa;IACxC,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,MAAM,EAAQ,aAAa;IACxC,eAAe,EAAE,KAAK,EAAK,WAAW;IACtC,mBAAmB,EAAE,IAAI;IACzB,cAAc,EAAE,IAAI;CACvB,CAAC;AAmQF;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAyB;IACzD,eAAe,EAAE,UAAU;IAC3B,SAAS,EAAE;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QAChD,OAAO,GAAG,UAAU;;sCAEU,GAAG,CAAC,OAAO,IAAI,CAAC;EACpD,GAAG,CAAC,sBAAsB;;;CAG3B,CAAC;IACE,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paean",
3
- "version": "0.4.2",
4
- "description": "Paean AI CLI - Claude Code-like AI agent with local MCP integration and task management",
3
+ "version": "0.6.2",
4
+ "description": "Paean AI CLI - Claude Code-like AI agent with local MCP integration, task management, and autonomous worker mode",
5
5
  "author": "Paean AI <dev@paean.ai>",
6
6
  "license": "MIT",
7
7
  "type": "module",