@chibitek/chibi 0.1.180 → 0.1.183

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 (74) hide show
  1. package/dist/assets/{abnfDiagram-O67JEVCF-C91sfqR5.js → abnfDiagram-O67JEVCF-BJRKA6IQ.js} +1 -1
  2. package/dist/assets/{arc-ywHVvcgD.js → arc-CZc_uW-u.js} +1 -1
  3. package/dist/assets/{architectureDiagram-NJMV4G6O-BgUERWVi.js → architectureDiagram-NJMV4G6O-DNLaTXeO.js} +1 -1
  4. package/dist/assets/{blockDiagram-BEXU5L5S-CpeTJJap.js → blockDiagram-BEXU5L5S-DLXsik0_.js} +1 -1
  5. package/dist/assets/{c4Diagram-YGBWAQC7-BgdM3M47.js → c4Diagram-YGBWAQC7-DG6hN1C0.js} +1 -1
  6. package/dist/assets/channel-DmcLphYK.js +1 -0
  7. package/dist/assets/{chunk-2Q5K7J3B-BcMR6SsJ.js → chunk-2Q5K7J3B-D5Yjh7-1.js} +1 -1
  8. package/dist/assets/{chunk-3FUC2YCW-DNzXM7Mm.js → chunk-3FUC2YCW-Bxyjopy0.js} +2 -2
  9. package/dist/assets/{chunk-5VM5RSS4-kVNi7GcP.js → chunk-5VM5RSS4-DDQZDrcU.js} +1 -1
  10. package/dist/assets/{chunk-GTNCS2PH-B5bYzLKn.js → chunk-GTNCS2PH-OwVykJDf.js} +1 -1
  11. package/dist/assets/{chunk-GWA4HPMP-DiMuTVC6.js → chunk-GWA4HPMP-BJRJdRRn.js} +1 -1
  12. package/dist/assets/{chunk-JWPE2WC7-Bl2yeh-K.js → chunk-JWPE2WC7-D0rQf2t4.js} +1 -1
  13. package/dist/assets/{chunk-NETBCI7D-Klel5WGa.js → chunk-NETBCI7D-DbgIhGxq.js} +1 -1
  14. package/dist/assets/{chunk-WEXAMYUT-CPIykbsI.js → chunk-WEXAMYUT-NVC6qgIT.js} +1 -1
  15. package/dist/assets/{chunk-XXDRQBXY-8cVOBFNO.js → chunk-XXDRQBXY-B9iYAoH7.js} +1 -1
  16. package/dist/assets/{classDiagram-v2-NBCMYWYE-DxDpAPju.js → classDiagram-v2-NBCMYWYE-Cma68soF.js} +1 -1
  17. package/dist/assets/{cose-bilkent-JH36ORCC-Bb935SMz.js → cose-bilkent-JH36ORCC-BrXaARl8.js} +1 -1
  18. package/dist/assets/{cynefin-OW5HDTMX-CxYWe3QR.js → cynefin-OW5HDTMX-DaxVySTi.js} +1 -1
  19. package/dist/assets/{cynefinDiagram-VND7K2PF-CYhyAhYv.js → cynefinDiagram-VND7K2PF-BhqakyPn.js} +1 -1
  20. package/dist/assets/{dagre-6A5THRUB-Bb41Vmni.js → dagre-6A5THRUB-C1GSPYtM.js} +1 -1
  21. package/dist/assets/{diagram-22UHCM2B-BNvUBpgi.js → diagram-22UHCM2B-BJ3lUPTt.js} +1 -1
  22. package/dist/assets/{diagram-3UASUU5V-D9x2CdxS.js → diagram-3UASUU5V-B15DdW5N.js} +1 -1
  23. package/dist/assets/{diagram-ATOU4E4O-BXIrC_GF.js → diagram-ATOU4E4O-CXiw2lST.js} +1 -1
  24. package/dist/assets/{diagram-CDSNMT55-OI4ao0qQ.js → diagram-CDSNMT55-DoqH99bW.js} +1 -1
  25. package/dist/assets/{diagram-MLGK6HIB-_zZZdxaC.js → diagram-MLGK6HIB-snN4K-CB.js} +1 -1
  26. package/dist/assets/{diagram-MPIPVDR6-9k65oUfK.js → diagram-MPIPVDR6-DgJvwpZO.js} +1 -1
  27. package/dist/assets/{ebnfDiagram-ZINNZB2B-Chvztd4J.js → ebnfDiagram-ZINNZB2B-AO646Cux.js} +1 -1
  28. package/dist/assets/{elk-276RUBZZ-CMWtKZmi.js → elk-276RUBZZ-BQwiFuXz.js} +1 -1
  29. package/dist/assets/{erDiagram-OPXOYQCR-2vqBM9HW.js → erDiagram-OPXOYQCR-B5VI88HR.js} +1 -1
  30. package/dist/assets/{flowDiagram-KWPJA3E3-C6y9L478.js → flowDiagram-KWPJA3E3-BNaAddPG.js} +1 -1
  31. package/dist/assets/{ganttDiagram-FUAMR5RP-uWHpQwJY.js → ganttDiagram-FUAMR5RP-C_ZoEfA5.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-X574FWY7-BLM0_X6z.js → gitGraphDiagram-X574FWY7-xthNWdmM.js} +1 -1
  33. package/dist/assets/{index-YJUVFbCT.js → index-ASohJJer.js} +1 -1
  34. package/dist/assets/{index-CPnrJ6T1.js → index-DmYwoh4R.js} +152 -152
  35. package/dist/assets/{infoDiagram-VRGFBTTK-DWeJ1wdL.js → infoDiagram-VRGFBTTK-Qhrkz09J.js} +1 -1
  36. package/dist/assets/{ishikawaDiagram-OU5B5YK6-R28kPwvB.js → ishikawaDiagram-OU5B5YK6-DzU3-GrV.js} +1 -1
  37. package/dist/assets/{journeyDiagram-ZHPQQLJL-BHWE5-BX.js → journeyDiagram-ZHPQQLJL-Dif-aG4a.js} +1 -1
  38. package/dist/assets/{kanban-definition-PNTS6WVX-M-Er9io8.js → kanban-definition-PNTS6WVX-NJ0l6rbK.js} +1 -1
  39. package/dist/assets/{linear-UI6pE8Wd.js → linear-DpEaZ_8H.js} +1 -1
  40. package/dist/assets/{mermaid.core-B_hsjjFv.js → mermaid.core-DOBTmT-1.js} +5 -5
  41. package/dist/assets/{mindmap-definition-NLK3R4M7-C6u7tH0B.js → mindmap-definition-NLK3R4M7-kPRBSQ6K.js} +1 -1
  42. package/dist/assets/{pegDiagram-GJSIUBJH-HdJHW3kd.js → pegDiagram-GJSIUBJH-BgX62j0G.js} +1 -1
  43. package/dist/assets/{pieDiagram-5QR66LMP-DYm0T2vD.js → pieDiagram-5QR66LMP-DpC0-6hx.js} +1 -1
  44. package/dist/assets/{quadrantDiagram-O4NWA36T-CEqOPSKh.js → quadrantDiagram-O4NWA36T-CNrmwxvV.js} +1 -1
  45. package/dist/assets/{railroadDiagram-XR7U4H2S-I8gLnKDm.js → railroadDiagram-XR7U4H2S-wl7o4Y2J.js} +1 -1
  46. package/dist/assets/{requirementDiagram-PLB6GJNP-0AbgBQwX.js → requirementDiagram-PLB6GJNP-D2qhVvpT.js} +1 -1
  47. package/dist/assets/{sankeyDiagram-IPEJSGJF-CELks0t3.js → sankeyDiagram-IPEJSGJF-DZOSOZWs.js} +1 -1
  48. package/dist/assets/{sequenceDiagram-PO4LG4MO-Lv5pg-Nj.js → sequenceDiagram-PO4LG4MO-eBogKj3g.js} +1 -1
  49. package/dist/assets/{sizeCapture-INFHLROL-D13uYR-m.js → sizeCapture-INFHLROL-Dp_Vdw0m.js} +1 -1
  50. package/dist/assets/{stateDiagram-v2-GCMORJYK-C6ntlRJp.js → stateDiagram-v2-GCMORJYK-K79Em0_p.js} +1 -1
  51. package/dist/assets/{swimlanes-2SLR337P-BBMTJMbP.js → swimlanes-2SLR337P-ByKYlFa_.js} +1 -1
  52. package/dist/assets/swimlanesDiagram-TC7HE7FX-BnN5frkm.js +8 -0
  53. package/dist/assets/{timeline-definition-EJHVYXUP-CQqiq_9n.js → timeline-definition-EJHVYXUP-CzeMeYU0.js} +1 -1
  54. package/dist/assets/{usecaseDiagram-POWQR4AR-CMdMUvua.js → usecaseDiagram-POWQR4AR-uQjp5Yz3.js} +1 -1
  55. package/dist/assets/{vennDiagram-UO4OBE2U-DwNRIC20.js → vennDiagram-UO4OBE2U-De8_78dQ.js} +1 -1
  56. package/dist/assets/{wardleyDiagram-VNRHLVJA-BDP4uswI.js → wardleyDiagram-VNRHLVJA-Dk_VO2LR.js} +1 -1
  57. package/dist/assets/{xychartDiagram-PMCCYNJV-B9qFFRsi.js → xychartDiagram-PMCCYNJV-DMx2Y7qW.js} +1 -1
  58. package/dist/handbook/atomic-handbook.html +1 -1
  59. package/dist/index.html +1 -1
  60. package/dist-server/drivers/agents-proxy.js +4 -4
  61. package/dist-server/index.js +333 -244
  62. package/dist-server/openmausbot.js +30 -9
  63. package/dist-server/pair-cli.js +30 -9
  64. package/dist-server/server/drivers/acp/hermes.js +4 -9
  65. package/dist-server/server/index.js +4 -3
  66. package/dist-server/server/workspace-backup-copy.js +67 -0
  67. package/dist-server/server/workspace-backup-http.js +1 -0
  68. package/dist-server/server/workspace-backup-maintenance.js +12 -2
  69. package/dist-server/server/workspace-backup.js +34 -52
  70. package/dist-server/shared/provider-accounts.js +13 -0
  71. package/dist-server/shared/subscription-bots.js +4 -4
  72. package/package.json +1 -1
  73. package/dist/assets/channel-Ck_atLKb.js +0 -1
  74. package/dist/assets/swimlanesDiagram-TC7HE7FX-CN2rFhol.js +0 -8
