limixbot 0.3.108 → 0.3.110

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 (57) hide show
  1. package/dist/assets/{ActivityPanel-CTrLS1XS.js → ActivityPanel-ealYfVzE.js} +1 -1
  2. package/dist/assets/{App-CG84MXOY.js → App-ExQJKJEP.js} +8 -8
  3. package/dist/assets/{AppEventEditor-ZtIPD0FQ.js → AppEventEditor-C3gJpVWL.js} +1 -1
  4. package/dist/assets/{BotSettingsDialog-C3tyr4gD.js → BotSettingsDialog-BdYHpaKY.js} +4 -4
  5. package/dist/assets/{BrowserPanel-BBSj_PCL.js → BrowserPanel-CwIut2ui.js} +1 -1
  6. package/dist/assets/{BrowserProfilesManager-CBzqzPcQ.js → BrowserProfilesManager-tNRPB-uL.js} +1 -1
  7. package/dist/assets/{CloudAddDialog-tp51EOQi.js → CloudAddDialog-lItXF3Nl.js} +1 -1
  8. package/dist/assets/{ComputerFilesPane-QxES8_oW.js → ComputerFilesPane-DKBUyWJD.js} +1 -1
  9. package/dist/assets/{ComputerPanel-Go21aHH_.js → ComputerPanel-B77Lywcl.js} +2 -2
  10. package/dist/assets/{DataPanel-CohjsyZS.js → DataPanel-DRS8E4zZ.js} +1 -1
  11. package/dist/assets/{GrokMoveDialog-Dta-wMUD.js → GrokMoveDialog-DHMMT7Av.js} +1 -1
  12. package/dist/assets/{InspectorPanel-DNVQ8l5h.js → InspectorPanel-Ds9BkkJu.js} +1 -1
  13. package/dist/assets/{KeyboardShortcutsModal-DKAqPkt7.js → KeyboardShortcutsModal-CgTOpa3v.js} +1 -1
  14. package/dist/assets/{LimixResizeHandles-DkFJU9cC.js → LimixResizeHandles-DBAMoEqz.js} +1 -1
  15. package/dist/assets/{LiveDesktop-CBma2qSi.js → LiveDesktop-BJ7zgHIQ.js} +1 -1
  16. package/dist/assets/{LocalVmWorkspace-Dmj0Asui.js → LocalVmWorkspace-DES13vVe.js} +1 -1
  17. package/dist/assets/{MacLocalControl-3ulCDLa0.js → MacLocalControl-DxnBZ0Ne.js} +1 -1
  18. package/dist/assets/{MarkdownFilePreview-D14WSq4R.js → MarkdownFilePreview-BoLNjM07.js} +1 -1
  19. package/dist/assets/{NewBotDialog-YvTqJ2Ew.js → NewBotDialog-CU1eL3ey.js} +1 -1
  20. package/dist/assets/{PhoneAppDialog-ilnxxFj8.js → PhoneAppDialog-DHfTvMWh.js} +1 -1
  21. package/dist/assets/{PluginsPanel-BcyGpf-0.js → PluginsPanel-CD4M6CMA.js} +1 -1
  22. package/dist/assets/{ProIntroduction-CSkNp2Uo.js → ProIntroduction-D5GICbcu.js} +1 -1
  23. package/dist/assets/{RemoteAgentSettingsPanel-CqIm4aob.js → RemoteAgentSettingsPanel-q1QqJ2ZE.js} +1 -1
  24. package/dist/assets/{RoomPanel-DV9a_WMs.js → RoomPanel-Cnhggtf1.js} +1 -1
  25. package/dist/assets/{RoutinesPage-l0d2HuFh.js → RoutinesPage-CLRcCB9f.js} +1 -1
  26. package/dist/assets/{SettingsModal-DrG6Vc09.js → SettingsModal-DDsP9I82.js} +1 -1
  27. package/dist/assets/{ShareTeamDialog-CxhYnAKl.js → ShareTeamDialog-Bcmv1cry.js} +1 -1
  28. package/dist/assets/{SignedInSites-BLbxN4TK.js → SignedInSites-4Vge3Znu.js} +1 -1
  29. package/dist/assets/{TeamLibraryPanel-DCCNY9_4.js → TeamLibraryPanel-DKrW-8E8.js} +1 -1
  30. package/dist/assets/{TeamMapPage-BHXeLBCn.js → TeamMapPage-Bf5766G0.js} +1 -1
  31. package/dist/assets/{TriggersPage-DFXX3U13.js → TriggersPage-C_bZuLDU.js} +1 -1
  32. package/dist/assets/{VisibilitySection-Bj2CSIz8.js → VisibilitySection-CEJQJtla.js} +1 -1
  33. package/dist/assets/{WebhookTrigger-BUWw55_B.js → WebhookTrigger-BDBsUhLR.js} +1 -1
  34. package/dist/assets/{WorksOnGrid-DI002IF-.js → WorksOnGrid-0reiMxMC.js} +1 -1
  35. package/dist/assets/{core-DVjkFPvv.js → core-vzoqg-hA.js} +1 -1
  36. package/dist/assets/{import-name-He5LDxDq.js → import-name-DwslErtr.js} +1 -1
  37. package/dist/assets/{index-Cp-6CGKc.js → index-BRT0fVvF.js} +1 -1
  38. package/dist/assets/{index-DlFIRtPe.js → index-D8Gg5AcQ.js} +2 -2
  39. package/dist/assets/{mcp-servers-CLZ0PI_2.js → mcp-servers-BGIdhG_Y.js} +1 -1
  40. package/dist/assets/{new-bot-DxHaApV0.js → new-bot-BG5ujKuR.js} +1 -1
  41. package/dist/assets/{org-library-CYxHJUvG.js → org-library-DkG-rRFx.js} +1 -1
  42. package/dist/assets/{package-format-DuWZOSdu.js → package-format-65qv_MtA.js} +1 -1
  43. package/dist/assets/{remote-desktop-panel-BR4X58aF.js → remote-desktop-panel-DP90g_gu.js} +1 -1
  44. package/dist/index.html +1 -1
  45. package/dist-server/index.js +741 -723
  46. package/dist-server/limixbot.js +199 -186
  47. package/dist-server/package.json +1 -1
  48. package/dist-server/pair-cli.js +199 -186
  49. package/dist-server/server/bot-api-host.js +36 -6
  50. package/dist-server/server/bot-channels/engine.js +10 -8
  51. package/dist-server/server/channel-public-lookup.js +16 -0
  52. package/dist-server/server/drivers/antigravity-guest.js +105 -0
  53. package/dist-server/server/drivers/antigravity.js +14 -8
  54. package/dist-server/server/drivers/pi.js +5 -3
  55. package/dist-server/server/index.js +25 -3
  56. package/dist-server/server/routes/image-tools.js +6 -0
  57. package/package.json +1 -1
