@chibitek/chibi 0.1.176 → 0.1.178

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 (93) hide show
  1. package/dist/assets/{abnfDiagram-O67JEVCF-sRKEv3Mr.js → abnfDiagram-O67JEVCF-dWHl3jkm.js} +1 -1
  2. package/dist/assets/{arc-BmpSdaQx.js → arc-CZzCs6es.js} +1 -1
  3. package/dist/assets/{architectureDiagram-NJMV4G6O-D7wISetH.js → architectureDiagram-NJMV4G6O-YwZAu6Y7.js} +1 -1
  4. package/dist/assets/{blockDiagram-BEXU5L5S-DNgLsg2M.js → blockDiagram-BEXU5L5S-WmC_extb.js} +1 -1
  5. package/dist/assets/{c4Diagram-YGBWAQC7-Bx9bZh8W.js → c4Diagram-YGBWAQC7-B65Jnm1V.js} +1 -1
  6. package/dist/assets/channel-ClZ5TVsZ.js +1 -0
  7. package/dist/assets/{chunk-2Q5K7J3B-D3fVaZ4m.js → chunk-2Q5K7J3B-CKo9M6W3.js} +1 -1
  8. package/dist/assets/{chunk-3FUC2YCW-CwGz6Ha8.js → chunk-3FUC2YCW-7yQVJbNw.js} +2 -2
  9. package/dist/assets/{chunk-5VM5RSS4-B6OEecjg.js → chunk-5VM5RSS4-De0KYP62.js} +1 -1
  10. package/dist/assets/{chunk-GTNCS2PH-BQcidIif.js → chunk-GTNCS2PH-CLr-nzve.js} +1 -1
  11. package/dist/assets/{chunk-GWA4HPMP-k9aUZSoo.js → chunk-GWA4HPMP-CtuDeI-a.js} +1 -1
  12. package/dist/assets/{chunk-JWPE2WC7-h3JmRvjC.js → chunk-JWPE2WC7-y52neVCm.js} +1 -1
  13. package/dist/assets/{chunk-NETBCI7D-neWbjUzw.js → chunk-NETBCI7D-CTQRNeEv.js} +1 -1
  14. package/dist/assets/{chunk-WEXAMYUT-5CvO78xu.js → chunk-WEXAMYUT-7zNFA7Tc.js} +1 -1
  15. package/dist/assets/{chunk-XXDRQBXY-WB5mOypF.js → chunk-XXDRQBXY-CF0jLMvs.js} +1 -1
  16. package/dist/assets/{classDiagram-v2-NBCMYWYE-BTPH5g_T.js → classDiagram-v2-NBCMYWYE-WBfBG6F9.js} +1 -1
  17. package/dist/assets/{cose-bilkent-JH36ORCC-D3vHHTSV.js → cose-bilkent-JH36ORCC-BN-OWUOQ.js} +1 -1
  18. package/dist/assets/{cynefin-OW5HDTMX-DgqNPGWZ.js → cynefin-OW5HDTMX-icxZUnEx.js} +1 -1
  19. package/dist/assets/{cynefinDiagram-VND7K2PF-R5Tq_pW2.js → cynefinDiagram-VND7K2PF-Clgujiet.js} +1 -1
  20. package/dist/assets/{dagre-6A5THRUB-CxOlFmnC.js → dagre-6A5THRUB-B-mr-ojn.js} +1 -1
  21. package/dist/assets/{diagram-22UHCM2B-CR0cl7m3.js → diagram-22UHCM2B-0VKN1h9d.js} +1 -1
  22. package/dist/assets/{diagram-3UASUU5V-CbKL4FKO.js → diagram-3UASUU5V-9Nvuaj11.js} +1 -1
  23. package/dist/assets/{diagram-ATOU4E4O-CrJLqyZe.js → diagram-ATOU4E4O-B-uzDb8p.js} +1 -1
  24. package/dist/assets/{diagram-CDSNMT55-B9Yv89qV.js → diagram-CDSNMT55-CTvDjLvE.js} +1 -1
  25. package/dist/assets/{diagram-MLGK6HIB-DmiwzM_2.js → diagram-MLGK6HIB-DxDrNPv6.js} +1 -1
  26. package/dist/assets/{diagram-MPIPVDR6-CcOb0oW2.js → diagram-MPIPVDR6-CGHXB_-s.js} +1 -1
  27. package/dist/assets/{ebnfDiagram-ZINNZB2B-CBPLHI7_.js → ebnfDiagram-ZINNZB2B-DNkShTCq.js} +1 -1
  28. package/dist/assets/{elk-276RUBZZ-6FqNvi_J.js → elk-276RUBZZ-CNZgZP06.js} +1 -1
  29. package/dist/assets/{erDiagram-OPXOYQCR-DMzFBP5h.js → erDiagram-OPXOYQCR-CVlJu0RH.js} +1 -1
  30. package/dist/assets/{flowDiagram-KWPJA3E3-DPy8GVYu.js → flowDiagram-KWPJA3E3-ZWXAAVoE.js} +1 -1
  31. package/dist/assets/{ganttDiagram-FUAMR5RP-BQd_gAGi.js → ganttDiagram-FUAMR5RP-BaPFE0m8.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-X574FWY7-DJfl14ff.js → gitGraphDiagram-X574FWY7-B__eRHIL.js} +1 -1
  33. package/dist/assets/index-CI0vGAif.css +1 -0
  34. package/dist/assets/{index-BgeuRd0K.js → index-CluLWh67.js} +1 -1
  35. package/dist/assets/{index-CiUkZ0_j.js → index-DxRLJ091.js} +197 -195
  36. package/dist/assets/{infoDiagram-VRGFBTTK-BV8yVtja.js → infoDiagram-VRGFBTTK-DQkxDIsw.js} +1 -1
  37. package/dist/assets/{ishikawaDiagram-OU5B5YK6-DyDmA3-6.js → ishikawaDiagram-OU5B5YK6-dc12aZx1.js} +1 -1
  38. package/dist/assets/{journeyDiagram-ZHPQQLJL-Bm31t8C8.js → journeyDiagram-ZHPQQLJL-BUQgOHxW.js} +1 -1
  39. package/dist/assets/{kanban-definition-PNTS6WVX-DJHtOiRR.js → kanban-definition-PNTS6WVX-0G8FTiwC.js} +1 -1
  40. package/dist/assets/{linear-CfkoYheD.js → linear-BsZ0eCh6.js} +1 -1
  41. package/dist/assets/{mermaid.core-BjvwttN3.js → mermaid.core-CBJIrEjV.js} +5 -5
  42. package/dist/assets/{mindmap-definition-NLK3R4M7-9Qb6NZdz.js → mindmap-definition-NLK3R4M7-oSFMOeAf.js} +1 -1
  43. package/dist/assets/{pegDiagram-GJSIUBJH-CkmUVrtf.js → pegDiagram-GJSIUBJH-DfF1Bylk.js} +1 -1
  44. package/dist/assets/{pieDiagram-5QR66LMP-DslnXTwg.js → pieDiagram-5QR66LMP-B75tQFJV.js} +1 -1
  45. package/dist/assets/{quadrantDiagram-O4NWA36T-ezbFZDsw.js → quadrantDiagram-O4NWA36T-Bzost4vl.js} +1 -1
  46. package/dist/assets/{railroadDiagram-XR7U4H2S-D4BEU9x6.js → railroadDiagram-XR7U4H2S-Kj-_EJse.js} +1 -1
  47. package/dist/assets/{requirementDiagram-PLB6GJNP-BbzX7pvK.js → requirementDiagram-PLB6GJNP-DgGyLbhO.js} +1 -1
  48. package/dist/assets/{sankeyDiagram-IPEJSGJF-3CkqEiXd.js → sankeyDiagram-IPEJSGJF-Ds7nNV4g.js} +1 -1
  49. package/dist/assets/{sequenceDiagram-PO4LG4MO-CgCGVT2m.js → sequenceDiagram-PO4LG4MO-BherGJTE.js} +1 -1
  50. package/dist/assets/{sizeCapture-INFHLROL-3WvzT1S8.js → sizeCapture-INFHLROL-his3_ohk.js} +1 -1
  51. package/dist/assets/{stateDiagram-v2-GCMORJYK-DJLDdpcK.js → stateDiagram-v2-GCMORJYK-Dm1QWOxb.js} +1 -1
  52. package/dist/assets/{swimlanes-2SLR337P-D91mFQnO.js → swimlanes-2SLR337P-CCDiiGy4.js} +1 -1
  53. package/dist/assets/swimlanesDiagram-TC7HE7FX-7bU41JJL.js +8 -0
  54. package/dist/assets/{timeline-definition-EJHVYXUP-BjIDeT1V.js → timeline-definition-EJHVYXUP-CTgG6kVO.js} +1 -1
  55. package/dist/assets/{usecaseDiagram-POWQR4AR-B0Ai3gPB.js → usecaseDiagram-POWQR4AR-B9FjIil8.js} +1 -1
  56. package/dist/assets/{vennDiagram-UO4OBE2U-CwfOPn1H.js → vennDiagram-UO4OBE2U-D_WKiutd.js} +1 -1
  57. package/dist/assets/{wardleyDiagram-VNRHLVJA-Dpw6_U0p.js → wardleyDiagram-VNRHLVJA-DqAabdPt.js} +1 -1
  58. package/dist/assets/{xychartDiagram-PMCCYNJV-DqXC0ReF.js → xychartDiagram-PMCCYNJV-CYpL8DXw.js} +1 -1
  59. package/dist/index.html +2 -2
  60. package/dist-server/drivers/agents-proxy.js +3 -2
  61. package/dist-server/index.js +1851 -1632
  62. package/dist-server/openmausbot.js +649 -490
  63. package/dist-server/pair-cli.js +649 -490
  64. package/dist-server/server/attachment-mimes.js +31 -7
  65. package/dist-server/server/attachments.js +16 -20
  66. package/dist-server/server/drivers/acp/core.js +10 -37
  67. package/dist-server/server/drivers/acp/droid.js +1 -0
  68. package/dist-server/server/drivers/acp/gemini.js +10 -0
  69. package/dist-server/server/drivers/acp/kimi.js +1 -0
  70. package/dist-server/server/drivers/acp/mode-readback.js +72 -0
  71. package/dist-server/server/drivers/acp/qwen.js +12 -0
  72. package/dist-server/server/drivers/acp/tool-log.js +40 -0
  73. package/dist-server/server/drivers/acp/vibe.js +14 -1
  74. package/dist-server/server/drivers/agents-catalog.js +2 -2
  75. package/dist-server/server/drivers/chat-mcp-tools.js +21 -1
  76. package/dist-server/server/drivers/openai-chat.js +1 -1
  77. package/dist-server/server/engine-tiers.js +1 -1
  78. package/dist-server/server/free-turn-guard.js +32 -0
  79. package/dist-server/server/harness-import/history.js +1 -1
  80. package/dist-server/server/incidents.js +9 -2
  81. package/dist-server/server/index.js +40 -21
  82. package/dist-server/server/mcp-secrets.js +33 -5
  83. package/dist-server/server/routes/engine-tiers.js +3 -1
  84. package/dist-server/server/vault/routes.js +1 -1
  85. package/dist-server/server/vault/store.js +1 -1
  86. package/dist-server/shared/approval-readback.js +52 -0
  87. package/dist-server/shared/provider-accounts.js +4 -4
  88. package/dist-server/shared/vault-csv.js +32 -10
  89. package/dist-server/src/lib/composer-attachments.js +5 -6
  90. package/package.json +1 -1
  91. package/dist/assets/channel-hUu8lOok.js +0 -1
  92. package/dist/assets/index-D17LLrYN.css +0 -1
  93. package/dist/assets/swimlanesDiagram-TC7HE7FX--A9LvTBi.js +0 -8
