@byok-sdk/client 0.14.0 → 0.16.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 (47) hide show
  1. package/README.md +15 -0
  2. package/dist/adapters/codex/codex-adapter.d.ts +2 -0
  3. package/dist/adapters/codex/process-runner.d.ts +16 -17
  4. package/dist/adapters/detect-outcome.d.ts +18 -0
  5. package/dist/adapters/index.d.ts +1 -1
  6. package/dist/adapters/index.js +189 -50
  7. package/dist/adapters/index.js.map +1 -1
  8. package/dist/bin/byok-agent-memory-mcp.js +29 -0
  9. package/dist/bin/byok-agent-memory-mcp.js.map +1 -1
  10. package/dist/bin/byok-agent-message-mcp.js +29 -0
  11. package/dist/bin/byok-agent-message-mcp.js.map +1 -1
  12. package/dist/bin/byok-agent-team-mcp.js +29 -0
  13. package/dist/bin/byok-agent-team-mcp.js.map +1 -1
  14. package/dist/bin/byok-agent.js +3026 -2122
  15. package/dist/bin/byok-agent.js.map +1 -1
  16. package/dist/bin/byok-approval-mcp.js +29 -0
  17. package/dist/bin/byok-approval-mcp.js.map +1 -1
  18. package/dist/bin/byok-mcp-env.d.ts +2 -0
  19. package/dist/bin/byok-mcp-env.js +36 -0
  20. package/dist/bin/byok-mcp-env.js.map +1 -0
  21. package/dist/bin/commands/doctor.d.ts +3 -0
  22. package/dist/bin/mcp-env-launcher.d.ts +5 -0
  23. package/dist/bin/runtime-probe.d.ts +6 -7
  24. package/dist/daemon/admission-wait.d.ts +2 -0
  25. package/dist/daemon/agent-egress-spool.d.ts +1 -0
  26. package/dist/daemon/agent-message-outbox.d.ts +17 -3
  27. package/dist/daemon/artifact-read.d.ts +7 -0
  28. package/dist/daemon/connection-manager.d.ts +18 -77
  29. package/dist/daemon/create-daemon.d.ts +11 -1
  30. package/dist/daemon/runtime-start.d.ts +3 -0
  31. package/dist/daemon/store.d.ts +2 -0
  32. package/dist/daemon/task-runner.d.ts +23 -0
  33. package/dist/daemon/terminal-commit-queue.d.ts +21 -0
  34. package/dist/daemon/terminal-identity.d.ts +6 -0
  35. package/dist/diagnostics/device-doctor.d.ts +46 -0
  36. package/dist/diagnostics/diagnostics.d.ts +5 -90
  37. package/dist/diagnostics/operator-actions.d.ts +63 -0
  38. package/dist/diagnostics/types.d.ts +92 -0
  39. package/dist/index.d.ts +5 -1
  40. package/dist/index.js +2575 -470
  41. package/dist/index.js.map +1 -1
  42. package/dist/runtime-detection.d.ts +3 -0
  43. package/dist/runtime-failure.d.ts +6 -0
  44. package/dist/sdk-reserved-helper-host.d.ts +1 -1
  45. package/dist/types.d.ts +20 -10
  46. package/dist/util/durable-jsonl.d.ts +12 -0
  47. package/package.json +4 -4
