@multiplayer-app/agent 0.0.7 → 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.
- package/dist/cli.js +15 -16
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +43 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +73 -11
- package/dist/config.js.map +1 -1
- package/dist/git-sync.d.ts +22 -0
- package/dist/git-sync.d.ts.map +1 -0
- package/dist/git-sync.js +107 -0
- package/dist/git-sync.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/dist/lambda-microvm-entrypoint.js +74 -39
- package/dist/lambda-microvm-entrypoint.js.map +1 -1
- package/dist/link.d.ts +16 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +76 -0
- package/dist/link.js.map +1 -0
- package/dist/loop.d.ts.map +1 -1
- package/dist/loop.js +8 -6
- package/dist/loop.js.map +1 -1
- package/dist/mcp/mcp-connection.js +1 -1
- package/dist/mcp/mcp-connection.js.map +1 -1
- package/dist/mcp/mcp-tools.js +1 -1
- package/dist/mcp/mcp-tools.js.map +1 -1
- package/dist/model.d.ts +4 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +20 -0
- package/dist/model.js.map +1 -0
- package/dist/protocol.d.ts +174 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +95 -0
- package/dist/protocol.js.map +1 -0
- package/dist/protocol.test.d.ts +2 -0
- package/dist/protocol.test.d.ts.map +1 -0
- package/dist/protocol.test.js +25 -0
- package/dist/protocol.test.js.map +1 -0
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +22 -44
- package/dist/report.js.map +1 -1
- package/dist/research/filingramp-client.d.ts +28 -0
- package/dist/research/filingramp-client.d.ts.map +1 -0
- package/dist/research/filingramp-client.js +124 -0
- package/dist/research/filingramp-client.js.map +1 -0
- package/dist/research/filingramp-tools.d.ts +10 -0
- package/dist/research/filingramp-tools.d.ts.map +1 -0
- package/dist/research/filingramp-tools.js +447 -0
- package/dist/research/filingramp-tools.js.map +1 -0
- package/dist/research/prompt.d.ts +13 -0
- package/dist/research/prompt.d.ts.map +1 -0
- package/dist/research/prompt.js +40 -0
- package/dist/research/prompt.js.map +1 -0
- package/dist/research/scope.d.ts +24 -0
- package/dist/research/scope.d.ts.map +1 -0
- package/dist/research/scope.js +103 -0
- package/dist/research/scope.js.map +1 -0
- package/dist/research/scope.test.d.ts +2 -0
- package/dist/research/scope.test.d.ts.map +1 -0
- package/dist/research/scope.test.js +45 -0
- package/dist/research/scope.test.js.map +1 -0
- package/dist/runtime.d.ts +10 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +35 -0
- package/dist/runtime.js.map +1 -0
- package/dist/session.d.ts +38 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +427 -0
- package/dist/session.js.map +1 -0
- package/dist/tools/fs-tools.js +1 -1
- package/dist/tools/fs-tools.js.map +1 -1
- package/package.json +8 -2
package/dist/session.js
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SessionAgent = void 0;
|
|
7
|
+
exports.limitConversation = limitConversation;
|
|
8
|
+
exports.runSessionAgent = runSessionAgent;
|
|
9
|
+
// Session mode: the process stays up for the life of the session VM and serves chat turns
|
|
10
|
+
// the platform forwards as commands. One turn = one streamText loop over the conversation so
|
|
11
|
+
// far; every delta, tool call, progress step and token count goes up the link as it happens,
|
|
12
|
+
// so the chat shows exactly what the guest does without the API running a model of its own.
|
|
13
|
+
//
|
|
14
|
+
// Durability: the conversation is checkpointed to .builder/conversation.json after every turn
|
|
15
|
+
// and the whole workspace is committed to the session's git branch (git-sync.ts) on
|
|
16
|
+
// checkpoints, so a VM that Lambda terminates after a long suspend resumes where it stopped.
|
|
17
|
+
const fs_1 = require("fs");
|
|
18
|
+
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const ai_1 = require("ai");
|
|
20
|
+
const zod_1 = require("zod");
|
|
21
|
+
const git_sync_1 = require("./git-sync");
|
|
22
|
+
const mcp_tools_1 = require("./mcp/mcp-tools");
|
|
23
|
+
const model_1 = require("./model");
|
|
24
|
+
const filingramp_client_1 = require("./research/filingramp-client");
|
|
25
|
+
const filingramp_tools_1 = require("./research/filingramp-tools");
|
|
26
|
+
const prompt_1 = require("./research/prompt");
|
|
27
|
+
const exec_tools_1 = require("./tools/exec-tools");
|
|
28
|
+
const fs_tools_1 = require("./tools/fs-tools");
|
|
29
|
+
const CONVERSATION_FILE = '.builder/conversation.json';
|
|
30
|
+
const MAX_STEPS_PER_TURN = 80;
|
|
31
|
+
/** Rough context cap (chars ≈ tokens × 4): older turns are dropped, the first question is kept. */
|
|
32
|
+
const CONTEXT_CHAR_BUDGET = 480000;
|
|
33
|
+
const PERIODIC_CHECKPOINT_MS = 10 * 60000;
|
|
34
|
+
const MAX_PUBLISHED_FILE_BYTES = 512 * 1024;
|
|
35
|
+
const MAX_EXTRACTION_CHARS = 60000;
|
|
36
|
+
const CODING_SYSTEM_PROMPT = `You are a coding agent running inside an isolated session workspace VM with a persistent disk. You have direct tools to read/write files and run shell commands in the workspace, plus (if any MCP servers are configured) search_tools/get_tool_details/call_mcp_tool to use them. Work efficiently, verify with cheap commands (build, lint), report progress with report_progress, publish deliverables with publish_results, and finish each turn with a concise summary.`;
|
|
37
|
+
function approxChars(message) {
|
|
38
|
+
return JSON.stringify(message).length;
|
|
39
|
+
}
|
|
40
|
+
/** Drops the oldest turns (user message + everything up to the next user message) past the cap, keeping the first one. */
|
|
41
|
+
function limitConversation(messages, charBudget = CONTEXT_CHAR_BUDGET) {
|
|
42
|
+
var _a;
|
|
43
|
+
let total = messages.reduce((sum, message) => sum + approxChars(message), 0);
|
|
44
|
+
if (total <= charBudget)
|
|
45
|
+
return messages;
|
|
46
|
+
const result = [...messages];
|
|
47
|
+
while (total > charBudget) {
|
|
48
|
+
const userIndexes = result.map((m, i) => (m.role === 'user' ? i : -1)).filter((i) => i >= 0);
|
|
49
|
+
if (userIndexes.length < 2)
|
|
50
|
+
break;
|
|
51
|
+
const start = userIndexes[1];
|
|
52
|
+
const end = (_a = userIndexes[2]) !== null && _a !== void 0 ? _a : result.length;
|
|
53
|
+
const removed = result.splice(start, end - start);
|
|
54
|
+
total -= removed.reduce((sum, message) => sum + approxChars(message), 0);
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
function usageOf(part) {
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
const usage = part.usage;
|
|
61
|
+
if (!usage)
|
|
62
|
+
return undefined;
|
|
63
|
+
const inputTokens = (_a = usage.inputTokens) !== null && _a !== void 0 ? _a : 0;
|
|
64
|
+
const outputTokens = (_b = usage.outputTokens) !== null && _b !== void 0 ? _b : 0;
|
|
65
|
+
return { inputTokens, outputTokens, totalTokens: (_c = usage.totalTokens) !== null && _c !== void 0 ? _c : inputTokens + outputTokens };
|
|
66
|
+
}
|
|
67
|
+
class SessionAgent {
|
|
68
|
+
constructor(config, link) {
|
|
69
|
+
this.config = config;
|
|
70
|
+
this.link = link;
|
|
71
|
+
this.messages = [];
|
|
72
|
+
this.usedTokens = 0;
|
|
73
|
+
this.budgetPaused = false;
|
|
74
|
+
this.queue = [];
|
|
75
|
+
this.tools = {};
|
|
76
|
+
this.systemPrompt = CODING_SYSTEM_PROMPT;
|
|
77
|
+
this.stopped = false;
|
|
78
|
+
this.budget = config.tokenBudget;
|
|
79
|
+
if (config.git)
|
|
80
|
+
this.gitSync = new git_sync_1.GitSync(config.git);
|
|
81
|
+
}
|
|
82
|
+
get workspaceDir() {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
return (_b = (_a = this.gitSync) === null || _a === void 0 ? void 0 : _a.dir) !== null && _b !== void 0 ? _b : this.config.workspaceDir;
|
|
85
|
+
}
|
|
86
|
+
async start() {
|
|
87
|
+
var _a;
|
|
88
|
+
let restored = false;
|
|
89
|
+
if (this.gitSync) {
|
|
90
|
+
try {
|
|
91
|
+
restored = await this.gitSync.restore();
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.error('[session] git restore failed, continuing with an empty workspace:', error.message);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
await fs_1.promises.mkdir(this.workspaceDir, { recursive: true });
|
|
98
|
+
restored = (await this.loadConversation()) || restored;
|
|
99
|
+
this.tools = this.buildTools();
|
|
100
|
+
this.systemPrompt =
|
|
101
|
+
this.config.profile === 'research'
|
|
102
|
+
? (0, prompt_1.buildResearchSystemPrompt)({
|
|
103
|
+
scope: this.config.researchScope,
|
|
104
|
+
industryData: Boolean((_a = this.config.filingRamp) === null || _a === void 0 ? void 0 : _a.industryData),
|
|
105
|
+
tokenBudget: this.budget,
|
|
106
|
+
})
|
|
107
|
+
: CODING_SYSTEM_PROMPT;
|
|
108
|
+
this.link.onCommand((command) => this.handle(command));
|
|
109
|
+
await this.link.ready();
|
|
110
|
+
this.link.send({ type: 'ready', mode: 'session', profile: this.config.profile, restored });
|
|
111
|
+
console.log(`[session] ready session=${this.config.sessionId} profile=${this.config.profile} restored=${restored}`);
|
|
112
|
+
}
|
|
113
|
+
/** Lifecycle hooks (suspend / terminate) call this; it is safe to call repeatedly. */
|
|
114
|
+
async checkpoint(reason) {
|
|
115
|
+
await this.saveConversation();
|
|
116
|
+
if (!this.gitSync)
|
|
117
|
+
return;
|
|
118
|
+
try {
|
|
119
|
+
const commit = await this.gitSync.commit(`checkpoint: ${reason}`);
|
|
120
|
+
this.link.send({ type: 'checkpointed', commit });
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
console.error('[session] git checkpoint failed:', error.message);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async stop() {
|
|
127
|
+
var _a;
|
|
128
|
+
this.stopped = true;
|
|
129
|
+
(_a = this.current) === null || _a === void 0 ? void 0 : _a.abort.abort();
|
|
130
|
+
await this.checkpoint('shutdown');
|
|
131
|
+
}
|
|
132
|
+
async handle(command) {
|
|
133
|
+
var _a;
|
|
134
|
+
switch (command.type) {
|
|
135
|
+
case 'message':
|
|
136
|
+
if (this.current) {
|
|
137
|
+
this.queue.push({ messageId: command.messageId, text: command.text });
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
void this.runTurn(command.messageId, command.text);
|
|
141
|
+
return;
|
|
142
|
+
case 'abort':
|
|
143
|
+
this.queue.length = 0;
|
|
144
|
+
(_a = this.current) === null || _a === void 0 ? void 0 : _a.abort.abort();
|
|
145
|
+
return;
|
|
146
|
+
case 'checkpoint':
|
|
147
|
+
await this.checkpoint('requested');
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
buildTools() {
|
|
152
|
+
const tools = {
|
|
153
|
+
...(0, fs_tools_1.createFsTools)(this.workspaceDir),
|
|
154
|
+
...(0, exec_tools_1.createExecTools)(this.workspaceDir),
|
|
155
|
+
...(0, mcp_tools_1.createMcpTools)(this.config.mcpConnections),
|
|
156
|
+
report_progress: (0, ai_1.tool)({
|
|
157
|
+
description: 'Show the user a checklist of the phases of the current work and their status. Call it when a phase starts or finishes.',
|
|
158
|
+
inputSchema: zod_1.z.object({
|
|
159
|
+
steps: zod_1.z
|
|
160
|
+
.array(zod_1.z.object({
|
|
161
|
+
key: zod_1.z.string().min(1).max(60),
|
|
162
|
+
label: zod_1.z.string().min(1).max(120),
|
|
163
|
+
status: zod_1.z.enum(['pending', 'active', 'done', 'failed']),
|
|
164
|
+
detail: zod_1.z.string().max(200).optional(),
|
|
165
|
+
}))
|
|
166
|
+
.min(1)
|
|
167
|
+
.max(20),
|
|
168
|
+
}),
|
|
169
|
+
execute: async ({ steps }) => {
|
|
170
|
+
if (this.current)
|
|
171
|
+
this.link.send({ type: 'progress', messageId: this.current.messageId, steps: steps });
|
|
172
|
+
return { ok: true };
|
|
173
|
+
},
|
|
174
|
+
}),
|
|
175
|
+
ask_user: (0, ai_1.tool)({
|
|
176
|
+
description: 'Pause and ask the user a question you cannot answer yourself (confirm a large population, choose between interpretations, approve spending more tokens). The turn ends after this call; the answer arrives as the next user message.',
|
|
177
|
+
inputSchema: zod_1.z.object({
|
|
178
|
+
question: zod_1.z.string().min(1).max(2000),
|
|
179
|
+
options: zod_1.z.array(zod_1.z.string().max(120)).max(6).optional(),
|
|
180
|
+
}),
|
|
181
|
+
execute: async ({ question, options }) => {
|
|
182
|
+
if (this.current) {
|
|
183
|
+
this.current.askedUser = true;
|
|
184
|
+
this.link.send({ type: 'question', messageId: this.current.messageId, text: question, options });
|
|
185
|
+
}
|
|
186
|
+
return { asked: true };
|
|
187
|
+
},
|
|
188
|
+
}),
|
|
189
|
+
publish_results: (0, ai_1.tool)({
|
|
190
|
+
description: 'Store text files from the workspace as session artifacts the user sees in the session (findings.md, results.csv, evidence.json, notes). Call it whenever a deliverable changes. Max 512 KB per file.',
|
|
191
|
+
inputSchema: zod_1.z.object({ paths: zod_1.z.array(zod_1.z.string().min(1).max(500)).min(1).max(20) }),
|
|
192
|
+
execute: async ({ paths }) => {
|
|
193
|
+
var _a;
|
|
194
|
+
const files = [];
|
|
195
|
+
const skipped = [];
|
|
196
|
+
for (const relative of paths) {
|
|
197
|
+
const target = path_1.default.resolve(this.workspaceDir, relative);
|
|
198
|
+
if (!target.startsWith(path_1.default.resolve(this.workspaceDir) + path_1.default.sep)) {
|
|
199
|
+
skipped.push({ path: relative, reason: 'outside the workspace' });
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
try {
|
|
203
|
+
const buffer = await fs_1.promises.readFile(target);
|
|
204
|
+
if (buffer.byteLength > MAX_PUBLISHED_FILE_BYTES) {
|
|
205
|
+
skipped.push({ path: relative, reason: `larger than ${MAX_PUBLISHED_FILE_BYTES} bytes` });
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (buffer.includes(0)) {
|
|
209
|
+
skipped.push({ path: relative, reason: 'binary file' });
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
files.push({ path: relative.replace(/^\/+/, ''), content: buffer.toString('utf8') });
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
skipped.push({ path: relative, reason: error.message });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (files.length)
|
|
219
|
+
this.link.send({ type: 'files', messageId: (_a = this.current) === null || _a === void 0 ? void 0 : _a.messageId, files });
|
|
220
|
+
return { published: files.map((file) => file.path), skipped };
|
|
221
|
+
},
|
|
222
|
+
}),
|
|
223
|
+
};
|
|
224
|
+
if (this.config.profile === 'research') {
|
|
225
|
+
if (this.config.filingRamp) {
|
|
226
|
+
const client = new filingramp_client_1.FilingRampClient(this.config.filingRamp);
|
|
227
|
+
Object.assign(tools, (0, filingramp_tools_1.createFilingRampTools)({ client, workspaceDir: this.workspaceDir, scope: this.config.researchScope }));
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
console.warn('[session] research profile without FilingRamp credentials — filing tools disabled');
|
|
231
|
+
}
|
|
232
|
+
tools.extract_from_texts = this.extractionTool();
|
|
233
|
+
}
|
|
234
|
+
return tools;
|
|
235
|
+
}
|
|
236
|
+
/** Bulk extraction on the cheaper model: one call per file, structured rows appended to a JSONL file. */
|
|
237
|
+
extractionTool() {
|
|
238
|
+
return (0, ai_1.tool)({
|
|
239
|
+
description: 'Extract the same facts from many extracted-text files with a cheaper model, one file at a time, appending one JSON row per file to outputPath (JSONL). Use after search_documents/download_attachment saved texts under data/text/. Each row has the requested fields plus `quote` (the supporting span) and `source`.',
|
|
240
|
+
inputSchema: zod_1.z.object({
|
|
241
|
+
paths: zod_1.z.array(zod_1.z.string().min(1).max(500)).min(1).max(50),
|
|
242
|
+
question: zod_1.z.string().min(1).max(2000).describe('What to look for, precisely'),
|
|
243
|
+
fields: zod_1.z.array(zod_1.z.string().min(1).max(60)).min(1).max(15).describe('Field names each row must contain'),
|
|
244
|
+
outputPath: zod_1.z.string().min(1).max(300).describe('e.g. data/extracted/water-valve.jsonl'),
|
|
245
|
+
}),
|
|
246
|
+
execute: async ({ paths, question, fields, outputPath }) => {
|
|
247
|
+
var _a, _b;
|
|
248
|
+
const model = (0, model_1.resolveLanguageModel)(this.config.provider, this.config.extractionModel);
|
|
249
|
+
const output = path_1.default.resolve(this.workspaceDir, outputPath);
|
|
250
|
+
await fs_1.promises.mkdir(path_1.default.dirname(output), { recursive: true });
|
|
251
|
+
let rows = 0;
|
|
252
|
+
const failures = [];
|
|
253
|
+
for (const relative of paths) {
|
|
254
|
+
if ((_a = this.current) === null || _a === void 0 ? void 0 : _a.abort.signal.aborted)
|
|
255
|
+
break;
|
|
256
|
+
try {
|
|
257
|
+
const text = (await fs_1.promises.readFile(path_1.default.resolve(this.workspaceDir, relative), 'utf8')).slice(0, MAX_EXTRACTION_CHARS);
|
|
258
|
+
const result = await (0, ai_1.generateText)({
|
|
259
|
+
model,
|
|
260
|
+
abortSignal: (_b = this.current) === null || _b === void 0 ? void 0 : _b.abort.signal,
|
|
261
|
+
system: 'You extract facts from one insurance filing document. Answer with a single JSON object only — no prose. Use null for a field the document does not state. Always include "quote": the exact supporting text (max 300 characters) or null, and "found": true|false.',
|
|
262
|
+
prompt: `Question: ${question}\nFields: ${fields.join(', ')}\n\nDocument (${relative}):\n${text}`,
|
|
263
|
+
});
|
|
264
|
+
const usage = usageOf(result);
|
|
265
|
+
if (usage)
|
|
266
|
+
this.recordUsage(usage, this.config.extractionModel);
|
|
267
|
+
const match = result.text.match(/\{[\s\S]*\}/);
|
|
268
|
+
const parsed = match ? JSON.parse(match[0]) : { found: false };
|
|
269
|
+
await fs_1.promises.appendFile(output, `${JSON.stringify({ source: relative, ...parsed })}\n`);
|
|
270
|
+
rows += 1;
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
failures.push({ path: relative, reason: error.message });
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return { outputPath, rows, failures, model: this.config.extractionModel };
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
recordUsage(usage, model) {
|
|
281
|
+
this.usedTokens += usage.totalTokens;
|
|
282
|
+
if (this.current)
|
|
283
|
+
this.link.send({ type: 'usage', messageId: this.current.messageId, usage: { ...usage, model } });
|
|
284
|
+
}
|
|
285
|
+
budgetExceeded() {
|
|
286
|
+
return this.budget !== undefined && this.usedTokens >= this.budget;
|
|
287
|
+
}
|
|
288
|
+
async runTurn(messageId, text) {
|
|
289
|
+
var _a, _b, _c;
|
|
290
|
+
const turn = { messageId, abort: new AbortController(), askedUser: false };
|
|
291
|
+
this.current = turn;
|
|
292
|
+
this.link.send({ type: 'turn_start', messageId });
|
|
293
|
+
// A paused-for-budget session resumes when the user says so: extend by the original budget.
|
|
294
|
+
if (this.budgetPaused && this.config.tokenBudget) {
|
|
295
|
+
if (/^(continue|yes|go on|proceed)/i.test(text.trim())) {
|
|
296
|
+
this.budget = this.usedTokens + this.config.tokenBudget;
|
|
297
|
+
this.budgetPaused = false;
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
this.link.send({ type: 'done', messageId, summary: 'The token budget is used up. Reply "continue" to extend it, or stop the session.' });
|
|
301
|
+
this.current = undefined;
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
this.messages.push({ role: 'user', content: text });
|
|
306
|
+
this.periodic = setInterval(() => void this.checkpoint('periodic'), PERIODIC_CHECKPOINT_MS);
|
|
307
|
+
let partialText = '';
|
|
308
|
+
let completed = false;
|
|
309
|
+
try {
|
|
310
|
+
const model = (0, model_1.resolveLanguageModel)(this.config.provider, this.config.model);
|
|
311
|
+
const result = (0, ai_1.streamText)({
|
|
312
|
+
model,
|
|
313
|
+
system: this.systemPrompt,
|
|
314
|
+
messages: limitConversation(this.messages),
|
|
315
|
+
tools: this.tools,
|
|
316
|
+
abortSignal: turn.abort.signal,
|
|
317
|
+
stopWhen: [(0, ai_1.stepCountIs)(MAX_STEPS_PER_TURN), () => turn.askedUser || this.budgetExceeded()],
|
|
318
|
+
});
|
|
319
|
+
for await (const part of result.fullStream) {
|
|
320
|
+
switch (part.type) {
|
|
321
|
+
case 'text-delta':
|
|
322
|
+
partialText += part.text;
|
|
323
|
+
this.link.send({ type: 'text_delta', messageId, text: part.text });
|
|
324
|
+
break;
|
|
325
|
+
case 'reasoning-delta':
|
|
326
|
+
this.link.send({ type: 'reasoning_delta', messageId, text: part.text });
|
|
327
|
+
break;
|
|
328
|
+
case 'tool-call':
|
|
329
|
+
this.link.send({ type: 'tool_call_start', messageId, toolCallId: part.toolCallId, toolName: part.toolName, input: part.input });
|
|
330
|
+
break;
|
|
331
|
+
case 'tool-result':
|
|
332
|
+
this.link.send({ type: 'tool_call_result', messageId, toolCallId: part.toolCallId, output: part.output });
|
|
333
|
+
break;
|
|
334
|
+
case 'tool-error':
|
|
335
|
+
this.link.send({
|
|
336
|
+
type: 'tool_call_result',
|
|
337
|
+
messageId,
|
|
338
|
+
toolCallId: part.toolCallId,
|
|
339
|
+
error: part.error instanceof Error ? part.error.message : String(part.error),
|
|
340
|
+
});
|
|
341
|
+
break;
|
|
342
|
+
case 'finish-step': {
|
|
343
|
+
const usage = usageOf(part);
|
|
344
|
+
if (usage)
|
|
345
|
+
this.recordUsage(usage, (_b = (_a = part.response) === null || _a === void 0 ? void 0 : _a.modelId) !== null && _b !== void 0 ? _b : this.config.model);
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
case 'error':
|
|
349
|
+
throw part.error instanceof Error ? part.error : new Error(String(part.error));
|
|
350
|
+
default:
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
const response = await result.response;
|
|
355
|
+
this.messages.push(...response.messages);
|
|
356
|
+
completed = true;
|
|
357
|
+
if (this.budgetExceeded() && !turn.askedUser) {
|
|
358
|
+
this.budgetPaused = true;
|
|
359
|
+
this.link.send({
|
|
360
|
+
type: 'question',
|
|
361
|
+
messageId,
|
|
362
|
+
text: `I have used ${this.usedTokens.toLocaleString()} tokens, which reaches this session's budget. Reply "continue" to extend it by ${(_c = this.config.tokenBudget) === null || _c === void 0 ? void 0 : _c.toLocaleString()} tokens, or tell me to wrap up with what I have.`,
|
|
363
|
+
options: ['continue', 'wrap up'],
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
const summary = (await result.text) || partialText;
|
|
367
|
+
this.link.send({ type: 'done', messageId, summary });
|
|
368
|
+
}
|
|
369
|
+
catch (error) {
|
|
370
|
+
const aborted = turn.abort.signal.aborted;
|
|
371
|
+
if (!completed) {
|
|
372
|
+
// Keep the conversation consistent: a stopped turn leaves text, never a dangling tool call.
|
|
373
|
+
this.messages.push({ role: 'assistant', content: partialText || (aborted ? '(stopped by the user)' : '(turn failed)') });
|
|
374
|
+
}
|
|
375
|
+
if (aborted) {
|
|
376
|
+
this.link.send({ type: 'done', messageId, summary: partialText ? `${partialText}\n\n_Stopped._` : 'Stopped.' });
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
380
|
+
console.error('[session] turn failed:', message);
|
|
381
|
+
this.link.send({ type: 'error', messageId, message });
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
finally {
|
|
385
|
+
if (this.periodic)
|
|
386
|
+
clearInterval(this.periodic);
|
|
387
|
+
this.periodic = undefined;
|
|
388
|
+
this.current = undefined;
|
|
389
|
+
await this.checkpoint('turn finished');
|
|
390
|
+
const next = this.queue.shift();
|
|
391
|
+
if (next && !this.stopped)
|
|
392
|
+
void this.runTurn(next.messageId, next.text);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
conversationPath() {
|
|
396
|
+
return path_1.default.join(this.workspaceDir, CONVERSATION_FILE);
|
|
397
|
+
}
|
|
398
|
+
async loadConversation() {
|
|
399
|
+
var _a;
|
|
400
|
+
try {
|
|
401
|
+
const raw = await fs_1.promises.readFile(this.conversationPath(), 'utf8');
|
|
402
|
+
const parsed = JSON.parse(raw);
|
|
403
|
+
if (parsed.version === 1 && Array.isArray(parsed.messages)) {
|
|
404
|
+
this.messages = parsed.messages;
|
|
405
|
+
this.usedTokens = (_a = parsed.usedTokens) !== null && _a !== void 0 ? _a : 0;
|
|
406
|
+
return this.messages.length > 0;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
catch (_b) {
|
|
410
|
+
/* first boot of this session */
|
|
411
|
+
}
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
async saveConversation() {
|
|
415
|
+
const target = this.conversationPath();
|
|
416
|
+
await fs_1.promises.mkdir(path_1.default.dirname(target), { recursive: true });
|
|
417
|
+
const payload = { version: 1, messages: this.messages, usedTokens: this.usedTokens };
|
|
418
|
+
await fs_1.promises.writeFile(target, JSON.stringify(payload));
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
exports.SessionAgent = SessionAgent;
|
|
422
|
+
async function runSessionAgent(config, link) {
|
|
423
|
+
const agent = new SessionAgent(config, link);
|
|
424
|
+
await agent.start();
|
|
425
|
+
return agent;
|
|
426
|
+
}
|
|
427
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":";;;;;;AAmDA,8CAaC;AAkXD,0CAIC;AAtbD,0FAA0F;AAC1F,6FAA6F;AAC7F,6FAA6F;AAC7F,4FAA4F;AAC5F,EAAE;AACF,8FAA8F;AAC9F,oFAAoF;AACpF,6FAA6F;AAC7F,2BAAmC;AACnC,gDAAuB;AACvB,2BAA8F;AAC9F,6BAAuB;AAEvB,yCAAoC;AAEpC,+CAAgD;AAChD,mCAA8C;AAE9C,oEAA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CAAgC;QAClC,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAEO,KAAK,CAAC,gBAAgB;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAA;QACtC,MAAM,aAAE,CAAC,KAAK,CAAC,cAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACzD,MAAM,OAAO,GAA0B,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAA;QAC3G,MAAM,aAAE,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IACrD,CAAC;CACF;AAtWD,oCAsWC;AAEM,KAAK,UAAU,eAAe,CAAC,MAA0B,EAAE,IAAiB;IACjF,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC5C,MAAM,KAAK,CAAC,KAAK,EAAE,CAAA;IACnB,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/dist/tools/fs-tools.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createFsTools = createFsTools;
|
|
7
|
-
// Local equivalents of
|
|
7
|
+
// Local equivalents of services/api/src/agents/shared/app-vm.tools.ts's writeAppFilesTool
|
|
8
8
|
// (schema/semantics kept for continuity) — but the agent runs inside the VM now, so these are
|
|
9
9
|
// plain Node fs calls against the workspace directory, not an RPC to a remote session bridge.
|
|
10
10
|
const fs_1 = require("fs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-tools.js","sourceRoot":"","sources":["../../src/tools/fs-tools.ts"],"names":[],"mappings":";;;;;AAmBA,sCA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,EAAE,CAAC,CAAC,CAAE,WAAqB,CAAC,CAAC,CAAE,MAAgB;iBACvE,CAAC,CAAC;aACJ,CAAA;QACH,CAAC;KACF,CAAC,CAAA;IAEF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,CAAA;AAC5F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplayer-app/agent",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Agent that runs inside a session VM — one-shot coding tasks or long-lived research sessions driven over the gateway socket; local file/exec tools, FilingRamp research tools, MCP over env-var config",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"require": "./dist/index.js",
|
|
11
11
|
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./protocol": {
|
|
14
|
+
"types": "./dist/protocol.d.ts",
|
|
15
|
+
"require": "./dist/protocol.js",
|
|
16
|
+
"default": "./dist/protocol.js"
|
|
12
17
|
}
|
|
13
18
|
},
|
|
14
19
|
"bin": {
|
|
@@ -25,6 +30,7 @@
|
|
|
25
30
|
"dependencies": {
|
|
26
31
|
"@ai-sdk/anthropic": "3.0.42",
|
|
27
32
|
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
33
|
+
"@openrouter/ai-sdk-provider": "2.9.1",
|
|
28
34
|
"ai": "6.0.3",
|
|
29
35
|
"socket.io-client": "4.8.3",
|
|
30
36
|
"zod": "^4.2.1"
|