@moldea.ai/cli 7.0.1 → 8.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 +5 -3
- package/dist/chunks/{composition-7d632gM8.js → composition-By-2bWuu.js} +13 -13
- package/dist/chunks/{composition-7d632gM8.js.map → composition-By-2bWuu.js.map} +1 -1
- package/dist/chunks/{core-composition-Bb9OMTs-.js → core-composition-CgaKOyog.js} +1 -1
- package/dist/chunks/{core-composition-6wOvReoY.js → core-composition-CttwXtDG.js} +6 -4
- package/dist/chunks/core-composition-CttwXtDG.js.map +1 -0
- package/dist/moldea.js +14 -2
- package/dist/moldea.js.map +1 -1
- package/package.json +12 -12
- package/dist/chunks/core-composition-6wOvReoY.js.map +0 -1
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
|
+
The version 8 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
|
|
|
@@ -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
|
|
|
@@ -103,7 +105,7 @@ Git process cancellation uses the safe retryable `git:GIT_OPERATION_ABORTED` con
|
|
|
103
105
|
|
|
104
106
|
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.
|
|
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
|
|
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, 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.
|
|
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
|
|
|
@@ -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-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": "^
|
|
16
|
-
"@moldea.ai/adapter-claude-agent-sdk": "^
|
|
17
|
-
"@moldea.ai/adapter-cloudflare-agents": "^
|
|
18
|
-
"@moldea.ai/adapter-eve": "^
|
|
19
|
-
"@moldea.ai/adapter-google-genai": "^
|
|
20
|
-
"@moldea.ai/adapter-langchain": "^
|
|
21
|
-
"@moldea.ai/adapter-langgraph": "^
|
|
22
|
-
"@moldea.ai/adapter-openai": "^
|
|
23
|
-
"@moldea.ai/adapter-openai-agents-sdk": "^
|
|
24
|
-
"@moldea.ai/adapter-vercel-ai-sdk": "^
|
|
25
|
-
"@moldea.ai/core": "^
|
|
15
|
+
"@moldea.ai/adapter-anthropic": "^4.0.0",
|
|
16
|
+
"@moldea.ai/adapter-claude-agent-sdk": "^3.0.0",
|
|
17
|
+
"@moldea.ai/adapter-cloudflare-agents": "^3.0.0",
|
|
18
|
+
"@moldea.ai/adapter-eve": "^3.0.0",
|
|
19
|
+
"@moldea.ai/adapter-google-genai": "^3.0.0",
|
|
20
|
+
"@moldea.ai/adapter-langchain": "^3.0.0",
|
|
21
|
+
"@moldea.ai/adapter-langgraph": "^3.0.0",
|
|
22
|
+
"@moldea.ai/adapter-openai": "^4.0.0",
|
|
23
|
+
"@moldea.ai/adapter-openai-agents-sdk": "^3.0.0",
|
|
24
|
+
"@moldea.ai/adapter-vercel-ai-sdk": "^3.0.0",
|
|
25
|
+
"@moldea.ai/core": "^4.0.0",
|
|
26
26
|
"@moldea.ai/repository": "^2.0.0",
|
|
27
27
|
"@moldea.ai/repository-fs": "^2.0.0"
|
|
28
28
|
});
|
|
@@ -139,4 +139,4 @@ var resolveInstalledMoldeaCliComposition = (input) => resolveMoldeaCliCompositio
|
|
|
139
139
|
//#endregion
|
|
140
140
|
export { resolveInstalledMoldeaCliComposition };
|
|
141
141
|
|
|
142
|
-
//# sourceMappingURL=composition-
|
|
142
|
+
//# sourceMappingURL=composition-By-2bWuu.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,oCAAoC;AACjD,IAAa,+BAA+B;AAG5C,IAAa,wCAAwC,OAAO,OAAO;CACjE,gCAAgC;CAChC,uCAAuC;CACvC,wCAAwC;CACxC,0BAA0B;CAC1B,mCAAmC;CACnC,gCAAgC;CAChC,gCAAgC;C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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 8\nexport const MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES = Object.freeze({\n '@moldea.ai/adapter-anthropic': '^4.0.0',\n '@moldea.ai/adapter-claude-agent-sdk': '^3.0.0',\n '@moldea.ai/adapter-cloudflare-agents': '^3.0.0',\n '@moldea.ai/adapter-eve': '^3.0.0',\n '@moldea.ai/adapter-google-genai': '^3.0.0',\n '@moldea.ai/adapter-langchain': '^3.0.0',\n '@moldea.ai/adapter-langgraph': '^3.0.0',\n '@moldea.ai/adapter-openai': '^4.0.0',\n '@moldea.ai/adapter-openai-agents-sdk': '^3.0.0',\n '@moldea.ai/adapter-vercel-ai-sdk': '^3.0.0',\n '@moldea.ai/core': '^4.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,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;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,cA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,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"}
|
|
@@ -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
|
-
|
|
58
|
-
|
|
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
|
-
})
|
|
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-
|
|
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
|
@@ -833,6 +833,15 @@ var createMoldeaCliDiagnosticRecord = (diagnostic, occurrence = 0) => Object.fre
|
|
|
833
833
|
/** Projects one bounded Core inspection item through the schema 4 allowlist. */
|
|
834
834
|
var createInspectRecord = (item, index) => {
|
|
835
835
|
const order = index.toString().padStart(6, "0");
|
|
836
|
+
if (item.kind === "agent") {
|
|
837
|
+
const record = {
|
|
838
|
+
agentId: item.agent.agentId,
|
|
839
|
+
key: createRecordKey(order, "agent", item.agent.agentId, item.agent.runtimeId),
|
|
840
|
+
kind: "agent",
|
|
841
|
+
runtimeId: item.agent.runtimeId
|
|
842
|
+
};
|
|
843
|
+
return Object.freeze(record);
|
|
844
|
+
}
|
|
836
845
|
if (item.kind === "diagnostic") return Object.freeze({
|
|
837
846
|
...createMoldeaCliDiagnosticRecord(item.diagnostic, index),
|
|
838
847
|
key: createRecordKey(order, "diagnostic", item.diagnostic.source, item.diagnostic.code)
|
|
@@ -1724,6 +1733,9 @@ var createCoreErrorDetails = (error) => {
|
|
|
1724
1733
|
if (error instanceof CoreOperationException) {
|
|
1725
1734
|
if (error.agentId !== null) details["agentId"] = error.agentId;
|
|
1726
1735
|
if (error.limit !== null) details["limit"] = error.limit;
|
|
1736
|
+
if (error.limitMaximum !== null) details["limitMaximum"] = error.limitMaximum;
|
|
1737
|
+
if (error.nextAction !== null) details["nextAction"] = error.nextAction;
|
|
1738
|
+
if (error.observedUsage !== null) details["observedUsage"] = error.observedUsage;
|
|
1727
1739
|
}
|
|
1728
1740
|
return Object.freeze(details);
|
|
1729
1741
|
};
|
|
@@ -3388,11 +3400,11 @@ var createMoldeaCliContentExecutionResult = (pageResult, cliVersion, isJson, cur
|
|
|
3388
3400
|
//#region src/cli-execution/command-executor.ts
|
|
3389
3401
|
/** Loads adapter-backed Core inspection only for commands that need it. */
|
|
3390
3402
|
var executeLazyCoreInspection = async (input) => {
|
|
3391
|
-
const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-
|
|
3403
|
+
const { executeMoldeaCliCoreInspection } = await import("./chunks/core-composition-CgaKOyog.js");
|
|
3392
3404
|
return executeMoldeaCliCoreInspection(input);
|
|
3393
3405
|
};
|
|
3394
3406
|
var loadInstalledComposition = async (input) => {
|
|
3395
|
-
const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-
|
|
3407
|
+
const { resolveInstalledMoldeaCliComposition } = await import("./chunks/composition-By-2bWuu.js");
|
|
3396
3408
|
return resolveInstalledMoldeaCliComposition(input);
|
|
3397
3409
|
};
|
|
3398
3410
|
/** Creates one operational error result without exposing caught failure details. */
|