@moldea.ai/core 1.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/LICENSE +21 -0
- package/README.md +135 -0
- package/dist/adapter/index.d.ts +48 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter-availability/index.d.ts +15 -0
- package/dist/adapter-availability/index.d.ts.map +1 -0
- package/dist/adapter-execution/index.d.ts +31 -0
- package/dist/adapter-execution/index.d.ts.map +1 -0
- package/dist/adapter-validation/index.d.ts +44 -0
- package/dist/adapter-validation/index.d.ts.map +1 -0
- package/dist/adapter.js +0 -0
- package/dist/agent-asset-validation/index.d.ts +34 -0
- package/dist/agent-asset-validation/index.d.ts.map +1 -0
- package/dist/agent-assets/index.d.ts +38 -0
- package/dist/agent-assets/index.d.ts.map +1 -0
- package/dist/canonical-discovery/index.d.ts +47 -0
- package/dist/canonical-discovery/index.d.ts.map +1 -0
- package/dist/canonical-discovery-validation/index.d.ts +26 -0
- package/dist/canonical-discovery-validation/index.d.ts.map +1 -0
- package/dist/constants/index.d.ts +6 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/contracts/index.d.ts +178 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/decision/index.d.ts +16 -0
- package/dist/decision/index.d.ts.map +1 -0
- package/dist/decision-graph/index.d.ts +28 -0
- package/dist/decision-graph/index.d.ts.map +1 -0
- package/dist/decision-graph-validation/index.d.ts +25 -0
- package/dist/decision-graph-validation/index.d.ts.map +1 -0
- package/dist/decision-validation/index.d.ts +34 -0
- package/dist/decision-validation/index.d.ts.map +1 -0
- package/dist/diagnostic-utilities/index.d.ts +62 -0
- package/dist/diagnostic-utilities/index.d.ts.map +1 -0
- package/dist/diagnostics/index.d.ts +43 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/exceptions/index.d.ts +38 -0
- package/dist/exceptions/index.d.ts.map +1 -0
- package/dist/format/index.d.ts +80 -0
- package/dist/format/index.d.ts.map +1 -0
- package/dist/format-validation/index.d.ts +51 -0
- package/dist/format-validation/index.d.ts.map +1 -0
- package/dist/format.js +0 -0
- package/dist/immutable/index.d.ts +13 -0
- package/dist/immutable/index.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4609 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest/index.d.ts +32 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest-relationship-validation/index.d.ts +18 -0
- package/dist/manifest-relationship-validation/index.d.ts.map +1 -0
- package/dist/manifest-validation/index.d.ts +28 -0
- package/dist/manifest-validation/index.d.ts.map +1 -0
- package/dist/mirrors/index.d.ts +35 -0
- package/dist/mirrors/index.d.ts.map +1 -0
- package/dist/options/index.d.ts +26 -0
- package/dist/options/index.d.ts.map +1 -0
- package/dist/project-assets/index.d.ts +56 -0
- package/dist/project-assets/index.d.ts.map +1 -0
- package/dist/project-index/index.d.ts +20 -0
- package/dist/project-index/index.d.ts.map +1 -0
- package/dist/project-inspection/index.d.ts +23 -0
- package/dist/project-inspection/index.d.ts.map +1 -0
- package/dist/repository-inspection-session/index.d.ts +22 -0
- package/dist/repository-inspection-session/index.d.ts.map +1 -0
- package/dist/repository-reference-validation/index.d.ts +25 -0
- package/dist/repository-reference-validation/index.d.ts.map +1 -0
- package/dist/repository-text/index.d.ts +27 -0
- package/dist/repository-text/index.d.ts.map +1 -0
- package/dist/runtime-guidance/index.d.ts +32 -0
- package/dist/runtime-guidance/index.d.ts.map +1 -0
- package/dist/runtime-placeholder-validation/index.d.ts +17 -0
- package/dist/runtime-placeholder-validation/index.d.ts.map +1 -0
- package/dist/source-location/index.d.ts +11 -0
- package/dist/source-location/index.d.ts.map +1 -0
- package/dist/text/index.d.ts +33 -0
- package/dist/text/index.d.ts.map +1 -0
- package/dist/universal-project-inspection/index.d.ts +35 -0
- package/dist/universal-project-inspection/index.d.ts.map +1 -0
- package/dist/yaml/index.d.ts +40 -0
- package/dist/yaml/index.d.ts.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 moldea.ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# `@moldea.ai/core`
|
|
2
|
+
|
|
3
|
+
Source-neutral, deterministic interpretation of the `moldea` repository format.
|
|
4
|
+
|
|
5
|
+
The `1.0.0` package surface accepts caller-supplied text documents and source-neutral repository readers. It does not access a filesystem, Git provider, or network independently. Invalid repository content produces stable diagnostics, while invalid configuration and operational failures use typed exceptions. Strict version 1 manifest and decision parsing, complete repository inspection, deterministic project indexing, built-in custom-runtime behavior, and all-or-nothing package-backed runtime-adapter execution are available now. Tarball and consumer-type checks remain the release boundary for every published version.
|
|
6
|
+
|
|
7
|
+
## Public entry points
|
|
8
|
+
|
|
9
|
+
- `@moldea.ai/core` exposes Core construction, results, diagnostics, limits, and exceptions.
|
|
10
|
+
- `@moldea.ai/core/format` exposes repository-format value types.
|
|
11
|
+
- `@moldea.ai/core/adapter` exposes the runtime-adapter inspection contract.
|
|
12
|
+
|
|
13
|
+
## Text normalization and digests
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createCore } from '@moldea.ai/core';
|
|
17
|
+
import { parseRepositoryPath } from '@moldea.ai/repository';
|
|
18
|
+
|
|
19
|
+
const core = createCore();
|
|
20
|
+
const input = {
|
|
21
|
+
content: new TextEncoder().encode('\ufeffline one\r\nline two\r'),
|
|
22
|
+
path: parseRepositoryPath('/moldea/project.md'),
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const normalized = core.normalizeText(input);
|
|
26
|
+
const digested = await core.calculateContentDigest(input);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Normalization validates strict UTF-8 or Unicode-scalar string input, removes one leading byte-order
|
|
30
|
+
mark, converts CRLF and CR line endings to LF, rejects NUL, performs no Unicode normalization, and
|
|
31
|
+
reports normalized UTF-8 byte and scalar lengths. Digests are SHA-256 over the normalized UTF-8
|
|
32
|
+
bytes.
|
|
33
|
+
|
|
34
|
+
## Manifest parsing
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { createCore } from '@moldea.ai/core';
|
|
38
|
+
import { parseRepositoryPath } from '@moldea.ai/repository';
|
|
39
|
+
|
|
40
|
+
const result = await createCore().parseManifest({
|
|
41
|
+
content: new TextEncoder().encode('version: 1\n'),
|
|
42
|
+
path: parseRepositoryPath('/moldea/moldea.yaml'),
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Manifest parsing validates the canonical path, strict UTF-8 and normalized text, the supported YAML 1.2 Core Schema subset, and every version 1 rule that can be established from the document alone. It rejects directives, anchors, aliases, merge keys, custom tags, duplicate keys, unknown properties, invalid values, unrecognized runtime IDs, and non-canonical relationships. Recognized official runtime IDs remain valid independently from the active Core instance's configured adapter set. A result includes both the normalized manifest asset and deeply immutable manifest value only when the complete document is valid. It does not read the repository, check adapter availability, or check whether referenced files exist.
|
|
47
|
+
|
|
48
|
+
## Decision parsing
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { createCore } from '@moldea.ai/core';
|
|
52
|
+
import { parseRepositoryPath } from '@moldea.ai/repository';
|
|
53
|
+
|
|
54
|
+
const result = await createCore().parseDecision({
|
|
55
|
+
content: [
|
|
56
|
+
'---',
|
|
57
|
+
'status: accepted',
|
|
58
|
+
'createdAt: "2026-08-07T19:42:03.456Z"',
|
|
59
|
+
'---',
|
|
60
|
+
'Use the accepted implementation.',
|
|
61
|
+
'',
|
|
62
|
+
].join('\n'),
|
|
63
|
+
path: parseRepositoryPath('/moldea/decisions/1786131723456-use-postgresql.md'),
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Decision parsing validates the canonical timestamp-slug path, exact frontmatter delimiters, strict YAML metadata, status, canonical UTC `createdAt`, filename timestamp equality, supersession IDs, and non-empty Markdown body. A valid result preserves the exact normalized body and complete normalized asset, sorts supersession IDs, and includes a SHA-256 digest. It does not read other decisions or validate reference existence, duplicate IDs across files, supersession graphs, status consistency, or manifest relationships.
|
|
68
|
+
|
|
69
|
+
## Repository inspection
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { createCore } from '@moldea.ai/core';
|
|
73
|
+
import { createMemoryRepositoryReader } from '@moldea.ai/repository/memory';
|
|
74
|
+
|
|
75
|
+
const repository = createMemoryRepositoryReader([
|
|
76
|
+
{
|
|
77
|
+
content: 'version: 1\n',
|
|
78
|
+
path: '/moldea/moldea.yaml',
|
|
79
|
+
type: 'file',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
content: '# Project\n',
|
|
83
|
+
path: '/moldea/project.md',
|
|
84
|
+
type: 'file',
|
|
85
|
+
},
|
|
86
|
+
]);
|
|
87
|
+
const result = await createCore().inspectProject({ repository });
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Core's repository-level foundation now includes one isolated reader session for each inspection. The session validates detached reader output, applies the shared entry and byte budgets, caches each successfully read source file once, returns a fresh byte array to every consumer, and preserves cancellation and repository-source failures. Its state is never shared across inspections.
|
|
91
|
+
|
|
92
|
+
Canonical discovery and exact decision reads can compose through this `IRepositoryReader` boundary. Core parses each discovered decision once and deterministically validates project-wide ID uniqueness, missing supersession references, cycles, active and historical status consistency, and orphaned superseded decisions. Invalid or ambiguous decision nodes do not produce dependent graph cascades, while unrelated trustworthy graph rules continue to run.
|
|
93
|
+
|
|
94
|
+
The internal relationship layer also validates top-level and per-agent context and decision paths against canonical discovery and the parsed decision graph. Context targets must exist, and decision targets must exist and be accepted. Discovery and document diagnostics retain ownership of invalid targets so dependent missing or inactive diagnostics do not cascade.
|
|
95
|
+
|
|
96
|
+
Repository references, bindings, capability implementations, unresolved-requirement references, and exact `affectedBy` paths are validated through the same inspection reader. Exact targets must resolve to regular files without following symlinks, repeated paths share one exact lookup, and capability implementation failures use their specific tool or skill diagnostic instead of a generic reference diagnostic. Glob `affectedBy` patterns are not enumerated and may match zero entries; adapter-owned symbol resolution remains deferred to adapter inspection.
|
|
97
|
+
|
|
98
|
+
Core now also contains internal readers for every discovered runtime-guidance file and for convention-owned registered-agent assets. Runtime guidance is normalized, digested, checked for non-whitespace content, and reconciled with each agent's optional runtime guidance path. Registered agents are reconciled with exact directories, mandatory descriptions and instructions, optional handoff descriptions, Unicode-whitespace-trimmed description limits, forbidden runtime-variable delimiters, opening instruction identity, and complete runtime-placeholder grammar and declaration usage. Placeholder diagnostics preserve scalar-aware source ranges and deterministic declaration pointers. Unregistered directories and missing registered assets produce deterministic diagnostics without rereading unregistered content or cascading from discovery-owned failures.
|
|
99
|
+
|
|
100
|
+
Declared mirrors are resolved through the same inspection reader and compared with their owning canonical instruction after strict text decoding and repository-format normalization. One leading byte-order mark and CRLF or CR line endings are normalized; all other content differences remain significant. Only exact normalized matches retain mirror and canonical digests. Missing, non-file, symlink, stale, and invalid-text mirrors produce deterministic diagnostics, while an unavailable canonical instruction suppresses mirror lookups and dependent diagnostics.
|
|
101
|
+
|
|
102
|
+
Universal inspection now reads and parses the manifest, reads the project foundation, and then composes canonical discovery, focused-context reads, decision graphs, runtime guidance, registered-agent assets, manifest relationships, repository references, and mirrors through one coherent reader session. Exact foundation entries and file bytes are reused rather than requested twice. It aggregates diagnostics under one project-inspection limit and produces a deeply immutable, deterministic, JSON-safe provisional project index only when every universal phase succeeds. A supported format version remains available when it is independently trustworthy even if another manifest rule fails. Project and focused-context files must contain non-whitespace text; valid focused context retains its manifest relationship metadata, and all indexed assets retain normalized content, scalar and byte lengths, and SHA-256 digests.
|
|
103
|
+
|
|
104
|
+
Before any adapter runs, Core verifies that every recognized package-backed runtime ID declared by an agent has a configured adapter and that the adapter supports the active repository-format version. Availability failures retain manifest-derived source ranges, prevent every adapter from running, and return empty evidence. Core then groups agents by runtime ID and invokes each applicable configured adapter exactly once in ascending adapter-ID order. Each adapter receives only its matching agents, the complete frozen project, the shared budget-aware reader, and the active signal. The built-in `custom` behavior requires no configured adapter and produces no runtime evidence by itself.
|
|
105
|
+
|
|
106
|
+
Core validates adapter evidence and diagnostics before retaining them. Evidence references must identify existing regular files; evidence and diagnostic identity, scope, namespace, ranges, pointers, entities, and JSON-scalar details must satisfy the public adapter contract. One operation-wide diagnostic budget counts raw Core proposals across every universal phase plus raw adapter diagnostics; raw evidence has its own operation-wide budget. Both adapter output budgets apply before validation, deduplication, or sorting. Core normalizes, deduplicates, sorts, and freezes valid output. Adapter diagnostics retain valid evidence but withhold the project index. Any universal diagnostic prevents every adapter from running and returns empty evidence.
|
|
107
|
+
|
|
108
|
+
The repository entry limit counts distinct non-root logical paths across Core and every adapter. A path counts when first targeted by `getEntry` or `readFile`, used as a non-root listing prefix, or yielded by a listing, including absent exact probes. Repeated and concurrent touches count exactly once. The root `/` never counts.
|
|
109
|
+
|
|
110
|
+
The public result is all-or-nothing: `valid` is true exactly when diagnostics are empty, and `project` is non-null exactly when `valid` is true. A supported parsed format version may remain available after an unrelated universal diagnostic. Operational failures reject instead of returning a structural result.
|
|
111
|
+
|
|
112
|
+
### Repository inspection failures
|
|
113
|
+
|
|
114
|
+
`inspectProject` may reject with these `CoreOperationException` contracts:
|
|
115
|
+
|
|
116
|
+
| Code | Stable message | Trigger and metadata | Cause and result behavior |
|
|
117
|
+
| -------------------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
118
|
+
| `INVALID_ARGUMENT` | `The Core operation received an invalid argument.` | The inspection input, reader, or signal violates its runtime contract. `operation` is `inspect-project`; `retryable` is `false`. | No structural result is returned. |
|
|
119
|
+
| `ABORTED` | `The Core operation was aborted.` | The shared signal is already aborted or becomes aborted during Core or adapter work. `operation` is `inspect-project`; `retryable` is `true` because a fresh call with a non-aborted signal may succeed. | The signal reason is preserved as `cause` when available; no partial result is returned. |
|
|
120
|
+
| `RESOURCE_LIMIT_EXCEEDED` | `A Core resource limit was exceeded.` | A distinct-entry, byte, file, manifest, raw-diagnostic, or raw-evidence budget is exceeded. `limit` identifies the budget; `retryable` is `false`. | No partial project, evidence, or diagnostics are returned. |
|
|
121
|
+
| `ADAPTER_EXECUTION_FAILED` | `A runtime adapter failed during inspection.` | An adapter throws unexpectedly or returns malformed, unsafe, cyclic, incorrectly namespaced, ungrounded, or out-of-scope output. `adapterId` identifies the adapter; `operation` is `inspect-project` for invocation failures and `validate-adapter` for invalid results; `retryable` is `false`. | Unexpected failures are preserved as `cause`; malformed results use a safe validation cause. No partial result is returned. |
|
|
122
|
+
|
|
123
|
+
`RepositoryPathException` and `RepositorySourceException` raised by the supplied reader or adapter-facing reader propagate unchanged. Core does not translate source access, snapshot, cancellation, or malformed-source failures into repository diagnostics or adapter failures.
|
|
124
|
+
|
|
125
|
+
## Development
|
|
126
|
+
|
|
127
|
+
From the monorepo root:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
pnpm exec turbo run typecheck --filter=@moldea.ai/core
|
|
131
|
+
pnpm exec turbo run build --filter=@moldea.ai/core
|
|
132
|
+
pnpm exec turbo run test --filter=@moldea.ai/core
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Unit and integration tests are colocated with their source. Repository-level fixtures use the immutable reader from `@moldea.ai/repository/memory`. Exact conformance goldens cover document diagnostics, context-only repositories, every tool and skill combination, complete project indexes, and the shared runtime-adapter boundary.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { IRepositoryReader } from '@moldea.ai/repository';
|
|
2
|
+
import type { IIndexedAgent, IMoldeaProjectIndex } from '../contracts/index.js';
|
|
3
|
+
import type { IAdapterDiagnostic, IDiagnosticDetails } from '../diagnostics/index.js';
|
|
4
|
+
import type { IRepositoryFormatVersion, IRepositoryReference } from '../format/index.js';
|
|
5
|
+
export interface IRuntimeAdapter {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly supportedRepositoryFormatVersions: readonly IRepositoryFormatVersion[];
|
|
8
|
+
/**
|
|
9
|
+
* Inspects the trusted provisional project through the supplied budget-aware reader.
|
|
10
|
+
* @param context The immutable project, matching agents, reader, and cancellation signal.
|
|
11
|
+
* @returns A promise resolving to deterministic evidence and adapter diagnostics.
|
|
12
|
+
* @throws
|
|
13
|
+
* - INVALID_REPOSITORY_PATH: An adapter repository path is invalid.
|
|
14
|
+
* - ENTRY_NOT_FOUND: A requested repository entry is absent.
|
|
15
|
+
* - ENTRY_NOT_FILE: A requested repository entry is not a regular file.
|
|
16
|
+
* - ENTRY_NOT_DIRECTORY: A requested repository entry is not a directory.
|
|
17
|
+
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
18
|
+
* - SOURCE_UNAVAILABLE: The repository source is unavailable.
|
|
19
|
+
* - SNAPSHOT_CHANGED: The repository snapshot changed during inspection.
|
|
20
|
+
* - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.
|
|
21
|
+
* - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.
|
|
22
|
+
* - ABORTED: Adapter inspection or a repository operation was aborted.
|
|
23
|
+
*/
|
|
24
|
+
inspect(context: IRuntimeAdapterContext): Promise<IRuntimeAdapterResult>;
|
|
25
|
+
}
|
|
26
|
+
export interface IRuntimeAdapterContext {
|
|
27
|
+
readonly repository: IRepositoryReader;
|
|
28
|
+
readonly project: IMoldeaProjectIndex;
|
|
29
|
+
readonly agents: readonly IIndexedAgent[];
|
|
30
|
+
readonly signal?: AbortSignal;
|
|
31
|
+
}
|
|
32
|
+
export type IRuntimeAdapterEvidenceKind = 'runtime-package' | 'language' | 'agent-definition' | 'instruction-loader' | 'schema' | 'tool-registration' | 'skill-registration' | 'handoff-registration' | 'variable-provider' | 'runtime-pattern';
|
|
33
|
+
export interface IRuntimeAdapterEvidence {
|
|
34
|
+
readonly source: string;
|
|
35
|
+
readonly kind: IRuntimeAdapterEvidenceKind;
|
|
36
|
+
readonly agentId: string | null;
|
|
37
|
+
readonly capabilityKind: 'tool' | 'skill' | null;
|
|
38
|
+
readonly capabilityId: string | null;
|
|
39
|
+
readonly runtimeName: string | null;
|
|
40
|
+
readonly references: readonly IRepositoryReference[];
|
|
41
|
+
readonly details: IDiagnosticDetails;
|
|
42
|
+
}
|
|
43
|
+
export interface IRuntimeAdapterResult {
|
|
44
|
+
readonly evidence: readonly IRuntimeAdapterEvidence[];
|
|
45
|
+
readonly diagnostics: readonly IAdapterDiagnostic[];
|
|
46
|
+
}
|
|
47
|
+
export type { IAdapterDiagnostic } from '../diagnostics/index.js';
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,KAAK,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAGzF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,iCAAiC,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAEhF;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC1E;AAGD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAGD,MAAM,MAAM,2BAA2B,GACnC,iBAAiB,GACjB,UAAU,GACV,kBAAkB,GAClB,oBAAoB,GACpB,QAAQ,GACR,mBAAmB,GACnB,oBAAoB,GACpB,sBAAsB,GACtB,mBAAmB,GACnB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACrD,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;CACtC;AAGD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACrD;AAGD,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ICoreDiagnostic } from '../diagnostics/index.js';
|
|
2
|
+
import type { IRepositoryFormatVersion } from '../format/index.js';
|
|
3
|
+
import type { IRuntimeManifestLocation } from '../manifest-validation/index.js';
|
|
4
|
+
import type { ICoreOptionsSnapshot } from '../options/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Validates adapter availability and format support before any runtime adapter runs.
|
|
7
|
+
* @param locations The recognized runtime declarations retained from manifest parsing.
|
|
8
|
+
* @param formatVersion The active repository-format version.
|
|
9
|
+
* @param options The immutable Core adapter registry and limits.
|
|
10
|
+
* @returns Frozen deterministic preflight diagnostics.
|
|
11
|
+
* @throws
|
|
12
|
+
* - RESOURCE_LIMIT_EXCEEDED: The raw Core diagnostic limit was exceeded.
|
|
13
|
+
*/
|
|
14
|
+
export declare const validateRuntimeAdapterAvailability: (locations: readonly IRuntimeManifestLocation[], formatVersion: IRepositoryFormatVersion, options: ICoreOptionsSnapshot) => readonly ICoreDiagnostic[];
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter-availability/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,GAC7C,WAAW,SAAS,wBAAwB,EAAE,EAC9C,eAAe,wBAAwB,EACvC,SAAS,oBAAoB,KAC5B,SAAS,eAAe,EAkC1B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { IRuntimeAdapterEvidence } from '../adapter/index.js';
|
|
2
|
+
import type { IMoldeaProjectIndex } from '../contracts/index.js';
|
|
3
|
+
import type { IAdapterDiagnostic } from '../diagnostics/index.js';
|
|
4
|
+
import type { ICoreOptionsSnapshot } from '../options/index.js';
|
|
5
|
+
import type { IRepositoryInspectionSession } from '../repository-inspection-session/index.js';
|
|
6
|
+
export interface IRuntimeAdapterInspectionResult {
|
|
7
|
+
readonly evidence: readonly IRuntimeAdapterEvidence[];
|
|
8
|
+
readonly diagnostics: readonly IAdapterDiagnostic[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Invokes every applicable configured adapter in canonical ID order.
|
|
12
|
+
* @param project The complete frozen universal project index.
|
|
13
|
+
* @param session The shared inspection reader, cache, and resource budget.
|
|
14
|
+
* @param options The immutable Core adapter registry and resource limits.
|
|
15
|
+
* @param signal Optional cancellation shared by the complete inspection.
|
|
16
|
+
* @returns A promise resolving to normalized evidence and adapter diagnostics.
|
|
17
|
+
* @throws
|
|
18
|
+
* - INVALID_REPOSITORY_PATH: An adapter repository path is invalid.
|
|
19
|
+
* - ENTRY_NOT_FOUND: A requested repository entry is absent.
|
|
20
|
+
* - ENTRY_NOT_FILE: A requested repository entry is not a regular file.
|
|
21
|
+
* - ENTRY_NOT_DIRECTORY: A requested repository entry is not a directory.
|
|
22
|
+
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
23
|
+
* - SOURCE_UNAVAILABLE: The repository source is unavailable.
|
|
24
|
+
* - SNAPSHOT_CHANGED: The repository snapshot changed during adapter inspection.
|
|
25
|
+
* - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.
|
|
26
|
+
* - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.
|
|
27
|
+
* - ABORTED: Adapter inspection or a repository operation was aborted.
|
|
28
|
+
* - ADAPTER_EXECUTION_FAILED: An adapter failed or returned an invalid result.
|
|
29
|
+
*/
|
|
30
|
+
export declare const inspectRuntimeAdapters: (project: IMoldeaProjectIndex, session: IRepositoryInspectionSession, options: ICoreOptionsSnapshot, signal?: AbortSignal) => Promise<IRuntimeAdapterInspectionResult>;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter-execution/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA0B,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAOjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE,OAAO,KAAK,EAAE,oBAAoB,EAA2B,MAAM,qBAAqB,CAAC;AACzF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAG9F,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACrD;AAsED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,mBAAmB,EAC5B,SAAS,4BAA4B,EACrC,SAAS,oBAAoB,EAC7B,SAAS,WAAW,KACnB,OAAO,CAAC,+BAA+B,CAezC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type IRepositoryReader } from '@moldea.ai/repository';
|
|
2
|
+
import type { IRuntimeAdapterEvidence } from '../adapter/index.js';
|
|
3
|
+
import type { ICoreResourceLimits, IIndexedAgent, IMoldeaProjectIndex } from '../contracts/index.js';
|
|
4
|
+
import type { IAdapterDiagnostic } from '../diagnostics/index.js';
|
|
5
|
+
export interface IValidatedRuntimeAdapterResult {
|
|
6
|
+
readonly evidence: readonly IRuntimeAdapterEvidence[];
|
|
7
|
+
readonly diagnostics: readonly IAdapterDiagnostic[];
|
|
8
|
+
}
|
|
9
|
+
export interface IRuntimeAdapterOutputCounts {
|
|
10
|
+
diagnostics: number;
|
|
11
|
+
evidence: number;
|
|
12
|
+
}
|
|
13
|
+
interface IAdapterValidationContext {
|
|
14
|
+
readonly adapterId: string;
|
|
15
|
+
readonly agents: readonly IIndexedAgent[];
|
|
16
|
+
readonly project: IMoldeaProjectIndex;
|
|
17
|
+
readonly repository: IRepositoryReader;
|
|
18
|
+
readonly limits: ICoreResourceLimits;
|
|
19
|
+
readonly signal?: AbortSignal;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Deduplicates and sorts normalized evidence from every completed adapter.
|
|
23
|
+
* @param candidates The normalized evidence items to combine.
|
|
24
|
+
* @returns A frozen deterministic evidence collection.
|
|
25
|
+
*/
|
|
26
|
+
export declare const normalizeRuntimeAdapterEvidence: (candidates: readonly IRuntimeAdapterEvidence[]) => readonly IRuntimeAdapterEvidence[];
|
|
27
|
+
/**
|
|
28
|
+
* Validates and normalizes one untrusted runtime adapter result.
|
|
29
|
+
* @param candidate The result returned by the adapter implementation.
|
|
30
|
+
* @param context The invoking adapter scope, project, reader, limits, and signal.
|
|
31
|
+
* @returns A promise resolving to frozen deterministic evidence and diagnostics.
|
|
32
|
+
* @throws
|
|
33
|
+
* - INVALID_REPOSITORY_PATH: An adapter repository reference path is invalid.
|
|
34
|
+
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
35
|
+
* - SOURCE_UNAVAILABLE: The repository source is unavailable.
|
|
36
|
+
* - SNAPSHOT_CHANGED: The repository snapshot changed during validation.
|
|
37
|
+
* - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.
|
|
38
|
+
* - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.
|
|
39
|
+
* - ABORTED: Adapter validation or a repository operation was aborted.
|
|
40
|
+
* - ADAPTER_EXECUTION_FAILED: The adapter result violates its public contract.
|
|
41
|
+
*/
|
|
42
|
+
export declare const validateRuntimeAdapterResult: (candidate: unknown, context: IAdapterValidationContext, outputCounts: IRuntimeAdapterOutputCounts) => Promise<IValidatedRuntimeAdapterResult>;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapter-validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,uBAAuB,EAA+B,MAAM,qBAAqB,CAAC;AAChG,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EACV,kBAAkB,EAInB,MAAM,yBAAyB,CAAC;AA8DjC,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACrD;AAGD,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,yBAAyB;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AA6cD;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,GAC1C,YAAY,SAAS,uBAAuB,EAAE,KAC7C,SAAS,uBAAuB,EAQlC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,4BAA4B,GACvC,WAAW,OAAO,EAClB,SAAS,yBAAyB,EAClC,cAAc,2BAA2B,KACxC,OAAO,CAAC,8BAA8B,CA4DxC,CAAC"}
|
package/dist/adapter.js
ADDED
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ICoreResourceLimits, IIndexedDescriptionAsset, IIndexedTextAsset } from '../contracts/index.js';
|
|
2
|
+
import type { ICoreDiagnostic } from '../diagnostics/index.js';
|
|
3
|
+
export interface IAgentDescriptionValidationResult {
|
|
4
|
+
readonly valid: boolean;
|
|
5
|
+
readonly description: IIndexedDescriptionAsset | null;
|
|
6
|
+
readonly diagnostics: readonly ICoreDiagnostic[];
|
|
7
|
+
}
|
|
8
|
+
export interface IAgentInstructionValidationResult {
|
|
9
|
+
readonly valid: boolean;
|
|
10
|
+
readonly instruction: IIndexedTextAsset | null;
|
|
11
|
+
readonly diagnostics: readonly ICoreDiagnostic[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Validates the effective value of one agent description asset.
|
|
15
|
+
* @param asset The normalized complete description or handoff-description asset.
|
|
16
|
+
* @param agentId The owning registered agent ID.
|
|
17
|
+
* @param kind The description role determining its diagnostic code.
|
|
18
|
+
* @param limits The Core diagnostic budget.
|
|
19
|
+
* @returns The frozen effective description when every version 1 rule passes.
|
|
20
|
+
* @throws
|
|
21
|
+
* - RESOURCE_LIMIT_EXCEEDED: The repository-level diagnostic budget was exceeded.
|
|
22
|
+
*/
|
|
23
|
+
export declare const validateAgentDescription: (asset: IIndexedTextAsset, agentId: string, kind: "description" | "handoff-description", limits: ICoreResourceLimits) => IAgentDescriptionValidationResult;
|
|
24
|
+
/**
|
|
25
|
+
* Validates one canonical instruction's non-empty content and opening identity.
|
|
26
|
+
* @param asset The normalized complete instruction asset.
|
|
27
|
+
* @param agentId The owning registered agent ID.
|
|
28
|
+
* @param limits The Core diagnostic budget.
|
|
29
|
+
* @returns The frozen instruction result, retaining non-empty content for later validation.
|
|
30
|
+
* @throws
|
|
31
|
+
* - RESOURCE_LIMIT_EXCEEDED: The repository-level diagnostic budget was exceeded.
|
|
32
|
+
*/
|
|
33
|
+
export declare const validateAgentInstruction: (asset: IIndexedTextAsset, agentId: string, limits: ICoreResourceLimits) => IAgentInstructionValidationResult;
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent-asset-validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAW/D,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,wBAAwB,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,SAAS,eAAe,EAAE,CAAC;CAClD;AAGD,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC/C,QAAQ,CAAC,WAAW,EAAE,SAAS,eAAe,EAAE,CAAC;CAClD;AAeD;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GACnC,OAAO,iBAAiB,EACxB,SAAS,MAAM,EACf,MAAM,aAAa,GAAG,qBAAqB,EAC3C,QAAQ,mBAAmB,KAC1B,iCAsCF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GACnC,OAAO,iBAAiB,EACxB,SAAS,MAAM,EACf,QAAQ,mBAAmB,KAC1B,iCA0CF,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type IRepositoryReader } from '@moldea.ai/repository';
|
|
2
|
+
import type { ICanonicalDiscoveryResult } from '../canonical-discovery/index.js';
|
|
3
|
+
import type { IIndexedDescriptionAsset, IIndexedTextAsset } from '../contracts/index.js';
|
|
4
|
+
import type { ICoreDiagnostic } from '../diagnostics/index.js';
|
|
5
|
+
import type { IAgentManifestEntry, IMoldeaManifestV1 } from '../format/index.js';
|
|
6
|
+
import { type ICoreOptionsSnapshot } from '../options/index.js';
|
|
7
|
+
export interface IInspectedAgentAssets {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly declaration: IAgentManifestEntry;
|
|
10
|
+
readonly description: IIndexedDescriptionAsset | null;
|
|
11
|
+
readonly instruction: IIndexedTextAsset | null;
|
|
12
|
+
readonly handoffDescription: IIndexedDescriptionAsset | null;
|
|
13
|
+
}
|
|
14
|
+
export interface IAgentAssetInspectionResult {
|
|
15
|
+
readonly valid: boolean;
|
|
16
|
+
readonly agents: readonly IInspectedAgentAssets[];
|
|
17
|
+
readonly diagnostics: readonly ICoreDiagnostic[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Reconciles registered agents with their convention-owned directories and Markdown assets.
|
|
21
|
+
* @param repository The coherent source-neutral repository reader.
|
|
22
|
+
* @param manifest The normalized manifest containing registered agents.
|
|
23
|
+
* @param discovery The canonical inventory and path-owned structural diagnostics.
|
|
24
|
+
* @param options The immutable Core configuration snapshot.
|
|
25
|
+
* @param signal Optional cancellation forwarded to every repository read.
|
|
26
|
+
* @returns Deeply immutable registered-agent assets and deterministic diagnostics.
|
|
27
|
+
* @throws
|
|
28
|
+
* - ENTRY_NOT_FOUND: A discovered agent asset disappeared from the reader snapshot.
|
|
29
|
+
* - ENTRY_NOT_FILE: A discovered agent asset is no longer a regular file.
|
|
30
|
+
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
31
|
+
* - SOURCE_UNAVAILABLE: The repository source is unavailable.
|
|
32
|
+
* - SNAPSHOT_CHANGED: The repository snapshot changed during agent reads.
|
|
33
|
+
* - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.
|
|
34
|
+
* - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.
|
|
35
|
+
* - ABORTED: Agent inspection or a repository operation was aborted.
|
|
36
|
+
*/
|
|
37
|
+
export declare const inspectAgentAssets: (repository: IRepositoryReader, manifest: IMoldeaManifestV1, discovery: ICanonicalDiscoveryResult, options: ICoreOptionsSnapshot, signal?: AbortSignal) => Promise<IAgentAssetInspectionResult>;
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent-assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,KAAK,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAKzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EAAsC,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAOpG,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,wBAAwB,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC/C,QAAQ,CAAC,kBAAkB,EAAE,wBAAwB,GAAG,IAAI,CAAC;CAC9D;AAGD,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAClD,QAAQ,CAAC,WAAW,EAAE,SAAS,eAAe,EAAE,CAAC;CAClD;AAyFD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,GAC7B,YAAY,iBAAiB,EAC7B,UAAU,iBAAiB,EAC3B,WAAW,yBAAyB,EACpC,SAAS,oBAAoB,EAC7B,SAAS,WAAW,KACnB,OAAO,CAAC,2BAA2B,CAiIrC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type IRepositoryEntry, type IRepositoryPath, type IRepositoryReader } from '@moldea.ai/repository';
|
|
2
|
+
import type { ICoreResourceLimits } from '../contracts/index.js';
|
|
3
|
+
import type { ICoreDiagnostic } from '../diagnostics/index.js';
|
|
4
|
+
export interface IDiscoveredAgentAssets {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly path: IRepositoryPath;
|
|
7
|
+
readonly description: IRepositoryPath | null;
|
|
8
|
+
readonly instruction: IRepositoryPath | null;
|
|
9
|
+
readonly handoffDescription: IRepositoryPath | null;
|
|
10
|
+
}
|
|
11
|
+
export interface ICanonicalDiscoveryInventory {
|
|
12
|
+
readonly manifest: IRepositoryPath | null;
|
|
13
|
+
readonly project: IRepositoryPath | null;
|
|
14
|
+
readonly context: readonly IRepositoryPath[];
|
|
15
|
+
readonly decisions: readonly IRepositoryPath[];
|
|
16
|
+
readonly runtimeGuidance: readonly IRepositoryPath[];
|
|
17
|
+
readonly agents: readonly IDiscoveredAgentAssets[];
|
|
18
|
+
}
|
|
19
|
+
export interface ICanonicalDiscoveryResult {
|
|
20
|
+
readonly valid: boolean;
|
|
21
|
+
readonly inventory: ICanonicalDiscoveryInventory;
|
|
22
|
+
readonly diagnostics: readonly ICoreDiagnostic[];
|
|
23
|
+
}
|
|
24
|
+
export interface ICanonicalDiscoveryFoundationEntries {
|
|
25
|
+
readonly moldeaRoot: IRepositoryEntry | null;
|
|
26
|
+
readonly manifest: IRepositoryEntry | null;
|
|
27
|
+
readonly project: IRepositoryEntry | null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Discovers and classifies version 1 canonical assets through one repository snapshot.
|
|
31
|
+
* @param repository The coherent source-neutral repository reader.
|
|
32
|
+
* @param limits The immutable Core limits governing diagnostic collection.
|
|
33
|
+
* @param signal Optional cancellation forwarded to every repository operation.
|
|
34
|
+
* @param foundations Optional exact foundation entries already observed by this inspection.
|
|
35
|
+
* @returns A deeply immutable inventory and its deterministic structural diagnostics.
|
|
36
|
+
* @throws
|
|
37
|
+
* - ENTRY_NOT_FOUND: The reader snapshot became inconsistent during discovery.
|
|
38
|
+
* - ENTRY_NOT_DIRECTORY: The reader snapshot became inconsistent during discovery.
|
|
39
|
+
* - ACCESS_DENIED: Access to the repository source was denied.
|
|
40
|
+
* - SOURCE_UNAVAILABLE: The repository source was unavailable.
|
|
41
|
+
* - SNAPSHOT_CHANGED: The repository snapshot changed during discovery.
|
|
42
|
+
* - INVALID_SOURCE_DATA: The repository reader returned invalid contract data.
|
|
43
|
+
* - RESOURCE_LIMIT_EXCEEDED: A Core or repository resource limit was exceeded.
|
|
44
|
+
* - ABORTED: Discovery or a repository operation was aborted.
|
|
45
|
+
*/
|
|
46
|
+
export declare const discoverCanonicalAssets: (repository: IRepositoryReader, limits: ICoreResourceLimits, signal?: AbortSignal, foundations?: ICanonicalDiscoveryFoundationEntries) => Promise<ICanonicalDiscoveryResult>;
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/canonical-discovery/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAKjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAS/D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,eAAe,GAAG,IAAI,CAAC;IAC7C,QAAQ,CAAC,WAAW,EAAE,eAAe,GAAG,IAAI,CAAC;IAC7C,QAAQ,CAAC,kBAAkB,EAAE,eAAe,GAAG,IAAI,CAAC;CACrD;AAGD,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C,QAAQ,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,CAAC;IAC/C,QAAQ,CAAC,eAAe,EAAE,SAAS,eAAe,EAAE,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,SAAS,sBAAsB,EAAE,CAAC;CACpD;AAGD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,4BAA4B,CAAC;IACjD,QAAQ,CAAC,WAAW,EAAE,SAAS,eAAe,EAAE,CAAC;CAClD;AAGD,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC3C;AA+ND;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,GAClC,YAAY,iBAAiB,EAC7B,QAAQ,mBAAmB,EAC3B,SAAS,WAAW,EACpB,cAAc,oCAAoC,KACjD,OAAO,CAAC,yBAAyB,CA+GnC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IRepositoryEntry } from '@moldea.ai/repository';
|
|
2
|
+
export type ICanonicalFileKind = 'manifest' | 'project' | 'context' | 'decision' | 'runtime-guidance' | 'agent-description' | 'agent-instruction' | 'agent-handoff-description';
|
|
3
|
+
export type ICanonicalEntryClassification = {
|
|
4
|
+
readonly kind: 'canonical-file';
|
|
5
|
+
readonly fileKind: ICanonicalFileKind;
|
|
6
|
+
readonly agentId: string | null;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'agent-directory';
|
|
9
|
+
readonly agentId: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'structural-directory' | 'ignored-directory';
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: 'canonical-asset-symlink';
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'entry-type-invalid';
|
|
16
|
+
readonly expectedType: 'file' | 'directory';
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'unrecognized';
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Classifies one reader entry against the version 1 canonical layout.
|
|
22
|
+
* @param entry The detached entry beneath the canonical moldea root.
|
|
23
|
+
* @returns Its canonical category or the precise structural failure category.
|
|
24
|
+
*/
|
|
25
|
+
export declare const classifyCanonicalEntry: (entry: IRepositoryEntry) => ICanonicalEntryClassification;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/canonical-discovery-validation/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAmB,MAAM,uBAAuB,CAAC;AAK/E,MAAM,MAAM,kBAAkB,GAC1B,UAAU,GACV,SAAS,GACT,SAAS,GACT,UAAU,GACV,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,2BAA2B,CAAC;AAGhC,MAAM,MAAM,6BAA6B,GACrC;IACE,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC9D;IAAE,QAAQ,CAAC,IAAI,EAAE,sBAAsB,GAAG,mBAAmB,CAAA;CAAE,GAC/D;IAAE,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,CAAA;CAAE,GACpF;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC;AA2EtC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,gBAAgB,KAAG,6BAkChE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ICoreResourceLimits } from '../contracts/index.js';
|
|
2
|
+
import type { IRepositoryFormatVersion } from '../format/index.js';
|
|
3
|
+
export declare const RECOGNIZED_RUNTIME_ADAPTER_IDS: readonly ["anthropic", "claude-agent-sdk", "cloudflare-agents", "custom", "eve", "google-genai", "langchain", "langgraph", "openai", "openai-agents-sdk", "pydantic-ai", "vercel-ai-sdk"];
|
|
4
|
+
export declare const SUPPORTED_REPOSITORY_FORMAT_VERSIONS: readonly IRepositoryFormatVersion[];
|
|
5
|
+
export declare const DEFAULT_CORE_RESOURCE_LIMITS: ICoreResourceLimits;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,eAAO,MAAM,8BAA8B,2LAahC,CAAC;AAGZ,eAAO,MAAM,oCAAoC,EAAE,SAAS,wBAAwB,EAChE,CAAC;AAGrB,eAAO,MAAM,4BAA4B,EAAE,mBAOzC,CAAC"}
|