@@ -79,10 +79,12 @@ export function createBotApiHost(deps) {
79
79
  deps.store.onChange((change) => { if (change.type === "bot.deleted")
80
80
  manager.removeForBot(change.botId); });
81
81
  const included = () => deps.included?.() !== false;
82
+ const channelRequests = new Set();
83
+ const busy = (botId, threadId) => channelRequests.has(threadId) || deps.threadBusy(botId, threadId);
82
84
  const pendingFor = (botId) => {
83
85
  const set = running.get(botId);
84
86
  for (const threadId of set ?? [])
85
- if (!deps.threadBusy(botId, threadId))
87
+ if (!busy(botId, threadId))
86
88
  set.delete(threadId);
87
89
  return set?.size ?? 0;
88
90
  };
@@ -107,7 +109,7 @@ export function createBotApiHost(deps) {
107
109
  const after = next === -1 ? rest : rest.slice(0, next);
108
110
  if (pendingCard(after))
109
111
  return { thread: threadId, status: "needs_approval" };
110
- if (deps.threadBusy(botId, threadId))
112
+ if (busy(botId, threadId))
111
113
  return { thread: threadId, status: "working" };
112
114
  return { reply: replyText(after), thread: threadId };
113
115
  }
@@ -129,7 +131,7 @@ export function createBotApiHost(deps) {
129
131
  // Only a thread this API opened: the caller never writes into the person's own conversations.
130
132
  if (!task || task.botApi !== true)
131
133
  fail(404, "no such thread");
132
- if (deps.threadBusy(botId, threadId))
134
+ if (busy(botId, threadId))
133
135
  failBeforeAcceptance("thread_busy");
134
136
  }
135
137
  if (!deps.canStart(botId, threadId ?? ""))
@@ -158,12 +160,33 @@ export function createBotApiHost(deps) {
158
160
  let settled;
159
161
  let dispatchError;
160
162
  markRunning(botId, threadId, true);
163
+ if (channel)
164
+ channelRequests.add(threadId);
161
165
  try {
166
+ const imageRequest = channel && message.trim().match(/^(?:@\S+\s+)?(?:(?:hãy|vui lòng|please)\s+)?(?:tạo\s+(?:một\s+)?(?:ảnh|hình)|vẽ|(?:generate|create|make)\s+(?:me\s+)?(?:an?\s+)?(?:image|picture)|draw)\s+(.+)$/isu);
167
+ if (imageRequest && deps.guestImage) {
168
+ const signal = channel?.delivery?.signal;
169
+ signal?.throwIfAborted();
170
+ const result = await deps.guestImage(botId, threadId, userMessage.id, imageRequest[1].trim(), signal);
171
+ signal?.throwIfAborted();
172
+ const vi = /(?:tạo|vẽ)/iu.test(imageRequest[0].slice(0, imageRequest[0].length - imageRequest[1].length));
173
+ const text = result.status === "ok" ? (vi ? "Đây là ảnh bạn yêu cầu." : "Here is your image.")
174
+ : result.status === "limit" ? (vi ? "Bot đã đạt giới hạn tạo ảnh. Bạn hãy thử lại sau." : "The image limit has been reached. Please try again later.")
175
+ : result.status === "disabled" ? (vi ? "Chức năng tạo ảnh đang tắt trên bot này." : "Image generation is switched off for this bot.")
176
+ : (vi ? "Bot chưa tạo được ảnh. Vui lòng báo quản trị viên kiểm tra dịch vụ tạo ảnh." : "The bot could not create the image. Please ask an administrator to check the image service.");
177
+ const attachments = result.status === "ok" ? [result.attachment] : [];
178
+ store.appendMessage(threadId, { role: "bot", kind: "text", text, attachments });
179
+ channel?.collect(attachments);
180
+ markRunning(botId, threadId, false);
181
+ turnStarted();
182
+ return { status: 200, body: { thread: threadId, reply: text } };
183
+ }
162
184
  const careFacts = await deps.careFacts?.(botId, message);
163
- const publicLookup = channel && careFacts === undefined ? await channelPublicLookup(message, previousGuestText) : undefined;
185
+ const publicLookup = channel && (careFacts === undefined || /https?:\/\//iu.test(message)) ? await channelPublicLookup(message, previousGuestText) : undefined;
164
186
  channel?.delivery?.signal.throwIfAborted();
165
187
  await deps.startTurn(botId, mediaPrompt(botApiPrompt(message, receivedAt, { guestChannel: Boolean(channel), publicLookup, careFacts }), channel?.attachment), {
166
188
  threadId, automationSource: "api", unattended: true, userMessage,
189
+ ...(channel?.model ? { channelGuestModel: channel.model } : {}),
167
190
  onSettled: (outcome) => { settled = outcome; markRunning(botId, threadId, false); },
168
191
  onDispatchError: (message) => { dispatchError = message; markRunning(botId, threadId, false); },
169
192
  });
@@ -175,6 +198,10 @@ export function createBotApiHost(deps) {
175
198
  const busy = z.object({ code: z.enum(["thread_busy", "thread_limit"]) }).safeParse(error).success;
176
199
  fail(busy ? 409 : 502, busy ? BUSY : COULD_NOT_ANSWER, error instanceof Error ? error.message : String(error));
177
200
  }
201
+ finally {
202
+ if (channel)
203
+ channelRequests.delete(threadId);
204
+ }
178
205
  turnStarted();
179
206
  let approvalNotified = false;
180
207
  const deadline = Date.now() + (call.wait === undefined ? waitMs : call.wait * 1000);
@@ -214,10 +241,13 @@ export function createBotApiHost(deps) {
214
241
  if (!input.owner) {
215
242
  if (savedTask && !savedTask.botApi)
216
243
  fail(404, "no such thread");
217
- if (!deps.canConfine(botId, channelThread))
244
+ const model = await deps.channelGuestModel?.(botId, channelThread);
245
+ if (deps.channelModelChanging?.(botId, channelThread))
246
+ failBeforeAcceptance("capacity_busy");
247
+ if (deps.channelGuestModel ? !model : !deps.canConfine(botId, channelThread))
218
248
  throw Object.assign(new Error(CANNOT_CONFINE), { status: 403, code: "guest_engine" });
219
249
  let attachments = [];
220
- const answer = await runCall(botId, { message: input.text, ...(channelThread ? { thread: channelThread } : {}), wait: Math.round((input.waitMs ?? 600_000) / 1000) }, () => { }, { attachment: input.attachment, delivery: input.delivery, collect(files) { attachments = files; } });
250
+ const answer = await runCall(botId, { message: input.text, ...(channelThread ? { thread: channelThread } : {}), wait: Math.round((input.waitMs ?? 600_000) / 1000) }, () => { }, { model, attachment: input.attachment, delivery: input.delivery, collect(files) { attachments = files; } });
221
251
  const body = answer.body;
222
252
  return { threadId: body.thread, ...(attachments.length ? { attachments } : {}), reply: body.reply ?? "", ...(body.status ? { status: body.status } : {}) };
223
253
  }
@@ -1,6 +1,6 @@
1
1
  // Limix Bot: a bot answers on Telegram, Discord, Zalo or a Facebook Page from its own settings. This server holds each connection itself
2
2
  // (no webhook, no address to open): the owner links their own account with a one-time code (/link CODE) and then talks
3
- // to the bot as from the app, at Full access, in a direct chat of its own; everyone else, and every group, is answered
3
+ // to the bot as from the app, at Full access, in a separate conversation for each chat; other participants are answered
4
4
  // only when the owner allows it, through the confined Bot API path. Secrets are sealed on disk and never leave this server.
5
5
  //
6
6
  // The duplicate filter, retry with backoff, per-account send pacing and the channel adapter contract follow ChannelHub,
@@ -55,11 +55,13 @@ const botSchema = z.object({
55
55
  recent: z.record(z.string(), z.number()).default({}),
56
56
  });
57
57
  const fileSchema = z.object({ v: z.literal(1), bots: z.record(z.string(), botSchema) });
58
- function privateGrant(adapter, entry, message) {
59
- if (!entry?.enabled || !message.direct || adapter.guestsOnly)
58
+ function channelGrant(adapter, entry, message) {
59
+ if (!entry?.enabled || adapter.guestsOnly)
60
60
  return undefined;
61
61
  if (entry.owner?.id === message.from.id)
62
62
  return "owner";
63
+ if (!message.direct)
64
+ return undefined;
63
65
  return entry.admins.find(admin => admin.id === message.from.id)?.grant;
64
66
  }
65
67
  const text = (label) => ({
@@ -277,7 +279,7 @@ export function createBotChannels(deps) {
277
279
  }
278
280
  async function deliverResult(adapter, botId, id, message, signal) {
279
281
  const lane = `${adapter.kind}:${botId}`;
280
- const authorized = () => !message.owner || privateGrant(adapter, read(adapter.kind).bots[botId], message) === (message.grant ?? "owner");
282
+ const authorized = () => !message.owner || channelGrant(adapter, read(adapter.kind).bots[botId], message) === (message.grant ?? "owner");
281
283
  const result = message.result;
282
284
  let sent = message.sent ?? 0;
283
285
  while (!signal.aborted && authorized()) {
@@ -345,15 +347,15 @@ export function createBotChannels(deps) {
345
347
  });
346
348
  return void await send(say.linked);
347
349
  }
348
- const grant = privateGrant(adapter, entry, message);
350
+ const grant = channelGrant(adapter, entry, message);
349
351
  const owner = !!grant && (saved?.row.owner ?? true);
350
- const authorized = () => !saved?.row.owner || privateGrant(adapter, read(kind).bots[botId], message) === (saved.row.grant ?? "owner");
352
+ const authorized = () => !saved?.row.owner || channelGrant(adapter, read(kind).bots[botId], message) === (saved.row.grant ?? "owner");
351
353
  if (!authorized())
352
354
  return;
353
355
  const allowsGuest = acceptGuest(kind, entry, message);
354
356
  if (!owner && !allowsGuest)
355
357
  return message.direct && !adapter.quietToStrangers ? void await send(say.ownerOnly) : undefined;
356
- const conversation = owner && grant !== "owner" ? JSON.stringify(["admin", grant, message.chatId]) : message.direct ? message.chatId : `${message.chatId}:${message.from.id}`;
358
+ const conversation = owner && !message.direct ? JSON.stringify(["group-owner", message.chatId, message.from.id]) : owner && grant !== "owner" ? JSON.stringify(["admin", grant, message.chatId]) : message.direct ? message.chatId : `${message.chatId}:${message.from.id}`;
357
359
  if (command?.[1] === "new") {
358
360
  patch(kind, botId, (current) => { const chats = { ...current.chats }; delete chats[conversation]; return { ...current, chats }; });
359
361
  return void await send(say.fresh);
@@ -432,7 +434,7 @@ export function createBotChannels(deps) {
432
434
  if (link && adapter.guestsOnly)
433
435
  return;
434
436
  const command = link || !message.media && /^\/start(?:@\w+)?$/.test(message.text.trim());
435
- const grant = privateGrant(adapter, entry, message);
437
+ const grant = channelGrant(adapter, entry, message);
436
438
  const owner = !!grant;
437
439
  const eligible = (owner || acceptGuest(kind, entry, message)) && !command && (message.text.trim() || message.loadMedia);
438
440
  const row = restored ?? (eligible ? inboxSchema.parse({ ...message, owner, grant, downloading: Boolean(message.loadMedia) }) : undefined);
@@ -89,6 +89,22 @@ async function searchWeb(query) {
89
89
  return results.length ? JSON.stringify(results) : NO_RESULTS;
90
90
  }
91
91
  export async function channelPublicLookup(text, previousGuestText) {
92
+ const link = text.trim().match(/^(?:@\S+\s+)?(?:(?:đọc|xem|tóm tắt|mở|read|open|summarize)\s+(?:(?:trang|link|page)\s+)?)?(https?:\/\/[^\s<>]+)$/iu);
93
+ if (link) {
94
+ try {
95
+ const url = new URL(link[1]);
96
+ if (url.username || url.password || url.port || redactSecretsInText(url.href) !== url.href)
97
+ return NO_RESULTS;
98
+ const page = await fetchPublicPage(url.href, { ...REQUEST, maxRedirects: 3 });
99
+ if (!page.ok || !/^(?:text\/(?:html|plain)|application\/xhtml\+xml)(?:;|$)/i.test(String(page.headers["content-type"])))
100
+ return NO_RESULTS;
101
+ const summary = pageText(page.body.toString("utf8")).slice(0, 4000);
102
+ return summary ? JSON.stringify({ url: page.url.href, summary }) : NO_RESULTS;
103
+ }
104
+ catch {
105
+ return NO_RESULTS;
106
+ }
107
+ }
92
108
  const query = publicQuery(text);
93
109
  if (!query)
94
110
  return undefined;
@@ -0,0 +1,105 @@
1
+ import { mkdtemp, rm } from "node:fs/promises";
2
+ import { tmpdir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { newEventId, newId } from "../contracts.js";
5
+ import { killCliTree, spawnCli } from "../procs.js";
6
+ export function antigravityGuestAdapter(adapter, cli, env) {
7
+ const listeners = new Set();
8
+ const pending = new Map();
9
+ async function guest(turn) {
10
+ if (!turn.model || turn.images?.length)
11
+ throw new Error("Antigravity customer chat requires a selected model and a text message");
12
+ if (pending.has(turn.threadId))
13
+ throw new Error("Conversation is busy");
14
+ const turnId = newId();
15
+ const controller = new AbortController();
16
+ pending.set(turn.threadId, controller);
17
+ const emit = (event) => {
18
+ const value = { ...event, provider: adapter.provider, turnId, threadId: turn.threadId, eventId: newEventId(), createdAt: new Date().toISOString() };
19
+ for (const listener of listeners)
20
+ listener(value);
21
+ };
22
+ async function run() {
23
+ let cwd;
24
+ try {
25
+ await turn.engineAdmission?.("process");
26
+ cwd = await mkdtemp(join(tmpdir(), "limix-guest-"));
27
+ controller.signal.throwIfAborted();
28
+ const args = ["--input-format", "stream-json", "--output-format", "stream-json", "--sandbox", "--disable-slash-commands",
29
+ "--settings", JSON.stringify({ toolPermission: "strict", allowNonWorkspaceAccess: false }), "--model", turn.model];
30
+ const effort = turn.variant || turn.effort;
31
+ if (effort)
32
+ args.push("--effort", effort);
33
+ const child = spawnCli(cli, args, { cwd, env: { ...env, HOME: cwd, USERPROFILE: cwd, XDG_CONFIG_HOME: cwd, GEMINI_CLI_HOME: cwd }, stdio: ["pipe", "pipe", "pipe"], botWork: true });
34
+ const stop = () => { void killCliTree(child, 0); };
35
+ controller.signal.addEventListener("abort", stop, { once: true });
36
+ const timer = setTimeout(() => controller.abort(), 120_000);
37
+ try {
38
+ const output = await new Promise((resolve, reject) => {
39
+ let data = "";
40
+ let sent = false;
41
+ child.stdout.setEncoding("utf8");
42
+ child.stdout.on("data", (chunk) => {
43
+ if (data.length + chunk.length > 4_000_000) {
44
+ stop();
45
+ reject(new Error("Customer response exceeded output limit"));
46
+ }
47
+ else
48
+ data += chunk;
49
+ if (!sent && data.includes("\n")) {
50
+ try {
51
+ const init = JSON.parse(data.slice(0, data.indexOf("\n")));
52
+ if (init.event !== "init" || init.init?.permission_mode !== "strict")
53
+ throw new Error("Antigravity did not confirm strict guest permissions");
54
+ sent = true;
55
+ const history = turn.transcript?.length ? JSON.stringify(turn.transcript) : undefined;
56
+ const prompt = [turn.system, history, turn.text].filter(Boolean).join("\n\n");
57
+ child.stdin.end(JSON.stringify({ event: "user", message: { content: prompt } }) + "\n");
58
+ }
59
+ catch (error) {
60
+ stop();
61
+ reject(error);
62
+ }
63
+ }
64
+ });
65
+ child.stderr.resume();
66
+ child.once("error", reject);
67
+ child.stdin.on("error", () => { });
68
+ child.once("close", code => code === 0 ? resolve(data) : reject(new Error("Antigravity could not complete this customer request")));
69
+ });
70
+ controller.signal.throwIfAborted();
71
+ const result = output.trim().split(/\r?\n/).map(line => JSON.parse(line)).find(item => item.event === "result")?.result;
72
+ if (result?.status !== "SUCCESS" || typeof result.response !== "string" || !result.response.trim())
73
+ throw new Error("Antigravity returned no customer reply");
74
+ emit({ type: "item.completed", itemType: "assistant_text", text: result.response });
75
+ emit({ type: "turn.completed", ok: true, stopReason: "end_turn", cost: null });
76
+ }
77
+ finally {
78
+ clearTimeout(timer);
79
+ controller.signal.removeEventListener("abort", stop);
80
+ }
81
+ }
82
+ catch (error) {
83
+ emit({ type: "runtime.error", message: error instanceof Error ? error.message : String(error) });
84
+ emit({ type: "turn.completed", ok: false, stopReason: "error", cost: null });
85
+ }
86
+ finally {
87
+ pending.delete(turn.threadId);
88
+ if (cwd)
89
+ await rm(cwd, { recursive: true, force: true, maxRetries: 4 }).catch(() => { });
90
+ }
91
+ }
92
+ emit({ type: "turn.started" });
93
+ void run();
94
+ return { turnId };
95
+ }
96
+ return {
97
+ ...adapter, capabilities: { ...adapter.capabilities, guestTurns: "confined" },
98
+ sendTurn: turn => turn.guestConfined ? guest(turn) : adapter.sendTurn(turn),
99
+ onEvent(listener) { listeners.add(listener); const off = adapter.onEvent(listener); return () => { listeners.delete(listener); off(); }; },
100
+ interruptTurn: async (id, turn) => { pending.get(id)?.abort(); await adapter.interruptTurn(id, turn); },
101
+ hasSession: id => pending.has(id) || adapter.hasSession(id),
102
+ stopAll: async () => { for (const controller of pending.values())
103
+ controller.abort(); await adapter.stopAll(); },
104
+ };
105
+ }
@@ -7,6 +7,7 @@ import { antigravityManagedInstallAvailable, installAntigravityRuntime, resolveA
7
7
  import { resolveAntigravityReleaseAsset } from "./antigravity-release.js";
8
8
  import { VERIFICATION_TEMP_KEY, scheduleAntigravityTempSweep } from "./antigravity-temp.js";
9
9
  import { augmentedPath } from "../env-path.js";
10
+ import { antigravityGuestAdapter } from "./antigravity-guest.js";
10
11
  import { agyCliFor, releaseAgyCli } from "../limix-agy-cli.js";
11
12
  import { bundledEngineCatalog } from "../model-manifest/bundled.js";
12
13
  import { currentEngineCatalog } from "../model-manifest/manifest.js";
@@ -54,6 +55,9 @@ function limixModeFor(wanted, option) {
54
55
  return wanted;
55
56
  return (LIMIX_MODE_ALIASES[wanted] ?? [wanted]).find((value) => offered.includes(value)) ?? null;
56
57
  }
58
+ function selectedAgyCli(cli, id, env) {
59
+ return !cli || cli === "agy" ? agyCliFor(id, env) : null;
60
+ }
57
61
  const support = {
58
62
  driverKind: "antigravityAgent",
59
63
  // Named for what people look for: Google moved personal Gemini subscriptions (free, AI Pro, AI Ultra) from Gemini CLI to Antigravity on 2026-06-18.
@@ -82,7 +86,7 @@ const support = {
82
86
  clientReadRoots: (turn) => (turn.skillFiles ?? []).map(dirname),
83
87
  sanitizeToolPayload: true,
84
88
  resolveCommand: async (env, config, instanceId) => {
85
- const agyCli = agyCliFor(instanceId, env);
89
+ const agyCli = selectedAgyCli(config.cli, instanceId, env);
86
90
  if (agyCli)
87
91
  return { command: agyCli, args: ["acp"] };
88
92
  const runtime = await resolveAntigravityRuntime(config.cli, env);
@@ -99,7 +103,7 @@ const support = {
99
103
  resolveModels: async (env, config, instanceId) => {
100
104
  // Limix: the person's own `agy` CLI is signed in to their Google account (Pro, Ultra…), whose models differ; read
101
105
  // them from the CLI itself instead of the fixed list, which only ever showed one plan's models.
102
- const agyCli = agyCliFor(instanceId, env);
106
+ const agyCli = selectedAgyCli(config.cli, instanceId, env);
103
107
  if (agyCli)
104
108
  return discoverAcpModels(env, agyCli, ["acp"], { default: currentEngineCatalog("antigravity").default, exitGraceMs: 2_000 });
105
109
  const runtime = await resolveAntigravityRuntime(config.cli, env);
@@ -118,7 +122,7 @@ const support = {
118
122
  authFailure: "fail",
119
123
  requireAuthenticationBeforeSpawn: true,
120
124
  isAuthenticated: async (env, config, instanceId) => {
121
- if (agyCliFor(instanceId, env))
125
+ if (selectedAgyCli(config.cli, instanceId, env))
122
126
  return true;
123
127
  try {
124
128
  const runtime = await resolveAntigravityRuntime(config.cli, env);
@@ -130,7 +134,7 @@ const support = {
130
134
  }
131
135
  },
132
136
  snapshot: async (env, config, instanceId) => {
133
- if (agyCliFor(instanceId, env))
137
+ if (selectedAgyCli(config.cli, instanceId, env))
134
138
  return { state: "available", version: "Antigravity CLI", authenticated: true };
135
139
  try {
136
140
  const runtime = await resolveAntigravityRuntime(config.cli, env);
@@ -185,12 +189,13 @@ export const AntigravityDriver = {
185
189
  });
186
190
  return { runtime, profile };
187
191
  };
192
+ const env = { ...process.env, ...input.environment, PATH: augmentedPath() };
193
+ const guestCli = selectedAgyCli(input.config.cli, input.instanceId, env);
194
+ const normal = { ...base.adapter, sendTurn: async (turn) => base.adapter.sendTurn(stageAntigravitySkills(turn, antigravityProfileDirectory(input.instanceId))) };
195
+ const adapter = guestCli ? antigravityGuestAdapter(normal, guestCli, env) : normal;
188
196
  return {
189
197
  ...base,
190
- adapter: {
191
- ...base.adapter,
192
- sendTurn: async (turn) => base.adapter.sendTurn(stageAntigravitySkills(turn, antigravityProfileDirectory(input.instanceId))),
193
- },
198
+ adapter,
194
199
  get models() {
195
200
  return base.models;
196
201
  },
@@ -232,6 +237,7 @@ export const AntigravityDriver = {
232
237
  },
233
238
  dispose: async () => {
234
239
  auth.cancel();
240
+ await adapter.stopAll();
235
241
  await base.dispose();
236
242
  },
237
243
  };
@@ -357,7 +357,7 @@ export const PiDriver = {
357
357
  const selection = parseToolScope(turn.toolScope);
358
358
  if (!selection.ok)
359
359
  throw new Error(selection.error);
360
- const toolScope = selection.scope;
360
+ const toolScope = turn.guestConfined ? { allow: [] } : selection.scope;
361
361
  if (active.has(threadId))
362
362
  throw new Error("a turn is already running on this thread");
363
363
  const fullAuto = turn.approvalMode === undefined ? config.fullAuto : false;
@@ -383,7 +383,7 @@ export const PiDriver = {
383
383
  }
384
384
  // The MCP config carries credentials: a 0600 temp file removed at settle, never argv.
385
385
  // Written on every turn: the extension also carries ask_user.
386
- const mcpServers = buildMcpServers(turn);
386
+ const mcpServers = turn.guestConfined ? {} : buildMcpServers(turn);
387
387
  const askUser = toolScope === undefined || allowsTool(toolScope, { kind: "native", name: ASK_USER_TOOL });
388
388
  const mcpTempDir = mkdtempSync(join(tmpdir(), "omb-pi-mcp-"));
389
389
  const scopeReadyPath = toolScope !== undefined ? join(mcpTempDir, "scope-ready.json") : undefined;
@@ -398,7 +398,8 @@ export const PiDriver = {
398
398
  catch { }
399
399
  throw err;
400
400
  }
401
- const childArgs = [...PI_ARGS, "-e", SPAWNED_PROXIES.piMcpExtension];
401
+ const guestArgs = turn.guestConfined ? ["--no-tools", "--no-extensions", "--no-skills", "--no-context-files", "--no-prompt-templates"] : [];
402
+ const childArgs = [...PI_ARGS, ...guestArgs, "-e", SPAWNED_PROXIES.piMcpExtension];
402
403
  // spawnCli can throw synchronously, before settle() could remove the credential file.
403
404
  const child = (() => {
404
405
  try {
@@ -923,6 +924,7 @@ export const PiDriver = {
923
924
  provider: DRIVER_KIND,
924
925
  capabilities: {
925
926
  sessionModelSwitch: "in-session",
927
+ guestTurns: "confined",
926
928
  // pi core has no MCP client of its own.
927
929
  agentsMcp: true,
928
930
  computerMcp: true,
@@ -7826,9 +7826,13 @@ async function beginTurn(botId, text, opts) {
7826
7826
  }
7827
7827
  healThreadModel(botId, threadId);
7828
7828
  limitFailovers.restore(botId, threadId);
7829
- const bot = store.projectBotForTask(botId, threadId);
7830
- if (!bot)
7829
+ const projected = store.projectBotForTask(botId, threadId);
7830
+ if (!projected)
7831
7831
  throw Object.assign(new Error("no such task"), { status: 404 });
7832
+ // Only the confined channel ingress may override the provider for a single turn.
7833
+ const channelModel = opts?.channelGuestModel && opts.automationSource === "api" && botApiThread(threadId)
7834
+ ? opts.channelGuestModel : undefined;
7835
+ const bot = channelModel ? { ...projected, modelSelection: channelModel } : projected;
7832
7836
  if (bot.approvalGrant) {
7833
7837
  throw Object.assign(new Error("this bot's approval level is still being confirmed — try again"), { status: 409, code: "settling" });
7834
7838
  }
@@ -9877,9 +9881,27 @@ const webhooks = new WebhookManager({
9877
9881
  }, ...createWebhookRoomPost({ store, cfg, roomTalks })
9878
9882
  });
9879
9883
  const webhookRequests = new WebhookRequestService({ store, webhooks, botName: (botId) => store.bot(botId)?.name ?? "the bot" });
9880
- const botApi = createBotApiHost({ store, startTurn, threadBusy, careFacts: (botId, message) => { const bot = store.bot(botId); return bot ? industryGuestFacts(bot, message, servers => managedPolicy.filterMcp(servers)) : Promise.resolve(undefined); }, canStart: (botId, threadId) => canAdmitDirectTurn(botId, threadId, false), channelModelChanging: (botId, threadId) => {
9884
+ const botApi = createBotApiHost({ store, startTurn, threadBusy,
9885
+ guestImage: async (botId, threadId, messageId, prompt, signal) => {
9886
+ if (store.bot(botId)?.toolsOff?.includes("images"))
9887
+ return { status: "disabled" };
9888
+ let attachment;
9889
+ const result = await imageTools.channelImage(botId, threadId, messageId, prompt, image => {
9890
+ if (signal?.aborted)
9891
+ return false;
9892
+ const saved = saveImage(image.bytes, image.mime);
9893
+ attachment = { kind: "image", path: saved.path, mime: saved.mime };
9894
+ return true;
9895
+ }, signal);
9896
+ if (attachment)
9897
+ return { status: "ok", attachment };
9898
+ return { status: result.status === 429 ? "limit" : "unavailable" };
9899
+ }, careFacts: (botId, message) => { const bot = store.bot(botId); return bot ? industryGuestFacts(bot, message, servers => managedPolicy.filterMcp(servers)) : Promise.resolve(undefined); }, canStart: (botId, threadId) => canAdmitDirectTurn(botId, threadId, false), channelModelChanging: (botId, threadId) => {
9881
9900
  const selection = threadId ? turnSelection(botId, threadId) : store.bot(botId)?.modelSelection;
9882
9901
  return Boolean(store.bot(botId)?.approvalGrant || selection && providerInstancesChanging.has(selection.instanceId));
9902
+ }, channelGuestModel: async (botId) => {
9903
+ const selected = store.bot(botId)?.modelSelection;
9904
+ return selected && registry.get(selected.instanceId)?.adapter.capabilities.guestTurns === "confined" ? selected : undefined;
9883
9905
  }, canConfine: (botId, threadId) => {
9884
9906
  const selection = threadId ? turnSelection(botId, threadId) : store.bot(botId)?.modelSelection;
9885
9907
  return registry.get(selection?.instanceId ?? "")?.adapter.capabilities.guestTurns === "confined";
@@ -96,6 +96,12 @@ export function createImageToolRoutes(deps) {
96
96
  const inFlight = new Map();
97
97
  const daily = createImageDailyCap(deps.dataDir);
98
98
  return {
99
+ async channelImage(botId, threadId, messageId, prompt, attach, signal) {
100
+ return generateImageForTurn({ prompt }, {
101
+ cfg: deps.config({ botId, threadId }), daily, inFlight, fetchImpl: deps.fetchImpl, signal,
102
+ personTurn: true, turn: { key: deps.key(threadId, messageId), parked: () => 0, attach },
103
+ });
104
+ },
99
105
  async internal(ctx) {
100
106
  if (ctx.method !== "POST" || ctx.path !== "/api/internal/images/generate")
101
107
  return PASS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "limixbot",
3
- "version": "0.3.108",
3
+ "version": "0.3.110",
4
4
  "description": "Run the Limix Bot server anywhere and pair your devices to it (Leox ৹ Limix AI)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",