replicas-engine 0.1.1723 → 0.1.1727

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.
@@ -6,21 +6,25 @@ import {
6
6
  fetchOpencodeModelVariants,
7
7
  getOpenCodeGoModel,
8
8
  getOpencodeProvider,
9
+ initializeGeminiAcp,
9
10
  initializeMuse,
10
11
  museTurnStartParams,
11
12
  opencodeConfig,
12
13
  opencodeModelRef,
13
14
  opencodeThinkingVariant,
14
15
  recoverCompletedTurn,
16
+ selectGeminiModel,
17
+ spawnGeminiAcp,
15
18
  spawnMuseMsp,
19
+ startGeminiSession,
16
20
  startMuseSession
17
- } from "./chunk-XPAPYRHZ.js";
18
- import "./chunk-7ZDAVYTV.js";
21
+ } from "./chunk-QN5PAZSN.js";
22
+ import "./chunk-XCFPXSY4.js";
19
23
  import {
20
24
  AppServerProcess,
21
25
  buildCodexAgentEnv
22
- } from "./chunk-NXMU4YQB.js";
23
- import "./chunk-7X2SLJ52.js";
26
+ } from "./chunk-F2YDU3AP.js";
27
+ import "./chunk-NTSUADYM.js";
24
28
  import {
25
29
  AGENT,
26
30
  OPENCODE_GO_PROVIDER,
@@ -30,7 +34,7 @@ import {
30
34
  headlessAgentUsagePath,
31
35
  isRecord,
32
36
  withTimeout
33
- } from "./chunk-S32SJWSV.js";
37
+ } from "./chunk-GBVHK7GR.js";
34
38
  import "./chunk-VEQXQN22.js";
35
39
 
36
40
  // src/headless-agent.ts
@@ -266,6 +270,42 @@ async function runMuse(request) {
266
270
  child.kill("SIGTERM");
267
271
  }
268
272
  }
273
+ async function runGemini(request) {
274
+ const { child, client } = spawnGeminiAcp(request.workingDirectory);
275
+ let stderr = "";
276
+ child.stderr.on("data", (chunk) => {
277
+ stderr = `${stderr}${chunk}`.slice(-2e3);
278
+ });
279
+ child.on("exit", (code, signal) => client.dispose(new Error(`Antigravity exited with ${code ?? signal}: ${stderr.trim()}`)));
280
+ client.on("serverRequest", (serverRequest) => client.respond(serverRequest.id, { outcome: { outcome: "cancelled" } }));
281
+ try {
282
+ await initializeGeminiAcp(client);
283
+ const session = await startGeminiSession(client, { cwd: request.workingDirectory });
284
+ await selectGeminiModel(client, session, request.model);
285
+ let message = "";
286
+ client.on("notification", (frame) => {
287
+ if (!isRecord(frame) || !isRecord(frame.params) || frame.params.sessionId !== session.sessionId || !isRecord(frame.params.update)) return;
288
+ const { update } = frame.params;
289
+ if (update.sessionUpdate === "agent_message_chunk" && isRecord(update.content) && typeof update.content.text === "string") {
290
+ message += update.content.text;
291
+ }
292
+ });
293
+ const response = await withTimeout(
294
+ client.request("session/prompt", { sessionId: session.sessionId, prompt: [{ type: "text", text: jsonReplyPrompt(request) }] }, { timeoutMs: 0 }),
295
+ request.timeoutSeconds * 1e3,
296
+ "Antigravity turn timed out"
297
+ );
298
+ if (!message) throw new Error("Antigravity returned no final message");
299
+ const usage = isRecord(response) && isRecord(response.usage) ? response.usage : null;
300
+ return {
301
+ output: parseJsonReply(message),
302
+ usage: usage && typeof usage.inputTokens === "number" && typeof usage.outputTokens === "number" ? { inputTokens: usage.inputTokens, outputTokens: usage.outputTokens } : null
303
+ };
304
+ } finally {
305
+ client.dispose();
306
+ child.kill("SIGTERM");
307
+ }
308
+ }
269
309
  async function main() {
270
310
  const [requestPath, outputPath] = process.argv.slice(2);
271
311
  if (!requestPath || !outputPath) throw new Error("Usage: replicas-headless-agent <request.json> <output.json>");
@@ -287,6 +327,9 @@ async function main() {
287
327
  case AGENT.MUSE:
288
328
  result = await runMuse(request);
289
329
  break;
330
+ case AGENT.GEMINI:
331
+ result = await runGemini(request);
332
+ break;
290
333
  case AGENT.PI:
291
334
  throw new Error("Send Pi credentials as an Opencode request, which reads the same stored secrets");
292
335
  case AGENT.REPLICAS: