@guilz-dev/belay 0.8.1 → 0.9.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 (104) hide show
  1. package/README.md +60 -10
  2. package/dist/adapters/shared/gate-runtime.d.ts +5 -0
  3. package/dist/adapters/shared/gate-runtime.js +237 -33
  4. package/dist/bundle/claude-runtime.mjs +4082 -1230
  5. package/dist/bundle/codex-runtime.mjs +4057 -1205
  6. package/dist/bundle/cursor-runtime.mjs +4057 -1205
  7. package/dist/commands/classify-for-report.js +5 -0
  8. package/dist/commands/doctor.js +73 -6
  9. package/dist/commands/explain.js +3 -2
  10. package/dist/commands/metrics.js +42 -0
  11. package/dist/commands/recovery-checkpoints.d.ts +8 -1
  12. package/dist/commands/recovery-checkpoints.js +44 -11
  13. package/dist/commands/session.d.ts +5 -0
  14. package/dist/commands/session.js +8 -1
  15. package/dist/config-io.js +2 -2
  16. package/dist/conformance/contained-execution-guarantee.d.ts +121 -0
  17. package/dist/conformance/contained-execution-guarantee.js +121 -0
  18. package/dist/conformance/guarantee-table.js +7 -0
  19. package/dist/core/audit-io.js +8 -0
  20. package/dist/core/audit-metrics.d.ts +11 -0
  21. package/dist/core/audit-metrics.js +14 -0
  22. package/dist/core/audit-recovery-metrics.d.ts +33 -0
  23. package/dist/core/audit-recovery-metrics.js +146 -0
  24. package/dist/core/audit-types.d.ts +7 -1
  25. package/dist/core/audit-types.js +1 -1
  26. package/dist/core/bounded-output.d.ts +11 -0
  27. package/dist/core/bounded-output.js +26 -0
  28. package/dist/core/capability/attestation.d.ts +56 -0
  29. package/dist/core/capability/attestation.js +110 -3
  30. package/dist/core/capability/boundary-session.d.ts +5 -0
  31. package/dist/core/capability/boundary-session.js +38 -1
  32. package/dist/core/capability/index.d.ts +1 -1
  33. package/dist/core/capability/index.js +1 -1
  34. package/dist/core/config.d.ts +18 -0
  35. package/dist/core/config.js +89 -10
  36. package/dist/core/contained-execution/docker-policy.d.ts +18 -0
  37. package/dist/core/contained-execution/docker-policy.js +97 -0
  38. package/dist/core/contained-execution/docker.d.ts +223 -0
  39. package/dist/core/contained-execution/docker.js +846 -0
  40. package/dist/core/contained-execution/eligibility.d.ts +9 -0
  41. package/dist/core/contained-execution/eligibility.js +103 -0
  42. package/dist/core/contained-execution/failure.d.ts +18 -0
  43. package/dist/core/contained-execution/failure.js +105 -0
  44. package/dist/core/contained-execution/mirror.d.ts +54 -0
  45. package/dist/core/contained-execution/mirror.js +587 -0
  46. package/dist/core/contained-execution/policy.d.ts +10 -0
  47. package/dist/core/contained-execution/policy.js +20 -0
  48. package/dist/core/effect-ir/index.d.ts +1 -1
  49. package/dist/core/effect-ir/index.js +1 -1
  50. package/dist/core/effect-ir/normalize.d.ts +5 -0
  51. package/dist/core/effect-ir/normalize.js +17 -7
  52. package/dist/core/effect-ir/shell-build.js +2 -14
  53. package/dist/core/effect-ir/shell-lower.js +100 -25
  54. package/dist/core/gate-contract.d.ts +4 -1
  55. package/dist/core/gate-contract.js +2 -0
  56. package/dist/core/process-runner.d.ts +10 -3
  57. package/dist/core/process-runner.js +66 -10
  58. package/dist/core/recovery/checkpoint.d.ts +3 -0
  59. package/dist/core/recovery/checkpoint.js +33 -4
  60. package/dist/core/recovery/types.d.ts +1 -0
  61. package/dist/core/scrub.d.ts +17 -0
  62. package/dist/core/scrub.js +499 -5
  63. package/dist/core/standing-allow.d.ts +0 -20
  64. package/dist/core/standing-allow.js +0 -71
  65. package/dist/core/transactional/apply-observed-changes.d.ts +1 -0
  66. package/dist/core/transactional/apply-observed-changes.js +11 -0
  67. package/dist/core/transactional/backend-selector.d.ts +2 -1
  68. package/dist/core/transactional/backend-selector.js +32 -29
  69. package/dist/core/transactional/backend.d.ts +3 -0
  70. package/dist/core/transactional/file-checkpoint-backend.js +242 -54
  71. package/dist/core/transactional/file-checkpoint-git.d.ts +3 -0
  72. package/dist/core/transactional/file-checkpoint-git.js +53 -0
  73. package/dist/core/transactional/file-checkpoint-isolation.d.ts +3 -0
  74. package/dist/core/transactional/file-checkpoint-isolation.js +16 -0
  75. package/dist/core/transactional/git-worktree-backend.js +3 -0
  76. package/dist/core/transactional/git-worktree.d.ts +1 -0
  77. package/dist/core/transactional/git-worktree.js +1 -0
  78. package/dist/core/transactional/runner.js +59 -13
  79. package/dist/core/types.d.ts +13 -0
  80. package/dist/core/verdict/parser.d.ts +10 -0
  81. package/dist/core/verdict/parser.js +271 -40
  82. package/dist/core/verdict/shell-semantics.js +21 -0
  83. package/dist/corpus/adversarial-probe.d.ts +1 -1
  84. package/dist/corpus/adversarial-probe.js +3 -3
  85. package/dist/corpus/benign-probe-cores.d.ts +6 -0
  86. package/dist/corpus/{must-allow-commands.js → benign-probe-cores.js} +8 -2
  87. package/dist/corpus/coverage-compare.d.ts +36 -0
  88. package/dist/corpus/coverage-compare.js +197 -0
  89. package/dist/corpus/coverage-contexts.d.ts +17 -0
  90. package/dist/corpus/coverage-contexts.js +88 -0
  91. package/dist/corpus/coverage-matrix.d.ts +37 -0
  92. package/dist/corpus/coverage-matrix.js +159 -0
  93. package/dist/corpus/coverage-probe.d.ts +91 -0
  94. package/dist/corpus/coverage-probe.js +341 -0
  95. package/dist/corpus/evaluate.d.ts +1 -1
  96. package/dist/corpus/evaluate.js +1 -1
  97. package/dist/corpus/structural-fixture-root.d.ts +2 -0
  98. package/dist/corpus/structural-fixture-root.js +5 -0
  99. package/dist/version.d.ts +1 -1
  100. package/dist/version.js +1 -1
  101. package/package.json +3 -1
  102. package/skills/belay/SKILL.md +19 -0
  103. package/skills/belay/belay-status.md +5 -0
  104. package/dist/corpus/must-allow-commands.d.ts +0 -6
