@moldea.ai/cli 7.1.0 → 9.0.0

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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  The canonical read-only local command-line composition for deterministic inspection of `moldea` repositories.
6
6
 
7
- The version 7.1 executable exposes one schema-4-only JSON contract. `validate` and `inspect` are content-free, `scope` matches changed paths by reading only the project manifest, and `content` retrieves one explicitly selected canonical text asset in bounded Unicode-safe chunks. Collection and content responses use deterministic snapshot-bound cursors, exact final UTF-8 byte accounting, a 65,536-byte default page budget, and a 1,048,576-byte hard page ceiling.
7
+ The version 9 executable exposes one schema-5-only JSON contract. `validate` and `inspect` are content-free, `scope` matches changed paths by reading only the project manifest, and `content` retrieves one explicitly selected canonical text asset in bounded Unicode-safe chunks. Collection and content responses use deterministic snapshot-bound cursors, exact final UTF-8 byte accounting, a 65,536-byte default page budget, and a 1,048,576-byte hard page ceiling.
8
8
 
9
9
  Install and invoke the CLI from each adopted repository. Global or user-home installation is outside the supported trust boundary because it can make unrelated repositories share ambient skill and executable behavior.
10
10
 
@@ -91,7 +91,9 @@ Before attempting a snapshot, the CLI pins the selected root directory, its work
91
91
 
92
92
  The CLI retries the complete provisional attempt for differing inventories, Repository FS `SNAPSHOT_CHANGED` failures, and reader-creation missing-entry or parent-type failures when a fresh inventory proves the source changed. It recreates the inventory, reader, wrappers, operation state, and filesystem resource budget for every retry and never reuses provisional bytes or results. Three total attempts are allowed. Exhaustion or a changed pinned identity returns `cli:WORKING_TREE_UNSTABLE` with message `The working tree did not remain stable.` and `retryable: true`.
93
93
 
94
- The CLI does not expose selected paths, candidate paths, resolved repository roots, raw process errors, or Git diagnostics in failures. Every accepted snapshot operation creates a fresh Core instance with the exact effective limits: `maxEntries`, `maxFileBytes`, `maxManifestBytes`, `maxDiagnostics`, and `maxEvidence` retain their names, while `maxTotalBytes` becomes Core's `maxTotalBytesRead`. The active package-backed adapter set contains the immutable `anthropic`, `claude-agent-sdk`, `cloudflare-agents`, `eve`, `google-genai`, `langchain`, `langgraph`, `openai`, `openai-agents-sdk`, and `vercel-ai-sdk` adapter singletons; Core's built-in `custom` behavior remains available without registration.
94
+ The CLI does not expose selected paths, candidate paths, resolved repository roots, raw process errors, or Git diagnostics in failures. Every accepted snapshot operation creates a fresh Core instance with the exact effective limits: `maxEntries`, `maxFileBytes`, `maxManifestBytes`, `maxDiagnostics`, and `maxEvidence` retain their names, while `maxTotalBytes` becomes Core's `maxTotalBytesRead`. Core's logical `maxRetainedBytes` ceiling is four times that total-read limit, capped at JavaScript's maximum safe integer, so validation and prepared inspection state remain bounded without adding another CLI option. Each `inspect` attempt prepares one content-free Core inspection and reads its requested page without a second validation pass. The active package-backed adapter set contains the immutable `anthropic`, `claude-agent-sdk`, `cloudflare-agents`, `eve`, `google-genai`, `langchain`, `langgraph`, `openai`, `openai-agents-sdk`, and `vercel-ai-sdk` adapter singletons; Core's built-in `custom` behavior remains available without registration.
95
+
96
+ Core resource refusals are mapped without loss into safe CLI error details: the limit name, configured maximum, observed or projected usage, and stable next action remain available, while repository bodies and private host diagnostics remain absent.
95
97
 
96
98
  Known `RepositorySourceException`, `CoreConfigurationException`, and `CoreOperationException` contracts become safe `repository` or `core` errors with their owning code, documented retryability, logical repository path when applicable, and non-confidential metadata. The private content-transformation marker is translated before the common repository-source case. Unexpected failures, including an internal `RepositoryPathException`, become the generic non-retryable `cli:INTERNAL_ERROR` contract without causes or rejected values.
97
99
 
@@ -101,9 +103,9 @@ The executable owns one operation-scoped `AbortController`. Repository-backed co
101
103
 
102
104
  Git process cancellation uses the safe retryable `git:GIT_OPERATION_ABORTED` contract with message `The Git operation was aborted.` at internal command boundaries. When cancellation originates from a process signal before output completion, the executable may emit no human or JSON document rather than expose a successful or partial result. Active Git child processes are terminated through the same operation signal; no raw abort reason or process diagnostic is printed.
103
105
 
104
- A successfully completed Core inspection produces `validate` human or JSON output without exposing the project index, canonical content, or adapter evidence details. Zero diagnostics return status `valid` and exit code `0`; one or more diagnostics return status `invalid` and exit with code `1`. Diagnostics use bounded pages in JSON mode.
106
+ A successfully completed Core inspection produces `validate` human or JSON output without exposing the project index, canonical content, or adapter evidence details. Zero errors return status `valid` and exit code `0`, including when scoped unverified-relationship warnings are present. Confirmed errors return status `invalid` and exit code `1`. Complete error and warning counts appear on every JSON page; human output names the affected relationship and safe version context when available. Diagnostics use bounded pages in JSON mode.
105
107
 
106
- `inspect` uses the same completion status and exit codes. Human output reports the repository format and complete collection counts. JSON output contains only allowlisted records: one independently keyed `agent` record per canonical agent with exactly its `agentId` and manifest-declared `runtimeId`, asset identifiers and metadata, diagnostics without arbitrary details, and evidence summaries without adapter detail payloads. An assignment establishes canonical configuration only. It does not claim that a runtime is installed, implemented, qualified, or published. Unbounded child collections are emitted as independently keyed records, so no parent record grows with the repository. A recursive guard rejects any non-`content` result containing a `content` property or an exact canonical body.
108
+ `inspect` uses the same completion status and exit codes. Human output reports the repository format and complete collection counts. JSON output contains only allowlisted records: one independently keyed `agent` record per canonical agent with exactly its `agentId` and manifest-declared `runtimeId`, asset identifiers and metadata, diagnostic severity and closed warning context without arbitrary error details, and evidence summaries without adapter detail payloads. An assignment establishes canonical configuration only. It does not claim that a runtime is installed, implemented, qualified, or published. Unbounded child collections are emitted as independently keyed records, so no parent record grows with the repository. A recursive guard rejects any non-`content` result containing a `content` property or an exact canonical body.
107
109
 
108
110
  `scope` accepts either one repository-logical path through `--path` or NUL-delimited UTF-8 paths through `--paths-stdin`. It reads only `/moldea/moldea.yaml`, invokes Core's deterministic relationship matcher without adapters, and returns relevance, complete counts and digests, and paged match or diagnostic records. `content` accepts exactly one canonical moldea text path and returns metadata plus the largest complete Unicode-scalar chunk that fits its output page.
109
111
 
@@ -111,13 +113,15 @@ For JSON collection and content output, `--max-output-bytes` accepts 4,096 throu
111
113
 
112
114
  The 65,536-byte default is retained by a reproducible three-sample resource corpus covering ordinary and 1,024-path repositories, large Unicode content, broad relationship output, dense diagnostics, and invalid binary content. Large traversals use additional bounded pages without raising the page peak. The 1 MiB hard maximum is a single-response safety boundary, not a total repository-size limit.
113
115
 
116
+ Each CLI invocation is stateless. An `inspect --cursor` call repeats Git inventory and Core preparation before returning its page; a prepared Core inspection used within one process can read further pages without repeating that work. In a 65-agent shared-source fixture on Linux, the default output budget required three separate CLI commands, emitted 155,606 cumulative JSON bytes, and took 3.37 seconds in one local run. The result describes that fixture and host, not a fixed performance limit or a token count. Use `scope` for changed-path relevance and `content` for one canonical file when a full inspection is unnecessary, and request only the pages needed for the task.
117
+
114
118
  ## Installed composition and integrity
115
119
 
