@godspeedai/cognate-profile-harness 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.
- package/README.md +94 -18
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,22 +1,98 @@
|
|
|
1
1
|
# @godspeedai/cognate-profile-harness
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
primitives. No kernel additions — every behaviour below is a `Component`, an `AgentDefinition`, or
|
|
5
|
-
plain durable-store/service calls.
|
|
3
|
+
The Harness reference profile: a ready-to-run autonomous agent — model provider, tool registry, agent loop, sessions, durable key-value storage, skills, a scheduler, a code sandbox, and subagents — composed entirely from existing runtime primitives. No new kernel machinery.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
> **Security warning.** This profile's reference configuration authorizes *every* capability invocation and *every* action: its policy is allow-all by default and cannot be tightened through options. It is a reference and demo harness for a local, single-user setting. Do not expose it to untrusted callers or networks. For real deployments, build on [`@godspeedai/cognate-runtime-bun`](https://www.npmjs.com/package/@godspeedai/cognate-runtime-bun) directly and pass your own `policy` and `actions` to `createRuntime`.
|
|
6
|
+
|
|
7
|
+
**When to use this package:** you want a working autonomous loop (model picks tools, tools run, loop continues until answered), durable sessions and scheduled runs, sandboxed code execution, and parent/child subagent composition — to run as-is or study before composing your own. For an interactive chat copilot instead, see [`@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-harness
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Requires [Bun](https://bun.sh) >= 1.4.0 (the sandbox spawns `bun -e` subprocesses). Builds on [`@godspeedai/cognate-runtime-bun`](https://www.npmjs.com/package/@godspeedai/cognate-runtime-bun), [`@godspeedai/cognate-capabilities`](https://www.npmjs.com/package/@godspeedai/cognate-capabilities), and [`@godspeedai/cognate-kernel-api`](https://www.npmjs.com/package/@godspeedai/cognate-kernel-api).
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import {
|
|
21
|
+
createHarness,
|
|
22
|
+
providerComponent,
|
|
23
|
+
toolComponent,
|
|
24
|
+
} from "@godspeedai/cognate-profile-harness";
|
|
25
|
+
import { openAICompatible } from "@godspeedai/cognate-provider-openai-compatible";
|
|
26
|
+
|
|
27
|
+
const harness = await createHarness({
|
|
28
|
+
store: "./harness.sqlite", // durable runs, sessions, schedules, and kv records
|
|
29
|
+
instructions: "You are a build assistant.",
|
|
30
|
+
maxSteps: 8, // model/tool iterations per run
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Mount a model provider (replaceable live: dispose one, mount another).
|
|
34
|
+
await harness.mount(providerComponent(
|
|
35
|
+
openAICompatible({ id: "main", baseURL: process.env.MODEL_BASE_URL!, model: "my-model", apiKey: () => process.env.MODEL_API_KEY! }),
|
|
36
|
+
));
|
|
37
|
+
|
|
38
|
+
// Mount a tool; the loop discovers it from the registry on the next run.
|
|
39
|
+
await harness.mount(toolComponent({
|
|
40
|
+
name: "reverse",
|
|
41
|
+
description: "Reverse a string",
|
|
42
|
+
inputSchema: { type: "object" },
|
|
43
|
+
handler: (input) => ({ reversed: [...String((input as { text: string }).text)].reverse().join("") }),
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
const runId = await harness.send("session-1", "please reverse this");
|
|
47
|
+
// ... the run executes; poll or subscribe for completion
|
|
48
|
+
const runs = await harness.session("session-1"); // [{ runId, status, output }]
|
|
49
|
+
await harness.close();
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## What a harness does
|
|
53
|
+
|
|
54
|
+
| Concern | Behaviour |
|
|
8
55
|
| --- | --- |
|
|
9
|
-
|
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
56
|
+
| Agent loop | `agent.loop` calls `model.generate`, executes the requested tools from the live registry, feeds results back, and stops when the model answers (bounded by `maxSteps`) |
|
|
57
|
+
| Tool registry | `toolComponent` mounts one tool; `skillComponent` mounts a named bundle; tools appear/disappear live as components mount and dispose, and a tool can declare capability `requires` so it waits for its dependencies |
|
|
58
|
+
| Sessions | `send(sessionId, message)` starts runs correlated by `session:<id>`; `session(sessionId)` lists them oldest-first |
|
|
59
|
+
| Storage | the built-in `storage.kv` capability — `get`/`set`/`delete` backed by durable records, partitioned by the caller's tenant |
|
|
60
|
+
| Scheduler | `schedule(agent, input, at)` records a durable schedule; a loop starts due runs (idempotently, safe across restarts) |
|
|
61
|
+
| Sandbox | the `sandbox.exec` capability runs code in a `bun -e` subprocess with a scrubbed environment (no inherited secrets), a timeout, and an output cap |
|
|
62
|
+
| Subagents | `spawnSubagent(ctx, id, agent, input)` starts a child run durably from inside a run and waits for its output — the wait survives a restart |
|
|
63
|
+
|
|
64
|
+
`spawnSubagent` is the one piece that runs inside an agent:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { spawnSubagent } from "@godspeedai/cognate-profile-harness";
|
|
68
|
+
|
|
69
|
+
const myAgent = {
|
|
70
|
+
id: "agent.researcher",
|
|
71
|
+
version: "1.0.0",
|
|
72
|
+
async run(input, ctx) {
|
|
73
|
+
const summary = await spawnSubagent(ctx, "search", "agent.search", { query: input.topic });
|
|
74
|
+
return { summary };
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
// pass it via createHarness({ agents: [myAgent], ... })
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The exported `harnessProfile` and `harnessRegistry` declare the composition by name (resolvable with `resolveProfile` from [`@godspeedai/cognate-profile`](https://www.npmjs.com/package/@godspeedai/cognate-profile)), and every behaviour above is an ordinary component, agent definition, or durable-store/service call you can reassemble yourself.
|
|
81
|
+
|
|
82
|
+
## Limitations
|
|
83
|
+
|
|
84
|
+
- **Allow-all authorization is baked into the reference configuration** (see the warning above); multi-tenant or least-privilege deployments need `createRuntime` with a real policy instead.
|
|
85
|
+
- The scheduler is an in-process interval loop: schedules are durable, but starting them requires a running harness process.
|
|
86
|
+
- The sandbox isolates only by scrubbed environment, timeout, and output cap — it is not a security boundary against hostile code.
|
|
87
|
+
- There is exactly one slot for the model provider contract: swap providers by disposing the mounted one and mounting the next (a verified live swap); routing between concurrent providers is not provided.
|
|
88
|
+
|
|
89
|
+
## Related packages
|
|
90
|
+
|
|
91
|
+
- [`@godspeedai/cognate-profile-copilot`](https://www.npmjs.com/package/@godspeedai/cognate-profile-copilot) — the interactive chat profile.
|
|
92
|
+
- [`@godspeedai/cognate-runtime-bun`](https://www.npmjs.com/package/@godspeedai/cognate-runtime-bun) — the runtime and durable store underneath.
|
|
93
|
+
- [`@godspeedai/cognate-provider-openai-compatible`](https://www.npmjs.com/package/@godspeedai/cognate-provider-openai-compatible) — model providers for real endpoints.
|
|
94
|
+
- [`@godspeedai/cognate`](https://www.npmjs.com/package/@godspeedai/cognate) — the SDK umbrella.
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@godspeedai/cognate-profile-harness",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Harness reference profile: model providers, tool registry, agent loop, sessions, storage, skills, scheduler, sandbox, replaceable services, subagents (spec §29.2). No kernel additions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
".": "./src/index.ts"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@godspeedai/cognate-capabilities": "^0.1.
|
|
26
|
-
"@godspeedai/cognate-events": "^0.1.
|
|
27
|
-
"@godspeedai/cognate-kernel-api": "^0.1.
|
|
28
|
-
"@godspeedai/cognate-profile": "^0.1.
|
|
29
|
-
"@godspeedai/cognate-provider-openai-compatible": "^0.1.
|
|
30
|
-
"@godspeedai/cognate-runtime-api": "^0.1.
|
|
31
|
-
"@godspeedai/cognate-runtime-bun": "^0.1.
|
|
25
|
+
"@godspeedai/cognate-capabilities": "^0.1.2",
|
|
26
|
+
"@godspeedai/cognate-events": "^0.1.2",
|
|
27
|
+
"@godspeedai/cognate-kernel-api": "^0.1.2",
|
|
28
|
+
"@godspeedai/cognate-profile": "^0.1.2",
|
|
29
|
+
"@godspeedai/cognate-provider-openai-compatible": "^0.1.2",
|
|
30
|
+
"@godspeedai/cognate-runtime-api": "^0.1.2",
|
|
31
|
+
"@godspeedai/cognate-runtime-bun": "^0.1.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@godspeedai/cognate-provider-local": "workspace:*"
|