@chibitek/chibi 0.1.194 → 0.1.196

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 (87) hide show
  1. package/dist/assets/{TerminalPanel-k-bNNesV.js → TerminalPanel-CB-6ECq_.js} +1 -1
  2. package/dist/assets/{abnfDiagram-O67JEVCF-dJ7qt3uJ.js → abnfDiagram-O67JEVCF-C79ttPKo.js} +1 -1
  3. package/dist/assets/{arc-EddF6kP_.js → arc-BUuqriRQ.js} +1 -1
  4. package/dist/assets/{architectureDiagram-NJMV4G6O-UeAIAzq1.js → architectureDiagram-NJMV4G6O-CxWfPil9.js} +1 -1
  5. package/dist/assets/{blockDiagram-BEXU5L5S-CFb6JiNj.js → blockDiagram-BEXU5L5S-BSLYuBHS.js} +1 -1
  6. package/dist/assets/{c4Diagram-YGBWAQC7-1hMBdQdo.js → c4Diagram-YGBWAQC7-B-xzP35S.js} +1 -1
  7. package/dist/assets/channel-AilCgHWM.js +1 -0
  8. package/dist/assets/{chunk-2Q5K7J3B-DNrbOG-A.js → chunk-2Q5K7J3B-B11khEvC.js} +1 -1
  9. package/dist/assets/{chunk-3FUC2YCW-BxPQB9CL.js → chunk-3FUC2YCW-DsPETNim.js} +2 -2
  10. package/dist/assets/{chunk-5VM5RSS4-B1komt_B.js → chunk-5VM5RSS4-D6WoBPUT.js} +1 -1
  11. package/dist/assets/{chunk-GTNCS2PH-CxvRNuCM.js → chunk-GTNCS2PH-CN_1S4k_.js} +1 -1
  12. package/dist/assets/{chunk-GWA4HPMP-Du9NeFCS.js → chunk-GWA4HPMP-NlXta6PY.js} +1 -1
  13. package/dist/assets/{chunk-JWPE2WC7-SQ6yowId.js → chunk-JWPE2WC7-CLIqUdNW.js} +1 -1
  14. package/dist/assets/{chunk-NETBCI7D-Bf5p4Mwp.js → chunk-NETBCI7D-DnuYREKE.js} +1 -1
  15. package/dist/assets/{chunk-WEXAMYUT-CGfgwr4k.js → chunk-WEXAMYUT-DJKFEs93.js} +1 -1
  16. package/dist/assets/{chunk-XXDRQBXY-DQiWv_eF.js → chunk-XXDRQBXY-CRWsxQ_5.js} +1 -1
  17. package/dist/assets/{classDiagram-v2-NBCMYWYE-CKfM0GgR.js → classDiagram-v2-NBCMYWYE-Cyp63Eux.js} +1 -1
  18. package/dist/assets/{cose-bilkent-JH36ORCC-E32mrb9n.js → cose-bilkent-JH36ORCC-BLjNsWhq.js} +1 -1
  19. package/dist/assets/{cynefin-OW5HDTMX-BmJl13re.js → cynefin-OW5HDTMX-BnV2cLbs.js} +1 -1
  20. package/dist/assets/{cynefinDiagram-VND7K2PF-BQmysSe8.js → cynefinDiagram-VND7K2PF-ClWXZ7xW.js} +1 -1
  21. package/dist/assets/{dagre-6A5THRUB-Bvix6bhv.js → dagre-6A5THRUB-Dk58FIJ2.js} +1 -1
  22. package/dist/assets/{diagram-22UHCM2B-DMb3_2Yw.js → diagram-22UHCM2B-BjlV2Pv3.js} +1 -1
  23. package/dist/assets/{diagram-3UASUU5V-C2G2lJWB.js → diagram-3UASUU5V-BOqom62X.js} +1 -1
  24. package/dist/assets/{diagram-ATOU4E4O-Cnk0-r8a.js → diagram-ATOU4E4O-CVw9PK2o.js} +1 -1
  25. package/dist/assets/{diagram-CDSNMT55-iWUk11Ac.js → diagram-CDSNMT55-LTIvpF3x.js} +1 -1
  26. package/dist/assets/{diagram-MLGK6HIB-pQNwgrXs.js → diagram-MLGK6HIB-DZKwFRor.js} +1 -1
  27. package/dist/assets/{diagram-MPIPVDR6-DyGbBWiA.js → diagram-MPIPVDR6-CY_QtFYz.js} +1 -1
  28. package/dist/assets/{ebnfDiagram-ZINNZB2B-DQ3Ni6jW.js → ebnfDiagram-ZINNZB2B-Kb2bwfRU.js} +1 -1
  29. package/dist/assets/{elk-276RUBZZ-DHKJu9Iv.js → elk-276RUBZZ-D05nrUAY.js} +1 -1
  30. package/dist/assets/{erDiagram-OPXOYQCR-PEPG1pKr.js → erDiagram-OPXOYQCR-cBbx_M93.js} +1 -1
  31. package/dist/assets/{flowDiagram-KWPJA3E3-WUiDjhuX.js → flowDiagram-KWPJA3E3-CzlBDlR8.js} +1 -1
  32. package/dist/assets/{ganttDiagram-FUAMR5RP-XYcSw8XW.js → ganttDiagram-FUAMR5RP-DkkjIANc.js} +1 -1
  33. package/dist/assets/{gitGraphDiagram-X574FWY7-CPDsEL6v.js → gitGraphDiagram-X574FWY7-DXlMkWfc.js} +1 -1
  34. package/dist/assets/{index-7tft1G3w.js → index-B2U0UUX-.js} +1 -1
  35. package/dist/assets/{index-CzsF5HT1.js → index-DzInGWYS.js} +152 -152
  36. package/dist/assets/{infoDiagram-VRGFBTTK-DA4G5Ada.js → infoDiagram-VRGFBTTK-B4MLOatD.js} +1 -1
  37. package/dist/assets/{ishikawaDiagram-OU5B5YK6-CLhBborF.js → ishikawaDiagram-OU5B5YK6-ccVErf8N.js} +1 -1
  38. package/dist/assets/{journeyDiagram-ZHPQQLJL-BoeIpfES.js → journeyDiagram-ZHPQQLJL-B8-kD51p.js} +1 -1
  39. package/dist/assets/{kanban-definition-PNTS6WVX-BF2VlALx.js → kanban-definition-PNTS6WVX-Kegk_QSG.js} +1 -1
  40. package/dist/assets/{linear-DGY-eezc.js → linear-CA_cRwMp.js} +1 -1
  41. package/dist/assets/{mermaid.core-BU5DAfrM.js → mermaid.core-DuwzJ1O8.js} +5 -5
  42. package/dist/assets/{mindmap-definition-NLK3R4M7-ldVJZIOj.js → mindmap-definition-NLK3R4M7-DngsWKWx.js} +1 -1
  43. package/dist/assets/{pegDiagram-GJSIUBJH-dS2C3m-e.js → pegDiagram-GJSIUBJH-BhVSGE6P.js} +1 -1
  44. package/dist/assets/{pieDiagram-5QR66LMP-BeX9hffn.js → pieDiagram-5QR66LMP-C-NQpcBB.js} +1 -1
  45. package/dist/assets/{quadrantDiagram-O4NWA36T-gBxWQRkY.js → quadrantDiagram-O4NWA36T-urAENfOl.js} +1 -1
  46. package/dist/assets/{railroadDiagram-XR7U4H2S-BSOKMMuc.js → railroadDiagram-XR7U4H2S-BPyCQBVM.js} +1 -1
  47. package/dist/assets/{requirementDiagram-PLB6GJNP-Cq4KZXOJ.js → requirementDiagram-PLB6GJNP-CZDPK8ow.js} +1 -1
  48. package/dist/assets/{sankeyDiagram-IPEJSGJF-C59BLmfb.js → sankeyDiagram-IPEJSGJF-BLkmCnNY.js} +1 -1
  49. package/dist/assets/{sequenceDiagram-PO4LG4MO-De8iVPzU.js → sequenceDiagram-PO4LG4MO-DOnJsutQ.js} +1 -1
  50. package/dist/assets/{sizeCapture-INFHLROL-CJLc7kKW.js → sizeCapture-INFHLROL-BTzltmsq.js} +1 -1
  51. package/dist/assets/{stateDiagram-v2-GCMORJYK-BQkW_Cs-.js → stateDiagram-v2-GCMORJYK-dMgLAXwt.js} +1 -1
  52. package/dist/assets/{swimlanes-2SLR337P-CDPrdFPs.js → swimlanes-2SLR337P-d_KFeNnI.js} +1 -1
  53. package/dist/assets/swimlanesDiagram-TC7HE7FX-DUtZuLFb.js +8 -0
  54. package/dist/assets/{timeline-definition-EJHVYXUP-VJExKP0a.js → timeline-definition-EJHVYXUP-quo7Si9R.js} +1 -1
  55. package/dist/assets/{usecaseDiagram-POWQR4AR-A_h0-hH3.js → usecaseDiagram-POWQR4AR-BPt91Frf.js} +1 -1
  56. package/dist/assets/{vennDiagram-UO4OBE2U-LeRZF6GK.js → vennDiagram-UO4OBE2U-U_iYVkHo.js} +1 -1
  57. package/dist/assets/{wardleyDiagram-VNRHLVJA-BtQte254.js → wardleyDiagram-VNRHLVJA-Se__ees9.js} +1 -1
  58. package/dist/assets/{xychartDiagram-PMCCYNJV-C5Sdyn-i.js → xychartDiagram-PMCCYNJV-D4CVeuAX.js} +1 -1
  59. package/dist/index.html +1 -1
  60. package/dist-server/companion/src/routes.js +29 -0
  61. package/dist-server/container-mcp.js +81 -81
  62. package/dist-server/drivers/agents-proxy.js +81 -81
  63. package/dist-server/index.js +680 -521
  64. package/dist-server/openmausbot.js +46146 -45889
  65. package/dist-server/pair-cli.js +46146 -45889
  66. package/dist-server/server/cli-browser.js +42 -0
  67. package/dist-server/server/cli-help.js +4 -0
  68. package/dist-server/server/cli-terminal.js +87 -0
  69. package/dist-server/server/cli.js +12 -45
  70. package/dist-server/server/index.js +2 -3
  71. package/dist-server/server/request-auth.js +2 -1
  72. package/dist-server/server/routes/team-rooms.js +5 -1
  73. package/dist-server/server/routes/terminal.js +13 -2
  74. package/dist-server/server/team-rooms/host.js +4 -0
  75. package/dist-server/server/team-rooms/installation.js +83 -0
  76. package/dist-server/server/team-rooms/service.js +51 -12
  77. package/dist-server/server/team-rooms/testing/fake-rooms-backend.js +3 -0
  78. package/dist-server/server/team-rooms/types.js +1 -0
  79. package/dist-server/server/terminal-places.js +3 -2
  80. package/dist-server/server/terminal.js +28 -2
  81. package/dist-server/server/workspace-backup.js +1 -1
  82. package/dist-server/shared/team-rooms.js +9 -0
  83. package/dist-server/vps-container-mcp.js +81 -81
  84. package/package.json +1 -1
  85. package/dist/assets/channel-BWPQj1aN.js +0 -1
  86. package/dist/assets/swimlanesDiagram-TC7HE7FX-CCgmD5dO.js +0 -8
  87. package/dist-server/server/session-fallback.js +0 -76
