@hopper-agent/core 0.1.1

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 (55) hide show
  1. package/LICENSE +179 -0
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/src/channel-registry.d.ts +26 -0
  4. package/dist/src/channel-registry.d.ts.map +1 -0
  5. package/dist/src/channel-registry.js +100 -0
  6. package/dist/src/channel-registry.js.map +1 -0
  7. package/dist/src/channel-router.d.ts +28 -0
  8. package/dist/src/channel-router.d.ts.map +1 -0
  9. package/dist/src/channel-router.js +52 -0
  10. package/dist/src/channel-router.js.map +1 -0
  11. package/dist/src/cron-manager.d.ts +70 -0
  12. package/dist/src/cron-manager.d.ts.map +1 -0
  13. package/dist/src/cron-manager.js +301 -0
  14. package/dist/src/cron-manager.js.map +1 -0
  15. package/dist/src/event-bus.d.ts +99 -0
  16. package/dist/src/event-bus.d.ts.map +1 -0
  17. package/dist/src/event-bus.js +56 -0
  18. package/dist/src/event-bus.js.map +1 -0
  19. package/dist/src/heartbeat-delivery.d.ts +27 -0
  20. package/dist/src/heartbeat-delivery.d.ts.map +1 -0
  21. package/dist/src/heartbeat-delivery.js +37 -0
  22. package/dist/src/heartbeat-delivery.js.map +1 -0
  23. package/dist/src/heartbeat-executor.d.ts +35 -0
  24. package/dist/src/heartbeat-executor.d.ts.map +1 -0
  25. package/dist/src/heartbeat-executor.js +174 -0
  26. package/dist/src/heartbeat-executor.js.map +1 -0
  27. package/dist/src/index.d.ts +26 -0
  28. package/dist/src/index.d.ts.map +1 -0
  29. package/dist/src/index.js +15 -0
  30. package/dist/src/index.js.map +1 -0
  31. package/dist/src/permission.d.ts +21 -0
  32. package/dist/src/permission.d.ts.map +1 -0
  33. package/dist/src/permission.js +69 -0
  34. package/dist/src/permission.js.map +1 -0
  35. package/dist/src/reminder-parser.d.ts +12 -0
  36. package/dist/src/reminder-parser.d.ts.map +1 -0
  37. package/dist/src/reminder-parser.js +164 -0
  38. package/dist/src/reminder-parser.js.map +1 -0
  39. package/dist/src/session-store.d.ts +32 -0
  40. package/dist/src/session-store.d.ts.map +1 -0
  41. package/dist/src/session-store.js +112 -0
  42. package/dist/src/session-store.js.map +1 -0
  43. package/dist/src/settings.d.ts +41 -0
  44. package/dist/src/settings.d.ts.map +1 -0
  45. package/dist/src/settings.js +128 -0
  46. package/dist/src/settings.js.map +1 -0
  47. package/dist/src/telegram-gateway.d.ts +35 -0
  48. package/dist/src/telegram-gateway.d.ts.map +1 -0
  49. package/dist/src/telegram-gateway.js +145 -0
  50. package/dist/src/telegram-gateway.js.map +1 -0
  51. package/dist/src/turn-loop.d.ts +106 -0
  52. package/dist/src/turn-loop.d.ts.map +1 -0
  53. package/dist/src/turn-loop.js +288 -0
  54. package/dist/src/turn-loop.js.map +1 -0
  55. package/package.json +33 -0