@@ -115,7 +115,7 @@ import { exchangeChannel, mirrorActivity, mirrorExchange, mirrorReply } from "./
115
115
  import { findMessageInThreads, readMessageText, recallMessages, recentMessages, searchMessages, closeMessageDb, chatFollowups, cancelledChatFollowup, settleChatFollowups, threadsReferencing, readCommandReceipt, withCommandReceipt } from "./message-db.js";
116
116
  import { briefCrossingLabel, claimRecallCrossings, recallCrossingLabel } from "./recall-disclosure.js";
117
117
  import { parseSince, parseUntil, recentWork, recentWorkPrompt, turnOutcomeLine } from "./recent-work.js";
118
- import { chiefForBot, INCIDENTS_THREAD_TITLE, IncidentLedger, incidentChip, incidentText } from "./incidents.js";
118
+ import { chiefForBot, INCIDENTS_THREAD_TITLE, IncidentLedger, incidentChip, incidentText, runWentOn } from "./incidents.js";
119
119
  /** A session_read answer competes with the transcript for the context
120
120
  * window; a computer-use turn's output can run to hundreds of KB. */
121
121
  const SESSION_READ_MAX_CHARS = 8_000;
@@ -131,6 +131,7 @@ import { computerKindForResource, ManagedDesktopPolicy } from "./managed-policy.
131
131
  import { hostedModelPolicy, HOSTED_MODEL_POLICY_HEADER, HOSTED_PROVIDER_SETTINGS_ERROR } from "./hosted-models.js";
