@byok-sdk/client 0.1.1 → 0.3.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.
Files changed (34) hide show
  1. package/README.md +46 -6
  2. package/dist/adapters/claude/claude-adapter.d.ts +3 -0
  3. package/dist/adapters/claude/resolve-bin.d.ts +2 -2
  4. package/dist/adapters/codex/codex-adapter.d.ts +5 -3
  5. package/dist/adapters/index.d.ts +1 -1
  6. package/dist/adapters/index.js +293 -100
  7. package/dist/adapters/index.js.map +1 -1
  8. package/dist/adapters/pi/events.d.ts +10 -37
  9. package/dist/adapters/pi/permission-mapping.d.ts +4 -20
  10. package/dist/adapters/pi/pi-adapter.d.ts +22 -0
  11. package/dist/adapters/pi/resolve-bin.d.ts +18 -14
  12. package/dist/adapters/pi/rpc-client.d.ts +1 -4
  13. package/dist/adapters/provider-credential-environment.d.ts +18 -0
  14. package/dist/bin/byok-agent.js +1839 -838
  15. package/dist/bin/byok-agent.js.map +1 -1
  16. package/dist/bin/byok-approval-mcp.js +2 -2
  17. package/dist/bin/byok-approval-mcp.js.map +1 -1
  18. package/dist/daemon/assertion-client.d.ts +68 -0
  19. package/dist/daemon/capabilities-client.d.ts +48 -0
  20. package/dist/daemon/control-protocol.d.ts +81 -4
  21. package/dist/daemon/create-daemon.d.ts +169 -1
  22. package/dist/daemon/daemon-owner.d.ts +35 -0
  23. package/dist/daemon/device-assertion-signer.d.ts +41 -0
  24. package/dist/daemon/device-keys.d.ts +15 -13
  25. package/dist/daemon/observer.d.ts +68 -3
  26. package/dist/daemon/presence-publisher.d.ts +69 -0
  27. package/dist/daemon/skill-pack-installer.d.ts +116 -0
  28. package/dist/daemon/task-runner.d.ts +129 -3
  29. package/dist/index.d.ts +22 -3
  30. package/dist/index.js +1872 -284
  31. package/dist/index.js.map +1 -1
  32. package/dist/lifecycle/create-service-lifecycle.d.ts +2 -2
  33. package/dist/types.d.ts +29 -0
  34. package/package.json +6 -5
package/README.md CHANGED
@@ -5,16 +5,56 @@ WebSocket or long poll, dispatches to local Claude Code, Codex, or pi adapters,
5
5
  and exposes authenticated local diagnostics/control commands.
6
6
 
7
7
  The package installs `byok-agent` and `byok-approval-mcp` binaries. Provider
8
- credentials are not read by the dispatch plane; `@byok-sdk/keys` is separate.
8
+ credentials are not read by the dispatch plane; `@byok-sdk/keys` is a separate
9
+ install and keeps a zero dependency edge to this package.
9
10
 
10
- Pi, Claude Code and Codex are user-installed runtimes. Install and authenticate
11
- the runtime CLI you choose; the SDK never packages its executable or
12
- credentials. Hosts that only need runtime detection/composition can import the
11
+ Pi is a required exact npm dependency and runs as an external Node subprocess.
12
+ For an authoritative BYOK `dispatchSelection`, configure `piByokLauncher` with
13
+ the separately installed `byok-pi-provider-launcher`, the local non-secret
14
+ profile database path, and a stable Pi session directory. The client passes
15
+ only those paths plus provider/model ids; the launcher alone reads the OS
16
+ credential when required and spawns Pi. Both custody paths must be absolute;
17
+ missing launcher configuration fails closed.
18
+
19
+ Claude Code and Codex remain user-installed runtimes and use their own login
20
+ state. Hosts that only need runtime detection/composition can import the
13
21
  transport-free adapter surface:
14
22
 
15
23
  ```ts
16
24
  import { PiAdapter, ClaudeAdapter, CodexAdapter } from '@byok-sdk/client/adapters';
17
25
  ```
18
26
 