@@ -19636,6 +19636,18 @@ var init_provider_accounts = __esm({
19636
19636
  keyUrl: "https://platform.minimax.io/console/plan",
19637
19637
  signupUrl: "https://www.minimax.io/m-plan"
19638
19638
  },
19639
+ {
19640
+ // Coding Plan quota uses its own endpoint, separate from the general Z.ai API.
19641
+ id: "zai",
19642
+ kind: "apiKey",
19643
+ label: "Z.ai GLM Coding Plan",
19644
+ billing: "subscription",
19645
+ driver: "openai-compat",
19646
+ envVar: "ZAI_API_KEY",
19647
+ config: { url: "https://api.z.ai/api/coding/paas/v4", apiKeyEnv: "ZAI_API_KEY", model: "glm-5.3", provider: "" },
19648
+ keyUrl: "https://z.ai/manage-apikey/apikey-list",
19649
+ signupUrl: "https://z.ai/subscribe"
19650
+ },
19639
19651
  {
19640
19652
  id: "xai",
19641
19653
  kind: "apiKey",
@@ -19674,6 +19686,20 @@ var init_provider_accounts = __esm({
19674
19686
  keyUrl: "https://ollama.com/settings/keys",
19675
19687
  signupUrl: "https://ollama.com/pricing"
19676
19688
  },
19689
+ {
19690
+ // Nous Portal's OpenAI-compatible API, signed in with a portal key. No
19691
+ // Hermes needed (Erick, 2026-11-08).
19692
+ id: "nous",
19693
+ kind: "apiKey",
19694
+ label: "Nous Research",
19695
+ billing: "subscription",
19696
+ driver: "openai-compat",
19697
+ envVar: "NOUS_API_KEY",
19698
+ config: { url: "https://inference-api.nousresearch.com/v1", apiKeyEnv: "NOUS_API_KEY", model: "Hermes-4-405B", provider: "" },
19699
+ keyTest: { provider: "openaiCompat", url: "https://inference-api.nousresearch.com/v1" },
19700
+ keyUrl: "https://portal.nousresearch.com/",
19701
+ signupUrl: "https://portal.nousresearch.com/"
19702
+ },
19677
19703
  {
19678
19704
  // OpenCode Go is a flat monthly plan used through an OpenCode key.
19679
19705
  id: "opencodeGo",
@@ -56551,15 +56577,10 @@ var init_hermes = __esm({
56551
56577
  // from its log, by the core's stderr check).
56552
56578
  promptIdleMs: 3e5,
56553
56579
  loginNote: "Hermes CLI is not installed",
56554
- install: {
56555
- command: {
56556
- darwin: "curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash",
56557
- linux: "curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash",
56558
- win32: "iex (irm https://hermes-agent.nousresearch.com/install.ps1)"
56559
- },
56560
- docsUrl: "https://hermes-agent.nousresearch.com/docs/getting-started/quickstart",
56561
- signInCommand: "hermes setup"
56562
- },
56580
+ // No install command: setup never installs Hermes (Erick, 2026-11-08).
56581
+ // Nous Research signs in with a Nous Portal API key instead
56582
+ // (shared/provider-accounts.ts `nous`); Hermes runs only where the person
56583
+ // installed it themselves.
56563
56584
  spawnArgs: () => ["acp"],
56564
56585
  transformEnv: (env) => {
56565
56586
  for (const key of ["OPENAI_API_KEY", "OPENROUTER_API_KEY"]) delete env[key];
@@ -19636,6 +19636,18 @@ var init_provider_accounts = __esm({
19636
19636
  keyUrl: "https://platform.minimax.io/console/plan",
19637
19637
  signupUrl: "https://www.minimax.io/m-plan"
19638
19638
  },
19639
+ {
19640
+ // Coding Plan quota uses its own endpoint, separate from the general Z.ai API.
19641
+ id: "zai",
19642
+ kind: "apiKey",
19643
+ label: "Z.ai GLM Coding Plan",
19644
+ billing: "subscription",
19645
+ driver: "openai-compat",
19646
+ envVar: "ZAI_API_KEY",
19647
+ config: { url: "https://api.z.ai/api/coding/paas/v4", apiKeyEnv: "ZAI_API_KEY", model: "glm-5.3", provider: "" },
19648
+ keyUrl: "https://z.ai/manage-apikey/apikey-list",
19649
+ signupUrl: "https://z.ai/subscribe"
19650
+ },
19639
19651
  {
19640
19652
  id: "xai",
19641
19653
  kind: "apiKey",
@@ -19674,6 +19686,20 @@ var init_provider_accounts = __esm({
19674
19686
  keyUrl: "https://ollama.com/settings/keys",
19675
19687
  signupUrl: "https://ollama.com/pricing"
19676
19688
  },
19689
+ {
19690
+ // Nous Portal's OpenAI-compatible API, signed in with a portal key. No
19691
+ // Hermes needed (Erick, 2026-11-08).
19692
+ id: "nous",
19693
+ kind: "apiKey",
19694
+ label: "Nous Research",
19695
+ billing: "subscription",
19696
+ driver: "openai-compat",
19697
+ envVar: "NOUS_API_KEY",
19698
+ config: { url: "https://inference-api.nousresearch.com/v1", apiKeyEnv: "NOUS_API_KEY", model: "Hermes-4-405B", provider: "" },
19699
+ keyTest: { provider: "openaiCompat", url: "https://inference-api.nousresearch.com/v1" },
19700
+ keyUrl: "https://portal.nousresearch.com/",
19701
+ signupUrl: "https://portal.nousresearch.com/"
19702
+ },
19677
19703
  {
19678
19704
  // OpenCode Go is a flat monthly plan used through an OpenCode key.
19679
19705
  id: "opencodeGo",
@@ -56551,15 +56577,10 @@ var init_hermes = __esm({
56551
56577
  // from its log, by the core's stderr check).
56552
56578
  promptIdleMs: 3e5,
56553
56579
  loginNote: "Hermes CLI is not installed",
56554
- install: {
56555
- command: {
56556
- darwin: "curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash",
56557
- linux: "curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash",
56558
- win32: "iex (irm https://hermes-agent.nousresearch.com/install.ps1)"
56559
- },
56560
- docsUrl: "https://hermes-agent.nousresearch.com/docs/getting-started/quickstart",
56561
- signInCommand: "hermes setup"
56562
- },
56580
+ // No install command: setup never installs Hermes (Erick, 2026-11-08).
56581
+ // Nous Research signs in with a Nous Portal API key instead
56582
+ // (shared/provider-accounts.ts `nous`); Hermes runs only where the person
56583
+ // installed it themselves.
56563
56584
  spawnArgs: () => ["acp"],
56564
56585
  transformEnv: (env) => {
56565
56586
  for (const key of ["OPENAI_API_KEY", "OPENROUTER_API_KEY"]) delete env[key];
@@ -596,15 +596,10 @@ const support = {
596
596
  // from its log, by the core's stderr check).
597
597
  promptIdleMs: 300_000,
598
598
  loginNote: "Hermes CLI is not installed",
599
- install: {
600
- command: {
601
- darwin: "curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash",
602
- linux: "curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash",
603
- win32: "iex (irm https://hermes-agent.nousresearch.com/install.ps1)",
604
- },
605
- docsUrl: "https://hermes-agent.nousresearch.com/docs/getting-started/quickstart",
606
- signInCommand: "hermes setup",
607
- },
599
+ // No install command: setup never installs Hermes (Erick, 2026-11-08).
600
+ // Nous Research signs in with a Nous Portal API key instead
601
+ // (shared/provider-accounts.ts `nous`); Hermes runs only where the person
602
+ // installed it themselves.
608
603
  spawnArgs: () => ["acp"],
609
604
  transformEnv: (env) => {
610
605
  // A leftover OPENAI_API_KEY makes Hermes auto-resolve to OpenRouter and send
@@ -1,3 +1,4 @@
1
+ import "../electron/socket-qos.mjs";
1
2
  import { createMessageFileRoutes } from "./routes/message-file.js";
2
3
  import { SharedDeliverables, createSharedDeliverablesRoutes, sharedDeliverableAccess } from "./shared-deliverables.js";
3
4
  import { connectionCredentialServer } from "./connection-credential.js";
@@ -15137,9 +15138,9 @@ const workspaceBackupRoutes = createWorkspaceBackupRoutes({
15137
15138
  resume: () => { routines?.start(); primaryBot.start(); calendarCalls?.start(); watchdog.start(); },
15138
15139
  flush: async () => {
15139
15140
  await Promise.all([flushAllProfileHistory(), flushAllMemoryJournals(), flushUsageLedger(DATA_DIR), flushDecisionLog(DATA_DIR), flushAdminActivity(DATA_DIR)]);
15140
- // With writers gated and work idle, release our WAL connection for the
15141
- // consistent snapshot. Store reopens it lazily after maintenance.
15142
- closeMessageDb();
15141
+ // Export uses SQLite online backup while writers keep their connection.
15142
+ if (keepLocked)
15143
+ closeMessageDb();
15143
15144
  },
15144
15145
  }, keepLocked),
15145
15146
  });
@@ -0,0 +1,67 @@
1
+ import { createHash } from "node:crypto";
2
+ import { closeSync, constants, fstatSync, fsyncSync, lstatSync, openSync, readSync, writeSync } from "node:fs";
3
+ import { MAX_WORKSPACE_BACKUP_BYTES } from "./workspace-backup-archive.js";
4
+ /** Export captures live files; restore keeps the strict staged-file check.
5
+ * Reads stay on the opened descriptor, never a replacement symlink. Each live
6
+ * attempt stops at its initial size so a growing log cannot run forever. */
7
+ export function copyRegular(source, destination, onLiveChange) {
8
+ let captured;
9
+ for (let attempt = 0; attempt < 3; attempt++) {
10
+ let input;
11
+ try {
12
+ input = openSync(source, constants.O_RDONLY | constants.O_NOFOLLOW);
13
+ }
14
+ catch (error) {
15
+ if (!onLiveChange || error.code !== "ENOENT")
16
+ throw error;
17
+ onLiveChange(captured ? "changed" : "removed");
18
+ return captured ?? null;
19
+ }
20
+ let output;
21
+ try {
22
+ const before = fstatSync(input);
23
+ if (!before.isFile() || before.size > MAX_WORKSPACE_BACKUP_BYTES)
24
+ throw new Error("A workspace file is not regular or exceeds the 64 GB backup limit.");
25
+ const mode = before.mode & 0o100 ? 0o700 : 0o600;
26
+ output = openSync(destination, attempt === 0 ? "wx" : constants.O_WRONLY | constants.O_NOFOLLOW | constants.O_TRUNC, mode);
27
+ const chunk = Buffer.allocUnsafe(1024 * 1024);
28
+ const hash = createHash("sha256");
29
+ let size = 0;
30
+ while (!onLiveChange || size < before.size) {
31
+ const length = onLiveChange ? Math.min(chunk.length, before.size - size) : chunk.length;
32
+ const count = readSync(input, chunk, 0, length, null);
33
+ if (!count)
34
+ break;
35
+ size += count;
36
+ if (!onLiveChange && size > before.size)
37
+ throw new Error("A staged workspace file changed during restore.");
38
+ hash.update(chunk.subarray(0, count));
39
+ let offset = 0;
40
+ while (offset < count)
41
+ offset += writeSync(output, chunk, offset, count - offset);
42
+ }
43
+ const after = fstatSync(input);
44
+ const current = onLiveChange ? null : lstatSync(source);
45
+ const changed = size !== before.size || after.size !== before.size || after.mtimeMs !== before.mtimeMs || after.ctimeMs !== before.ctimeMs ||
46
+ (current !== null && (current.ino !== before.ino || current.dev !== before.dev || current.isSymbolicLink()));
47
+ if (changed && !onLiveChange)
48
+ throw new Error("A staged workspace file changed during restore.");
49
+ fsyncSync(output);
50
+ captured = { size, mode, sha256: hash.digest("hex") };
51
+ if (!changed)
52
+ return captured;
53
+ // ponytail: three bounded captures, then keep the bytes with a warning.
54
+ // A filesystem snapshot is needed for point-in-time external file consistency.
55
+ if (attempt === 2) {
56
+ onLiveChange?.("changed");
57
+ return captured;
58
+ }
59
+ }
60
+ finally {
61
+ closeSync(input);
62
+ if (output !== undefined)
63
+ closeSync(output);
64
+ }
65
+ }
66
+ return captured ?? null;
67
+ }
@@ -148,6 +148,7 @@ export function createWorkspaceBackupRoutes(options) {
148
148
  const restored = options.restored;
149
149
  json(res, 200, {
150
150
  ...options.status(),
151
+ busy: operating || options.status().busy,
151
152
  progress,
152
153
  lastRestoreId: restored.restored ? restored.id : null,
153
154
  safetyCopyPath: restored.safetyCopyPath ?? null,
@@ -1,4 +1,4 @@
1
- /** A backup owns one quiet workspace. Never interrupt a turn to obtain it. */
1
+ /** Export reads a live snapshot; only restore requires a quiet workspace. */
2
2
  export class WorkspaceBackupMaintenance {
3
3
  active = false;
4
4
  pendingRestore = false;
@@ -16,8 +16,18 @@ export class WorkspaceBackupMaintenance {
16
16
  }
17
17
  async run(work, hooks, keepLocked = false) {
18
18
  this.assertAvailable();
19
+ if (!keepLocked) {
20
+ const release = this.request();
21
+ try {
22
+ await hooks.flush();
23
+ return await work();
24
+ }
25
+ finally {
26
+ release();
27
+ }
28
+ }
19
29
  if (this.requests || !hooks.idle())
20
- throw Object.assign(new Error("Wait for bot turns, approvals, sign-ins, and computer actions to finish before backing up or restoring."), { status: 409 });
30
+ throw Object.assign(new Error("Wait for bot turns, approvals, sign-ins, and computer actions to finish before restoring."), { status: 409 });
21
31
  this.active = true;
22
32
  let committed = false;
23
33
  try {
@@ -1,13 +1,14 @@
1
1
  // A filesystem snapshot, not an additive import, encrypted unless the person
2
- // turns that off (workspace-backup-archive.ts). The caller must quiesce
3
- // writers before create/commit. Restore runs before config/store load.
2
+ // turns that off (workspace-backup-archive.ts). Restore must quiesce
3
+ // app-owned writers before commit. Restore runs before config/store load.
4
4
  import { createHash, randomBytes, randomUUID } from "node:crypto";
5
- import { chmodSync, closeSync, constants, copyFileSync, cpSync, existsSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, readSync, realpathSync, renameSync, rmSync, writeFileSync, writeSync, } from "node:fs";
5
+ import { chmodSync, closeSync, constants, copyFileSync, cpSync, existsSync, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, readSync, realpathSync, renameSync, rmSync, writeFileSync, } from "node:fs";
6
6
  import { isAbsolute, join, parse, posix, relative, resolve, win32 } from "node:path";
7
7
  import { homedir } from "node:os";
8
8
  import { backup, DatabaseSync } from "node:sqlite";
9
9
  import * as tar from "tar";
10
10
  import { fromMarkdown } from "mdast-util-from-markdown";
11
+ import { copyRegular } from "./workspace-backup-copy.js";
11
12
  import { writeFileAtomic } from "./atomic.js";
12
13
  import { escapeAttribute, splitTranscriptAttachments } from "../src/lib/composer-attachments.js";
13
14
  import { WORKSPACE_BACKUP_CLIENT_KEYS } from "../shared/workspace-backup-client.js";
@@ -40,7 +41,7 @@ const EXCLUSION_NOTES = [
40
41
  "Device pairing, server identity, live leases and runtime files (existing destination identities are preserved).",
41
42
  SECRETS_NOTE,
42
43
  "Downloaded tools and caches; these can be installed again.",
43
- "Project dependency and build folders (node_modules, .venv, __pycache__, .next, .turbo, .build, DerivedData); reinstall them in each project after restoring.",
44
+ "Project dependency and build folders (node_modules, .venv, __pycache__, .next, .turbo, .build, DerivedData, and in task workspaces .git, *-derived, *.xcarchive, dist and release); reinstall or rebuild them after restoring.",
44
45
  "External project folders, CLI login homes, browser session homes, OS keychains, companion devices and other servers.",
45
46
  "VM/container disk layers and remote cloud data; durable files inside this workspace are included.",
46
47
  ];
@@ -173,47 +174,6 @@ function assertLocalAuthOutsideSnapshot(dataDir) {
173
174
  check(instance.config.configDir, "config.configDir", String(environment.HOME || environment.USERPROFILE || homedir()));
174
175
  }
175
176
  }
176
- // Open without following links and copy synchronously so this server cannot
177
- // interleave a mutation. External writers are detected where stat permits.
178
- function copyRegular(source, destination) {
179
- const input = openSync(source, constants.O_RDONLY | constants.O_NOFOLLOW);
180
- let output;
181
- try {
182
- const before = fstatSync(input);
183
- if (!before.isFile() || before.size > MAX_WORKSPACE_BACKUP_BYTES)
184
- throw new Error("A workspace file is not regular or exceeds the 64 GB backup limit.");
185
- const mode = before.mode & 0o100 ? 0o700 : 0o600;
186
- output = openSync(destination, "wx", mode);
187
- const chunk = Buffer.allocUnsafe(1024 * 1024);
188
- const hash = createHash("sha256");
189
- let size = 0;
190
- for (;;) {
191
- const count = readSync(input, chunk, 0, chunk.length, null);
192
- if (!count)
193
- break;
194
- size += count;
195
- if (size > before.size)
196
- throw new Error("A workspace file changed during backup. Stop its writer and retry.");
197
- hash.update(chunk.subarray(0, count));
198
- let offset = 0;
199
- while (offset < count)
200
- offset += writeSync(output, chunk, offset, count - offset);
201
- }
202
- const after = fstatSync(input);
203
- const current = lstatSync(source);
204
- if (size !== before.size || after.mtimeMs !== before.mtimeMs || after.ctimeMs !== before.ctimeMs ||
205
- current.ino !== before.ino || current.dev !== before.dev || current.isSymbolicLink()) {
206
- throw new Error("A workspace file changed during backup. Stop its writer and retry.");
207
- }
208
- fsyncSync(output);
209
- return { size, mode, sha256: hash.digest("hex") };
210
- }
211
- finally {
212
- closeSync(input);
213
- if (output !== undefined)
214
- closeSync(output);
215
- }
216
- }
217
177
  function hashFile(path) {
218
178
  const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW);
219
179
  try {
@@ -286,17 +246,19 @@ export async function createWorkspaceBackup(dataDir, options) {
286
246
  const entries = [];
287
247
  const links = [];
288
248
  const checkouts = [];
289
- const warnings = ["Stop external editors and managed desktops before exporting; files written outside this server cannot be frozen by the backup gate.",
249
+ const warnings = ["Files are captured as the backup runs. External changes made after a file is captured belong to the next backup.",
290
250
  encrypted ? "Conversation text and user files are not redacted and may contain secrets you pasted. Keep the encrypted backup private." : "This backup is not encrypted. Anyone with the file can read your conversations and files; keep it private.",
291
251
  ...(secrets ? ["This backup holds your keys, passwords and tokens. Anyone with the file and its password can use them."] : []), RESTORE_WARNING];
292
252
  let bytes = 0;
293
253
  let skippedLinks = 0;
254
+ let changedFiles = 0;
255
+ let removedFiles = 0;
294
256
  const progress = () => options.onProgress?.({ phase: "copying", files: entries.length, bytes });
295
257
  try {
296
258
  const root = realpathSync(dataDir);
297
259
  const sourceDb = join(root, "messages.db");
298
- // The caller closes its message handle after flushing, while maintenance
299
- // remains held. The native snapshot includes any committed WAL records.
260
+ // SQLite online backup captures committed WAL records while the live
261
+ // message connection remains open and turns continue writing.
300
262
  if (existsSync(sourceDb)) {
301
263
  if (lstatSync(sourceDb).isSymbolicLink())
302
264
  throw new Error("The message database must not be a symbolic link.");
@@ -352,8 +314,17 @@ export async function createWorkspaceBackup(dataDir, options) {
352
314
  if (!validRelative(path))
353
315
  throw new Error("A workspace filename cannot be safely restored on supported platforms.");
354
316
  const source = join(directory, name);
355
- const stat = lstatSync(source);
356
- if (prefix && REINSTALLABLE_DIRS.has(name) && (stat.isDirectory() || stat.isSymbolicLink()))
317
+ let stat;
318
+ try {
319
+ stat = lstatSync(source);
320
+ }
321
+ catch (error) {
322
+ if (error.code !== "ENOENT")
323
+ throw error;
324
+ removedFiles++;
325
+ continue;
326
+ }
327
+ if ((prefix && REINSTALLABLE_DIRS.has(name) && (stat.isDirectory() || stat.isSymbolicLink())) || (path.startsWith("task-workspaces/") && (name === ".git" || (stat.isDirectory() && /^(?:.+-derived|.+\.xcarchive|dist.*|release)$/.test(name)))))
357
328
  continue;
358
329
  if (stat.isSymbolicLink() && BROWSER_LOCK_LINKS.has(name))
359
330
  continue;
@@ -410,8 +381,15 @@ export async function createWorkspaceBackup(dataDir, options) {
410
381
  }
411
382
  copied = { size: lstatSync(destination).size, mode: 0o600, sha256: hashFile(destination) };
412
383
  }
413
- else
414
- copied = copyRegular(path === "messages.db" ? join(snapshot, "messages-snapshot.db") : source, destination);
384
+ else {
385
+ const captured = copyRegular(path === "messages.db" ? join(snapshot, "messages-snapshot.db") : source, destination, path === "messages.db" ? undefined : (kind) => { if (kind === "changed")
386
+ changedFiles++;
387
+ else
388
+ removedFiles++; });
389
+ if (!captured)
390
+ continue;
391
+ copied = captured;
392
+ }
415
393
  bytes += copied.size;
416
394
  if (bytes > MAX_WORKSPACE_BACKUP_BYTES)
417
395
  throw new Error("The workspace exceeds the 64 GB backup limit.");
@@ -424,6 +402,10 @@ export async function createWorkspaceBackup(dataDir, options) {
424
402
  }
425
403
  };
426
404
  walk(root);
405
+ if (changedFiles)
406
+ warnings.push(`${changedFiles} file(s) kept changing during backup. Their captured bytes are included, but may contain an in-progress write.`);
407
+ if (removedFiles)
408
+ warnings.push(`${removedFiles} file(s) disappeared before they could be captured and are not included.`);
427
409
  if (skippedLinks)
428
410
  warnings.push(`${skippedLinks} managed skill discovery link(s) were omitted and are recreated by the app.`);
429
411
  if (checkouts.length)
@@ -45,6 +45,12 @@ export const ACCOUNT_PROVIDERS = [
45
45
  config: {}, keyTest: { provider: "openaiCompat", url: "https://api.minimax.io/v1" },
46
46
  keyUrl: "https://platform.minimax.io/console/plan", signupUrl: "https://www.minimax.io/m-plan",
47
47
  },
48
+ {
49
+ // Coding Plan quota uses its own endpoint, separate from the general Z.ai API.
50
+ id: "zai", kind: "apiKey", label: "Z.ai GLM Coding Plan", billing: "subscription", driver: "openai-compat", envVar: "ZAI_API_KEY",
51
+ config: { url: "https://api.z.ai/api/coding/paas/v4", apiKeyEnv: "ZAI_API_KEY", model: "glm-5.3", provider: "" },
52
+ keyUrl: "https://z.ai/manage-apikey/apikey-list", signupUrl: "https://z.ai/subscribe",
53
+ },
48
54
  {
49
55
  id: "xai", kind: "apiKey", label: "xAI API", billing: "payPerUse", driver: "grok", envVar: "XAI_API_KEY", icon: "xai",
50
56
  config: {}, keyTest: { provider: "xai" }, keyUrl: "https://console.x.ai",
@@ -58,6 +64,13 @@ export const ACCOUNT_PROVIDERS = [
58
64
  id: "ollamaCloud", kind: "apiKey", label: "Ollama Cloud", billing: "subscription", driver: "ollamaCloud", envVar: "OLLAMA_API_KEY", icon: "ollama",
59
65
  config: {}, keyTest: { provider: "ollamaCloud" }, keyUrl: "https://ollama.com/settings/keys", signupUrl: "https://ollama.com/pricing",
60
66
  },
67
+ {
68
+ // Nous Portal's OpenAI-compatible API, signed in with a portal key. No
69
+ // Hermes needed (Erick, 2026-11-08).
70
+ id: "nous", kind: "apiKey", label: "Nous Research", billing: "subscription", driver: "openai-compat", envVar: "NOUS_API_KEY",
71
+ config: { url: "https://inference-api.nousresearch.com/v1", apiKeyEnv: "NOUS_API_KEY", model: "Hermes-4-405B", provider: "" },
72
+ keyTest: { provider: "openaiCompat", url: "https://inference-api.nousresearch.com/v1" }, keyUrl: "https://portal.nousresearch.com/", signupUrl: "https://portal.nousresearch.com/",
73
+ },
61
74
  {
62
75
  // OpenCode Go is a flat monthly plan used through an OpenCode key.
63
76
  id: "opencodeGo", kind: "apiKey", label: "OpenCode Go", billing: "subscription", driver: "opencodeGo", envVar: "OPENCODE_API_KEY",
@@ -55,10 +55,10 @@ export const SUBSCRIPTION_PROVIDERS = Object.freeze([
55
55
  id: "minimax", name: "MiniMax", drivers: ["minimax"], generic: ["minimax", "minimax (api)", "minimax m plan", "m plan", "minimax coding plan"],
56
56
  planOnly: true, signInUrl: "https://platform.minimax.io/console/plan",
57
57
  },
58
- // Z.ai allows the GLM Coding Plan only in the tools it lists; Hermes Agent
59
- // is one, so the plan runs on a Hermes whose Z.ai key is on the plan's
60
- // endpoint (server/drivers/acp/hermes.ts hermesZaiCodingPlan). A Hermes on
61
- // Nous Portal and the plan together makes the Nous Research bot only.
58
+ // A Hermes the person set up themselves with a Z.ai key on the GLM Coding
59
+ // Plan endpoint (server/drivers/acp/hermes.ts hermesZaiCodingPlan). Atomic
60
+ // setup never installs Hermes: the Z.ai card takes the plan key directly.
61
+ // A Hermes on Nous Portal and the plan together makes the Nous Research bot only.
62
62
  {
63
63
  id: "zai", name: "Z.ai GLM", drivers: ["hermesAgent"], generic: ["z.ai", "zai", "z.ai glm", "glm", "glm coding plan", "hermes", "hermes agent"],
64
64
  host: "zai-coding-plan", ownModels: /^zai:./i, signInUrl: "https://z.ai/manage-apikey/apikey-list",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chibitek/chibi",
3
- "version": "0.1.180",
3
+ "version": "0.1.183",
4
4
  "description": "Atomic by Chibitek: run your AI team's server anywhere and pair your devices to it",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{U as a,C as n}from"./mermaid.core-B_hsjjFv.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1,8 +0,0 @@
1
- import{c as r,s as e}from"./flowDiagram-KWPJA3E3-C6y9L478.js";import{_ as a}from"./mermaid.core-B_hsjjFv.js";import"./chunk-5VM5RSS4-kVNi7GcP.js";import"./chunk-XXDRQBXY-8cVOBFNO.js";import"./chunk-WEXAMYUT-CPIykbsI.js";import"./chunk-GWA4HPMP-DiMuTVC6.js";import"./channel-Ck_atLKb.js";import"./index-CPnrJ6T1.js";var o=a(t=>`${e(t)}
2
- .swimlane.cluster:not([data-color-id]) rect {
3
- stroke: ${t.clusterBorder} !important;
4
- }
5
- [data-look="neo"].cluster rect {
6
- filter: none;
7
- }
8
- `,"getStyles"),s=o,u=r({styles:s});export{u as diagram};