@chibitek/chibi 0.1.188 → 0.1.190

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 (85) hide show
  1. package/dist/assets/{abnfDiagram-O67JEVCF-CKDXgnYw.js → abnfDiagram-O67JEVCF-Bz3wlNsQ.js} +1 -1
  2. package/dist/assets/{arc--VPK-xet.js → arc-CX0dJSa0.js} +1 -1
  3. package/dist/assets/{architectureDiagram-NJMV4G6O-DSVjpq7n.js → architectureDiagram-NJMV4G6O-APIM9yGf.js} +1 -1
  4. package/dist/assets/{blockDiagram-BEXU5L5S-BiQ1JgSl.js → blockDiagram-BEXU5L5S-DNmNNaVY.js} +1 -1
  5. package/dist/assets/{c4Diagram-YGBWAQC7-kWWEc-NZ.js → c4Diagram-YGBWAQC7-CAPPUeMU.js} +1 -1
  6. package/dist/assets/channel-CnfDal05.js +1 -0
  7. package/dist/assets/{chunk-2Q5K7J3B-QJYqMtWJ.js → chunk-2Q5K7J3B-DfCDsQgU.js} +1 -1
  8. package/dist/assets/{chunk-3FUC2YCW-C7oGYTZS.js → chunk-3FUC2YCW-vdffwGmy.js} +2 -2
  9. package/dist/assets/{chunk-5VM5RSS4-MahQWTzh.js → chunk-5VM5RSS4-BazIL_2e.js} +1 -1
  10. package/dist/assets/{chunk-GTNCS2PH-CQfOvr7l.js → chunk-GTNCS2PH-GpKjNZ-V.js} +1 -1
  11. package/dist/assets/{chunk-GWA4HPMP-b0lt02Pi.js → chunk-GWA4HPMP-BuRq21LZ.js} +1 -1
  12. package/dist/assets/{chunk-JWPE2WC7-J1_ylbx8.js → chunk-JWPE2WC7-CqNGOyHV.js} +1 -1
  13. package/dist/assets/{chunk-NETBCI7D-AWcL9tld.js → chunk-NETBCI7D-B1DpzVCP.js} +1 -1
  14. package/dist/assets/{chunk-WEXAMYUT-DpTrAXJV.js → chunk-WEXAMYUT-DcH1Euc6.js} +1 -1
  15. package/dist/assets/{chunk-XXDRQBXY-2_DCjtc9.js → chunk-XXDRQBXY-M1JLd_cm.js} +1 -1
  16. package/dist/assets/{classDiagram-v2-NBCMYWYE-BBQMtHHs.js → classDiagram-v2-NBCMYWYE-C8mBZ7i2.js} +1 -1
  17. package/dist/assets/{cose-bilkent-JH36ORCC-CmxRmDe8.js → cose-bilkent-JH36ORCC-Cr3TqHDz.js} +1 -1
  18. package/dist/assets/{cynefin-OW5HDTMX-DjlothXK.js → cynefin-OW5HDTMX-BKPr6l0I.js} +1 -1
  19. package/dist/assets/{cynefinDiagram-VND7K2PF-D6HfzP26.js → cynefinDiagram-VND7K2PF-Cbg5mrIM.js} +1 -1
  20. package/dist/assets/{dagre-6A5THRUB-BtzaxY50.js → dagre-6A5THRUB-9I9X1J3r.js} +1 -1
  21. package/dist/assets/{diagram-22UHCM2B-DsyCiGJD.js → diagram-22UHCM2B-B43b8pqQ.js} +1 -1
  22. package/dist/assets/{diagram-3UASUU5V-CjjvxIr3.js → diagram-3UASUU5V-CIehgEkZ.js} +1 -1
  23. package/dist/assets/{diagram-ATOU4E4O-DDu2iVRb.js → diagram-ATOU4E4O-gx8nkXLZ.js} +1 -1
  24. package/dist/assets/{diagram-CDSNMT55-BBTViw3h.js → diagram-CDSNMT55-BZzWgYHa.js} +1 -1
  25. package/dist/assets/{diagram-MLGK6HIB-D83j4C6w.js → diagram-MLGK6HIB-BqoCqkZD.js} +1 -1
  26. package/dist/assets/{diagram-MPIPVDR6-DTpmpL8Q.js → diagram-MPIPVDR6-Bsc7x0UT.js} +1 -1
  27. package/dist/assets/{ebnfDiagram-ZINNZB2B-D3B4hz_Y.js → ebnfDiagram-ZINNZB2B-8HjdD_s8.js} +1 -1
  28. package/dist/assets/{elk-276RUBZZ-CbNicGf_.js → elk-276RUBZZ-bmxiEFtT.js} +1 -1
  29. package/dist/assets/{erDiagram-OPXOYQCR-DeSwxwFC.js → erDiagram-OPXOYQCR-BU-sRLe3.js} +1 -1
  30. package/dist/assets/{flowDiagram-KWPJA3E3-3n_Hk-ZR.js → flowDiagram-KWPJA3E3-D45vn40U.js} +1 -1
  31. package/dist/assets/{ganttDiagram-FUAMR5RP-BsadEPTf.js → ganttDiagram-FUAMR5RP-CArB98Hu.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-X574FWY7-DOvqN3Jh.js → gitGraphDiagram-X574FWY7-fPB1k-W7.js} +1 -1
  33. package/dist/assets/{index-B9LCl5y3.js → index-QsXeEMxJ.js} +71 -71
  34. package/dist/assets/{index-BmYLMFD8.js → index-u1wvoacp.js} +1 -1
  35. package/dist/assets/{infoDiagram-VRGFBTTK-CI3tfMt9.js → infoDiagram-VRGFBTTK-ZRVWXAr4.js} +1 -1
  36. package/dist/assets/{ishikawaDiagram-OU5B5YK6-BE7AjZYf.js → ishikawaDiagram-OU5B5YK6-DOaurRbX.js} +1 -1
  37. package/dist/assets/{journeyDiagram-ZHPQQLJL-DplNZPox.js → journeyDiagram-ZHPQQLJL-Ca9B-09w.js} +1 -1
  38. package/dist/assets/{kanban-definition-PNTS6WVX-Cos64we-.js → kanban-definition-PNTS6WVX-CA2XswEJ.js} +1 -1
  39. package/dist/assets/{linear-DDfQb-jo.js → linear-B-F7icip.js} +1 -1
  40. package/dist/assets/{mermaid.core-BekbnuLb.js → mermaid.core-ymtCpbZ5.js} +5 -5
  41. package/dist/assets/{mindmap-definition-NLK3R4M7-DJ0MbzMW.js → mindmap-definition-NLK3R4M7-02vIazCi.js} +1 -1
  42. package/dist/assets/{pegDiagram-GJSIUBJH-DZNZCZ4O.js → pegDiagram-GJSIUBJH-DRb7Pn72.js} +1 -1
  43. package/dist/assets/{pieDiagram-5QR66LMP-COD5v2yC.js → pieDiagram-5QR66LMP-B2YwP3S_.js} +1 -1
  44. package/dist/assets/{quadrantDiagram-O4NWA36T-D4dlLWfv.js → quadrantDiagram-O4NWA36T-CbR573mu.js} +1 -1
  45. package/dist/assets/{railroadDiagram-XR7U4H2S-CEpVYFKl.js → railroadDiagram-XR7U4H2S-CqHuDCnM.js} +1 -1
  46. package/dist/assets/{requirementDiagram-PLB6GJNP-DYD5GX0G.js → requirementDiagram-PLB6GJNP-BSeC-H1j.js} +1 -1
  47. package/dist/assets/{sankeyDiagram-IPEJSGJF-C9bPeTfK.js → sankeyDiagram-IPEJSGJF-BMFuhoh1.js} +1 -1
  48. package/dist/assets/{sequenceDiagram-PO4LG4MO-eXpmPg9C.js → sequenceDiagram-PO4LG4MO-DRT_EI9u.js} +1 -1
  49. package/dist/assets/{sizeCapture-INFHLROL-DfqKWBhp.js → sizeCapture-INFHLROL-BLFT4fV7.js} +1 -1
  50. package/dist/assets/{stateDiagram-v2-GCMORJYK-DkIf90iA.js → stateDiagram-v2-GCMORJYK-C8vB_69H.js} +1 -1
  51. package/dist/assets/{swimlanes-2SLR337P-Ds64cQxN.js → swimlanes-2SLR337P-T6BBolT8.js} +1 -1
  52. package/dist/assets/swimlanesDiagram-TC7HE7FX-BIY4fGCv.js +8 -0
  53. package/dist/assets/{timeline-definition-EJHVYXUP-Ci3-31qT.js → timeline-definition-EJHVYXUP-DjdjBRQV.js} +1 -1
  54. package/dist/assets/{usecaseDiagram-POWQR4AR-DQUGgfBf.js → usecaseDiagram-POWQR4AR-CDGccZMN.js} +1 -1
  55. package/dist/assets/{vennDiagram-UO4OBE2U-DV5_nmWl.js → vennDiagram-UO4OBE2U-CgYSihtW.js} +1 -1
  56. package/dist/assets/{wardleyDiagram-VNRHLVJA-DatPTthc.js → wardleyDiagram-VNRHLVJA-Bub5ScM8.js} +1 -1
  57. package/dist/assets/{xychartDiagram-PMCCYNJV-ADaxt1QH.js → xychartDiagram-PMCCYNJV-DK5iMX67.js} +1 -1
  58. package/dist/index.html +1 -1
  59. package/dist-server/drivers/agents-proxy.js +14 -4
  60. package/dist-server/index.js +3545 -3026
  61. package/dist-server/openmausbot.js +1378 -844
  62. package/dist-server/pair-cli.js +1378 -844
  63. package/dist-server/server/browser-runtime.js +41 -5
  64. package/dist-server/server/chibi-defaults.js +96 -0
  65. package/dist-server/server/cli-login.js +4 -0
  66. package/dist-server/server/connection-cap-failover.js +0 -2
  67. package/dist-server/server/drivers/agents-vault.js +4 -3
  68. package/dist-server/server/engine-tiers.js +4 -4
  69. package/dist-server/server/hidden-ai-text.js +56 -0
  70. package/dist-server/server/index.js +21 -27
  71. package/dist-server/server/system-prompt.js +17 -2
  72. package/dist-server/server/vault/fill.js +338 -0
  73. package/dist-server/server/vault/request.js +6 -2
  74. package/dist-server/server/vault/routes.js +14 -2
  75. package/dist-server/server/vault/runtime.js +14 -0
  76. package/dist-server/server/vault/store.js +40 -3
  77. package/dist-server/shared/engine-tiers.js +23 -1
  78. package/dist-server/shared/provider-accounts.js +5 -3
  79. package/dist-server/shared/subscription-bots.js +14 -6
  80. package/dist-server/shared/vault-api-providers.js +48 -0
  81. package/dist-server/shared/vault-csv.js +62 -14
  82. package/dist-server/shared/vault.js +14 -3
  83. package/package.json +1 -1
  84. package/dist/assets/channel-CQdxuHwI.js +0 -1
  85. package/dist/assets/swimlanesDiagram-TC7HE7FX-bO3Klz6Z.js +0 -8
