@godspeedai/cognate-profile 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +71 -12
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,14 +1,73 @@
1
1
  # @godspeedai/cognate-profile
2
2
 
3
- Profiles are pure composition (spec §29, §40.J/K): a named, ordered
4
- selection of registered component names plus per-component options. They
5
- add no kernel concepts. `defineProfile` validates (non-empty name, unique
6
- non-empty component names) and returns a deep-frozen `ProfileDefinition`
7
- with `description` defaulting to `""`.
8
-
9
- `resolveProfile(profile, registry)` looks up each requested component name
10
- in a caller-supplied `ComponentEntry[]` registry, in profile order. An
11
- unknown name resolves with reason `"unknown component"`; an entry with
12
- `supported: false` resolves with its own `reason`; only supported entries
13
- have `contribute(profile.options[name])` called. Every requested-but-missing
14
- component is reported in `unresolved` — nothing is silently dropped.
3
+ Declarative composition for Cognate applications: `defineProfile` names an ordered selection of registered components plus their configuration, and `resolveProfile` turns that selection into contributions. Profiles add no kernel concepts — they only select and configure what packages already register.
4
+
5
+ **When to use this package:** you are defining a reusable application composition (a "profile") or building the registry a profile resolves against. Ready-made profiles include
6
+ [`@godspeedai/cognate-profile-harness`](https://www.npmjs.com/package/@godspeedai/cognate-profile-harness)
7
+ and [`@godspeedai/cognate-profile-copilot`](https://www.npmjs.com/package/@godspeedai/cognate-profile-copilot).
8
+
9
+ ## Installation
10
+
11
+ ```sh
12
+ bun add @godspeedai/cognate-profile
13
+ ```
14
+
15
+ Requires [Bun](https://bun.sh) >= 1.4.0.
16
+
17
+ ## Quick start
18
+
19
+ ```ts
20
+ import { defineProfile, resolveProfile } from "@godspeedai/cognate-profile";
21
+ import type { ComponentEntry } from "@godspeedai/cognate-profile";
22
+
23
+ // A registry: entries a package provides, each producing one contribution.
24
+ const registry: ComponentEntry<string[]>[] = [
25
+ {
26
+ name: "sessions",
27
+ package: "@godspeedai/cognate-runtime-bun",
28
+ supported: true,
29
+ contribute: () => ["sessions"],
30
+ },
31
+ {
32
+ name: "agents",
33
+ package: "@godspeedai/cognate-runtime-bun",
34
+ supported: true,
35
+ contribute: (options) => [`agents:${JSON.stringify(options ?? null)}`],
36
+ },
37
+ ];
38
+
39
+ // Validate and freeze the profile. Names must be unique and non-empty.
40
+ const profile = defineProfile({
41
+ name: "research-workbench",
42
+ description: "Sessions plus a bounded agent pool",
43
+ components: ["sessions", "agents"],
44
+ options: { agents: { max: 2 } },
45
+ });
46
+
47
+ const resolved = resolveProfile(profile, registry);
48
+ resolved.contributions; // [{ name: "sessions", ... }, { name: "agents", contribution: 'agents:{"max":2}' }]
49
+ resolved.unresolved; // every requested name that could not be included, with a reason
50
+ ```
51
+
52
+ `resolveProfile` walks the profile's components in order, calling `contribute(profile.options[name])` only for supported entries. An unknown name is reported with reason `"unknown component"`; an entry marked `supported: false` is reported with its own reason. Nothing is ever silently dropped.
53
+
54
+ ## What the types guarantee
55
+
56
+ - `defineProfile` returns a deep-frozen `ProfileDefinition`: the component list and options cannot be mutated after definition, and validation errors throw `ProfileError` at definition time, not resolution time.
57
+ - `ResolvedProfile` separates `contributions` (in profile order, each tagged with its source package) from `unresolved` (requested but absent, each with a reason), so a composition can show exactly what it is running and why anything is missing.
58
+ - `ComponentEntry.supported: false` records an unavailable component explicitly, with a human-readable `reason`.
59
+
60
+ ## Limitations
61
+
62
+ - Pure data: this package validates and resolves — it mounts nothing, starts nothing, and knows no registry by itself. The caller owns what `contribute` returns and what happens with the resolved contributions.
63
+ - Options are opaque to this package; they are passed through to each entry's `contribute` untouched.
64
+
65
+ ## Related packages
66
+
67
+ - [`@godspeedai/cognate-kernel-api`](https://www.npmjs.com/package/@godspeedai/cognate-kernel-api) — the kernel contract profiles select against, without extending it.
68
+ - [`@godspeedai/cognate-runtime-bun`](https://www.npmjs.com/package/@godspeedai/cognate-runtime-bun) — the runtime compositions are typically resolved into.
69
+ - [`@godspeedai/cognate`](https://www.npmjs.com/package/@godspeedai/cognate) — the SDK umbrella.
70
+
71
+ ## License
72
+
73
+ Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@godspeedai/cognate-profile",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
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.1.0"
25
+ "@godspeedai/cognate-kernel-api": "^0.1.2"
26
26
  }
27
27
  }