132
132
  import { newEventId } from "./contracts.js";
133
133
  import { canTitle, routedThreadTitle } from "./thread-title.js";
134
+ import { freeTurnNexusRefusal, guardFreeTurn } from "./free-turn-guard.js";
134
135
  import { createSummaryScheduler } from "./bot-summary.js";
135
136
  import { BOT_SUMMARY_MAX, sanitizeBotSummary } from "../shared/bot-summary.js";
136
137
  import { selectDefaultModelSelection, withNewBotEffort } from "./default-model-selection.js";
@@ -288,7 +289,7 @@ import { cleanMarketplaceQuery, marketplaceCard, marketplaceCardText, marketplac
288
289
  import { createModelLevels } from "./model-levels/index.js";
289
290
  import { compareWithinClass } from "./model-levels/classes.js";
290
291
  import { HISTORY_RECEIPT_KIND, historyAttachmentStore } from "./harness-import/history.js";
291
- import { chooseEngine, engineIntent, harnessForName, localModel, newBotSelection, paidCandidate, perTokenModel } from "./harness-import/engine-policy.js";
292
+ import { chooseEngine, engineIntent, freeCandidate, harnessForName, localModel, newBotSelection, paidCandidate, perTokenModel } from "./harness-import/engine-policy.js";
292
293
  import { createEngineTierRoutes } from "./routes/engine-tiers.js";
293
294
  import { createPrimaryBotRoutes } from "./routes/primary-bot.js";
294
295
  import { EngineSnapshotCache, botTier, canDriveComputer, classLadder, engineAccount, engineHealth, engineLabel, engineTierClasses, engineTierLadders, engineTiersIncludeFree, generateLadders, handlesClientData, ladderForClass, keyBased, needsDelegation, resolveFailover, resolveLadder } from "./engine-tiers.js";
@@ -3729,10 +3730,11 @@ function engineFailover(turn, completion) {
3729
3730
  });
3730
3731
  }
3731
3732
  retireFailedAttempt(turn.botId, turn.threadId, turn.generation, failedOwner, completion);
3732
- if (failure.kind === "auth_failed")
3733
+ const signIn = failure.kind === "auth_failed" ? `${engineLabel(candidates, moved)} needs signing in again in Settings > Engines` : undefined;
3734
+ if (!reportFreeFallback(profile, turn.threadId, choice.selection, signIn ?? `${engineLabel(candidates, moved)} failed (${failure.kind})`) && signIn)
3733
3735
  reportIncident({
3734
3736
  kind: "engine-fallback", bot: profile, threadId: turn.threadId, notifyChief: true,
3735
- detail: `${engineLabel(candidates, moved)} needs signing in again in Settings > Engines; the turn continued on ${engineLabel(candidates, choice.selection)}`,
3737
+ detail: `${signIn}; the turn continued on ${engineLabel(candidates, choice.selection)}`,
3736
3738
  });
3737
3739
  console.error(`[omb-failover] thread=${turn.threadId} ${failure.kind}: ${moved.instanceId} -> ${choice.selection.instanceId} (attempt ${attempt})`);
3738
3740
  // No turnId: the failed provider turn is retired, and its id would hide
