botmux 3.18.5 → 3.18.6

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.
@@ -1 +1 @@
1
- cd39121384378fc2a1e3b9dc8cd4ef4523b48386c926712eaaa7d5e5e92715c6
1
+ 772cb5082be7e1181051fb6e4344f92bc8a484024a69f8d8f5cbc607b014e30a
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA8BA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAoLhD,OAAO,EAAE,KAAK,KAAK,EAA0C,MAAM,yBAAyB,CAAC;AAujB7F;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,GAAG,OAAO,CACpF;IACE,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oDAAoD;IACpD,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CACrC,CA6LA;AAmlDD,MAAM,MAAM,kBAAkB,GAC1B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,SAAS,GAAG,gBAAgB,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACtE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,kBAAkB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtH,MAAM,MAAM,iBAA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AAwB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,2BAA2B,EAAE,UAAU,GAAG,IAAI,CAAC,GAClH,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAuL7B"}
package/dist/cli.js CHANGED
@@ -52,6 +52,7 @@ import { buildBotFromAddFlags, editInputFromFlags, isScriptedSetupInvocation, ma
52
52
  import { detectUnusableOwnerEntries, normalizeManagedOwnerEntries, resolveScannerAllowedUser, } from './setup/owner-identity.js';
53
53
  import { interactiveSelect, pickChoice, pickCliSelection } from './setup/interactive-select.js';
54
54
  import { buildPreset, serializePreset, presetFilename } from './setup/agent-preset.js';
55
+ import bundledScopeManifest from './setup/lark-scopes.json' with { type: 'json' };
55
56
  import { validateCodexAppManagedSendOrigin, } from './utils/codex-app-dispatch-ledger.js';
56
57
  import { hasProtectedSessionMutationOwnership } from './core/session-mutation-guard.js';
57
58
  import { logger } from './utils/logger.js';
@@ -360,23 +361,8 @@ function botBrand(b) {
360
361
  * Returns: 写出的 JSON 文件绝对路径.
361
362
  */
362
363
  function writeScopesJsonToConfigDir() {
363
- // build script 会把 src/setup/lark-scopes.json copy 到 dist/setup/.
364
- // dist 模式下 __dirname 是 dist/, 找 ./setup/lark-scopes.json; dev (tsx)
365
- // 模式找 src/setup/lark-scopes.json 在源码同目录也成立.
366
- const here = dirname(fileURLToPath(import.meta.url));
367
- const srcCandidates = [
368
- join(here, 'setup', 'lark-scopes.json'),
369
- join(here, '..', 'src', 'setup', 'lark-scopes.json'),
370
- ];
371
- let scopesPath = srcCandidates[0];
372
- for (const p of srcCandidates) {
373
- if (existsSync(p)) {
374
- scopesPath = p;
375
- break;
376
- }
377
- }
378
364
  const destPath = join(CONFIG_DIR, 'lark-scopes.json');
379
- copyFileSync(scopesPath, destPath);
365
+ writeFileSync(destPath, `${JSON.stringify(bundledScopeManifest, null, 2)}\n`);
380
366
  return destPath;
381
367
  }
382
368
  function printCopyHint(filePath) {
@@ -12368,6 +12354,36 @@ switch (command) {
12368
12354
  case '__zmx-attach-managed':
12369
12355
  cmdManagedZmxAttach(process.argv.slice(3));
12370
12356
  break;
12357
+ // Hidden self-check for the compiled single-file binary: exercise the two
12358
+ // setup-time code paths that load lark-scopes.json off a module-relative path —
12359
+ // readDefaultScopeManifest() (real Open Platform setup) and
12360
+ // writeScopesJsonToConfigDir() (writes ~/.botmux/lark-scopes.json). In compiled
12361
+ // mode the module graph lives in the read-only virtual /$bunfs, so the old
12362
+ // readFileSync/copyFileSync of a __dirname-derived path threw
12363
+ // "找不到 botmux lark-scopes.json". The npm/Node unit tests can't catch that —
12364
+ // dist/ physically exists there — so smoke-bun-binary.mjs drives THIS against
12365
+ // the actual binary. Prints a one-line JSON summary and exits 0; any throw
12366
+ // (missing/empty manifest, unwritable path) exits non-zero and fails the smoke.
12367
+ case '__selfcheck': {
12368
+ const { readDefaultScopeManifest } = await import('./setup/open-platform-automation.js');
12369
+ const manifest = readDefaultScopeManifest();
12370
+ const tenant = manifest.scopes?.tenant?.length ?? 0;
12371
+ const user = manifest.scopes?.user?.length ?? 0;
12372
+ if (tenant <= 0 || user <= 0) {
12373
+ console.error(`__selfcheck: lark-scopes manifest empty (tenant=${tenant}, user=${user})`);
12374
+ process.exit(1);
12375
+ }
12376
+ const written = writeScopesJsonToConfigDir();
12377
+ const onDisk = JSON.parse(readFileSync(written, 'utf-8'));
12378
+ const wroteTenant = onDisk?.scopes?.tenant?.length ?? 0;
12379
+ const wroteUser = onDisk?.scopes?.user?.length ?? 0;
12380
+ if (wroteTenant !== tenant || wroteUser !== user) {
12381
+ console.error(`__selfcheck: written manifest mismatch (${wroteTenant}/${wroteUser} vs ${tenant}/${user})`);
12382
+ process.exit(1);
12383
+ }
12384
+ console.log(JSON.stringify({ ok: true, tenant, user, written }));
12385
+ process.exit(0);
12386
+ }
12371
12387
  case 'delete':
12372
12388
  case 'del':
12373
12389
  case 'rm':