@byok-sdk/server 0.7.0 → 0.8.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/hub.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { WebSocket } from 'ws';
2
- import { type Envelope, type RuntimeId, type RuntimeInfo, type TaskState, type ToolsetId } from '@byok-sdk/protocol';
2
+ import { type Envelope, type AgentHomeProjectionCompletionRequest, type AgentHomeProjectionReadback, type RuntimeId, type RuntimeInfo, type TaskState, type ToolsetId } from '@byok-sdk/protocol';
3
3
  import type { DeviceRegistry } from './auth';
4
4
  import { RateLimiter } from './rate-limiter';
5
5
  import type { TaskStore } from './task-store';
6
- import type { ByokServerEvent, AgentContentReadRequest, AgentEgressReceipt, DispatchInput, HubStats, MachineInfo, TaskHandle, TaskSnapshot } from './types';
6
+ import type { ByokServerEvent, AgentContentReadRequest, AgentHomeProjectionRequest, AgentEgressReceipt, DispatchInput, FreshAgentEgressDispatchInput, HubStats, MachineInfo, TaskHandle, TaskSnapshot } from './types';
7
7
  /**
8
8
  * The connection hub: tracks each device's live transport (WS or long-poll —
9
9
  * never both at once, see {@link takeOverAsLongPoll}), routes `dispatch()`'d
@@ -189,6 +189,11 @@ export declare class SteerRejectedError extends Error {
189
189
  /** `TaskSnapshot.claimedRuntime` — `undefined` when nothing was ever recorded (which is itself a reason `steer_unsupported_runtime` can fire). */
190
190
  runtime: RuntimeId | undefined);
191
191
  }
192
+ export type AgentHomeProjectionCompletionErrorCode = 'not_found' | 'conflict' | 'invalid';
193
+ export declare class AgentHomeProjectionCompletionError extends Error {
194
+ readonly code: AgentHomeProjectionCompletionErrorCode;
195
+ constructor(code: AgentHomeProjectionCompletionErrorCode, message: string);
196
+ }
192
197
  export declare class ConnectionHub {
193
198
  private readonly taskStore;
194
199
  private readonly devices;
@@ -217,6 +222,10 @@ export declare class ConnectionHub {
217
222
  private readonly agentContentReadRequests;
218
223
  /** Content-free explicit-read audit facts keyed by exact authenticated device/request identity. */
219
224
  private readonly agentContentReceipts;
225
+ /** Immutable requested projection facts, keyed by authenticated device/request. */
226
+ private readonly agentHomeProjectionRequests;
227
+ /** First terminal completion for each exact projection request. */
228
+ private readonly agentHomeProjectionCompletions;
220
229
  /**
221
230
  * Per-task last-inbound-activity timestamp (epoch ms) — the task-lease
222
231
  * reaper's condition (c), see the "task-lease reaper" section below. Reset
@@ -749,8 +758,14 @@ export declare class ConnectionHub {
749
758
  /** Reap one lease-expired task through the exact same TaskStore/canTransition path — and terminal-event emission — as any other `task.fail` (see {@link applyOrFail}). */
750
759
  private reapTask;
751
760
  dispatch(input: DispatchInput): Promise<TaskHandle>;
761
+ dispatchFreshAgentEgress(input: FreshAgentEgressDispatchInput): Promise<TaskHandle>;
762
+ private dispatchInternal;
752
763
  /** Capability-gated control-plane read request; no request enters the outbox on omission. */
753
764
  requestAgentContentRead(input: AgentContentReadRequest): Promise<void>;
765
+ /** Task-free exact-device projection; no task record, runtime or session is created. */
766
+ enqueueAgentHomeProjection(input: AgentHomeProjectionRequest): Promise<AgentHomeProjectionReadback>;
767
+ readAgentHomeProjection(deviceId: string, requestId: string): AgentHomeProjectionReadback | undefined;
768
+ completeAgentHomeProjection(deviceId: string, input: AgentHomeProjectionCompletionRequest): AgentHomeProjectionReadback;
754
769
  private buildTaskHandle;
755
770
  /** Idempotent: cancelling an already-terminal task is a no-op, not an error. */
756
771
  private cancelTask;
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import type { Server as HttpServer } from 'node:http';
2
2
  import type { Hono } from 'hono';
3
3
  import { type TenantId } from './auth';
4
4
  import { type PairingCodeClaims, type PairingCodeInfo } from './pairing';
5
- import type { ByokServerEvent, AgentContentReadRequest, AgentEgressReceipt, CreateByokServerOptions, DispatchInput, HubStats, MachineInfo, TaskHandle, TaskSnapshot } from './types';
6
- export type { ByokServerEvent, AgentContentReadRequest, AgentEgressReceipt, CreateByokServerOptions, DispatchInput, HubStats, MachineInfo, ServerTaskEvent, TaskHandle, TaskResult, TaskSnapshot, } from './types';
5
+ import type { ByokServerEvent, AgentContentReadRequest, AgentHomeProjectionRequest, AgentHomeProjectionStatusReadback, AgentEgressReceipt, CreateByokServerOptions, DispatchInput, FreshAgentEgressDispatchInput, HubStats, MachineInfo, TaskHandle, TaskSnapshot } from './types';
6
+ export type { ByokServerEvent, AgentContentReadRequest, AgentHomeProjectionRequest, AgentHomeProjectionStatusReadback, AgentEgressReceipt, CreateByokServerOptions, DispatchInput, FreshAgentEgressDispatchInput, HubStats, MachineInfo, ServerTaskEvent, TaskHandle, TaskResult, TaskSnapshot, } from './types';
7
7
  export type { CreateTaskInput, TaskRecord, TaskStore } from './task-store';
8
8
  export { IllegalTaskTransitionError, InMemoryTaskStore } from './task-store';
9
9
  /**
@@ -24,6 +24,8 @@ export { StaleApprovalError } from './hub';
24
24
  */
25
25
  export { SteerRejectedError } from './hub';
26
26
  export type { SteerRejectionCode } from './hub';
27
+ export { AgentHomeProjectionCompletionError } from './hub';
28
+ export type { AgentHomeProjectionCompletionErrorCode } from './hub';
27
29
  export { PairingCodeInvalidError } from './pairing';
28
30
  export type { PairingCodeClaims, PairingCodeInfo } from './pairing';
29
31
  export type { AccessTokenClaims, AuthenticatedDevice, DeviceRecord, TenantId, TokenSigner, } from './auth';
@@ -60,8 +62,14 @@ export interface ByokServer {
60
62
  createPairingCode(claims: PairingCodeClaims): PairingCodeInfo;
61
63
  };
62
64
  dispatch(input: DispatchInput): Promise<TaskHandle>;
65
+ /** Dispatch a fresh Agent execution whose runtime will mint its session after start. */
66
+ dispatchFreshAgentEgress(input: FreshAgentEgressDispatchInput): Promise<TaskHandle>;
63
67
  /** Enqueue one capability-gated, exact-identity content-read request. */
64
68
  requestAgentContentRead(input: AgentContentReadRequest): Promise<void>;
69
+ /** Enqueue one task-free, exact-device Agent-home projection. */
70
+ enqueueAgentHomeProjection(input: AgentHomeProjectionRequest): Promise<AgentHomeProjectionStatusReadback>;
71
+ /** Reference-only in-process status readback; production durability belongs to @byok-sdk/cloud stores. */
72
+ readAgentHomeProjection(deviceId: string, requestId: string): AgentHomeProjectionStatusReadback | undefined;
65
73
  tasks: {
66
74
  get(taskId: string): TaskSnapshot | undefined;
67
75
  list(): TaskSnapshot[];