@byok-sdk/server 0.23.0 → 0.25.0-rc.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.
- package/README.md +42 -23
- package/dist/index.d.ts +2 -1
- package/dist/index.js +49 -17
- package/dist/index.js.map +1 -1
- package/dist/sqlite-support.d.ts +20 -0
- package/dist/stores/sqlite/index.d.ts +3 -2
- package/dist/types.d.ts +14 -8
- package/package.json +5 -5
package/dist/sqlite-support.d.ts
CHANGED
|
@@ -28,6 +28,26 @@ export declare function closeSqliteDatabaseAfterInitializationFailure(db: Databa
|
|
|
28
28
|
export declare class SqliteUnavailableError extends Error {
|
|
29
29
|
constructor(cause: unknown);
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Why a SQLite file was refused at open, so a host can tell the user what to do
|
|
33
|
+
* without parsing the message:
|
|
34
|
+
* - `SQLITE_SCHEMA_UNSUPPORTED`: the stored version is not this build's and no
|
|
35
|
+
* matching `migration` selector was given (an older file needs one; a newer
|
|
36
|
+
* file needs a newer build).
|
|
37
|
+
* - `SQLITE_MIGRATION_REFUSED`: the selected migration would lose durable
|
|
38
|
+
* authority; preserve the file for reconciliation.
|
|
39
|
+
* - `SQLITE_SCHEMA_INVALID`: the file contradicts its declared BYOK schema or
|
|
40
|
+
* is not a BYOK database.
|
|
41
|
+
*/
|
|
42
|
+
export type SqliteSchemaErrorCode = 'SQLITE_SCHEMA_UNSUPPORTED' | 'SQLITE_MIGRATION_REFUSED' | 'SQLITE_SCHEMA_INVALID';
|
|
43
|
+
export declare class SqliteSchemaError extends Error {
|
|
44
|
+
readonly code: SqliteSchemaErrorCode;
|
|
45
|
+
/** The stored `schema_version`; `undefined` when the file has none. */
|
|
46
|
+
readonly foundVersion: string | undefined;
|
|
47
|
+
/** The schema version this build writes. */
|
|
48
|
+
readonly requiredVersion: string;
|
|
49
|
+
constructor(code: SqliteSchemaErrorCode, message: string, foundVersion: string | undefined, requiredVersion: string, options?: ErrorOptions);
|
|
50
|
+
}
|
|
31
51
|
/**
|
|
32
52
|
* Whether `nodeVersion` (a `major.minor.patch` string shaped like
|
|
33
53
|
* `process.versions.node`) is new enough to have `node:sqlite` at all.
|
|
@@ -5,7 +5,7 @@ import type { DatabaseSync } from 'node:sqlite';
|
|
|
5
5
|
export interface SqliteEmbeddedStoreOptions {
|
|
6
6
|
readonly path: string;
|
|
7
7
|
readonly urlTtlMs?: number;
|
|
8
|
-
readonly migration?: 'v1-to-
|
|
8
|
+
readonly migration?: 'v1-to-v4' | 'v2-to-v4' | 'v3-to-v4';
|
|
9
9
|
}
|
|
10
10
|
export interface SqliteEmbeddedStores {
|
|
11
11
|
readonly core: CoreStores;
|
|
@@ -17,7 +17,7 @@ export interface SqliteEmbeddedStores {
|
|
|
17
17
|
declare class SqliteCoordinator {
|
|
18
18
|
#private;
|
|
19
19
|
readonly db: DatabaseSync;
|
|
20
|
-
constructor(path: string, migration?: 'v1-to-
|
|
20
|
+
constructor(path: string, migration?: 'v1-to-v4' | 'v2-to-v4' | 'v3-to-v4');
|
|
21
21
|
run<T>(operation: (db: DatabaseSync) => T | Promise<T>): Promise<T>;
|
|
22
22
|
transaction<T>(operation: (db: DatabaseSync) => T | Promise<T>): Promise<T>;
|
|
23
23
|
close(): Promise<void>;
|
|
@@ -70,6 +70,7 @@ export declare class SqliteTaskAttemptStore implements TaskAttemptStore {
|
|
|
70
70
|
taskId: string;
|
|
71
71
|
deviceId: string;
|
|
72
72
|
runtime?: RuntimeId;
|
|
73
|
+
harnessId?: string;
|
|
73
74
|
capabilities?: RuntimeCapabilities;
|
|
74
75
|
}): Promise<TaskAttempt | undefined>;
|
|
75
76
|
recordStatus(tenant: TenantId, input: {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HarnessInfo } from '@byok-sdk/protocol';
|
|
2
|
-
import type { AgentContentReadPayload, AgentHomeProjectionPayload, AgentHomeProjectionReadback, AgentEventOrUnknown, AgentEgressPolicy, AgentEgressReliablePayload, AgentMessageEgressRequirement, AgentMessageServerContext, AgentMessagePublishPayload, AgentRef, BlobRef, DispatchSelection,
|
|
2
|
+
import type { AgentContentReadPayload, AgentHomeProjectionPayload, AgentHomeProjectionReadback, AgentEventOrUnknown, AgentEgressPolicy, AgentEgressReliablePayload, AgentMessageEgressRequirement, AgentMessageServerContext, AgentMessagePublishPayload, AgentRef, BlobRef, DispatchSelection, RuntimeCapabilities, RuntimeId, RuntimeInfo, TaskApprovalResolvedPayload, TaskArtifactPayload, TaskState, ToolsetId, TerminalProjectionSelection } from '@byok-sdk/protocol';
|
|
3
3
|
import type { TenantId, TokenSigner } from '@byok-sdk/cloud';
|
|
4
4
|
import type { RateLimiterOptions } from './rate-limiter';
|
|
5
5
|
/** Mutually-exclusive storage authority for the embedded reference server. */
|
|
@@ -11,8 +11,8 @@ export type ByokServerStorage = {
|
|
|
11
11
|
readonly path: string;
|
|
12
12
|
/** Lifetime of signed blob upload/download URLs. Default 15 minutes. */
|
|
13
13
|
readonly urlTtlMs?: number;
|
|
14
|
-
/** One-shot adoption
|
|
15
|
-
readonly migration?: 'v1-to-
|
|
14
|
+
/** One-shot schema adoption: v1/v2 require no task history; v3 requires no ambiguous claimed identity. Stop all writers and back up first; old builds cannot reopen v4. */
|
|
15
|
+
readonly migration?: 'v1-to-v4' | 'v2-to-v4' | 'v3-to-v4';
|
|
16
16
|
};
|
|
17
17
|
/** Options for {@link createByokServer}. */
|
|
18
18
|
export interface CreateByokServerOptions {
|
|
@@ -48,8 +48,9 @@ export interface CreateByokServerOptions {
|
|
|
48
48
|
/**
|
|
49
49
|
* How long after a task reaches a terminal its relay buffer and terminal
|
|
50
50
|
* promise are RETAINED before being reclaimed, ms. A late `events()` reader
|
|
51
|
-
* within this window still replays the
|
|
52
|
-
*
|
|
51
|
+
* within this window still replays the retained feed; past it, new event
|
|
52
|
+
* reads complete empty. Use the durable read model (`tasks.get`, `result()`)
|
|
53
|
+
* for terminal facts after expiry. Default 5 minutes.
|
|
53
54
|
*
|
|
54
55
|
* Retention never decides when a feed ENDS: {@link TaskHandle.events}
|
|
55
56
|
* completes at the terminal event itself, whenever that happens, so a
|
|
@@ -123,7 +124,6 @@ export interface DispatchInput {
|
|
|
123
124
|
dispatchSelection?: DispatchSelection;
|
|
124
125
|
runtime?: RuntimeId;
|
|
125
126
|
harnessId?: string;
|
|
126
|
-
policy?: PermissionPolicy;
|
|
127
127
|
deviceId?: string;
|
|
128
128
|
sessionRef?: string;
|
|
129
129
|
/** Logical device-local MCP toolsets required for this task; never executable definitions. */
|
|
@@ -238,6 +238,12 @@ export type ServerTaskEvent = {
|
|
|
238
238
|
/** Handle returned by {@link ByokServer.dispatch} for one in-flight task. */
|
|
239
239
|
export interface TaskHandle {
|
|
240
240
|
readonly taskId: string;
|
|
241
|
+
/**
|
|
242
|
+
* Replay retained notifications and follow live updates until terminal.
|
|
243
|
+
* New reads after terminal retention expires or the server stops complete
|
|
244
|
+
* empty; they never reopen a feed. Durable terminal facts remain available
|
|
245
|
+
* through `result()` and `ByokServer.tasks.get`.
|
|
246
|
+
*/
|
|
241
247
|
events(): AsyncIterable<ServerTaskEvent>;
|
|
242
248
|
cancel(reason?: string): Promise<void>;
|
|
243
249
|
/**
|
|
@@ -282,8 +288,8 @@ export interface MachineInfo {
|
|
|
282
288
|
* `@byok-sdk/cloud`) on every call — never a mirrored record this package
|
|
283
289
|
* maintains alongside it.
|
|
284
290
|
*
|
|
285
|
-
* Deliberately smaller than it used to be: `instruction`, `runtime
|
|
286
|
-
*
|
|
291
|
+
* Deliberately smaller than it used to be: `instruction`, `runtime` and
|
|
292
|
+
* `requiredToolsets` were DISPATCH INPUT the host already holds and the
|
|
287
293
|
* kernel does not persist (ADR-028 — an attempt records ownership and
|
|
288
294
|
* disposition, not the request that produced it). A host that wants them back
|
|
289
295
|
* keeps its own map keyed by `taskId`; this snapshot never re-derives them.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byok-sdk/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0-rc.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",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/Ancienttwo/byok-sdk#readme",
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": ">=
|
|
17
|
+
"node": ">=24.15.0"
|
|
18
18
|
},
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"main": "./dist/index.js",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"clean": "rm -rf dist"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@byok-sdk/cloud": "0.
|
|
48
|
-
"@byok-sdk/core": "0.
|
|
49
|
-
"@byok-sdk/protocol": "0.
|
|
47
|
+
"@byok-sdk/cloud": "0.25.0-rc.1",
|
|
48
|
+
"@byok-sdk/core": "0.25.0-rc.1",
|
|
49
|
+
"@byok-sdk/protocol": "0.25.0-rc.1",
|
|
50
50
|
"@hono/node-server": "^2.0.10",
|
|
51
51
|
"hono": "^4.12.30"
|
|
52
52
|
},
|