@byok-sdk/server 0.5.0 → 0.6.1

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.
@@ -1,4 +1,4 @@
1
- import { type PermissionPolicy, type RuntimeId, type TaskState, type ToolsetId } from '@byok-sdk/protocol';
1
+ import { type AgentRef, type PermissionPolicy, type RuntimeId, type TaskState, type ToolsetId } from '@byok-sdk/protocol';
2
2
  import type { TaskSnapshot } from './types';
3
3
  /** Thrown by a {@link TaskStore}'s `transition` when `from -> to` is not in TASK_TRANSITIONS. Every implementation (in-memory, SQLite, or otherwise) must throw this rather than silently applying an invalid move. */
4
4
  export declare class IllegalTaskTransitionError extends Error {
@@ -15,6 +15,7 @@ export interface CreateTaskInput {
15
15
  requiredToolsets?: ToolsetId[];
16
16
  deviceId?: string;
17
17
  sessionRef?: string;
18
+ agentRef?: AgentRef;
18
19
  }
19
20
  /** A task's full persisted state, as tracked by any {@link TaskStore} implementation. Same shape as {@link TaskSnapshot} — kept as its own (structurally identical) type so this storage-layer contract can evolve independently of the SDK-facing `TaskSnapshot` if a future need arises. */
20
21
  export interface TaskRecord extends TaskSnapshot {
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AgentEventOrUnknown, BlobRef, DispatchSelection, PermissionPolicy, RuntimeCapabilities, RuntimeId, RuntimeInfo, TaskApprovalResolvedPayload, TaskArtifactPayload, TaskState, ToolsetId } from '@byok-sdk/protocol';
1
+ import type { AgentContentReadPayload, AgentEventOrUnknown, AgentEgressPolicy, AgentEgressReliablePayload, AgentRef, BlobRef, DispatchSelection, PermissionPolicy, RuntimeCapabilities, RuntimeId, RuntimeInfo, TaskApprovalResolvedPayload, TaskArtifactPayload, TaskState, ToolsetId } from '@byok-sdk/protocol';
2
2
  import type { BlobStore } from './blob-store';
3
3
  import type { RateLimiterOptions } from './rate-limiter';
4
4
  import type { TaskStore } from './task-store';
@@ -95,6 +95,25 @@ export interface DispatchInput {
95
95
  sessionRef?: string;
96
96
  /** Logical device-local MCP toolsets required for this task; never executable definitions. */
97
97
  requiredToolsets?: ToolsetId[];
98
+ /** Explicit durable Agent identity; dispatches through task.offer_for_agent. */
99
+ agentRef?: AgentRef;
100
+ /**
101
+ * An explicit, consumed Agent egress policy. This may only travel with an
102
+ * Agent-bound offer on the distinct egress-aware wire message.
103
+ */
104
+ egressPolicy?: AgentEgressPolicy;
105
+ }
106
+ /** Host control-plane input for one exact content-read request. */
107
+ export interface AgentContentReadRequest {
108
+ readonly deviceId: string;
109
+ readonly payload: AgentContentReadPayload;
110
+ }
111
+ /** First-write-wins reference-server readback for a reliable Agent egress item. */
112
+ export interface AgentEgressReceipt {
113
+ readonly deviceId: string;
114
+ readonly payload: AgentEgressReliablePayload;
115
+ readonly receiptId: string;
116
+ readonly recordedAt: string;
98
117
  }
99
118
  /** Outcome of a task that reached a terminal state. */
100
119
  export interface TaskResult {
@@ -188,6 +207,8 @@ export interface MachineInfo {
188
207
  deviceName: string;
189
208
  connected: boolean;
190
209
  lastSeen?: string;
210
+ /** Process-immutable Local Agent release from the current/last WS hello; omission means legacy/unknown. */
211
+ clientVersion?: string;
191
212
  /** Runtimes detected on this device, as reported in its last `conn.hello` (M1: typed, replaces the old untyped `agents`). */
192
213
  runtimes?: RuntimeInfo[];
193
214
  /** Logical toolset IDs reported by the current daemon; omission means legacy/unknown. */
@@ -213,6 +234,8 @@ export interface TaskSnapshot {
213
234
  requiredToolsets?: ToolsetId[];
214
235
  deviceId?: string;
215
236
  sessionRef?: string;
237
+ /** Exact Agent identity for an Agent-bound task; absent for legacy tasks. */
238
+ agentRef?: AgentRef;
216
239
  createdAt: string;
217
240
  updatedAt: string;
218
241
  result?: TaskResult;
@@ -254,8 +277,8 @@ export interface TaskSnapshot {
254
277
  *
255
278
  * Sourced from the claim and from nothing else. The connection-level
256
279
  * `conn.hello.runtimes[].capabilities` is discovery data — it describes a
257
- * device rather than a task, and a long-poll-only daemon never sends
258
- * `conn.hello` at all — so it is never read here or by the gate; see
280
+ * device rather than the adapter that claimed this task so it is never
281
+ * read here or by the gate; see
259
282
  * `SteerRejectedError` (`hub.ts`) for the full argument.
260
283
  *
261
284
  * A SNAPSHOT, deliberately — not a live read of anything: the same device
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byok-sdk/server",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "BYOK SDK server: in-memory M0 reference implementation of the SaaS-side coordinator",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -44,8 +44,8 @@
44
44
  "clean": "rm -rf dist"
45
45
  },
46
46
  "dependencies": {
47
- "@byok-sdk/core": "0.5.0",
48
- "@byok-sdk/protocol": "0.5.0",
47
+ "@byok-sdk/core": "0.6.1",
48
+ "@byok-sdk/protocol": "0.6.1",
49
49
  "@hono/node-server": "^2.0.10",
50
50
  "hono": "^4.12.30",
51
51
  "jose": "^6.2.3",