@@ -1,3 +1,4 @@
1
+ import { apiProviderFor } from "./vault-api-providers.js";
1
2
  import { vaultOrigin } from "./vault.js";
2
3
  export class VaultCsvError extends Error {
3
4
  }
@@ -52,24 +53,48 @@ const COLUMNS = {
52
53
  password: ["password", "login_password", "pwd", "pass"],
53
54
  name: ["name", "title", "account"],
54
55
  type: ["type"],
56
+ // An API token: its own column, or a row whose type says so. `header` and
57
+ // `prefix` say how it is sent when that is not "Authorization: Bearer".
58
+ token: ["token", "api token", "api_token", "api key", "api_key", "apikey", "access token", "access_token", "credential", "secret", "key"],
59
+ header: ["header", "header name"],
60
+ prefix: ["prefix", "scheme"],
55
61
  // The vault, folder or tag a row was filed under, so an import can take one.
56
62
  group: ["vault", "folder", "grouping", "collections", "collection", "category", "tags"],
57
63
  };
58
- /** Logins from a password manager's CSV export. Notes, TOTP seeds and custom
59
- * fields are dropped: they can hold secrets and hints are not secret. Rows
60
- * without a website, username and password, or that are not logins, are
61
- * counted in `skipped`. Imported items are private to the person (no bots). */
64
+ /** A row's type that means an API token, not a login ("API Credential",
65
+ * "token", "secret key"). */
66
+ const TOKEN_TYPE = /api|token|key|credential|secret/;
67
+ const TOKEN_VALUE = /^[\x21-\x7E]{1,8192}$/;
68
+ const HEADER_NAME = /^[A-Za-z0-9-]{1,64}$/;
69
+ const PREFIX = /^[\x20-\x7E]{0,32}$/;
70
+ /** Logins and API tokens from a CSV export. Notes, TOTP seeds and custom
71
+ * fields are dropped: they can hold secrets and hints are not secret.
72
+ *
73
+ * A login needs a website, username and password. An API token is a row
74
+ * with a token: in a token column, in the password column when the row's
75
+ * type says it is a token, or a password saved under a name alone (no
76
+ * website and no username, how many people keep API keys). With a website
77
+ * it is bound to that website, sent as "Authorization: Bearer <token>"
78
+ * unless `header` and `prefix` columns say otherwise. With no website, a
79
+ * name Atomic knows (shared/vault-api-providers.ts) binds it to that
80
+ * provider's API with the header it asks for; any other is saved with no
81
+ * address, which no bot can use until the person adds one (`needAddress`
82
+ * counts those). Other rows are counted in `skipped`. Imported items may be
83
+ * used by every bot of the person (allBots). */
62
84
  export function vaultLoginsFromCsv(text, group) {
63
85
  const [header, ...rows] = parseCsv(text);
64
86
  if (!header)
65
- return { logins: [], skipped: 0 };
87
+ return { logins: [], apiKeys: [], skipped: 0, needAddress: 0 };
66
88
  const groupAt = columnIndex(header, "group");
67
89
  const col = (key) => columnIndex(header, key);
68
- const at = { url: col("url"), username: col("username"), password: col("password"), name: col("name"), type: col("type") };
69
- if (at.url < 0 || at.password < 0 || at.username < 0)
70
- throw new VaultCsvError("This CSV has no website, username and password columns.");
90
+ const at = { url: col("url"), username: col("username"), password: col("password"), name: col("name"), type: col("type"),
91
+ token: col("token"), header: col("header"), prefix: col("prefix") };
92
+ if (at.token < 0 && at.password < 0)
93
+ throw new VaultCsvError("This CSV has no password or token column.");
71
94
  const logins = [];
95
+ const apiKeys = [];
72
96
  let skipped = 0;
97
+ let needAddress = 0;
73
98
  for (const row of rows) {
74
99
  const cell = (index) => (index >= 0 ? row[index] ?? "" : "").trim();
75
100
  if (group && !groupsOf(cell(groupAt)).includes(group))
@@ -77,17 +102,40 @@ export function vaultLoginsFromCsv(text, group) {
77
102
  const type = cell(at.type).toLowerCase();
78
103
  const raw = cell(at.url).split(/[\s,]+/)[0] ?? "";
79
104
  // Old entries saved as http:// or a bare domain are filled over HTTPS.
80
- const website = vaultOrigin(/^[a-z][a-z0-9+.-]*:\/\//i.test(raw) ? raw.replace(/^http:\/\//i, "https://") : `https://${raw}`);
105
+ const website = raw ? vaultOrigin(/^[a-z][a-z0-9+.-]*:\/\//i.test(raw) ? raw.replace(/^http:\/\//i, "https://") : `https://${raw}`) : null;
81
106
  const username = cell(at.username);
82
- const password = row[at.password] ?? "";
83
- if ((type && type !== "login") || !raw || !website || !username || !password || username.length > 320 || password.length > 4096) {
107
+ const password = at.password >= 0 ? row[at.password] ?? "" : "";
108
+ const name = cell(at.name);
109
+ // A password kept under a name alone, with no website and no username, is an API key.
110
+ const nameOnly = !raw && !username && Boolean(name) && type !== "login";
111
+ const token = cell(at.token) || ((type !== "login" && TOKEN_TYPE.test(type)) || nameOnly ? password.trim() : "");
112
+ if (raw && !website) {
84
113
  skipped++;
85
114
  continue;
86
115
  }
87
- const label = (cell(at.name) || new URL(website).hostname).slice(0, 200);
88
- logins.push({ kind: "login", label, hints: "", botIds: [], expiresAt: null, website, username, password });
116
+ const label = (name || (website ? new URL(website).hostname : "")).slice(0, 200);
117
+ if (token) {
118
+ const known = website ? undefined : apiProviderFor(label);
119
+ const sentIn = cell(at.header) || known?.header || "Authorization";
120
+ // The prefix keeps its trailing space ("Bearer "), so it is not trimmed.
121
+ const prefix = at.prefix >= 0 ? row[at.prefix] ?? "" : cell(at.header) ? "" : known ? known.prefix : "Bearer ";
122
+ if (!label || !TOKEN_VALUE.test(token) || !HEADER_NAME.test(sentIn) || !PREFIX.test(prefix)) {
123
+ skipped++;
124
+ continue;
125
+ }
126
+ const origins = website ? [website] : known ? [...known.origins] : [];
127
+ if (!origins.length)
128
+ needAddress++;
129
+ apiKeys.push({ kind: "apiKey", label, hints: "", botIds: [], allBots: true, expiresAt: null, origins, header: sentIn, prefix, secret: token });
130
+ continue;
131
+ }
132
+ if (!website || (type && type !== "login") || !username || !password || username.length > 320 || password.length > 4096) {
133
+ skipped++;
134
+ continue;
135
+ }
136
+ logins.push({ kind: "login", label, hints: "", botIds: [], allBots: true, expiresAt: null, website, username, password });
89
137
  }
90
- return { logins, skipped };
138
+ return { logins, apiKeys, skipped, needAddress };
91
139
  }
92
140
  function columnIndex(header, key) {
93
141
  const names = header.map((cell) => cell.trim().toLowerCase());
@@ -23,6 +23,11 @@ const address = z.object({
23
23
  const base = {
24
24
  label: z.string().trim().min(1).max(200), hints: text(1000),
25
25
  botIds: z.array(z.string().uuid()).max(100).refine((ids) => new Set(ids).size === ids.length),
26
+ /** Every bot of the owner may use the item, including bots made later
27
+ * (Erick, 2026-11-13: no per-item setup). The default for a new or
28
+ * imported item; `botIds` then adds nothing. Absent on items saved before
29
+ * it existed, which keep their own list. */
30
+ allBots: z.boolean().optional(),
26
31
  expiresAt: z.number().int().positive().max(Number.MAX_SAFE_INTEGER).nullable(),
27
32
  };
28
33
  /** Reject unknown fields rather than accidentally persisting secrets in
@@ -40,7 +45,10 @@ export const vaultInputSchema = z.discriminatedUnion("kind", [
40
45
  }).strict(),
41
46
  // An API key a granted bot may send, in one named header, to the listed
42
47
  // origins. The value is visible ASCII only, so it can never split a header.
43
- z.object({ ...base, kind: z.literal("apiKey"), origins: z.array(origin).min(1).max(50),
48
+ // A key may be saved with no origin yet (many are kept under a name alone,
49
+ // with no website): it is stored, and no bot can send it anywhere until
50
+ // its owner adds an address.
51
+ z.object({ ...base, kind: z.literal("apiKey"), origins: z.array(origin).max(50),
44
52
  header: z.string().regex(/^[A-Za-z0-9-]{1,64}$/), prefix: z.string().regex(/^[\x20-\x7E]{0,32}$/),
45
53
  secret: z.string().regex(/^[\x21-\x7E]{1,8192}$/),
46
54
  }).strict(),
@@ -49,7 +57,7 @@ export const vaultInputSchema = z.discriminatedUnion("kind", [
49
57
  export function vaultMetadata(item) {
50
58
  return {
51
59
  id: item.id, kind: item.kind, label: item.label, hints: item.hints,
52
- botIds: [...item.botIds], expiresAt: item.expiresAt,
60
+ botIds: [...item.botIds], allBots: item.allBots === true, expiresAt: item.expiresAt,
53
61
  origins: item.kind === "login" ? [item.website] : [...item.origins],
54
62
  ...(item.kind === "login" ? { username: item.username } : {}),
55
63
  ...(item.kind === "card" ? { lastFour: item.number.slice(-4), expiryMonth: item.expiryMonth, expiryYear: item.expiryYear, billing: { ...item.billing } } : {}),
@@ -58,9 +66,12 @@ export function vaultMetadata(item) {
58
66
  createdAt: item.createdAt, updatedAt: item.updatedAt,
59
67
  };
60
68
  }
69
+ /** Whether this bot is one the owner let use the item: every bot, or one
70
+ * on its list. The owner, expiry and destination are checked apart. */
71
+ export const vaultGranted = (item, botId) => item.allBots === true || item.botIds.includes(botId);
61
72
  export function vaultUseAllowed(item, actor, now) {
62
73
  const destination = vaultOrigin(actor.destination);
63
- return Number.isSafeInteger(now) && now >= 0 && item.ownerId === actor.ownerId && item.botIds.includes(actor.botId)
74
+ return Number.isSafeInteger(now) && now >= 0 && item.ownerId === actor.ownerId && vaultGranted(item, actor.botId)
64
75
  && (item.expiresAt === null || now < item.expiresAt) && destination !== null
65
76
  && (item.kind === "login" ? item.website === destination : item.origins.includes(destination));
66
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chibitek/chibi",
3
- "version": "0.1.188",
3
+ "version": "0.1.190",
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-BekbnuLb.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
@@ -1,8 +0,0 @@
1
- import{c as r,s as e}from"./flowDiagram-KWPJA3E3-3n_Hk-ZR.js";import{_ as a}from"./mermaid.core-BekbnuLb.js";import"./chunk-5VM5RSS4-MahQWTzh.js";import"./chunk-XXDRQBXY-2_DCjtc9.js";import"./chunk-WEXAMYUT-DpTrAXJV.js";import"./chunk-GWA4HPMP-b0lt02Pi.js";import"./channel-CQdxuHwI.js";import"./index-B9LCl5y3.js";var o=a(t=>`${e(t)}
2
- .swimlane.cluster:not([data-color-id]) rect {
3
- stroke: ${t.clusterBorder} !important;
4
- }
5
- [data-look="neo"].cluster rect {
6
- filter: none;
7
- }
8
- `,"getStyles"),s=o,u=r({styles:s});export{u as diagram};