@@ -0,0 +1,42 @@
1
+ const message = (error) => (error instanceof Error ? error.message : String(error));
2
+ export async function runBrowser(options, io) {
3
+ const { browserEngineStatus, describeBrowserEngine, ensureChrome, installAgentBrowserBinary, resolveAgentBrowserBinary } = await import("./browser-engine.js");
4
+ const status = browserEngineStatus({ dataDir: options.dataDir });
5
+ if (options.browserAction === "status") {
6
+ io.log(describeBrowserEngine(status));
7
+ if (status.kind !== "ready" && status.installable)
8
+ io.log("install it with: chibi browser install");
9
+ return status.kind === "ready" ? 0 : 1;
10
+ }
11
+ let binary = resolveAgentBrowserBinary({ dataDir: options.dataDir });
12
+ if (binary) {
13
+ io.log(`agent-browser is already here: ${binary}`);
14
+ }
15
+ else {
16
+ if (status.kind !== "ready" && !status.installable) {
17
+ io.error(status.reason);
18
+ return 1;
19
+ }
20
+ try {
21
+ binary = await installAgentBrowserBinary({ dataDir: options.dataDir, log: io.log });
22
+ }
23
+ catch (error) {
24
+ io.error(`could not install agent-browser: ${message(error)}`);
25
+ return 1;
26
+ }
27
+ io.log(`installed ${binary}`);
28
+ }
29
+ try {
30
+ await ensureChrome(binary, { withDeps: options.withDeps === true, log: io.log });
31
+ }
32
+ catch (error) {
33
+ io.error(`Chrome is not ready: ${message(error)}`);
34
+ if (process.platform === "linux" && !options.withDeps)
35
+ io.error("on Linux, install Chrome's system libraries with `sudo chibi browser install --with-deps`, then retry `chibi browser install` as the user running serve");
36
+ return 1;
37
+ }
38
+ io.log("browser installed for this user and data directory; run serve as the same user, then enable it under Settings → Experimental and per bot");
39
+ if (process.platform === "linux" && options.withDeps)
40
+ io.log("if serve runs as another user, run `chibi browser install` from that user's login shell too");
41
+ return 0;
42
+ }
@@ -16,6 +16,7 @@ export const USAGE = `chibi — your team of AI bots, ready in a few steps
16
16
  chibi access list | add EMAIL [--chat-only] | remove EMAIL
17
17
  chibi service install [--domain HOST | --tunnel | --tailscale] [--port N] [--data-dir DIR] | uninstall
18
18
  chibi browser install [--with-deps] | status
19
+ chibi terminal --bot ID [--place local|vm|cloud] [--thread ID]
19
20
  chibi fleet init --domain HOST [--operator USER] | create NAME --admin EMAIL [--member EMAIL] [--brand FILE]
20
21
  [--anthropic-key-file FILE] [--cap USD] [--license-key KEY] [--memory 1G]
21
22
  | list | users NAME add|remove EMAIL [--chat-only] | suspend NAME | resume NAME
@@ -44,6 +45,9 @@ browser install: the bots' browser engine (agent-browser, pinned) into the
44
45
  the Linux libraries Chrome needs (run as root once). Then run
45
46
  browser install as the user running serve, from that user's home.
46
47
  status: what the current user and data directory have.
48
+ terminal a shell on a bot's computer, like the Computer panel's Terminal
49
+ tab: local (this computer, the default), vm or cloud. Keys go to
50
+ the shell as typed; Ctrl-] closes it.
47
51
  fleet many client workspaces on one Linux server, each its own account,
48
52
  service, data folder, brand, sign-in list and keys at NAME.HOST
49
53
  behind the system Caddy. Plans are printed unless run as root;
@@ -0,0 +1,87 @@
1
+ // `chibi terminal --bot ID [--place vm|cloud|local] [--thread ID]`: the
2
+ // Computer panel's Terminal tab in this terminal, through the running server
3
+ // (server/routes/terminal.ts). Loopback is the owner, so the shell is the
4
+ // desktop's; a service-trust server refuses it like any other caller.
5
+ //
6
+ // Keys go to the shell as typed (raw mode), Ctrl-C included. Ctrl-] closes
7
+ // the shell and returns, as in telnet.
8
+ const CLOSE_KEY = "\x1d";
9
+ const HEADERS = { "content-type": "application/json", "x-openmausbot-cli": "1" };
10
+ export async function runTerminal(options, io) {
11
+ const call = io.fetch ?? fetch;
12
+ const base = `http://127.0.0.1:${options.port}`;
13
+ let opened;
14
+ try {
15
+ opened = await call(`${base}/api/bots/${encodeURIComponent(options.botId)}/terminal`, {
16
+ method: "POST",
17
+ headers: HEADERS,
18
+ body: JSON.stringify({ place: options.place, threadId: options.threadId, cols: io.stdout.columns, rows: io.stdout.rows }),
19
+ });
20
+ }
21
+ catch {
22
+ io.error(`no server answered on port ${options.port}; start it with chibi start`);
23
+ return 1;
24
+ }
25
+ const body = await opened.json().catch(() => ({}));
26
+ if (!opened.ok || !body.id) {
27
+ io.error(body.error ?? `Server returned ${opened.status}`);
28
+ return 1;
29
+ }
30
+ const session = `${base}/api/terminal/${encodeURIComponent(body.id)}`;
31
+ const stream = await call(`${session}/stream`, { headers: HEADERS });
32
+ if (!stream.ok || !stream.body) {
33
+ io.error(`the terminal stream did not open (${stream.status})`);
34
+ return 1;
35
+ }
36
+ const reader = stream.body.getReader();
37
+ // Keystrokes go out one request at a time so they arrive in order.
38
+ let sending = Promise.resolve();
39
+ const onKeys = (chunk) => {
40
+ const data = chunk.toString();
41
+ if (data.includes(CLOSE_KEY)) {
42
+ void reader.cancel();
43
+ return;
44
+ }
45
+ sending = sending.then(() => call(`${session}/input`, { method: "POST", headers: HEADERS, body: JSON.stringify({ data }) }).then(() => undefined, () => undefined));
46
+ };
47
+ const raw = Boolean(io.stdin.isTTY && io.stdin.setRawMode);
48
+ if (raw)
49
+ io.stdin.setRawMode(true);
50
+ io.stdin.on("data", onKeys);
51
+ io.stdin.resume();
52
+ let code = null;
53
+ const decoder = new TextDecoder();
54
+ let pending = "";
55
+ try {
56
+ for (;;) {
57
+ const { done, value } = await reader.read();
58
+ if (done)
59
+ break;
60
+ pending += decoder.decode(value, { stream: true });
61
+ const lines = pending.split("\n");
62
+ pending = lines.pop() ?? "";
63
+ for (const line of lines) {
64
+ // Blank lines are the server's keepalive.
65
+ if (!line.trim())
66
+ continue;
67
+ const event = JSON.parse(line);
68
+ if (event.type === "output" && event.data)
69
+ io.stdout.write(event.data);
70
+ if (event.type === "exit")
71
+ code = event.code ?? 0;
72
+ }
73
+ }
74
+ }
75
+ catch {
76
+ // The stream was cut (Ctrl-], or the server went away); the shell is closed below.
77
+ }
78
+ finally {
79
+ io.stdin.off("data", onKeys);
80
+ if (raw)
81
+ io.stdin.setRawMode(false);
82
+ io.stdin.pause();
83
+ }
84
+ await sending;
85
+ await call(session, { method: "DELETE", headers: HEADERS }).catch(() => undefined);
86
+ return code ?? 0;
87
+ }
@@ -1,4 +1,6 @@
1
1
  import { USAGE } from "./cli-help.js";
