@knpkv/relay 0.0.0-stage → 0.2.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/dist/wire.js ADDED
@@ -0,0 +1,145 @@
1
+ // dist/wire.js
2
+ import { Schema as Schema2 } from "effect";
3
+
4
+ // dist/model.js
5
+ import * as Capability from "@knpkv/capability";
6
+ import { Schema } from "effect";
7
+ var Name = Schema.String.check(Schema.isTrimmed(), Schema.isNonEmpty(), Schema.isMaxLength(200));
8
+ var RelayProduct = Schema.Literals(["codecommit", "jcf", "agent-usage", "control-center", "herdr"]);
9
+ var ObjectRef2 = Schema.Struct({
10
+ product: RelayProduct,
11
+ kind: Name,
12
+ id: Name
13
+ });
14
+ var objectRefKey = (ref) => JSON.stringify([ref.product, ref.kind, ref.id]);
15
+ var CapabilityAccess = Schema.Literals(["read", "write", "host"]);
16
+ var BackendUnavailableCause = Schema.Literals(["NotInstalled", "SignedOut", "Misconfigured", "NoCapability"]);
17
+ var RelayBackendId = Schema.Literals(["claude-code", "codex-cli"]);
18
+ var backendFields = { backend: RelayBackendId, label: Schema.String };
19
+ var BackendStatus = Schema.TaggedUnion({
20
+ Unverified: { ...backendFields, version: Schema.String },
21
+ Ready: { ...backendFields, version: Schema.String },
22
+ Unavailable: {
23
+ ...backendFields,
24
+ version: Schema.optionalKey(Schema.String),
25
+ cause: BackendUnavailableCause,
26
+ fix: Schema.String
27
+ }
28
+ });
29
+ var DecisionState = Schema.TaggedUnion({
30
+ Decided: { allow: Schema.Boolean },
31
+ Expired: {},
32
+ Unknown: {}
33
+ });
34
+ var SessionTool = Schema.Struct({
35
+ name: Name,
36
+ access: CapabilityAccess,
37
+ available: Schema.Boolean,
38
+ unavailableReason: Schema.optional(Schema.String)
39
+ });
40
+ var SessionInfo = Schema.Struct({
41
+ tools: Schema.Array(SessionTool),
42
+ backend: RelayBackendId,
43
+ cancel: Schema.Boolean
44
+ });
45
+ var WriteReceipt = Schema.Struct({
46
+ summary: Schema.String,
47
+ providerId: Schema.String,
48
+ link: Schema.optionalKey(Schema.String)
49
+ });
50
+ var Seq = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
51
+ var eventFields = { session: Name, seq: Seq };
52
+ var RunIds = Schema.Array(Name);
53
+ var RelayEvent = Schema.TaggedUnion({
54
+ Snapshot: {
55
+ ...eventFields,
56
+ messages: Schema.Array(Schema.Struct({ id: Name, role: Schema.Literals(["user", "relay"]), text: Schema.String })),
57
+ /** The run in flight, empty when idle. */
58
+ runIds: RunIds,
59
+ /** Messages accepted but not yet in the transcript, oldest first: they wait for the run in flight. */
60
+ queued: RunIds
61
+ },
62
+ /**
63
+ * A message the server accepted that waits for the run in flight. It joins the transcript with its own
64
+ * `MessagePlaced`, or leaves with `MessageWithdrawn`.
65
+ */
66
+ MessageQueued: { ...eventFields, requestId: Name },
67
+ /** A message the server placed in the transcript; `id` is its transcript id, as a later Snapshot names it. */
68
+ MessagePlaced: { ...eventFields, id: Name, requestId: Name, text: Schema.String },
69
+ /** A queued message the person withdrew before any run took it. */
70
+ MessageWithdrawn: { ...eventFields, requestId: Name },
71
+ RunStarted: { ...eventFields, runIds: RunIds },
72
+ TextDelta: { ...eventFields, text: Schema.String },
73
+ /** `summary` is a server-built, display-safe line; `input` is the call's typed arguments. */
74
+ ToolStarted: { ...eventFields, call: Name, capability: Name, summary: Schema.String, input: Schema.Json },
75
+ /** `receipt` is set when a write completed and its capability projects one. */
76
+ ToolFinished: {
77
+ ...eventFields,
78
+ call: Name,
79
+ ok: Schema.Boolean,
80
+ summary: Schema.String,
81
+ cites: Schema.Array(Capability.ObjectRef),
82
+ receipt: Schema.optionalKey(WriteReceipt)
83
+ },
84
+ ConfirmationRequired: { ...eventFields, call: Name, action: Capability.PendingAction, reversible: Schema.Boolean },
85
+ /** The server's outcome for a confirmation: the card turns to past tense only on this. */
86
+ ConfirmationResolved: {
87
+ ...eventFields,
88
+ call: Name,
89
+ decision: Schema.Literals(["confirmed", "declined", "expired"])
90
+ },
91
+ ApprovalPending: { ...eventFields, call: Name, approvalId: Name },
92
+ Cancelled: { ...eventFields, runIds: RunIds },
93
+ RunFinished: { ...eventFields, runIds: RunIds },
94
+ RunFailed: { ...eventFields, runIds: RunIds, cause: Schema.String, fix: Schema.String }
95
+ });
96
+
97
+ // dist/wire.js
98
+ var Name2 = Schema2.String.check(Schema2.isTrimmed(), Schema2.isNonEmpty(), Schema2.isMaxLength(200));
99
+ var RelayStreamFrame = Schema2.Union([
100
+ RelayEvent,
101
+ Schema2.TaggedStruct("Unauthorized", {}),
102
+ Schema2.TaggedStruct("StreamFailed", {})
103
+ ]);
104
+ var RelayMessageText = Schema2.String.check(Schema2.isNonEmpty(), Schema2.isMaxLength(2e4));
105
+ var RelayMessageRequest = Schema2.Struct({
106
+ ref: ObjectRef2,
107
+ text: RelayMessageText,
108
+ requestId: Name2,
109
+ backend: Schema2.optionalKey(RelayBackendId)
110
+ });
111
+ var RelayMessageAccepted = Schema2.Struct({ runId: Schema2.String });
112
+ var RelayCancelRequest = Schema2.Struct({ ref: ObjectRef2, runId: Name2 });
113
+ var RelayDecisionRequest = Schema2.Struct({ ref: ObjectRef2, callId: Name2, allow: Schema2.Boolean });
114
+ var RelayConflictState = Schema2.Union([DecisionState, Schema2.TaggedStruct("NotRunning", {})]);
115
+ var RelayUnavailableError = class extends Schema2.TaggedError()("RelayUnavailableError", { message: Schema2.String, fix: Schema2.String }, { httpApiStatus: 503 }) {
116
+ };
117
+ var RelayConflictError = class extends Schema2.TaggedError()("RelayConflictError", { state: RelayConflictState }, { httpApiStatus: 409 }) {
118
+ };
119
+ var RelayBadRequestError = class extends Schema2.TaggedError()("RelayBadRequestError", { message: Schema2.String }, { httpApiStatus: 400 }) {
120
+ };
121
+ export {
122
+ BackendStatus,
123
+ BackendUnavailableCause,
124
+ CapabilityAccess,
125
+ DecisionState,
126
+ ObjectRef2 as ObjectRef,
127
+ RelayBackendId,
128
+ RelayBadRequestError,
129
+ RelayCancelRequest,
130
+ RelayConflictError,
131
+ RelayConflictState,
132
+ RelayDecisionRequest,
133
+ RelayEvent,
134
+ RelayMessageAccepted,
135
+ RelayMessageRequest,
136
+ RelayMessageText,
137
+ RelayProduct,
138
+ RelayStreamFrame,
139
+ RelayUnavailableError,
140
+ SessionInfo,
141
+ SessionTool,
142
+ WriteReceipt,
143
+ objectRefKey
144
+ };
145
+ //# sourceMappingURL=wire.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/wire.ts", "../src/model.ts"],
4
+ "sourcesContent": ["/**\n * Relay's wire contract: what a product's `/\u2026/relay` routes accept and send, and what the browser decodes.\n * Browser-safe: it imports only `effect` and `@knpkv/capability`, never the harness, Pi or SQLite, so a page\n * can import `@knpkv/relay/wire` without pulling the server in.\n *\n * **Mental model**\n *\n * - **One stream per conversation.** `GET events?product&kind&id` sends `data: <RelayStreamFrame JSON>`\n * frames: a `Snapshot` first, then live {@link RelayEvent}s. `Unauthorized` (the browser's session ended)\n * and `StreamFailed` (the server could not read the session's events) end the stream.\n * - **Writes answer with what happened.** `messages` is 202 {@link RelayMessageAccepted}; `cancel` and\n * `decisions` are 204, or 409 {@link RelayConflictError} with the state they found. Every route can be 503\n * {@link RelayUnavailableError} with the fix when Relay could not start in that process.\n *\n * A product narrows `ref` to its own objects and may add a typed `context` to a message; both are its own\n * schema built on these.\n *\n * @module\n */\nimport { Schema } from \"effect\"\nimport { DecisionState, ObjectRef, RelayBackendId, RelayEvent } from \"./model.js\"\n\nexport {\n BackendStatus,\n BackendUnavailableCause,\n CapabilityAccess,\n DecisionState,\n ObjectRef,\n objectRefKey,\n RelayBackendId,\n RelayEvent,\n RelayProduct,\n SessionInfo,\n SessionTool,\n WriteReceipt\n} from \"./model.js\"\n\nconst Name = Schema.String.check(Schema.isTrimmed(), Schema.isNonEmpty(), Schema.isMaxLength(200))\n\n/** One `data:` frame of the events stream: an event, or why the stream ended. */\nexport const RelayStreamFrame = Schema.Union([\n RelayEvent,\n Schema.TaggedStruct(\"Unauthorized\", {}),\n Schema.TaggedStruct(\"StreamFailed\", {})\n])\nexport type RelayStreamFrame = typeof RelayStreamFrame.Type\n\n/** The text a message may carry. */\nexport const RelayMessageText = Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(20_000))\n\n/**\n * `POST messages`. `requestId` is the client's: a retry with the same one lands once, and the run that\n * answers carries it in `runIds`. `backend` switches the session from its next turn on.\n */\nexport const RelayMessageRequest = Schema.Struct({\n ref: ObjectRef,\n text: RelayMessageText,\n requestId: Name,\n backend: Schema.optionalKey(RelayBackendId)\n})\nexport interface RelayMessageRequest extends Schema.Schema.Type<typeof RelayMessageRequest> {}\n\n/** `messages` answers 202 with the run id, which is the request id. */\nexport const RelayMessageAccepted = Schema.Struct({ runId: Schema.String })\nexport interface RelayMessageAccepted extends Schema.Schema.Type<typeof RelayMessageAccepted> {}\n\n/** `POST cancel`: withdraws a queued message, or stops the run in flight. */\nexport const RelayCancelRequest = Schema.Struct({ ref: ObjectRef, runId: Name })\nexport interface RelayCancelRequest extends Schema.Schema.Type<typeof RelayCancelRequest> {}\n\n/** `POST decisions`: the person's answer to one confirmation card. */\nexport const RelayDecisionRequest = Schema.Struct({ ref: ObjectRef, callId: Name, allow: Schema.Boolean })\nexport interface RelayDecisionRequest extends Schema.Schema.Type<typeof RelayDecisionRequest> {}\n\n/** What a 409 found instead: the run already over, or the confirmation decided, expired or never asked. */\nexport const RelayConflictState = Schema.Union([DecisionState, Schema.TaggedStruct(\"NotRunning\", {})])\nexport type RelayConflictState = typeof RelayConflictState.Type\n\n/** Relay could not start in this process: another one owns its store, or the store is unreadable. */\nexport class RelayUnavailableError extends Schema.TaggedError<RelayUnavailableError>()(\n \"RelayUnavailableError\",\n { message: Schema.String, fix: Schema.String },\n { httpApiStatus: 503 }\n) {}\n\n/** A run or confirmation is no longer in the state the request assumed; `state` says which it is in. */\nexport class RelayConflictError extends Schema.TaggedError<RelayConflictError>()(\n \"RelayConflictError\",\n { state: RelayConflictState },\n { httpApiStatus: 409 }\n) {}\n\n/** The request named a backend this server does not offer, or was otherwise malformed. */\nexport class RelayBadRequestError extends Schema.TaggedError<RelayBadRequestError>()(\n \"RelayBadRequestError\",\n { message: Schema.String },\n { httpApiStatus: 400 }\n) {}\n", "/**\n * The Relay contracts every product and the dock share.\n *\n * **Mental model**\n *\n * - **An {@link ObjectRef} is what a conversation is about.** A pull request, a jcf week, a herdr\n * goal. Relay keeps one durable session per ref, so the same question about the same object finds\n * its history again.\n * - **A capability (`@knpkv/capability`) is the only way Relay touches a product.** Its contract declares\n * input, output and failure as Schema, and its access: `read` runs, `write` waits for the person to\n * confirm the exact action in the dock, `host` waits for a herdr Approval. The harness enforces it; the\n * product never sees an unconfirmed write.\n * - **A {@link RelayEvent} is the only thing the dock renders.** Every event carries the session and a\n * `seq` that counts up within one subscription. A dock that reconnects starts a new subscription: a\n * `Snapshot` first (with any run in flight and any pending confirmation), then live events. `seq` is not\n * comparable across subscriptions; render the Snapshot rather than deduplicating by `seq`.\n *\n * @module\n */\nimport * as Capability from \"@knpkv/capability\"\nimport { Schema } from \"effect\"\n\nconst Name = Schema.String.check(Schema.isTrimmed(), Schema.isNonEmpty(), Schema.isMaxLength(200))\n\n/** The products Relay can be about. */\nexport const RelayProduct = Schema.Literals([\"codecommit\", \"jcf\", \"agent-usage\", \"control-center\", \"herdr\"])\nexport type RelayProduct = typeof RelayProduct.Type\n\n/** A product object a Relay session is about. Relay keeps sessions only for the products it knows. */\nexport const ObjectRef = Schema.Struct({\n product: RelayProduct,\n kind: Name,\n id: Name\n})\nexport interface ObjectRef extends Schema.Schema.Type<typeof ObjectRef> {}\n\n/** The key a session is stored under. Unique per product, kind and id: JSON-encoded, so no field can contain the separator. */\nexport const objectRefKey = (ref: ObjectRef): string => JSON.stringify([ref.product, ref.kind, ref.id])\n\n/** Who must agree before a capability runs, as the dock lists it. */\nexport const CapabilityAccess = Schema.Literals([\"read\", \"write\", \"host\"])\nexport type CapabilityAccess = typeof CapabilityAccess.Type\n\n/** Why a backend can't answer yet, and the one action that fixes it. */\nexport const BackendUnavailableCause = Schema.Literals([\"NotInstalled\", \"SignedOut\", \"Misconfigured\", \"NoCapability\"])\nexport type BackendUnavailableCause = typeof BackendUnavailableCause.Type\n\n/** The backends Relay supports: each runs on the user's own CLI login, never on a token Relay holds. */\nexport const RelayBackendId = Schema.Literals([\"claude-code\", \"codex-cli\"])\nexport type RelayBackendId = typeof RelayBackendId.Type\n\nconst backendFields = { backend: RelayBackendId, label: Schema.String }\n\n/**\n * What setup shows for one backend. `Unverified` (installed, version known, never answered yet) until a turn\n * answers (`Ready`) or is refused for sign-in (`Unavailable` with `SignedOut`). Not persisted: every start is\n * `Unverified` or `Unavailable` again. `fix` is one line the person can act on.\n */\nexport const BackendStatus = Schema.TaggedUnion({\n Unverified: { ...backendFields, version: Schema.String },\n Ready: { ...backendFields, version: Schema.String },\n Unavailable: {\n ...backendFields,\n version: Schema.optionalKey(Schema.String),\n cause: BackendUnavailableCause,\n fix: Schema.String\n }\n})\nexport type BackendStatus = typeof BackendStatus.Type\n\n/** Why a confirmation can't be answered: answered already, withdrawn with its run, or never asked. */\nexport const DecisionState = Schema.TaggedUnion({\n Decided: { allow: Schema.Boolean },\n Expired: {},\n Unknown: {}\n})\nexport type DecisionState = typeof DecisionState.Type\n\n/** One tool as the dock lists it for a session. */\nexport const SessionTool = Schema.Struct({\n name: Name,\n access: CapabilityAccess,\n available: Schema.Boolean,\n unavailableReason: Schema.optional(Schema.String)\n})\nexport interface SessionTool extends Schema.Schema.Type<typeof SessionTool> {}\n\n/**\n * What the dock shows for a session: its tools, the backend its next turn runs on, and whether a run can\n * be stopped (the dock offers Stop only when `cancel` is true).\n */\nexport const SessionInfo = Schema.Struct({\n tools: Schema.Array(SessionTool),\n backend: RelayBackendId,\n cancel: Schema.Boolean\n})\nexport interface SessionInfo extends Schema.Schema.Type<typeof SessionInfo> {}\n\n/**\n * What a confirmed write did, as the product projects it: a display-safe line, the provider's id for what\n * was made, and where to see it.\n */\nexport const WriteReceipt = Schema.Struct({\n summary: Schema.String,\n providerId: Schema.String,\n link: Schema.optionalKey(Schema.String)\n})\nexport interface WriteReceipt extends Schema.Schema.Type<typeof WriteReceipt> {}\n\nconst Seq = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))\n\nconst eventFields = { session: Name, seq: Seq }\n\n/** The `requestId`s of the messages a run answers: one run can take several queued messages. */\nconst RunIds = Schema.Array(Name)\n\n/** Everything the dock renders. `seq` counts up within one subscription; a reconnect starts from a `Snapshot`. */\nexport const RelayEvent = Schema.TaggedUnion({\n Snapshot: {\n ...eventFields,\n messages: Schema.Array(\n Schema.Struct({ id: Name, role: Schema.Literals([\"user\", \"relay\"]), text: Schema.String })\n ),\n /** The run in flight, empty when idle. */\n runIds: RunIds,\n /** Messages accepted but not yet in the transcript, oldest first: they wait for the run in flight. */\n queued: RunIds\n },\n /**\n * A message the server accepted that waits for the run in flight. It joins the transcript with its own\n * `MessagePlaced`, or leaves with `MessageWithdrawn`.\n */\n MessageQueued: { ...eventFields, requestId: Name },\n /** A message the server placed in the transcript; `id` is its transcript id, as a later Snapshot names it. */\n MessagePlaced: { ...eventFields, id: Name, requestId: Name, text: Schema.String },\n /** A queued message the person withdrew before any run took it. */\n MessageWithdrawn: { ...eventFields, requestId: Name },\n RunStarted: { ...eventFields, runIds: RunIds },\n TextDelta: { ...eventFields, text: Schema.String },\n /** `summary` is a server-built, display-safe line; `input` is the call's typed arguments. */\n ToolStarted: { ...eventFields, call: Name, capability: Name, summary: Schema.String, input: Schema.Json },\n /** `receipt` is set when a write completed and its capability projects one. */\n ToolFinished: {\n ...eventFields,\n call: Name,\n ok: Schema.Boolean,\n summary: Schema.String,\n cites: Schema.Array(Capability.ObjectRef),\n receipt: Schema.optionalKey(WriteReceipt)\n },\n ConfirmationRequired: { ...eventFields, call: Name, action: Capability.PendingAction, reversible: Schema.Boolean },\n /** The server's outcome for a confirmation: the card turns to past tense only on this. */\n ConfirmationResolved: {\n ...eventFields,\n call: Name,\n decision: Schema.Literals([\"confirmed\", \"declined\", \"expired\"])\n },\n ApprovalPending: { ...eventFields, call: Name, approvalId: Name },\n Cancelled: { ...eventFields, runIds: RunIds },\n RunFinished: { ...eventFields, runIds: RunIds },\n RunFailed: { ...eventFields, runIds: RunIds, cause: Schema.String, fix: Schema.String }\n})\nexport type RelayEvent = typeof RelayEvent.Type\n"],
5
+ "mappings": ";AAmBA,SAAS,UAAAA,eAAc;;;ACAvB,YAAY,gBAAgB;AAC5B,SAAS,cAAc;AAEvB,IAAM,OAAO,OAAO,OAAO,MAAM,OAAO,UAAS,GAAI,OAAO,WAAU,GAAI,OAAO,YAAY,GAAG,CAAC;AAG1F,IAAM,eAAe,OAAO,SAAS,CAAC,cAAc,OAAO,eAAe,kBAAkB,OAAO,CAAC;AAIpG,IAAMC,aAAY,OAAO,OAAO;EACrC,SAAS;EACT,MAAM;EACN,IAAI;CACL;AAIM,IAAM,eAAe,CAAC,QAA2B,KAAK,UAAU,CAAC,IAAI,SAAS,IAAI,MAAM,IAAI,EAAE,CAAC;AAG/F,IAAM,mBAAmB,OAAO,SAAS,CAAC,QAAQ,SAAS,MAAM,CAAC;AAIlE,IAAM,0BAA0B,OAAO,SAAS,CAAC,gBAAgB,aAAa,iBAAiB,cAAc,CAAC;AAI9G,IAAM,iBAAiB,OAAO,SAAS,CAAC,eAAe,WAAW,CAAC;AAG1E,IAAM,gBAAgB,EAAE,SAAS,gBAAgB,OAAO,OAAO,OAAM;AAO9D,IAAM,gBAAgB,OAAO,YAAY;EAC9C,YAAY,EAAE,GAAG,eAAe,SAAS,OAAO,OAAM;EACtD,OAAO,EAAE,GAAG,eAAe,SAAS,OAAO,OAAM;EACjD,aAAa;IACX,GAAG;IACH,SAAS,OAAO,YAAY,OAAO,MAAM;IACzC,OAAO;IACP,KAAK,OAAO;;CAEf;AAIM,IAAM,gBAAgB,OAAO,YAAY;EAC9C,SAAS,EAAE,OAAO,OAAO,QAAO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AAM,GAC5C,EAAE,eAAe,IAAG,CAAE,EACvB;;AAGK,IAAO,qBAAP,cAAkCA,QAAO,YAAW,EACxD,sBACA,EAAE,OAAO,mBAAkB,GAC3B,EAAE,eAAe,IAAG,CAAE,EACvB;;AAGK,IAAO,uBAAP,cAAoCA,QAAO,YAAW,EAC1D,wBACA,EAAE,SAASA,QAAO,OAAM,GACxB,EAAE,eAAe,IAAG,CAAE,EACvB;;",
6
+ "names": ["Schema", "ObjectRef", "Name", "Schema", "ObjectRef"]
7
+ }
package/package.json CHANGED
@@ -1,6 +1,76 @@
1
1
  {
2
2
  "name": "@knpkv/relay",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "Relay agent harness: durable sessions per product object, typed capabilities, a central permission gate, and model turns through the user's own Claude Code or Codex CLI login",
5
+ "license": "MIT",
6
+ "author": "knpkv",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/knpkv/npm.git",
10
+ "directory": "packages/relay"
11
+ },
12
+ "type": "module",
13
+ "sideEffects": false,
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ },
21
+ "./wire": {
22
+ "types": "./dist/wire.d.ts",
23
+ "import": "./dist/wire.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md",
29
+ "LICENSE-THIRD-PARTY.md"
30
+ ],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "engines": {
35
+ "node": ">=26"
36
+ },
37
+ "peerDependencies": {
38
+ "effect": "4.0.0"
39
+ },
40
+ "dependencies": {
41
+ "@libsql/client": "^0.18.0",
42
+ "typebox": "1.3.27",
43
+ "@knpkv/ai-claude": "^0.4.3",
44
+ "@knpkv/ai-runtime": "^0.5.2",
45
+ "@knpkv/ai-codex": "^0.5.3",
46
+ "@knpkv/capability": "^0.1.0"
47
+ },
48
+ "devDependencies": {
49
+ "@earendil-works/chord": "1.0.4",
50
+ "@earendil-works/pi-ai": "1.0.4",
51
+ "@earendil-works/pi-durable": "1.0.4",
52
+ "@effect/platform-node": "4.0.0",
53
+ "@effect/vitest": "4.0.0",
54
+ "effect": "4.0.0",
55
+ "esbuild": "0.28.2",
56
+ "rimraf": "^6.1.3",
57
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
58
+ "vitest": "^5.0.3"
59
+ },
60
+ "keywords": [
61
+ "effect",
62
+ "agent",
63
+ "relay",
64
+ "durable",
65
+ "claude",
66
+ "codex"
67
+ ],
68
+ "scripts": {
69
+ "build": "rimraf dist && tsc && node scripts/bundle.mjs",
70
+ "check": "tsc --noEmit && tsc --noEmit -p test/tsconfig.json",
71
+ "clean": "rimraf dist *.tsbuildinfo",
72
+ "lint": "eslint \"{src,test}/**/*.ts\"",
73
+ "test": "vitest run",
74
+ "test:pack": "pnpm --filter \"@knpkv/relay...\" --sort run build && node scripts/test-packed-package.mjs"
75
+ }
6
76
  }