19
- MIT licensed. Node.js 20 or newer; SQLite-backed journaling requires a runtime
20
- with `node:sqlite` support.
27
+ Claude tasks can select operator-owned local stdio MCP servers by logical id.
28
+ The toolset selector carries no MCP command or connector credential:
29
+
30
+ ```ts
31
+ import { createDaemon } from '@byok-sdk/client';
32
+
33
+ createDaemon({
34
+ // ...normal device and transport configuration
35
+ mcpToolsets: {
36
+ 'salesko.prospecting': {
37
+ mcpServers: {
38
+ 'salesko-connectors': {
39
+ command: '/opt/salesko/bin/connector-mcp',
40
+ args: ['--profile', 'default'],
41
+ },
42
+ },
43
+ },
44
+ },
45
+ });
46
+ ```
47
+
48
+ The map accepts only `command` and `args`; put OAuth tokens, cookies, and other
49
+ secrets behind the local MCP process's own credential broker. Toolset offers
50
+ for Pi or Codex are declined because those adapters do not yet expose a strict
51
+ task-scoped MCP configuration boundary.
52
+
53
+ For a concrete private host composition, see the
54
+ [`examples/salesko-connector-broker`](../../examples/salesko-connector-broker)
55
+ reference. It keeps `@byok-sdk/client` credential-blind while combining
56
+ OS-backed refresh-token custody, a PKCE desktop Google OAuth flow, exact domain
57
+ policy, a real read-only Gmail metadata adapter, and a closed metadata-only MCP
58
+ result.
59
+
60
+ MIT licensed. Node.js 22.19.0 or newer.
@@ -3,6 +3,8 @@ import { type RuntimeAdapter, type RuntimeCapabilities, type RuntimeDetectResult
3
3
  import { type ResolvedBin } from './resolve-bin';
4
4
  import { type ResolvedApprovalMcpBin } from './resolve-approval-mcp-bin';
5
5
  import { type SpawnFn } from './process-client';
6
+ /** The MCP server NAME this adapter registers `byok-approval-mcp` under in the generated `--mcp-config` (arbitrary, local to this file) — combined with {@link APPROVAL_TOOL_NAME} (imported, single-sourced from `bin/approval-mcp-server.ts` so the two can never independently drift) to form the `mcp__<server>__<tool>` identifier `--permission-prompt-tool` expects. */
7
+ export declare const APPROVAL_MCP_SERVER_NAME = "byokapproval";
6
8
  export interface ClaudeAdapterOptions {
7
9
  /** Override bin resolution — tests substitute the fake-claude fixture script. */
8
10
  resolveBin?: () => ResolvedBin;
@@ -112,6 +114,7 @@ export interface ClaudeAdapterOptions {
112
114
  */
113
115
  export declare class ClaudeAdapter implements RuntimeAdapter {
114
116
  private readonly options;
117
+ readonly supportsDispatchSelection = true;
115
118
  readonly id = "claude";
116
119
  constructor(options?: ClaudeAdapterOptions);
117
120
  detect(): Promise<RuntimeDetectResult>;
@@ -6,7 +6,7 @@ export interface ResolvedBin {
6
6
  * Resolve the `claude` (Claude Code) CLI executable.
7
7
  *
8
8
  * Unlike pi (`../pi/resolve-bin.ts`), this package does NOT bundle a
9
- * matched `claude` build as an optionalDependency. Claude Code is the end
9
+ * matched `claude` build as a dependency. Claude Code is the end
10
10
  * user's own globally-installed, individually-authenticated CLI (`claude
11
11
  * auth login`, tied to their Anthropic/claude.ai account) — there is
12
12
  * nothing useful to vendor: a bundled copy could never carry the user's own
@@ -22,6 +22,6 @@ export interface ResolvedBin {
22
22
  * `fake-claude.mjs` fixture ahead of a real claude install, exactly as pi's
23
23
  * own override does), otherwise this falls back to the literal command name
24
24
  * `claude`, resolved via the child process's own PATH lookup — there is no
25
- * optionalDependency tier in between.
25
+ * package-resolution tier in between.
26
26
  */
27
27
  export declare function resolveClaudeBin(): ResolvedBin;
@@ -52,6 +52,7 @@ export interface CodexAdapterOptions {
52
52
  */
53
53
  export declare class CodexAdapter implements RuntimeAdapter {
54
54
  private readonly options;
55
+ readonly supportsDispatchSelection = true;
55
56
  readonly id = "codex";
56
57
  constructor(options?: CodexAdapterOptions);
57
58
  detect(): Promise<RuntimeDetectResult>;
@@ -66,9 +67,10 @@ export declare class CodexAdapter implements RuntimeAdapter {
66
67
  * Two independently-verified channel gotchas apply here, the "pi lesson"
67
68
  * yet again:
68
69
  * - `codex login status`'s human-readable "Logged in using ChatGPT"
69
- * message prints on STDERR, not stdout (the opposite-channel
70
- * counterpart of pi's own `--version`-goes-to-stderr surprise) both
71
- * streams are checked here for exactly that reason.
70
+ * message prints on STDERR, not stdout both streams are checked
71
+ * here for exactly that reason. pi's `--version` is the same class of
72
+ * hazard from the other direction: its channel has moved between pi
73
+ * releases (see ../pi/pi-adapter.ts), so neither stream is assumed.
72
74
  * - The NOT-logged-in message/exit-code shape was deliberately never
73
75
  * empirically tested: this machine has a real, live ChatGPT login, and
74
76
  * running `codex logout` to observe the negative case would have
@@ -1,7 +1,7 @@
1
1
  export type { RuntimeAdapter, RuntimeCapabilities, RuntimeDetectResult, } from '../types';
2
2
  export type { RuntimeEnvironmentRequirements } from '../daemon/environment';
3
3
  export { PiAdapter } from './pi/pi-adapter';
4
- export type { PiAdapterOptions } from './pi/pi-adapter';
4
+ export type { PiAdapterOptions, PiByokLauncherConfig } from './pi/pi-adapter';
5
5
  export { PI_PACKAGE_NAME } from './pi/resolve-bin';
6
6
  export { ClaudeAdapter } from './claude/claude-adapter';
7
7
  export type { ClaudeAdapterOptions } from './claude/claude-adapter';