@chibitek/chibi 0.1.204 → 0.1.206
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.
- package/dist/assets/{TerminalPanel-BR7_5v_A.js → TerminalPanel-BBJ8EeT7.js} +1 -1
- package/dist/assets/{abnfDiagram-O67JEVCF-CLlStcGS.js → abnfDiagram-O67JEVCF-a06YszXx.js} +1 -1
- package/dist/assets/{arc-BHbaT-sk.js → arc-Fe3WbFfc.js} +1 -1
- package/dist/assets/{architectureDiagram-NJMV4G6O-WbYeclYS.js → architectureDiagram-NJMV4G6O-DYcb0ZrL.js} +1 -1
- package/dist/assets/{blockDiagram-BEXU5L5S-BjLSSFCv.js → blockDiagram-BEXU5L5S-xC5y8We2.js} +1 -1
- package/dist/assets/{c4Diagram-YGBWAQC7-BD0ADRml.js → c4Diagram-YGBWAQC7-Dm81dUJa.js} +1 -1
- package/dist/assets/channel-D3ihDYTR.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-6KX_NidY.js → chunk-2Q5K7J3B-CDVJUGUd.js} +1 -1
- package/dist/assets/{chunk-3FUC2YCW-DD5c2wxN.js → chunk-3FUC2YCW-BvPx7oJb.js} +2 -2
- package/dist/assets/{chunk-5VM5RSS4-CqVhfBe4.js → chunk-5VM5RSS4-kUQxxDSH.js} +1 -1
- package/dist/assets/{chunk-GTNCS2PH-BkDNK4_N.js → chunk-GTNCS2PH-hmSLPBzT.js} +1 -1
- package/dist/assets/{chunk-GWA4HPMP-18kKc3zf.js → chunk-GWA4HPMP-ivlnCC25.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-pq9dw6Nh.js → chunk-JWPE2WC7-hjxL5olg.js} +1 -1
- package/dist/assets/{chunk-NETBCI7D-o8wzQe-h.js → chunk-NETBCI7D-ClgHcSe7.js} +1 -1
- package/dist/assets/{chunk-WEXAMYUT-iH237f6j.js → chunk-WEXAMYUT-1i-fNDpg.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-FW6F9gXF.js → chunk-XXDRQBXY-BhPdm5u4.js} +1 -1
- package/dist/assets/{classDiagram-v2-NBCMYWYE-DN_wA2Iu.js → classDiagram-v2-NBCMYWYE-BsL-gKkF.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-BuC_Xux8.js → cose-bilkent-JH36ORCC-piSPlA0p.js} +1 -1
- package/dist/assets/{cynefin-OW5HDTMX-utuaVwac.js → cynefin-OW5HDTMX-D2T5q7wD.js} +1 -1
- package/dist/assets/{cynefinDiagram-VND7K2PF-B5dHHkET.js → cynefinDiagram-VND7K2PF-CWHt2804.js} +1 -1
- package/dist/assets/{dagre-6A5THRUB-Dd4zswKZ.js → dagre-6A5THRUB-BNioVBDz.js} +1 -1
- package/dist/assets/{diagram-22UHCM2B-W1xZAePS.js → diagram-22UHCM2B-DULW9a3n.js} +1 -1
- package/dist/assets/{diagram-3UASUU5V-ytF3T-6m.js → diagram-3UASUU5V-EYvilvye.js} +1 -1
- package/dist/assets/{diagram-ATOU4E4O-DZUm9qqt.js → diagram-ATOU4E4O-BRkFLoxi.js} +1 -1
- package/dist/assets/{diagram-CDSNMT55-s0fp6jUL.js → diagram-CDSNMT55-B0IbbTpB.js} +1 -1
- package/dist/assets/{diagram-MLGK6HIB-DyRhGqmG.js → diagram-MLGK6HIB-u7n_3e2v.js} +1 -1
- package/dist/assets/{diagram-MPIPVDR6-CaIIQRhj.js → diagram-MPIPVDR6-NegomnHr.js} +1 -1
- package/dist/assets/{ebnfDiagram-ZINNZB2B-CsTrai7W.js → ebnfDiagram-ZINNZB2B-BPZmiseK.js} +1 -1
- package/dist/assets/{elk-276RUBZZ-CRc9CYMO.js → elk-276RUBZZ-BcBEThvp.js} +1 -1
- package/dist/assets/{erDiagram-OPXOYQCR-Ci3J3HOK.js → erDiagram-OPXOYQCR-BVAGByE5.js} +1 -1
- package/dist/assets/{flowDiagram-KWPJA3E3-CiNdncgv.js → flowDiagram-KWPJA3E3-ByZ1IyAE.js} +1 -1
- package/dist/assets/{ganttDiagram-FUAMR5RP-B0fkV-ZJ.js → ganttDiagram-FUAMR5RP-CEa3O2pJ.js} +1 -1
- package/dist/assets/{gitGraphDiagram-X574FWY7-CoxvyRBO.js → gitGraphDiagram-X574FWY7-dul-ZoaX.js} +1 -1
- package/dist/assets/index-Bi3hprmz.css +1 -0
- package/dist/assets/{index-DwuiJpCH.js → index-CFUbzTrj.js} +1 -1
- package/dist/assets/{index-DY2xQYkO.js → index-Tw4-5a-J.js} +155 -155
- package/dist/assets/{infoDiagram-VRGFBTTK-Cjwbpd4N.js → infoDiagram-VRGFBTTK-Bt9KS597.js} +1 -1
- package/dist/assets/{ishikawaDiagram-OU5B5YK6-BD2-4Y-q.js → ishikawaDiagram-OU5B5YK6-BjJTuEjh.js} +1 -1
- package/dist/assets/{journeyDiagram-ZHPQQLJL-BHmIniXX.js → journeyDiagram-ZHPQQLJL-j07hDjg4.js} +1 -1
- package/dist/assets/{kanban-definition-PNTS6WVX-DrCw5Y3V.js → kanban-definition-PNTS6WVX-DU8baSEs.js} +1 -1
- package/dist/assets/{linear-BZ0XZy8S.js → linear-Dj1tr9Bh.js} +1 -1
- package/dist/assets/{mermaid.core-D8Rkm6x8.js → mermaid.core-BeSGZMCl.js} +5 -5
- package/dist/assets/{mindmap-definition-NLK3R4M7-BJNrLsxL.js → mindmap-definition-NLK3R4M7-LiRl-Bq2.js} +1 -1
- package/dist/assets/{pegDiagram-GJSIUBJH-vv5pMKB3.js → pegDiagram-GJSIUBJH-COL7EWof.js} +1 -1
- package/dist/assets/{pieDiagram-5QR66LMP-BmKrvr-Q.js → pieDiagram-5QR66LMP-BnMXaara.js} +1 -1
- package/dist/assets/{quadrantDiagram-O4NWA36T-BPbUBZ0J.js → quadrantDiagram-O4NWA36T-BjLcZ6bG.js} +1 -1
- package/dist/assets/{railroadDiagram-XR7U4H2S-BAIvR6OT.js → railroadDiagram-XR7U4H2S-wKCzKLAA.js} +1 -1
- package/dist/assets/{requirementDiagram-PLB6GJNP-19eXNruJ.js → requirementDiagram-PLB6GJNP-BjoTwmZ-.js} +1 -1
- package/dist/assets/{sankeyDiagram-IPEJSGJF-C9byyYhZ.js → sankeyDiagram-IPEJSGJF-CuGyR0Tn.js} +1 -1
- package/dist/assets/{sequenceDiagram-PO4LG4MO-J451N9gP.js → sequenceDiagram-PO4LG4MO-DxOzUuSx.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-h_eW-84j.js → sizeCapture-INFHLROL-B-bTrmx9.js} +1 -1
- package/dist/assets/{stateDiagram-v2-GCMORJYK-CbWBRuzI.js → stateDiagram-v2-GCMORJYK-D6ZflrZQ.js} +1 -1
- package/dist/assets/{swimlanes-2SLR337P-BGWsOai2.js → swimlanes-2SLR337P-DKgdDJlH.js} +1 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-DSlLxTUH.js +8 -0
- package/dist/assets/{timeline-definition-EJHVYXUP-M_CjZAFy.js → timeline-definition-EJHVYXUP-Dli4hqxc.js} +1 -1
- package/dist/assets/{usecaseDiagram-POWQR4AR-BPzYYGGa.js → usecaseDiagram-POWQR4AR-CQ8Cc1rN.js} +1 -1
- package/dist/assets/{vennDiagram-UO4OBE2U-Ch74mbiF.js → vennDiagram-UO4OBE2U-JEu7ZkzA.js} +1 -1
- package/dist/assets/{wardleyDiagram-VNRHLVJA-TAuQdz0L.js → wardleyDiagram-VNRHLVJA-DkFigbd0.js} +1 -1
- package/dist/assets/{xychartDiagram-PMCCYNJV-Pb3KiukR.js → xychartDiagram-PMCCYNJV-DwOctln8.js} +1 -1
- package/dist/index.html +2 -2
- package/dist-server/companion/src/routes.js +10 -0
- package/dist-server/container-mcp.js +81 -81
- package/dist-server/drivers/agents-proxy.js +183 -83
- package/dist-server/index.js +3608 -3149
- package/dist-server/openmausbot.js +576 -566
- package/dist-server/pair-cli.js +576 -566
- package/dist-server/server/apple-account-tools.js +83 -0
- package/dist-server/server/apple-data.js +236 -0
- package/dist-server/server/bot-package.js +3 -2
- package/dist-server/server/drivers/agents-catalog.js +2 -2
- package/dist-server/server/harness-import/adapters.js +13 -1
- package/dist-server/server/harness-import/apply.js +21 -41
- package/dist-server/server/harness-import/cli-skills.js +124 -0
- package/dist-server/server/harness-import/convert.js +2 -2
- package/dist-server/server/harness-import/grokbot.js +36 -0
- package/dist-server/server/harness-import/hermes.js +3 -2
- package/dist-server/server/index.js +15 -13
- package/dist-server/server/marketplace-search.js +25 -6
- package/dist-server/server/model-evidence-context.js +7 -0
- package/dist-server/server/model-evidence.js +6 -1
- package/dist-server/server/oauth-account-core.js +4 -1
- package/dist-server/server/oauth-account-internal.js +4 -2
- package/dist-server/server/oauth-account-tools.js +14 -11
- package/dist-server/server/personal-bot.js +3 -0
- package/dist-server/server/routes/accounts.js +22 -4
- package/dist-server/server/system-prompt.js +3 -3
- package/dist-server/shared/marketplace-match.js +16 -2
- package/dist-server/shared/model-evidence.js +13 -0
- package/dist-server/shared/oauth-providers.js +18 -5
- package/dist-server/vps-container-mcp.js +81 -81
- package/package.json +1 -1
- package/skills/reverse-engineer-anything/LICENSE-rea-agents.txt +21 -0
- package/skills/reverse-engineer-anything/SKILL.md +356 -0
- package/skills/reverse-engineer-anything/VENDORED.md +46 -0
- package/skills/reverse-engineer-anything/manifest.json +21 -0
- package/skills/reverse-engineer-anything/references/android-applications.md +36 -0
- package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
- package/skills/reverse-engineer-anything/references/evidence-workflows.md +71 -0
- package/skills/reverse-engineer-anything/references/javascript-applications.md +218 -0
- package/skills/reverse-engineer-anything/references/native-and-artifacts.md +297 -0
- package/skills/reverse-engineer-anything/references/runtime-observation.md +78 -0
- package/dist/assets/channel-ByXDKjNr.js +0 -1
- package/dist/assets/index-C36j3Mf7.css +0 -1
- package/dist/assets/swimlanesDiagram-TC7HE7FX-Dye77wGY.js +0 -8
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
// neutral harness model. It never lists an agent folder, so it never learns
|
|
3
3
|
// the names of the stores that sit beside profile.json. It lists only the
|
|
4
4
|
// memory/ folder, whose markdown notes are the bot's own memory.
|
|
5
|
+
import { existsSync, statSync } from "node:fs";
|
|
6
|
+
import { homedir } from "node:os";
|
|
7
|
+
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
5
8
|
import { parse as parseYaml } from "yaml";
|
|
6
9
|
import { DEFAULT_RULES } from "./rules.js";
|
|
7
10
|
import { createSourceReader, MAX_MEMORY_FILE_BYTES } from "./source-reader.js";
|
|
@@ -262,3 +265,36 @@ export function skillFrontmatter(content) {
|
|
|
262
265
|
body: match[2] ?? "",
|
|
263
266
|
};
|
|
264
267
|
}
|
|
268
|
+
/** Where a typed or picked path points, as a Grok Bot backup root. Choosing
|
|
269
|
+
* the `agent-data` folder itself is accepted and means its parent. */
|
|
270
|
+
export function checkBackupFolder(input) {
|
|
271
|
+
if (typeof input !== "string" || !input.trim()) {
|
|
272
|
+
return { ok: false, code: "path_required", error: "Choose the folder that holds your Grok Bot backup." };
|
|
273
|
+
}
|
|
274
|
+
if (input.length > 4096 || input.includes("\0"))
|
|
275
|
+
return { ok: false, code: "not_found", error: "That folder does not exist." };
|
|
276
|
+
let path = input.trim();
|
|
277
|
+
if (path === "~" || path.startsWith("~/"))
|
|
278
|
+
path = join(homedir(), path.slice(1));
|
|
279
|
+
if (!isAbsolute(path)) {
|
|
280
|
+
return { ok: false, code: "not_absolute", error: "Enter the full path to the backup folder, for example /Users/you/Downloads/grokbot-backup." };
|
|
281
|
+
}
|
|
282
|
+
path = resolve(path);
|
|
283
|
+
if (!existsSync(path))
|
|
284
|
+
return { ok: false, code: "not_found", error: "That folder does not exist." };
|
|
285
|
+
if (!statSync(path).isDirectory())
|
|
286
|
+
return { ok: false, code: "not_folder", error: "That path is a file. Choose the backup folder instead." };
|
|
287
|
+
const isBackup = (root) => {
|
|
288
|
+
const agents = join(root, "agent-data", "agents");
|
|
289
|
+
return existsSync(agents) && statSync(agents).isDirectory();
|
|
290
|
+
};
|
|
291
|
+
if (isBackup(path))
|
|
292
|
+
return { ok: true, root: path };
|
|
293
|
+
if (basename(path) === "agent-data" && isBackup(dirname(path)))
|
|
294
|
+
return { ok: true, root: dirname(path) };
|
|
295
|
+
return {
|
|
296
|
+
ok: false,
|
|
297
|
+
code: "not_grokbot",
|
|
298
|
+
error: "This folder is not a Grok Bot backup. Choose the folder that contains agent-data.",
|
|
299
|
+
};
|
|
300
|
+
}
|
|
@@ -322,7 +322,8 @@ function readRoutines(reader, profile, config) {
|
|
|
322
322
|
};
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
|
-
|
|
325
|
+
/** SKILL.md plus the text files under references/ and scripts/. Shared with the CLI skills adapter. */
|
|
326
|
+
export function readSkillFolder(reader, dir) {
|
|
326
327
|
const main = reader.readText(`${dir}/SKILL.md`);
|
|
327
328
|
if (main === null)
|
|
328
329
|
return null;
|
|
@@ -369,7 +370,7 @@ function bundledSkills(reader, profile) {
|
|
|
369
370
|
const text = reader.readText(`${profile.base}skills/.bundled_manifest`) ?? "";
|
|
370
371
|
return new Set(text.split(/\r?\n/).map((line) => line.split(":")[0].trim()).filter(Boolean));
|
|
371
372
|
}
|
|
372
|
-
const fingerprint = (files) => createHash("sha256").update(files.map((file) => `${file.file}\0${file.content.replace(/\r\n/g, "\n").trim()}`).join("\0\0")).digest("hex");
|
|
373
|
+
export const fingerprint = (files) => createHash("sha256").update(files.map((file) => `${file.file}\0${file.content.replace(/\r\n/g, "\n").trim()}`).join("\0\0")).digest("hex");
|
|
373
374
|
/** One skill per slug and content across profiles. The version most profiles
|
|
374
375
|
* share keeps the slug; a profile's own edit becomes `<slug>-<profile>`. */
|
|
375
376
|
function mergeSkills(found) {
|
|
@@ -5,7 +5,7 @@ import { SharedDeliverables, createSharedDeliverablesRoutes, sharedDeliverableAc
|
|
|
5
5
|
import { connectionCredentialServer } from "./connection-credential.js";
|
|
6
6
|
import { requestCredentialCard } from "./credential-card-request.js";
|
|
7
7
|
import { invalidateBrokenCheckpoint } from "./checkpoint-recovery.js";
|
|
8
|
-
import { createModelExpectation, ModelEvidenceLedger } from "./model-evidence-context.js";
|
|
8
|
+
import { createModelExpectation, ModelEvidenceLedger, standInReason } from "./model-evidence-context.js";
|
|
9
9
|
import { reactToMessage } from "./message-reactions.js";
|
|
10
10
|
import { hasUnboundGoalGuard, goalGuardForEvent, addGoalGuard, removeGoalGuard, runPersonalGoalTurn, updatePersonalGoalReceipt } from "./personal-goal-turn.js";
|
|
11
11
|
import { PersonalGoalRuntime, receiveGoalCommand } from "./personal-goal-runtime.js";
|
|
@@ -287,6 +287,7 @@ import { OAuthAccounts, takeOAuthClients } from "./oauth-accounts.js";
|
|
|
287
287
|
import { DesktopAccountVault, FileAccountVault, UnavailableAccountVault, takeAccountsFromEnvironment } from "./oauth-account-vault.js";
|
|
288
288
|
import { accountConnectorNames } from "./claude-account-connectors.js";
|
|
289
289
|
import { accountsInternalResponse, allowedAccounts } from "./oauth-account-internal.js";
|
|
290
|
+
import { createAppleAccount } from "./apple-data.js";
|
|
290
291
|
import { connectedAccountProviders, effectiveBotAccountIds } from "../shared/oauth-account-grants.js";
|
|
291
292
|
import { isReadOnlyAccountTool, ACCOUNT_TOOLS } from "./oauth-account-tools.js";
|
|
292
293
|
import { ACCOUNT_ID, botAccountIds } from "../shared/oauth-providers.js";
|
|
@@ -1249,6 +1250,7 @@ const accountVault = process.env.OMB_CREDENTIAL_STORE === "unavailable"
|
|
|
1249
1250
|
? new DesktopAccountVault(savedOAuthAccounts, postDesktopPrivateMessage)
|
|
1250
1251
|
: new FileAccountVault(DATA_DIR);
|
|
1251
1252
|
const oauthAccounts = new OAuthAccounts({ vault: accountVault, clients: oauthClients });
|
|
1253
|
+
const apple = createAppleAccount({ oauth: oauthAccounts, personal: () => personalCfg(), savePersonal: (value) => savePersonalConfig(value) });
|
|
1252
1254
|
// MCP server secrets go to the same encrypted store, through the same
|
|
1253
1255
|
// private channel (server/mcp-secrets.ts).
|
|
1254
1256
|
if (DESKTOP_MANAGED && utilityParentPort)
|
|
@@ -2158,7 +2160,7 @@ function accountsIntegration(botId, threadId, generation) {
|
|
|
2158
2160
|
}
|
|
2159
2161
|
/** Emails of the accounts a bot may use, for its system prompt. */
|
|
2160
2162
|
function botAccountEmails(bot) {
|
|
2161
|
-
return allowedAccounts(accountScopedBot(bot),
|
|
2163
|
+
return allowedAccounts(accountScopedBot(bot), apple.accounts).map((account) => account.email);
|
|
2162
2164
|
}
|
|
2163
2165
|
/** Rule 4 (server/personal-bot.ts): the Google and Microsoft accounts a bot
|
|
2164
2166
|
* may use. The Private Bot only the ones the person marked Personal; every
|
|
@@ -2170,7 +2172,7 @@ function accountScopedBot(bot) {
|
|
|
2170
2172
|
const requested = effectiveBotAccountIds({
|
|
2171
2173
|
bot,
|
|
2172
2174
|
policy: accountBotGrantPolicy(cfg),
|
|
2173
|
-
connectedIds: oauthAccounts.accounts().map((account) => account.id),
|
|
2175
|
+
connectedIds: [...oauthAccounts.accounts().map((account) => account.id), ...apple.connectedIds()],
|
|
2174
2176
|
personalIds: personal,
|
|
2175
2177
|
});
|
|
2176
2178
|
return { ...bot, accounts: connectionsFor(bot, requested, personal) };
|
|
@@ -9859,8 +9861,8 @@ async function startTurn(botId, text, opts) {
|
|
|
9859
9861
|
// busy flips immediately so the composer locks; the dispatch itself runs
|
|
9860
9862
|
// in the background — box provisioning can take ~90s and must never
|
|
9861
9863
|
// hang the HTTP request
|
|
9862
|
-
const evidenceAttemptId = expectedModel ? modelEvidence.begin({ ...expectedModel, requestedModel: model,
|
|
9863
|
-
|
|
9864
|
+
const evidenceAttemptId = expectedModel ? modelEvidence.begin({ ...expectedModel, requestedModel: model, instanceId: instance.instanceId,
|
|
9865
|
+
provider: instance.driverKind }, Boolean(failover), standInReason(failover, engineChoice, projectedBot?.modelSelection)) : undefined;
|
|
9864
9866
|
const dispatchClaimId = randomUUID();
|
|
9865
9867
|
const resourceOwner = { threadId, generation: dispatchClaimId };
|
|
9866
9868
|
turnResourceOwners.set(threadId, resourceOwner);
|
|
@@ -13646,7 +13648,7 @@ function botInterviewContext(mode) {
|
|
|
13646
13648
|
tools.push({ id: `mcp:${name}`, kind: "mcp", name: isChibitekMochii(parsed.server) ? "mochii" : isChibitekNexus(parsed.server) ? "nexus" : name, status });
|
|
13647
13649
|
}
|
|
13648
13650
|
const accounts = oauthAccounts.status();
|
|
13649
|
-
for (const provider of accounts.providers) {
|
|
13651
|
+
for (const provider of [...accounts.providers, apple.status()]) {
|
|
13650
13652
|
for (const account of provider.accounts) {
|
|
13651
13653
|
if (!mine("accounts", account.id))
|
|
13652
13654
|
continue;
|
|
@@ -13657,7 +13659,7 @@ function botInterviewContext(mode) {
|
|
|
13657
13659
|
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC",
|
|
13658
13660
|
takenNames: store.bots.filter((bot) => !bot.hidden).map((bot) => bot.name),
|
|
13659
13661
|
tools,
|
|
13660
|
-
accountProviders: accounts.storage === "unavailable" ? [] : accounts.providers.
|
|
13662
|
+
accountProviders: accounts.storage === "unavailable" ? [] : accounts.providers.flatMap((provider) => provider.configured && provider.id !== "apple" ? [provider.id] : []),
|
|
13661
13663
|
};
|
|
13662
13664
|
}
|
|
13663
13665
|
function connectorThread(botId, threadId) {
|
|
@@ -15866,7 +15868,7 @@ ROUTES.push(createPersonalBotRoutes({
|
|
|
15866
15868
|
},
|
|
15867
15869
|
connections: () => personalCfg().connections,
|
|
15868
15870
|
setConnection: (kind, id, personal) => {
|
|
15869
|
-
const exists = kind === "mcpServers" ? Object.hasOwn(cfg.mcpServers ?? {}, id) : Boolean(
|
|
15871
|
+
const exists = kind === "mcpServers" ? Object.hasOwn(cfg.mcpServers ?? {}, id) : Boolean(apple.accounts.account(id));
|
|
15870
15872
|
if (!exists)
|
|
15871
15873
|
return { ok: false, status: 404, error: kind === "mcpServers" ? "no such MCP server" : "no such account" };
|
|
15872
15874
|
savePersonalConfig(withPersonalConnection(cfg.personal, kind, id, personal));
|
|
@@ -16019,7 +16021,7 @@ if (process.env.OMB_MODEL_LEVELS_REFRESH !== "0")
|
|
|
16019
16021
|
setTimeout(() => void describeInstances().catch(() => { }), 0).unref?.();
|
|
16020
16022
|
// Settings → Accounts: Google and Microsoft sign-in (server/routes/accounts.ts).
|
|
16021
16023
|
ROUTES.push(createAccountRoutes({
|
|
16022
|
-
accounts: oauthAccounts, grantPolicy: () => accountBotGrantPolicy(cfg),
|
|
16024
|
+
accounts: oauthAccounts, grantPolicy: () => accountBotGrantPolicy(cfg), apple: apple.routes,
|
|
16023
16025
|
removedFromBots: (accountId) => {
|
|
16024
16026
|
for (const bot of store.bots) {
|
|
16025
16027
|
const ids = botAccountIds(bot);
|
|
@@ -18705,7 +18707,7 @@ const handleRequest = async (req, res) => {
|
|
|
18705
18707
|
return json(res, 200, {
|
|
18706
18708
|
text: card.source === "none"
|
|
18707
18709
|
? `A card now offers to send "${card.query}" to Chibitek as an idea. Say in one sentence that it isn't available in the Marketplace yet and offer that. Stop there; do not suggest building anything.`
|
|
18708
|
-
: `A card with a button to connect ${card.name} in Settings > Marketplace is now in the conversation. Answer in one or two plain sentences that point to it.`,
|
|
18710
|
+
: `A card with a button to connect ${card.name} in Settings > ${card.source === "account" ? "Accounts" : "Marketplace"} is now in the conversation. Answer in one or two plain sentences that point to it.`,
|
|
18709
18711
|
});
|
|
18710
18712
|
}
|
|
18711
18713
|
if (method === "POST" && path === "/api/internal/request-credential") {
|
|
@@ -18725,7 +18727,7 @@ const handleRequest = async (req, res) => {
|
|
|
18725
18727
|
const currentSender = store.bot(internalCapability.botId);
|
|
18726
18728
|
if (!currentSender)
|
|
18727
18729
|
return json(res, 401, { error: INTERNAL_CAPABILITY_BOT_GONE });
|
|
18728
|
-
const answer = await accountsInternalResponse({ method, path, body, bot: accountScopedBot(currentSender), accounts:
|
|
18730
|
+
const answer = await accountsInternalResponse({ method, path, body, bot: accountScopedBot(currentSender), accounts: apple.accounts, apple: apple.client });
|
|
18729
18731
|
if (!answer)
|
|
18730
18732
|
return json(res, 404, { error: "not found" });
|
|
18731
18733
|
res.setHeader("cache-control", "no-store");
|
|
@@ -21072,7 +21074,7 @@ const handleRequest = async (req, res) => {
|
|
|
21072
21074
|
}
|
|
21073
21075
|
else {
|
|
21074
21076
|
const requested = [...new Set(body.accounts)];
|
|
21075
|
-
const unknown = requested.find((id) => !
|
|
21077
|
+
const unknown = requested.find((id) => !apple.accounts.account(id));
|
|
21076
21078
|
if (unknown)
|
|
21077
21079
|
return json(res, 400, { error: "That account is not connected. Connect it in Settings → Accounts first." });
|
|
21078
21080
|
patch.accounts = requested.length ? requested : undefined;
|
|
@@ -25443,7 +25445,7 @@ const gracefulShutdown = createGracefulShutdown({
|
|
|
25443
25445
|
webhookIngress?.server.close();
|
|
25444
25446
|
tunnelListener?.close();
|
|
25445
25447
|
},
|
|
25446
|
-
async () => { await managedDesktop.close(); await registry.disposeAll(); },
|
|
25448
|
+
async () => { apple.client.dispose(); await managedDesktop.close(); await registry.disposeAll(); },
|
|
25447
25449
|
async () => {
|
|
25448
25450
|
await Promise.all([...temporaryBrowserSessions.keys()].map((botId) => forgetTemporaryBrowser(botId)));
|
|
25449
25451
|
await browserRuntime.closeAll();
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// What the bots' marketplace_search and open_marketplace tools look up
|
|
2
|
-
// (agents-catalog.ts). Only
|
|
2
|
+
// (agents-catalog.ts). Only three kinds of entry count as available:
|
|
3
|
+
// account an account built into Atomic (Settings > Accounts), such as
|
|
4
|
+
// this Mac's Apple Calendar, Reminders, Contacts and iCloud Drive
|
|
3
5
|
// featured an official, vendor-run server Atomic connects directly
|
|
4
6
|
// (shared/mcp-featured.ts, each URL checked)
|
|
5
7
|
// claude the vendor's official connector in the person's Claude account
|
|
@@ -7,15 +9,18 @@
|
|
|
7
9
|
// Community and individual-developer servers are never offered: Atomic cannot
|
|
8
10
|
// tell where they send the person's data.
|
|
9
11
|
import { CLAUDE_CONNECTORS_URL } from "../shared/claude-connectors.js";
|
|
10
|
-
import { claudeConnectorMatches, featuredMatches } from "../shared/marketplace-match.js";
|
|
12
|
+
import { accountMatches, claudeConnectorMatches, featuredMatches } from "../shared/marketplace-match.js";
|
|
11
13
|
export const MARKETPLACE_QUERY_MAX = 80;
|
|
12
14
|
export function cleanMarketplaceQuery(value) {
|
|
13
15
|
return typeof value === "string" ? value.replace(/\s+/g, " ").trim().slice(0, MARKETPLACE_QUERY_MAX) : "";
|
|
14
16
|
}
|
|
15
|
-
export function searchMarketplace(query) {
|
|
17
|
+
export function searchMarketplace(query, platform = process.platform) {
|
|
16
18
|
return {
|
|
17
19
|
query,
|
|
18
20
|
matches: [
|
|
21
|
+
...accountMatches(query, platform).map((account) => ({
|
|
22
|
+
serverId: `account:${account.provider}`, name: account.name, description: account.description, source: "account",
|
|
23
|
+
})),
|
|
19
24
|
...featuredMatches(query).map((server) => ({
|
|
20
25
|
serverId: `featured:${server.id}`, name: server.name, description: server.description, source: "featured",
|
|
21
26
|
})),
|
|
@@ -25,21 +30,33 @@ export function searchMarketplace(query) {
|
|
|
25
30
|
],
|
|
26
31
|
};
|
|
27
32
|
}
|
|
28
|
-
/** The entry a card should show:
|
|
29
|
-
* directly
|
|
33
|
+
/** The entry a card should show: an account built into Atomic first, then a
|
|
34
|
+
* vendor's own server Atomic connects directly, then the person's Claude
|
|
35
|
+
* account. */
|
|
30
36
|
export function bestMarketplaceMatch(result, serverId) {
|
|
31
37
|
if (serverId) {
|
|
32
38
|
const named = result.matches.find((match) => match.serverId === serverId);
|
|
33
39
|
if (named)
|
|
34
40
|
return named;
|
|
35
41
|
}
|
|
36
|
-
|
|
42
|
+
for (const source of ["account", "featured", "claude"]) {
|
|
43
|
+
const match = result.matches.find((entry) => entry.source === source);
|
|
44
|
+
if (match)
|
|
45
|
+
return match;
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
37
48
|
}
|
|
38
49
|
/** What marketplace_search tells the bot. Plain, and short enough to read. */
|
|
39
50
|
export function marketplaceSearchText(result, opts) {
|
|
40
51
|
const lines = [];
|
|
52
|
+
const accounts = result.matches.filter((match) => match.source === "account");
|
|
41
53
|
const featured = result.matches.filter((match) => match.source === "featured");
|
|
42
54
|
const claude = result.matches.filter((match) => match.source === "claude");
|
|
55
|
+
if (accounts.length) {
|
|
56
|
+
lines.push("Built into Atomic, in Settings > Accounts (no server to add; the person turns on each part there, then allows the account for a bot under Access, and list_accounts shows it):");
|
|
57
|
+
for (const match of accounts)
|
|
58
|
+
lines.push(`- ${match.name} (server_id ${match.serverId}): ${match.description}`);
|
|
59
|
+
}
|
|
43
60
|
if (featured.length) {
|
|
44
61
|
lines.push("Official, ready in the Marketplace:");
|
|
45
62
|
for (const match of featured)
|
|
@@ -70,6 +87,8 @@ export function marketplaceCard(result, serverId) {
|
|
|
70
87
|
export function marketplaceCardText(card) {
|
|
71
88
|
if (card.source === "none")
|
|
72
89
|
return `${card.name} isn't available in the Marketplace yet. You can send it to Chibitek as an idea.`;
|
|
90
|
+
if (card.source === "account")
|
|
91
|
+
return `Connect ${card.name}: Settings > Accounts.`;
|
|
73
92
|
if (card.source === "claude")
|
|
74
93
|
return `Connect ${card.name} through your Claude account: Settings > Marketplace.`;
|
|
75
94
|
return `Connect ${card.name}: Settings > Marketplace.`;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export { ModelEvidenceLedger } from "./model-evidence.js";
|
|
2
2
|
// Snapshot the same class choices the model picker displays before routing mutates the task.
|
|
3
3
|
import { threadEngineMode } from "../shared/engine-tiers.js";
|
|
4
|
+
/** A pinned or hand-picked engine passed over at start (resting, signed
|
|
5
|
+
* out, not installed) is a fallback hop like a mid-turn switch, so the
|
|
6
|
+
* evidence counts it and the stand-in is never read as the thread's own.
|
|
7
|
+
* A tier's ladder pick (persist) re-points the thread: its own choice. */
|
|
8
|
+
export function standInReason(failover, choice, own) {
|
|
9
|
+
return !failover && choice && !choice.persist && own && choice.selection.instanceId !== own.instanceId ? "own engine unavailable at start" : undefined;
|
|
10
|
+
}
|
|
4
11
|
export function createModelExpectation(context) {
|
|
5
12
|
return (threadId, instanceId, provider) => {
|
|
6
13
|
const profile = context.store.botByThread(threadId) ?? context.store.bot(context.speakerBot(threadId) ?? "");
|
|
@@ -12,11 +12,16 @@ export class ModelEvidenceLedger {
|
|
|
12
12
|
failures = 0;
|
|
13
13
|
dataDir;
|
|
14
14
|
constructor(dataDir) { this.dataDir = dataDir; }
|
|
15
|
-
|
|
15
|
+
/** `standIn`: the turn starts on an engine other than the thread's own
|
|
16
|
+
* (its own was resting, signed out or not installed), so no mid-turn
|
|
17
|
+
* switch will record the hop: it is written as a fallback here. */
|
|
18
|
+
begin(expected, continuation = false, standIn) {
|
|
16
19
|
const prior = this.active.get(expected.threadId);
|
|
17
20
|
const attempt = { expected: { ...expected, ...(continuation && prior ? { label: prior.expected.label, modelClass: prior.expected.modelClass, model: prior.expected.model } : {}) }, logicalTurnId: continuation && prior ? prior.logicalTurnId : randomUUID(), attemptId: randomUUID() };
|
|
18
21
|
this.active.set(expected.threadId, attempt);
|
|
19
22
|
this.write(attempt, { kind: "dispatch", level: expected.requestedModel || expected.model ? "requested-only" : "unknown" });
|
|
23
|
+
if (standIn)
|
|
24
|
+
this.write(attempt, { kind: "fallback", level: "unknown", reason: standIn });
|
|
20
25
|
return attempt.attemptId;
|
|
21
26
|
}
|
|
22
27
|
finishDispatch(threadId, attemptId) {
|
|
@@ -14,6 +14,9 @@ export const accountArg = { type: "string", description: "Email address of the a
|
|
|
14
14
|
export const EMAIL = /^[^\s@<>,;"]+@[^\s@<>,;"]+\.[^\s@<>,;"]+$/;
|
|
15
15
|
export const noNewlines = (value) => !/[\r\n]/.test(value);
|
|
16
16
|
export const base = z.object({ account: z.string().max(320).optional() });
|
|
17
|
+
export function providerLabel(provider) {
|
|
18
|
+
return provider === "apple" ? "Apple" : OAUTH_PROVIDERS[provider].label;
|
|
19
|
+
}
|
|
17
20
|
export class ToolInputError extends Error {
|
|
18
21
|
}
|
|
19
22
|
export function bounded(text, limit = MAX_RESULT_CHARS) {
|
|
@@ -100,7 +103,7 @@ export async function call(ctx, account, url, init) {
|
|
|
100
103
|
throw new ProviderApiError(403, `${account.email} does not allow this: ${message}`);
|
|
101
104
|
if (response.status === 404)
|
|
102
105
|
throw new ProviderApiError(404, `Not found in ${account.email}: ${message}`);
|
|
103
|
-
throw new ProviderApiError(response.status, `${
|
|
106
|
+
throw new ProviderApiError(response.status, `${providerLabel(account.provider)} refused the request for ${account.email}: ${message}`);
|
|
104
107
|
}
|
|
105
108
|
if (expect === "none") {
|
|
106
109
|
await response.body?.cancel().catch(() => { });
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// bot; this decides, on every call, which accounts that bot may touch.
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { accountProvider, botAccountIds } from "../shared/oauth-providers.js";
|
|
6
|
+
import { providerLabel } from "./apple-account-tools.js";
|
|
6
7
|
import { ACCOUNT_TOOLS, accountToolList, runAccountTool } from "./oauth-account-tools.js";
|
|
7
8
|
/** The connected accounts this bot may use, right now. */
|
|
8
9
|
export function allowedAccounts(bot, accounts) {
|
|
@@ -26,10 +27,10 @@ export async function accountsInternalResponse(input) {
|
|
|
26
27
|
if (!parsed.success)
|
|
27
28
|
return { status: 400, body: { error: "invalid tool call" } };
|
|
28
29
|
if (!allowed.length && parsed.data.name !== "list_accounts")
|
|
29
|
-
return { status: 403, body: { error: "This bot is not allowed to use any
|
|
30
|
+
return { status: 403, body: { error: "This bot is not allowed to use any connected account." } };
|
|
30
31
|
const tool = ACCOUNT_TOOLS.find((entry) => entry.name === parsed.data.name);
|
|
31
32
|
if (tool?.provider && !allowed.some((account) => account.provider === tool.provider)) {
|
|
32
|
-
return { status: 403, body: { error: `This bot is not allowed to use
|
|
33
|
+
return { status: 403, body: { error: `This bot is not allowed to use ${tool.provider === "apple" ? "Apple data" : `a ${providerLabel(tool.provider)} account`}.` } };
|
|
33
34
|
}
|
|
34
35
|
const requested = parsed.data.arguments?.account;
|
|
35
36
|
if (typeof requested === "string" && requested.trim()) {
|
|
@@ -47,6 +48,7 @@ export async function accountsInternalResponse(input) {
|
|
|
47
48
|
allowed,
|
|
48
49
|
accessToken: (id) => input.accounts.accessToken(id),
|
|
49
50
|
invalidate: (id) => input.accounts.invalidate(id),
|
|
51
|
+
...(input.apple ? { apple: input.apple } : {}),
|
|
50
52
|
...(input.fetch ? { fetch: input.fetch } : {}),
|
|
51
53
|
}, parsed.data.name, parsed.data.arguments);
|
|
52
54
|
return { status: 200, body: { text: outcome.text, isError: outcome.isError } };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// The tools a bot gets for its allowed Google and
|
|
1
|
+
// The tools a bot gets for its allowed Google, Microsoft and Apple accounts. The
|
|
2
2
|
// stdio proxy (accounts-proxy.ts) only lists them and forwards calls; every
|
|
3
3
|
// call runs here, in the server, with the chosen account's access token,
|
|
4
4
|
// after the internal route has re-checked that this bot may use it.
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import { OAUTH_PROVIDERS
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { OAUTH_PROVIDERS } from "../shared/oauth-providers.js";
|
|
7
|
+
import { APPLE_FAMILY_LABEL, APPLE_RUNNERS, APPLE_TOOLS, accountMissing } from "./apple-account-tools.js";
|
|
8
|
+
import { CREATES, GRAPH, MAX_DOWNLOAD_BYTES, READS, SENDS, ToolInputError, accountArg, addresses, base, bounded, call, graphRecipient, htmlToText, json, noNewlines, parse, providerLabel, recipient, } from "./oauth-account-core.js";
|
|
9
9
|
import { CALENDAR_RUNNERS, GOOGLE_CALENDAR_TOOLS, OUTLOOK_CALENDAR_TOOLS } from "./oauth-calendar-tools.js";
|
|
10
10
|
import { officeKind, officeText } from "./office-text.js";
|
|
11
11
|
export { ToolInputError } from "./oauth-account-core.js";
|
|
@@ -42,7 +42,7 @@ const draftSchema = {
|
|
|
42
42
|
additionalProperties: false,
|
|
43
43
|
};
|
|
44
44
|
export const ACCOUNT_TOOLS = [
|
|
45
|
-
{ name: "list_accounts", provider: null, description: "List the Google and
|
|
45
|
+
{ name: "list_accounts", provider: null, description: "List the Google, Microsoft and Apple accounts this bot may use, by email.", inputSchema: { type: "object", properties: {}, additionalProperties: false }, annotations: READS, args: listAccountsArgs },
|
|
46
46
|
{ name: "gmail_search", provider: "google", family: "gmail", description: "Search Gmail with Gmail search syntax (e.g. from:alex newer_than:7d). Returns message ids, senders, subjects, dates and snippets.", inputSchema: searchSchema("Gmail search query."), annotations: READS, args: searchArgs },
|
|
47
47
|
{ name: "gmail_read", provider: "google", family: "gmail", description: "Read one Gmail message by id: headers, plain-text body and attachment names.", inputSchema: idSchema("id", "Message id from gmail_search."), annotations: READS, args: idArgs("id") },
|
|
48
48
|
{ name: "gmail_create_draft", provider: "google", family: "gmailSend", description: "Create a plain-text Gmail draft. Nothing is sent until gmail_send_draft.", inputSchema: draftSchema, annotations: CREATES, args: draftArgs },
|
|
@@ -57,6 +57,7 @@ export const ACCOUNT_TOOLS = [
|
|
|
57
57
|
...OUTLOOK_CALENDAR_TOOLS,
|
|
58
58
|
{ name: "onedrive_search", provider: "microsoft", family: "onedrive", description: "Search OneDrive files by words in their name or content.", inputSchema: searchSchema("Words to look for."), annotations: READS, args: searchArgs },
|
|
59
59
|
{ name: "onedrive_read", provider: "microsoft", family: "onedrive", description: "Read a OneDrive file by id: text for small text and Office files, details and a link otherwise.", inputSchema: idSchema("fileId", "File id from onedrive_search."), annotations: READS, args: idArgs("fileId") },
|
|
60
|
+
...APPLE_TOOLS,
|
|
60
61
|
];
|
|
61
62
|
const TOOL_BY_NAME = new Map(ACCOUNT_TOOLS.map((tool) => [tool.name, tool]));
|
|
62
63
|
/** The MCP tools/list entries for a bot whose allowed accounts cover these
|
|
@@ -74,7 +75,7 @@ function describeIssues(error) {
|
|
|
74
75
|
}
|
|
75
76
|
/** Pick the account a call acts as. `account` may be an email or an id. */
|
|
76
77
|
export function resolveAccount(provider, allowed, requested) {
|
|
77
|
-
const label =
|
|
78
|
+
const label = providerLabel(provider);
|
|
78
79
|
const candidates = allowed.filter((account) => account.provider === provider);
|
|
79
80
|
if (!candidates.length)
|
|
80
81
|
throw new ToolInputError(`This bot has no ${label} account. The person can allow one in the bot's settings under Access.`);
|
|
@@ -384,6 +385,7 @@ const RUNNERS = {
|
|
|
384
385
|
outlook_send_draft: outlookSendDraft,
|
|
385
386
|
onedrive_search: onedriveSearch,
|
|
386
387
|
onedrive_read: onedriveRead,
|
|
388
|
+
...APPLE_RUNNERS,
|
|
387
389
|
};
|
|
388
390
|
const FAMILY_LABEL = {
|
|
389
391
|
gmail: "Gmail (reading email)",
|
|
@@ -393,6 +395,7 @@ const FAMILY_LABEL = {
|
|
|
393
395
|
outlook: "Outlook mail",
|
|
394
396
|
outlookCalendar: "Outlook calendar",
|
|
395
397
|
onedrive: "OneDrive",
|
|
398
|
+
...APPLE_FAMILY_LABEL,
|
|
396
399
|
};
|
|
397
400
|
/** Validate, pick the account, and run one tool. Never throws: every
|
|
398
401
|
* failure comes back as an error result the model can read. */
|
|
@@ -410,9 +413,9 @@ export async function runAccountTool(ctx, name, rawArgs) {
|
|
|
410
413
|
accounts: ctx.allowed.map((account) => ({
|
|
411
414
|
id: account.id,
|
|
412
415
|
email: account.email,
|
|
413
|
-
provider:
|
|
414
|
-
status: account.status === "reauth" ? "needs sign-in again" : "signed in",
|
|
415
|
-
missing:
|
|
416
|
+
provider: providerLabel(account.provider),
|
|
417
|
+
status: "status" in account && account.status === "reauth" ? "needs sign-in again" : "signed in",
|
|
418
|
+
missing: accountMissing(account), ...(account.provider === "apple" ? { sensitivity: "personal" } : {}),
|
|
416
419
|
})),
|
|
417
420
|
...(!ctx.allowed.length ? {
|
|
418
421
|
guidance: "This bot cannot use any Google or Microsoft account right now. If none is connected, ask the person to connect one in Settings → Accounts; a connected account works in every bot by default. If one is connected but this bot still sees none, the bot's own Settings → Access list is restricting it. Do not use an LLM account’s connectors instead.",
|
|
@@ -423,9 +426,9 @@ export async function runAccountTool(ctx, name, rawArgs) {
|
|
|
423
426
|
}
|
|
424
427
|
const args = parsed.data;
|
|
425
428
|
const account = resolveAccount(tool.provider, ctx.allowed, args.account);
|
|
426
|
-
if (tool.family &&
|
|
429
|
+
if (tool.family && accountMissing(account).includes(tool.family)) {
|
|
427
430
|
const label = FAMILY_LABEL[tool.family];
|
|
428
|
-
throw new ToolInputError(OAUTH_PROVIDERS[account.provider].incremental
|
|
431
|
+
throw new ToolInputError(account.provider === "apple" || OAUTH_PROVIDERS[account.provider].incremental
|
|
429
432
|
? `${label} is not turned on for ${account.email} yet. Ask the person to open Settings → Accounts and choose "Turn on" next to ${label} for this account.`
|
|
430
433
|
: `${account.email} did not allow ${label} when it was connected. Ask the person to connect it again in Settings → Accounts and allow ${label}.`);
|
|
431
434
|
}
|
|
@@ -2,6 +2,7 @@ import { readFileSync } from "node:fs";
|
|
|
2
2
|
import { readManagedPreferences, parseManagedPreferences } from "../electron/managed-prefs.mjs";
|
|
3
3
|
import { CHIEF_OF_STAFF_BUILTIN } from "../shared/chief-of-staff.js";
|
|
4
4
|
import { isPrimaryBot } from "../shared/primary-bot.js";
|
|
5
|
+
import { appleAccountRecord } from "./apple-data.js";
|
|
5
6
|
import { DRIVER_BILLING } from "../shared/provider-accounts.js";
|
|
6
7
|
import { PERSONAL_BOT_REFUSALS, isEngineOwner, isPersonalBot, personalBotNameError, } from "../shared/personal-bot.js";
|
|
7
8
|
import { isSubscriptionBot } from "../shared/subscription-bots.js";
|
|
@@ -13,6 +14,7 @@ export function personalConfig(raw) {
|
|
|
13
14
|
const owners = record(value.engineOwners);
|
|
14
15
|
const connections = record(value.connections);
|
|
15
16
|
const migrated = value.ownersMigratedAt;
|
|
17
|
+
const appleAccount = appleAccountRecord(value.appleAccount);
|
|
16
18
|
return {
|
|
17
19
|
engineOwners: Object.fromEntries(Object.entries(owners).filter(([id, owner]) => NAME.test(id) && isEngineOwner(owner))),
|
|
18
20
|
connections: { mcpServers: names(connections.mcpServers), accounts: names(connections.accounts) },
|
|
@@ -20,6 +22,7 @@ export function personalConfig(raw) {
|
|
|
20
22
|
readWorkMemory: value.readWorkMemory !== false,
|
|
21
23
|
chibiLink: value.chibiLink !== false,
|
|
22
24
|
...(typeof migrated === "number" && Number.isFinite(migrated) ? { ownersMigratedAt: migrated } : {}),
|
|
25
|
+
...(appleAccount ? { appleAccount } : {}),
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
/** The value to store after one instance's owner changes. */
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { ACCOUNT_ID, incrementalFamilies, isAccountToolFamily, isOAuthProviderId } from "../../shared/oauth-providers.js";
|
|
1
|
+
import { ACCOUNT_ID, APPLE_ACCOUNT_ID, incrementalFamilies, isAccountToolFamily, isOAuthProviderId } from "../../shared/oauth-providers.js";
|
|
2
2
|
import { OAuthError } from "../oauth-accounts.js";
|
|
3
3
|
import { PASS } from "./table.js";
|
|
4
4
|
const SESSION_PATH = /^\/api\/accounts\/connect\/([0-9a-f-]{36})$/;
|
|
5
5
|
const ACCOUNT_PATH = /^\/api\/accounts\/([^/]+)$/;
|
|
6
6
|
export function createAccountRoutes(deps) {
|
|
7
|
+
const status = () => {
|
|
8
|
+
const oauth = deps.accounts.status();
|
|
9
|
+
return { ...oauth, providers: deps.apple ? [...oauth.providers, deps.apple.status()] : oauth.providers, botGrant: deps.grantPolicy() };
|
|
10
|
+
};
|
|
7
11
|
return async ({ req, res, path, method, auth, json, readBody }) => {
|
|
8
12
|
if (path !== "/api/accounts" && !path.startsWith("/api/accounts/"))
|
|
9
13
|
return PASS;
|
|
@@ -16,7 +20,20 @@ export function createAccountRoutes(deps) {
|
|
|
16
20
|
if (path === "/api/accounts") {
|
|
17
21
|
if (method !== "GET")
|
|
18
22
|
return json(res, 405, { error: "method not allowed" });
|
|
19
|
-
return json(res, 200,
|
|
23
|
+
return json(res, 200, status());
|
|
24
|
+
}
|
|
25
|
+
if (path === "/api/accounts/apple/families") {
|
|
26
|
+
if (method !== "POST")
|
|
27
|
+
return json(res, 405, { error: "method not allowed" });
|
|
28
|
+
if (!deps.apple)
|
|
29
|
+
return json(res, 404, { error: "Apple data is not available on this computer." });
|
|
30
|
+
const body = (await readBody(req).catch(() => null));
|
|
31
|
+
if (!isAccountToolFamily("apple", body?.family))
|
|
32
|
+
return json(res, 400, { error: "family must be an Apple family" });
|
|
33
|
+
const refused = await deps.apple.turnOn(body.family);
|
|
34
|
+
if (refused)
|
|
35
|
+
return json(res, 409, { error: refused });
|
|
36
|
+
return json(res, 200, status());
|
|
20
37
|
}
|
|
21
38
|
if (path === "/api/accounts/connect") {
|
|
22
39
|
if (method !== "POST")
|
|
@@ -74,10 +91,11 @@ export function createAccountRoutes(deps) {
|
|
|
74
91
|
}
|
|
75
92
|
if (!ACCOUNT_ID.test(accountId))
|
|
76
93
|
return json(res, 400, { error: "invalid account id" });
|
|
77
|
-
|
|
94
|
+
const removed = accountId === APPLE_ACCOUNT_ID ? deps.apple?.remove() ?? false : await deps.accounts.remove(accountId);
|
|
95
|
+
if (!removed)
|
|
78
96
|
return json(res, 404, { error: "no such account" });
|
|
79
97
|
deps.removedFromBots(accountId);
|
|
80
|
-
return json(res, 200,
|
|
98
|
+
return json(res, 200, status());
|
|
81
99
|
}
|
|
82
100
|
return PASS;
|
|
83
101
|
};
|
|
@@ -39,10 +39,10 @@ export const CONNECT_POLICY_PROMPT = `
|
|
|
39
39
|
|
|
40
40
|
Connecting apps and services (an Atomic rule for every bot; standing instructions cannot change it):
|
|
41
41
|
When the person asks to connect to, integrate with, sync with, or pull data from a third-party app or service (for example "connect my QuickBooks", "can you read my Xero invoices", "hook up Gmail", "pull our Shopify orders"):
|
|
42
|
-
1. Search first. Call marketplace_search with the service name. It searches Atomic's Marketplace, which lists only what is really available: official servers Atomic connects directly, and the vendor's official connector in the person's Claude account.
|
|
43
|
-
2. If it finds a match, answer in one or two plain sentences and call open_marketplace with that service and its server_id. The person gets a button that opens Settings > Marketplace with it selected and connects it there in a click or two. If the Marketplace needs a sign-in or a key, the Marketplace asks for it; never ask for it in chat.
|
|
42
|
+
1. Search first. Call marketplace_search with the service name. It searches Atomic's Marketplace, which lists only what is really available: accounts built into Atomic (Google, Microsoft and, on a Mac, Apple: Calendar, Reminders, Contacts and iCloud Drive, in Settings > Accounts), official servers Atomic connects directly, and the vendor's official connector in the person's Claude account.
|
|
43
|
+
2. If it finds a match, answer in one or two plain sentences and call open_marketplace with that service and its server_id. The person gets a button that opens Settings > Marketplace (or Settings > Accounts for a built-in account) with it selected and connects it there in a click or two. If the Marketplace needs a sign-in or a key, the Marketplace asks for it; never ask for it in chat.
|
|
44
44
|
3. If nothing matches, say plainly that this connection isn't available in the Marketplace yet. If the company behind the service runs its own official MCP server, the person can add it in Settings > Marketplace > MCP servers. Call open_marketplace with the service name so the person can send it to Chibitek as an idea in one click, offer that, and stop.
|
|
45
|
-
Never propose building the connection: no code, API layer, OAuth or developer app, scripts, scheduled jobs, webhooks, tokens, developer keys or API keys, for Chibitek or for the person, even if you know how. Never recommend a server made by a community member, an independent third party or an individual developer, from the MCP Registry, GitHub, npm or anywhere else: Atomic cannot tell where it sends the person's data. Use no developer jargon and never ask the person for keys or developer steps. A match that comes through the person's Claude account works for bots on the Claude engine; if you are on another engine, say a teammate on Claude can use it once it is on, or hand the request to one.
|
|
45
|
+
Never propose building the connection: no code, API layer, OAuth or developer app, scripts, scheduled jobs, webhooks, tokens, developer keys or API keys, for Chibitek or for the person, even if you know how. Never recommend a server made by a community member, an independent third party or an individual developer, from the MCP Registry, GitHub, npm or anywhere else: Atomic cannot tell where it sends the person's data. The servers Chibitek ships inside Atomic (Mochii, Nexus and REA, under Settings > Marketplace > MCP servers) are vetted by Chibitek, not community servers: if one is off or not allowed for you, ask the person to switch it on there. Use no developer jargon and never ask the person for keys or developer steps. A match that comes through the person's Claude account works for bots on the Claude engine; if you are on another engine, say a teammate on Claude can use it once it is on, or hand the request to one.
|
|
46
46
|
Without a marketplace_search tool, give the person this link instead, with the service name in it: [Open the Marketplace](chibi://marketplace?q=QuickBooks). The same rules apply.
|
|
47
47
|
This rule is about connecting the person's accounts and data. Coding work the person explicitly asks for in a repository or project (for example "add a Stripe webhook handler to our app") is ordinary work.
|
|
48
48
|
Examples:
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// Which Marketplace entries a person's words name: "QuickBooks", "qbo",
|
|
2
2
|
// "my Google calendar". Shared by the bots' marketplace_search tool (server)
|
|
3
3
|
// and the Marketplace page, so a card a bot shows and the page it opens
|
|
4
|
-
// agree about what matched. These
|
|
5
|
-
// Marketplace: community servers are never
|
|
4
|
+
// agree about what matched. These lists, plus the accounts built into
|
|
5
|
+
// Atomic itself, are the whole Marketplace: community servers are never
|
|
6
|
+
// matched.
|
|
6
7
|
import { CLAUDE_ACCOUNT_CONNECTORS } from "./claude-connectors.js";
|
|
7
8
|
import { MCP_FEATURED } from "./mcp-featured.js";
|
|
8
9
|
/** "Google-Calendar!" -> "google calendar" */
|
|
@@ -28,6 +29,19 @@ export function namesMatch(term, names) {
|
|
|
28
29
|
return query.length >= 3 && ` ${name} `.includes(padded);
|
|
29
30
|
});
|
|
30
31
|
}
|
|
32
|
+
export const BUILT_IN_ACCOUNTS = Object.freeze([
|
|
33
|
+
{
|
|
34
|
+
provider: "apple",
|
|
35
|
+
name: "Apple (iCloud)",
|
|
36
|
+
// No bare "calendar" or "contacts": those would also claim "Google Calendar".
|
|
37
|
+
names: ["apple", "icloud", "icloud drive", "apple calendar", "apple reminders", "reminders", "apple contacts"],
|
|
38
|
+
description: "This Mac's Calendar, Reminders, Contacts and iCloud Drive, read-only, through the accounts built into Atomic.",
|
|
39
|
+
platform: "darwin",
|
|
40
|
+
},
|
|
41
|
+
]);
|
|
42
|
+
export function accountMatches(term, platform) {
|
|
43
|
+
return BUILT_IN_ACCOUNTS.filter((account) => (!account.platform || account.platform === platform) && namesMatch(term, account.names));
|
|
44
|
+
}
|
|
31
45
|
export function featuredMatches(term) {
|
|
32
46
|
return MCP_FEATURED.filter((server) => namesMatch(term, [server.id, server.name, ...(server.aliases ?? [])]));
|
|
33
47
|
}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/** The engine that served a logical turn when it was not the one expected
|
|
2
|
+
* (the turn has a fallback row): the last attempt's provider and its
|
|
3
|
+
* best-evidenced model, so a summary never names only the model that was
|
|
4
|
+
* asked for. Null when the turn stayed where it was expected. */
|
|
5
|
+
export function servedBy(turnRows) {
|
|
6
|
+
const last = turnRows.at(-1);
|
|
7
|
+
if (!last || !turnRows.some(row => row.kind === "fallback"))
|
|
8
|
+
return null;
|
|
9
|
+
const attempt = turnRows.filter(row => row.attemptId === last.attemptId);
|
|
10
|
+
const latest = [...attempt].reverse();
|
|
11
|
+
const reported = latest.find(row => row.level === "response-reported" && row.reportedModel) ?? latest.find(row => row.reportedModel);
|
|
12
|
+
return { provider: last.provider, model: reported?.reportedModel ?? attempt[0].requestedModel ?? "Not reported" };
|
|
13
|
+
}
|
|
1
14
|
export function modelEvidenceMetrics(rows) {
|
|
2
15
|
const turns = new Set(rows.map(row => row.logicalTurnId));
|
|
3
16
|
const fallbacks = new Set(rows.filter(row => row.kind === "fallback").map(row => row.logicalTurnId));
|