@@ -0,0 +1,288 @@
1
+ import { EventBus } from './event-bus.js';
2
+ import { SessionStore } from './session-store.js';
3
+ import { PermissionEngine } from './permission.js';
4
+ export class TurnLoop {
5
+ bus;
6
+ store;
7
+ permission;
8
+ config;
9
+ abort = false;
10
+ abortController = null;
11
+ messages = [];
12
+ activeSessionId;
13
+ constructor(config, store) {
14
+ this.config = config;
15
+ this.bus = new EventBus();
16
+ this.store = store ?? new SessionStore();
17
+ this.permission = new PermissionEngine(config.permissions, config.approvalMode ?? 'auto');
18
+ }
19
+ get eventBus() {
20
+ return this.bus;
21
+ }
22
+ getSessionId() {
23
+ return this.activeSessionId || this.config.sessionId || undefined;
24
+ }
25
+ cancel() {
26
+ this.abort = true;
27
+ this.abortController?.abort();
28
+ }
29
+ async evaluateHarm(toolName, input) {
30
+ const inputJson = JSON.stringify(input);
31
+ const systemPrompt = 'You are a safety evaluator. Given a tool call, determine if it is potentially harmful to the user\'s system. Harmful means: deleting files, executing arbitrary shell commands, sending data to external services, modifying system configuration, or any action that could cause data loss or security compromise. Your response must be exactly one of these two strings: APPROVE or DENY. Do not add any other text.';
32
+ const prompt = `Evaluate this tool call:\nTool: ${toolName}\nInput: ${inputJson}`;
33
+ try {
34
+ const response = await this.config.provider.check(prompt, { model: this.config.model, system: systemPrompt });
35
+ const decision = response.trim().toUpperCase();
36
+ if (decision === 'APPROVE') {
37
+ return { approved: true, reason: `LLM harm-check: APPROVE` };
38
+ }
39
+ return { approved: false, reason: `LLM harm-check: DENY — ${response.trim()}` };
40
+ }
41
+ catch {
42
+ // If LLM check fails, deny for safety
43
+ return { approved: false, reason: 'LLM harm-check failed — denied' };
44
+ }
45
+ }
46
+ async run(prompt) {
47
+ let session;
48
+ if (this.config.sessionId) {
49
+ const loaded = this.store.load(this.config.sessionId);
50
+ if (loaded) {
51
+ session = loaded;
52
+ }
53
+ else {
54
+ // Session ID was provided but doesn't exist on disk yet
55
+ // (e.g. ChannelRouter generates a placeholder before TurnLoop creates it)
56
+ session = this.store.create(this.config.cwd, this.config.model, this.config.provider.name);
57
+ this.activeSessionId = session.id;
58
+ }
59
+ }
60
+ else {
61
+ session = this.store.create(this.config.cwd, this.config.model, this.config.provider.name);
62
+ }
63
+ this.activeSessionId ??= session.id;
64
+ const websearchTools = new Set(['WebSearch', 'WebFetch']);
65
+ const emit = (e) => {
66
+ this.bus.emit(e);
67
+ this.store.appendEvent(session.id, e);
68
+ };
69
+ this.abort = false;
70
+ this.abortController = new AbortController();
71
+ emit({ type: 'session-start', id: session.id, model: this.config.model, provider: this.config.provider.name, cwd: this.config.cwd, timestamp: Date.now() });
72
+ emit({ type: 'user-prompt', id: session.id, text: prompt, cwd: this.config.cwd, timestamp: Date.now() });
73
+ this.messages.push({ role: 'user', content: prompt });
74
+ let turn = 0;
75
+ const maxTurns = this.config.maxTurns ?? 50;
76
+ try {
77
+ while (turn < maxTurns && !this.abort) {
78
+ turn++;
79
+ let fullText = '';
80
+ const toolCalls = [];
81
+ let totalToolCalls = 0;
82
+ let websearchToolCalls = 0;
83
+ const thinkingBlocks = [];
84
+ // Local providers (Ollama, llama.cpp) don't support Anthropic thinking blocks.
85
+ // Strip thinking blocks from message history to avoid serialization errors.
86
+ const self = this;
87
+ const isLocal = self.config.provider.name === 'local';
88
+ const streamMessages = isLocal
89
+ ? self.messages.map((m) => {
90
+ if (m.role === 'assistant' && Array.isArray(m.content)) {
91
+ return { ...m, content: m.content.filter((b) => b.type !== 'thinking') };
92
+ }
93
+ return m;
94
+ })
95
+ : self.messages;
96
+ // Capture abortController before the loop — it's always set by this point.
97
+ const abortCtrl = self.abortController;
98
+ try {
99
+ for await (const event of self.config.provider.stream({
100
+ messages: streamMessages,
101
+ tools: self.config.tools.map((t) => t.definition),
102
+ model: self.config.model,
103
+ system: self.config.system,
104
+ signal: abortCtrl.signal,
105
+ effort: self.config.effort,
106
+ })) {
107
+ if (self.abort)
108
+ break;
109
+ switch (event.type) {
110
+ case 'text-delta':
111
+ fullText += event.text;
112
+ emit({ type: 'assistant-delta', id: session.id, text: event.text, timestamp: Date.now() });
113
+ break;
114
+ case 'thinking-block':
115
+ thinkingBlocks.push({ thinking: event.thinking, signature: event.signature });
116
+ break;
117
+ case 'tool-call':
118
+ toolCalls.push({ id: event.id, name: event.name, input: event.input });
119
+ emit({ type: 'tool-call', id: session.id, toolCallId: event.id, name: event.name, input: event.input, timestamp: Date.now() });
120
+ break;
121
+ case 'usage':
122
+ emit({ type: 'usage', id: session.id, inputTokens: event.inputTokens, outputTokens: event.outputTokens, cacheReadTokens: event.cacheReadTokens, cacheWriteTokens: event.cacheWriteTokens, timestamp: Date.now() });
123
+ break;
124
+ }
125
+ }
126
+ }
127
+ catch (err) {
128
+ const status = err?.status ?? err?.response?.status;
129
+ const msg = err instanceof Error ? err.message : String(err);
130
+ if (status === 413) {
131
+ emit({ type: 'error', id: session.id, message: `Provider returned 413 (Request Entity Too Large). The system prompt + messages exceed the local model's context window. Try: reduce AGENTS.md size, or use a larger local model. (Original: ${msg})`,
132
+ timestamp: Date.now(),
133
+ });
134
+ emit({ type: 'session-stop', id: session.id, reason: 'error', timestamp: Date.now() });
135
+ return { events: self.bus.history(), sessionId: session.id, reason: 'error' };
136
+ }
137
+ if (msg.includes('invalid string length') || msg.includes('INVALID_LENGTH')) {
138
+ emit({ type: 'error', id: session.id, message: `Provider returned "invalid string length" — the local model's response format is incompatible with the Anthropic SDK. This usually means the model doesn't fully implement the Anthropic API. Try: use a model that supports the Anthropic Messages API (e.g. llama-3.1), or switch to OpenAI-compatible provider with correct model names. (Original: ${msg})`,
139
+ timestamp: Date.now(),
140
+ });
141
+ emit({ type: 'session-stop', id: session.id, reason: 'error', timestamp: Date.now() });
142
+ return { events: self.bus.history(), sessionId: session.id, reason: 'error' };
143
+ }
144
+ throw err;
145
+ }
146
+ if (this.abort) {
147
+ emit({ type: 'assistant-stop', id: session.id, timestamp: Date.now() });
148
+ emit({ type: 'session-stop', id: session.id, reason: 'cancelled', timestamp: Date.now() });
149
+ return { events: this.bus.history(), sessionId: session.id, reason: 'cancelled' };
150
+ }
151
+ // Build assistant message: thinking blocks MUST come first (Anthropic
152
+ // requires them preserved when extended thinking + tool use is combined),
153
+ // then text, then tool-use blocks.
154
+ const assistantContent = [];
155
+ for (const tb of thinkingBlocks) {
156
+ assistantContent.push({ type: 'thinking', thinking: tb.thinking, signature: tb.signature });
157
+ }
158
+ if (fullText)
159
+ assistantContent.push({ type: 'text', text: fullText });
160
+ for (const tc of toolCalls) {
161
+ assistantContent.push({ type: 'tool-use', id: tc.id, name: tc.name, input: tc.input });
162
+ }
163
+ if (assistantContent.length > 0) {
164
+ this.messages.push({ role: 'assistant', content: assistantContent });
165
+ }
166
+ if (toolCalls.length === 0) {
167
+ emit({ type: 'assistant-stop', id: session.id, timestamp: Date.now() });
168
+ emit({ type: 'session-stop', id: session.id, reason: 'stop', timestamp: Date.now() });
169
+ return { events: this.bus.history(), sessionId: session.id, reason: 'stop' };
170
+ }
171
+ for (const tc of toolCalls) {
172
+ if (this.abort)
173
+ break;
174
+ // --- Tool usage limits ---
175
+ const totalLimit = this.config.settings.TOOLS_PER_CALL ?? 10;
176
+ const websearchLimit = this.config.settings.WEBSEARCH_PER_CALL ?? 5;
177
+ if (totalToolCalls >= totalLimit) {
178
+ const msg = `Tool call limit reached (${totalLimit} per turn). Skipping remaining tool call(s).`;
179
+ emit({ type: 'status', id: session.id, message: msg, timestamp: Date.now() });
180
+ for (const remaining of toolCalls.slice(toolCalls.indexOf(tc))) {
181
+ this.messages.push({ role: 'tool', toolUseId: remaining.id, content: `Skipped: ${msg}` });
182
+ emit({ type: 'tool-result', id: session.id, toolCallId: remaining.id, output: null, error: msg, timestamp: Date.now() });
183
+ }
184
+ break;
185
+ }
186
+ if (websearchTools.has(tc.name) && websearchToolCalls >= websearchLimit) {
187
+ const msg = `WebSearch/WebFetch limit reached (${websearchLimit} per turn). Skipping remaining tool call(s).`;
188
+ emit({ type: 'status', id: session.id, message: msg, timestamp: Date.now() });
189
+ for (const remaining of toolCalls.slice(toolCalls.indexOf(tc))) {
190
+ this.messages.push({ role: 'tool', toolUseId: remaining.id, content: `Skipped: ${msg}` });
191
+ emit({ type: 'tool-result', id: session.id, toolCallId: remaining.id, output: null, error: msg, timestamp: Date.now() });
192
+ }
193
+ break;
194
+ }
195
+ // --- End tool usage limits ---
196
+ const permResult = this.permission.check(tc.name, tc.input);
197
+ emit({
198
+ type: 'approval-request',
199
+ id: session.id,
200
+ toolCallId: tc.id,
201
+ name: tc.name,
202
+ input: tc.input,
203
+ decision: permResult.decision,
204
+ timestamp: Date.now(),
205
+ });
206
+ if (permResult.decision === 'deny') {
207
+ emit({ type: 'approval-decision', id: session.id, toolCallId: tc.id, decision: 'deny', timestamp: Date.now() });
208
+ this.messages.push({ role: 'tool', toolUseId: tc.id, content: `Tool call denied: ${permResult.reason}` });
209
+ continue;
210
+ }
211
+ // Track approval status for display in tool result messages.
212
+ let toolApproved = true;
213
+ let toolDecisionBy = 'auto';
214
+ if (permResult.decision === 'ask') {
215
+ const ask = this.config.onApprovalAsk;
216
+ // In auto mode: evaluate harm with LLM before asking user.
217
+ let approved = false;
218
+ let decisionBy = 'user';
219
+ if (this.permission['mode'] === 'auto' && ask) {
220
+ const harm = await this.evaluateHarm(tc.name, tc.input);
221
+ if (harm.approved) {
222
+ approved = true;
223
+ decisionBy = 'llm';
224
+ }
225
+ else {
226
+ // LLM denied — ask user for final decision
227
+ approved = await ask({ name: tc.name, input: tc.input, reason: harm.reason });
228
+ decisionBy = 'user';
229
+ }
230
+ }
231
+ else {
232
+ approved = ask
233
+ ? await ask({ name: tc.name, input: tc.input, reason: permResult.reason })
234
+ : true; // no callback wired — treat as allow to preserve old behavior
235
+ decisionBy = approved ? 'user' : 'user';
236
+ }
237
+ emit({
238
+ type: 'approval-decision',
239
+ id: session.id,
240
+ toolCallId: tc.id,
241
+ decision: approved ? 'allow' : 'deny',
242
+ by: decisionBy,
243
+ timestamp: Date.now(),
244
+ });
245
+ if (!approved) {
246
+ this.messages.push({ role: 'tool', toolUseId: tc.id, content: decisionBy === 'llm' ? `Tool call denied by LLM harm-check: ${tc.name}` : 'Tool call denied by user.' });
247
+ continue;
248
+ }
249
+ toolApproved = approved;
250
+ toolDecisionBy = decisionBy === 'llm' ? 'llm' : 'user';
251
+ }
252
+ totalToolCalls++;
253
+ if (websearchTools.has(tc.name))
254
+ websearchToolCalls++;
255
+ const tool = this.config.tools.find((t) => t.definition.name === tc.name);
256
+ if (!tool) {
257
+ emit({ type: 'tool-result', id: session.id, toolCallId: tc.id, output: null, error: `Unknown tool: ${tc.name}`, timestamp: Date.now() });
258
+ this.messages.push({ role: 'tool', toolUseId: tc.id, content: `Unknown tool: ${tc.name}` });
259
+ continue;
260
+ }
261
+ try {
262
+ const result = await tool.execute(tc.input, this.config.settings);
263
+ emit({ type: 'tool-result', id: session.id, toolCallId: tc.id, output: result.output, error: result.error, timestamp: Date.now() });
264
+ const outputStr = result.error ? `Error: ${result.error}` : JSON.stringify(result.output);
265
+ const decisionLabel = toolDecisionBy === 'llm' ? 'LLM-approved' : toolDecisionBy === 'user' ? 'Approved by user' : 'Auto Approved';
266
+ this.messages.push({ role: 'tool', toolUseId: tc.id, content: `${tc.name}: ${decisionLabel} — ${outputStr}` });
267
+ }
268
+ catch (err) {
269
+ const msg = err instanceof Error ? err.message : String(err);
270
+ emit({ type: 'tool-result', id: session.id, toolCallId: tc.id, output: null, error: msg, timestamp: Date.now() });
271
+ const decisionLabel = toolDecisionBy === 'llm' ? 'LLM-approved' : toolDecisionBy === 'user' ? 'Approved by user' : 'Auto Approved';
272
+ this.messages.push({ role: 'tool', toolUseId: tc.id, content: `${tc.name}: ${decisionLabel} — Error: ${msg}` });
273
+ }
274
+ }
275
+ }
276
+ emit({ type: 'assistant-stop', id: session.id, timestamp: Date.now() });
277
+ emit({ type: 'session-stop', id: session.id, reason: 'max-turns', timestamp: Date.now() });
278
+ return { events: this.bus.history(), sessionId: session.id, reason: 'max-turns' };
279
+ }
280
+ catch (err) {
281
+ const msg = err instanceof Error ? err.message : String(err);
282
+ emit({ type: 'error', id: session.id, message: msg, timestamp: Date.now() });
283
+ emit({ type: 'session-stop', id: session.id, reason: 'error', timestamp: Date.now() });
284
+ return { events: this.bus.history(), sessionId: session.id, reason: 'error' };
285
+ }
286
+ }
287
+ }
288
+ //# sourceMappingURL=turn-loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn-loop.js","sourceRoot":"","sources":["../../src/turn-loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAoB,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAqB,MAAM,iBAAiB,CAAC;AAiEtE,MAAM,OAAO,QAAQ;IACX,GAAG,CAAW;IACd,KAAK,CAAe;IACpB,UAAU,CAAmB;IAC7B,MAAM,CAAiB;IACvB,KAAK,GAAG,KAAK,CAAC;IACd,eAAe,GAA2B,IAAI,CAAC;IAC/C,QAAQ,GAAc,EAAE,CAAC;IACzB,eAAe,CAAqB;IAE5C,YAAY,MAAsB,EAAE,KAAoB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G,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC7E,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACvF,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;QAChF,CAAC;IACH,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@hopper-agent/core",
3
+ "version": "0.1.1",
4
+ "publish": true,
5
+ "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "main": "./dist/src/index.js",
10
+ "types": "./dist/src/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/src/index.js",
14
+ "types": "./dist/src/index.d.ts"
15
+ }
16
+ },
17
+ "dependencies": {
18
+ "grammy": "^1.42.0",
19
+ "zod": "^3.25.0"
20
+ },
21
+ "devDependencies": {
22
+ "@types/node": "^22.0.0",
23
+ "typescript": "^5.9.0"
24
+ },
25
+ "scripts": {
26
+ "build": "tsc --project tsconfig.json",
27
+ "dev": "tsc --watch --project tsconfig.json",
28
+ "typecheck": "tsc --noEmit --project tsconfig.json",
29
+ "lint": "eslint src/",
30
+ "test": "vitest run",
31
+ "clean": "npx rimraf dist"
32
+ }
33
+ }