@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
package/README.md
CHANGED
|
@@ -24,6 +24,14 @@ transport-free adapter surface:
|
|
|
24
24
|
import { PiAdapter, ClaudeAdapter, CodexAdapter } from '@byok-sdk/client/adapters';
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
Version 0.4.0 intentionally breaks custom adapters: they expose a frozen
|
|
28
|
+
descriptor and side-effect-free `prepare()` that returns one prepared
|
|
29
|
+
operation; the old direct `start()` surface is removed. A published
|
|
30
|
+
`Session.close()` is a bounded quiescent-disposal receipt. It resolves only
|
|
31
|
+
after the adapter-owned process tree and task resources are gone, or rejects
|
|
32
|
+
with `RuntimeDisposalFailure`. The daemon keeps active/Git ownership after a
|
|
33
|
+
rejection and never rewrites the task's already-established terminal result.
|
|
34
|
+
|
|
27
35
|
Claude tasks can select operator-owned local stdio MCP servers by logical id.
|
|
28
36
|
The toolset selector carries no MCP command or connector credential:
|
|
29
37
|
|
|
@@ -50,6 +58,11 @@ secrets behind the local MCP process's own credential broker. Toolset offers
|
|
|
50
58
|
for Pi or Codex are declined because those adapters do not yet expose a strict
|
|
51
59
|
task-scoped MCP configuration boundary.
|
|
52
60
|
|
|
61
|
+
The daemon derives one sorted `configuredToolsets` snapshot from this
|
|
62
|
+
validated registry. Only those logical IDs are advertised in `conn.hello`
|
|
63
|
+
and hosted presence; command, args, environment, headers, and credentials
|
|
64
|
+
remain local.
|
|
65
|
+
|
|
53
66
|
For a concrete private host composition, see the
|
|
54
67
|
[`examples/salesko-connector-broker`](../../examples/salesko-connector-broker)
|
|
55
68
|
reference. It keeps `@byok-sdk/client` credential-blind while combining
|
|
@@ -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 ResolvedApprovalMcpBin } from './resolve-approval-mcp-bin';
|
|
5
4
|
import { type SpawnFn } from './process-client';
|
|
@@ -114,26 +113,11 @@ export interface ClaudeAdapterOptions {
|
|
|
114
113
|
*/
|
|
115
114
|
export declare class ClaudeAdapter implements RuntimeAdapter {
|
|
116
115
|
private readonly options;
|
|
117
|
-
readonly
|
|
118
|
-
readonly id = "claude";
|
|
116
|
+
readonly descriptor: import("..").RuntimeAdapterDescriptor;
|
|
119
117
|
constructor(options?: ClaudeAdapterOptions);
|
|
120
118
|
detect(): Promise<RuntimeDetectResult>;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
* M5: deliberate product-boundary decision, not an oversight — byok's
|
|
124
|
-
* current ToS posture for claude is login-state-only (`claude auth
|
|
125
|
-
* login`'s own OAuth session — see `probeAuthPresent` below), so this
|
|
126
|
-
* adapter declares NO credential env vars at all; env-based API-key
|
|
127
|
-
* passthrough for claude is a separate, still-pending product decision.
|
|
128
|
-
* A product that genuinely needs it can opt in locally per-device via
|
|
129
|
-
* `DaemonConfig.runtimeEnvironment.claude.allow` (`create-daemon.ts`).
|
|
130
|
-
* `baseNames` is empty too: nothing in this adapter reads a
|
|
131
|
-
* claude-specific config-discovery variable (e.g. `CLAUDE_CONFIG_DIR`)
|
|
132
|
-
* today — if a future version of this adapter starts reading one, it
|
|
133
|
-
* belongs here, not left to rely on the platform baseline alone.
|
|
134
|
-
*/
|
|
135
|
-
environmentRequirements(): RuntimeEnvironmentRequirements;
|
|
136
|
-
start(task: TaskOfferPayload, ctx: TaskContext): Promise<Session>;
|
|
119
|
+
prepare(input: RuntimeAdapterPrepareInput): Promise<RuntimeAdapterPrepareResult>;
|
|
120
|
+
private startPrepared;
|
|
137
121
|
/**
|
|
138
122
|
* `claude auth status --json` is claude's OWN non-secret login-state
|
|
139
123
|
* signal (see the credential-isolation rule on `RuntimeAdapter` in
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentEvent } from '@byok-sdk/protocol';
|
|
2
|
+
import { RuntimeExecutionFailure } from '../../runtime-failure';
|
|
2
3
|
/**
|
|
3
4
|
* A raw parsed line from `claude --output-format stream-json`. Shapes vary
|
|
4
5
|
* a lot by `type` (and, for `system`, by `subtype`) — see the doc comments
|
|
@@ -38,6 +39,8 @@ export interface MapClaudeMessageOptions {
|
|
|
38
39
|
}
|
|
39
40
|
export interface MapClaudeMessageResult {
|
|
40
41
|
events: AgentEvent[];
|
|
42
|
+
/** Present only when this frame is authoritative terminal failure evidence. */
|
|
43
|
+
terminalFailure?: RuntimeExecutionFailure;
|
|
41
44
|
/**
|
|
42
45
|
* Set when this exact frame (or, for `assistant`/`user` frames, one
|
|
43
46
|
* content block inside it) was genuinely unrecognized — a frame/subtype/
|
|
@@ -52,6 +52,9 @@ export declare class ClaudeProcessClient {
|
|
|
52
52
|
private readonly eventQueue;
|
|
53
53
|
private closed;
|
|
54
54
|
private exitError;
|
|
55
|
+
private readonly closedPromise;
|
|
56
|
+
private resolveClosed;
|
|
57
|
+
private disposalAttempt;
|
|
55
58
|
private readonly stderrRing;
|
|
56
59
|
private readonly unmappedFrameCounts;
|
|
57
60
|
private sessionId;
|
|
@@ -81,6 +84,8 @@ export declare class ClaudeProcessClient {
|
|
|
81
84
|
waitForInit(): Promise<string>;
|
|
82
85
|
/** Every parsed stream-json line — `system/init` is consumed internally (see `waitForInit`) but is also forwarded here like any other frame, so routine-frame accounting in `ClaudeSession`'s mapper stays uniform. */
|
|
83
86
|
get events(): AsyncIterable<ClaudeStreamMessage>;
|
|
87
|
+
/** Local transport diagnostic retained when the process closes; consumers classify it at the session boundary. */
|
|
88
|
+
get terminalError(): Error | undefined;
|
|
84
89
|
/**
|
|
85
90
|
* Record a claude stream-json frame/subtype/content-block label that
|
|
86
91
|
* `ClaudeSession`'s event iterator (`../claude-adapter.ts`) decided has
|
|
@@ -92,8 +97,11 @@ export declare class ClaudeProcessClient {
|
|
|
92
97
|
* post-mortem without separate log scraping.
|
|
93
98
|
*/
|
|
94
99
|
recordUnmappedFrame(label: string): void;
|
|
95
|
-
/**
|
|
100
|
+
/** Immediate process-tree termination request. `dispose()` is the settlement receipt. */
|
|
96
101
|
kill(): void;
|
|
102
|
+
waitClosed(): Promise<void>;
|
|
103
|
+
dispose(): Promise<void>;
|
|
104
|
+
private processTreeOptions;
|
|
97
105
|
private onData;
|
|
98
106
|
private onLine;
|
|
99
107
|
private onStderr;
|
|
@@ -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 './process-runner';
|
|
5
4
|
export interface CodexAdapterOptions {
|
|
@@ -52,8 +51,7 @@ export interface CodexAdapterOptions {
|
|
|
52
51
|
*/
|
|
53
52
|
export declare class CodexAdapter implements RuntimeAdapter {
|
|
54
53
|
private readonly options;
|
|
55
|
-
readonly
|
|
56
|
-
readonly id = "codex";
|
|
54
|
+
readonly descriptor: import("..").RuntimeAdapterDescriptor;
|
|
57
55
|
constructor(options?: CodexAdapterOptions);
|
|
58
56
|
detect(): Promise<RuntimeDetectResult>;
|
|
59
57
|
/**
|
|
@@ -83,17 +81,7 @@ export declare class CodexAdapter implements RuntimeAdapter {
|
|
|
83
81
|
* empirical pass on a logged-out machine, not asserted as verified.
|
|
84
82
|
*/
|
|
85
83
|
private probeAuthPresent;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
* M5: same deliberate posture as the claude adapter (see its own doc
|
|
89
|
-
* comment) — codex authenticates via its own `codex login`-managed
|
|
90
|
-
* ChatGPT OAuth session (`probeAuthPresent` above), not an env var, so
|
|
91
|
-
* there is no credential env var this adapter needs forwarded; env-based
|
|
92
|
-
* API-key passthrough remains a separate, pending product decision. No
|
|
93
|
-
* `baseNames` either: nothing in this adapter reads a codex-specific
|
|
94
|
-
* config-discovery variable (e.g. `CODEX_HOME`) today.
|
|
95
|
-
*/
|
|
96
|
-
environmentRequirements(): RuntimeEnvironmentRequirements;
|
|
97
|
-
start(task: TaskOfferPayload, ctx: TaskContext): Promise<Session>;
|
|
84
|
+
prepare(input: RuntimeAdapterPrepareInput): Promise<RuntimeAdapterPrepareResult>;
|
|
85
|
+
private startPrepared;
|
|
98
86
|
private resolveBin;
|
|
99
87
|
}
|
|
@@ -59,13 +59,14 @@ export declare class CodexProcessRunner {
|
|
|
59
59
|
private exitSignal;
|
|
60
60
|
private readonly closedPromise;
|
|
61
61
|
private resolveClosed;
|
|
62
|
+
private disposalAttempt;
|
|
62
63
|
constructor(options: CodexProcessOptions);
|
|
63
64
|
private finishClosing;
|
|
64
65
|
/** Resolves once the child process has fully exited (both exit and stdio-flush guaranteed — see the `close` listener above). Never rejects. */
|
|
65
66
|
waitClosed(): Promise<void>;
|
|
66
67
|
get isClosed(): boolean;
|
|
67
68
|
/**
|
|
68
|
-
*
|
|
69
|
+
* Immediate tree termination request. SIGTERM on POSIX: SIGINT was empirically confirmed
|
|
69
70
|
* to be silently ignored by `codex exec` (a real, direct test — a 60s
|
|
70
71
|
* shell `sleep` ran to full, unaffected completion despite SIGINT sent at
|
|
71
72
|
* t=4s) — a genuine, evidence-based correction to this task's own initial
|
|
@@ -78,6 +79,8 @@ export declare class CodexProcessRunner {
|
|
|
78
79
|
* `../pi/rpc-client.ts`'s own cross-platform convention.
|
|
79
80
|
*/
|
|
80
81
|
kill(): void;
|
|
82
|
+
dispose(): Promise<void>;
|
|
83
|
+
private processTreeOptions;
|
|
81
84
|
/** Builds a descriptive error folding in the exit code/signal and the stderr tail — mirrors `PiRpcClient.buildExitError`'s reasoning: a post-mortem on a failed start/resume should never need separately re-running codex by hand with a raw JSONL logger to learn why. */
|
|
82
85
|
buildExitError(context: string): Error;
|
|
83
86
|
private onData;
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export type { RuntimeAdapter, RuntimeCapabilities, RuntimeDetectResult, } from '../types';
|
|
1
|
+
export type { RuntimeAdapter, RuntimeAdapterDescriptor, RuntimeAdapterPrepareInput, RuntimeAdapterPrepareResult, RuntimeAdapterRejectedOperation, RuntimeAdapterPreparedOperation, PreparedRuntimeOperation, RuntimeOperationManifest, RuntimeOperationStartInput, RuntimeCapabilities, RuntimeDetectResult, } from '../types';
|
|
2
2
|
export type { RuntimeEnvironmentRequirements } from '../daemon/environment';
|
|
3
|
+
export { RuntimeDisposalFailure, RuntimeExecutionFailure } from '../runtime-failure';
|
|
4
|
+
export type { RuntimeDisposalFailureInput, RuntimeDisposalStage, RuntimeExecutionFailureInput, RuntimeFailureCategory, RuntimeFailurePhase, RuntimeRetryDisposition, } from '../runtime-failure';
|
|
3
5
|
export { PiAdapter } from './pi/pi-adapter';
|
|
4
6
|
export type { PiAdapterOptions, PiByokLauncherConfig } from './pi/pi-adapter';
|
|
5
7
|
export { PI_PACKAGE_NAME } from './pi/resolve-bin';
|