@producible/cereworker-core 26.520.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 (90) hide show
  1. package/LICENSE +21 -0
  2. package/dist/abort.d.ts +5 -0
  3. package/dist/abort.d.ts.map +1 -0
  4. package/dist/abort.js +36 -0
  5. package/dist/abort.js.map +1 -0
  6. package/dist/context.d.ts +20 -0
  7. package/dist/context.d.ts.map +1 -0
  8. package/dist/context.js +45 -0
  9. package/dist/context.js.map +1 -0
  10. package/dist/conversation.d.ts +48 -0
  11. package/dist/conversation.d.ts.map +1 -0
  12. package/dist/conversation.js +358 -0
  13. package/dist/conversation.js.map +1 -0
  14. package/dist/discovery.d.ts +32 -0
  15. package/dist/discovery.d.ts.map +1 -0
  16. package/dist/discovery.js +165 -0
  17. package/dist/discovery.js.map +1 -0
  18. package/dist/events.d.ts +222 -0
  19. package/dist/events.d.ts.map +1 -0
  20. package/dist/events.js +25 -0
  21. package/dist/events.js.map +1 -0
  22. package/dist/http-tools.d.ts +8 -0
  23. package/dist/http-tools.d.ts.map +1 -0
  24. package/dist/http-tools.js +137 -0
  25. package/dist/http-tools.js.map +1 -0
  26. package/dist/index.d.ts +34 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +20 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/instance.d.ts +56 -0
  31. package/dist/instance.d.ts.map +1 -0
  32. package/dist/instance.js +136 -0
  33. package/dist/instance.js.map +1 -0
  34. package/dist/legacy-sqlite.d.ts +6 -0
  35. package/dist/legacy-sqlite.d.ts.map +1 -0
  36. package/dist/legacy-sqlite.js +90 -0
  37. package/dist/legacy-sqlite.js.map +1 -0
  38. package/dist/logger.d.ts +15 -0
  39. package/dist/logger.d.ts.map +1 -0
  40. package/dist/logger.js +53 -0
  41. package/dist/logger.js.map +1 -0
  42. package/dist/orchestrator.d.ts +321 -0
  43. package/dist/orchestrator.d.ts.map +1 -0
  44. package/dist/orchestrator.js +2610 -0
  45. package/dist/orchestrator.js.map +1 -0
  46. package/dist/pairing.d.ts +41 -0
  47. package/dist/pairing.d.ts.map +1 -0
  48. package/dist/pairing.js +215 -0
  49. package/dist/pairing.js.map +1 -0
  50. package/dist/plan-store.d.ts +33 -0
  51. package/dist/plan-store.d.ts.map +1 -0
  52. package/dist/plan-store.js +113 -0
  53. package/dist/plan-store.js.map +1 -0
  54. package/dist/proactive.d.ts +64 -0
  55. package/dist/proactive.d.ts.map +1 -0
  56. package/dist/proactive.js +179 -0
  57. package/dist/proactive.js.map +1 -0
  58. package/dist/sub-agent-manager.d.ts +45 -0
  59. package/dist/sub-agent-manager.d.ts.map +1 -0
  60. package/dist/sub-agent-manager.js +509 -0
  61. package/dist/sub-agent-manager.js.map +1 -0
  62. package/dist/sub-agent-tools.d.ts +4 -0
  63. package/dist/sub-agent-tools.d.ts.map +1 -0
  64. package/dist/sub-agent-tools.js +94 -0
  65. package/dist/sub-agent-tools.js.map +1 -0
  66. package/dist/system-prompt.d.ts +34 -0
  67. package/dist/system-prompt.d.ts.map +1 -0
  68. package/dist/system-prompt.js +256 -0
  69. package/dist/system-prompt.js.map +1 -0
  70. package/dist/task-schedule.d.ts +13 -0
  71. package/dist/task-schedule.d.ts.map +1 -0
  72. package/dist/task-schedule.js +201 -0
  73. package/dist/task-schedule.js.map +1 -0
  74. package/dist/task-store.d.ts +22 -0
  75. package/dist/task-store.d.ts.map +1 -0
  76. package/dist/task-store.js +141 -0
  77. package/dist/task-store.js.map +1 -0
  78. package/dist/text-store.d.ts +18 -0
  79. package/dist/text-store.d.ts.map +1 -0
  80. package/dist/text-store.js +212 -0
  81. package/dist/text-store.js.map +1 -0
  82. package/dist/tool-runtime.d.ts +76 -0
  83. package/dist/tool-runtime.d.ts.map +1 -0
  84. package/dist/tool-runtime.js +443 -0
  85. package/dist/tool-runtime.js.map +1 -0
  86. package/dist/types.d.ts +392 -0
  87. package/dist/types.d.ts.map +1 -0
  88. package/dist/types.js +2 -0
  89. package/dist/types.js.map +1 -0
  90. package/package.json +31 -0
