@chibitek/chibi 0.1.211 → 0.1.214

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 (83) hide show
  1. package/dist/assets/{TerminalPanel-Dro3aeVy.js → TerminalPanel-B9u1SPIJ.js} +1 -1
  2. package/dist/assets/{abnfDiagram-O67JEVCF-kzAr7vQ8.js → abnfDiagram-O67JEVCF-DLKHvswB.js} +1 -1
  3. package/dist/assets/{arc-DKMhcYud.js → arc-CT_EkJME.js} +1 -1
  4. package/dist/assets/{architectureDiagram-NJMV4G6O-_XDnZ7Jz.js → architectureDiagram-NJMV4G6O-Cr57hSCz.js} +1 -1
  5. package/dist/assets/{blockDiagram-BEXU5L5S-D5MoWro9.js → blockDiagram-BEXU5L5S-D0kXMYp9.js} +1 -1
  6. package/dist/assets/{c4Diagram-YGBWAQC7-CGvTMpGE.js → c4Diagram-YGBWAQC7-DO8ibxIl.js} +1 -1
  7. package/dist/assets/channel-D__zUWCH.js +1 -0
  8. package/dist/assets/{chunk-2Q5K7J3B-pjTwr5y0.js → chunk-2Q5K7J3B-B1pfwUYG.js} +1 -1
  9. package/dist/assets/{chunk-3FUC2YCW-BR6zkd-l.js → chunk-3FUC2YCW-IFY2H2h0.js} +2 -2
  10. package/dist/assets/{chunk-5VM5RSS4-CfVFFBeH.js → chunk-5VM5RSS4-CB6AI6WN.js} +1 -1
  11. package/dist/assets/{chunk-GTNCS2PH-TIoAkccw.js → chunk-GTNCS2PH-DJ6HW3xW.js} +1 -1
  12. package/dist/assets/{chunk-GWA4HPMP-BNFBgzbt.js → chunk-GWA4HPMP-GQsHzpVv.js} +1 -1
  13. package/dist/assets/{chunk-JWPE2WC7-B_3QFchU.js → chunk-JWPE2WC7-bEk7MgMp.js} +1 -1
  14. package/dist/assets/{chunk-NETBCI7D-Cj9q80P-.js → chunk-NETBCI7D-DMnkFbzc.js} +1 -1
  15. package/dist/assets/{chunk-WEXAMYUT-DFZPGo9K.js → chunk-WEXAMYUT-DK1Y5Lqz.js} +1 -1
  16. package/dist/assets/{chunk-XXDRQBXY-CekDrT9T.js → chunk-XXDRQBXY-tEYduUGA.js} +1 -1
  17. package/dist/assets/{classDiagram-v2-NBCMYWYE-C3R6Z4Qe.js → classDiagram-v2-NBCMYWYE-C359202A.js} +1 -1
  18. package/dist/assets/{cose-bilkent-JH36ORCC-C1CKyj0L.js → cose-bilkent-JH36ORCC-umDDzyA6.js} +1 -1
  19. package/dist/assets/{cynefin-OW5HDTMX-Deh9QGb0.js → cynefin-OW5HDTMX-CLFzOwUQ.js} +1 -1
  20. package/dist/assets/{cynefinDiagram-VND7K2PF-BIlWyG_M.js → cynefinDiagram-VND7K2PF-Dgsmj170.js} +1 -1
  21. package/dist/assets/{dagre-6A5THRUB-Dx4bWOog.js → dagre-6A5THRUB-BphzZtyp.js} +1 -1
  22. package/dist/assets/{diagram-22UHCM2B-DPxb-FUO.js → diagram-22UHCM2B-DWV7hLJ-.js} +1 -1
  23. package/dist/assets/{diagram-3UASUU5V-BLPCNc4m.js → diagram-3UASUU5V-AAFcIzJf.js} +1 -1
  24. package/dist/assets/{diagram-ATOU4E4O-DOCbp2Dw.js → diagram-ATOU4E4O-BAFFwIW2.js} +1 -1
  25. package/dist/assets/{diagram-CDSNMT55-62uSG-tn.js → diagram-CDSNMT55-B8YeBwQF.js} +1 -1
  26. package/dist/assets/{diagram-MLGK6HIB-De1ZAWVZ.js → diagram-MLGK6HIB-KQTiCQZy.js} +1 -1
  27. package/dist/assets/{diagram-MPIPVDR6-CIGX9tku.js → diagram-MPIPVDR6-B9GZxZY6.js} +1 -1
  28. package/dist/assets/{ebnfDiagram-ZINNZB2B-CegjStdk.js → ebnfDiagram-ZINNZB2B-OdFJszg6.js} +1 -1
  29. package/dist/assets/{elk-276RUBZZ-ClI52Pqm.js → elk-276RUBZZ-3z1fNqtE.js} +1 -1
  30. package/dist/assets/{erDiagram-OPXOYQCR-BQuzjt2-.js → erDiagram-OPXOYQCR-CFIdS8ci.js} +1 -1
  31. package/dist/assets/{flowDiagram-KWPJA3E3-D1xbKgbB.js → flowDiagram-KWPJA3E3-BQz8RfCq.js} +1 -1
  32. package/dist/assets/{ganttDiagram-FUAMR5RP-CH1jGSZz.js → ganttDiagram-FUAMR5RP-BzjyIEHj.js} +1 -1
  33. package/dist/assets/{gitGraphDiagram-X574FWY7-BvAUPEmQ.js → gitGraphDiagram-X574FWY7-BduA844K.js} +1 -1
  34. package/dist/assets/{index-DbkR_erP.js → index-B2iS4X_f.js} +1 -1
  35. package/dist/assets/{index-BcXDfnlQ.js → index-DZVhBXFS.js} +131 -131
  36. package/dist/assets/{infoDiagram-VRGFBTTK-CyMmMbMv.js → infoDiagram-VRGFBTTK-BM3By-gM.js} +1 -1
  37. package/dist/assets/{ishikawaDiagram-OU5B5YK6-Uw-hE1tO.js → ishikawaDiagram-OU5B5YK6-DS_5pa-v.js} +1 -1
  38. package/dist/assets/{journeyDiagram-ZHPQQLJL-ClEDnNRB.js → journeyDiagram-ZHPQQLJL-CdCG3WIh.js} +1 -1
  39. package/dist/assets/{kanban-definition-PNTS6WVX-erx0BEal.js → kanban-definition-PNTS6WVX-Byg5UqYJ.js} +1 -1
  40. package/dist/assets/{linear-CSSxpyL0.js → linear-CDV6zgxP.js} +1 -1
  41. package/dist/assets/{mermaid.core-n13K6vlC.js → mermaid.core-D31FuzHj.js} +5 -5
  42. package/dist/assets/{mindmap-definition-NLK3R4M7-BcTEIqpD.js → mindmap-definition-NLK3R4M7-u5bkqwma.js} +1 -1
  43. package/dist/assets/{pegDiagram-GJSIUBJH-CJdsm3en.js → pegDiagram-GJSIUBJH-B8uahXqZ.js} +1 -1
  44. package/dist/assets/{pieDiagram-5QR66LMP-C7rk-ash.js → pieDiagram-5QR66LMP-Beji3_Lb.js} +1 -1
  45. package/dist/assets/{quadrantDiagram-O4NWA36T-BSXOYov0.js → quadrantDiagram-O4NWA36T-BpbLoL7d.js} +1 -1
  46. package/dist/assets/{railroadDiagram-XR7U4H2S-Cmg_FtZY.js → railroadDiagram-XR7U4H2S-Bjm_Cslm.js} +1 -1
  47. package/dist/assets/{requirementDiagram-PLB6GJNP-B_9aE6Mg.js → requirementDiagram-PLB6GJNP-CqN7iivm.js} +1 -1
  48. package/dist/assets/{sankeyDiagram-IPEJSGJF-DyxaQPy3.js → sankeyDiagram-IPEJSGJF-CuH1ynLe.js} +1 -1
  49. package/dist/assets/{sequenceDiagram-PO4LG4MO-D5CJeESq.js → sequenceDiagram-PO4LG4MO-CFYrTC70.js} +1 -1
  50. package/dist/assets/{sizeCapture-INFHLROL-9-Q4eosQ.js → sizeCapture-INFHLROL-BdnwdU8-.js} +1 -1
  51. package/dist/assets/{stateDiagram-v2-GCMORJYK-jgsHnEQl.js → stateDiagram-v2-GCMORJYK-CHGgtFqA.js} +1 -1
  52. package/dist/assets/{swimlanes-2SLR337P-MIVacUbv.js → swimlanes-2SLR337P--Q3opHe5.js} +1 -1
  53. package/dist/assets/swimlanesDiagram-TC7HE7FX-DoO8fttf.js +8 -0
  54. package/dist/assets/{timeline-definition-EJHVYXUP-Ch8ins-D.js → timeline-definition-EJHVYXUP-C8xegRju.js} +1 -1
  55. package/dist/assets/{usecaseDiagram-POWQR4AR-BDwBIuhZ.js → usecaseDiagram-POWQR4AR-Bt5PpgS7.js} +1 -1
  56. package/dist/assets/{vennDiagram-UO4OBE2U-BiiDxcHO.js → vennDiagram-UO4OBE2U-BVfuyLk-.js} +1 -1
  57. package/dist/assets/{wardleyDiagram-VNRHLVJA-D79CK2__.js → wardleyDiagram-VNRHLVJA-DOcd0zsh.js} +1 -1
  58. package/dist/assets/{xychartDiagram-PMCCYNJV-CI7S0o-6.js → xychartDiagram-PMCCYNJV-CsX4ff0v.js} +1 -1
  59. package/dist/handbook/atomic-handbook.html +1 -1
  60. package/dist/index.html +1 -1
  61. package/dist-server/container-mcp.js +81 -81
  62. package/dist-server/drivers/agents-proxy.js +83 -84
  63. package/dist-server/index.js +742 -703
  64. package/dist-server/openmausbot.js +687 -659
  65. package/dist-server/pair-cli.js +687 -659
  66. package/dist-server/server/agents-token-file.js +26 -0
  67. package/dist-server/server/drivers/acp/core.js +4 -6
  68. package/dist-server/server/drivers/agents-catalog.js +2 -2
  69. package/dist-server/server/drivers/chat-mcp-tools.js +1 -21
  70. package/dist-server/server/drivers/claude.js +69 -66
  71. package/dist-server/server/drivers/codex.js +4 -3
  72. package/dist-server/server/drivers/openai-chat.js +1 -1
  73. package/dist-server/server/drivers/session-allow-key.js +22 -5
  74. package/dist-server/server/engine-tiers.js +3 -7
  75. package/dist-server/server/index.js +37 -40
  76. package/dist-server/server/new-bot-defaults.js +3 -1
  77. package/dist-server/server/routes/thread-stop.js +15 -2
  78. package/dist-server/server/surface.js +1 -1
  79. package/dist-server/server/system-prompt.js +13 -2
  80. package/dist-server/vps-container-mcp.js +81 -81
  81. package/package.json +1 -1
  82. package/dist/assets/channel-YcZdlysP.js +0 -1
  83. package/dist/assets/swimlanesDiagram-TC7HE7FX-Dekwo1KL.js +0 -8
