@godspeedai/cognate-profile 0.7.1 → 0.9.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/package.json +2 -2
- package/src/EGM.md +27 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@godspeedai/cognate-profile",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "defineProfile: reusable application compositions that select and configure components without new kernel concepts (spec §29).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
".": "./src/index.ts"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@godspeedai/cognate-kernel-api": "^0.
|
|
25
|
+
"@godspeedai/cognate-kernel-api": "^0.9.0"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/EGM.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# profile/src — profile composition primitives
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
This directory holds the entire profile layer: two functions and the types they exchange. A profile is a named selection of registered component factories plus per-component options, and the module header states it introduces no kernel primitive `[packages/profile/src/index.ts:Profiles are composition]`. `defineProfile` validates and freezes a definition; `resolveProfile` turns a definition plus a caller-supplied registry into contributions and an explicit unresolved list.
|
|
5
|
+
|
|
6
|
+
## Interface
|
|
7
|
+
- `ProfileDefinition` — frozen `name`, `description`, ordered `components`, and `options` `[packages/profile/src/index.ts:ProfileDefinition]`
|
|
8
|
+
- `ProfileError` — `Error` subclass whose `name` is `"ProfileError"` `[packages/profile/src/index.ts:ProfileError]`
|
|
9
|
+
- `defineProfile(profile)` — validates, normalizes, freezes, and returns a `ProfileDefinition` `[packages/profile/src/index.ts:defineProfile]`
|
|
10
|
+
- `ComponentEntry<T>` — registered factory: `name`, `package`, `supported`, optional `reason`, and `contribute(options)` `[packages/profile/src/index.ts:ComponentEntry]`
|
|
11
|
+
- `ResolvedProfile<T>` — the profile, ordered `contributions`, and `unresolved` entries `[packages/profile/src/index.ts:ResolvedProfile]`
|
|
12
|
+
- `resolveProfile<T>(profile, registry)` — resolves names against the registry in profile order `[packages/profile/src/index.ts:resolveProfile]`
|
|
13
|
+
|
|
14
|
+
## Invariants
|
|
15
|
+
- An empty profile name throws `ProfileError("profile name must not be empty")` `[packages/profile/src/index.ts:defineProfile]`
|
|
16
|
+
- Component names must be non-empty and unique; a repeat throws ``duplicate component name: ${name}`` `[packages/profile/src/index.ts:defineProfile]`
|
|
17
|
+
- The returned definition, its `components` array, and its `options` record are all frozen `[packages/profile/src/index.ts:defineProfile]`
|
|
18
|
+
- `description` defaults to `""` and `options` to `{}` when omitted `[packages/profile/src/index.ts:defineProfile]`
|
|
19
|
+
- A requested name missing from the registry becomes `unresolved` with reason `"unknown component"` `[packages/profile/src/index.ts:resolveProfile]`
|
|
20
|
+
- A registered but unsupported entry becomes `unresolved` with its own `reason`, falling back to `"unsupported component"` `[packages/profile/src/index.ts:resolveProfile]`
|
|
21
|
+
- `contribute` receives `profile.options[name]`, untyped, so each factory owns its own validation `[packages/profile/src/index.ts:resolveProfile]`
|
|
22
|
+
|
|
23
|
+
## Side Effects
|
|
24
|
+
- Calls each supported entry's `contribute` during resolution; the module performs no I/O of its own `[packages/profile/src/index.ts:resolveProfile]`
|
|
25
|
+
|
|
26
|
+
## Verification
|
|
27
|
+
- Run: `cd packages/profile && bun test`
|