@ebowwa/daemons 0.5.1 → 0.7.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 (121) hide show
  1. package/dist/core.d.ts +89 -0
  2. package/dist/core.d.ts.map +1 -0
  3. package/dist/core.js +346 -0
  4. package/dist/core.js.map +1 -0
  5. package/dist/index.d.ts +16 -17
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +25 -125305
  8. package/dist/index.js.map +1 -0
  9. package/dist/types.d.ts +28 -273
  10. package/dist/types.d.ts.map +1 -1
  11. package/dist/types.js +7 -0
  12. package/dist/types.js.map +1 -0
  13. package/package.json +14 -65
  14. package/src/core.ts +476 -0
  15. package/src/index.ts +23 -101
  16. package/src/types.ts +24 -301
  17. package/dist/agent.d.ts +0 -37
  18. package/dist/agent.d.ts.map +0 -1
  19. package/dist/bin/discord-cli.js +0 -124083
  20. package/dist/bin/manager.js +0 -143
  21. package/dist/bin/telegram-cli.js +0 -124079
  22. package/dist/channels/base.d.ts +0 -163
  23. package/dist/channels/base.d.ts.map +0 -1
  24. package/dist/channels/discord.d.ts +0 -61
  25. package/dist/channels/discord.d.ts.map +0 -1
  26. package/dist/channels/index.d.ts +0 -55
  27. package/dist/channels/index.d.ts.map +0 -1
  28. package/dist/channels/telegram.d.ts +0 -113
  29. package/dist/channels/telegram.d.ts.map +0 -1
  30. package/dist/daemon.d.ts +0 -119
  31. package/dist/daemon.d.ts.map +0 -1
  32. package/dist/hooks.d.ts +0 -34
  33. package/dist/hooks.d.ts.map +0 -1
  34. package/dist/memory.d.ts +0 -151
  35. package/dist/memory.d.ts.map +0 -1
  36. package/dist/skills/coding/commit.d.ts +0 -31
  37. package/dist/skills/coding/commit.d.ts.map +0 -1
  38. package/dist/skills/coding/execute-subtask.d.ts +0 -30
  39. package/dist/skills/coding/execute-subtask.d.ts.map +0 -1
  40. package/dist/skills/coding/fix-issues.d.ts +0 -29
  41. package/dist/skills/coding/fix-issues.d.ts.map +0 -1
  42. package/dist/skills/coding/index.d.ts +0 -21
  43. package/dist/skills/coding/index.d.ts.map +0 -1
  44. package/dist/skills/coding/plan-task.d.ts +0 -38
  45. package/dist/skills/coding/plan-task.d.ts.map +0 -1
  46. package/dist/skills/coding/quality-check.d.ts +0 -35
  47. package/dist/skills/coding/quality-check.d.ts.map +0 -1
  48. package/dist/skills/index.d.ts +0 -38
  49. package/dist/skills/index.d.ts.map +0 -1
  50. package/dist/skills/registry.d.ts +0 -95
  51. package/dist/skills/registry.d.ts.map +0 -1
  52. package/dist/skills/shared/index.d.ts +0 -16
  53. package/dist/skills/shared/index.d.ts.map +0 -1
  54. package/dist/skills/shared/reflect.d.ts +0 -42
  55. package/dist/skills/shared/reflect.d.ts.map +0 -1
  56. package/dist/skills/shared/review.d.ts +0 -42
  57. package/dist/skills/shared/review.d.ts.map +0 -1
  58. package/dist/skills/shared/trajectory.d.ts +0 -80
  59. package/dist/skills/shared/trajectory.d.ts.map +0 -1
  60. package/dist/skills/trading/analyze-market.d.ts +0 -43
  61. package/dist/skills/trading/analyze-market.d.ts.map +0 -1
  62. package/dist/skills/trading/check-risk.d.ts +0 -33
  63. package/dist/skills/trading/check-risk.d.ts.map +0 -1
  64. package/dist/skills/trading/execute-trade.d.ts +0 -38
  65. package/dist/skills/trading/execute-trade.d.ts.map +0 -1
  66. package/dist/skills/trading/generate-signal.d.ts +0 -57
  67. package/dist/skills/trading/generate-signal.d.ts.map +0 -1
  68. package/dist/skills/trading/index.d.ts +0 -21
  69. package/dist/skills/trading/index.d.ts.map +0 -1
  70. package/dist/skills/trading/monitor-position.d.ts +0 -37
  71. package/dist/skills/trading/monitor-position.d.ts.map +0 -1
  72. package/dist/skills/types.d.ts +0 -173
  73. package/dist/skills/types.d.ts.map +0 -1
  74. package/dist/skills/workflows.d.ts +0 -36
  75. package/dist/skills/workflows.d.ts.map +0 -1
  76. package/dist/state.d.ts +0 -31
  77. package/dist/state.d.ts.map +0 -1
  78. package/dist/tools.d.ts +0 -42
  79. package/dist/tools.d.ts.map +0 -1
  80. package/dist/workflow.d.ts +0 -182
  81. package/dist/workflow.d.ts.map +0 -1
  82. package/dist/workflows/coding.d.ts +0 -79
  83. package/dist/workflows/coding.d.ts.map +0 -1
  84. package/dist/workflows/index.d.ts +0 -24
  85. package/dist/workflows/index.d.ts.map +0 -1
  86. package/dist/workflows/trading.d.ts +0 -72
  87. package/dist/workflows/trading.d.ts.map +0 -1
  88. package/src/agent.ts +0 -111
  89. package/src/channels/base.ts +0 -574
  90. package/src/channels/discord.ts +0 -306
  91. package/src/channels/index.ts +0 -169
  92. package/src/channels/telegram.ts +0 -316
  93. package/src/daemon.ts +0 -534
  94. package/src/hooks.ts +0 -97
  95. package/src/memory.ts +0 -369
  96. package/src/skills/coding/commit.ts +0 -202
  97. package/src/skills/coding/execute-subtask.ts +0 -136
  98. package/src/skills/coding/fix-issues.ts +0 -126
  99. package/src/skills/coding/index.ts +0 -26
  100. package/src/skills/coding/plan-task.ts +0 -158
  101. package/src/skills/coding/quality-check.ts +0 -155
  102. package/src/skills/index.ts +0 -65
  103. package/src/skills/registry.ts +0 -380
  104. package/src/skills/shared/index.ts +0 -21
  105. package/src/skills/shared/reflect.ts +0 -156
  106. package/src/skills/shared/review.ts +0 -201
  107. package/src/skills/shared/trajectory.ts +0 -326
  108. package/src/skills/trading/analyze-market.ts +0 -144
  109. package/src/skills/trading/check-risk.ts +0 -176
  110. package/src/skills/trading/execute-trade.ts +0 -185
  111. package/src/skills/trading/generate-signal.ts +0 -160
  112. package/src/skills/trading/index.ts +0 -26
  113. package/src/skills/trading/monitor-position.ts +0 -179
  114. package/src/skills/types.ts +0 -235
  115. package/src/skills/workflows.ts +0 -340
  116. package/src/state.ts +0 -77
  117. package/src/tools.ts +0 -134
  118. package/src/workflow.ts +0 -341
  119. package/src/workflows/coding.ts +0 -580
  120. package/src/workflows/index.ts +0 -61
  121. package/src/workflows/trading.ts +0 -608