@@ -136,7 +136,6 @@ import { computerKindForResource, ManagedDesktopPolicy } from "./managed-policy.
136
136
  import { hostedModelPolicy, HOSTED_MODEL_POLICY_HEADER, HOSTED_PROVIDER_SETTINGS_ERROR } from "./hosted-models.js";
137
137
  import { newEventId } from "./contracts.js";
138
138
  import { canTitle, routedThreadTitle } from "./thread-title.js";
139
- import { freeTurnNexusRefusal, guardFreeTurn } from "./free-turn-guard.js";
140
139
  import { createSummaryScheduler } from "./bot-summary.js";
141
140
  import { BOT_SUMMARY_MAX, sanitizeBotSummary } from "../shared/bot-summary.js";
142
141
  import { selectDefaultModelSelection, withNewBotEffort } from "./default-model-selection.js";
@@ -304,7 +303,7 @@ import { createEngineTierRoutes } from "./routes/engine-tiers.js";
304
303
  import { createModelGatewayRoutes } from "./model-gateway/route.js";
305
304
  import { applyChibiDefaults, chibiDefaultSelection } from "./chibi-defaults.js";
306
305
  import { createPrimaryBotRoutes } from "./routes/primary-bot.js";
307
- import { EngineSnapshotCache, botTier, canDriveComputer, classLadder, engineAccount, engineHealth, engineLabel, engineTierClasses, engineTierLadders, failoverClassOrder, engineTiersIncludeFree, generateLadders, handlesClientData, ladderForClass, keyBased, needsDelegation, needsWiderWalk, resolveFailover, takeWider, resolveLadder } from "./engine-tiers.js";
306
+ import { EngineSnapshotCache, botTier, canDriveComputer, classLadder, engineAccount, engineHealth, engineLabel, engineTierClasses, engineTierLadders, failoverClassOrder, engineTiersIncludeFree, generateLadders, ladderForClass, keyBased, needsDelegation, needsWiderWalk, resolveFailover, takeWider, resolveLadder } from "./engine-tiers.js";
308
307
  import { PRIMARY_BOT_THREAD_TITLE, PRIMARY_BOT_TRIGGER, PrimaryBotStore, routesAsSweep, PrimaryBotSweeper } from "./primary-bot.js";
