@cabane/companion 0.6.105 → 0.6.106

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/cli.js CHANGED
@@ -7139,6 +7139,67 @@ function isStringRecord2(v) {
7139
7139
  import {
7140
7140
  Codex
7141
7141
  } from "@openai/codex-sdk";
7142
+
7143
+ // packages/agent-runtime/src/codex/config-overrides.ts
7144
+ var TOML_BARE_KEY = /^[A-Za-z0-9_-]+$/;
7145
+ function formatKey(key) {
7146
+ return TOML_BARE_KEY.test(key) ? key : JSON.stringify(key);
7147
+ }
7148
+ function isTable(value) {
7149
+ return !!value && typeof value === "object" && !Array.isArray(value);
7150
+ }
7151
+ function tomlValue(value, path) {
7152
+ if (typeof value === "string") return JSON.stringify(value);
7153
+ if (typeof value === "number") {
7154
+ if (!Number.isFinite(value)) {
7155
+ throw new Error(`Codex config override at ${path} must be a finite number`);
7156
+ }
7157
+ return `${value}`;
7158
+ }
7159
+ if (typeof value === "boolean") return value ? "true" : "false";
7160
+ if (Array.isArray(value)) {
7161
+ return `[${value.map((item, i) => tomlValue(item, `${path}[${i}]`)).join(", ")}]`;
7162
+ }
7163
+ if (isTable(value)) {
7164
+ const parts = [];
7165
+ for (const [key, child] of Object.entries(value)) {
7166
+ if (!key) throw new Error("Codex config override keys must be non-empty strings");
7167
+ if (child === void 0) continue;
7168
+ parts.push(`${formatKey(key)} = ${tomlValue(child, `${path}.${key}`)}`);
7169
+ }
7170
+ return `{${parts.join(", ")}}`;
7171
+ }
7172
+ throw new Error(`Codex config override at ${path} has an unsupported type`);
7173
+ }
7174
+ function walk(table, prefix, out) {
7175
+ const entries = Object.entries(table).filter(([, child]) => child !== void 0);
7176
+ if (entries.length === 0) {
7177
+ if (prefix) out.push(`${prefix}={}`);
7178
+ return;
7179
+ }
7180
+ for (const [key] of entries) {
7181
+ if (!key) throw new Error("Codex config override keys must be non-empty strings");
7182
+ }
7183
+ if (entries.some(([key]) => !TOML_BARE_KEY.test(key))) {
7184
+ if (!prefix) {
7185
+ throw new Error("Codex config override has a non-bare key at the root");
7186
+ }
7187
+ out.push(`${prefix}=${tomlValue(Object.fromEntries(entries), prefix)}`);
7188
+ return;
7189
+ }
7190
+ for (const [key, child] of entries) {
7191
+ const path = prefix ? `${prefix}.${key}` : key;
7192
+ if (isTable(child)) walk(child, path, out);
7193
+ else out.push(`${path}=${tomlValue(child, path)}`);
7194
+ }
7195
+ }
7196
+ function buildConfigOverrides(config) {
7197
+ const out = [];
7198
+ walk(config, "", out);
7199
+ return out;
7200
+ }
7201
+
7202
+ // packages/agent-runtime/src/codex/transport.ts
7142
7203
  function buildSdkThreadOptions(spec) {
7143
7204
  return {
7144
7205
  ...spec.model ? { model: spec.model } : {},
@@ -7155,11 +7216,17 @@ function createSdkCodexTransport(opts = {}) {
7155
7216
  const codexOptions = {
7156
7217
  ...opts.apiKey ? { apiKey: opts.apiKey } : {},
7157
7218
  ...opts.codexPathOverride ? { codexPathOverride: opts.codexPathOverride } : {},
7158
- // The `--config` overrides (MCP servers + rmcp flag). Cast at the SDK
7159
- // boundary `CodexConfig` is a TOML-shaped plain object the SDK flattens
7160
- // to dotted `--config key=value` flags (verified against the SDK's
7161
- // `serializeConfigOverrides`).
7162
- config: spec.config
7219
+ // The `--config` overrides (MCP servers + rmcp flag). CT1501: rendered to
7220
+ // finished `--config` strings by US and passed through `configOverrides`,
7221
+ // the SDK's raw passthrough NOT through `config`, which would flatten
7222
+ // them itself. A user MCP server named `my.server` cannot go in an
7223
+ // override's dotted path at all (the CLI splits the path on `.` and
7224
+ // ignores TOML quoting), so it has to ride inside an inline-table value,
7225
+ // and the SDK's flattener cannot be steered into producing one. This is
7226
+ // also what makes the PUBLISHED companion correct, where the vendored
7227
+ // patch never reached — and why that patch is gone. See
7228
+ // `config-overrides.ts`.
7229
+ configOverrides: buildConfigOverrides(spec.config)
7163
7230
  };
7164
7231
  const codex = new Codex(codexOptions);
7165
7232
  const threadOptions = buildSdkThreadOptions(spec);
package/dist/runtime.js CHANGED
@@ -6552,6 +6552,67 @@ function isStringRecord2(v) {
6552
6552
  import {
6553
6553
  Codex
6554
6554
  } from "@openai/codex-sdk";
6555
+
6556
+ // packages/agent-runtime/src/codex/config-overrides.ts
6557
+ var TOML_BARE_KEY = /^[A-Za-z0-9_-]+$/;
6558
+ function formatKey(key) {
6559
+ return TOML_BARE_KEY.test(key) ? key : JSON.stringify(key);
6560
+ }
6561
+ function isTable(value) {
6562
+ return !!value && typeof value === "object" && !Array.isArray(value);
6563
+ }
6564
+ function tomlValue(value, path) {
6565
+ if (typeof value === "string") return JSON.stringify(value);
6566
+ if (typeof value === "number") {
6567
+ if (!Number.isFinite(value)) {
6568
+ throw new Error(`Codex config override at ${path} must be a finite number`);
6569
+ }
6570
+ return `${value}`;
6571
+ }
6572
+ if (typeof value === "boolean") return value ? "true" : "false";
6573
+ if (Array.isArray(value)) {
6574
+ return `[${value.map((item, i) => tomlValue(item, `${path}[${i}]`)).join(", ")}]`;
6575
+ }
6576
+ if (isTable(value)) {
6577
+ const parts = [];
6578
+ for (const [key, child] of Object.entries(value)) {
6579
+ if (!key) throw new Error("Codex config override keys must be non-empty strings");
6580
+ if (child === void 0) continue;
6581
+ parts.push(`${formatKey(key)} = ${tomlValue(child, `${path}.${key}`)}`);
6582
+ }
6583
+ return `{${parts.join(", ")}}`;
6584
+ }
6585
+ throw new Error(`Codex config override at ${path} has an unsupported type`);
6586
+ }
6587
+ function walk(table, prefix, out) {
6588
+ const entries = Object.entries(table).filter(([, child]) => child !== void 0);
6589
+ if (entries.length === 0) {
6590
+ if (prefix) out.push(`${prefix}={}`);
6591
+ return;
6592
+ }
6593
+ for (const [key] of entries) {
6594
+ if (!key) throw new Error("Codex config override keys must be non-empty strings");
6595
+ }
6596
+ if (entries.some(([key]) => !TOML_BARE_KEY.test(key))) {
6597
+ if (!prefix) {
6598
+ throw new Error("Codex config override has a non-bare key at the root");
6599
+ }
6600
+ out.push(`${prefix}=${tomlValue(Object.fromEntries(entries), prefix)}`);
6601
+ return;
6602
+ }
6603
+ for (const [key, child] of entries) {
6604
+ const path = prefix ? `${prefix}.${key}` : key;
6605
+ if (isTable(child)) walk(child, path, out);
6606
+ else out.push(`${path}=${tomlValue(child, path)}`);
6607
+ }
6608
+ }
6609
+ function buildConfigOverrides(config) {
6610
+ const out = [];
6611
+ walk(config, "", out);
6612
+ return out;
6613
+ }
6614
+
6615
+ // packages/agent-runtime/src/codex/transport.ts
6555
6616
  function buildSdkThreadOptions(spec) {
6556
6617
  return {
6557
6618
  ...spec.model ? { model: spec.model } : {},
@@ -6568,11 +6629,17 @@ function createSdkCodexTransport(opts = {}) {
6568
6629
  const codexOptions = {
6569
6630
  ...opts.apiKey ? { apiKey: opts.apiKey } : {},
6570
6631
  ...opts.codexPathOverride ? { codexPathOverride: opts.codexPathOverride } : {},
6571
- // The `--config` overrides (MCP servers + rmcp flag). Cast at the SDK
6572
- // boundary `CodexConfig` is a TOML-shaped plain object the SDK flattens
6573
- // to dotted `--config key=value` flags (verified against the SDK's
6574
- // `serializeConfigOverrides`).
6575
- config: spec.config
6632
+ // The `--config` overrides (MCP servers + rmcp flag). CT1501: rendered to
6633
+ // finished `--config` strings by US and passed through `configOverrides`,
6634
+ // the SDK's raw passthrough NOT through `config`, which would flatten
6635
+ // them itself. A user MCP server named `my.server` cannot go in an
6636
+ // override's dotted path at all (the CLI splits the path on `.` and
6637
+ // ignores TOML quoting), so it has to ride inside an inline-table value,
6638
+ // and the SDK's flattener cannot be steered into producing one. This is
6639
+ // also what makes the PUBLISHED companion correct, where the vendored
6640
+ // patch never reached — and why that patch is gone. See
6641
+ // `config-overrides.ts`.
6642
+ configOverrides: buildConfigOverrides(spec.config)
6576
6643
  };
6577
6644
  const codex = new Codex(codexOptions);
6578
6645
  const threadOptions = buildSdkThreadOptions(spec);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabane/companion",
3
- "version": "0.6.105",
3
+ "version": "0.6.106",
4
4
  "type": "module",
5
5
  "description": "The Cabane Companion (headless): connect a coding agent on your machine to your Cabane workspace as a responder — drive work against your own codebase, files, and MCP servers without putting any of it in Cabane.",
6
6
  "license": "UNLICENSED",
@@ -29,8 +29,8 @@
29
29
  "prepublishOnly": "pnpm build"
30
30
  },
31
31
  "dependencies": {
32
- "@anthropic-ai/claude-agent-sdk": "0.3.263",
33
- "@openai/codex-sdk": "0.153.4",
32
+ "@anthropic-ai/claude-agent-sdk": "0.3.270",
33
+ "@openai/codex-sdk": "0.154.0",
34
34
  "@hono/node-server": "1.19.14",
35
35
  "@inquirer/prompts": "7.10.1",
36
36
  "commander": "12.1.0",