package/src/types.ts CHANGED
@@ -1,314 +1,37 @@
1
1
  /**
2
- * GLM Daemon - Core Types
2
+ * Daemons - Core Types
3
3
  *
4
- * Autonomous AI daemon powered by GLM 4.7 with hooks, tools, and teammates.
5
- * Based on Ralph Iterative's SLAM pattern (State → Loop → Action → Memory).
4
+ * Minimal types for DaemonCore and VPSDaemon.
6
5
  */
7
6
 
8
- import type { Team } from "@ebowwa/teammates";
7
+ // ============================================================
8
+ // Generic Daemon Types
9
+ // ============================================================
9
10
 
10
- /**
11
- * GLM Daemon state phases (SLAM pattern)
12
- * @deprecated Skills now use string IDs directly (e.g., "/plan-task")
13
- */
14
- export const GLM_PHASES = {
15
- planning: "planning",
16
- executing: "executing",
17
- reflecting: "reflecting", // Checkpoint after N tools
18
- paranoid: "paranoid",
19
- reviewing: "reviewing",
20
- fixing: "fixing",
21
- committing: "committing",
22
- complete: "complete",
23
- } as const;
24
-
25
- /**
26
- * Legacy phase type for backwards compatibility
27
- * @deprecated Skills now use string IDs (e.g., "/plan-task", "/execute-subtask")
28
- */
29
- export type GLMPhase = keyof typeof GLM_PHASES;
30
-
31
- /**
32
- * GLM Daemon configuration
33
- */
34
- export interface GLMDaemonConfig {
35
- /** Team name for multi-agent coordination */
36
- teamName: string;
37
-
38
- /** GLM model to use */
39
- model?: string;
40
-
41
- /** Working directory */
42
- cwd: string;
11
+ export type DaemonStatus = "starting" | "running" | "stopping" | "stopped" | "error";
43
12
 
44
- /** Enable automatic commits */
45
- autoCommit?: boolean;
46
-
47
- /** Enable automatic PR creation */
48
- autoPR?: boolean;
49
-
50
- /** Base branch for PRs */
51
- baseBranch?: string;
52
-
53
- /** Maximum iterations (0 = unlimited) */
54
- maxIterations?: number;
55
-
56
- /** Completion promise text */
57
- completionPromise?: string;
58
-
59
- /** Hooks configuration */
60
- hooks?: GLMHooksConfig;
61
-
62
- /** Tools configuration */
63
- tools?: GLMToolsConfig;
64
-
65
- /** Reflection checkpoint configuration */
66
- reflection?: GLMReflectionConfig;
67
- }
68
-
69
- /**
70
- * GLM Daemon state (persisted to disk)
71
- */
72
- export interface GLMDaemonState {
73
- /** Original prompt/task */
74
- prompt: string;
75
-
76
- /** Completion promise (when to stop) */
77
- promise: string;
78
-
79
- /** Current iteration */
80
- iteration: number;
81
-
82
- /** Maximum iterations */
83
- maxIterations: number;
84
-
85
- /** Start timestamp */
86
- startTime: string;
87
-
88
- /** Last update timestamp */
89
- lastUpdate: string;
90
-
91
- /** Token usage tracking */
92
- tokens: {
93
- totalInput: number;
94
- totalOutput: number;
95
- byIteration: Array<{
96
- iteration: number;
97
- input: number;
98
- output: number;
99
- }>;
100
- };
101
-
102
- /** Files changed in this session */
103
- filesChanged: string[];
104
-
105
- /** Working memory */
106
- workMemory: {
107
- completedFiles: string[];
108
- fileChecksums: Record<string, string>;
109
- };
110
-
111
- /** SLAM state */
112
- slam: {
113
- enabled: boolean;
114
- /** Current skill ID (e.g., "/plan-task", "/execute-subtask") or legacy phase */
115
- phase: string;
116
- /** Previous phase/skill (used to return after reflection) */
117
- previousPhase?: string;
118
- state: {
119
- currentTask: string;
120
- beliefs: Record<string, unknown>;
121
- goals: string[];
122
- };
123
- subtasks: GLMSubtask[];
124
- currentSubtask: string | null;
125
- completedSubtasks: string[];
126
- memory: {
127
- actionsTaken: string[];
128
- outcomes: Record<string, unknown>;
129
- patterns: Record<string, unknown>;
130
- };
131
- };
132
-
133
- /** Git configuration */
134
- git: {
135
- enabled: boolean;
136
- autoCommit: boolean;
137
- autoPR: boolean;
138
- baseBranch: string;
139
- branchName: string;
140
- branchCreated: boolean;
141
- currentCommit: string;
142
- };
143
-
144
- /** Reflection checkpoint state */
145
- reflection: {
146
- /** Current tool call count in this chunk */
147
- toolCount: number;
148
- /** Total tool calls across all chunks */
149
- totalToolCount: number;
150
- /** Number of reflection checkpoints completed */
151
- checkpointCount: number;
152
- /** Timestamp of last reflection */
153
- lastReflection: string | null;
154
- /** Accumulated TL;DR summaries */
155
- summaries: GLMReflectionSummary[];
156
- };
157
-
158
- /** Machine info */
159
- machine?: {
160
- cpu: { count: number; model: string; tier: string };
161
- memory: { total: number; free: number; tier: string };
162
- disk: { total: number; available: number; tier: string };
163
- platform: { os: string; arch: string; isContainer: boolean };
164
- capacity: string;
165
- score: number;
166
- };
167
- }
168
-
169
- /**
170
- * GLM Subtask (for SLAM coordination)
171
- */
172
- export interface GLMSubtask {
13
+ export interface Channel {
173
14
  id: string;
174
- title: string;
175
- description: string;
176
- status: "pending" | "in_progress" | "completed" | "blocked" | "failed";
177
- assignedTo?: string;
178
- dependencies?: string[];
179
- result?: unknown;
15
+ type: string;
16
+ start(): Promise<void>;
17
+ stop(): Promise<void>;
18
+ isRunning(): boolean;
19
+ send?(message: unknown): Promise<unknown>;
20
+ onMessage(handler: (msg: unknown) => Promise<void>): void;
180
21
  }
181
22
 
182
- /**
183
- * GLM Hooks configuration
184
- */
185
- export interface GLMHooksConfig {
186
- onSessionStart?: (state: GLMDaemonState) => Promise<void>;
187
- onSessionEnd?: (state: GLMDaemonState) => Promise<void>;
188
- onPreToolUse?: (tool: string, args: unknown) => Promise<boolean>;
189
- onPostToolUse?: (tool: string, args: unknown, result: unknown) => Promise<void>;
190
- onSubagentStart?: (subagentId: string) => Promise<void>;
191
- onSubagentStop?: (subagentId: string, result: unknown) => Promise<void>;
192
- onIterationStart?: (iteration: number) => Promise<void>;
193
- onIterationEnd?: (iteration: number, result: unknown) => Promise<void>;
194
- /** Called at each reflection checkpoint */
195
- onReflection?: (state: GLMDaemonState, summary: GLMReflectionSummary) => Promise<void>;
196
- }
197
-
198
- /**
199
- * GLM Tools configuration
200
- */
201
- export interface GLMToolsConfig {
202
- /** Enable MCP tool access */
203
- enableMCP?: boolean;
204
-
205
- /** Allowed tools (whitelist) */
206
- allowedTools?: string[];
207
-
208
- /** Blocked tools (blacklist) */
209
- blockedTools?: string[];
210
-
211
- /** Tool timeout in ms */
212
- toolTimeout?: number;
213
-
214
- /** Max retries for failed tools */
215
- maxRetries?: number;
216
- }
217
-
218
- /**
219
- * Reflection checkpoint configuration
220
- * Triggers TL;DR summary after N tool calls
221
- */
222
- export interface GLMReflectionConfig {
223
- /** Enable reflection checkpoints */
224
- enabled: boolean;
225
-
226
- /** Number of tools before reflection (default: 50) */
227
- toolLimit: number;
228
-
229
- /** Auto-continue after reflection (default: true) */
230
- autoContinue: boolean;
231
-
232
- /** Save reflection summaries to file */
233
- saveToFile?: string;
234
- }
235
-
236
- /**
237
- * GLM Agent (individual GLM-powered agent)
238
- */
239
- export interface GLMAgentConfig {
240
- /** Agent ID */
241
- agentId: string;
242
-
243
- /** Agent name */
244
- name: string;
245
-
246
- /** System prompt */
247
- prompt: string;
248
-
249
- /** Model to use */
250
- model?: string;
251
-
252
- /** Temperature (0-1) */
253
- temperature?: number;
254
-
255
- /** Max tokens */
256
- maxTokens?: number;
257
-
258
- /** Tools this agent can use */
259
- tools?: string[];
260
-
261
- /** Assigned subtasks */
262
- assignedSubtasks?: string[];
263
- }
264
-
265
- /**
266
- * GLM Tool execution result
267
- * @deprecated Use ToolExecutionResult from @ebowwa/codespaces-types/runtime/tools
268
- */
269
- export interface GLMToolResult {
270
- success: boolean;
271
- result?: unknown;
272
- error?: string;
273
- duration: number;
274
- }
275
-
276
- /**
277
- * Reflection summary generated at checkpoint
278
- */
279
- export interface GLMReflectionSummary {
280
- /** Checkpoint number */
281
- checkpoint: number;
282
- /** Timestamp */
23
+ export interface ChannelMessage {
24
+ id: string;
25
+ channelId: string;
26
+ type: "text" | "command" | "event";
27
+ content: string;
28
+ metadata?: Record<string, unknown>;
283
29
  timestamp: string;
284
- /** Tools used in this chunk */
285
- toolsUsed: number;
286
- /** Phase/skill when reflection occurred */
287
- phase: string;
288
- /** TL;DR summary */
289
- summary: string;
290
- /** Key accomplishments */
291
- accomplishments: string[];
292
- /** Next steps identified */
293
- nextSteps: string[];
294
- /** Issues/blockers found */
295
- issues: string[];
296
30
  }
297
31
 
298
- /**
299
- * GLM Daemon status
300
- */
301
- export interface GLMDaemonStatus {
302
- id: string;
303
- status: "starting" | "running" | "complete" | "error" | "stopped";
304
- /** Current skill ID or phase */
305
- phase: string;
306
- iteration: number;
307
- prompt: string;
308
- currentTask?: string;
309
- totalSubtasks: number;
310
- completedSubtasks: number;
311
- startedAt: string;
312
- lastUpdate: string;
313
- processId?: number;
32
+ export interface HealthStatus {
33
+ status: "healthy" | "degraded" | "unhealthy";
34
+ uptime: number;
35
+ channels: Record<string, { running: boolean; error?: string }>;
36
+ checks: Record<string, { passed: boolean; message?: string }>;
314
37
  }
package/dist/agent.d.ts DELETED
@@ -1,37 +0,0 @@
1
- /**
2
- * GLM Agent - Individual GLM-powered agent
3
- *
4
- * Wraps GLM 4.7 API with tool access and hook integration.
5
- */
6
- import type { GLMAgentConfig, GLMToolResult } from "./types.js";
7
- export declare class GLMAgent {
8
- private config;
9
- private client;
10
- private tools;
11
- constructor(config: GLMAgentConfig);
12
- /**
13
- * Execute a prompt and get response
14
- */
15
- execute(prompt: string, tools?: Record<string, unknown>): Promise<string>;
16
- /**
17
- * Execute a tool call
18
- */
19
- executeTool(toolName: string, args: unknown): Promise<GLMToolResult>;
20
- /**
21
- * Register a tool
22
- */
23
- registerTool(name: string, handler: (args: unknown) => Promise<unknown>): void;
24
- /**
25
- * Get available tools
26
- */
27
- getAvailableTools(): string[];
28
- /**
29
- * Get agent ID
30
- */
31
- get agentId(): string;
32
- /**
33
- * Get agent name
34
- */
35
- get name(): string;
36
- }
37
- //# sourceMappingURL=agent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhE,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,KAAK,CAA+D;gBAEhE,MAAM,EAAE,cAAc;IAKlC;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IA6B/E;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IA4B1E;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI;IAI9E;;OAEG;IACH,iBAAiB,IAAI,MAAM,EAAE;IAI7B;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}