@withtruing/companion 0.14.0 → 0.14.1

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
@@ -4,7 +4,7 @@ import { existsSync } from 'node:fs';
4
4
  import { dirname, join, resolve } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { addConnection, cleanupMigratedManagedRepositories, configPath, enableWorkspacePolling, hasTemporaryManagedRepository, loadConfig, managedReposDir, migrateManagedRepositoriesToTemporaryStorage, normalizeConsoleUrl, recordWorkspaceId, removePairing, } from './config.js';
7
- import { CompanionClient, CompanionHttpError, CLAUDE_CLI_FAST_MODEL, CODEX_FAST_MODEL, PairingHttpError, } from './http-client.js';
7
+ import { CompanionClient, CompanionHttpError, CLAUDE_CLI_FAST_MODEL, wholeReadBackendName as sharedWholeReadBackendName, CODEX_FAST_MODEL, PairingHttpError, } from './http-client.js';
8
8
  import { assertIsRepo, currentCommit, GIT_UNAVAILABLE_MESSAGE, REMOTE_TROUBLESHOOTING_HINT, repositoryIdentity, RepositoryIdentityError, repositoryTopLevel, } from './local-scan.js';
9
9
  import { runAnalyseShipmentTask, runDesignPromptTask, runGenerateSpecBatchTask, runGenericTask, runProposeNewCapabilitiesTask, runProposeSkeletonTask, runStructuredModelCall, runVerifyModuleTask } from './api-key-caller.js';
10
10
  import { runAnalyseShipmentTaskViaCli, runDesignPromptTaskViaCli, runGenerateSpecBatchTaskViaCli, runGenericTaskViaCli, runProposeNewCapabilitiesTaskViaCli, runProposeSkeletonTaskViaCli, runStructuredModelCallViaCli, runVerifyModuleTaskViaCli, runWholeReadModelCallViaCli } from './claude-cli-caller.js';
@@ -1180,11 +1180,7 @@ function wholeReadTransport(client, onUsageLimit) {
1180
1180
  };
1181
1181
  }
1182
1182
  function wholeReadBackendName(runtime) {
1183
- if (runtime.backend === 'api-key')
1184
- return 'anthropic_api';
1185
- if (runtime.backend === 'cli')
1186
- return 'claude_cli';
1187
- return 'codex';
1183
+ return sharedWholeReadBackendName(runtime.backend);
1188
1184
  }
1189
1185
  async function runWholeReadAssignment(input) {
1190
1186
  const connection = input.connections.find((candidate) => candidate.connectionId === input.assignment.connectionId);
@@ -1368,7 +1364,8 @@ async function runPairing(pairing, options) {
1368
1364
  return [[connection.connectionId, CODEX_FAST_MODEL]];
1369
1365
  return [];
1370
1366
  }));
1371
- const client = new CompanionClient(pairing.url, pairing.token, fastModelsByConnection);
1367
+ const backendsByConnection = Object.fromEntries(pairing.connections.map((connection) => [connection.connectionId, sharedWholeReadBackendName(connection.backend)]));
1368
+ const client = new CompanionClient(pairing.url, pairing.token, fastModelsByConnection, backendsByConnection);
1372
1369
  const tokenRejected = () => {
1373
1370
  error(`The Console at ${pairing.url} no longer accepts this computer's token — stopped working for it. Pair again from that Console to reconnect.`);
1374
1371
  return 'token_rejected';
@@ -30,10 +30,20 @@ export const COMPANION_CAPABILITIES = [
30
30
  export const CLAUDE_CLI_FAST_MODEL = 'claude-haiku-5-5';
31
31
  export const CODEX_FAST_MODEL = 'gpt-5.6-luna';
32
32
  export const WHOLE_READ_FAST_MODEL_CAPABILITY = 'whole-read-fast-model@';
33
- const capabilityHeaders = (fastModel) => ({
33
+ export const WHOLE_READ_BACKEND_CAPABILITY = 'whole-read-backend@';
34
+ /** The one mapping from a connection's backend to the name the server freezes and the readiness report uses. */
35
+ export function wholeReadBackendName(backend) {
36
+ if (backend === 'api-key')
37
+ return 'anthropic_api';
38
+ if (backend === 'cli')
39
+ return 'claude_cli';
40
+ return 'codex';
41
+ }
42
+ export const capabilityHeaders = (fastModel, backend) => ({
34
43
  'X-Companion-Capabilities': [...COMPANION_CAPABILITIES,
35
44
  ...(fastModel && /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(fastModel)
36
- ? [`${WHOLE_READ_FAST_MODEL_CAPABILITY}${fastModel}`] : [])].join(','),
45
+ ? [`${WHOLE_READ_FAST_MODEL_CAPABILITY}${fastModel}`] : []),
46
+ ...(backend && /^[a-z_]{1,32}$/.test(backend) ? [`${WHOLE_READ_BACKEND_CAPABILITY}${backend}`] : [])].join(','),
37
47
  });
38
48
  export class CompanionHttpError extends Error {
39
49
  status;
@@ -61,13 +71,15 @@ export class CompanionClient {
61
71
  url;
62
72
  token;
63
73
  fastModelsByConnection;
64
- constructor(url, token, fastModelsByConnection = {}) {
74
+ backendsByConnection;
75
+ constructor(url, token, fastModelsByConnection = {}, backendsByConnection = {}) {
65
76
  this.url = url;
66
77
  this.token = token;
67
78
  this.fastModelsByConnection = fastModelsByConnection;
79
+ this.backendsByConnection = backendsByConnection;
68
80
  }
69
81
  capabilityHeaders(connectionId) {
70
- return capabilityHeaders(connectionId ? this.fastModelsByConnection[connectionId] : undefined);
82
+ return capabilityHeaders(connectionId ? this.fastModelsByConnection[connectionId] : undefined, connectionId ? this.backendsByConnection[connectionId] : undefined);
71
83
  }
72
84
  request(path, timeoutMs, init) {
73
85
  return fetch(`${this.url}${path}`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withtruing/companion",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "The Truing companion: reads your code and runs AI on your own computer, for Truing.",
5
5
  "type": "module",
6
6
  "license": "MIT",