theclawbay 0.3.73 → 0.3.74

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.
@@ -516,6 +516,35 @@ function upsertTopLevelTableKey(source, tableName, key, tomlValue) {
516
516
  function setTopLevelTableKey(source, tableName, key, tomlValue) {
517
517
  return upsertTopLevelTableKey(source, tableName, key, tomlValue);
518
518
  }
519
+ function getTopLevelTableKeyValue(source, tableName, key) {
520
+ const header = `[${tableName}]`;
521
+ const lines = source.split(/\r?\n/);
522
+ let tableStart = -1;
523
+ for (let i = 0; i < lines.length; i++) {
524
+ if ((lines[i] ?? "").trim() === header) {
525
+ tableStart = i;
526
+ break;
527
+ }
528
+ }
529
+ if (tableStart < 0)
530
+ return null;
531
+ let tableEnd = lines.length;
532
+ for (let i = tableStart + 1; i < lines.length; i++) {
533
+ if (/^\s*\[[^\]]+\]\s*$/.test(lines[i] ?? "")) {
534
+ tableEnd = i;
535
+ break;
536
+ }
537
+ }
538
+ for (let i = tableStart + 1; i < tableEnd; i++) {
539
+ const line = lines[i] ?? "";
540
+ if (/^\s*#/.test(line))
541
+ continue;
542
+ if (!new RegExp(`^\\s*${key}\\s*=`).test(line))
543
+ continue;
544
+ return parseTomlScalarValue(line);
545
+ }
546
+ return null;
547
+ }
519
548
  function removeTopLevelTableKey(source, tableName, key) {
520
549
  const header = `[${tableName}]`;
521
550
  const lines = source.split(/\r?\n/);
@@ -576,6 +605,28 @@ async function restoreManagedCodexFeatureFlags(source) {
576
605
  }
577
606
  return next;
578
607
  }
608
+ async function ensureManagedCodexFeatureFlags(source) {
609
+ const existingSnapshotRaw = await readFileIfExists(CODEX_FEATURE_FLAGS_STATE_PATH);
610
+ if (existingSnapshotRaw === null || !existingSnapshotRaw.trim()) {
611
+ const featuresHeader = "[features]";
612
+ const lines = source.split(/\r?\n/);
613
+ const hadFeaturesTable = lines.some((line) => (line ?? "").trim() === featuresHeader);
614
+ const appsPreviousValue = getTopLevelTableKeyValue(source, "features", "apps");
615
+ const appsMcpGatewayPreviousValue = getTopLevelTableKeyValue(source, "features", "apps_mcp_gateway");
616
+ const snapshot = {
617
+ hadFeaturesTable,
618
+ appsHadKey: appsPreviousValue !== null,
619
+ appsPreviousValue,
620
+ appsMcpGatewayHadKey: appsMcpGatewayPreviousValue !== null,
621
+ appsMcpGatewayPreviousValue,
622
+ };
623
+ await writeJsonObjectFile(CODEX_FEATURE_FLAGS_STATE_PATH, snapshot, 0o600);
624
+ }
625
+ let next = source;
626
+ next = setTopLevelTableKey(next, "features", "apps", "true");
627
+ next = setTopLevelTableKey(next, "features", "apps_mcp_gateway", "true");
628
+ return next;
629
+ }
579
630
  function removeTopLevelKeyLineIf(source, key, shouldRemove) {
580
631
  const lines = source.split(/\r?\n/);
581
632
  const filtered = [];
@@ -1525,6 +1576,7 @@ async function writeCodexConfig(params) {
1525
1576
  const proxyRoot = publicApiOriginForBackendUrl(params.backendUrl);
1526
1577
  const nativeCodexBaseUrl = `${proxyRoot}${CANONICAL_CODEX_NATIVE_PROXY_SUFFIX}`;
1527
1578
  let next = await restoreManagedCodexFeatureFlags(existing);
1579
+ next = await ensureManagedCodexFeatureFlags(next);
1528
1580
  next = removeManagedBlock(next, MANAGED_START, MANAGED_END);
1529
1581
  next = removeProviderTable(next, DEFAULT_PROVIDER_ID);
1530
1582
  next = upsertFirstKeyLine(next, "model_provider", `"${DEFAULT_PROVIDER_ID}"`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "theclawbay",
3
- "version": "0.3.73",
3
+ "version": "0.3.74",
4
4
  "description": "CLI for connecting Codex, Continue, Cline, GSD, OpenClaw, OpenCode, Kilo, Roo Code, Aider, experimental Trae, and experimental Zo to The Claw Bay.",
5
5
  "license": "MIT",
6
6
  "repository": {