@@ -0,0 +1,165 @@
1
+ import { nanoid } from 'nanoid';
2
+ import { createLogger } from './logger.js';
3
+ const log = createLogger('discovery');
4
+ const DISCOVERY_SYSTEM_PROMPT = `You are being set up for the first time. Your job is to learn who you are by asking Boss questions. Always address the user as "Boss".
5
+
6
+ Ask these questions ONE AT A TIME. Wait for Boss's answer before moving to the next question:
7
+ 1. "What should I call myself?" — to learn your name.
8
+ 2. "What's my primary role or purpose?" — to learn what you'll be doing.
9
+ 3. "What tasks should I handle regularly?" — to learn your recurring responsibilities.
10
+ 4. "How should I communicate — concise, detailed, formal, friendly?" — to learn your style.
11
+ 5. "Anything else I should know about how you work or what you need from me?" — open-ended.
12
+
13
+ After each answer, briefly acknowledge it and move to the next question.
14
+ When all questions are answered, output a confirmation summary in this exact format:
15
+
16
+ <discovery_complete>
17
+ name: [the name they chose]
18
+ role: [their description of your role]
19
+ traits: [comma-separated communication traits]
20
+ </discovery_complete>
21
+
22
+ Be natural and conversational but efficient. Do not use tools.`;
23
+ const MAX_TURNS = 12;
24
+ export class DiscoveryEngine {
25
+ cerebrum;
26
+ callbacks;
27
+ messages = [];
28
+ constructor(cerebrum, callbacks) {
29
+ this.cerebrum = cerebrum;
30
+ this.callbacks = callbacks;
31
+ }
32
+ async run() {
33
+ log.info('Starting discovery conversation');
34
+ // System prompt
35
+ this.messages.push({
36
+ id: 'system',
37
+ role: 'system',
38
+ content: DISCOVERY_SYSTEM_PROMPT,
39
+ timestamp: Date.now(),
40
+ });
41
+ // Seed user message to satisfy AI SDK requirement (messages must not be empty)
42
+ this.messages.push({
43
+ id: nanoid(),
44
+ role: 'user',
45
+ content: 'Hello! I just set you up. Please start asking your questions.',
46
+ timestamp: Date.now(),
47
+ });
48
+ // First turn: agent asks the first question
49
+ let agentResponse = await this.getAgentResponse();
50
+ this.callbacks.sendMessage(agentResponse);
51
+ // Multi-turn loop
52
+ for (let turn = 0; turn < MAX_TURNS; turn++) {
53
+ // Check if discovery is complete
54
+ const parsed = this.parseCompletion(agentResponse);
55
+ if (parsed) {
56
+ const result = this.buildResult(parsed);
57
+ this.callbacks.onComplete(result);
58
+ log.info('Discovery completed', { name: parsed.name, role: parsed.role });
59
+ return result;
60
+ }
61
+ // Get user input
62
+ const userInput = await this.callbacks.getUserInput();
63
+ this.messages.push({
64
+ id: nanoid(),
65
+ role: 'user',
66
+ content: userInput,
67
+ timestamp: Date.now(),
68
+ });
69
+ // Get agent response
70
+ agentResponse = await this.getAgentResponse();
71
+ this.callbacks.sendMessage(agentResponse);
72
+ }
73
+ // Max turns reached — extract what we have
74
+ log.warn('Discovery hit max turns, extracting partial result');
75
+ const fallback = this.extractPartialResult();
76
+ this.callbacks.onComplete(fallback);
77
+ return fallback;
78
+ }
79
+ async getAgentResponse() {
80
+ return new Promise((resolve, reject) => {
81
+ const callbacks = {
82
+ onChunk: (chunk) => {
83
+ this.callbacks.onChunk?.(chunk);
84
+ },
85
+ onToolCall: async () => ({ callId: '', output: '', isError: true }),
86
+ onFinish: (content) => {
87
+ this.messages.push({
88
+ id: nanoid(),
89
+ role: 'cerebrum',
90
+ content,
91
+ timestamp: Date.now(),
92
+ });
93
+ resolve(content);
94
+ },
95
+ onError: (error) => {
96
+ reject(error);
97
+ },
98
+ };
99
+ this.cerebrum.stream(this.messages, {}, callbacks).catch(reject);
100
+ });
101
+ }
102
+ parseCompletion(text) {
103
+ const match = text.match(/<discovery_complete>\s*([\s\S]*?)\s*<\/discovery_complete>/);
104
+ if (!match)
105
+ return null;
106
+ const block = match[1];
107
+ const nameMatch = block.match(/name:\s*(.+)/i);
108
+ const roleMatch = block.match(/role:\s*(.+)/i);
109
+ const traitsMatch = block.match(/traits:\s*(.+)/i);
110
+ const name = nameMatch?.[1]?.trim() || 'Cere';
111
+ const role = roleMatch?.[1]?.trim() || 'general-purpose assistant';
112
+ const traits = traitsMatch?.[1]
113
+ ?.split(',')
114
+ .map((t) => t.trim().toLowerCase())
115
+ .filter(Boolean) ?? [];
116
+ return { name, role, traits };
117
+ }
118
+ buildResult(parsed) {
119
+ const conversationMessages = this.messages.filter((m) => m.role !== 'system');
120
+ const trainingPairs = this.extractTrainingPairs();
121
+ return {
122
+ name: parsed.name,
123
+ role: parsed.role,
124
+ traits: parsed.traits,
125
+ conversation: conversationMessages,
126
+ trainingPairs,
127
+ };
128
+ }
129
+ extractPartialResult() {
130
+ // Try to extract structured info from conversation even without the completion tag
131
+ let name = 'Cere';
132
+ let role = 'general-purpose assistant';
133
+ const traits = [];
134
+ // Skip the seed message (first user message is the kickoff prompt)
135
+ const userMessages = this.messages.filter((m) => m.role === 'user').slice(1);
136
+ if (userMessages.length > 0)
137
+ name = userMessages[0].content.trim().split('\n')[0];
138
+ if (userMessages.length > 1)
139
+ role = userMessages[1].content.trim();
140
+ return {
141
+ name,
142
+ role,
143
+ traits,
144
+ conversation: this.messages.filter((m) => m.role !== 'system'),
145
+ trainingPairs: this.extractTrainingPairs(),
146
+ };
147
+ }
148
+ extractTrainingPairs() {
149
+ const pairs = [];
150
+ const msgs = this.messages.filter((m) => m.role !== 'system');
151
+ // Each user→cerebrum turn becomes a training pair
152
+ for (let i = 0; i < msgs.length - 1; i++) {
153
+ if (msgs[i].role === 'user' && msgs[i + 1].role === 'cerebrum') {
154
+ pairs.push({
155
+ instruction: msgs[i].content,
156
+ response: msgs[i + 1].content,
157
+ source: 'discovery',
158
+ createdAt: msgs[i + 1].timestamp,
159
+ });
160
+ }
161
+ }
162
+ return pairs;
163
+ }
164
+ }
165
+ //# sourceMappingURL=discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.js","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,MAAM,GAAG,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;AAEtC,MAAM,uBAAuB,G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;YACJ,MAAM;YACN,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;YAC9D,aAAa,EAAE,IAAI,CAAC,oBAAoB,EAAE;SAC3C,CAAC;IACJ,CAAC;IAEO,oBAAoB;QAC1B,MAAM,KAAK,GAAmB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;QAE9D,kDAAkD;QAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;gBAC/D,KAAK,CAAC,IAAI,CAAC;oBACT,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO;oBAC5B,QAAQ,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO;oBAC7B,MAAM,EAAE,WAAW;oBACnB,SAAS,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;iBACjC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
@@ -0,0 +1,222 @@
1
+ import type { AgentHealthAction, CerebellumStatus, Message, SessionMemorySnapshot, SessionSource, RecoveryAction, RecoveryCause, StreamPhase, TaskAction, ToolCall, ToolResult, VerificationResult } from './types.js';
2
+ interface StreamDiagnosticEvent {
3
+ elapsedSeconds?: number;
4
+ phase: StreamPhase;
5
+ activeToolName?: string;
6
+ activeToolCallId?: string;
7
+ activeToolStartedAt?: number;
8
+ }
9
+ export type WatchdogStage = 'stalled' | 'nudge_requested' | 'abort_issued' | 'retry_started' | 'retry_recovered' | 'retry_failed' | 'teardown_timeout';
10
+ export type CompletionStage = 'signal_recorded' | 'guard_triggered' | 'retry_started' | 'retry_recovered' | 'retry_failed';
11
+ export type OrchestratorEvent = {
12
+ type: 'message:user';
13
+ message: Message;
14
+ } | {
15
+ type: 'message:system';
16
+ message: Message;
17
+ } | {
18
+ type: 'message:cerebrum:start';
19
+ conversationId: string;
20
+ turnId: string;
21
+ sessionId: string;
22
+ source: SessionSource;
23
+ } | {
24
+ type: 'message:cerebrum:chunk';
25
+ chunk: string;
26
+ } | {
27
+ type: 'message:cerebrum:end';
28
+ conversationId: string;
29
+ turnId: string;
30
+ sessionId: string;
31
+ source: SessionSource;
32
+ message: Message;
33
+ } | {
34
+ type: 'session:memory-updated';
35
+ conversationId: string;
36
+ sessionId: string;
37
+ snapshot: SessionMemorySnapshot;
38
+ } | {
39
+ type: 'message:cerebrum:toolcall';
40
+ toolCall: ToolCall;
41
+ } | {
42
+ type: 'tool:start';
43
+ callId: string;
44
+ name: string;
45
+ requestedName?: string;
46
+ args: Record<string, unknown>;
47
+ } | {
48
+ type: 'tool:end';
49
+ callId: string;
50
+ name: string;
51
+ requestedName?: string;
52
+ args: Record<string, unknown>;
53
+ result: ToolResult;
54
+ } | {
55
+ type: 'verification:start';
56
+ callId: string;
57
+ toolName: string;
58
+ } | {
59
+ type: 'verification:end';
60
+ result: VerificationResult;
61
+ conversationId: string;
62
+ sessionId: string;
63
+ } | {
64
+ type: 'heartbeat:tick';
65
+ actions: TaskAction[];
66
+ } | {
67
+ type: 'cerebellum:loading';
68
+ phase: string;
69
+ attempt?: number;
70
+ maxAttempts?: number;
71
+ } | {
72
+ type: 'cerebellum:status';
73
+ status: CerebellumStatus;
74
+ } | {
75
+ type: 'agent:spawned';
76
+ agentId: string;
77
+ task: string;
78
+ } | {
79
+ type: 'agent:completed';
80
+ agentId: string;
81
+ result: string;
82
+ } | {
83
+ type: 'agent:failed';
84
+ agentId: string;
85
+ error: string;
86
+ } | {
87
+ type: 'agent:health';
88
+ actions: AgentHealthAction[];
89
+ } | {
90
+ type: 'agent:progress';
91
+ agentId: string;
92
+ note: string;
93
+ percent?: number;
94
+ } | {
95
+ type: 'agent:recovered';
96
+ agentId: string;
97
+ task: string;
98
+ } | {
99
+ type: 'exec:approval-required';
100
+ command: string;
101
+ } | {
102
+ type: 'exec:blocked';
103
+ command: string;
104
+ reason: string;
105
+ } | {
106
+ type: 'emergency:stop';
107
+ } | {
108
+ type: 'node:connected';
109
+ nodeId: string;
110
+ capabilities: string[];
111
+ } | {
112
+ type: 'node:disconnected';
113
+ nodeId: string;
114
+ reason: string;
115
+ } | {
116
+ type: 'node:invoke';
117
+ nodeId: string;
118
+ tool: string;
119
+ id: string;
120
+ } | {
121
+ type: 'node:invoke-result';
122
+ nodeId: string;
123
+ id: string;
124
+ isError: boolean;
125
+ } | {
126
+ type: 'finetune:start';
127
+ jobId: string;
128
+ } | {
129
+ type: 'finetune:progress';
130
+ jobId: string;
131
+ progress: number;
132
+ loss: number;
133
+ } | {
134
+ type: 'finetune:complete';
135
+ jobId: string;
136
+ checkpointPath: string;
137
+ } | {
138
+ type: 'finetune:error';
139
+ jobId: string;
140
+ error: string;
141
+ } | {
142
+ type: 'task:start';
143
+ taskId: string;
144
+ goal: string;
145
+ } | {
146
+ type: 'task:complete';
147
+ taskId: string;
148
+ } | {
149
+ type: 'task:error';
150
+ taskId: string;
151
+ error: string;
152
+ } | {
153
+ type: 'browser:extension-connected';
154
+ } | {
155
+ type: 'browser:extension-disconnected';
156
+ } | {
157
+ type: 'conversation:resumed';
158
+ conversationId: string;
159
+ messages: Message[];
160
+ } | {
161
+ type: 'message:proactive';
162
+ content: string;
163
+ source: string;
164
+ } | {
165
+ type: 'proactive:resume';
166
+ taskId: string;
167
+ goal: string;
168
+ } | {
169
+ type: 'proactive:report';
170
+ report: string;
171
+ } | ({
172
+ type: 'cerebrum:stall';
173
+ } & StreamDiagnosticEvent) | ({
174
+ type: 'cerebrum:stall:nudge';
175
+ attempt: number;
176
+ } & StreamDiagnosticEvent) | ({
177
+ type: 'cerebrum:watchdog';
178
+ stage: WatchdogStage;
179
+ turnId: string;
180
+ attempt: number;
181
+ conversationId: string;
182
+ message: string;
183
+ } & StreamDiagnosticEvent) | ({
184
+ type: 'cerebrum:completion';
185
+ stage: CompletionStage;
186
+ turnId: string;
187
+ attempt: number;
188
+ conversationId: string;
189
+ message: string;
190
+ signal?: 'complete' | 'blocked' | 'none';
191
+ } & StreamDiagnosticEvent) | ({
192
+ type: 'cerebellum:recovery';
193
+ cause: RecoveryCause;
194
+ action: RecoveryAction;
195
+ turnId: string;
196
+ attempt: number;
197
+ conversationId: string;
198
+ message: string;
199
+ operatorMessage: string;
200
+ diagnosis: string;
201
+ nextStep: string;
202
+ completedSteps: string[];
203
+ waitSeconds?: number;
204
+ source: 'cerebellum' | 'fallback';
205
+ } & StreamDiagnosticEvent) | {
206
+ type: 'error';
207
+ error: Error;
208
+ };
209
+ type EventHandler<T> = (event: T) => void;
210
+ type EventMap = {
211
+ [K in OrchestratorEvent['type']]: Extract<OrchestratorEvent, {
212
+ type: K;
213
+ }>;
214
+ };
215
+ export declare class TypedEventEmitter {
216
+ private handlers;
217
+ on<K extends OrchestratorEvent['type']>(type: K, handler: EventHandler<EventMap[K]>): () => void;
218
+ emit<K extends OrchestratorEvent['type']>(event: EventMap[K]): void;
219
+ removeAllListeners(): void;
220
+ }
221
+ export {};
222
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,aAAa,EACb,WAAW,EACX,UAAU,EACV,QAAQ,EACR,UAAU,EACV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AO,CAAC,iBAAiB,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC;CAC1E,CAAC;AAEF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAA2D;IAE3E,EAAE,CAAC,CAAC,SAAS,iBAAiB,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAYhG,IAAI,CAAC,CAAC,SAAS,iBAAiB,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI;IASnE,kBAAkB,IAAI,IAAI;CAG3B"}
package/dist/events.js ADDED
@@ -0,0 +1,25 @@
1
+ export class TypedEventEmitter {
2
+ handlers = new Map();
3
+ on(type, handler) {
4
+ if (!this.handlers.has(type)) {
5
+ this.handlers.set(type, new Set());
6
+ }
7
+ const typedHandler = handler;
8
+ this.handlers.get(type).add(typedHandler);
9
+ return () => {
10
+ this.handlers.get(type)?.delete(typedHandler);
11
+ };
12
+ }
13
+ emit(event) {
14
+ const handlers = this.handlers.get(event.type);
15
+ if (handlers) {
16
+ for (const handler of handlers) {
17
+ handler(event);
18
+ }
19
+ }
20
+ }
21
+ removeAllListeners() {
22
+ this.handlers.clear();
23
+ }
24
+ }
25
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AA4IA,MAAM,OAAO,iBAAiB;IACpB,QAAQ,GAAG,IAAI,GAAG,EAAgD,CAAC;IAE3E,EAAE,CAAsC,IAAO,EAAE,OAAkC;QACjF,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACrC,CAAC;QACD,MAAM,YAAY,GAAG,OAA0C,CAAC;QAChE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAE3C,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;QAChD,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,CAAsC,KAAkB;QAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,QAAQ,EAAE,CAAC;YACb,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;gBAC/B,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IAED,kBAAkB;QAChB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import type { ToolDefinition } from './orchestrator.js';
2
+ export interface HttpToolConfig {
3
+ timeout: number;
4
+ maxResponseSize: number;
5
+ allowPrivate: boolean;
6
+ }
7
+ export declare function createHttpTools(config?: Partial<HttpToolConfig>): Record<string, ToolDefinition>;
8
+ //# sourceMappingURL=http-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-tools.d.ts","sourceRoot":"","sources":["../src/http-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;CACvB;AAsBD,wBAAgB,eAAe,CAC7B,MAAM,GAAE,OAAO,CAAC,cAAc,CAAM,GACnC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA8GhC"}
@@ -0,0 +1,137 @@
1
+ const DEFAULT_HTTP_CONFIG = {
2
+ timeout: 30000,
3
+ maxResponseSize: 102400,
4
+ allowPrivate: false,
5
+ };
6
+ const PRIVATE_PATTERNS = [
7
+ /^file:\/\//i,
8
+ /^https?:\/\/localhost/i,
9
+ /^https?:\/\/127\./,
10
+ /^https?:\/\/10\./,
11
+ /^https?:\/\/192\.168\./,
12
+ /^https?:\/\/172\.(1[6-9]|2\d|3[01])\./,
13
+ /^https?:\/\/\[::1\]/,
14
+ ];
15
+ function isPrivateUrl(url) {
16
+ return PRIVATE_PATTERNS.some((p) => p.test(url));
17
+ }
18
+ export function createHttpTools(config = {}) {
19
+ const cfg = { ...DEFAULT_HTTP_CONFIG, ...config };
20
+ return {
21
+ httpFetch: {
22
+ description: 'Make an HTTP request. Returns status code and response body.',
23
+ parameters: {
24
+ url: { type: 'string', description: 'The URL to fetch', required: true },
25
+ method: { type: 'string', description: 'HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD (default: GET)', required: false },
26
+ headers: { type: 'object', description: 'Request headers as key-value pairs', required: false },
27
+ body: { type: 'string', description: 'Request body (for POST/PUT/PATCH)', required: false },
28
+ timeout: { type: 'number', description: 'Request timeout in milliseconds (default: 30000)', required: false },
29
+ },
30
+ execute: async (args) => {
31
+ const { url, method: m, headers, body, timeout: t } = args;
32
+ const method = m ?? 'GET';
33
+ const timeout = t ?? cfg.timeout;
34
+ if (!cfg.allowPrivate && isPrivateUrl(url)) {
35
+ return 'Blocked: requests to private/local URLs are disabled. Set tools.http.allowPrivate to enable.';
36
+ }
37
+ const controller = new AbortController();
38
+ const timer = setTimeout(() => controller.abort(), timeout);
39
+ try {
40
+ const response = await fetch(url, {
41
+ method,
42
+ headers,
43
+ body: body && ['POST', 'PUT', 'PATCH'].includes(method) ? body : undefined,
44
+ signal: controller.signal,
45
+ });
46
+ const contentType = response.headers.get('content-type') ?? 'unknown';
47
+ let responseBody = await response.text();
48
+ if (responseBody.length > cfg.maxResponseSize) {
49
+ responseBody =
50
+ responseBody.slice(0, cfg.maxResponseSize) + '\n... (response truncated)';
51
+ }
52
+ return `HTTP ${response.status} ${response.statusText}\nContent-Type: ${contentType}\n\n${responseBody}`;
53
+ }
54
+ catch (err) {
55
+ if (err instanceof DOMException && err.name === 'AbortError') {
56
+ return `Request timed out after ${timeout}ms`;
57
+ }
58
+ return `HTTP error: ${err instanceof Error ? err.message : String(err)}`;
59
+ }
60
+ finally {
61
+ clearTimeout(timer);
62
+ }
63
+ },
64
+ },
65
+ webSearch: {
66
+ description: 'Search the web using DuckDuckGo. Returns titles, URLs, and snippets. No API key required.',
67
+ parameters: {
68
+ query: { type: 'string', description: 'The search query', required: true },
69
+ maxResults: { type: 'number', description: 'Maximum number of results (default: 5)', required: false },
70
+ },
71
+ execute: async (args) => {
72
+ const { query, maxResults: mr } = args;
73
+ const maxResults = mr ?? 5;
74
+ const encoded = encodeURIComponent(query);
75
+ try {
76
+ // Try DuckDuckGo HTML search
77
+ const response = await fetch(`https://html.duckduckgo.com/html/?q=${encoded}`, {
78
+ headers: {
79
+ 'User-Agent': 'CereWorker/1.0',
80
+ },
81
+ });
82
+ const html = await response.text();
83
+ const results = parseDdgHtml(html, maxResults);
84
+ if (results.length > 0) {
85
+ return results
86
+ .map((r, i) => `${i + 1}. ${r.title}\n URL: ${r.url}\n ${r.snippet}`)
87
+ .join('\n\n');
88
+ }
89
+ // Fallback: DuckDuckGo Instant Answer API
90
+ const apiResp = await fetch(`https://api.duckduckgo.com/?q=${encoded}&format=json&no_html=1`);
91
+ const data = (await apiResp.json());
92
+ if (data.AbstractText) {
93
+ return `${data.AbstractText}\nSource: ${data.AbstractURL}`;
94
+ }
95
+ if (data.RelatedTopics && data.RelatedTopics.length > 0) {
96
+ return data.RelatedTopics.slice(0, maxResults)
97
+ .map((t, i) => `${i + 1}. ${t.Text}\n URL: ${t.FirstURL}`)
98
+ .join('\n\n');
99
+ }
100
+ return 'No search results found.';
101
+ }
102
+ catch (err) {
103
+ return `Search error: ${err instanceof Error ? err.message : String(err)}`;
104
+ }
105
+ },
106
+ },
107
+ };
108
+ }
109
+ function parseDdgHtml(html, max) {
110
+ const results = [];
111
+ // DuckDuckGo HTML results use class="result__a" for links and class="result__snippet" for descriptions
112
+ const linkRegex = /class="result__a"[^>]*href="([^"]*)"[^>]*>([^<]*)</g;
113
+ const snippetRegex = /class="result__snippet"[^>]*>([\s\S]*?)<\//g;
114
+ const links = [];
115
+ let match;
116
+ while ((match = linkRegex.exec(html)) !== null && links.length < max) {
117
+ let url = match[1];
118
+ // DDG wraps URLs in a redirect; extract the actual URL
119
+ const uddg = url.match(/uddg=([^&]+)/);
120
+ if (uddg)
121
+ url = decodeURIComponent(uddg[1]);
122
+ links.push({ url, title: match[2].trim() });
123
+ }
124
+ const snippets = [];
125
+ while ((match = snippetRegex.exec(html)) !== null && snippets.length < max) {
126
+ snippets.push(match[1].replace(/<[^>]+>/g, '').trim());
127
+ }
128
+ for (let i = 0; i < links.length; i++) {
129
+ results.push({
130
+ title: links[i].title,
131
+ url: links[i].url,
132
+ snippet: snippets[i] ?? '',
133
+ });
134
+ }
135
+ return results;
136
+ }
137
+ //# sourceMappingURL=http-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-tools.js","sourceRoot":"","sources":["../src/http-tools.ts"],"names":[],"mappings":"AAQA,MAAM,mBAAmB,GAAmB;IAC1C,OAAO,EAAE,KAAK;IACd,eAAe,EAAE,MAAM;IACvB,YAAY,EAAE,KAAK;CACpB,CAAC;AAEF,MAAM,gBAAgB,GAAG;IACvB,aAAa;IACb,wBAAwB;IACxB,mBAAmB;IACnB,kBAAkB;IAClB,wBAAwB;IACxB,uCAAuC;IACvC,qBAAqB;CACtB,CAAC;AAEF,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACnD,C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Ac,CAAC,CAAC;QACvC,IAAI,IAAI;YAAE,GAAG,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5C,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QAC3E,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC;YACX,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK;YACrB,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG;YACjB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,34 @@
1
+ export type { Message, MessageRole, ToolCall, ToolResult, Conversation, TaskAction, CerebellumStatus, OrchestratorConfig, VerificationResult, VerificationCheck, SubAgentState, SubAgentStatus, SubAgentCleanup, SubAgentSummary, AgentHealthAction, SystemStatus, StreamPhase, StreamFinishReason, StreamContentKind, StreamFinishMetadata, TurnProtocolState, BrowserTabSnapshot, BrowserStateSnapshot, TaskCheckpointStatus, TaskCheckpoint, ProgressEntry, TurnOutcome, TurnBoundaryKind, TurnBoundarySummary, TurnJournalEntryType, TurnJournalEntry, QuerySessionState, SessionSource, SessionEventType, SessionMemorySnapshot, SessionEvent, QuerySession, TaskScheduleCatchUpPolicy, TaskScheduleUnit, TaskKind, TaskReportTarget, TaskOriginSource, TaskRunStatus, TaskExecutionSurface, SchedulerStatus, IntervalTaskSchedule, DailyAtTaskSchedule, OneShotTaskSchedule, TaskSchedule, TaskOrigin, TaskDefinition, TaskRunRecord, SupervisorTaskState, SupervisorState, TrainingExample, TransportEnvelope, RecoveryCause, RecoveryAction, TurnRecoveryRequest, TurnRecoveryAssessment, } from './types.js';
2
+ export type { OrchestratorEvent } from './events.js';
3
+ export { TypedEventEmitter } from './events.js';
4
+ export { createAbortError, isAbortError, raceWithAbort, throwIfAborted } from './abort.js';
5
+ export { ensureDir, resolveStoreBasePath, readJsonFile, readJsonLines, appendJsonLine, writeTextFileAtomic, writeJsonFileAtomic, writeJsonLines, withTextStoreLock, } from './text-store.js';
6
+ export { ConversationStore } from './conversation.js';
7
+ export type { TurnJournalRetentionPolicy } from './conversation.js';
8
+ export { Orchestrator } from './orchestrator.js';
9
+ export { ToolRuntime } from './tool-runtime.js';
10
+ export { createLogger, configureLogger } from './logger.js';
11
+ export type { Logger, LogLevel } from './logger.js';
12
+ export type { CerebrumAdapter, CerebellumAdapter, ToolDefinition, StreamCallbacks, OrchestratorOptions, CompactionConfig, FineTuneStatus, TrainingPair, StreamState, } from './orchestrator.js';
13
+ export type { ToolRuntimeConfig, ToolRuntimeEngine, ToolLoopDetectionConfig, ToolExecutionContext, ToolExecutionValue, ToolRuntimeExecution, } from './tool-runtime.js';
14
+ export { SubAgentManager } from './sub-agent-manager.js';
15
+ export type { SubAgentManagerOptions } from './sub-agent-manager.js';
16
+ export { createSubAgentTools } from './sub-agent-tools.js';
17
+ export { estimateTokens, estimateMessageTokens, shouldCompact, buildCompactionMessages, } from './context.js';
18
+ export { buildSystemPrompt } from './system-prompt.js';
19
+ export type { SystemPromptOptions, RecurringTask } from './system-prompt.js';
20
+ export { PairingStore, formatCode, normalizeCode } from './pairing.js';
21
+ export type { PairingRequest, ApprovalResult } from './pairing.js';
22
+ export { createHttpTools } from './http-tools.js';
23
+ export type { HttpToolConfig } from './http-tools.js';
24
+ export { InstanceStore } from './instance.js';
25
+ export type { InstanceIdentity, InstanceProfile, FineTuneRecord } from './instance.js';
26
+ export { DiscoveryEngine } from './discovery.js';
27
+ export type { DiscoveryResult, DiscoveryCallbacks } from './discovery.js';
28
+ export { PlanStore } from './plan-store.js';
29
+ export type { Plan, PlanStep, PlanStatus, PlanStepStatus } from './plan-store.js';
30
+ export { TaskStore } from './task-store.js';
31
+ export { normalizeTaskSchedule, formatTaskSchedule, taskScheduleToHint, getNextTaskRun, } from './task-schedule.js';
32
+ export { ProactiveController } from './proactive.js';
33
+ export type { ProactiveConfig, ProactiveOutput } from './proactive.js';
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,OAAO,EACP,WAAW,EACX,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,yBAAyB,EACzB,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf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