@brunobracaioli/aibrain 0.4.0-beta.30 → 0.4.0-beta.31

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.
@@ -16,7 +16,7 @@ export const MAX_LOG_FILES = 3;
16
16
  const LOCK_WAIT_MS = 250;
17
17
  const LOCK_STALE_MS = 30_000;
18
18
  const ADMISSION_MS = 60 * 60 * 1000;
19
- export const ADAPTER_VERSION = '0.4.0-beta.30';
19
+ export const ADAPTER_VERSION = '0.4.0-beta.31';
20
20
  const MAX_DIAGNOSTIC_COUNT = 10_000_000;
21
21
  const MAX_DIAGNOSTIC_BYTES = 128 * 1024 * 1024;
22
22
  const CHECKPOINT_BACKENDS = new Set(['native_store', 'private_file']);
package/dist/cli.mjs CHANGED
@@ -89,13 +89,15 @@ import { codexHooksStatus, supportsCodexHooks } from './codex-hooks.mjs';
89
89
  import { managerDoctorLine, managerDoctorSection, takeRoleFlags } from './manager/launch-role.mjs';
90
90
  import { WORKERS_USAGE, workersCommand } from './manager/workers-cli.mjs';
91
91
  import {
92
+ describeClientNotConfigured,
93
+ describeMissingSetupClient,
92
94
  describePermissionError,
93
95
  describeRoleError,
94
96
  launchFeedbackLocale,
95
97
  } from './launch-feedback.mjs';
96
98
  import { parseCodexLaunchArgs } from './codex-permissions.mjs';
97
99
 
98
- const VERSION = '0.4.0-beta.30';
100
+ const VERSION = '0.4.0-beta.31';
99
101
  // The command is `aisac`; `aibrain` is an alias installed from the same entry.
100
102
  const COMMAND = 'aisac';
101
103
  /** `aisac scan` could not scan as asked (scan spec D6); 1 means findings, 2 a usage error. */
@@ -617,21 +619,34 @@ async function disclosureAccepted(
617
619
  }
618
620
 
619
621
  /**
620
- * Client selection when `--client` is omitted: the native clients found on PATH. Codex
621
- * also needs `node`, the same pair the explicit `--client codex` path checks.
622
+ * Whether a native client is usable from PATH. Codex also needs `node`, the same pair
623
+ * the explicit `--client codex` path checks; a managed Codex needs only `node`.
624
+ * @param {'claude' | 'codex'} host @param {boolean} [managedCodex]
625
+ */
626
+ function nativeClientFound(host, managedCodex = false) {
627
+ if (host === 'claude') return resolveNative('claude') !== null;
628
+ return (managedCodex || resolveNative('codex') !== null) && resolveNative('node') !== null;
629
+ }
630
+
631
+ /**
632
+ * Client selection when `--client` is omitted: the native clients found on PATH.
622
633
  * @returns {'claude' | 'codex' | 'both' | null}
623
634
  */
624
635
  function detectedClients(managedCodex = false) {
625
- const hasClaude = resolveNative('claude') !== null;
626
- const hasCodex =
627
- (managedCodex || resolveNative('codex') !== null) && resolveNative('node') !== null;
636
+ const hasClaude = nativeClientFound('claude');
637
+ const hasCodex = nativeClientFound('codex', managedCodex);
628
638
  if (hasClaude && hasCodex) return 'both';
629
639
  if (hasClaude) return 'claude';
630
640
  return hasCodex ? 'codex' : null;
631
641
  }
632
642
 
