product-console-companion 0.7.0 → 0.7.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.
@@ -17,6 +17,7 @@ export const COMPANION_VERSION = packageVersion;
17
17
  export const COMPANION_CAPABILITIES = [
18
18
  'auto-surface-map@1',
19
19
  'auto-surface-mapper@1',
20
+ 'auto-surface-mapper@2',
20
21
  'snapshot-read@1',
21
22
  'local-git-range@1',
22
23
  'verify-automatic-surface@1',
@@ -14,7 +14,7 @@ const JS_TO_TS = {
14
14
  '.mjs': ['.mts'],
15
15
  '.cjs': ['.cts'],
16
16
  };
17
- const BLOCKING = new Set([
17
+ const BLOCKING_V1 = new Set([
18
18
  'unresolved_internal',
19
19
  'unresolved_dynamic',
20
20
  'declaration_only',
@@ -28,6 +28,16 @@ const BLOCKING = new Set([
28
28
  'limit_files',
29
29
  'limit_bytes',
30
30
  ]);
31
+ /** Under @2, `limit_bytes` is a deliberate trim (nearest files kept), not a block. */
32
+ const BLOCKING_V2 = new Set([...BLOCKING_V1].filter((code) => code !== 'limit_bytes'));
33
+ /** Every mapper version this companion can produce; advertised as capabilities. */
34
+ export const SUPPORTED_MAPPER_VERSIONS = [
35
+ 'auto-surface-mapper@1',
36
+ 'auto-surface-mapper@2',
37
+ ];
38
+ export function isSupportedMapperVersion(value) {
39
+ return SUPPORTED_MAPPER_VERSIONS.includes(value);
40
+ }
31
41
  export class MappingFailure extends Error {
32
42
  kind;
33
43
  code;
@@ -501,6 +511,8 @@ function seedRoots(seeds, workspace) {
501
511
  }
502
512
  export async function expandImports(input) {
503
513
  const settings = input.settings ?? DEFAULT_MAPPER_SETTINGS;
514
+ const mapperVersion = input.mapperVersion ?? 'auto-surface-mapper@1';
515
+ const blocking = mapperVersion === 'auto-surface-mapper@2' ? BLOCKING_V2 : BLOCKING_V1;
504
516
  const workspace = await discoverWorkspace(input.sandboxPath, input.tree);
505
517
  const diagnostics = [...workspace.diagnostics];
506
518
  const externals = [];
@@ -606,11 +618,11 @@ export async function expandImports(input) {
606
618
  const uniqueDiagnostics = [...new Map(diagnostics.map((entry) => [`${entry.code}\0${entry.path}\0${entry.detail}`, entry])).values()].sort(compareDiagnostic);
607
619
  const uniqueExternals = [...new Map(externals.map((entry) => [`${entry.from}\0${entry.specifier}`, entry])).values()].sort((a, b) => a.from.localeCompare(b.from) || a.specifier.localeCompare(b.specifier));
608
620
  return {
609
- mapper: { version: 'auto-surface-mapper@1', settings },
621
+ mapper: { version: mapperVersion, settings },
610
622
  resolutionInputs: workspace.resolutionInputs,
611
623
  files,
612
624
  externals: uniqueExternals,
613
- status: uniqueDiagnostics.some((diagnostic) => BLOCKING.has(diagnostic.code)) ? 'incomplete' : 'complete',
625
+ status: uniqueDiagnostics.some((diagnostic) => blocking.has(diagnostic.code)) ? 'incomplete' : 'complete',
614
626
  diagnostics: uniqueDiagnostics,
615
627
  };
616
628
  }
@@ -3,7 +3,7 @@ import { execFile } from 'node:child_process';
3
3
  import { statSync } from 'node:fs';
4
4
  import { promisify } from 'node:util';
5
5
  import { hasLinkedPathComponent } from './investigation-reader.js';
6
- import { DEFAULT_MAPPER_SETTINGS, enumerateTrackedFiles, expandImports, MappingFailure, trackedNamedPathStatus, } from './import-resolver.js';
6
+ import { DEFAULT_MAPPER_SETTINGS, enumerateTrackedFiles, expandImports, isSupportedMapperVersion, MappingFailure, trackedNamedPathStatus, } from './import-resolver.js';
7
7
  import { repositoryMissingReason, spawnFailureCode } from './local-scan.js';
8
8
  import { createSandbox } from './sandbox.js';
9
9
  export const SURFACE_SEED_PROMPT_VERSION = 'map_module_seeds@1';
@@ -191,6 +191,9 @@ function seedPrompt(claim, trackedPaths) {
191
191
  }
192
192
  export async function mapSurfaceSnapshot(input) {
193
193
  const { claim, sandboxPath, tree } = input;
194
+ if (!isSupportedMapperVersion(claim.mapperVersion)) {
195
+ throw new MappingFailure('stable', 'mapper_version_unsupported', `Unsupported mapper version ${String(claim.mapperVersion)}`);
196
+ }
194
197
  const diagnostics = [];
195
198
  const namedPaths = [];
196
199
  const namedSeeds = [];
@@ -275,6 +278,7 @@ export async function mapSurfaceSnapshot(input) {
275
278
  tree,
276
279
  seeds,
277
280
  settings: claim.mapperSettings,
281
+ mapperVersion: claim.mapperVersion,
278
282
  });
279
283
  const expansion = diagnostics.some((diagnostic) => diagnostic.code === 'named_path_unverifiable')
280
284
  ? { ...expanded, status: 'incomplete' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "product-console-companion",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Local-first BYOS companion for the Fynch Product Console — reads code and runs AI calls from your own machine instead of the hosted server.",
5
5
  "type": "module",
6
6
  "license": "MIT",