@moldea.ai/cli 6.0.0 → 7.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 +6 -6
- package/dist/chunks/{composition-CIrgnSN8.js → composition-B9oqoRqn.js} +4 -4
- package/dist/chunks/{composition-CIrgnSN8.js.map → composition-B9oqoRqn.js.map} +1 -1
- package/dist/chunks/{core-composition-sKWsd1Aj.js → core-composition-6wOvReoY.js} +11 -4
- package/dist/chunks/core-composition-6wOvReoY.js.map +1 -0
- package/dist/chunks/{core-composition-bX-2XB4n.js → core-composition-Bb9OMTs-.js} +1 -1
- package/dist/moldea.js +298 -373
- package/dist/moldea.js.map +1 -1
- package/package.json +14 -14
- package/dist/chunks/core-composition-sKWsd1Aj.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
The canonical read-only local command-line composition for deterministic inspection of `moldea` repositories.
|
|
6
6
|
|
|
7
|
-
The version
|
|
7
|
+
The version 7 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.
|
|
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
|
|
|
11
11
|
Tarball, installed-bin, runtime, and testing-peer checks remain the package release boundary.
|
|
12
12
|
|
|
@@ -45,7 +45,7 @@ The package exposes the `moldea` executable and no supported JavaScript or TypeS
|
|
|
45
45
|
|
|
46
46
|
The package-backed `anthropic`, `claude-agent-sdk`, `cloudflare-agents`, `eve`, `google-genai`, `langchain`, `langgraph`, `openai`, `openai-agents-sdk`, and `vercel-ai-sdk` runtime adapters are active. The `custom` adapter remains built into Core and requires no separate package. Target maturity is not part of the CLI contract.
|
|
47
47
|
|
|
48
|
-
The package declares `preferUnplugged: true` so Yarn Plug'n'Play materializes the executable on the physical filesystem instead of leaving the bundled ESM entry point inside ZipFS. This package-owned hint preserves
|
|
48
|
+
The package declares `preferUnplugged: true` so Yarn Plug'n'Play materializes the executable on the physical filesystem instead of leaving the bundled ESM entry point inside ZipFS. This package-owned hint preserves repository-local Yarn execution without requiring client configuration or a `node_modules` linker.
|
|
49
49
|
|
|
50
50
|
The executable derives its composition state from its installed manifest, actually resolved first-class package versions, active adapter singletons, Core repository-format constants, minimum Git constant, and JSON output schema constant. It carries no Runtime Compatibility Matrix or target-maturity snapshot.
|
|
51
51
|
|
|
@@ -83,9 +83,9 @@ Every decoded Git candidate path is validated through `@moldea.ai/repository` be
|
|
|
83
83
|
|
|
84
84
|
For every effective inventory entry, the CLI sends the exact Git-relative path through NUL-delimited stdin to one fixed `git check-attr --stdin -z` operation and strictly associates the resulting `filter`, `working-tree-encoding`, and `ident` triples. Exact effective values are retained in the immutable inventory so later snapshot comparison can detect any classification change. `unset` and `unspecified` are unguarded; `set` and every other effective value are guarded. Ordinary `text` and `eol` attributes alone remain supported. Invalid UTF-8, missing or duplicate triples, unknown paths or attributes, successful stderr, and output that cannot be associated exactly fail atomically with `GIT_OUTPUT_INVALID`.
|
|
85
85
|
|
|
86
|
-
Git attribute inspection never invokes configured filters, Git LFS, clean or smudge commands, or encoding helpers. A guarded path remains visible in lookup and listing and does not fail merely by existing. The outer content-transformation wrapper inspects the already-overlaid logical entry only when its bytes are requested. A guarded logical regular file then raises a CLI-owned non-retryable `RepositorySourceException` on the common `SOURCE_UNAVAILABLE` boundary before `
|
|
86
|
+
Git attribute inspection never invokes configured filters, Git LFS, clean or smudge commands, or encoding helpers. A guarded path remains visible in lookup and listing and does not fail merely by existing. The outer content-transformation wrapper inspects the already-overlaid logical entry only when its bytes are requested. A guarded logical regular file then raises a CLI-owned non-retryable `RepositorySourceException` on the common `SOURCE_UNAVAILABLE` boundary before `readFilePage` reaches Repository FS. Native and materialized logical symlinks retain the common `ENTRY_NOT_FILE` behavior even when their host paths are guarded. When Core requests guarded regular-file bytes, the CLI translates its private marker to `git:GIT_CONTENT_TRANSFORM_UNSUPPORTED` and includes only the safe repository logical path.
|
|
87
87
|
|
|
88
|
-
The CLI passes the complete normalized logical path set to `@moldea.ai/repository-fs` exact-path selection, so the filesystem reader
|
|
88
|
+
The CLI passes the complete normalized logical path set to `@moldea.ai/repository-fs` exact-path selection, so the filesystem reader exposes required parent directories without admitting unrelated files. The CLI derives reader concurrency, queue, page, range, observation, and cache limits from its operation budgets. The private immutable overlay maps materialized Git symlink host files to `type: 'symlink'` in exact lookup and listing, rejects their reads with the common non-retryable `ENTRY_NOT_FILE` contract, and never calls the underlying `readFilePage` for those paths. The content-transformation guard wraps that logical view so symlink semantics take precedence. Missing or contradictory wrapper entries fail with `INVALID_SOURCE_DATA`.
|
|
89
89
|
|
|
90
90
|
Before attempting a snapshot, the CLI pins the selected root directory, its worktree-specific Git directory, and its shared Git common directory by absolute host path plus nonzero device and inode identity. Linked worktrees therefore retain distinct worktree identity while sharing the expected common repository identity. Each attempt verifies the complete pin, derives normalized full or path-selected inventories before and after exact-path reader creation, and runs its provisional operation only when both inventories match exactly, including entry type, retained index stages, symlink-overlay state, and content-transformation classification.
|
|
91
91
|
|
|
@@ -115,7 +115,7 @@ Before `validate`, `inspect`, or `composition` produces a result, the executable
|
|
|
115
115
|
|
|
116
116
|
`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).
|
|
117
117
|
|
|
118
|
-
Successful human and JSON reports use exit code `0`; JSON uses status `valid` and the schema
|
|
118
|
+
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.
|
|
119
119
|
|
|
120
120
|
## Development
|
|
121
121
|
|
|
@@ -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-
|
|
3
|
+
import { r as ACTIVE_RUNTIME_ADAPTERS } from "./core-composition-6wOvReoY.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();
|
|
@@ -35,7 +35,7 @@ var createActiveAdapterMap = (adapters, coreRepositoryFormatVersions) => {
|
|
|
35
35
|
*/
|
|
36
36
|
var isMoldeaCliCompositionStateValid = (input) => {
|
|
37
37
|
const { dependencies, installedPackageVersions, supportedNodeRange, version } = input.packageMetadata;
|
|
38
|
-
if ((0, import_semver.valid)(version) === null || supportedNodeRange === null || (0, import_semver.validRange)(supportedNodeRange) === null || (0, import_semver.valid)(input.minimumGitVersion) === null || input.outputSchemaVersion !==
|
|
38
|
+
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;
|
|
39
39
|
const activeAdapterMap = createActiveAdapterMap(input.activeAdapters, input.coreSupportedRepositoryFormatVersions);
|
|
40
40
|
if (activeAdapterMap === null) return false;
|
|
41
41
|
const expectedPackageNames = [...MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES, ...[...activeAdapterMap.keys()].map((adapterId) => `${MOLDEA_CLI_ADAPTER_PACKAGE_PREFIX}${adapterId}`)];
|
|
@@ -117,10 +117,10 @@ var resolveInstalledMoldeaCliComposition = (input) => resolveMoldeaCliCompositio
|
|
|
117
117
|
activeAdapters: ACTIVE_RUNTIME_ADAPTERS,
|
|
118
118
|
coreSupportedRepositoryFormatVersions: SUPPORTED_REPOSITORY_FORMAT_VERSIONS,
|
|
119
119
|
minimumGitVersion: MINIMUM_GIT_VERSION,
|
|
120
|
-
outputSchemaVersion:
|
|
120
|
+
outputSchemaVersion: 4,
|
|
121
121
|
packageMetadata: input.packageMetadata
|
|
122
122
|
});
|
|
123
123
|
//#endregion
|
|
124
124
|
export { resolveInstalledMoldeaCliComposition };
|
|
125
125
|
|
|
126
|
-
//# sourceMappingURL=composition-
|
|
126
|
+
//# sourceMappingURL=composition-B9oqoRqn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition-CIrgnSN8.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","import { 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_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 !== 3 ||\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 declaredVersion = dependencies[packageName];\n\n return (\n resolvedVersion !== undefined &&\n isValidVersion(resolvedVersion) !== null &&\n (declaredVersion === resolvedVersion || declaredVersion === `workspace:${resolvedVersion}`)\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;;;ACE5C,IAAM,qBAAqB;AAE3B,IAAM,qBAAqB,MAAyB,UAAsC;CACxF,IACE,KAAK,WAAW,MAAM,UACtB,IAAI,IAAI,IAAI,CAAC,CAAC,SAAS,KAAK,UAC5B,IAAI,IAAI,KAAK,CAAC,CAAC,SAAS,MAAM,QAE9B,OAAO;CAGT,MAAM,cAAc,IAAI,IAAI,KAAK;CACjC,OAAO,KAAK,OAAO,UAAU,YAAY,IAAI,KAAK,CAAC;AACrD;AAEA,IAAM,6BAA6B,YACjC,QAAQ,SAAS,KACjB,QAAQ,OAAO,UAAU,OAAO,cAAc,KAAK,KAAK,QAAQ,CAAC,KACjE,IAAI,IAAI,OAAO,CAAC,CAAC,SAAS,QAAQ;AAEpC,IAAM,0B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AC,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
|
+
{"version":3,"file":"composition-B9oqoRqn.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","import { 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_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 declaredVersion = dependencies[packageName];\n\n return (\n resolvedVersion !== undefined &&\n isValidVersion(resolvedVersion) !== null &&\n (declaredVersion === resolvedVersion || declaredVersion === `workspace:${resolvedVersion}`)\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;;;ACE5C,IAAM,qBAAqB;AAE3B,IAAM,qBAAqB,MAAyB,UAAsC;CACxF,IACE,KAAK,WAAW,MAAM,UACtB,IAAI,IAAI,IAAI,CAAC,CAAC,SAAS,KAAK,UAC5B,IAAI,IAAI,KAAK,CAAC,CAAC,SAAS,MAAM,QAE9B,OAAO;CAGT,MAAM,cAAc,IAAI,IAAI,KAAK;CACjC,OAAO,KAAK,OAAO,UAAU,YAAY,IAAI,KAAK,CAAC;AACrD;AAEA,IAAM,6BAA6B,YACjC,QAAQ,SAAS,KACjB,QAAQ,OAAO,UAAU,OAAO,cAAc,KAAK,KAAK,QAAQ,CAAC,KACjE,IAAI,IAAI,OAAO,CAAC,CAAC,SAAS,QAAQ;AAEpC,IAAM,0BACJ,UACA,iCACgD;CAChD,MAAM,6BAAa,IAAI,IAA6B;CAEpD,KAAK,MAAM,WAAW,UAAU;EAC9B,IACE,WAAW,IAAI,QAAQ,EAAE,KACzB,QAAQ,OAAA,YACR,CAAC,mB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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"}
|
|
@@ -39,7 +39,7 @@ var compareAdapterIds = (left, right) => {
|
|
|
39
39
|
var createMoldeaCliCoreInspectionExecutor = (coreFactory = createCore, activeAdapters = ACTIVE_RUNTIME_ADAPTERS) => {
|
|
40
40
|
const normalizedAdapters = Object.freeze([...activeAdapters].sort(compareAdapterIds));
|
|
41
41
|
return async (input) => {
|
|
42
|
-
|
|
42
|
+
const core = coreFactory({
|
|
43
43
|
adapters: normalizedAdapters,
|
|
44
44
|
limits: Object.freeze({
|
|
45
45
|
maxDiagnostics: input.resourceLimits.maxDiagnostics,
|
|
@@ -49,10 +49,17 @@ var createMoldeaCliCoreInspectionExecutor = (coreFactory = createCore, activeAda
|
|
|
49
49
|
maxManifestBytes: input.resourceLimits.maxManifestBytes,
|
|
50
50
|
maxTotalBytesRead: input.resourceLimits.maxTotalBytes
|
|
51
51
|
})
|
|
52
|
-
})
|
|
52
|
+
});
|
|
53
|
+
const projectInput = {
|
|
53
54
|
repository: input.repository,
|
|
54
55
|
...input.signal === void 0 ? {} : { signal: input.signal }
|
|
55
|
-
}
|
|
56
|
+
};
|
|
57
|
+
return input.command === "inspect" ? core.inspectProjectPage({
|
|
58
|
+
...projectInput,
|
|
59
|
+
...input.cursor === void 0 ? {} : { cursor: input.cursor },
|
|
60
|
+
maxItems: Math.min(256, input.resourceLimits.maxEntries),
|
|
61
|
+
view: "all"
|
|
62
|
+
}) : core.validateProject(projectInput);
|
|
56
63
|
};
|
|
57
64
|
};
|
|
58
65
|
/**
|
|
@@ -80,4 +87,4 @@ var executeMoldeaCliCoreInspection = createMoldeaCliCoreInspectionExecutor();
|
|
|
80
87
|
//#endregion
|
|
81
88
|
export { executeMoldeaCliCoreInspection as n, ACTIVE_RUNTIME_ADAPTERS as r, createMoldeaCliCoreInspectionExecutor as t };
|
|
82
89
|
|
|
83
|
-
//# sourceMappingURL=core-composition-
|
|
90
|
+
//# sourceMappingURL=core-composition-6wOvReoY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-composition-6wOvReoY.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\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 maxTotalBytesRead: input.resourceLimits.maxTotalBytes,\n }),\n });\n\n const projectInput = {\n repository: input.repository,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n };\n\n return input.command === 'inspect'\n ? core.inspectProjectPage({\n ...projectInput,\n ...(input.cursor === undefined ? {} : { cursor: input.cursor }),\n maxItems: Math.min(256, input.resourceLimits.maxEntries),\n view: 'all',\n })\n : core.validateProject(projectInput);\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;;;;;;;AAQA,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,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,OAAO,MAAM,YAAY,YACrB,KAAK,mBAAmB;GACtB,GAAG;GACH,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;GAC7D,UAAU,KAAK,IAAI,KAAK,MAAM,eAAe,UAAU;GACvD,MAAM;EACR,CAAC,IACD,KAAK,gBAAgB,YAAY;CACvC;AACF;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,iCAAiC,sCAAsC"}
|