@@ -0,0 +1,63 @@
1
+ import { type AgentRef } from '@byok-sdk/protocol';
2
+ import type { DaemonConfig } from '../daemon/create-daemon';
3
+ import type { OperationalHealthFixResult } from './types';
4
+ import type { DiagnoseDeviceOptions } from './device-doctor';
5
+ declare const MESSAGES: {
6
+ readonly 'confirmation-required': 'Explicit confirmation is required for this local maintenance action.';
7
+ readonly 'invalid-input': 'The maintenance action requires valid explicit inputs.';
8
+ readonly 'daemon-running': 'Stop the host daemon before local maintenance.';
9
+ readonly 'store-busy': 'Another operation owns the device store.';
10
+ readonly 'agent-busy': 'Another operation owns the Agent home.';
11
+ readonly 'target-mismatch': 'The stored device or Agent records do not match the authorized target.';
12
+ readonly 'source-unavailable': 'The local source cannot be accessed safely; preserve it for inspection.';
13
+ readonly 'output-exists': 'The selected output already exists; it will not be overwritten.';
14
+ readonly 'operation-failed': 'The maintenance operation did not complete; preserve evidence before retrying.';
15
+ };
16
+ export type DeviceOperatorErrorCode = keyof typeof MESSAGES;
17
+ /** Closed codes only: never attach filesystem/OS error text, paths or nested causes. */
18
+ export declare class DeviceOperatorError extends Error {
19
+ readonly code: DeviceOperatorErrorCode;
20
+ constructor(code: DeviceOperatorErrorCode);
21
+ }
22
+ export interface ConfirmDeviceMaintenanceInput {
23
+ confirmed: true;
24
+ }
25
+ export type DeviceHealthQuarantineResult = OperationalHealthFixResult & {
26
+ action: 'quarantine-operational-health';
27
+ scope: 'device';
28
+ };
29
+ export interface ExportDeviceSupportBundleInput extends DiagnoseDeviceOptions {
30
+ /** Absolute, previously unused file in an existing directory. */
31
+ outputPath: string;
32
+ }
33
+ export interface DeviceSupportBundleExportResult {
34
+ action: 'export-support-bundle';
35
+ scope: 'device';
36
+ status: 'written';
37
+ bundleVersion: 1;
38
+ }
39
+ export interface ArchiveAgentTerminalMessagesInput extends ConfirmDeviceMaintenanceInput {
40
+ expectedTenantId: string;
41
+ expectedDeviceId: string;
42
+ /** Selects one Agent home. Historical profile revisions are preserved verbatim. */
43
+ agentRef: AgentRef;
44
+ /** Absolute NEW directory in an existing parent; contains sensitive audit bodies. */
45
+ archiveDirectory: string;
46
+ }
47
+ export type AgentTerminalMessagesArchiveResult = {
48
+ action: 'archive-terminal-messages';
49
+ scope: 'agent';
50
+ } & ({
51
+ status: 'not-needed';
52
+ } | {
53
+ status: 'archived';
54
+ archivedRecords: number;
55
+ archiveFileName: string;
56
+ });
57
+ /** Quarantines confirmed-corrupt health only; the host owns supervisor stop/restart. */
58
+ export declare function quarantineDeviceOperationalHealth(config: DaemonConfig, input: ConfirmDeviceMaintenanceInput): Promise<DeviceHealthQuarantineResult>;
59
+ /** Read-only source observation; publishes only the SDK allowlisted bundle, never raw logs. */
60
+ export declare function exportDeviceSupportBundle(config: DaemonConfig, input: ExportDeviceSupportBundleInput): Promise<DeviceSupportBundleExportResult>;
61
+ /** Archive refused/revoked evidence for one Agent under device and Agent single-writer leases. */
62
+ export declare function archiveAgentTerminalMessages(config: DaemonConfig, input: ArchiveAgentTerminalMessagesInput): Promise<AgentTerminalMessagesArchiveResult>;
63
+ export {};
@@ -0,0 +1,92 @@
1
+ import type { RuntimeDetectResult } from '../types';
2
+ import type { ControlStatusResult } from '../daemon/control-protocol';
3
+ import type { OperationalHealthFileInspection } from '../daemon/operational-health';
4
+ export type DiagnosticStatus = 'pass' | 'warn' | 'fail';
5
+ export interface DiagnosticCheck {
6
+ id: 'config' | 'device' | 'runtimes' | 'control' | 'health' | 'journal' | 'workspace' | 'quarantine';
7
+ status: DiagnosticStatus;
8
+ summary: string;
9
+ }
10
+ export interface DiagnosticsSnapshot {
11
+ version: 1;
12
+ generatedAt: string;
13
+ product: {
14
+ nameHash: string;
15
+ idHash: string;
16
+ };
17
+ system: {
18
+ node: string;
19
+ platform: NodeJS.Platform;
20
+ arch: string;
21
+ sqliteAvailable: boolean;
22
+ };
23
+ config: {
24
+ serverProtocol: 'http' | 'https' | 'ws' | 'wss' | 'invalid' | 'unsupported';
25
+ customStoreDir: boolean;
26
+ hostedJournal: boolean;
27
+ runtimeAllowlistCount?: number;
28
+ };
29
+ device: {
30
+ status: 'paired' | 'unpaired' | 'unavailable';
31
+ deviceIdHash?: string;
32
+ };
33
+ runtimes: Array<{
34
+ idHash: string;
35
+ present: boolean;
36
+ outcome: RuntimeDetectResult['kind'];
37
+ versionPresent: boolean;
38
+ authPresent?: boolean;
39
+ steer: boolean;
40
+ resume: boolean;
41
+ permissionModeCount: number;
42
+ }>;
43
+ control: {
44
+ status: 'offline';
45
+ reason: string;
46
+ } | {
47
+ status: 'online';
48
+ pid: number;
49
+ uptimeMs: number;
50
+ transport: string;
51
+ activeTaskCount: number;
52
+ pendingApprovalCount: number;
53
+ operationalHealth: ControlStatusResult['operationalHealth'];
54
+ storage?: ControlStatusResult['storage'];
55
+ };
56
+ health: OperationalHealthFileInspection;
57
+ journal: {
58
+ status: 'missing' | 'present' | 'corrupt' | 'unavailable';
59
+ sizeBytes?: number;
60
+ walBytes?: number;
61
+ integrity?: 'ok' | 'not-checked';
62
+ reason?: string;
63
+ };
64
+ workspace: {
65
+ status: 'available' | 'missing' | 'unavailable';
66
+ writable?: boolean;
67
+ reason?: string;
68
+ };
69
+ quarantine: {
70
+ status: 'available' | 'missing' | 'unavailable';
71
+ count: number;
72
+ scannedCount: number;
73
+ truncated: boolean;
74
+ entries: Array<{
75
+ nameHash: string;
76
+ sizeBytes: number;
77
+ modifiedAt: string;
78
+ }>;
79
+ reason?: string;
80
+ };
81
+ checks: DiagnosticCheck[];
82
+ }
83
+ export type OperationalHealthFixResult = {
84
+ status: 'not-needed';
85
+ reason: 'missing' | 'valid';
86
+ } | {
87
+ status: 'quarantined';
88
+ evidenceName: string;
89
+ manifestName: string;
90
+ sha256: string;
91
+ sizeBytes: number;
92
+ };
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export { resolveLocalAgentReleaseIdentity } from './release-identity';
12
12
  export type { LocalAgentReleaseIdentity } from './release-identity';