309
308
  import { PRIMARY_BOT_LOCKED, primaryBotChoiceField, isPrimaryBot } from "../shared/primary-bot.js";
310
309
  import { moveIntoChibi } from "./move-into-chibi.js";
@@ -3115,7 +3114,7 @@ function ladderTurnEngineChoice(profile, projected, threadId, needs, runOn, subs
3115
3114
  const { ladder } = plan;
3116
3115
  const computer = turnComputer(projected, threadId, runOn);
3117
3116
  const context = { candidates, needsDelegation: needsDelegation(tier, profile), computer, refuse: engineTierRefusal(projected), resting: engineResting, own: profile.modelSelection.instanceId,
3118
- keyBandPaused: subscriptionsOnly || keyBandPausedFor(threadId), includeFree: engineTiersIncludeFree(cfg.engineTiers), clientData: handlesClientData(profile) };
3117
+ keyBandPaused: subscriptionsOnly || keyBandPausedFor(threadId), includeFree: engineTiersIncludeFree(cfg.engineTiers) };
3119
3118
  const local = (resolution) => localModeTurn(resolution, { tier, context, needs, prefer: [projected.modelSelection.instanceId] });
3120
3119
  const wider = (tried, modelClass) => resolveFailover({
3121
3120
  ladder, classLadder: (cls) => classLadder(classedModels(), cls), failed: projected.modelSelection, context, tried,
@@ -3881,7 +3880,7 @@ function failoverPick(turn, profile, projected, candidates, failedCandidate, res
3881
3880
  classLadder: (modelClass) => classLadder(classedModels(), modelClass),
3882
3881
  failed: attempt.selection,
3883
3882
  context: { candidates, needsDelegation: needsDelegation(tier, profile), computer, refuse: engineTierRefusal(projected), resting, own: profile.modelSelection.instanceId,
3884
- keyBandPaused: keyBandPausedFor(turn.threadId), includeFree: engineTiersIncludeFree(cfg.engineTiers), clientData: handlesClientData(profile) },
3883
+ keyBandPaused: keyBandPausedFor(turn.threadId), includeFree: engineTiersIncludeFree(cfg.engineTiers) },
3885
3884
  tried,
3886
3885
  modelClass: neededClass,
3887
3886
  mayDrop: true,
@@ -7553,7 +7552,7 @@ function continueComputerSelection(threadId, generation, succeeded) {
7553
7552
  // machine's record, so a later Works on change may sweep it.
7554
7553
  store.patchTask(bot.id, threadId, { surface, surfaceSource: "auto" });
7555
7554
  const text = `The computer selection is now ${surfaceLabel(surface)}. Continue the user's original request using the tools mounted for this turn; verify the result before claiming success.\n\n${selection.text}`;
7556
- void startTurn(bot.id, text, { threadId, userMessage: selection.source, computerSelectionContinuation: true }).catch(error => {
7555
+ void startTurn(bot.id, text, { threadId, userMessage: selection.source, computerSelectionContinuation: selection.text }).catch(error => {
7557
7556
  if (store.taskByThread(bot.id, threadId))
7558
7557
  store.appendMessage(threadId, { role: "bot", kind: "activity",
7559
7558
  tool: { name: `Could not continue on ${surfaceLabel(surface)}: ${error instanceof Error ? error.message : String(error)}`, ok: false } });
@@ -9922,11 +9921,11 @@ async function startTurn(botId, text, opts) {
9922
9921
  directTurnDispatchClaims.set(threadId, { id: dispatchClaimId, botId, threadId, phase: "setup" });
9923
9922
  directTurnBots.set(threadId, bot);
9924
9923
  beginInternalCapabilityGeneration(threadId, dispatchClaimId);
9925
- if (!opts?.computerSelectionContinuation && !opts?.cardContinuation && !opts?.automationSource && !opts?.unattended &&
9924
+ if (!opts?.cardContinuation && !opts?.automationSource && !opts?.unattended &&
9926
9925
  !opts?.commsDepth && !opts?.coordination && !inheritedTeamComputer(bot) && bot.computer !== "off" && agentsMounted) {
9927
9926
  const source = store.activePath(threadId).findLast(message => message.id === userMessage?.id && message.role === "user" && !message.peerAsk);
9928
9927
  if (source)
9929
- computerSelectionTurns.set(threadId, { generation: dispatchClaimId, botId: bot.id, source, text });
9928
+ computerSelectionTurns.set(threadId, { generation: dispatchClaimId, botId: bot.id, source, text: opts?.computerSelectionContinuation ?? text });
9930
9929
  }
9931
9930
  store.setTaskActivity(bot.id, threadId, "working");
9932
9931
  // A closed thread that gets a new turn is open again: the person (or the
@@ -10749,16 +10748,15 @@ async function startTurn(botId, text, opts) {
10749
10748
  }
10750
10749
  }
10751
10750
  const addons = turnAddons(liveBot ?? bot, instance.driverKind, { local: opts?.runOn !== "cloud", fileTools: worksInWorkspace });
10752
- const blockedPaths = guardFreeTurn(threadId, providerConfigs()[instance.instanceId]?.account, integrations, [paw.root, resolveIcmPath(cfg)]);
10753
10751
  // What Nexus already knows for this person: read once per session and
10754
10752
  // cached, bounded in size and time, never holding the turn up. A Team
10755
10753
  // Room turn reads it only when its owner shares memories in that room.
10756
- const nexusContext = !blockedPaths && nexusOwnerThread(threadId) && (!roomTurn || roomTurn.share.memories)
10754
+ const nexusContext = nexusOwnerThread(threadId) && (!roomTurn || roomTurn.share.memories)
10757
10755
  ? await nexusMemory.readBack({ bot: liveBot ?? bot, threadId, query: providerText })
10758
10756
  : "";
10759
10757
  const prompt = buildSystemPrompt(persona, liveBot?.soul ?? bot.soul ?? "", roomPromptSections(roomTurn, [
10760
10758
  { id: "personal-goal", label: "Active goal", text: personalGoals.goals.get(threadId)?.status === "working" ? personalGoalInstructions(personalGoals.goals.get(threadId)) : "" },
10761
- { id: "user-profile", label: "About the user", text: blockedPaths ? "" : userProfileSystemPrompt(cfg.profile) },
10759
+ { id: "user-profile", label: "About the user", text: userProfileSystemPrompt(cfg.profile) },
10762
10760
  // the ICM folder is on this machine; a cloud run cannot reach it
10763
10761
  // first after the soul: the block names agent tools, so it only goes
10764
10762
  // to a turn whose engine actually mounted them (setupMode is already
@@ -10766,8 +10764,8 @@ async function startTurn(botId, text, opts) {
10766
10764
  { id: "setup", label: "Setup", text: setupSystemPrompt(setupMode, { skills: skillAuthoring, cwd: liveBot?.cwd ?? bot.cwd }) },
10767
10765
  // after setup (which must follow the soul): PAW (Personal AI Workspace)
10768
10766
  // first, then a legacy ICM folder; a cloud run cannot reach either
10769
- { id: "paw", label: "Shared context (PAW)", text: blockedPaths ? "" : pawPrompt(liveBot ?? bot, text, opts?.runOn) },
10770
- { id: "icm", label: "Shared context (ICM)", text: !blockedPaths && opts?.runOn !== "cloud" ? icmSystemPrompt(cfg) : "" },
10767
+ { id: "paw", label: "Shared context (PAW)", text: pawPrompt(liveBot ?? bot, text, opts?.runOn) },
10768
+ { id: "icm", label: "Shared context (ICM)", text: opts?.runOn !== "cloud" ? icmSystemPrompt(cfg) : "" },
10771
10769
  { id: "private-bot", label: "Private Bot", text: isPersonalBot(liveBot ?? bot) ? privateBotPrompt(privateChibiLinkActive()) : chibiLinkPromptFor(liveBot ?? bot, threadId) },
10772
10770
  { id: "files", label: "File locations", text: worksInWorkspace && opts?.runOn !== "cloud" ? workspaceLocationsPrompt(bot.id, cwd, liveBot?.cwd ?? bot.cwd) : "" },
10773
10771
  { id: "repos", label: "Linked repos", text: repoPlan ? repoPromptSection(repoPlan, repoPlace(opts?.runOn, computerKind), cwd) : "" },
@@ -10842,7 +10840,7 @@ async function startTurn(botId, text, opts) {
10842
10840
  systemStable: prompt.stable,
10843
10841
  systemVolatile: prompt.volatile,
10844
10842
  systemVolatileSections: prompt.volatileSections,
10845
- integrations, blockedPaths,
10843
+ integrations,
10846
10844
  ...userMcpForTurn(liveBot ?? bot, instance),
10847
10845
  ...(addons.pluginDirs.length ? { pluginDirs: addons.pluginDirs } : {}),
10848
10846
  ...(addons.rtk ? { rtk: addons.rtk } : {}),
@@ -12223,7 +12221,6 @@ failover) {
12223
12221
  if (Object.keys(custom).length)
12224
12222
  integrations.custom = custom;
12225
12223
  }
12226
- const blockedPaths = guardFreeTurn(threadId, providerConfigs()[instance.instanceId]?.account, integrations, [paw.root, resolveIcmPath(cfg)]);
12227
12224
  // Turn setup can yield before a provider owns the bot. An interrupt
12228
12225
  // during that setup window must still stop the queued
12229
12226
  // room operation before it starts a process.
@@ -12618,13 +12615,13 @@ failover) {
12618
12615
  }
12619
12616
  }
12620
12617
  const roomAddons = turnAddons(readyBot, instance.driverKind, { local: true, fileTools: worksInWorkspace });
12621
- const roomNexusContext = !blockedPaths && nexusOwnerThread(threadId)
12618
+ const roomNexusContext = nexusOwnerThread(threadId)
12622
12619
  ? await nexusMemory.readBack({ bot, threadId, query: addressedRequest?.text ?? "" })
12623
12620
  : "";
12624
12621
  const roomSystem = buildSystemPrompt(system, store.bot(bot.id)?.soul ?? bot.soul ?? "", [
12625
- { id: "user-profile", label: "About the user", text: blockedPaths ? "" : userProfileSystemPrompt(cfg.profile) },
12626
- { id: "paw", label: "Shared context (PAW)", text: blockedPaths ? "" : pawPrompt(bot, "") },
12627
- { id: "icm", label: "Shared context (ICM)", text: blockedPaths ? "" : icmSystemPrompt(cfg) },
12622
+ { id: "user-profile", label: "About the user", text: userProfileSystemPrompt(cfg.profile) },
12623
+ { id: "paw", label: "Shared context (PAW)", text: pawPrompt(bot, "") },
12624
+ { id: "icm", label: "Shared context (ICM)", text: icmSystemPrompt(cfg) },
12628
12625
  { id: "private-bot", label: "Private Bot", text: isPersonalBot(bot) ? privateBotPrompt(false) : "" },
12629
12626
  { id: "files", label: "File locations", text: workspace ? workspaceLocationsPrompt(bot.id, cwd, readyBot.cwd) : "" },
12630
12627
  { id: "repos", label: "Linked repos", text: repoPlan ? repoPromptSection(repoPlan, repoPlace(undefined, roomTeamComputer || roomComputerKind === "box" ? "box" : roomVmMounted ? "vm" : roomComputerKind), cwd) : "" },
@@ -12788,7 +12785,7 @@ failover) {
12788
12785
  systemVolatileSections: roomSystem.volatileSections,
12789
12786
  cwd,
12790
12787
  additionalDirs: turnAdditionalDirs(repoPlan, cwd),
12791
- integrations, blockedPaths,
12788
+ integrations,
12792
12789
  ...userMcpForTurn(readyBot, instance),
12793
12790
  ...(roomAddons.pluginDirs.length ? { pluginDirs: roomAddons.pluginDirs } : {}),
12794
12791
  ...(roomAddons.rtk ? { rtk: roomAddons.rtk } : {}),
@@ -16192,6 +16189,20 @@ ROUTES.push(createThreadStopRoutes({
16192
16189
  working: (botId, threadId) => threadBusy(botId, threadId) || Boolean(roomHandoffs.activeDirect(threadId)) ||
16193
16190
  routines?.activeBotRunForBot(botId)?.threadId === threadId,
16194
16191
  stop: stopBotThread,
16192
+ hold: async (botId, threadId) => {
16193
+ const bot = store.bot(botId);
16194
+ if (!bot)
16195
+ return "unavailable";
16196
+ const instance = registry.get((botForThread(botId, threadId) ?? bot).modelSelection.instanceId);
16197
+ return (await instance?.adapter.holdTurn?.(threadId)) ?? "unavailable";
16198
+ },
16199
+ resume: async (botId, threadId) => {
16200
+ const bot = store.bot(botId);
16201
+ if (!bot)
16202
+ return "unavailable";
16203
+ const instance = registry.get((botForThread(botId, threadId) ?? bot).modelSelection.instanceId);
16204
+ return (await instance?.adapter.resumeTurn?.(threadId)) ?? "unavailable";
16205
+ },
16195
16206
  }));
16196
16207
  const sharedDeliverables = new SharedDeliverables(DATA_DIR);
16197
16208
  const deliverableAccess = (senderId, auth) => sharedDeliverableAccess(sharedDeliverables, {
@@ -16202,8 +16213,6 @@ const deliverableAccess = (senderId, auth) => sharedDeliverableAccess(sharedDeli
16202
16213
  ROUTES.push(createSharedDeliverablesRoutes(sharedDeliverables, () => deliverableAccess(undefined).sharedBlockedRoots ?? []));
16203
16214
  ROUTES.push(createMessageFileRoutes({ store, attachments: ATTACHMENTS_DIR, workspaceDir, access: deliverableAccess }), createModelGatewayRoutes({ withinBudget: () => assertWithinBudget(cfg, DATA_DIR), book: bookTurnUsage }));
16204
16215
  ROUTES.push(createPinOrderRoutes({ store, visible: (auth) => visibleTo(viewerFor(auth)), personalHidden: personalBotHidden, fromBot: (req) => authorizedInternalCapability(req.headers.authorization) !== null }));
16205
- // Linked repos: Settings > Repos, per-thread links and worktrees. See
16206
- // server/routes/repos.ts for the routes and docs/chibitek/README.md.
16207
16216
  ROUTES.push(createRepoRoutes({
16208
16217
  registry: repoRegistry,
16209
16218
  github: new GitHubRepos(repoRegistry),
@@ -16283,10 +16292,7 @@ const handleRequest = async (req, res) => {
16283
16292
  if (refusal)
16284
16293
  return json(res, 403, { error: refusal, code: "managed_policy" });
16285
16294
  }
16286
- // ── who is asking (server/request-auth.ts) ──────────────────────────
16287
- // Two public routes come first: what this server is, and turning a pairing
16288
- // code into a session. Everything else needs the loopback owner or a
16289
- // paired session with the right scope.
16295
+ // Auth (server/request-auth.ts): /meta and /pair are public; everything else needs a session.
16290
16296
  if (method === "GET" && !path.startsWith("/api/") && !path.startsWith("/.well-known/") && serveStatic(res, path))
16291
16297
  return;
16292
16298
  if (method === "GET" && path === "/.well-known/openmausbot/environment") {
@@ -16298,9 +16304,7 @@ const handleRequest = async (req, res) => {
16298
16304
  const challenge = customDomainVerifier.challenge(domainCheck[1]);
16299
16305
  return json(res, challenge ? 200 : 404, challenge ?? { error: "No active domain check." });
16300
16306
  }
16301
- // Sign in with an emailed code (server/account-signin.ts). Public like
16302
- // /api/auth/pair, JSON-only for the same reason, and counted against the
16303
- // same per-source lockout so a code cannot be guessed.
16307
+ // Emailed sign-in code (server/account-signin.ts): public, JSON-only, same lockout as /pair.
16304
16308
  if (method === "POST" && (path === "/api/auth/email/start" || path === "/api/auth/email/verify")) {
16305
16309
  if (!/^application\/json\b/i.test(String(req.headers["content-type"] ?? ""))) {
16306
16310
  return json(res, 415, { error: "send the sign-in request as JSON (content-type: application/json)" });
@@ -16339,9 +16343,7 @@ const handleRequest = async (req, res) => {
16339
16343
  return json(res, 200, { session: issued.session, environment });
16340
16344
  }
16341
16345
  if (method === "POST" && path === "/api/auth/pair") {
16342
- // JSON only: a cross-site HTML form cannot send this content type
16343
- // without a preflight, so a stray unused code cannot be planted as a
16344
- // session in someone else's browser.
16346
+ // JSON only, so a cross-site form cannot plant a session without a preflight.
16345
16347
  if (!/^application\/json\b/i.test(String(req.headers["content-type"] ?? ""))) {
16346
16348
  return json(res, 415, { error: "send the pairing code as JSON (content-type: application/json)" });
16347
16349
  }
@@ -16890,7 +16892,7 @@ const handleRequest = async (req, res) => {
16890
16892
  return json(res, 403, { error: "Computer selection belongs to a direct bot conversation." });
16891
16893
  const requested = method === "POST" ? (await readInternalBody()).surface : undefined;
16892
16894
  if (method === "POST" && !canSelect)
16893
- return json(res, 403, { error: "Computer selection is only available once per direct user request, with computer access enabled." });
16895
+ return json(res, 403, { error: "Computer selection requires an active direct user request with computer access enabled." });
16894
16896
  if (method === "POST" && requested !== "auto" && !parseSurface(requested)) {
16895
16897
  return json(res, 400, { error: "surface must be auto, cloud, vm, local, or browser" });
16896
16898
  }
@@ -16963,9 +16965,8 @@ const handleRequest = async (req, res) => {
16963
16965
  // only work items), and only when the person on the thread is the one
16964
16966
  // signed in to Nexus here.
16965
16967
  if (method === "POST" && (path === "/api/internal/nexus/recall" || path === "/api/internal/nexus/file")) {
16966
- 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.";
16967
- if (refusal)
16968
- return json(res, 403, { error: refusal });
16968
+ if (!nexusOwnerThread(internalCapability.threadId))
16969
+ 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." });
16969
16970
  const body = await readInternalBody();
16970
16971
  const bot = { id: internalSender.id, name: internalSender.name, ...(internalSender.personal ? { personal: true } : {}) };
16971
16972
  try {
@@ -20578,7 +20579,7 @@ const handleRequest = async (req, res) => {
20578
20579
  // computer, MCP servers, skills, routines): a plain bot, set up by the person.
20579
20580
  if (auth.kind === "assistant")
20580
20581
  body = { ...body, useDefaults: false };
20581
- const template = resolveBotCreationDefaults(cfg.newBotDefaults, body);
20582
+ const template = resolveBotCreationDefaults(cfg.newBotDefaults, body, auth.kind !== "assistant");
20582
20583
  const settings = template.profile;
20583
20584
  if (auth.kind === "session" && !auth.scopes.includes("admin")) {
20584
20585
  const field = clientBotPatchViolation(settings);
@@ -22624,8 +22625,6 @@ const handleRequest = async (req, res) => {
22624
22625
  if (expectedThreadId !== undefined && (typeof expectedThreadId !== "string" || !/^[\w-]+$/.test(expectedThreadId))) {
22625
22626
  return json(res, 400, { error: "threadId must be a task id" });
22626
22627
  }
22627
- // Explicit thread targets never fall through to another routine or
22628
- // channel just because it belongs to the same bot.
22629
22628
  if (typeof expectedThreadId === "string" && store.taskByThread(bot.id, expectedThreadId)) {
22630
22629
  await stopBotThread(bot.id, expectedThreadId);
22631
22630
  return json(res, 200, { ok: true });
@@ -22644,8 +22643,6 @@ const handleRequest = async (req, res) => {
22644
22643
  return json(res, 200, { ok: true });
22645
22644
  }
22646
22645
  const instance = registry.get((botForThread(bot.id, expectedThreadId ?? bot.threadId) ?? bot).modelSelection.instanceId);
22647
- // a bot busy in a ROOM is running on the room's thread — stopping it
22648
- // from its own chat must reach that turn, not just the 1:1 thread
22649
22646
  const busyGroup = activeGroupTurnForBot(bot.id);
22650
22647
  if (busyGroup) {
22651
22648
  if (expectedThreadId !== undefined && busyGroup.threadId !== expectedThreadId) {
@@ -91,7 +91,7 @@ export const newBotDefaultsSchema = z.object({
91
91
  }).strict().refine(value => Buffer.byteLength(JSON.stringify(value), "utf8") <= 900_000, "Bot defaults must fit within 900 KB");
92
92
  /** Explicit values (including empty values) win. A resolved renderer draft
93
93
  * opts out so deleted fields and template extras are not restored on POST. */
94
- export function resolveBotCreationDefaults(saved, body) {
94
+ export function resolveBotCreationDefaults(saved, body, ownerCreated = true) {
95
95
  if (body.useDefaults !== undefined && typeof body.useDefaults !== "boolean") {
96
96
  throw Object.assign(new Error("useDefaults must be true or false"), { status: 400 });
97
97
  }
@@ -105,6 +105,8 @@ export function resolveBotCreationDefaults(saved, body) {
105
105
  if (Object.hasOwn(body, key))
106
106
  Object.assign(profile, { [key]: key === "section" && body[key] === null ? "" : body[key] });
107
107
  }
108
+ // Review by default; local computer automation retains its consent flow.
109
+ profile.approvalMode ??= ownerCreated && profile.computer !== "local" ? "auto" : "ask";
108
110
  const resolved = botDefaultsProfileSchema.safeParse(profile);
109
111
  if (!resolved.success)
110
112
  throw Object.assign(new Error(resolved.error.message), { status: 400 });
@@ -8,10 +8,15 @@
8
8
  // conversations that assistant can already write to with
9
9
  // POST /api/bots/:id/messages.
10
10
  import { PASS } from "./table.js";
11
- const PATH = /^\/api\/bots\/([\w-]+)\/threads\/([\w-]+)\/stop$/;
11
+ const STOP = /^\/api\/bots\/([\w-]+)\/threads\/([\w-]+)\/stop$/;
12
+ const PAUSE = /^\/api\/bots\/([\w-]+)\/threads\/([\w-]+)\/pause$/;
13
+ const RESUME = /^\/api\/bots\/([\w-]+)\/threads\/([\w-]+)\/resume$/;
12
14
  export function createThreadStopRoutes(deps) {
13
15
  return async ({ res, path, method, json }) => {
14
- const m = PATH.exec(path);
16
+ const stop = STOP.exec(path);
17
+ const pause = PAUSE.exec(path);
18
+ const resume = RESUME.exec(path);
19
+ const m = stop ?? pause ?? resume;
15
20
  if (!m)
16
21
  return PASS;
17
22
  if (method !== "POST")
@@ -19,6 +24,14 @@ export function createThreadStopRoutes(deps) {
19
24
  const [, botId, threadId] = m;
20
25
  if (!deps.owns(botId, threadId))
21
26
  return json(res, 404, { error: "no such conversation for this bot" });
27
+ if (pause) {
28
+ const outcome = await deps.hold(botId, threadId);
29
+ return json(res, 200, { ok: true, outcome });
30
+ }
31
+ if (resume) {
32
+ const outcome = await deps.resume(botId, threadId);
33
+ return json(res, 200, { ok: true, outcome });
34
+ }
22
35
  // Nothing running: a no-op, so a late Stop never marks a finished
23
36
  // request as cancelled.
24
37
  if (!deps.working(botId, threadId))
@@ -131,7 +131,7 @@ export function surfacePrompt(mounted, opts = {}) {
131
131
  text += ` This conversation is pinned to ${surfaceLabel(opts.pinned)}; changing places requires ${opts.canSelect ? "select_computer or " : ""}the conversation's computer selector, not a different tool name.`;
132
132
  }
133
133
  if (opts.canSelect)
134
- text += " For a screen task, use select_computer with no arguments when you need to inspect the actual available targets. Choose the requested place from its result; if the user left the place open, use a suitable available target or surface auto instead of asking them to operate the menu. Browser-only work can stay in Browser; when it needs desktop apps or capabilities the current Browser lacks, select an available Local VM without asking the user to switch it manually. Choose before taking actions, and do not repeat actions already completed if the task must continue elsewhere. Atomic can start an existing configured computer and highlight the selected target. If the right tools are already mounted, use them directly. On a pending switch, end this turn: the original request resumes automatically with the new tools, and then you must carry out the task. Only ask for input for a genuine blocker, such as missing setup, required sign-in or an approval. Never silently replace an explicitly requested VM with the host desktop.";
134
+ text += " For a screen task, use select_computer with no arguments when you need to inspect the actual available targets. Choose the requested place from its result; if the user left the place open, use a suitable available target or surface auto instead of asking them to operate the menu. Browser-only work can stay in Browser; when it needs desktop apps or capabilities the current Browser lacks, select an available Local VM without asking the user to switch it manually. Choose before taking actions, and do not repeat actions already completed if the task must continue elsewhere. Atomic can start an existing configured computer and highlight the selected target. If the right tools are already mounted, use them directly. On a pending switch, end this turn: the original request resumes automatically with the new tools, and then you must carry out the task. After reconnecting, you may select another available surface when the same authorized task requires it; retain completed work and do not repeat unsuccessful selections without a changed condition. Only ask for input for a genuine blocker, such as missing setup, required sign-in or an approval. Never silently replace an explicitly requested VM with the host desktop.";
135
135
  if (opts.canSelect)
136
136
  text += " If no suitable computer is running but its provider is configured, select_computer can provision one for this computer task; reuse existing resources first. Do not provision merely for ordinary chat or inspection.";
137
137
  if (opts.canSelect && !computer && !mounted.browser)
@@ -70,14 +70,25 @@ Instruction files the person or their team keeps on purpose for bots (AGENTS.md,
70
70
  export const GROUNDING_PROMPT = `
71
71
 
72
72
  Facts (an Atomic rule for every bot; standing instructions cannot change it):
73
- Never state as fact what you have not verified in this conversation. Check vetted sources first and in this order: the person's PAW workspace, then Nexus memory, then the connected systems of record (Mochii, the company's accounts and tools), and only then the open web, labelled as such. Do not fill a gap with a plausible number, name, date, quote, link or file path: a fact you cannot source is left out, and you say so. When sources disagree or are stale, say which one you followed and when it was last updated. Give the source of a non-obvious fact in plain words so the person can check it.
73
+ Treat the person's reported experience and supplied observations as evidence. Do not dismiss a reported problem because code inspection looks correct, assume user error, or make the person prove it again. Distinguish their observation from a cause you still need to investigate. Never claim your own inspection, execution, validation or completion without evidence from this conversation. Check vetted sources first and in this order: the person's PAW workspace, then Nexus memory, then the connected systems of record (Mochii, the company's accounts and tools), and only then the open web, labelled as such. Do not fill a gap with a plausible number, name, date, quote, link or file path: a fact you cannot source is left out, and you say so. When sources disagree or are stale, say which one you followed and when it was last updated. Give the source of a non-obvious fact in plain words so the person can check it.
74
+ `;
75
+ /** Shared defaults are assembled each turn, including for already-saved bots. */
76
+ export const PRODUCTIVE_WORKFLOW_PROMPT = `
77
+
78
+ Working productively (defaults for every Atomic bot):
79
+ Follow the person's requested working style, including planning-only requests. For implementation work, carry the authorized task through to a working result, not just a plan or a promise.
80
+ For complex work, give a short, revisable plan and start the smallest useful increment. Inspect existing work and reuse it. Combine discussion and implementation: clarify consequential design choices when needed, while continuing independent authorized work. Do not ask again for approval already given for the same scope; routine reads, edits and checks should proceed within the active permissions. Never bypass a tool's approval or access controls.
81
+ Build, check actual results, and adapt before expanding. For data pipelines and SQL, establish expected outputs and validation queries, check a small real slice through the available authorized tools, then revise against returned schemas, API responses, row counts, nulls, duplicates, data volumes and errors as relevant. Do not invent successful results or treat an unexecuted query as validated. If execution is unavailable, provide runnable checks and name that exact limitation while continuing what can be done.
82
+ Use new results to correct the implementation and update the remaining plan; do not force evidence into an earlier design. Preserve decisions, completed increments, validation results and the next step across interruptions or handoffs. Ask the person for input at meaningful choices or when only they can supply a needed result, not after every routine step.
83
+ Report what changed, what was actually checked, and what remains. Queued jobs, started builds and passing unit tests alone do not prove the user's workflow is complete.
74
84
  `;
75
85
  export function buildSystemPrompt(persona, soul, parts) {
76
86
  const ordered = [
77
87
  { id: "persona", label: "Identity", text: persona },
78
88
  { id: "soul", label: "Standing instructions (SOUL.md)", text: soulSystemPrompt(soul) },
79
89
  // a caller's part with one of these ids cannot replace or blank the rule
80
- ...parts.filter((part) => part.id !== "connect-policy" && part.id !== "hidden-ai-text" && part.id !== "grounding"),
90
+ ...parts.filter((part) => part.id !== "connect-policy" && part.id !== "hidden-ai-text" && part.id !== "grounding" && part.id !== "productive-workflow"),
91
+ { id: "productive-workflow", label: "Productive work defaults", text: PRODUCTIVE_WORKFLOW_PROMPT },
81
92
  { id: "connect-policy", label: "Connecting apps (Atomic rule)", text: CONNECT_POLICY_PROMPT },
82
93
  { id: "hidden-ai-text", label: "Text written for an AI (Atomic rule)", text: HIDDEN_AI_TEXT_PROMPT },
83
94
  { id: "grounding", label: "Facts (Atomic rule)", text: GROUNDING_PROMPT },