@@ -0,0 +1,223 @@
1
+ import type { BoundaryAttestation, ContainedExecutionAttestation, ContainedExecutionResourceLimits, DockerSubstrateIdentity } from '../capability/attestation.js';
2
+ import type { BelayContainedExecutionConfig } from '../config.js';
3
+ import { type ProcessOutputPolicy, type ShellRunResult } from '../process-runner.js';
4
+ import { type BuildContainedDockerCreateArgsParams, buildContainedDockerCreateArgs } from './docker-policy.js';
5
+ import { type ContainedExecutionFailureCode, ContainedExecutionFailureError } from './failure.js';
6
+ import { type ContainedExecutionMirrorBackend, type ContainedExecutionMirrorHandle } from './mirror.js';
7
+ export declare class ContainedDockerBoundaryUnavailableError extends ContainedExecutionFailureError {
8
+ readonly reason: ContainedExecutionFailureCode;
9
+ readonly receipt: undefined;
10
+ constructor(reason: ContainedExecutionFailureCode, options?: ErrorOptions);
11
+ }
12
+ export declare class ContainedDockerStartAttemptError extends ContainedExecutionFailureError {
13
+ constructor(options?: ErrorOptions);
14
+ }
15
+ export declare class ContainedDockerCleanupUnconfirmedError extends ContainedExecutionFailureError {
16
+ readonly containerName: string;
17
+ readonly executionStarted: boolean;
18
+ readonly cleanupConfirmed = false;
19
+ constructor(containerName: string, executionStarted: boolean, options?: ErrorOptions);
20
+ }
21
+ export interface ContainedDockerInspect {
22
+ Id: string;
23
+ Image: string;
24
+ Config: {
25
+ User: string;
26
+ Env: string[] | null;
27
+ Entrypoint: string[] | string | null;
28
+ Cmd: string[] | null;
29
+ WorkingDir: string;
30
+ Healthcheck: {
31
+ Test?: string[] | null;
32
+ } | null;
33
+ };
34
+ HostConfig: {
35
+ AutoRemove: boolean;
36
+ Privileged: boolean;
37
+ CapAdd: string[] | null;
38
+ CapDrop: string[] | null;
39
+ SecurityOpt: string[] | null;
40
+ LogConfig: {
41
+ Type: string;
42
+ Config: Record<string, string> | null;
43
+ } | null;
44
+ Devices: unknown[] | null;
45
+ DeviceRequests: unknown[] | null;
46
+ DeviceCgroupRules: string[] | null;
47
+ GroupAdd: string[] | null;
48
+ VolumesFrom: string[] | null;
49
+ Binds: string[] | null;
50
+ PortBindings: Record<string, unknown> | null;
51
+ PublishAllPorts: boolean;
52
+ Links: string[] | null;
53
+ ExtraHosts: string[] | null;
54
+ Dns: string[] | null;
55
+ DnsOptions: string[] | null;
56
+ DnsSearch: string[] | null;
57
+ NetworkMode: string;
58
+ ReadonlyRootfs: boolean;
59
+ Tmpfs: Record<string, string> | null;
60
+ Memory: number;
61
+ MemorySwap: number;
62
+ ShmSize: number;
63
+ NanoCpus: number;
64
+ PidsLimit: number | null;
65
+ RestartPolicy: {
66
+ Name: string;
67
+ MaximumRetryCount: number;
68
+ };
69
+ IpcMode: string;
70
+ PidMode: string;
71
+ UTSMode: string;
72
+ UsernsMode: string;
73
+ CgroupnsMode: string;
74
+ };
75
+ NetworkSettings: {
76
+ Ports: Record<string, unknown> | null;
77
+ };
78
+ Mounts: Array<{
79
+ Type: string;
80
+ Source: string;
81
+ Destination: string;
82
+ RW: boolean;
83
+ }>;
84
+ }
85
+ export interface ContainedDockerDependencies {
86
+ resolveSubstrate(params: {
87
+ executable: string;
88
+ host: string;
89
+ repoRoot: string;
90
+ protectedRoots: readonly string[];
91
+ }): Promise<DockerSubstrateIdentity>;
92
+ runProcess(file: string, args: string[], env: Record<string, string>, timeoutMs: number, outputPolicy?: ProcessOutputPolicy): Promise<ShellRunResult>;
93
+ now(): number;
94
+ randomUUID(): string;
95
+ uid(): number;
96
+ gid(): number;
97
+ }
98
+ export type { BuildContainedDockerCreateArgsParams };
99
+ export { buildContainedDockerCreateArgs };
100
+ export declare function probeContainedDockerBoundary(params: {
101
+ repoRoot: string;
102
+ protectedRoots: readonly string[];
103
+ imageReference: string;
104
+ dockerExecutable: string;
105
+ dockerHost: string;
106
+ hostProbeRoot: string;
107
+ guestWorkspacePath: string;
108
+ resourceLimits: ContainedExecutionResourceLimits;
109
+ dependencies?: ContainedDockerDependencies;
110
+ }): Promise<ContainedExecutionAttestation>;
111
+ export interface ContainedExecutionReceipt {
112
+ version: 1;
113
+ inputFingerprint: string;
114
+ actionFingerprint: string;
115
+ attestationDigest: string;
116
+ executionStarted: true;
117
+ timeoutMs: number;
118
+ dockerSubstrate: DockerSubstrateIdentity;
119
+ imageId: string;
120
+ mirror: {
121
+ backend: ContainedExecutionMirrorBackend;
122
+ type: 'bind';
123
+ cardinality: 1;
124
+ readWrite: true;
125
+ sourceFingerprint: string;
126
+ guestWorkspacePathFingerprint: string;
127
+ guestCwdFingerprint: string;
128
+ };
129
+ logging: {
130
+ driver: 'none';
131
+ config: Record<string, never>;
132
+ };
133
+ network: {
134
+ mode: 'none';
135
+ publishAllPorts: false;
136
+ portBindings: Record<string, never>;
137
+ links: [];
138
+ extraHosts: [];
139
+ dns: [];
140
+ dnsOptions: [];
141
+ dnsSearch: [];
142
+ };
143
+ readOnlyRoot: true;
144
+ tmpfs: {
145
+ path: '/tmp';
146
+ sizeBytes: number;
147
+ mode: 0o1777;
148
+ exec: false;
149
+ nosuid: true;
150
+ nodev: true;
151
+ };
152
+ environment: {
153
+ hostForwarded: false;
154
+ proxyEnvironment: 'neutralized-empty';
155
+ neutralizedVariables: readonly string[];
156
+ imageEnvironmentDigest: string;
157
+ };
158
+ privilege: {
159
+ privileged: false;
160
+ noNewPrivileges: true;
161
+ capAdd: [];
162
+ capDrop: ['ALL'];
163
+ groupAdd: [];
164
+ };
165
+ devices: {
166
+ devices: [];
167
+ deviceRequests: [];
168
+ deviceCgroupRules: [];
169
+ };
170
+ storage: {
171
+ volumesFrom: [];
172
+ bindsOutsideMirror: [];
173
+ };
174
+ namespaces: {
175
+ ipc: 'none';
176
+ pid: 'private';
177
+ uts: 'private';
178
+ cgroup: 'private';
179
+ user: 'default';
180
+ };
181
+ healthcheckDisabled: true;
182
+ lifecycle: {
183
+ autoRemove: false;
184
+ restart: 'no';
185
+ maximumRetryCount: 0;
186
+ };
187
+ resources: {
188
+ memoryMiB: number;
189
+ memorySwapMiB: number;
190
+ shmSizeMiB: number;
191
+ cpus: number;
192
+ nanoCpus: number;
193
+ pids: number;
194
+ };
195
+ user: string;
196
+ entrypoint: '/bin/sh';
197
+ exitCode: number | null;
198
+ timedOut: boolean;
199
+ }
200
+ export interface ContainedDockerExecutionResult extends ShellRunResult {
201
+ executionStarted: true;
202
+ receipt: ContainedExecutionReceipt;
203
+ receiptHash: string;
204
+ }
205
+ export interface ExecuteContainedDockerParams {
206
+ repoRoot: string;
207
+ controlPlaneDir: string;
208
+ protectedRoots: readonly string[];
209
+ config: BelayContainedExecutionConfig;
210
+ mirror: ContainedExecutionMirrorHandle;
211
+ guestCwd: string;
212
+ command: string;
213
+ inputFingerprint: string;
214
+ signedAttestation: unknown;
215
+ dependencies?: ContainedDockerDependencies;
216
+ }
217
+ export declare function executeContainedDocker(params: ExecuteContainedDockerParams): Promise<ContainedDockerExecutionResult>;
218
+ export declare function probeContainedDockerForSession(params: {
219
+ repoRoot: string;
220
+ controlPlaneDir: string;
221
+ config: BelayContainedExecutionConfig;
222
+ dependencies?: ContainedDockerDependencies;
223
+ }): Promise<BoundaryAttestation>;