13
13
  export { BYOK_SDK_HELPER_SUBCOMMAND, resolveSdkReservedHelperBin, runSdkReservedHelperCommand, } from './sdk-reserved-helper-host';
14
14
  export type { SdkHelperHostConfig, SdkReservedHelperKind, ResolvedSdkReservedHelperBin, } from './sdk-reserved-helper-host';
15
- export { RuntimeExecutionFailure, RuntimeDisposalFailure, RUNTIME_ADAPTER_CONTRACT_VIOLATION_REASON, isRuntimeDisposalFailure, isRuntimeExecutionFailure, projectRuntimeBoundaryFailure, projectRuntimeExecutionFailure, } from './runtime-failure';
15
+ export { RuntimeExecutionFailure, RuntimeStartupDisposalFailure, isRuntimeStartupDisposalFailure, RuntimeDisposalFailure, RUNTIME_ADAPTER_CONTRACT_VIOLATION_REASON, isRuntimeDisposalFailure, isRuntimeExecutionFailure, projectRuntimeBoundaryFailure, projectRuntimeExecutionFailure, } from './runtime-failure';
16
16
  export type { RuntimeExecutionFailureInput, RuntimeDisposalFailureInput, RuntimeDisposalStage, RuntimeFailureCategory, RuntimeFailurePhase, RuntimeFailureProjection, RuntimeRetryDisposition, } from './runtime-failure';
17
17
  export { GitWorkspaceManager, GitWorkspaceError, isGitWorkspaceConfig, prependGitWorkspaceGuidance } from './daemon/git-workspace';
18
18
  export type { GitWorkspaceObservation, GitWorkspaceLease, GitWorkspaceOptions, GitErrorCategory } from './daemon/git-workspace';
@@ -82,3 +82,7 @@ export { PI_PACKAGE_NAME } from './adapters/pi/resolve-bin';
82
82
  export { ClaudeAdapter } from './adapters/claude/claude-adapter';
83
83
  export type { ClaudeAdapterOptions } from './adapters/claude/claude-adapter';
84
84
  export { CodexAdapter, type CodexAdapterOptions } from './adapters/codex/codex-adapter';
85
+ export { diagnoseDevice, repairDeviceEnrollmentMetadata, DeviceMetadataRepairError } from './diagnostics/device-doctor';
86
+ export type { DiagnoseDeviceOptions, DiagnosticsSnapshot, DiagnosticCheck, DiagnosticStatus, RepairDeviceEnrollmentMetadataInput, DeviceMetadataRepairResult, DeviceMetadataRepairErrorCode, } from './diagnostics/device-doctor';
87
+ export { quarantineDeviceOperationalHealth, exportDeviceSupportBundle, archiveAgentTerminalMessages, DeviceOperatorError } from './diagnostics/operator-actions';
88
+ export type { ConfirmDeviceMaintenanceInput, DeviceHealthQuarantineResult, ExportDeviceSupportBundleInput, DeviceSupportBundleExportResult, ArchiveAgentTerminalMessagesInput, AgentTerminalMessagesArchiveResult, DeviceOperatorErrorCode } from './diagnostics/operator-actions';