633
- /** @param {string | undefined} requested @param {boolean} [managedCodex] @returns {'claude' | 'codex' | 'both'} */
634
- function setupClients(requested, managedCodex = false) {
643
+ /**
644
+ * When setup found only one client, it says which one it left out and how to add it
645
+ * later (spec aisac-host-upgrade-resilience, contract 10).
646
+ * @param {string | undefined} requested @param {boolean} managedCodex @param {'pt-BR' | 'en'} locale
647
+ * @returns {'claude' | 'codex' | 'both'}
648
+ */
649
+ function setupClients(requested, managedCodex, locale) {
635
650
  if (requested !== undefined) {
636
651
  if (requested !== 'claude' && requested !== 'codex' && requested !== 'both')
637
652
  throw new Error('invalid_client');
@@ -640,6 +655,7 @@ function setupClients(requested, managedCodex = false) {
640
655
  const detected = detectedClients(managedCodex);
641
656
  if (detected === null) throw new Error('no_native_client_found');
642
657
  console.log(`Clients detected on PATH: ${detected} (pass --client to choose).`);
658
+ if (detected !== 'both') console.log(describeMissingSetupClient(detected, locale));
643
659
  return detected;
644
660
  }
645
661
 
@@ -944,7 +960,8 @@ async function setup(args) {
944
960
  if (localOptOut) return disableTelemetryLocally(previous);
945
961
  const platform = platformCheck();
946
962
  if (!platform.ok) throw new Error(`${platform.code}:${platform.message}`);
947
- const clients = setupClients(option(args, '--client'), release.hostCodex === 'managed');
963
+ const locale = resolvePackLocale(lang ?? (await readStoredLocale(stateRoot())));
964
+ const clients = setupClients(option(args, '--client'), release.hostCodex === 'managed', locale);
948
965
  if (
949
966
  clients === 'codex' &&
950
967
  (option(args, '--claude-shadow') !== undefined ||
@@ -955,7 +972,6 @@ async function setup(args) {
955
972
  throw new Error('host_claude_requires_claude_client');
956
973
  if (clients === 'claude' && release.hostCodex !== undefined)
957
974
  throw new Error('host_codex_requires_codex_client');
958
- const locale = resolvePackLocale(lang ?? (await readStoredLocale(stateRoot())));
959
975
  // The hosts are checked before the disclosure and the token (spec
960
976
  // aisac-host-upgrade-resilience C7, C8): an incompatible host costs the user neither.
961
977
  const preflight = await preflightSetupHosts(clients, release, locale);
@@ -1684,8 +1700,12 @@ async function main(argv) {
1684
1700
  }
1685
1701
  if (config.schemaVersion === 2 && config.disclosureVersion !== DISCLOSURE_VERSION)
1686
1702
  throw new Error('disclosure_outdated');
1687
- if (config.clientSelection !== command && config.clientSelection !== 'both')
1688
- throw new Error('client_not_configured');
1703
+ if (config.clientSelection !== command && config.clientSelection !== 'both') {
1704
+ const locale = resolvePackLocale(await readStoredLocale(stateRoot()), process.env);
1705
+ throw Object.assign(new Error('client_not_configured'), {
1706
+ guide: describeClientNotConfigured(command, nativeClientFound(command), locale),
1707
+ });
1708
+ }
1689
1709
  // The native executable is authoritative. The stored setup version is
1690
1710
  // metadata only, so patch updates do not block a fresh compatibility check.
1691
1711
  if (command === 'codex' && typeof config.codexVersion !== 'string')
@@ -361,10 +361,13 @@ export const MCP_CATALOG = Object.freeze([
361
361
  'pt-BR':
362
362
  'As chaves dos provedores são gerenciadas só na página de chaves do Studio (https://studio.aisac.agency/?studio=keys): uma chave digitada numa chamada de ferramenta ficaria no transcript da sessão.',
363
363
  },
364
+ // Since mcp-creatives ADR-0053 (2026-12-01) the consent page approves with the
365
+ // Studio session of the browser the host opens; a personal token stays as the
366
+ // fallback. Without a session there, the login cannot finish.
364
367
  loginNote: {
365
- en: 'The Studio login needs an account with access (it comes with the AISAC Engineering purchase). Register your provider keys on the Studio keys page before the first generation; the server never takes a key as an argument.',
368
+ en: 'Before you log in, open the Studio in your default browser: from the AISAC Mothership, or with the e-mail of an account with access (it comes with the AISAC Engineering purchase). When the host opens the authorization page, click “Aprovar”: no token to paste. Register your provider keys on the Studio keys page before the first generation; the server never takes a key as an argument.',
366
369
  'pt-BR':
367
- 'O login do Studio exige uma conta com acesso (vem com a compra do AISAC Engineering). Registre as chaves dos seus provedores na página de chaves do Studio antes da primeira geração; o servidor nunca recebe uma chave como argumento.',
370
+ 'Antes do login, abra o Studio no seu navegador padrão: pela AISAC Mothership, ou com o e-mail de uma conta com acesso (vem com a compra do AISAC Engineering). Quando o host abrir a página de autorização, clique em “Aprovar”: não há token para colar. Registre as chaves dos seus provedores na página de chaves do Studio antes da primeira geração; o servidor nunca recebe uma chave como argumento.',
368
371
  },
369
372
  description: {
370
373
  en: 'The AISAC Creatives Studio: images, narration and video generated with your own provider keys, plus voices, influencer profiles and reel productions.',
@@ -275,6 +275,66 @@ export function describePermissionError(error, args, locale) {
275
275
  return null;
276
276
  }
277
277
 
278
+ /** @param {'claude' | 'codex'} host */
279
+ function hostName(host) {
280
+ return host === 'claude' ? 'Claude Code' : 'Codex';
281
+ }
282
+
283
+ /** @param {'claude' | 'codex'} host */
284
+ function otherHost(host) {
285
+ return host === 'claude' ? 'codex' : 'claude';
286
+ }
287
+
288
+ /**
289
+ * Guide for `aisac claude|codex` when the setup covers only the other host
290
+ * (spec aisac-host-upgrade-resilience, contract 11).
291
+ * @param {'claude' | 'codex'} host the host the user asked to launch
292
+ * @param {boolean} hostFound whether that host is on PATH now
293
+ * @param {FeedbackLocale} locale
294
+ */
295
+ export function describeClientNotConfigured(host, hostFound, locale) {
296
+ const name = hostName(host);
297
+ const configured = hostName(otherHost(host));
298
+ const managed = `aisac setup --client both --host-${host} managed`;
299
+ if (locale === 'pt-BR') {
300
+ const first = `O \`aisac setup\` deste computador configurou só o ${configured}, por isso o \`aisac ${host}\` não foi iniciado.`;
301
+ const again = 'O setup pede o ACCEPT e o login de novo.';
302
+ return hostFound
303
+ ? [
304
+ first,
305
+ `Isso acontece quando o ${name} é instalado depois do setup. Rode \`aisac setup --client both\` para adicionar o ${name} e manter o ${configured}. ${again}`,
306
+ ].join('\n')
307
+ : [
308
+ first,
309
+ `O ${name} não foi encontrado no PATH. Instale-o e rode \`aisac setup --client both\`, ou deixe o setup instalar a cópia privada do aisac com \`${managed}\`. ${again}`,
310
+ ].join('\n');
311
+ }
312
+ const first = `This computer's \`aisac setup\` covers ${configured} only, so \`aisac ${host}\` was not started.`;
313
+ const again = 'Setup asks for ACCEPT and a login again.';
314
+ return hostFound
315
+ ? [
316
+ first,
317
+ `This happens when ${name} is installed after setup. Run \`aisac setup --client both\` to add ${name} and keep ${configured}. ${again}`,
318
+ ].join('\n')
319
+ : [
320
+ first,
321
+ `${name} was not found on PATH. Install it and run \`aisac setup --client both\`, or let setup install aisac's private copy with \`${managed}\`. ${again}`,
322
+ ].join('\n');
323
+ }
324
+
325
+ /**
326
+ * Setup's line when it selected the clients itself and found only one
327
+ * (spec aisac-host-upgrade-resilience, contract 10).
328
+ * @param {'claude' | 'codex'} found the host setup is about to configure
329
+ * @param {FeedbackLocale} locale
330
+ */
331
+ export function describeMissingSetupClient(found, locale) {
332
+ const missing = otherHost(found);
333
+ return locale === 'pt-BR'
334
+ ? `O ${hostName(missing)} não foi encontrado no PATH, então este setup configura só o ${hostName(found)}. Para usar o \`aisac ${missing}\` depois, instale o ${hostName(missing)} e rode \`aisac setup --client both\`.`
335
+ : `${hostName(missing)} was not found on PATH, so this setup covers ${hostName(found)} only. To use \`aisac ${missing}\` later, install ${hostName(missing)} and run \`aisac setup --client both\`.`;
336
+ }
337
+
278
338
  /**
279
339
  * The launch-feedback locale follows the saved pack choice. An unset choice
280
340
  * uses English as required for command-line errors.
package/dist/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@brunobracaioli/aibrain",
3
- "version": "0.4.0-beta.30",
3
+ "version": "0.4.0-beta.31",
4
4
  "type": "module"
5
5
  }
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "kind": "aisac-release-manifest",
3
3
  "schema_version": 1,
4
- "sequence": 8,
5
- "issued_at": "2026-12-01T13:21:00Z",
6
- "expires_at": "2026-12-31T13:21:00Z",
4
+ "sequence": 9,
5
+ "issued_at": "2026-12-01T22:55:00Z",
6
+ "expires_at": "2026-12-31T22:55:00Z",
7
7
  "key_id": "94f9ccf331e4f7f3",
8
8
  "features": {
9
9
  "self_update": true,
@@ -20,10 +20,10 @@
20
20
  "minimum_version": "0.4.0-beta.18",
21
21
  "channels": {
22
22
  "beta": {
23
- "version": "0.4.0-beta.28",
23
+ "version": "0.4.0-beta.30",
24
24
  "integrity": {
25
- "@aisac/cli": "sha512-XiaSAXGRFqxIgw3YLUItwTbt3+rTSgP/0siz82RJZtwvH20wnKGn7qGlBGpGTjZDJ7VMUdf3gTulntOC2aEKNg==",
26
- "@brunobracaioli/aibrain": "sha512-5Eu1qxShLlXAB8akYD+tVobFTJQ3pBAtDVtvXYNc2VeWup1fl5xVl9JXnQDT7V11iacc66JJ+8jmh/WcWAYYKw=="
25
+ "@aisac/cli": "sha512-iFSAat6dZc+li1gjAvtmb8GjWcSV3C2N9J5n3m06SyekPtiB/5HGLYIR/125Rd0RLKtTvbRbJ65l0KlIZkoOBQ==",
26
+ "@brunobracaioli/aibrain": "sha512-l+8K2IoAok0mleaTFkNbXaCmZ1MEY3CAUCRi+dMHlMQyXlPV0F+x4dAupSjXOU1JGS9mtux8fQny0zFOVWvClg=="
27
27
  }
28
28
  }
29
29
  }
@@ -180,7 +180,7 @@
180
180
  },
181
181
  "codex": {
182
182
  "package": "@openai/codex",
183
- "pinned": "0.167.1",
183
+ "pinned": "0.172.0",
184
184
  "qualified": [
185
185
  "0.161.0",
186
186
  "0.162.0",
@@ -262,66 +262,66 @@
262
262
  }
263
263
  }
264
264
  },
265
- "0.166.0": {
265
+ "0.172.0": {
266
266
  "ignore_scripts": true,
267
267
  "platforms": {
268
268
  "linux-x64": {
269
269
  "lock": {
270
270
  "@openai/codex": {
271
- "version": "0.166.0",
272
- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.166.0.tgz",
273
- "integrity": "sha512-2Szlp1l1cz5TX1ccpX4Zok3DZrot9xeZe0km+6/1v8JmqxADwyJxKBJah4dBymkwtS25j/u6dipJusTOI97Z8Q=="
271
+ "version": "0.172.0",
272
+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.172.0.tgz",
273
+ "integrity": "sha512-yHf/6wbw4Zvha2M2ylDhDrU9FgfKLYgV6xSzSjlz3gxQNsiVLkXo+fPGwBqvP0A5geLtZs9wAbq+1v7+ZVWJ0g=="
274
274
  },
275
275
  "@openai/codex-linux-x64": {
276
276
  "name": "@openai/codex",
277
- "version": "0.166.0-linux-x64",
278
- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.166.0-linux-x64.tgz",
279
- "integrity": "sha512-CxDm3+D1cpbGJeHrdzINoG+3wn9BVncP4qpZaaNYkxe8iPtRJOYyCJnnPoVjWRIBvI9vPKbRoifsMSA5xDaUpw=="
277
+ "version": "0.172.0-linux-x64",
278
+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.172.0-linux-x64.tgz",
279
+ "integrity": "sha512-YJq6Wz3PFXV5LZ0OQc3/o+gpM3pLmQ/8n8uM2zF/m0O/8zED+uSPT8Ln1KGRrqR8Q6eon9YdWlhueAunVTZ+eg=="
280
280
  }
281
281
  }
282
282
  },
283
283
  "linux-arm64": {
284
284
  "lock": {
285
285
  "@openai/codex": {
286
- "version": "0.166.0",
287
- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.166.0.tgz",
288
- "integrity": "sha512-2Szlp1l1cz5TX1ccpX4Zok3DZrot9xeZe0km+6/1v8JmqxADwyJxKBJah4dBymkwtS25j/u6dipJusTOI97Z8Q=="
286
+ "version": "0.172.0",
287
+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.172.0.tgz",
288
+ "integrity": "sha512-yHf/6wbw4Zvha2M2ylDhDrU9FgfKLYgV6xSzSjlz3gxQNsiVLkXo+fPGwBqvP0A5geLtZs9wAbq+1v7+ZVWJ0g=="
289
289
  },
290
290
  "@openai/codex-linux-arm64": {
291
291
  "name": "@openai/codex",
292
- "version": "0.166.0-linux-arm64",
293
- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.166.0-linux-arm64.tgz",
294
- "integrity": "sha512-w0ScAsBr9aZKtIFrh6HN6KU2yjKKeSCzYfbb7DB0Ccj4BYPzeZtUeQprbycLCwuX3AFQdbdjapmLho2iot74jQ=="
292
+ "version": "0.172.0-linux-arm64",
293
+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.172.0-linux-arm64.tgz",
294
+ "integrity": "sha512-qLH5VdeTkPlknWgKkU11IlGMyyxKXp9vcj65libT3Zp4P3Kt7gEbK4YDXlDBqWtA09+fGnIUpWERs6BaNo86DA=="
295
295
  }
296
296
  }
297
297
  },
298
298
  "darwin-x64": {
299
299
  "lock": {
300
300
  "@openai/codex": {
301
- "version": "0.166.0",
302
- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.166.0.tgz",
303
- "integrity": "sha512-2Szlp1l1cz5TX1ccpX4Zok3DZrot9xeZe0km+6/1v8JmqxADwyJxKBJah4dBymkwtS25j/u6dipJusTOI97Z8Q=="
301
+ "version": "0.172.0",
302
+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.172.0.tgz",
303
+ "integrity": "sha512-yHf/6wbw4Zvha2M2ylDhDrU9FgfKLYgV6xSzSjlz3gxQNsiVLkXo+fPGwBqvP0A5geLtZs9wAbq+1v7+ZVWJ0g=="
304
304
  },
305
305
  "@openai/codex-darwin-x64": {
306
306
  "name": "@openai/codex",
307
- "version": "0.166.0-darwin-x64",
308
- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.166.0-darwin-x64.tgz",
309
- "integrity": "sha512-Vj5wXJPizKmrzNtnRNQf9PP6FJkG3iJU/UO3NE4WvkENZGoQfmImdwf4MVRI5NgwjSuC6LT0HbBRHPVVnwGHuw=="
307
+ "version": "0.172.0-darwin-x64",
308
+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.172.0-darwin-x64.tgz",
309
+ "integrity": "sha512-hrL9NQwH9E0WqK8Yofqe6fipE1XDSXx/C2fwSOagXdTRcjYXOrfQ9fSCKaKZXr/xm43ATdsRSjGGAn8IJhGmhA=="
310
310
  }
311
311
  }
312
312
  },
313
313
  "darwin-arm64": {
314
314
  "lock": {
315
315
  "@openai/codex": {
316
- "version": "0.166.0",
317
- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.166.0.tgz",
318
- "integrity": "sha512-2Szlp1l1cz5TX1ccpX4Zok3DZrot9xeZe0km+6/1v8JmqxADwyJxKBJah4dBymkwtS25j/u6dipJusTOI97Z8Q=="
316
+ "version": "0.172.0",
317
+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.172.0.tgz",
318
+ "integrity": "sha512-yHf/6wbw4Zvha2M2ylDhDrU9FgfKLYgV6xSzSjlz3gxQNsiVLkXo+fPGwBqvP0A5geLtZs9wAbq+1v7+ZVWJ0g=="
319
319
  },
320
320
  "@openai/codex-darwin-arm64": {
321
321
  "name": "@openai/codex",
322
- "version": "0.166.0-darwin-arm64",
323
- "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.166.0-darwin-arm64.tgz",
324
- "integrity": "sha512-5fWH6qqUInACcRADIewjlnRxDb4QLe0uriwehiZz0+viuAAB8I+WWefqw4xwHvyKaxeiGX4uK56+vrgfvFk3FQ=="
322
+ "version": "0.172.0-darwin-arm64",
323
+ "resolved": "https://registry.npmjs.org/@openai/codex/-/codex-0.172.0-darwin-arm64.tgz",
324
+ "integrity": "sha512-B239wE7pGeOmjylfqLymDIwuL4QgQR7pQZc5phHpZ3t8UVkno9AS3dNPEprm7AzZHw3kf2I6Uf+uOFfjGegELQ=="
325
325
  }
326
326
  }
327
327
  }
@@ -330,5 +330,5 @@
330
330
  }
331
331
  }
332
332
  },
333
- "signature": "+vQ+BC4+9IsXib0P/BdmorfWSF5aMEbxCFvRqwB1S9e+KVNi5LC8TuuJXJXwMKUeUW6mgD7fluh7PVrUkMXoAg=="
333
+ "signature": "PC1t2QaLaunjPO+cQLLhWyw+WgJ7+SvNfIva3SxlqQT+6BlrJnOILruyuaWNgnCx8Oa+ZvHmD8c9jPZPHntEBw=="
334
334
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brunobracaioli/aibrain",
3
- "version": "0.4.0-beta.30",
3
+ "version": "0.4.0-beta.31",
4
4
  "private": false,
5
5
  "description": "AISAC client for Claude Code and Codex: AI Brain memory, context management and AISAC Engineering",
6
6
  "license": "UNLICENSED",