@anureo/host 0.0.0-stage → 0.3.11

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 CHANGED
@@ -1,3 +1,61 @@
1
- # Temporary Holding Version
1
+ # @anureo/host
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Persist agent sessions, observe their events, and expose scoped access through a
4
+ local API or a WebSocket endpoint. The application supplies runtime clients,
5
+ authenticated actors, workspace resolution, and an authorization policy.
6
+
7
+ ```ts
8
+ import { createHarnessHost } from '@anureo/host'
9
+ import { HarnessStore } from '@anureo/host/sqlite'
10
+
11
+ const actor = { userId: 'owner' }
12
+ const host = createHarnessHost({
13
+ store: new HarnessStore('./sessions.sqlite'),
14
+ runtimes: [],
15
+ resolveWorkspace: scopeId => scopeId === 'workspace' ? process.cwd() : undefined,
16
+ authorize: (candidate, scopeId) =>
17
+ candidate.userId === actor.userId && scopeId === 'workspace',
18
+ })
19
+ try {
20
+ console.log(await host.sessions.list({ actor }, { scopeId: 'workspace' }))
21
+ } finally {
22
+ await host.close()
23
+ }
24
+ ```
25
+
26
+ Register runtime descriptors whose `create` callback returns an initialized SDK
27
+ Client to execute model turns. Empty runtime registration still permits reading
28
+ stored sessions. Scope IDs are application-defined workspace identities; the
29
+ Host enforces the injected authorization policy for each operation.
30
+
31
+ ## Storage and lifecycle
32
+
33
+ `@anureo/host/sqlite` selects Bun SQLite under Bun and Node SQLite under Node.
34
+ Use a separate database per Host instance; concurrent writers are rejected.
35
+ `HostStorage` is the storage port for an application-owned implementation.
36
+ Await `host.close()` to release runtime observations, subscriptions, and storage.
37
+ Closing an observation does not by itself prove that a shared native execution
38
+ has stopped; interruption and recovery use the runtime's declared capabilities.
39
+
40
+ ## WebSocket access
41
+
42
+ `createScopedHostDispatcher(host)` adapts the Host to the scope-based JSON-RPC
43
+ contract. Pass it to `createHostWebSocket` to embed the transport in an existing
44
+ server, or `listenHostWebSocket` from `@anureo/host/ws` for a standalone listener.
45
+ The application authenticates each connection; authentication does not replace
46
+ the Host's per-scope authorization policy. Close the listener before the Host.
47
+ `@anureo/host/protocol` exports the scoped protocol types and codecs.
48
+
49
+ ## Compatibility
50
+
51
+ `HarnessHost` and `@anureo/host/compat` retain the existing project-based Hx
52
+ integration surface. New applications should use `createHarnessHost` and the
53
+ scoped dispatcher. Projection and UI presentation remain application-owned.
54
+
55
+ ## Code structure
56
+
57
+ - `src/host.ts`, `src/scoped-host.ts`: lifecycle, execution, and scoped APIs.
58
+ - `src/store.ts`, `src/sqlite-bun.ts`, `src/sqlite-node.ts`: durable storage.
59
+ - `src/catalog.ts`, `src/queue.ts`: model discovery and queued work.
60
+ - `src/ws.ts`, `src/ws-connection.ts`, `src/ws-listener.ts`: transports.
61
+ - `src/protocol.ts`, `schema/`, `scripts/generate.ts`: wire types and validation.
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@anureo/host",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.11",
4
+ "description": "Persistent agent sessions and WebSocket access for the Anureo SDK",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/hi-youichi/anureo-sdk.git",
9
+ "directory": "packages/host"
10
+ },
11
+ "type": "module",
12
+ "files": [
13
+ "src",
14
+ "schema",
15
+ "README.md"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "exports": {
21
+ ".": "./src/index.ts",
22
+ "./compat": "./src/compat.ts",
23
+ "./ws": "./src/ws.ts",
24
+ "./protocol": "./src/protocol.ts",
25
+ "./sqlite": {
26
+ "bun": "./src/sqlite-bun.ts",
27
+ "default": "./src/sqlite-node.ts"
28
+ }
29
+ },
30
+ "scripts": {
31
+ "build": "tsc --noEmit",
32
+ "typecheck": "tsc --noEmit --pretty false",
33
+ "test": "bun test tests",
34
+ "test:node": "bun scripts/test-node.ts",
35
+ "generate": "bun scripts/generate.ts",
36
+ "generate:check": "bun scripts/generate.ts --check"
37
+ },
38
+ "dependencies": {
39
+ "@anureo/adapter-swarm": "0.3.11",
40
+ "@anureo/protocol": "0.3.11",
41
+ "@anureo/sdk": "0.3.11",
42
+ "ajv": "8.20.0",
43
+ "ws": "8.21.1"
44
+ },
45
+ "devDependencies": {
46
+ "@anureo/conformance": "0.3.11",
47
+ "@types/ws": "8.18.1"
48
+ },
49
+ "engines": {
50
+ "node": ">=22"
51
+ }
52
+ }