116
120
  Before `validate`, `inspect`, or `composition` produces a result, the executable compares its installed package metadata, actually resolved first-class package identities and versions, compatible-major first-class dependency declarations, active package-backed adapter registration, Core repository-format support, minimum Git constant, and JSON output schema constant. Source-workspace dependencies use `workspace:^<major>.0.0`; packed dependencies retain the equivalent `^<major>.0.0` range. Every resolved package must satisfy the CLI release's declared major line. Exact pins, unbounded ranges, package-manager overrides to a different major or prerelease, missing or additional first-class dependencies, duplicate or invalid adapter IDs, package-backed registration of `custom`, unsupported adapter formats, and invalid constants fail before Git discovery or repository inspection. Compatible patch and minor resolutions remain valid and are reported exactly by `composition`.
117
121
 
118
122
  `composition` reports the installed CLI version and JSON schema version in the envelope, plus the supported Node.js range, minimum Git version, sorted exact package versions, Core repository-format versions, and every sorted executable adapter with its accepted repository formats. Core's built-in `custom` adapter is included using Core's format support. The CLI does not report matrix entries, maturity, implementation status, target profiles, evidence links, or compatibility claims owned by the packages website. Current published technical compatibility and target maturity are available from [`https://packages.moldea.ai/compatibility/runtimes.json`](https://packages.moldea.ai/compatibility/runtimes.json).
119
123
 
120
- Successful human and JSON reports use exit code `0`; JSON uses status `valid` and the schema 4 deterministic envelope. The command never uses status `invalid`. A contradictory installation returns the non-retryable `cli:COMPOSITION_STATE_INVALID` error with message `The installed composition state is invalid.` and exit code `3`, without a partial result. The command accesses no Git executable, repository filesystem, client manifest, network, or Cloud service.
124
+ Successful human and JSON reports use exit code `0`; JSON uses status `valid` and the schema 5 deterministic envelope. The command never uses status `invalid`. A contradictory installation returns the non-retryable `cli:COMPOSITION_STATE_INVALID` error with message `The installed composition state is invalid.` and exit code `3`, without a partial result. The command accesses no Git executable, repository filesystem, client manifest, network, or Cloud service.
121
125
 
122
126
  ## Development
123
127
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { r as MINIMUM_GIT_VERSION, t as require_semver } from "./semver-BzaJzKRS.js";
3
- import { r as ACTIVE_RUNTIME_ADAPTERS } from "./core-composition-6wOvReoY.js";
3
+ import { r as ACTIVE_RUNTIME_ADAPTERS } from "./core-composition-CttwXtDG.js";
4
4
  import { SUPPORTED_REPOSITORY_FORMAT_VERSIONS } from "@moldea.ai/core";
5
5
  //#region src/composition/constants.ts
6
6
  var import_semver = require_semver();
@@ -12,17 +12,17 @@ var MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES = Object.freeze([
12
12
  var MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX = "@moldea.ai/adapter-";
13
13
  var MOLDEA_CLI_CUSTOM_ADAPTER_ID = "custom";
14
14
  var MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES = Object.freeze({
15
- "@moldea.ai/adapter-anthropic": "^3.0.0",
16
- "@moldea.ai/adapter-claude-agent-sdk": "^2.0.0",
17
- "@moldea.ai/adapter-cloudflare-agents": "^2.0.0",
18
- "@moldea.ai/adapter-eve": "^2.0.0",
19
- "@moldea.ai/adapter-google-genai": "^2.0.0",
20
- "@moldea.ai/adapter-langchain": "^2.0.0",
21
- "@moldea.ai/adapter-langgraph": "^2.0.0",
22
- "@moldea.ai/adapter-openai": "^3.0.0",
23
- "@moldea.ai/adapter-openai-agents-sdk": "^2.0.0",
24
- "@moldea.ai/adapter-vercel-ai-sdk": "^2.0.0",
25
- "@moldea.ai/core": "^3.0.0",
15
+ "@moldea.ai/adapter-anthropic": "^5.0.0",
16
+ "@moldea.ai/adapter-claude-agent-sdk": "^4.0.0",
17
+ "@moldea.ai/adapter-cloudflare-agents": "^4.0.0",
18
+ "@moldea.ai/adapter-eve": "^4.0.0",
19
+ "@moldea.ai/adapter-google-genai": "^4.0.0",
20
+ "@moldea.ai/adapter-langchain": "^4.0.0",
21
+ "@moldea.ai/adapter-langgraph": "^4.0.0",
22
+ "@moldea.ai/adapter-openai": "^5.0.0",
23
+ "@moldea.ai/adapter-openai-agents-sdk": "^4.0.0",
24
+ "@moldea.ai/adapter-vercel-ai-sdk": "^4.0.0",
25
+ "@moldea.ai/core": "^5.0.0",
26
26
  "@moldea.ai/repository": "^2.0.0",
27
27
  "@moldea.ai/repository-fs": "^2.0.0"
28
28
  });
@@ -50,7 +50,7 @@ var createActiveAdapterMap = (adapters, coreRepositoryFormatVersions) => {
50
50
  */
51
51
  var isMoldeaCliCompositionStateValid = (input) => {
52
52
  const { dependencies, installedPackageVersions, supportedNodeRange, version } = input.packageMetadata;
53
- if ((0, import_semver.valid)(version) === null || supportedNodeRange === null || (0, import_semver.validRange)(supportedNodeRange) === null || (0, import_semver.valid)(input.minimumGitVersion) === null || input.outputSchemaVersion !== 4 || dependencies === null || installedPackageVersions === null || !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)) return false;
53
+ if ((0, import_semver.valid)(version) === null || supportedNodeRange === null || (0, import_semver.validRange)(supportedNodeRange) === null || (0, import_semver.valid)(input.minimumGitVersion) === null || input.outputSchemaVersion !== 5 || dependencies === null || installedPackageVersions === null || !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)) return false;
54
54
  const activeAdapterMap = createActiveAdapterMap(input.activeAdapters, input.coreSupportedRepositoryFormatVersions);
55
55
  if (activeAdapterMap === null) return false;
56
56
  const expectedPackageNames = [...MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES, ...[...activeAdapterMap.keys()].map((adapterId) => `${MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX}${adapterId}`)];
@@ -133,10 +133,10 @@ var resolveInstalledMoldeaCliComposition = (input) => resolveMoldeaCliCompositio
133
133
  activeAdapters: ACTIVE_RUNTIME_ADAPTERS,
134
134
  coreSupportedRepositoryFormatVersions: SUPPORTED_REPOSITORY_FORMAT_VERSIONS,
135
135
  minimumGitVersion: MINIMUM_GIT_VERSION,
136
- outputSchemaVersion: 4,
136
+ outputSchemaVersion: 5,
137
137
  packageMetadata: input.packageMetadata
138
138
  });
139
139
  //#endregion
140
140
  export { resolveInstalledMoldeaCliComposition };
141
141
 
142
- //# sourceMappingURL=composition-7d632gM8.js.map
142
+ //# sourceMappingURL=composition-Ck3cXQUk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"composition-7d632gM8.js","names":[],"sources":["../../src/composition/constants.ts","../../src/composition/validations.ts","../../src/composition/transformers.ts","../../src/composition/composition.ts"],"sourcesContent":["// exact first-class package identities required by every CLI release\nexport const MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES = Object.freeze([\n '@moldea.ai/core',\n '@moldea.ai/repository',\n '@moldea.ai/repository-fs',\n] as const);\n\n// stable package and adapter identities used by runtime composition validation\nexport const MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX = '@moldea.ai/adapter-';\nexport const MOLDEA_CLI_CUSTOM_ADAPTER_ID = 'custom';\n\n// compatible first-class package lines accepted by CLI 7\nexport const MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES = Object.freeze({\n '@moldea.ai/adapter-anthropic': '^3.0.0',\n '@moldea.ai/adapter-claude-agent-sdk': '^2.0.0',\n '@moldea.ai/adapter-cloudflare-agents': '^2.0.0',\n '@moldea.ai/adapter-eve': '^2.0.0',\n '@moldea.ai/adapter-google-genai': '^2.0.0',\n '@moldea.ai/adapter-langchain': '^2.0.0',\n '@moldea.ai/adapter-langgraph': '^2.0.0',\n '@moldea.ai/adapter-openai': '^3.0.0',\n '@moldea.ai/adapter-openai-agents-sdk': '^2.0.0',\n '@moldea.ai/adapter-vercel-ai-sdk': '^2.0.0',\n '@moldea.ai/core': '^3.0.0',\n '@moldea.ai/repository': '^2.0.0',\n '@moldea.ai/repository-fs': '^2.0.0',\n} as const);\n","import { satisfies as doesVersionSatisfy, valid as isValidVersion, validRange } from 'semver';\n\nimport type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\n\nimport {\n MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX,\n MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES,\n MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n} from './constants.js';\nimport type { IMoldeaCliCompositionStateInput } from './types.js';\n\nconst ADAPTER_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;\n\nconst hasExactStringSet = (left: readonly string[], right: readonly string[]): boolean => {\n if (\n left.length !== right.length ||\n new Set(left).size !== left.length ||\n new Set(right).size !== right.length\n ) {\n return false;\n }\n\n const rightValues = new Set(right);\n return left.every((entry) => rightValues.has(entry));\n};\n\nconst hasUniquePositiveIntegers = (entries: readonly number[]): boolean =>\n entries.length > 0 &&\n entries.every((entry) => Number.isSafeInteger(entry) && entry > 0) &&\n new Set(entries).size === entries.length;\n\nconst createActiveAdapterMap = (\n adapters: readonly IRuntimeAdapter[],\n coreRepositoryFormatVersions: readonly number[],\n): ReadonlyMap<string, IRuntimeAdapter> | null => {\n const adapterMap = new Map<string, IRuntimeAdapter>();\n\n for (const adapter of adapters) {\n if (\n adapterMap.has(adapter.id) ||\n adapter.id === MOLDEA_CLI_CUSTOM_ADAPTER_ID ||\n !ADAPTER_ID_PATTERN.test(adapter.id) ||\n !hasUniquePositiveIntegers(adapter.supportedRepositoryFormatVersions) ||\n adapter.supportedRepositoryFormatVersions.some(\n (version) => !coreRepositoryFormatVersions.includes(version),\n )\n ) {\n return null;\n }\n\n adapterMap.set(adapter.id, adapter);\n }\n\n return adapterMap;\n};\n\n/**\n * Verifies the installed package manifest and actual executable adapter composition.\n * @param input The installed package, Core, adapter, Git, and JSON-schema state.\n * @returns Whether every runtime composition invariant is satisfied.\n */\nexport const isMoldeaCliCompositionStateValid = (\n input: IMoldeaCliCompositionStateInput,\n): boolean => {\n const { dependencies, installedPackageVersions, supportedNodeRange, version } =\n input.packageMetadata;\n\n if (\n isValidVersion(version) === null ||\n supportedNodeRange === null ||\n validRange(supportedNodeRange) === null ||\n isValidVersion(input.minimumGitVersion) === null ||\n input.outputSchemaVersion !== 4 ||\n dependencies === null ||\n installedPackageVersions === null ||\n !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)\n ) {\n return false;\n }\n\n const activeAdapterMap = createActiveAdapterMap(\n input.activeAdapters,\n input.coreSupportedRepositoryFormatVersions,\n );\n\n if (activeAdapterMap === null) {\n return false;\n }\n\n const expectedPackageNames = [\n ...MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n ...[...activeAdapterMap.keys()].map(\n (adapterId) => `${MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX}${adapterId}`,\n ),\n ];\n const declaredPackageNames = Object.keys(dependencies).filter((packageName) =>\n packageName.startsWith('@moldea.ai/'),\n );\n const resolvedPackageNames = Object.keys(installedPackageVersions);\n\n if (\n !hasExactStringSet(declaredPackageNames, expectedPackageNames) ||\n !hasExactStringSet(resolvedPackageNames, expectedPackageNames)\n ) {\n return false;\n }\n\n return expectedPackageNames.every((packageName) => {\n const resolvedVersion = installedPackageVersions[packageName];\n const declaredRange = dependencies[packageName];\n const supportedRange =\n MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES[\n packageName as keyof typeof MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES\n ];\n\n return (\n resolvedVersion !== undefined &&\n isValidVersion(resolvedVersion) !== null &&\n supportedRange !== undefined &&\n (declaredRange === supportedRange || declaredRange === `workspace:${supportedRange}`) &&\n doesVersionSatisfy(resolvedVersion, supportedRange)\n );\n });\n};\n","import { MOLDEA_CLI_CUSTOM_ADAPTER_ID } from './constants.js';\nimport type {\n IMoldeaCliAdapterComposition,\n IMoldeaCliCompositionResult,\n IMoldeaCliCompositionStateInput,\n} from './types.js';\n\nconst compareIdentifiers = (left: string, right: string): number =>\n left < right ? -1 : left > right ? 1 : 0;\n\n/** Recursively freezes a composition result without retaining mutable input ownership. */\nconst freezeCompositionValue = <TValue extends object>(value: TValue): TValue => {\n const pendingValues: object[] = [value];\n const visitedValues = new Set<object>();\n\n while (pendingValues.length > 0) {\n const currentValue = pendingValues.pop();\n\n if (currentValue === undefined || visitedValues.has(currentValue)) {\n continue;\n }\n\n visitedValues.add(currentValue);\n for (const nestedValue of Object.values(currentValue as Readonly<Record<string, unknown>>)) {\n if (typeof nestedValue === 'object' && nestedValue !== null) {\n pendingValues.push(nestedValue);\n }\n }\n\n Object.freeze(currentValue);\n }\n\n return value;\n};\n\n/**\n * Creates the compact immutable composition result from validated installed state.\n * @param input The already validated installed and executable composition.\n * @returns A deeply immutable composition result in deterministic report order.\n */\nexport const createMoldeaCliCompositionResult = (\n input: IMoldeaCliCompositionStateInput,\n): IMoldeaCliCompositionResult => {\n const adapters: IMoldeaCliAdapterComposition[] = [\n {\n id: MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n },\n ...input.activeAdapters.map((adapter) => ({\n id: adapter.id,\n repositoryFormatVersions: [...adapter.supportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n })),\n ].sort((left, right) => compareIdentifiers(left.id, right.id));\n const packages = Object.entries(input.packageMetadata.installedPackageVersions ?? {})\n .map(([name, version]) => ({ name, version }))\n .sort((left, right) => compareIdentifiers(left.name, right.name));\n\n return freezeCompositionValue({\n adapters,\n minimumGitVersion: input.minimumGitVersion,\n packages,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n supportedNodeRange: input.packageMetadata.supportedNodeRange ?? '',\n });\n};\n","import { SUPPORTED_REPOSITORY_FORMAT_VERSIONS } from '@moldea.ai/core';\n\nimport { ACTIVE_RUNTIME_ADAPTERS } from '../core-composition/index.js';\nimport { MINIMUM_GIT_VERSION } from '../git-version/index.js';\nimport { MOLDEA_CLI_JSON_SCHEMA_VERSION } from '../json-output-contract/index.js';\n\nimport { createMoldeaCliCompositionResult } from './transformers.js';\nimport type {\n IMoldeaCliCompositionResolution,\n IMoldeaCliCompositionStateInput,\n IMoldeaCliInstalledCompositionInput,\n} from './types.js';\nimport { isMoldeaCliCompositionStateValid } from './validations.js';\n\nconst INVALID_COMPOSITION_RESOLUTION = Object.freeze({ kind: 'invalid' as const });\n\n/**\n * Resolves one explicit runtime composition without emitting a partial composition result.\n * @param input The installed and actual runtime state to compare.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveMoldeaCliComposition = (\n input: IMoldeaCliCompositionStateInput,\n): IMoldeaCliCompositionResolution => {\n try {\n if (!isMoldeaCliCompositionStateValid(input)) {\n return INVALID_COMPOSITION_RESOLUTION;\n }\n\n return Object.freeze({\n kind: 'valid',\n result: createMoldeaCliCompositionResult(input),\n });\n } catch {\n return INVALID_COMPOSITION_RESOLUTION;\n }\n};\n\n/**\n * Resolves composition through the fixed package, Core, adapter, Git, and JSON composition.\n * @param input The installed package metadata.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveInstalledMoldeaCliComposition = (\n input: IMoldeaCliInstalledCompositionInput,\n): IMoldeaCliCompositionResolution =>\n resolveMoldeaCliComposition({\n activeAdapters: ACTIVE_RUNTIME_ADAPTERS,\n coreSupportedRepositoryFormatVersions: SUPPORTED_REPOSITORY_FORMAT_VERSIONS,\n minimumGitVersion: MINIMUM_GIT_VERSION,\n outputSchemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n packageMetadata: input.packageMetadata,\n });\n"],"mappings":";;;;;;AACA,IAAa,wCAAwC,OAAO,OAAO;CACjE;CACA;CACA;AACF,CAAU;AAGV,IAAa,oCAAo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C1B,gBAAgB;CAChB,uCAAuC;CACvC,mBAAmB;CACnB,qBAAA;CACA,iBAAiB,MAAM;AACzB,CAAC"}
1
+ {"version":3,"file":"composition-Ck3cXQUk.js","names":[],"sources":["../../src/composition/constants.ts","../../src/composition/validations.ts","../../src/composition/transformers.ts","../../src/composition/composition.ts"],"sourcesContent":["// exact first-class package identities required by every CLI release\nexport const MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES = Object.freeze([\n '@moldea.ai/core',\n '@moldea.ai/repository',\n '@moldea.ai/repository-fs',\n] as const);\n\n// stable package and adapter identities used by runtime composition validation\nexport const MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX = '@moldea.ai/adapter-';\nexport const MOLDEA_CLI_CUSTOM_ADAPTER_ID = 'custom';\n\n// compatible first-class package lines accepted by CLI 9\nexport const MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES = Object.freeze({\n '@moldea.ai/adapter-anthropic': '^5.0.0',\n '@moldea.ai/adapter-claude-agent-sdk': '^4.0.0',\n '@moldea.ai/adapter-cloudflare-agents': '^4.0.0',\n '@moldea.ai/adapter-eve': '^4.0.0',\n '@moldea.ai/adapter-google-genai': '^4.0.0',\n '@moldea.ai/adapter-langchain': '^4.0.0',\n '@moldea.ai/adapter-langgraph': '^4.0.0',\n '@moldea.ai/adapter-openai': '^5.0.0',\n '@moldea.ai/adapter-openai-agents-sdk': '^4.0.0',\n '@moldea.ai/adapter-vercel-ai-sdk': '^4.0.0',\n '@moldea.ai/core': '^5.0.0',\n '@moldea.ai/repository': '^2.0.0',\n '@moldea.ai/repository-fs': '^2.0.0',\n} as const);\n","import { satisfies as doesVersionSatisfy, valid as isValidVersion, validRange } from 'semver';\n\nimport type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\n\nimport {\n MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX,\n MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES,\n MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n} from './constants.js';\nimport type { IMoldeaCliCompositionStateInput } from './types.js';\n\nconst ADAPTER_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;\n\nconst hasExactStringSet = (left: readonly string[], right: readonly string[]): boolean => {\n if (\n left.length !== right.length ||\n new Set(left).size !== left.length ||\n new Set(right).size !== right.length\n ) {\n return false;\n }\n\n const rightValues = new Set(right);\n return left.every((entry) => rightValues.has(entry));\n};\n\nconst hasUniquePositiveIntegers = (entries: readonly number[]): boolean =>\n entries.length > 0 &&\n entries.every((entry) => Number.isSafeInteger(entry) && entry > 0) &&\n new Set(entries).size === entries.length;\n\nconst createActiveAdapterMap = (\n adapters: readonly IRuntimeAdapter[],\n coreRepositoryFormatVersions: readonly number[],\n): ReadonlyMap<string, IRuntimeAdapter> | null => {\n const adapterMap = new Map<string, IRuntimeAdapter>();\n\n for (const adapter of adapters) {\n if (\n adapterMap.has(adapter.id) ||\n adapter.id === MOLDEA_CLI_CUSTOM_ADAPTER_ID ||\n !ADAPTER_ID_PATTERN.test(adapter.id) ||\n !hasUniquePositiveIntegers(adapter.supportedRepositoryFormatVersions) ||\n adapter.supportedRepositoryFormatVersions.some(\n (version) => !coreRepositoryFormatVersions.includes(version),\n )\n ) {\n return null;\n }\n\n adapterMap.set(adapter.id, adapter);\n }\n\n return adapterMap;\n};\n\n/**\n * Verifies the installed package manifest and actual executable adapter composition.\n * @param input The installed package, Core, adapter, Git, and JSON-schema state.\n * @returns Whether every runtime composition invariant is satisfied.\n */\nexport const isMoldeaCliCompositionStateValid = (\n input: IMoldeaCliCompositionStateInput,\n): boolean => {\n const { dependencies, installedPackageVersions, supportedNodeRange, version } =\n input.packageMetadata;\n\n if (\n isValidVersion(version) === null ||\n supportedNodeRange === null ||\n validRange(supportedNodeRange) === null ||\n isValidVersion(input.minimumGitVersion) === null ||\n input.outputSchemaVersion !== 5 ||\n dependencies === null ||\n installedPackageVersions === null ||\n !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)\n ) {\n return false;\n }\n\n const activeAdapterMap = createActiveAdapterMap(\n input.activeAdapters,\n input.coreSupportedRepositoryFormatVersions,\n );\n\n if (activeAdapterMap === null) {\n return false;\n }\n\n const expectedPackageNames = [\n ...MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES,\n ...[...activeAdapterMap.keys()].map(\n (adapterId) => `${MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX}${adapterId}`,\n ),\n ];\n const declaredPackageNames = Object.keys(dependencies).filter((packageName) =>\n packageName.startsWith('@moldea.ai/'),\n );\n const resolvedPackageNames = Object.keys(installedPackageVersions);\n\n if (\n !hasExactStringSet(declaredPackageNames, expectedPackageNames) ||\n !hasExactStringSet(resolvedPackageNames, expectedPackageNames)\n ) {\n return false;\n }\n\n return expectedPackageNames.every((packageName) => {\n const resolvedVersion = installedPackageVersions[packageName];\n const declaredRange = dependencies[packageName];\n const supportedRange =\n MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES[\n packageName as keyof typeof MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES\n ];\n\n return (\n resolvedVersion !== undefined &&\n isValidVersion(resolvedVersion) !== null &&\n supportedRange !== undefined &&\n (declaredRange === supportedRange || declaredRange === `workspace:${supportedRange}`) &&\n doesVersionSatisfy(resolvedVersion, supportedRange)\n );\n });\n};\n","import { MOLDEA_CLI_CUSTOM_ADAPTER_ID } from './constants.js';\nimport type {\n IMoldeaCliAdapterComposition,\n IMoldeaCliCompositionResult,\n IMoldeaCliCompositionStateInput,\n} from './types.js';\n\nconst compareIdentifiers = (left: string, right: string): number =>\n left < right ? -1 : left > right ? 1 : 0;\n\n/** Recursively freezes a composition result without retaining mutable input ownership. */\nconst freezeCompositionValue = <TValue extends object>(value: TValue): TValue => {\n const pendingValues: object[] = [value];\n const visitedValues = new Set<object>();\n\n while (pendingValues.length > 0) {\n const currentValue = pendingValues.pop();\n\n if (currentValue === undefined || visitedValues.has(currentValue)) {\n continue;\n }\n\n visitedValues.add(currentValue);\n for (const nestedValue of Object.values(currentValue as Readonly<Record<string, unknown>>)) {\n if (typeof nestedValue === 'object' && nestedValue !== null) {\n pendingValues.push(nestedValue);\n }\n }\n\n Object.freeze(currentValue);\n }\n\n return value;\n};\n\n/**\n * Creates the compact immutable composition result from validated installed state.\n * @param input The already validated installed and executable composition.\n * @returns A deeply immutable composition result in deterministic report order.\n */\nexport const createMoldeaCliCompositionResult = (\n input: IMoldeaCliCompositionStateInput,\n): IMoldeaCliCompositionResult => {\n const adapters: IMoldeaCliAdapterComposition[] = [\n {\n id: MOLDEA_CLI_CUSTOM_ADAPTER_ID,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n },\n ...input.activeAdapters.map((adapter) => ({\n id: adapter.id,\n repositoryFormatVersions: [...adapter.supportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n })),\n ].sort((left, right) => compareIdentifiers(left.id, right.id));\n const packages = Object.entries(input.packageMetadata.installedPackageVersions ?? {})\n .map(([name, version]) => ({ name, version }))\n .sort((left, right) => compareIdentifiers(left.name, right.name));\n\n return freezeCompositionValue({\n adapters,\n minimumGitVersion: input.minimumGitVersion,\n packages,\n repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort(\n (left, right) => left - right,\n ),\n supportedNodeRange: input.packageMetadata.supportedNodeRange ?? '',\n });\n};\n","import { SUPPORTED_REPOSITORY_FORMAT_VERSIONS } from '@moldea.ai/core';\n\nimport { ACTIVE_RUNTIME_ADAPTERS } from '../core-composition/index.js';\nimport { MINIMUM_GIT_VERSION } from '../git-version/index.js';\nimport { MOLDEA_CLI_JSON_SCHEMA_VERSION } from '../json-output-contract/index.js';\n\nimport { createMoldeaCliCompositionResult } from './transformers.js';\nimport type {\n IMoldeaCliCompositionResolution,\n IMoldeaCliCompositionStateInput,\n IMoldeaCliInstalledCompositionInput,\n} from './types.js';\nimport { isMoldeaCliCompositionStateValid } from './validations.js';\n\nconst INVALID_COMPOSITION_RESOLUTION = Object.freeze({ kind: 'invalid' as const });\n\n/**\n * Resolves one explicit runtime composition without emitting a partial composition result.\n * @param input The installed and actual runtime state to compare.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveMoldeaCliComposition = (\n input: IMoldeaCliCompositionStateInput,\n): IMoldeaCliCompositionResolution => {\n try {\n if (!isMoldeaCliCompositionStateValid(input)) {\n return INVALID_COMPOSITION_RESOLUTION;\n }\n\n return Object.freeze({\n kind: 'valid',\n result: createMoldeaCliCompositionResult(input),\n });\n } catch {\n return INVALID_COMPOSITION_RESOLUTION;\n }\n};\n\n/**\n * Resolves composition through the fixed package, Core, adapter, Git, and JSON composition.\n * @param input The installed package metadata.\n * @returns A valid immutable result or the single invalid-state outcome.\n */\nexport const resolveInstalledMoldeaCliComposition = (\n input: IMoldeaCliInstalledCompositionInput,\n): IMoldeaCliCompositionResolution =>\n resolveMoldeaCliComposition({\n activeAdapters: ACTIVE_RUNTIME_ADAPTERS,\n coreSupportedRepositoryFormatVersions: SUPPORTED_REPOSITORY_FORMAT_VERSIONS,\n minimumGitVersion: MINIMUM_GIT_VERSION,\n outputSchemaVersion: MOLDEA_CLI_JSON_SCHEMA_VERSION,\n packageMetadata: input.packageMetadata,\n });\n"],"mappings":";;;;;;AACA,IAAa,wCAAwC,OAAO,OAAO;CACjE;CACA;CACA;AACF,CAAU;AAGV,IAAa,oCAAoC;AACjD,IAAa,+BAA+B;AAG5C,IAAa,wCAAwC,OAAO,OAAO;CACjE,gCAAgC;CAChC,uCAAuC;CACvC,wCAAwC;CACxC,0BAA0B;CAC1B,mCAAmC;CACnC,gCAAgC;CAChC,gCAAgC;CAChC,6BAA6B;CAC7B,wCAAwC;CACxC,oCAAoC;CACpC,mBAAmB;CACnB,yBAAyB;CACzB,4BAA4B;AAC9B,CAAU;;;ACdV,IAAM,qBAAqB;AAE3B,IAAM,qBAAqB,MAAyB,UAAsC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;CACF,GACA,GAAG,MAAM,eAAe,KAAK,aAAa;EACxC,IAAI,QAAQ;EACZ,0BAA0B,CAAC,GAAG,QAAQ,iCAAiC,CAAC,CAAC,MACtE,MAAM,UAAU,OAAO,KAC1B;CACF,EAAE,CACJ,CAAC,CAAC,MAAM,MAAM,UAAU,mBAAmB,KAAK,IAAI,MAAM,EAAE,CAAC;CAC7D,MAAM,WAAW,OAAO,QAAQ,MAAM,gBAAgB,4BAA4B,CAAC,CAAC,CAAC,CAClF,KAAK,CAAC,MAAM,cAAc;EAAE;EAAM;CAAQ,EAAE,CAAC,CAC7C,MAAM,MAAM,UAAU,mBAAmB,KAAK,MAAM,MAAM,IAAI,CAAC;CAElE,OAAO,uBAAuB;EAC5B;EACA,mBAAmB,MAAM;EACzB;EACA,0BAA0B,CAAC,GAAG,MAAM,qCAAqC,CAAC,CAAC,MACxE,MAAM,UAAU,OAAO,KAC1B;EACA,oBAAoB,MAAM,gBAAgB,sBAAsB;CAClE,CAAC;AACH;;;ACxDA,IAAM,iCAAiC,OAAO,OAAO,EAAE,MAAM,UAAmB,CAAC;;;;;;AAOjF,IAAa,+BACX,UACoC;CACpC,IAAI;EACF,IAAI,CAAC,iCAAiC,KAAK,GACzC,OAAO;EAGT,OAAO,OAAO,OAAO;GACnB,MAAM;GACN,QAAQ,iCAAiC,KAAK;EAChD,CAAC;CACH,QAAQ;EACN,OAAO;CACT;AACF;;;;;;AAOA,IAAa,wCACX,UAEA,4BAA4B;CAC1B,gBAAgB;CAChB,uCAAuC;CACvC,mBAAmB;CACnB,qBAAA;CACA,iBAAiB,MAAM;AACzB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { n as executeMoldeaCliCoreInspection } from "./core-composition-6wOvReoY.js";
2
+ import { n as executeMoldeaCliCoreInspection } from "./core-composition-CttwXtDG.js";
3
3
  export { executeMoldeaCliCoreInspection };
@@ -30,6 +30,7 @@ var compareAdapterIds = (left, right) => {
30
30
  if (left.id > right.id) return 1;
31
31
  return 0;
32
32
  };
33
+ var calculateRetainedByteLimit = (maxTotalBytes) => maxTotalBytes > Math.floor(Number.MAX_SAFE_INTEGER / 4) ? Number.MAX_SAFE_INTEGER : maxTotalBytes * 4;
33
34
  /**
34
35
  * Creates the private attempt-local Core composition boundary.
35
36
  * @param coreFactory The immutable Core construction boundary.
@@ -47,6 +48,7 @@ var createMoldeaCliCoreInspectionExecutor = (coreFactory = createCore, activeAda
47
48
  maxEvidence: input.resourceLimits.maxEvidence,
48
49
  maxFileBytes: input.resourceLimits.maxFileBytes,
49
50
  maxManifestBytes: input.resourceLimits.maxManifestBytes,
51
+ maxRetainedBytes: calculateRetainedByteLimit(input.resourceLimits.maxTotalBytes),
50
52
  maxTotalBytesRead: input.resourceLimits.maxTotalBytes
51
53
  })
52
54
  });
@@ -54,12 +56,12 @@ var createMoldeaCliCoreInspectionExecutor = (coreFactory = createCore, activeAda
54
56
  repository: input.repository,
55
57
  ...input.signal === void 0 ? {} : { signal: input.signal }
56
58
  };
57
- return input.command === "inspect" ? core.inspectProjectPage({
58
- ...projectInput,
59
+ if (input.command === "validate") return core.validateProject(projectInput);
60
+ return (await core.createProjectInspection(projectInput)).readPage({
59
61
  ...input.cursor === void 0 ? {} : { cursor: input.cursor },
60
62
  maxItems: Math.min(256, input.resourceLimits.maxEntries),
61
63
  view: "all"
62
- }) : core.validateProject(projectInput);
64
+ });
63
65
  };
64
66
  };
65
67
  /**
@@ -87,4 +89,4 @@ var executeMoldeaCliCoreInspection = createMoldeaCliCoreInspectionExecutor();
87
89
  //#endregion
88
90
  export { executeMoldeaCliCoreInspection as n, ACTIVE_RUNTIME_ADAPTERS as r, createMoldeaCliCoreInspectionExecutor as t };
89
91
 
90
- //# sourceMappingURL=core-composition-6wOvReoY.js.map
92
+ //# sourceMappingURL=core-composition-CttwXtDG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-composition-CttwXtDG.js","names":[],"sources":["../../src/core-composition/constants.ts","../../src/core-composition/executor.ts"],"sourcesContent":["import type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\nimport { anthropicAdapter } from '@moldea.ai/adapter-anthropic';\nimport { claudeAgentSdkAdapter } from '@moldea.ai/adapter-claude-agent-sdk';\nimport { cloudflareAgentsAdapter } from '@moldea.ai/adapter-cloudflare-agents';\nimport { eveAdapter } from '@moldea.ai/adapter-eve';\nimport { googleGenAiAdapter } from '@moldea.ai/adapter-google-genai';\nimport { langChainAdapter } from '@moldea.ai/adapter-langchain';\nimport { langGraphAdapter } from '@moldea.ai/adapter-langgraph';\nimport { openAiAdapter } from '@moldea.ai/adapter-openai';\nimport { openAiAgentsSdkAdapter } from '@moldea.ai/adapter-openai-agents-sdk';\nimport { vercelAiSdkAdapter } from '@moldea.ai/adapter-vercel-ai-sdk';\n\n// package-backed runtime adapters active in this CLI release\nexport const ACTIVE_RUNTIME_ADAPTERS: readonly IRuntimeAdapter[] = Object.freeze([\n anthropicAdapter,\n claudeAgentSdkAdapter,\n cloudflareAgentsAdapter,\n eveAdapter,\n googleGenAiAdapter,\n langChainAdapter,\n langGraphAdapter,\n openAiAdapter,\n openAiAgentsSdkAdapter,\n vercelAiSdkAdapter,\n]);\n","import { createCore } from '@moldea.ai/core';\nimport type { IRuntimeAdapter } from '@moldea.ai/core/adapter';\n\nimport { ACTIVE_RUNTIME_ADAPTERS } from './constants.js';\nimport type { IMoldeaCliCoreFactory, IMoldeaCliCoreInspectionExecutor } from './types.js';\n\nconst compareAdapterIds = (left: IRuntimeAdapter, right: IRuntimeAdapter): number => {\n if (left.id < right.id) {\n return -1;\n }\n\n if (left.id > right.id) {\n return 1;\n }\n\n return 0;\n};\n\nconst calculateRetainedByteLimit = (maxTotalBytes: number): number =>\n maxTotalBytes > Math.floor(Number.MAX_SAFE_INTEGER / 4)\n ? Number.MAX_SAFE_INTEGER\n : maxTotalBytes * 4;\n\n/**\n * Creates the private attempt-local Core composition boundary.\n * @param coreFactory The immutable Core construction boundary.\n * @param activeAdapters The package-backed adapters active in this CLI release.\n * @returns An executor that creates and runs a fresh Core instance per snapshot attempt.\n */\nexport const createMoldeaCliCoreInspectionExecutor = (\n coreFactory: IMoldeaCliCoreFactory = createCore,\n activeAdapters: readonly IRuntimeAdapter[] = ACTIVE_RUNTIME_ADAPTERS,\n): IMoldeaCliCoreInspectionExecutor => {\n const normalizedAdapters = Object.freeze([...activeAdapters].sort(compareAdapterIds));\n\n return async (input) => {\n const core = coreFactory({\n adapters: normalizedAdapters,\n limits: Object.freeze({\n maxDiagnostics: input.resourceLimits.maxDiagnostics,\n maxEntries: input.resourceLimits.maxEntries,\n maxEvidence: input.resourceLimits.maxEvidence,\n maxFileBytes: input.resourceLimits.maxFileBytes,\n maxManifestBytes: input.resourceLimits.maxManifestBytes,\n maxRetainedBytes: calculateRetainedByteLimit(input.resourceLimits.maxTotalBytes),\n maxTotalBytesRead: input.resourceLimits.maxTotalBytes,\n }),\n });\n\n const projectInput = {\n repository: input.repository,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n };\n\n if (input.command === 'validate') {\n return core.validateProject(projectInput);\n }\n\n const inspection = await core.createProjectInspection(projectInput);\n\n return inspection.readPage({\n ...(input.cursor === undefined ? {} : { cursor: input.cursor }),\n maxItems: Math.min(256, input.resourceLimits.maxEntries),\n view: 'all',\n });\n };\n};\n\n/**\n * Executes one project inspection through a fresh CLI-configured Core instance.\n * @returns A promise resolving to Core's complete immutable inspection result.\n * @throws\n * - DUPLICATE_ADAPTER_ID: A runtime adapter ID is registered more than once.\n * - RESERVED_ADAPTER_ID: A reserved runtime adapter ID was supplied.\n * - INVALID_ADAPTER_DEFINITION: A runtime adapter definition is invalid.\n * - INVALID_RESOURCE_LIMIT: A Core resource limit is invalid.\n * - INVALID_ARGUMENT: The Core operation received an invalid argument.\n * - INVALID_REPOSITORY_PATH: A repository path is invalid.\n * - ENTRY_NOT_FOUND: A discovered file disappeared from the reader snapshot.\n * - ENTRY_NOT_FILE: A discovered file changed type during inspection.\n * - ENTRY_NOT_DIRECTORY: A discovered directory changed type during inspection.\n * - ACCESS_DENIED: Access to the repository source was denied.\n * - SOURCE_UNAVAILABLE: The repository source is unavailable.\n * - SNAPSHOT_CHANGED: The repository snapshot changed during inspection.\n * - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.\n * - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.\n * - ABORTED: Project inspection or a repository operation was aborted.\n * - ADAPTER_EXECUTION_FAILED: A runtime adapter failed or returned an invalid result.\n */\nexport const executeMoldeaCliCoreInspection = createMoldeaCliCoreInspectionExecutor();\n"],"mappings":";;;;;;;;;;;;;AAaA,IAAa,0BAAsD,OAAO,OAAO;CAC/E;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;AClBD,IAAM,qBAAqB,MAAuB,UAAmC;CACnF,IAAI,KAAK,KAAK,MAAM,IAClB,OAAO;CAGT,IAAI,KAAK,KAAK,MAAM,IAClB,OAAO;CAGT,OAAO;AACT;AAEA,IAAM,8BAA8B,kBAClC,gBAAgB,KAAK,MAAM,OAAO,mBAAmB,CAAC,IAClD,OAAO,mBACP,gBAAgB;;;;;;;AAQtB,IAAa,yCACX,cAAqC,YACrC,iBAA6C,4BACR;CACrC,MAAM,qBAAqB,OAAO,OAAO,CAAC,GAAG,cAAc,CAAC,CAAC,KAAK,iBAAiB,CAAC;CAEpF,OAAO,OAAO,UAAU;EACtB,MAAM,OAAO,YAAY;GACvB,UAAU;GACV,QAAQ,OAAO,OAAO;IACpB,gBAAgB,MAAM,eAAe;IACrC,YAAY,MAAM,eAAe;IACjC,aAAa,MAAM,eAAe;IAClC,cAAc,MAAM,eAAe;IACnC,kBAAkB,MAAM,eAAe;IACvC,kBAAkB,2BAA2B,MAAM,eAAe,aAAa;IAC/E,mBAAmB,MAAM,eAAe;GAC1C,CAAC;EACH,CAAC;EAED,MAAM,eAAe;GACnB,YAAY,MAAM;GAClB,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;EAC/D;EAEA,IAAI,MAAM,YAAY,YACpB,OAAO,KAAK,gBAAgB,YAAY;EAK1C,QAAO,MAFkB,KAAK,wBAAwB,YAAY,EAAA,CAEhD,SAAS;GACzB,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;GAC7D,UAAU,KAAK,IAAI,KAAK,MAAM,eAAe,UAAU;GACvD,MAAM;EACR,CAAC;CACH;AACF;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,iCAAiC,sCAAsC"}
package/dist/moldea.js CHANGED
@@ -294,7 +294,7 @@ var parsePositiveSafeInteger = (input) => {
294
294
  const parsedInteger = Number(input);
295
295
  return Number.isSafeInteger(parsedInteger) && parsedInteger > 0 ? parsedInteger : null;
296
296
  };
297
- /** Parses one output byte budget inside the schema 4 transport bounds. */
297
+ /** Parses one output byte budget inside the schema 5 transport bounds. */
298
298
  var parseMoldeaCliOutputByteLimit = (input) => {
299
299
  const parsed = parsePositiveSafeInteger(input);
300
300
  return parsed !== null && parsed >= 4096 && parsed <= 1048576 ? parsed : null;
@@ -340,7 +340,7 @@ var isMoldeaCliCommand = (input) => {
340
340
  return input !== void 0 && COMMAND_NAMES.has(input);
341
341
  };
342
342
  /**
343
- * Parses the complete schema 4 command grammar without mutating caller arguments.
343
+ * Parses the complete schema 5 command grammar without mutating caller arguments.
344
344
  * @param commandLineArguments The process arguments after the executable path.
345
345
  * @returns A normalized command, informational request, or safe invocation error.
346
346
  */
@@ -669,16 +669,16 @@ var createMoldeaCliOwnedError = (code) => {
669
669
  };
670
670
  //#endregion
671
671
  //#region src/json-output-contract/document.ts
672
- /** Creates one strict schema 4 JSON envelope. */
672
+ /** Creates one strict schema 5 JSON envelope. */
673
673
  var createMoldeaCliJsonEnvelope = (input) => Object.freeze({
674
674
  cliVersion: input.cliVersion,
675
675
  command: input.command,
676
676
  error: input.error,
677
677
  result: input.result,
678
- schemaVersion: 4,
678
+ schemaVersion: 5,
679
679
  status: input.status
680
680
  });
681
- /** Serializes one schema 4 envelope with its required trailing line feed. */
681
+ /** Serializes one schema 5 envelope with its required trailing line feed. */
682
682
  var serializeMoldeaCliJsonEnvelope = (input) => `${serializeJsonDeterministically(createMoldeaCliJsonEnvelope(input))}\n`;
683
683
  //#endregion
684
684
  //#region src/json-output-contract/guard.ts
@@ -725,11 +725,20 @@ var formatMoldeaCliHumanDiagnostic = (diagnostic) => {
725
725
  const lines = [`${diagnostic.source}:${diagnostic.code}${location} ${diagnostic.message}`];
726
726
  if (diagnostic.pointer !== null) lines.push(` pointer: ${diagnostic.pointer}`);
727
727
  if (diagnostic.entity !== null) lines.push(` entity: ${formatMoldeaCliHumanDiagnosticEntity(diagnostic.entity)}`);
728
+ if (diagnostic.severity === "warning") {
729
+ lines.push(` unverified relationship: ${diagnostic.details.relationship}`);
730
+ lines.push(` reason: ${diagnostic.details.reason.replaceAll("-", " ")}`);
731
+ if (diagnostic.details.reason === "version-dependent-behavior") {
732
+ lines.push(` package: ${diagnostic.details.packageName}`);
733
+ lines.push(` declared range: ${diagnostic.details.declaredRange ?? "unavailable"}`);
734
+ lines.push(` behavior boundary: ${diagnostic.details.boundaryVersion}`);
735
+ }
736
+ }
728
737
  return lines.join("\n");
729
738
  };
730
739
  /** Creates shared human status lines for one completed repository command. */
731
- var createMoldeaCliHumanStatusLines = (isValid, formatVersion) => {
732
- const lines = [`The moldea project is ${isValid ? "valid" : "invalid"}.`];
740
+ var createMoldeaCliHumanStatusLines = (isValid, formatVersion, warningCount = 0) => {
741
+ const lines = [`The moldea project is ${isValid ? warningCount > 0 ? "valid with warnings" : "valid" : "invalid"}.`];
733
742
  if (formatVersion !== null) lines.push(`Repository format: ${formatVersion}`);
734
743
  return lines;
735
744
  };
@@ -741,7 +750,7 @@ var formatMoldeaCliHelp = (command) => {
741
750
  };
742
751
  /** Formats one safe CLI error for human stderr output. */
743
752
  var formatMoldeaCliHumanError = (error) => `${error.source}:${error.code} ${error.message}\n`;
744
- /** Formats any strict schema 4 JSON envelope. */
753
+ /** Formats any strict schema 5 JSON envelope. */
745
754
  var formatMoldeaCliJsonResult = (command, result, error, status, cliVersion) => serializeMoldeaCliJsonEnvelope({
746
755
  cliVersion,
747
756
  command,
@@ -749,7 +758,7 @@ var formatMoldeaCliJsonResult = (command, result, error, status, cliVersion) =>
749
758
  result,
750
759
  status
751
760
  });
752
- /** Formats one safe schema 4 JSON error envelope. */
761
+ /** Formats one safe schema 5 JSON error envelope. */
753
762
  var formatMoldeaCliJsonError = (error, command, cliVersion) => formatMoldeaCliJsonResult(command, null, error, "error", cliVersion);
754
763
  /** Formats one valid composition result for human stdout. */
755
764
  var formatMoldeaCliHumanCompositionResult = (result, cliVersion) => {
@@ -757,7 +766,7 @@ var formatMoldeaCliHumanCompositionResult = (result, cliVersion) => {
757
766
  "The installed CLI composition state is valid.",
758
767
  `CLI version: ${cliVersion}`,
759
768
  `Supported Node.js: ${result.supportedNodeRange}`,
760
- `JSON output schema: 4`,
769
+ `JSON output schema: 5`,
761
770
  `Minimum Git: ${result.minimumGitVersion}`,
762
771
  `Repository formats: ${result.repositoryFormatVersions.join(", ")}`,
763
772
  "Packages:",
@@ -766,25 +775,27 @@ var formatMoldeaCliHumanCompositionResult = (result, cliVersion) => {
766
775
  ...result.adapters.map(({ id, repositoryFormatVersions }) => ` ${id}: repository formats ${repositoryFormatVersions.join(", ")}`)
767
776
  ].join("\n")}\n`;
768
777
  };
769
- /** Formats one composition result in the strict schema 4 envelope. */
778
+ /** Formats one composition result in the strict schema 5 envelope. */
770
779
  var formatMoldeaCliJsonCompositionResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Composition, result, null, "valid", cliVersion);
771
780
  /** Formats one completed validation result for human stdout. */
772
781
  var formatMoldeaCliHumanValidateResult = (result) => {
773
- const lines = createMoldeaCliHumanStatusLines(result.diagnosticCount === 0, result.formatVersion);
782
+ const lines = createMoldeaCliHumanStatusLines(result.valid, result.formatVersion, result.warningCount);
774
783
  for (const diagnostic of result.page.records) lines.push(formatMoldeaCliHumanDiagnostic(diagnostic));
775
784
  lines.push(formatMoldeaCliHumanCount(result.diagnosticCount, "Diagnostic", "Diagnostics"));
785
+ lines.push(formatMoldeaCliHumanCount(result.errorCount, "Error", "Errors"));
786
+ lines.push(formatMoldeaCliHumanCount(result.warningCount, "Warning", "Warnings"));
776
787
  if (result.page.cursor !== null) lines.push("Additional diagnostics are available through JSON pagination.");
777
788
  return `${lines.join("\n")}\n`;
778
789
  };
779
- /** Formats one validation result in the strict schema 4 envelope. */
790
+ /** Formats one validation result in the strict schema 5 envelope. */
780
791
  var formatMoldeaCliJsonValidateResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Validate, result, null, result.valid ? "valid" : "invalid", cliVersion);
781
792
  /** Formats one completed metadata inspection for human stdout. */
782
793
  var formatMoldeaCliHumanInspectResult = (result) => {
783
- const lines = createMoldeaCliHumanStatusLines(result.valid, result.formatVersion);
794
+ const lines = createMoldeaCliHumanStatusLines(result.valid, result.formatVersion, result.counts.warnings);
784
795
  for (const [label, count] of Object.entries(result.counts)) lines.push(`${label}: ${count}`);
785
796
  return `${lines.join("\n")}\n`;
786
797
  };
787
- /** Formats one metadata inspection in the strict schema 4 envelope. */
798
+ /** Formats one metadata inspection in the strict schema 5 envelope. */
788
799
  var formatMoldeaCliJsonInspectResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Inspect, result, null, result.valid ? "valid" : "invalid", cliVersion);
789
800
  /** Formats one changed-path scope result for human stdout. */
790
801
  var formatMoldeaCliHumanScopeResult = (result) => {
@@ -794,7 +805,7 @@ var formatMoldeaCliHumanScopeResult = (result) => {
794
805
  ...Object.entries(result.counts).map(([label, count]) => `${label}: ${count}`)
795
806
  ].join("\n")}\n`;
796
807
  };
797
- /** Formats one changed-path scope result in the strict schema 4 envelope. */
808
+ /** Formats one changed-path scope result in the strict schema 5 envelope. */
798
809
  var formatMoldeaCliJsonScopeResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Scope, result, null, result.valid ? "valid" : "invalid", cliVersion);
799
810
  /** Formats one explicit canonical content chunk for human stdout. */
800
811
  var formatMoldeaCliHumanContentResult = (result) => {
@@ -808,29 +819,53 @@ var formatMoldeaCliHumanContentResult = (result) => {
808
819
  result.chunk.content
809
820
  ].join("\n")}\n`;
810
821
  };
811
- /** Formats one explicit canonical content chunk in the strict schema 4 envelope. */
822
+ /** Formats one explicit canonical content chunk in the strict schema 5 envelope. */
812
823
  var formatMoldeaCliJsonContentResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Content, result, null, "valid", cliVersion);
813
824
  //#endregion
814
825
  //#region src/presentation/transformers.ts
815
826
  /** Rejects a Core validation result whose completion fields contradict its validity. */
816
827
  var assertProjectValidationInvariant = (validation) => {
817
- if (!(validation.valid ? validation.summary !== null && validation.diagnostics.length === 0 : validation.diagnostics.length > 0)) throw new TypeError("The Core validation result is internally inconsistent.");
828
+ const observedErrorCount = validation.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
829
+ if (!(Number.isSafeInteger(validation.errorCount) && Number.isSafeInteger(validation.warningCount) && validation.errorCount === observedErrorCount && validation.warningCount === validation.diagnostics.length - observedErrorCount && validation.valid === (validation.summary !== null && validation.errorCount === 0) && (validation.valid || validation.errorCount > 0))) throw new TypeError("The Core validation result is internally inconsistent.");
818
830
  };
819
831
  /** Creates one stable composite record key. */
820
832
  var createRecordKey = (kind, ...parts) => JSON.stringify([kind, ...parts]);
821
833
  /** Projects one diagnostic without retaining arbitrary detail payloads. */
822
- var createMoldeaCliDiagnosticRecord = (diagnostic, occurrence = 0) => Object.freeze({
823
- code: diagnostic.code,
824
- entity: diagnostic.entity,
825
- key: createRecordKey("diagnostic", diagnostic.source, diagnostic.code, diagnostic.path, diagnostic.pointer, occurrence),
826
- kind: "diagnostic",
827
- message: diagnostic.message,
828
- path: diagnostic.path,
829
- pointer: diagnostic.pointer,
830
- range: diagnostic.range,
831
- source: diagnostic.source
832
- });
833
- /** Projects one bounded Core inspection item through the schema 4 allowlist. */
834
+ var createMoldeaCliDiagnosticRecord = (diagnostic, occurrence = 0) => {
835
+ const record = {
836
+ code: diagnostic.code,
837
+ entity: diagnostic.entity,
838
+ key: createRecordKey("diagnostic", diagnostic.source, diagnostic.severity, diagnostic.code, diagnostic.path, diagnostic.pointer, diagnostic.severity === "warning" ? diagnostic.details : null, occurrence),
839
+ kind: "diagnostic",
840
+ message: diagnostic.message,
841
+ path: diagnostic.path,
842
+ pointer: diagnostic.pointer,
843
+ range: diagnostic.range,
844
+ source: diagnostic.source
845
+ };
846
+ if (diagnostic.severity === "warning") {
847
+ const details = diagnostic.details.reason === "version-dependent-behavior" ? Object.freeze({
848
+ boundaryVersion: diagnostic.details.boundaryVersion,
849
+ declaredRange: diagnostic.details.declaredRange,
850
+ packageName: diagnostic.details.packageName,
851
+ reason: diagnostic.details.reason,
852
+ relationship: diagnostic.details.relationship
853
+ }) : Object.freeze({
854
+ reason: diagnostic.details.reason,
855
+ relationship: diagnostic.details.relationship
856
+ });
857
+ return Object.freeze({
858
+ ...record,
859
+ details,
860
+ severity: "warning"
861
+ });
862
+ }
863
+ return Object.freeze({
864
+ ...record,
865
+ severity: "error"
866
+ });
867
+ };
868
+ /** Projects one bounded Core inspection item through the schema 5 allowlist. */
834
869
  var createInspectRecord = (item, index) => {
835
870
  const order = index.toString().padStart(6, "0");
836
871
  if (item.kind === "agent") {
@@ -844,7 +879,7 @@ var createInspectRecord = (item, index) => {
844
879
  }
845
880
  if (item.kind === "diagnostic") return Object.freeze({
846
881
  ...createMoldeaCliDiagnosticRecord(item.diagnostic, index),
847
- key: createRecordKey(order, "diagnostic", item.diagnostic.source, item.diagnostic.code)
882
+ key: createRecordKey(order, "diagnostic", item.diagnostic.source, item.diagnostic.severity, item.diagnostic.code, item.diagnostic.severity === "warning" ? item.diagnostic.details : null)
848
883
  });
849
884
  if (item.kind === "evidence") {
850
885
  const evidence = item.evidence;
@@ -885,19 +920,23 @@ var createMoldeaCliValidateProjection = (validation) => {
885
920
  const diagnostics = Object.freeze(validation.diagnostics.map((diagnostic, index) => createMoldeaCliDiagnosticRecord(diagnostic, index)).sort((left, right) => left.key < right.key ? -1 : left.key > right.key ? 1 : 0));
886
921
  const snapshotDigest = calculateMoldeaCliJsonDigest({
887
922
  diagnostics,
923
+ errorCount: validation.errorCount,
888
924
  formatVersion: validation.formatVersion,
889
925
  summary: validation.summary,
890
- valid: validation.valid
926
+ valid: validation.valid,
927
+ warningCount: validation.warningCount
891
928
  });
892
929
  return Object.freeze({
893
930
  diagnostics,
931
+ errorCount: validation.errorCount,
894
932
  formatVersion: validation.formatVersion,
895
933
  snapshotDigest,
896
934
  source: MOLDEA_CLI_GIT_WORKING_TREE_SOURCE,
897
- valid: validation.valid
935
+ valid: validation.valid,
936
+ warningCount: validation.warningCount
898
937
  });
899
938
  };
900
- /** Projects one bounded Core page through the content-free schema 4 allowlist. */
939
+ /** Projects one bounded Core page through the content-free schema 5 allowlist. */
901
940
  var createMoldeaCliInspectProjection = (inspection) => {
902
941
  const project = inspection.summary === null ? null : Object.freeze({
903
942
  manifest: Object.freeze({
@@ -1733,6 +1772,9 @@ var createCoreErrorDetails = (error) => {
1733
1772
  if (error instanceof CoreOperationException) {
1734
1773
  if (error.agentId !== null) details["agentId"] = error.agentId;
1735
1774
  if (error.limit !== null) details["limit"] = error.limit;
1775
+ if (error.limitMaximum !== null) details["limitMaximum"] = error.limitMaximum;
1776
+ if (error.nextAction !== null) details["nextAction"] = error.nextAction;
1777
+ if (error.observedUsage !== null) details["observedUsage"] = error.observedUsage;
1736
1778
  }
1737
1779
  return Object.freeze(details);
1738
1780
  };
@@ -3277,11 +3319,13 @@ var createMoldeaCliValidateExecutionResult = (inspection, cliVersion, isJson, cu
3277
3319
  const projection = createMoldeaCliValidateProjection(inspection);
3278
3320
  const createResult = (page) => ({
3279
3321
  diagnosticCount: projection.diagnostics.length,
3322
+ errorCount: projection.errorCount,
3280
3323
  formatVersion: projection.formatVersion,
3281
3324
  page,
3282
3325
  snapshotDigest: projection.snapshotDigest,
3283
3326
  source: projection.source,
3284
- valid: projection.valid
3327
+ valid: projection.valid,
3328
+ warningCount: projection.warningCount
3285
3329
  });
3286
3330
  const page = createMoldeaCliOutputPage({
3287
3331
  command: "validate",
@@ -3397,11 +3441,11 @@ var createMoldeaCliContentExecutionResult = (pageResult, cliVersion, isJson, cur
3397
3441
  //#region src/cli-execution/command-executor.ts
3398
3442
  /** Loads adapter-backed Core inspection only for commands that need it. */
3399
3443
  var executeLazyCoreInspection = async (input) => {
3400
- const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-Bb9OMTs-.js");
3444
+ const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-CgaKOyog.js");
3401
3445
  return executeMoldeaCliCoreInspection(input);
3402
3446
  };
3403
3447
  var loadInstalledComposition = async (input) => {
3404
- const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-7d632gM8.js");
3448
+ const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-Ck3cXQUk.js");
3405
3449
  return resolveInstalledMoldeaCliComposition(input);
3406
3450
  };
3407
3451
  /** Creates one operational error result without exposing caught failure details. */
@@ -3414,7 +3458,7 @@ var createOperationalErrorResult = (code, input) => createMoldeaCliErrorResult(c
3414
3458
  * @param compositionLoader The installed executable-integrity composition boundary.
3415
3459
  * @param projectScopeExecutor The adapter-free manifest scope operation.
3416
3460
  * @param projectContentExecutor The adapter-free canonical content operation.
3417
- * @returns A command executor for the schema 4 CLI.
3461
+ * @returns A command executor for the schema 5 CLI.
3418
3462
  */
3419
3463
  var createMoldeaCliCommandExecutor = (workingTreeDiscovery = discoverGitWorkingTree, workingTreeSnapshotExecutor = executeWorkingTreeSnapshot, coreInspectionExecutor = executeLazyCoreInspection, compositionLoader = loadInstalledComposition, projectScopeExecutor = executeMoldeaCliProjectScope, projectContentExecutor = executeMoldeaCliProjectContent) => {
3420
3464
  return async (input) => {