@byok-sdk/client 0.3.0 → 0.4.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/README.md +13 -0
- package/dist/adapters/claude/claude-adapter.d.ts +4 -20
- package/dist/adapters/claude/events.d.ts +3 -0
- package/dist/adapters/claude/process-client.d.ts +9 -1
- package/dist/adapters/codex/codex-adapter.d.ts +4 -16
- package/dist/adapters/codex/process-runner.d.ts +4 -1
- package/dist/adapters/index.d.ts +3 -1
- package/dist/adapters/index.js +923 -258
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/pi/pi-adapter.d.ts +3 -16
- package/dist/adapters/pi/rpc-client.d.ts +9 -1
- package/dist/adapters/process-tree.d.ts +19 -0
- package/dist/bin/audit-log.d.ts +12 -0
- package/dist/bin/byok-agent.js +1293 -484
- package/dist/bin/byok-agent.js.map +1 -1
- package/dist/bin/byok-approval-mcp.js.map +1 -1
- package/dist/bin/commands/workspaces.d.ts +11 -0
- package/dist/bin/format.d.ts +13 -0
- package/dist/bin/runtime-probe.d.ts +1 -1
- package/dist/bin/tasks-view.d.ts +13 -0
- package/dist/daemon/approvals.d.ts +2 -2
- package/dist/daemon/connection-manager.d.ts +4 -2
- package/dist/daemon/control-server.d.ts +18 -1
- package/dist/daemon/create-daemon.d.ts +2 -2
- package/dist/daemon/daemon-owner.d.ts +4 -2
- package/dist/daemon/environment.d.ts +9 -9
- package/dist/daemon/git-workspace.d.ts +21 -0
- package/dist/daemon/observer.d.ts +13 -0
- package/dist/daemon/presence-publisher.d.ts +29 -0
- package/dist/daemon/runtime-capabilities.d.ts +1 -1
- package/dist/daemon/task-runner.d.ts +27 -34
- package/dist/daemon/ws-transport.d.ts +3 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1254 -432
- package/dist/index.js.map +1 -1
- package/dist/runtime-failure.d.ts +64 -0
- package/dist/types.d.ts +100 -73
- package/package.json +4 -4
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type RuntimeAdapter, type RuntimeCapabilities, type RuntimeDetectResult, type RuntimeEnvironmentRequirements, type Session, type TaskContext } from '../../types';
|
|
1
|
+
import { type RuntimeAdapter, type RuntimeDetectResult, type RuntimeAdapterPrepareInput, type RuntimeAdapterPrepareResult } from '../../types';
|
|
3
2
|
import { type ResolvedBin } from './resolve-bin';
|
|
4
3
|
import { type SpawnFn } from './rpc-client';
|
|
5
4
|
/**
|
|
@@ -31,21 +30,9 @@ export interface PiByokLauncherConfig {
|
|
|
31
30
|
}
|
|
32
31
|
export declare class PiAdapter implements RuntimeAdapter {
|
|
33
32
|
private readonly options;
|
|
34
|
-
readonly
|
|
35
|
-
readonly supportsDispatchSelection = true;
|
|
33
|
+
readonly descriptor: import("..").RuntimeAdapterDescriptor;
|
|
36
34
|
constructor(options?: PiAdapterOptions);
|
|
37
35
|
detect(): Promise<RuntimeDetectResult>;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* M5: pi authenticates to its ~30 supported providers via env-var API
|
|
41
|
-
* keys — `detect()`'s own `authPresent` probe above checks this identical
|
|
42
|
-
* list — so these MUST keep flowing into pi's spawned process or pi auth
|
|
43
|
-
* breaks entirely. `KNOWN_PROVIDER_ENV_VARS` above is the single source
|
|
44
|
-
* of truth, reused here rather than duplicated. No `baseNames`: nothing
|
|
45
|
-
* in this adapter or `rpc-client.ts` reads a pi-specific config-discovery
|
|
46
|
-
* variable beyond the platform baseline (`daemon/environment.ts`).
|
|
47
|
-
*/
|
|
48
|
-
environmentRequirements(): RuntimeEnvironmentRequirements;
|
|
49
|
-
start(task: TaskOfferPayload, ctx: TaskContext): Promise<Session>;
|
|
36
|
+
prepare(input: RuntimeAdapterPrepareInput): Promise<RuntimeAdapterPrepareResult>;
|
|
50
37
|
private resolveBin;
|
|
51
38
|
}
|
|
@@ -39,6 +39,9 @@ export declare class PiRpcClient {
|
|
|
39
39
|
private readonly eventQueue;
|
|
40
40
|
private closed;
|
|
41
41
|
private exitError;
|
|
42
|
+
private readonly closedPromise;
|
|
43
|
+
private resolveClosed;
|
|
44
|
+
private disposalAttempt;
|
|
42
45
|
/** Bounded tail of recent stderr lines — pi discarded this entirely before (nothing ever read `child.stderr`), which is exactly why finding #1 (`Error: Unknown option: --session-id`, exit 1) had to be root-caused by hand instead of reading it off a thrown error. See `buildExitError`. */
|
|
43
46
|
private readonly stderrRing;
|
|
44
47
|
/** Count of pi RPC message types `PiSession` (pi-adapter.ts) has told us have no `AgentEvent` mapping and aren't routine bookkeeping — see `recordUnmappedFrame`. */
|
|
@@ -51,6 +54,8 @@ export declare class PiRpcClient {
|
|
|
51
54
|
}): Promise<PiRpcMessage>;
|
|
52
55
|
/** Every non-response, non-`extension_ui_request` line — the latter is answered directly by this client (see `respondToExtensionUiRequest`) and never enqueued. */
|
|
53
56
|
get events(): AsyncIterable<PiRpcMessage>;
|
|
57
|
+
/** Local transport diagnostic retained when the process closes; consumers must classify it explicitly. */
|
|
58
|
+
get terminalError(): Error | undefined;
|
|
54
59
|
/**
|
|
55
60
|
* Record a pi RPC message `type` that `PiSession` (pi-adapter.ts) decided
|
|
56
61
|
* has no `AgentEvent` mapping and isn't routine bookkeeping (see
|
|
@@ -61,8 +66,11 @@ export declare class PiRpcClient {
|
|
|
61
66
|
* a post-mortem on a failed/hung task has it without separate log scraping.
|
|
62
67
|
*/
|
|
63
68
|
recordUnmappedFrame(type: string): void;
|
|
64
|
-
/**
|
|
69
|
+
/** Immediate process-tree termination request. `dispose()` is the settlement receipt. */
|
|
65
70
|
kill(): void;
|
|
71
|
+
waitClosed(): Promise<void>;
|
|
72
|
+
dispose(): Promise<void>;
|
|
73
|
+
private processTreeOptions;
|
|
66
74
|
private onData;
|
|
67
75
|
private onLine;
|
|
68
76
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ChildProcess, type SpawnOptions } from 'node:child_process';
|
|
2
|
+
export interface OwnedProcessTreeOptions {
|
|
3
|
+
child: ChildProcess;
|
|
4
|
+
waitClosed: () => Promise<void>;
|
|
5
|
+
isClosed: () => boolean;
|
|
6
|
+
label: string;
|
|
7
|
+
termGraceMs?: number;
|
|
8
|
+
killGraceMs?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Every bundled runtime root is an owned process-group leader on POSIX. Pipes
|
|
12
|
+
* remain referenced, so `detached` changes ownership topology without making
|
|
13
|
+
* the runtime outlive the daemon. Windows uses taskkill's `/T` tree authority.
|
|
14
|
+
*/
|
|
15
|
+
export declare function withOwnedProcessTree<T extends SpawnOptions>(options: T): T;
|
|
16
|
+
/** Immediate termination request used by interrupt paths; close remains the receipt. */
|
|
17
|
+
export declare function requestOwnedProcessTreeTermination(options: OwnedProcessTreeOptions): void;
|
|
18
|
+
/** Resolve only after the adapter-owned root and descendants are quiescent. */
|
|
19
|
+
export declare function disposeOwnedProcessTree(options: OwnedProcessTreeOptions): Promise<void>;
|
package/dist/bin/audit-log.d.ts
CHANGED
|
@@ -118,6 +118,18 @@ export declare const AUDIT_LOG_TRIM_TARGET_LINES = 5000;
|
|
|
118
118
|
* tail) rather than the file growing without bound.
|
|
119
119
|
*/
|
|
120
120
|
export declare const MAX_LIVE_TASK_ANCHORS = 500;
|
|
121
|
+
/**
|
|
122
|
+
* Git failures are serialized only as this closed, stable category set —
|
|
123
|
+
* never raw Git errors or command output. Projected from
|
|
124
|
+
* `daemon/git-workspace.ts`'s `GIT_ERROR_CATEGORIES` (the single source of
|
|
125
|
+
* truth for the `GitErrorCategory` union) rather than carrying a literal
|
|
126
|
+
* copy that could drift from it; the runtime half of that guarantee is
|
|
127
|
+
* `__tests__/git-category-drift.test.ts`.
|
|
128
|
+
*
|
|
129
|
+
* @internal Exported for the drift-guard test only (never re-exported from
|
|
130
|
+
* `index.ts`).
|
|
131
|
+
*/
|
|
132
|
+
export declare const STABLE_GIT_ERROR_CATEGORIES: Set<string>;
|
|
121
133
|
/**
|
|
122
134
|
* Appends one `DaemonEvent` as a single redacted JSON line (finding P1 #3 —
|
|
123
135
|
* see this file's module doc comment) at 0600, and rotates the file if it's
|