@@ -3804,7 +3806,7 @@ function roomEngineFailover(turn, completion, room, profile, candidates, failedC
3804
3806
  const failedLabel = engineLabel(candidates, room.selection);
3805
3807
  const replacementLabel = engineLabel(candidates, choice.selection);
3806
3808
  console.error(`[omb-failover] room thread=${turn.threadId} ${failure.kind}: ${room.selection.instanceId} -> ${choice.selection.instanceId} (attempt ${attempt})`);
3807
- if (!failure.permanent) {
3809
+ if (!reportFreeFallback(profile, turn.threadId, choice.selection, `${failedLabel} failed (${failure.kind})`) && !failure.permanent) {
3808
3810
  reportIncident({
3809
3811
  kind: "engine-fallback", bot: profile, threadId: turn.threadId,
3810
3812
  detail: `${failedLabel} failed (${failure.kind}); the room turn continued on ${replacementLabel}`,
@@ -8592,13 +8594,23 @@ function incidentContext(threadId) {
8592
8594
  lastReply: messages.find((message) => message.role === "bot" && message.kind === "text" && message.text)?.text ?? null,
8593
8595
  };
8594
8596
  }
8597
+ /** A turn on a free-tier engine is a Team incident (docs/specs/free-models-in-auto); true when filed. */
8598
+ function reportFreeFallback(bot, threadId, selection, why) {
8599
+ const candidates = engineSnapshots.current() ?? [];
8600
+ const candidate = candidates.find((entry) => entry.instanceId === selection.instanceId);
8601
+ if (!candidate || !freeCandidate(candidate))
8602
+ return false;
8603
+ reportIncident({ kind: "free-fallback", bot, threadId, notifyChief: true,
8604
+ detail: `${why ? `${why}; ` : ""}the turn ran on ${engineLabel(candidates, selection)}` });
8605
+ return true;
8606
+ }
8595
8607
  function reportIncident(input) {
8596
8608
  const { bot, threadId } = input;
8597
8609
  // A fallback, or a turn that ran on without a broken tool server, is a run that went on, not a broken one.
8598
- const quiet = input.kind === "model-fallback" || input.kind === "engine-fallback" || input.kind === "mcp-unavailable";
8610
+ const quiet = runWentOn(input.kind);
8599
8611
  // The Primary Bot's pre-check reads broken runs from here (a failed
8600
8612
  // routine has its own run record, so it is not noted twice).
8601
- if (input.kind !== "routine-failed" && input.kind !== "model-fallback" && input.kind !== "engine-fallback" && input.kind !== "mcp-unavailable") {
8613
+ if (input.kind !== "routine-failed" && !runWentOn(input.kind)) {
8602
8614
  primaryBotStore.noteFailure({ botId: bot.id, threadId, kind: input.kind, detail: redactSecretsInText(input.detail).slice(0, 300), at: Date.now() });
8603
8615
  }
8604
8616
  const task = store.taskByThread(bot.id, threadId);
@@ -9817,6 +9829,9 @@ async function startTurn(botId, text, opts) {
9817
9829
  // thread, so this is the one moment the ledger's "who asked" may change.
9818
9830
  if (opts?.trigger)
9819
9831
  turnTriggers.set(threadId, opts.trigger);
9832
+ // A failover files its own report (engineFailover); a hand-picked engine is no fallback.
9833
+ if (engineChoice && !failover && !opts?.engine)
9834
+ reportFreeFallback(bot, threadId, engineChoice.selection);
9820
9835
  const expectedModel = modelExpectation(threadId);
9821
9836
  // The engine the ladder chose becomes the thread's model, as a person's
9822
9837
  // switch would; the thread stays tier-managed for its next turn.
@@ -10724,15 +10739,16 @@ async function startTurn(botId, text, opts) {
10724
10739
  }
10725
10740
  }
10726
10741
  const addons = turnAddons(liveBot ?? bot, instance.driverKind, { local: opts?.runOn !== "cloud", fileTools: worksInWorkspace });
10742
+ const blockedPaths = guardFreeTurn(threadId, providerConfigs()[instance.instanceId]?.account, integrations, [paw.root, resolveIcmPath(cfg)]);
10727
10743
  // What Nexus already knows for this person: read once per session and
10728
10744
  // cached, bounded in size and time, never holding the turn up. A Team
10729
10745
  // Room turn reads it only when its owner shares memories in that room.
10730
- const nexusContext = nexusOwnerThread(threadId) && (!roomTurn || roomTurn.share.memories)
10746
+ const nexusContext = !blockedPaths && nexusOwnerThread(threadId) && (!roomTurn || roomTurn.share.memories)
10731
10747
  ? await nexusMemory.readBack({ bot: liveBot ?? bot, threadId, query: providerText })
10732
10748
  : "";
10733
10749
  const prompt = buildSystemPrompt(persona, liveBot?.soul ?? bot.soul ?? "", roomPromptSections(roomTurn, [
10734
10750
  { id: "personal-goal", label: "Active goal", text: personalGoals.goals.get(threadId)?.status === "working" ? personalGoalInstructions(personalGoals.goals.get(threadId)) : "" },
10735
- { id: "user-profile", label: "About the user", text: userProfileSystemPrompt(cfg.profile) },
10751
+ { id: "user-profile", label: "About the user", text: blockedPaths ? "" : userProfileSystemPrompt(cfg.profile) },
10736
10752
  // the ICM folder is on this machine; a cloud run cannot reach it
10737
10753
  // first after the soul: the block names agent tools, so it only goes
10738
10754
  // to a turn whose engine actually mounted them (setupMode is already
@@ -10740,8 +10756,8 @@ async function startTurn(botId, text, opts) {
10740
10756
  { id: "setup", label: "Setup", text: setupSystemPrompt(setupMode, { skills: skillAuthoring, cwd: liveBot?.cwd ?? bot.cwd }) },
10741
10757
  // after setup (which must follow the soul): PAW (Personal AI Workspace)
10742
10758
  // first, then a legacy ICM folder; a cloud run cannot reach either
10743
- { id: "paw", label: "Shared context (PAW)", text: pawPrompt(liveBot ?? bot, text, opts?.runOn) },
10744
- { id: "icm", label: "Shared context (ICM)", text: opts?.runOn !== "cloud" ? icmSystemPrompt(cfg) : "" },
10759
+ { id: "paw", label: "Shared context (PAW)", text: blockedPaths ? "" : pawPrompt(liveBot ?? bot, text, opts?.runOn) },
10760
+ { id: "icm", label: "Shared context (ICM)", text: !blockedPaths && opts?.runOn !== "cloud" ? icmSystemPrompt(cfg) : "" },
10745
10761
  { id: "private-bot", label: "Private Bot", text: isPersonalBot(liveBot ?? bot) ? privateBotPrompt(privateChibiLinkActive()) : chibiLinkPromptFor(liveBot ?? bot, threadId) },
10746
10762
  { id: "files", label: "File locations", text: worksInWorkspace && opts?.runOn !== "cloud" ? workspaceLocationsPrompt(bot.id, cwd, liveBot?.cwd ?? bot.cwd) : "" },
10747
10763
  { id: "repos", label: "Linked repos", text: repoPlan ? repoPromptSection(repoPlan, repoPlace(opts?.runOn, computerKind), cwd) : "" },
@@ -10816,7 +10832,7 @@ async function startTurn(botId, text, opts) {
10816
10832
  systemStable: prompt.stable,
10817
10833
  systemVolatile: prompt.volatile,
10818
10834
  systemVolatileSections: prompt.volatileSections,
10819
- integrations,
10835
+ integrations, blockedPaths,
10820
10836
  ...userMcpForTurn(liveBot ?? bot, instance),
10821
10837
  ...(addons.pluginDirs.length ? { pluginDirs: addons.pluginDirs } : {}),
10822
10838
  ...(addons.rtk ? { rtk: addons.rtk } : {}),
@@ -12117,6 +12133,8 @@ failover) {
12117
12133
  onDispatchError?.(message);
12118
12134
  return true;
12119
12135
  }
12136
+ if (roomEngine && !failover)
12137
+ reportFreeFallback(bot, threadId, roomEngine.selection);
12120
12138
  const internalGeneration = beginInternalCapabilityGeneration(threadId);
12121
12139
  const resourceOwner = { threadId, generation: internalGeneration };
12122
12140
  turnResourceOwners.set(threadId, resourceOwner);
@@ -12195,6 +12213,7 @@ failover) {
12195
12213
  if (Object.keys(custom).length)
12196
12214
  integrations.custom = custom;
12197
12215
  }
12216
+ const blockedPaths = guardFreeTurn(threadId, providerConfigs()[instance.instanceId]?.account, integrations, [paw.root, resolveIcmPath(cfg)]);
12198
12217
  // Turn setup can yield before a provider owns the bot. An interrupt
12199
12218
  // during that setup window must still stop the queued
12200
12219
  // room operation before it starts a process.
@@ -12589,13 +12608,13 @@ failover) {
12589
12608
  }
12590
12609
  }
12591
12610
  const roomAddons = turnAddons(readyBot, instance.driverKind, { local: true, fileTools: worksInWorkspace });
12592
- const roomNexusContext = nexusOwnerThread(threadId)
12611
+ const roomNexusContext = !blockedPaths && nexusOwnerThread(threadId)
12593
12612
  ? await nexusMemory.readBack({ bot, threadId, query: addressedRequest?.text ?? "" })
12594
12613
  : "";
12595
12614
  const roomSystem = buildSystemPrompt(system, store.bot(bot.id)?.soul ?? bot.soul ?? "", [
12596
- { id: "user-profile", label: "About the user", text: userProfileSystemPrompt(cfg.profile) },
12597
- { id: "paw", label: "Shared context (PAW)", text: pawPrompt(bot, "") },
12598
- { id: "icm", label: "Shared context (ICM)", text: icmSystemPrompt(cfg) },
12615
+ { id: "user-profile", label: "About the user", text: blockedPaths ? "" : userProfileSystemPrompt(cfg.profile) },
12616
+ { id: "paw", label: "Shared context (PAW)", text: blockedPaths ? "" : pawPrompt(bot, "") },
12617
+ { id: "icm", label: "Shared context (ICM)", text: blockedPaths ? "" : icmSystemPrompt(cfg) },
12599
12618
  { id: "private-bot", label: "Private Bot", text: isPersonalBot(bot) ? privateBotPrompt(false) : "" },
12600
12619
  { id: "files", label: "File locations", text: workspace ? workspaceLocationsPrompt(bot.id, cwd, readyBot.cwd) : "" },
12601
12620
  { id: "repos", label: "Linked repos", text: repoPlan ? repoPromptSection(repoPlan, repoPlace(undefined, roomTeamComputer || roomComputerKind === "box" ? "box" : roomVmMounted ? "vm" : roomComputerKind), cwd) : "" },
@@ -12759,7 +12778,7 @@ failover) {
12759
12778
  systemVolatileSections: roomSystem.volatileSections,
12760
12779
  cwd,
12761
12780
  additionalDirs: turnAdditionalDirs(repoPlan, cwd),
12762
- integrations,
12781
+ integrations, blockedPaths,
12763
12782
  ...userMcpForTurn(readyBot, instance),
12764
12783
  ...(roomAddons.pluginDirs.length ? { pluginDirs: roomAddons.pluginDirs } : {}),
12765
12784
  ...(roomAddons.rtk ? { rtk: roomAddons.rtk } : {}),
@@ -14785,7 +14804,7 @@ function engineMcpServers(bot) {
14785
14804
  * refuses leaves both the file and this process as they were. */
14786
14805
  async function persistMcpServers(next, forceSecure) {
14787
14806
  try {
14788
- await storeMcpServerSecrets(next, forceSecure);
14807
+ await storeMcpServerSecrets(next, forceSecure, cfg.mcpServers ?? {});
14789
14808
  }
14790
14809
  catch (error) {
14791
14810
  throw Object.assign(error instanceof Error ? error : new Error(String(error)), { status: error?.status ?? 503 });
@@ -16927,9 +16946,9 @@ const handleRequest = async (req, res) => {
16927
16946
  // only work items), and only when the person on the thread is the one
16928
16947
  // signed in to Nexus here.
16929
16948
  if (method === "POST" && (path === "/api/internal/nexus/recall" || path === "/api/internal/nexus/file")) {
16930
- if (!nexusOwnerThread(internalCapability.threadId)) {
16931
- return json(res, 403, { error: "This conversation is with someone other than the person signed in to Nexus here, so their Nexus is not shared into it." });
16932
- }
16949
+ const refusal = nexusOwnerThread(internalCapability.threadId) ? freeTurnNexusRefusal(internalCapability.threadId) : "This conversation is with someone other than the person signed in to Nexus here, so their Nexus is not shared into it.";
16950
+ if (refusal)
16951
+ return json(res, 403, { error: refusal });
16933
16952
  const body = await readInternalBody();
16934
16953
  const bot = { id: internalSender.id, name: internalSender.name, ...(internalSender.personal ? { personal: true } : {}) };
16935
16954
  try {
@@ -8,9 +8,12 @@
8
8
  // start a server whose placeholder has nothing behind it, or whose command
9
9
  // line still holds a parked token, does not start (launchBlocker)
10
10
  //
11
- // Without the desktop shell (a development or headless server, or Linux with
12
- // no keyring) there is no secure store: entries are kept in config.json as
13
- // they always were, and Settings says so.
11
+ // Without the desktop shell (a development or headless server) there is no
12
+ // secure store: entries are kept in config.json as they always were, and
13
+ // Settings says so. When the desktop shell IS there but found no real store
14
+ // (Linux with no keyring: "insecure"), secrets already in config.json stay
15
+ // where they are, but a save that adds or changes one is refused: Atomic
16
+ // does not fall back to writing new secrets into a plain file.
14
17
  import { randomUUID } from "node:crypto";
15
18
  import { MCP_SECRET_PLACEHOLDER, MCP_SECRET_STORE_ENV, MCP_SECRETS_ENV, MCP_SECRETS_SAVE, MCP_SECRETS_SAVE_RESULT, hydrateMcpServerSecrets, mcpArgPlaceholderId, sanitizeMcpSecrets, splitMcpServerSecrets, } from "../electron/mcp-secrets.mjs";
16
19
  export { MCP_SECRET_PLACEHOLDER, mcpArgPlaceholderId };
@@ -37,7 +40,7 @@ export function mcpSecretState(env = process.env) {
37
40
  secrets = {};
38
41
  }
39
42
  }
40
- const kind = claimed === "os" || claimed === "unavailable" ? claimed : "plaintext";
43
+ const kind = claimed === "os" || claimed === "unavailable" || claimed === "insecure" ? claimed : "plaintext";
41
44
  state = { kind, secrets };
42
45
  return state;
43
46
  }
@@ -127,10 +130,16 @@ export function mcpServersForDisk(servers) {
127
130
  }
128
131
  /** Seal the secrets of the next `mcpServers` before config.json is written.
129
132
  * Resolves once they are durable (or there is nothing to seal). */
130
- export async function storeMcpServerSecrets(next, forceSecure = {}) {
133
+ export async function storeMcpServerSecrets(next, forceSecure = {}, onDisk = {}) {
131
134
  const current = mcpSecretState();
132
135
  if (current.kind === "plaintext")
133
136
  return;
137
+ if (current.kind === "insecure") {
138
+ if (Object.keys(forceSecure).length || addsPlaintextSecret(next, onDisk)) {
139
+ throw Object.assign(new Error(INSECURE_STORE_REFUSAL), { status: 409 });
140
+ }
141
+ return;
142
+ }
134
143
  // `forceSecure`: values that must be stored whatever their name, merged
135
144
  // in as though already stored (the quick fix's named variable)
136
145
  const previous = structuredClone(current.secrets);
@@ -146,6 +155,25 @@ export async function storeMcpServerSecrets(next, forceSecure = {}) {
146
155
  await sendToDesktop(split.secrets);
147
156
  current.secrets = split.secrets;
148
157
  }
158
+ /** What a refused save on a computer with no real secure store says. */
159
+ export const INSECURE_STORE_REFUSAL = "This computer has no unlocked keyring (such as GNOME Keyring or KWallet), so Atomic did not save this MCP server's secret. Atomic does not keep new secrets in a plain file. Install or unlock a keyring, then quit and reopen Atomic and try again.";
160
+ /** True when `next` holds a secret env or header value that `onDisk` (what
161
+ * config.json has now) does not already hold under the same server and key.
162
+ * Unchanged plaintext from before is allowed through untouched; anything new
163
+ * or edited is not. */
164
+ export function addsPlaintextSecret(next, onDisk) {
165
+ const after = splitMcpServerSecrets(next, {}).secrets;
166
+ const before = splitMcpServerSecrets(onDisk, {}).secrets;
167
+ for (const [name, slot] of Object.entries(after)) {
168
+ for (const part of ["env", "headers"]) {
169
+ for (const [key, value] of Object.entries(slot[part] ?? {})) {
170
+ if (before[name]?.[part]?.[key] !== value)
171
+ return true;
172
+ }
173
+ }
174
+ }
175
+ return false;
176
+ }
149
177
  /** Why a configured server must not start, or null. */
150
178
  export function mcpLaunchBlocker(raw) {
151
179
  if (!raw || typeof raw !== "object" || Array.isArray(raw))
@@ -95,7 +95,9 @@ export function createEngineTierRoutes(deps) {
95
95
  const value = body && typeof body === "object" && !Array.isArray(body) && Object.keys(body).length === 1 ? body.includeFree : undefined;
96
96
  if (typeof value !== "boolean")
97
97
  return json(res, 400, { error: "send { includeFree: boolean }" });
98
- deps.saveEngineTiers({ ...(deps.engineTiers() ?? { ladders: {} }), includeFree: value || undefined });
98
+ // Off drops the key: config.json holds JSON values only, so undefined is refused.
99
+ const { includeFree: _was, ...rest } = deps.engineTiers() ?? { ladders: {} };
100
+ deps.saveEngineTiers(value ? { ...rest, includeFree: true } : rest);
99
101
  return json(res, 200, await view());
100
102
  }
101
103
  if (path === "/api/engine-tiers/rebalance" && method === "GET") {
@@ -23,7 +23,7 @@ export function createVaultRoutes(deps) {
23
23
  if (typeof body?.csv !== "string")
24
24
  return json(res, 400, { error: "Choose a CSV file exported from your password manager." });
25
25
  try {
26
- const { logins, skipped } = vaultLoginsFromCsv(body.csv);
26
+ const { logins, skipped } = vaultLoginsFromCsv(body.csv, typeof body.group === "string" && body.group ? body.group : undefined);
27
27
  return json(res, 200, { ...store.importLogins(ownerId, logins), skipped });
28
28
  }
29
29
  catch (error) {
@@ -8,7 +8,7 @@ import { z } from "zod";
8
8
  import { vaultInputSchema, vaultMetadata } from "../../shared/vault.js";
9
9
  import { writeFileAtomic } from "../atomic.js";
10
10
  const MAX_BYTES = 16 * 1024 * 1024;
11
- const MAX_ITEMS = 1000;
11
+ const MAX_ITEMS = 3000;
12
12
  const AAD = Buffer.from("atomic-native-vault:v1");
13
13
  const identity = z.string().uuid();
14
14
  const metadataSchema = z.object({
@@ -0,0 +1,52 @@
1
+ // Did the engine actually run with the approval mode Atomic asked for?
2
+ //
3
+ // Atomic tells each engine how much it may do on its own (for the ACP
4
+ // engines, a session mode). An engine that
5
+ // silently runs LOOSER than that (an old CLI that ignores a flag, a session
6
+ // saved in yolo, a settings file that pins a mode) would act without the
7
+ // approval card the person chose. This module is the one comparison every
8
+ // driver uses: plain lookup tables, no model.
9
+ //
10
+ // ok reported is the same as, or stricter than, what was asked
11
+ // looser reported lets the engine do more on its own: stop the turn
12
+ // unverified the engine did not say, or said something this table does
13
+ // not know: the caller logs it
14
+ /** Higher is stricter. Ids each engine documents (see its driver). Several
15
+ * spellings are listed where CLIs disagree (Gemini says autoEdit, Qwen
16
+ * auto-edit, the Gemini flag auto_edit). */
17
+ export const MODE_LADDERS = {
18
+ kimiAgent: { plan: 4, default: 3, yolo: 1, auto: 0 },
19
+ droidAgent: { spec: 4, normal: 3, "auto-low": 2, "auto-medium": 1, "auto-high": 0 },
20
+ vibeAgent: { plan: 4, ask: 3, "accept-edits": 2, "smart-approve": 1, "auto-approve": 0 },
21
+ qwenAgent: { plan: 4, default: 3, "auto-edit": 2, autoEdit: 2, auto: 1, yolo: 0 },
22
+ geminiAgent: { plan: 4, default: 3, autoEdit: 2, auto_edit: 2, "auto-edit": 2, yolo: 0 },
23
+ };
24
+ const text = (value) => (typeof value === "string" && value.trim() ? value.trim() : null);
25
+ /** Compare one requested mode with what the engine reported. */
26
+ export function compareEffectiveMode(ladder, requested, reported) {
27
+ const want = text(requested);
28
+ const got = text(reported);
29
+ const ranks = MODE_LADDERS[ladder];
30
+ if (want === null || got === null)
31
+ return { status: "unverified", requested: want, reported: got };
32
+ const wantRank = ranks?.[want];
33
+ const gotRank = ranks?.[got];
34
+ if (wantRank === undefined || gotRank === undefined) {
35
+ // An exact echo is a confirmation even for an id the table does not rank.
36
+ return { status: want === got ? "ok" : "unverified", requested: want, reported: got };
37
+ }
38
+ return { status: gotRank < wantRank ? "looser" : "ok", requested: want, reported: got };
39
+ }
40
+ /** The sentence a stopped turn shows. */
41
+ export function looserModeMessage(engine, readback) {
42
+ return `${engine} ran with looser permissions than requested (asked for "${readback.requested}", it reported "${readback.reported}"), so Atomic stopped the turn before it could act. Update ${engine}, check its own settings for a pinned mode, then try again.`;
43
+ }
44
+ /** Throws when the engine reported a looser mode. Returns the readback so
45
+ * the caller can log an unverified one. */
46
+ export function assertEffectiveModeNotLooser(engine, ladder, requested, reported) {
47
+ const readback = compareEffectiveMode(ladder, requested, reported);
48
+ if (readback.status === "looser") {
49
+ throw Object.assign(new Error(looserModeMessage(engine, readback)), { code: "APPROVAL_MODE_LOOSER", readback });
50
+ }
51
+ return readback;
52
+ }
@@ -75,22 +75,22 @@ export const ACCOUNT_PROVIDERS = [
75
75
  {
76
76
  id: "googleAiStudioFree", kind: "apiKey", label: "Google AI Studio (free tier)", billing: "free", driver: "openai-compat", envVar: "GOOGLE_AI_STUDIO_FREE_API_KEY", icon: "google",
77
77
  config: { url: "https://generativelanguage.googleapis.com/v1beta/openai", apiKeyEnv: "GOOGLE_AI_STUDIO_FREE_API_KEY", model: "", provider: "" },
78
- keyTest: { provider: "openaiCompat", url: "https://generativelanguage.googleapis.com/v1beta/openai" }, keyUrl: "https://aistudio.google.com/apikey",
78
+ keyTest: { provider: "openaiCompat", url: "https://generativelanguage.googleapis.com/v1beta/openai" }, keyUrl: "https://aistudio.google.com/apikey", signupUrl: "https://aistudio.google.com/",
79
79
  },
80
80
  {
81
81
  id: "groqFree", kind: "apiKey", label: "Groq (free tier)", billing: "free", driver: "openai-compat", envVar: "GROQ_FREE_API_KEY",
82
82
  config: { url: "https://api.groq.com/openai/v1", apiKeyEnv: "GROQ_FREE_API_KEY", model: "", provider: "" },
83
- keyTest: { provider: "openaiCompat", url: "https://api.groq.com/openai/v1" }, keyUrl: "https://console.groq.com/keys",
83
+ keyTest: { provider: "openaiCompat", url: "https://api.groq.com/openai/v1" }, keyUrl: "https://console.groq.com/keys", signupUrl: "https://console.groq.com/",
84
84
  },
85
85
  {
86
86
  id: "cerebrasFree", kind: "apiKey", label: "Cerebras (free tier)", billing: "free", driver: "openai-compat", envVar: "CEREBRAS_FREE_API_KEY",
87
87
  config: { url: "https://api.cerebras.ai/v1", apiKeyEnv: "CEREBRAS_FREE_API_KEY", model: "", provider: "" },
88
- keyTest: { provider: "openaiCompat", url: "https://api.cerebras.ai/v1" }, keyUrl: "https://cloud.cerebras.ai/platform/apikeys",
88
+ keyTest: { provider: "openaiCompat", url: "https://api.cerebras.ai/v1" }, keyUrl: "https://cloud.cerebras.ai/platform/apikeys", signupUrl: "https://cloud.cerebras.ai/",
89
89
  },
90
90
  {
91
91
  id: "nvidiaFree", kind: "apiKey", label: "NVIDIA NIM (free tier)", billing: "free", driver: "openai-compat", envVar: "NVIDIA_FREE_API_KEY",
92
92
  config: { url: "https://integrate.api.nvidia.com/v1", apiKeyEnv: "NVIDIA_FREE_API_KEY", model: "", provider: "" },
93
- keyTest: { provider: "openaiCompat", url: "https://integrate.api.nvidia.com/v1" }, keyUrl: "https://build.nvidia.com/settings/api-keys",
93
+ keyTest: { provider: "openaiCompat", url: "https://integrate.api.nvidia.com/v1" }, keyUrl: "https://build.nvidia.com/settings/api-keys", signupUrl: "https://build.nvidia.com/",
94
94
  },
95
95
  ];
96
96
  export function accountProvider(id) {
@@ -52,24 +52,19 @@ const COLUMNS = {
52
52
  password: ["password", "login_password", "pwd", "pass"],
53
53
  name: ["name", "title", "account"],
54
54
  type: ["type"],
55
+ // The vault, folder or tag a row was filed under, so an import can take one.
56
+ group: ["vault", "folder", "grouping", "collections", "collection", "category", "tags"],
55
57
  };
56
58
  /** Logins from a password manager's CSV export. Notes, TOTP seeds and custom
57
59
  * fields are dropped: they can hold secrets and hints are not secret. Rows
58
60
  * without a website, username and password, or that are not logins, are
59
61
  * counted in `skipped`. Imported items are private to the person (no bots). */
60
- export function vaultLoginsFromCsv(text) {
62
+ export function vaultLoginsFromCsv(text, group) {
61
63
  const [header, ...rows] = parseCsv(text);
62
64
  if (!header)
63
65
  return { logins: [], skipped: 0 };
64
- const names = header.map((cell) => cell.trim().toLowerCase());
65
- const col = (key) => {
66
- for (const name of COLUMNS[key]) {
67
- const index = names.indexOf(name);
68
- if (index >= 0)
69
- return index;
70
- }
71
- return -1;
72
- };
66
+ const groupAt = columnIndex(header, "group");
67
+ const col = (key) => columnIndex(header, key);
73
68
  const at = { url: col("url"), username: col("username"), password: col("password"), name: col("name"), type: col("type") };
74
69
  if (at.url < 0 || at.password < 0 || at.username < 0)
75
70
  throw new VaultCsvError("This CSV has no website, username and password columns.");
@@ -77,6 +72,8 @@ export function vaultLoginsFromCsv(text) {
77
72
  let skipped = 0;
78
73
  for (const row of rows) {
79
74
  const cell = (index) => (index >= 0 ? row[index] ?? "" : "").trim();
75
+ if (group && !groupsOf(cell(groupAt)).includes(group))
76
+ continue;
80
77
  const type = cell(at.type).toLowerCase();
81
78
  const raw = cell(at.url).split(/[\s,]+/)[0] ?? "";
82
79
  // Old entries saved as http:// or a bare domain are filled over HTTPS.
@@ -92,3 +89,28 @@ export function vaultLoginsFromCsv(text) {
92
89
  }
93
90
  return { logins, skipped };
94
91
  }
92
+ function columnIndex(header, key) {
93
+ const names = header.map((cell) => cell.trim().toLowerCase());
94
+ for (const name of COLUMNS[key]) {
95
+ const index = names.indexOf(name);
96
+ if (index >= 0)
97
+ return index;
98
+ }
99
+ return -1;
100
+ }
101
+ // Tags arrive as "a, b" or "a;b"; a vault or folder name is one value.
102
+ const groupsOf = (cell) => cell.split(/[,;]/).map((part) => part.trim()).filter(Boolean);
103
+ /** Vaults, folders or tags in the export with their row counts, so the
104
+ * person can import one instead of everything. Empty when there is no
105
+ * such column. Runs on the device that picked the file. */
106
+ export function vaultCsvGroups(text) {
107
+ const [header, ...rows] = parseCsv(text);
108
+ const at = header ? columnIndex(header, "group") : -1;
109
+ if (at < 0)
110
+ return [];
111
+ const counts = new Map();
112
+ for (const row of rows)
113
+ for (const name of groupsOf(row[at] ?? ""))
114
+ counts.set(name, (counts.get(name) ?? 0) + 1);
115
+ return [...counts].map(([name, count]) => ({ name, count })).sort((a, b) => a.name.localeCompare(b.name));
116
+ }
@@ -72,6 +72,7 @@ const DOCUMENT_MIMES = {
72
72
  txt: "text/plain",
73
73
  md: "text/markdown",
74
74
  markdown: "text/markdown",
75
+ html: "text/html", htm: "text/html",
75
76
  csv: "text/csv",
76
77
  tsv: "text/tab-separated-values",
77
78
  json: "application/json",
@@ -271,16 +272,14 @@ export async function imageAttachmentFromFile(file, optimistic) {
271
272
  ...(optimistic?.previewUrl ? { previewUrl: optimistic.previewUrl } : {}),
272
273
  };
273
274
  }
274
- /** Copy a supported document or audio file into the private attachment store. The prompt
275
- * then carries the same durable path for the local agent and paired phones,
276
- * instead of exposing an arbitrary Finder path to the companion route. */
275
+ /** Copy any file into the private attachment store. The prompt then carries the same durable
276
+ * path for the local agent and paired phones, instead of an arbitrary Finder path. */
277
277
  export async function fileAttachmentFromFile(file) {
278
278
  const declared = file.type.split(";", 1)[0].trim().toLowerCase();
279
279
  const extension = file.name.split(".").at(-1)?.toLowerCase() ?? "";
280
280
  const mime = documentMime(file) ??
281
- (ACCEPTED_AUDIO_MIMES.has(declared) ? declared : AUDIO_MIMES_BY_EXTENSION[extension]);
282
- if (!mime)
283
- return null;
281
+ (ACCEPTED_AUDIO_MIMES.has(declared) ? declared : AUDIO_MIMES_BY_EXTENSION[extension]) ??
282
+ (/^[\w.+-]+\/[\w.+-]+$/.test(declared) ? declared : "application/octet-stream");
284
283
  if (file.size > FILE_MAX_BYTES) {
285
284
  throw Object.assign(new Error(`${file.name} exceeds 25 MB`), { status: 413 });
286
285
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chibitek/chibi",
3
- "version": "0.1.176",
3
+ "version": "0.1.178",
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-BjvwttN3.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};