2
+ import { runBrowser } from "./cli-browser.js";
3
+ import { runTerminal } from "./cli-terminal.js";
2
4
  export { USAGE } from "./cli-help.js";
3
5
  // `chibi` on the command line: run the server anywhere and pair devices
4
6
  // to it. One implementation for three homes — `npx @chibitek/chibi` (the npm
@@ -50,7 +52,7 @@ import { defaultSetupIo, SetupCancelled } from "./cli-prompts.js";
50
52
  import { normalizePhoneOrigin, phonePairingInstructions, runPhoneSetup } from "./cli-phone-setup.js";
51
53
  import { cleanupTunnelOrigin, createTunnelAccount, createTunnelOrigin, describeTunnelAccount, describeTunnelState, ensureCloudflared, FLEET_CREDENTIAL_ENV, fleetAccess, fleetCredential, guardianEntry, startTunnel, tunnelAccess, } from "./tunnel.js";
52
54
  const HERE = dirname(fileURLToPath(import.meta.url));
53
- export const COMMANDS = ["command", "goal", "setup", "start", "serve", "pair", "sessions", "status", "login", "logout", "access", "service", "browser", "fleet", "help", "--help", "-h"];
55
+ export const COMMANDS = ["command", "goal", "setup", "start", "serve", "pair", "sessions", "status", "login", "logout", "access", "service", "browser", "fleet", "terminal", "help", "--help", "-h"];
54
56
  export function parseArgs(argv, env = process.env) {
55
57
  const implicitStart = !argv.length || (argv[0].startsWith("--") && argv[0] !== "--help");
56
58
  const [command = "start", ...rest] = implicitStart ? ["start", ...argv] : argv;
@@ -79,11 +81,11 @@ export function parseArgs(argv, env = process.env) {
79
81
  return v;
80
82
  };
81
83
  try {
82
- if ((options.command === "command" || options.command === "goal") && arg === "--bot")
84
+ if ((options.command === "command" || options.command === "goal" || options.command === "terminal") && arg === "--bot")
83
85
  options.botId = value();
84
86
  else if ((options.command === "command" || options.command === "goal") && arg === "--group")
85
87
  options.groupId = value();
86
- else if ((options.command === "command" || options.command === "goal") && arg === "--thread")
88
+ else if ((options.command === "command" || options.command === "goal" || options.command === "terminal") && arg === "--thread")
87
89
  options.threadId = value();
88
90
  else if ((options.command === "command" || options.command === "goal") && arg === "--text")
89
91
  options.commandText = value();
@@ -143,6 +145,8 @@ export function parseArgs(argv, env = process.env) {
143
145
  options.browserAction = arg;
144
146
  else if (options.command === "browser" && arg === "--with-deps")
145
147
  options.withDeps = true;
148
+ else if (options.command === "terminal" && arg === "--place")
149
+ options.place = value();
146
150
  else if (options.command === "fleet" && !options.fleetAction && ["init", "create", "list", "users", "suspend", "resume", "delete", "upgrade", "agent"].includes(arg))
147
151
  options.fleetAction = arg;
148
152
  else if (options.command === "fleet" && options.fleetAction && !["init", "list", "upgrade", "agent"].includes(options.fleetAction) && !options.slug && !arg.startsWith("--"))
@@ -205,6 +209,8 @@ export function parseArgs(argv, env = process.env) {
205
209
  return { error: "--local cannot be combined with a remote-access option" };
206
210
  if (options.command === "browser" && !options.browserAction)
207
211
  return { error: "browser needs an action: install or status" };
212
+ if (options.command === "terminal" && (!options.botId || !["vm", "cloud", "local"].includes(options.place ?? "local")))
213
+ return { error: "terminal needs --bot ID, and --place is vm, cloud or local" };
208
214
  if (options.command === "fleet") {
209
215
  if (!options.fleetAction)
210
216
  return { error: "fleet needs one of: init --domain HOST [--operator USER], create NAME --admin EMAIL, list, users NAME add|remove EMAIL, suspend NAME, resume NAME, delete NAME --yes, upgrade, agent" };
@@ -722,47 +728,6 @@ export async function runLogout(options, io = defaultIo()) {
722
728
  io.log(`Signed out ${before.email}${before.address ? `; ${before.address} is released` : ""}.`);
723
729
  return 0;
724
730
  }
725
- export async function runBrowser(options, io = defaultIo()) {
726
- const { browserEngineStatus, describeBrowserEngine, ensureChrome, installAgentBrowserBinary, resolveAgentBrowserBinary } = await import("./browser-engine.js");
727
- const status = browserEngineStatus({ dataDir: options.dataDir });
728
- if (options.browserAction === "status") {
729
- io.log(describeBrowserEngine(status));
730
- if (status.kind !== "ready" && status.installable)
731
- io.log("install it with: chibi browser install");
732
- return status.kind === "ready" ? 0 : 1;
733
- }
734
- let binary = resolveAgentBrowserBinary({ dataDir: options.dataDir });
735
- if (binary) {
736
- io.log(`agent-browser is already here: ${binary}`);
737
- }
738
- else {
739
- if (status.kind !== "ready" && !status.installable) {
740
- io.error(status.reason);
741
- return 1;
742
- }
743
- try {
744
- binary = await installAgentBrowserBinary({ dataDir: options.dataDir, log: io.log });
745
- }
746
- catch (error) {
747
- io.error(`could not install agent-browser: ${message(error)}`);
748
- return 1;
749
- }
750
- io.log(`installed ${binary}`);
751
- }
752
- try {
753
- await ensureChrome(binary, { withDeps: options.withDeps === true, log: io.log });
754
- }
755
- catch (error) {
756
- io.error(`Chrome is not ready: ${message(error)}`);
757
- if (process.platform === "linux" && !options.withDeps)
758
- io.error("on Linux, install Chrome's system libraries with `sudo chibi browser install --with-deps`, then retry `chibi browser install` as the user running serve");
759
- return 1;
760
- }
761
- io.log("browser installed for this user and data directory; run serve as the same user, then enable it under Settings → Experimental and per bot");
762
- if (process.platform === "linux" && options.withDeps)
763
- io.log("if serve runs as another user, run `chibi browser install` from that user's login shell too");
764
- return 0;
765
- }
766
731
  /** Where the server bundle lives relative to this file: next to it in the
767
732
  * npm package and the image (dist-server/), or the TypeScript source in a
768
733
  * checkout. */
@@ -1260,7 +1225,9 @@ export async function main(argv = process.argv.slice(2)) {
1260
1225
  case "logout":
1261
1226
  return runLogout(options);
1262
1227
  case "browser":
1263
- return runBrowser(options);
1228
+ return runBrowser(options, defaultIo());
1229
+ case "terminal":
1230
+ return runTerminal({ port: options.port, botId: options.botId, place: options.place ?? "local", threadId: options.threadId }, { stdin: process.stdin, stdout: process.stdout, error: (line) => console.error(line) });
1264
1231
  default:
1265
1232
  console.log(USAGE);
1266
1233
  return 0;
@@ -298,7 +298,7 @@ import { applyChibiDefaults, chibiDefaultSelection } from "./chibi-defaults.js";
298
298
  import { createPrimaryBotRoutes } from "./routes/primary-bot.js";
299
299
  import { EngineSnapshotCache, botTier, canDriveComputer, classLadder, engineAccount, engineHealth, engineLabel, engineTierClasses, engineTierLadders, failoverClassOrder, engineTiersIncludeFree, generateLadders, handlesClientData, ladderForClass, keyBased, needsDelegation, resolveFailover, resolveLadder } from "./engine-tiers.js";
300
300
  import { PRIMARY_BOT_THREAD_TITLE, PRIMARY_BOT_TRIGGER, PrimaryBotStore, routesAsSweep, PrimaryBotSweeper } from "./primary-bot.js";
301
- import { PRIMARY_BOT_LOCKED, primaryBotChoiceField } from "../shared/primary-bot.js";
301
+ import { PRIMARY_BOT_LOCKED, primaryBotChoiceField, isPrimaryBot } from "../shared/primary-bot.js";
302
302
  import { moveIntoChibi } from "./move-into-chibi.js";
303
303
  import { MODEL_CLASSES, TIERS_THAT_MAY_DROP_A_CLASS, botEngineMode, isBotTier, modeClass, parseClassChoice, threadEngineMode } from "../shared/engine-tiers.js";
304
304
  import { EngineRestStore } from "./engine-rest.js";
@@ -15633,8 +15633,7 @@ teamRoomsHost = new TeamRoomsHost({
15633
15633
  dataDir: DATA_DIR,
15634
15634
  enabled: () => teamRoomsEnabled(cfg),
15635
15635
  localBots: () => store.bots.filter((bot) => !personalBotHidden(bot)).map((bot) => ({
15636
- id: bot.id,
15637
- name: bot.name,
15636
+ id: bot.id, name: bot.name, primary: isPrimaryBot(bot),
15638
15637
  private: isPersonalBot(bot),
15639
15638
  hipaa: bot.hipaa === true || workspaceHipaa().enabled,
15640
15639
  })),
@@ -471,7 +471,8 @@ export function resolveRequestAuth(req, options) {
471
471
  !/^[\w-]{1,128}$/.test(headerValue(req.headers["x-openmausbot-companion-device"]) ?? "") ||
472
472
  companionDenial({ path, method, authenticated: true }))
473
473
  return deny(403, "forbidden: invalid companion request");
474
- return { auth: { kind: "loopback", scopes: LOOPBACK_SCOPES }, status: 401, error: "" };
474
+ const device = headerValue(req.headers["x-openmausbot-companion-device"]);
475
+ return { auth: { kind: "loopback", scopes: LOOPBACK_SCOPES, device }, status: 401, error: "" };
475
476
  }
476
477
  if (options.loopbackMutationToken !== undefined &&
477
478
  mutatingPublicRoute(method, path) &&
@@ -71,6 +71,10 @@ export function createTeamRoomsRoutes(deps) {
71
71
  if (path === "/api/team-rooms" && method === "POST") {
72
72
  const body = record(await readBody(req, 16_000));
73
73
  const title = typeof body.title === "string" ? body.title : "";
74
+ if (body.kind !== undefined && body.kind !== "channel" && body.kind !== "room")
75
+ return json(res, 400, { error: "Unknown room type.", code: "bad_request" });
76
+ if (body.kind === "channel" && body.share !== undefined)
77
+ return json(res, 400, { error: "Channels start without private conversation history.", code: "bad_request" });
74
78
  const share = record(body.share);
75
79
  if (body.share !== undefined) {
76
80
  const botId = typeof share.botId === "string" && LOCAL_ID.test(share.botId) ? share.botId : null;
@@ -82,7 +86,7 @@ export function createTeamRoomsRoutes(deps) {
82
86
  return json(res, 404, { error: "That conversation is not on this computer.", code: "not_found" });
83
87
  return json(res, 200, await service.createRoom({ title, share: { localBotId: botId, threadId, history } }));
84
88
  }
85
- return json(res, 200, await service.createRoom({ title }));
89
+ return json(res, 200, await service.createRoom({ title, ...(body.kind === "channel" ? { kind: "channel" } : {}) }));
86
90
  }
87
91
  if (path === "/api/team-rooms/join/preview" && method === "POST") {
88
92
  const body = record(await readBody(req, 4_096));
@@ -1,12 +1,16 @@
1
1
  import { clampSize } from "../terminal.js";
2
2
  import { PASS } from "./table.js";
3
+ /** Under the 90-second idle timeout the phone's stream session uses. */
4
+ const KEEPALIVE_MS = 25_000;
3
5
  const owner = (auth) => {
4
6
  if (!auth.scopes.includes("admin"))
5
7
  return null;
6
8
  if (auth.kind === "session")
7
9
  return `session:${auth.session.id}`;
10
+ // A paired phone reaches the server through the companion as a loopback
11
+ // owner; its shells are its own, not the desktop's or another phone's.
8
12
  if (auth.kind === "loopback" && auth.trust !== "service")
9
- return "desktop";
13
+ return auth.device ? `companion:${auth.device}` : "desktop";
10
14
  return null;
11
15
  };
12
16
  export function createTerminalRoutes(deps) {
@@ -47,12 +51,19 @@ export function createTerminalRoutes(deps) {
47
51
  return json(res, 405, { error: "method not allowed" });
48
52
  res.writeHead(200, { "content-type": "application/x-ndjson", "cache-control": "no-cache", "x-accel-buffering": "no" });
49
53
  req.socket.setTimeout(0);
54
+ // A blank line every so often keeps a quiet shell's stream from looking
55
+ // dead to a phone's idle timeout; readers skip empty lines.
56
+ const keepalive = setInterval(() => res.write("\n"), KEEPALIVE_MS);
57
+ keepalive.unref?.();
50
58
  const unsubscribe = live.subscribe((event) => {
51
59
  res.write(`${JSON.stringify(event)}\n`);
52
60
  if (event.type === "exit")
53
61
  res.end();
54
62
  });
55
- res.on("close", unsubscribe);
63
+ res.on("close", () => {
64
+ clearInterval(keepalive);
65
+ unsubscribe();
66
+ });
56
67
  return;
57
68
  }
58
69
  if (action === "input") {
@@ -8,6 +8,7 @@ import { randomUUID } from "node:crypto";
8
8
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
9
9
  import { join } from "node:path";
10
10
  import { onStikiSessionChange, setStikiSessionSource, stikiSession } from "../stiki-session.js";
11
+ import { ChannelInstallation } from "./installation.js";
11
12
  import { RoomsBackend } from "./backend.js";
12
13
  import { TeamRoomsService } from "./service.js";
13
14
  /** Longest a room turn may take before the room is told it did not finish. */
@@ -20,10 +21,12 @@ export class TeamRoomsHost {
20
21
  svc = null;
21
22
  installId;
22
23
  backend;
24
+ installation;
23
25
  deps;
24
26
  constructor(deps) {
25
27
  this.deps = deps;
26
28
  this.installId = loadInstallId(deps.dataDir);
29
+ this.installation = new ChannelInstallation(deps.dataDir, this.installId, stikiSession);
27
30
  this.backend = deps.backend ?? new RoomsBackend({
28
31
  url: process.env.ATOMIC_ROOMS_URL || undefined,
29
32
  key: process.env.ATOMIC_ROOMS_KEY || undefined,
@@ -47,6 +50,7 @@ export class TeamRoomsHost {
47
50
  installId: this.installId,
48
51
  device: process.platform === "darwin" ? "mac" : process.platform === "win32" ? "windows" : "linux",
49
52
  localBots: this.deps.localBots,
53
+ channelProof: (botId) => this.installation.proof(botId),
50
54
  runTurn: (run) => this.runTurn(run),
51
55
  notify: this.deps.notify,
52
56
  changed: this.deps.changed,
@@ -0,0 +1,83 @@
1
+ import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes, sign } from "node:crypto";
2
+ import { existsSync, mkdirSync, readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { writeFileAtomic } from "../atomic.js";
5
+ /** Device identity is never backed up or returned to the renderer. Like the
6
+ * private-scope key, it is stored owner-readable only. This proves possession,
7
+ * not executable integrity; revocation must be checked on every room write. */
8
+ export class ChannelInstallation {
9
+ pending = new Map();
10
+ dataDir;
11
+ installId;
12
+ session;
13
+ request;
14
+ constructor(dataDir, installId, session, request = fetch) {
15
+ this.dataDir = dataDir;
16
+ this.installId = installId;
17
+ this.session = session;
18
+ this.request = request;
19
+ }
20
+ async proof(primaryBotId) {
21
+ const source = this.session();
22
+ const token = await source.accessToken();
23
+ const owner = source.identity()?.userId;
24
+ if (!token || !owner)
25
+ throw new Error("Sign in to Chibitek to use your Chibi in Channels.");
26
+ const dir = join(this.dataDir, "channel-identity");
27
+ const path = join(dir, `${createHash("sha256").update(owner).digest("hex")}.json`);
28
+ mkdirSync(dir, { recursive: true, mode: 0o700 });
29
+ if (!existsSync(path)) {
30
+ const { privateKey } = generateKeyPairSync("ec", { namedCurve: "prime256v1" });
31
+ writeFileAtomic(path, JSON.stringify({ primaryBotId, keyId: randomBytes(16).toString("hex"), pem: privateKey.export({ type: "pkcs8", format: "pem" }) }), { mode: 0o600 });
32
+ }
33
+ const stored = JSON.parse(readFileSync(path, "utf8"));
34
+ if (stored.primaryBotId !== primaryBotId)
35
+ throw new Error("This installation is bound to a different primary Chibi. Revoke its binding before replacing it.");
36
+ const key = createPrivateKey(stored.pem);
37
+ const identifiers = [owner, this.installId, stored.keyId, primaryBotId, "primary_chibi"];
38
+ const signature = (lines) => sign("sha256", Buffer.from(lines.join("\n")), key).toString("base64");
39
+ const api = async (suffix, body) => {
40
+ const response = await this.request(`https://auth.chibitek.com/api/atomic-installations${suffix}`, {
41
+ method: body ? "POST" : "GET", headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
42
+ ...(body ? { body: JSON.stringify(body) } : {}), redirect: "error", signal: AbortSignal.timeout(15_000),
43
+ });
44
+ if (response.status === 404 && !body)
45
+ return null;
46
+ if (!response.ok)
47
+ throw new Error(`Chibi installation verification failed (${response.status}). Sign in again or check the Channels service.`);
48
+ return await response.json();
49
+ };
50
+ // Serialize enrollment for simultaneous channel admissions. Every call still
51
+ // performs a live lookup; a revoked key is never silently replaced.
52
+ const previous = this.pending.get(owner) ?? Promise.resolve();
53
+ const enrollment = previous.catch(() => { }).then(async () => {
54
+ const current = await api(`?install_id=${encodeURIComponent(this.installId)}&key_id=${stored.keyId}`);
55
+ if (current) {
56
+ const binding = current.installation;
57
+ if (!binding || binding.revoked !== false || binding.user_id !== owner || binding.install_id !== this.installId || binding.key_id !== stored.keyId || binding.primary_bot_id !== primaryBotId || binding.role !== "primary_chibi") {
58
+ throw new Error("This Chibi installation binding is revoked or does not match this computer.");
59
+ }
60
+ return;
61
+ }
62
+ const challenge = await api("/challenge", { install_id: this.installId, key_id: stored.keyId, primary_bot_id: primaryBotId });
63
+ if (!challenge || challenge.user_id !== owner || challenge.install_id !== this.installId || challenge.key_id !== stored.keyId || challenge.primary_bot_id !== primaryBotId || challenge.role !== "primary_chibi" || typeof challenge.challenge !== "string" || typeof challenge.challenge_id !== "string") {
64
+ throw new Error("Chibi enrollment challenge did not match this installation.");
65
+ }
66
+ await api("", { challenge_id: challenge.challenge_id, public_key: createPublicKey(key).export({ type: "spki", format: "der" }).toString("base64"), signature: signature(["stiki.atomic-install-enroll.v1", ...identifiers, challenge.challenge]) });
67
+ });
68
+ this.pending.set(owner, enrollment);
69
+ try {
70
+ await enrollment;
71
+ }
72
+ finally {
73
+ if (this.pending.get(owner) === enrollment)
74
+ this.pending.delete(owner);
75
+ }
76
+ if (source !== this.session() || source.identity()?.userId !== owner)
77
+ throw new Error("Chibitek sign-in changed during verification.");
78
+ const nonce = randomBytes(24).toString("base64url");
79
+ const issuedAt = new Date().toISOString();
80
+ return { stiki_token: token, installation_proof: { install_id: this.installId, key_id: stored.keyId, audience: "atomic-rooms", nonce, issued_at: issuedAt,
81
+ signature: signature(["stiki.atomic-install-attest.v1", ...identifiers, "atomic-rooms", nonce, issuedAt]) } };
82
+ }
83
+ }
@@ -8,7 +8,7 @@
8
8
  import { randomUUID } from "node:crypto";
9
9
  import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
10
10
  import { join } from "node:path";
11
- import { PRESENCE_HEARTBEAT_MS, ROOM_MESSAGE_MAX, ROOM_TITLE_MAX, botAvailable, canAddBot, companyNames, inviteTokenFrom, isCrossCompany, mentionedBots, sharePolicy, SHARE_CATEGORIES, } from "../../shared/team-rooms.js";
11
+ import { PRESENCE_HEARTBEAT_MS, ROOM_MESSAGE_MAX, ROOM_TITLE_MAX, botAvailable, canAddBot, companyNames, inviteTokenFrom, isChannel, isCrossCompany, mentionedBots, roomSharePolicy, SHARE_CATEGORIES, } from "../../shared/team-rooms.js";
12
12
  import { RoomsApiError } from "./backend.js";
13
13
  import { RoomsRealtime } from "./realtime.js";
14
14
  import { roomTurnText } from "./turn.js";
@@ -270,6 +270,7 @@ export class TeamRoomsService {
270
270
  return {
271
271
  id: state.room.id,
272
272
  title: state.room.title,
273
+ kind: isChannel(state.room.source) ? "channel" : "room",
273
274
  isOwner: mine?.role === "owner",
274
275
  crossCompany: isCrossCompany(realms),
275
276
  companies: companyNames(realms),
@@ -297,7 +298,7 @@ export class TeamRoomsService {
297
298
  isMine: b.owner_user_id === me,
298
299
  localBotId: b.owner_user_id === me && b.host_install_id === this.deps.installId && local.has(b.local_bot_id) ? b.local_bot_id : null,
299
300
  available: botAvailable(this.presence.get(b.id) ?? null, now),
300
- share: sharePolicy(b.share_policy, crossCompany),
301
+ share: roomSharePolicy(state.room.source, b.share_policy, crossCompany),
301
302
  dailyTurnCap: b.daily_turn_cap,
302
303
  })),
303
304
  messages: state.messages.filter((m) => !m.deleted_at).map((m) => ({
@@ -314,6 +315,8 @@ export class TeamRoomsService {
314
315
  // ── Actions ───────────────────────────────────────────────────────────
315
316
  async createRoom(input) {
316
317
  this.me();
318
+ if (input.kind === "channel" && input.share)
319
+ throw new RoomsApiError(400, "bad_request", "Channels start without private conversation history.");
317
320
  const title = input.title.trim().slice(0, ROOM_TITLE_MAX);
318
321
  if (!title)
319
322
  throw new RoomsApiError(400, "bad_request", "Give the room a name.");
@@ -327,8 +330,14 @@ export class TeamRoomsService {
327
330
  throw new RoomsApiError(403, "private_bot", "Your Private Bot stays out of Team Rooms.");
328
331
  bot = { install_id: this.deps.installId, local_bot_id: local.id, bot_name: local.name, hipaa: local.hipaa, private: false };
329
332
  }
333
+ if (input.kind === "channel") {
334
+ const capability = await this.deps.backend.api("channels/capabilities");
335
+ if (capability.version !== 1)
336
+ throw new RoomsApiError(409, "bad_request", "This server does not support Channels yet.");
337
+ }
330
338
  const result = await this.deps.backend.api("rooms/create", {
331
339
  title,
340
+ ...(input.kind === "channel" ? { kind: "channel" } : {}),
332
341
  ...(input.share ? {
333
342
  source: { installId: this.deps.installId, botId: input.share.localBotId, threadId: input.share.threadId },
334
343
  bot,
@@ -377,7 +386,7 @@ export class TeamRoomsService {
377
386
  throw new RoomsApiError(400, "invite_not_found", "This invite link is not valid.");
378
387
  const result = await this.deps.backend.api("join", { token });
379
388
  await this.sync();
380
- return { roomId: result.room.id };
389
+ return { roomId: result.room.id, kind: this.detail(result.room.id)?.kind ?? "room" };
381
390
  }
382
391
  async leave(roomId) {
383
392
  await this.deps.backend.api("leave", { room_id: roomId });
@@ -396,6 +405,9 @@ export class TeamRoomsService {
396
405
  const local = this.deps.localBots().find((b) => b.id === localBotId);
397
406
  if (!state || !local)
398
407
  throw new RoomsApiError(404, "not_found", "That bot is not on this computer.");
408
+ if (isChannel(state.room.source) && local.primary !== true) {
409
+ throw new RoomsApiError(403, "bad_request", "Only your primary Chibi can join a channel.");
410
+ }
399
411
  const decision = canAddBot(local, {
400
412
  crossCompany: isCrossCompany(state.members.map((m) => ({ realm: m.realm, realmName: m.realm_name }))),
401
413
  activeBots: state.bots.length,
@@ -403,7 +415,7 @@ export class TeamRoomsService {
403
415
  });
404
416
  if (!decision.ok)
405
417
  throw new RoomsApiError(403, decision.code, decision.reason);
406
- await this.deps.backend.api("bots/add", { room_id: roomId, install_id: this.deps.installId, local_bot_id: local.id, bot_name: local.name, hipaa: local.hipaa, private: false });
418
+ await this.deps.backend.api("bots/add", { ...await this.channelProof(roomId, local.id), room_id: roomId, install_id: this.deps.installId, local_bot_id: local.id, bot_name: local.name, hipaa: local.hipaa, private: false });
407
419
  await this.sync();
408
420
  void this.heartbeat();
409
421
  }
@@ -417,7 +429,10 @@ export class TeamRoomsService {
417
429
  if (!state || !bot || bot.owner_user_id !== this.me())
418
430
  throw new RoomsApiError(403, "not_bot_owner", "Only the bot's owner changes what it may share.");
419
431
  const crossCompany = isCrossCompany(state.members.map((m) => ({ realm: m.realm, realmName: m.realm_name })));
420
- const next = sharePolicy(bot.share_policy, crossCompany);
432
+ if (isChannel(state.room.source) && SHARE_CATEGORIES.some(key => patch.share?.[key] === true)) {
433
+ throw new RoomsApiError(403, "bad_request", "Private capabilities stay with their owner in Channels.");
434
+ }
435
+ const next = roomSharePolicy(state.room.source, bot.share_policy, crossCompany);
421
436
  for (const key of SHARE_CATEGORIES)
422
437
  if (typeof patch.share?.[key] === "boolean")
423
438
  next[key] = patch.share[key];
@@ -492,14 +507,35 @@ export class TeamRoomsService {
492
507
  }
493
508
  }
494
509
  }
510
+ async channelProof(roomId, botId) {
511
+ const state = this.rooms.get(roomId);
512
+ if (!state)
513
+ throw new Error("Room is no longer available.");
514
+ if (!isChannel(state.room.source))
515
+ return {};
516
+ if (!this.deps.localBots().some((bot) => bot.id === botId && bot.primary && !bot.private))
517
+ throw new Error("Only your primary Chibi can answer in Channels.");
518
+ if (!this.deps.channelProof)
519
+ throw new Error("Chibi installation verification is unavailable.");
520
+ return this.deps.channelProof(botId);
521
+ }
522
+ async turnProof(turnId) {
523
+ for (const state of this.rooms.values()) {
524
+ const turn = state.turns.get(turnId);
525
+ const bot = turn && state.bots.find((entry) => entry.id === turn.bot_id);
526
+ if (bot)
527
+ return this.channelProof(state.room.id, bot.local_bot_id);
528
+ }
529
+ throw new Error("Room turn is no longer available.");
530
+ }
495
531
  async finish(turnId, body, ok, usage) {
496
- await this.deps.backend.api("turns/finish", { turn_id: turnId, install_id: this.deps.installId, body, status: ok ? "done" : "failed", ...(usage ? { usage } : {}) });
532
+ await this.deps.backend.api("turns/finish", { ...await this.turnProof(turnId), turn_id: turnId, install_id: this.deps.installId, body, status: ok ? "done" : "failed", ...(usage ? { usage } : {}) });
497
533
  }
498
534
  async runTurn(state, turn, bot) {
499
535
  const local = this.deps.localBots().find((b) => b.id === bot.local_bot_id);
500
536
  let claim;
501
537
  try {
502
- claim = await this.deps.backend.api("turns/claim", { turn_id: turn.id, install_id: this.deps.installId });
538
+ claim = await this.deps.backend.api("turns/claim", { ...await this.channelProof(state.room.id, bot.local_bot_id), turn_id: turn.id, install_id: this.deps.installId });
503
539
  }
504
540
  catch (error) {
505
541
  console.warn(`[team-rooms] claim ${turn.id}: ${errorText(error)}`);
@@ -508,7 +544,7 @@ export class TeamRoomsService {
508
544
  if (!claim.claimed)
509
545
  return;
510
546
  // Refused twice: Atomic here, the backend at add time.
511
- if (!local || local.private) {
547
+ if (!local || local.private || (isChannel(state.room.source) && local.primary !== true)) {
512
548
  await this.finish(turn.id, `${bot.display_name} is no longer available on its owner's computer.`, false).catch(() => { });
513
549
  return;
514
550
  }
@@ -527,7 +563,7 @@ export class TeamRoomsService {
527
563
  roomTitle: state.room.title,
528
564
  turnId: turn.id,
529
565
  botDisplayName: bot.display_name,
530
- share: sharePolicy(bot.share_policy, crossCompany),
566
+ share: roomSharePolicy(state.room.source, bot.share_policy, crossCompany),
531
567
  crossCompany,
532
568
  requestedByOwner: turn.requested_by === bot.owner_user_id,
533
569
  requestedByName,
@@ -537,9 +573,12 @@ export class TeamRoomsService {
537
573
  .map((m) => ({ author: m.author_name || "Someone", body: m.body, kind: m.author_kind }));
538
574
  const text = roomTurnText(lines, { from: requestedByName, body: trigger.body });
539
575
  try {
540
- await this.deps.backend.api("turns/status", { turn_id: turn.id, install_id: this.deps.installId, status: "running" });
576
+ await this.deps.backend.api("turns/status", { ...await this.channelProof(state.room.id, bot.local_bot_id), turn_id: turn.id, install_id: this.deps.installId, status: "running" });
577
+ }
578
+ catch {
579
+ if (isChannel(state.room.source))
580
+ return;
541
581
  }
542
- catch { /* status is informational */ }
543
582
  let outcome;
544
583
  try {
545
584
  outcome = await this.deps.runTurn({ localBotId: local.id, restriction, text });
@@ -574,7 +613,7 @@ export class TeamRoomsService {
574
613
  return;
575
614
  try {
576
615
  const result = await this.deps.backend.api("approvals/request", {
577
- turn_id: run.turn.id, install_id: this.deps.installId, summary: summary.slice(0, 500) || "An action", action_hash: actionHash,
616
+ ...await this.channelProof(run.turn.room_id, run.bot.local_bot_id), turn_id: run.turn.id, install_id: this.deps.installId, summary: summary.slice(0, 500) || "An action", action_hash: actionHash,
578
617
  });
579
618
  run.approvals.set(requestId, result.approval_id);
580
619
  }
@@ -182,8 +182,11 @@ export class FakeRoomsBackend {
182
182
  const turns = this.tables.room_turns;
183
183
  const bots = this.tables.room_bots;
184
184
  switch (route) {
185
+ case "channels/capabilities": return reply(200, { version: 1, chibiAdmission: false });
185
186
  case "rooms/create": {
186
187
  const id = this.addRoom(me, String(body.title));
188
+ if (body.kind === "channel")
189
+ this.tables.rooms.find(row => row.id === id).source = { kind: "channel" };
187
190
  let botId = null;
188
191
  const bot = body.bot;
189
192
  if (bot) {
@@ -0,0 +1 @@
1
+ export {};