clinkx 1.1.0 → 1.1.2
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/CHANGELOG.md +39 -1
- package/README.md +210 -177
- package/clinkx-workflows/dist/architecture-comparison/admission.d.ts +5 -0
- package/clinkx-workflows/dist/architecture-comparison/admission.js +50 -0
- package/clinkx-workflows/dist/architecture-comparison/admission.js.map +1 -0
- package/clinkx-workflows/dist/architecture-comparison/contract.d.ts +995 -0
- package/clinkx-workflows/dist/architecture-comparison/contract.js +149 -0
- package/clinkx-workflows/dist/architecture-comparison/contract.js.map +1 -0
- package/clinkx-workflows/dist/architecture-comparison/runtime.d.ts +29 -0
- package/clinkx-workflows/dist/architecture-comparison/runtime.js +387 -0
- package/clinkx-workflows/dist/architecture-comparison/runtime.js.map +1 -0
- package/clinkx-workflows/dist/contained-file.js +1 -1
- package/clinkx-workflows/dist/contained-file.js.map +1 -1
- package/clinkx-workflows/dist/council-execution-policy.d.ts +4 -2
- package/clinkx-workflows/dist/council-execution-policy.js +5 -1
- package/clinkx-workflows/dist/council-execution-policy.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/activity-contract.d.ts +72 -72
- package/clinkx-workflows/dist/dashboard/contracts.d.ts +1564 -122
- package/clinkx-workflows/dist/dashboard/contracts.js +4 -0
- package/clinkx-workflows/dist/dashboard/contracts.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +12 -12
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.d.ts +8 -8
- package/clinkx-workflows/dist/dashboard/scanner.d.ts +3 -0
- package/clinkx-workflows/dist/dashboard/scanner.js +27 -0
- package/clinkx-workflows/dist/dashboard/scanner.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +48 -48
- package/clinkx-workflows/dist/dashboard/session-log-redaction.d.ts +2 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js +4 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/verified-repair-contract.d.ts +191 -0
- package/clinkx-workflows/dist/dashboard/verified-repair-contract.js +28 -0
- package/clinkx-workflows/dist/dashboard/verified-repair-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/index-BdpmbPps.js +115 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/style-Im5i1iAs.css +1 -0
- package/clinkx-workflows/dist/dashboard-ui/index.html +2 -2
- package/clinkx-workflows/dist/engine.d.ts +6 -0
- package/clinkx-workflows/dist/engine.js +78 -7
- package/clinkx-workflows/dist/engine.js.map +1 -1
- package/clinkx-workflows/dist/index.d.ts +3 -0
- package/clinkx-workflows/dist/index.js +3 -2
- package/clinkx-workflows/dist/index.js.map +1 -1
- package/clinkx-workflows/dist/reducers/index.d.ts +9 -1
- package/clinkx-workflows/dist/reducers/index.js +22 -0
- package/clinkx-workflows/dist/reducers/index.js.map +1 -1
- package/clinkx-workflows/dist/state.js +17 -7
- package/clinkx-workflows/dist/state.js.map +1 -1
- package/clinkx-workflows/dist/validators/architecture-comparison.d.ts +2 -0
- package/clinkx-workflows/dist/validators/architecture-comparison.js +12 -0
- package/clinkx-workflows/dist/validators/architecture-comparison.js.map +1 -0
- package/clinkx-workflows/dist/validators/index.js +4 -0
- package/clinkx-workflows/dist/validators/index.js.map +1 -1
- package/clinkx-workflows/dist/validators/verified-repair.d.ts +2 -0
- package/clinkx-workflows/dist/validators/verified-repair.js +12 -0
- package/clinkx-workflows/dist/validators/verified-repair.js.map +1 -0
- package/clinkx-workflows/dist/verification-proof.d.ts +254 -0
- package/clinkx-workflows/dist/verification-proof.js +195 -0
- package/clinkx-workflows/dist/verification-proof.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/admission.d.ts +72 -0
- package/clinkx-workflows/dist/verified-repair/admission.js +63 -0
- package/clinkx-workflows/dist/verified-repair/admission.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/contract.d.ts +1910 -0
- package/clinkx-workflows/dist/verified-repair/contract.js +127 -0
- package/clinkx-workflows/dist/verified-repair/contract.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/host.d.ts +32 -0
- package/clinkx-workflows/dist/verified-repair/host.js +2 -0
- package/clinkx-workflows/dist/verified-repair/host.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/prompts.d.ts +12 -0
- package/clinkx-workflows/dist/verified-repair/prompts.js +58 -0
- package/clinkx-workflows/dist/verified-repair/prompts.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/result.d.ts +16 -0
- package/clinkx-workflows/dist/verified-repair/result.js +102 -0
- package/clinkx-workflows/dist/verified-repair/result.js.map +1 -0
- package/clinkx-workflows/dist/verified-repair/runtime.d.ts +28 -0
- package/clinkx-workflows/dist/verified-repair/runtime.js +186 -0
- package/clinkx-workflows/dist/verified-repair/runtime.js.map +1 -0
- package/clinkx-workflows/dist/workflow-tools.d.ts +3 -0
- package/clinkx-workflows/dist/workflow-tools.js +148 -14
- package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
- package/clinkx-workflows/dist/workflow-verification-contract.d.ts +539 -0
- package/clinkx-workflows/dist/workflow-verification-contract.js +52 -0
- package/clinkx-workflows/dist/workflow-verification-contract.js.map +1 -0
- package/clinkx-workflows/dist/workflow-verification.d.ts +15 -0
- package/clinkx-workflows/dist/workflow-verification.js +218 -0
- package/clinkx-workflows/dist/workflow-verification.js.map +1 -0
- package/clinkx-workflows/templates/architecture-comparison/candidate.txt +29 -0
- package/clinkx-workflows/templates/architecture-comparison/judge.txt +31 -0
- package/clinkx-workflows/templates/verified-repair/investigate.txt +20 -0
- package/clinkx-workflows/templates/verified-repair/repair.txt +11 -0
- package/clinkx-workflows/templates/verified-repair/review.txt +18 -0
- package/clinkx-workflows/workflows/architecture-comparison.yaml +133 -0
- package/clinkx-workflows/workflows/verified-repair.yaml +104 -0
- package/dist/allowed-roots.js +4 -1
- package/dist/allowed-roots.js.map +1 -1
- package/dist/codex/app-server-client.d.ts +1 -0
- package/dist/codex/app-server-client.js +3 -2
- package/dist/codex/app-server-client.js.map +1 -1
- package/dist/context-builder/diagnostics.d.ts +1 -0
- package/dist/context-builder/diagnostics.js +1 -1
- package/dist/context-builder/diagnostics.js.map +1 -1
- package/dist/context-builder/discovery.d.ts +18 -1
- package/dist/context-builder/discovery.js +69 -1
- package/dist/context-builder/discovery.js.map +1 -1
- package/dist/context-builder/handler.js +8 -1
- package/dist/context-builder/handler.js.map +1 -1
- package/dist/context-builder/lifecycle-contract.d.ts +24 -24
- package/dist/context-builder/refine-handler.js +16 -1
- package/dist/context-builder/refine-handler.js.map +1 -1
- package/dist/context-builder/secrets.d.ts +11 -0
- package/dist/context-builder/secrets.js +81 -1
- package/dist/context-builder/secrets.js.map +1 -1
- package/dist/context-builder/versions.d.ts +5 -2
- package/dist/context-builder/versions.js +5 -2
- package/dist/context-builder/versions.js.map +1 -1
- package/dist/dashboard-cli.js +10 -3
- package/dist/dashboard-cli.js.map +1 -1
- package/dist/dashboard-gateway/main.js +8 -3
- package/dist/dashboard-gateway/main.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/project-verification/contract.d.ts +537 -0
- package/dist/project-verification/contract.js +40 -0
- package/dist/project-verification/contract.js.map +1 -0
- package/dist/project-verification/files.d.ts +23 -0
- package/dist/project-verification/files.js +80 -0
- package/dist/project-verification/files.js.map +1 -0
- package/dist/project-verification/process.d.ts +7 -0
- package/dist/project-verification/process.js +115 -0
- package/dist/project-verification/process.js.map +1 -0
- package/dist/project-verification/runner.d.ts +35 -0
- package/dist/project-verification/runner.js +185 -0
- package/dist/project-verification/runner.js.map +1 -0
- package/dist/project-verification/service.d.ts +37 -0
- package/dist/project-verification/service.js +151 -0
- package/dist/project-verification/service.js.map +1 -0
- package/dist/provider-doctor.d.ts +22 -0
- package/dist/provider-doctor.js +22 -0
- package/dist/provider-doctor.js.map +1 -0
- package/dist/server.js +29 -1
- package/dist/server.js.map +1 -1
- package/dist/verification-tools.d.ts +90 -0
- package/dist/verification-tools.js +120 -0
- package/dist/verification-tools.js.map +1 -0
- package/dist/verified-repair/files.d.ts +22 -0
- package/dist/verified-repair/files.js +114 -0
- package/dist/verified-repair/files.js.map +1 -0
- package/dist/verified-repair/host.d.ts +14 -0
- package/dist/verified-repair/host.js +612 -0
- package/dist/verified-repair/host.js.map +1 -0
- package/docs/configuration.md +493 -0
- package/docs/engineering-recipes.md +415 -0
- package/docs/security.md +293 -0
- package/docs/verification/README.md +59 -0
- package/docs/verification/dashboard-real-disk.md +436 -0
- package/docs/verification/project-checks.example.json +14 -0
- package/docs/verification/project-checks.md +444 -0
- package/docs/verification/workflow-handoff.md +113 -0
- package/package.json +13 -6
- package/scripts/provider-doctor-core.mjs +364 -0
- package/scripts/provider-doctor-probe.mjs +34 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/index-JPHQVtn9.js +0 -106
- package/clinkx-workflows/dist/dashboard-ui/assets/style-DOMHk-j6.css +0 -1
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const RelativeFile: z.ZodEffects<z.ZodString, string, string>;
|
|
3
|
+
export declare const ManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
4
|
+
version: z.ZodLiteral<1>;
|
|
5
|
+
inputs: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
6
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
command: z.ZodEffects<z.ZodString, string, string>;
|
|
9
|
+
args: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
10
|
+
cwd: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<".">, z.ZodEffects<z.ZodString, string, string>]>>;
|
|
11
|
+
timeout_seconds: z.ZodDefault<z.ZodNumber>;
|
|
12
|
+
env_allowlist: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
timeout_seconds: number;
|
|
15
|
+
args: string[];
|
|
16
|
+
command: string;
|
|
17
|
+
env_allowlist: string[];
|
|
18
|
+
cwd: string;
|
|
19
|
+
id: string;
|
|
20
|
+
}, {
|
|
21
|
+
args: string[];
|
|
22
|
+
command: string;
|
|
23
|
+
id: string;
|
|
24
|
+
timeout_seconds?: number | undefined;
|
|
25
|
+
env_allowlist?: string[] | undefined;
|
|
26
|
+
cwd?: string | undefined;
|
|
27
|
+
}>, "many">;
|
|
28
|
+
}, "strict", z.ZodTypeAny, {
|
|
29
|
+
version: 1;
|
|
30
|
+
inputs: string[];
|
|
31
|
+
checks: {
|
|
32
|
+
timeout_seconds: number;
|
|
33
|
+
args: string[];
|
|
34
|
+
command: string;
|
|
35
|
+
env_allowlist: string[];
|
|
36
|
+
cwd: string;
|
|
37
|
+
id: string;
|
|
38
|
+
}[];
|
|
39
|
+
}, {
|
|
40
|
+
version: 1;
|
|
41
|
+
inputs: string[];
|
|
42
|
+
checks: {
|
|
43
|
+
args: string[];
|
|
44
|
+
command: string;
|
|
45
|
+
id: string;
|
|
46
|
+
timeout_seconds?: number | undefined;
|
|
47
|
+
env_allowlist?: string[] | undefined;
|
|
48
|
+
cwd?: string | undefined;
|
|
49
|
+
}[];
|
|
50
|
+
}>, {
|
|
51
|
+
version: 1;
|
|
52
|
+
inputs: string[];
|
|
53
|
+
checks: {
|
|
54
|
+
timeout_seconds: number;
|
|
55
|
+
args: string[];
|
|
56
|
+
command: string;
|
|
57
|
+
env_allowlist: string[];
|
|
58
|
+
cwd: string;
|
|
59
|
+
id: string;
|
|
60
|
+
}[];
|
|
61
|
+
}, {
|
|
62
|
+
version: 1;
|
|
63
|
+
inputs: string[];
|
|
64
|
+
checks: {
|
|
65
|
+
args: string[];
|
|
66
|
+
command: string;
|
|
67
|
+
id: string;
|
|
68
|
+
timeout_seconds?: number | undefined;
|
|
69
|
+
env_allowlist?: string[] | undefined;
|
|
70
|
+
cwd?: string | undefined;
|
|
71
|
+
}[];
|
|
72
|
+
}>;
|
|
73
|
+
export type Manifest = z.infer<typeof ManifestSchema>;
|
|
74
|
+
export declare const FileFactSchema: z.ZodObject<{
|
|
75
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
76
|
+
size_bytes: z.ZodNumber;
|
|
77
|
+
sha256: z.ZodString;
|
|
78
|
+
}, "strict", z.ZodTypeAny, {
|
|
79
|
+
path: string;
|
|
80
|
+
sha256: string;
|
|
81
|
+
size_bytes: number;
|
|
82
|
+
}, {
|
|
83
|
+
path: string;
|
|
84
|
+
sha256: string;
|
|
85
|
+
size_bytes: number;
|
|
86
|
+
}>;
|
|
87
|
+
export declare const ExpectedSchema: z.ZodObject<{
|
|
88
|
+
version: z.ZodLiteral<1>;
|
|
89
|
+
project: z.ZodString;
|
|
90
|
+
manifest_path: z.ZodEffects<z.ZodString, string, string>;
|
|
91
|
+
manifest: z.ZodEffects<z.ZodObject<{
|
|
92
|
+
version: z.ZodLiteral<1>;
|
|
93
|
+
inputs: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
94
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
command: z.ZodEffects<z.ZodString, string, string>;
|
|
97
|
+
args: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
98
|
+
cwd: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<".">, z.ZodEffects<z.ZodString, string, string>]>>;
|
|
99
|
+
timeout_seconds: z.ZodDefault<z.ZodNumber>;
|
|
100
|
+
env_allowlist: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
101
|
+
}, "strict", z.ZodTypeAny, {
|
|
102
|
+
timeout_seconds: number;
|
|
103
|
+
args: string[];
|
|
104
|
+
command: string;
|
|
105
|
+
env_allowlist: string[];
|
|
106
|
+
cwd: string;
|
|
107
|
+
id: string;
|
|
108
|
+
}, {
|
|
109
|
+
args: string[];
|
|
110
|
+
command: string;
|
|
111
|
+
id: string;
|
|
112
|
+
timeout_seconds?: number | undefined;
|
|
113
|
+
env_allowlist?: string[] | undefined;
|
|
114
|
+
cwd?: string | undefined;
|
|
115
|
+
}>, "many">;
|
|
116
|
+
}, "strict", z.ZodTypeAny, {
|
|
117
|
+
version: 1;
|
|
118
|
+
inputs: string[];
|
|
119
|
+
checks: {
|
|
120
|
+
timeout_seconds: number;
|
|
121
|
+
args: string[];
|
|
122
|
+
command: string;
|
|
123
|
+
env_allowlist: string[];
|
|
124
|
+
cwd: string;
|
|
125
|
+
id: string;
|
|
126
|
+
}[];
|
|
127
|
+
}, {
|
|
128
|
+
version: 1;
|
|
129
|
+
inputs: string[];
|
|
130
|
+
checks: {
|
|
131
|
+
args: string[];
|
|
132
|
+
command: string;
|
|
133
|
+
id: string;
|
|
134
|
+
timeout_seconds?: number | undefined;
|
|
135
|
+
env_allowlist?: string[] | undefined;
|
|
136
|
+
cwd?: string | undefined;
|
|
137
|
+
}[];
|
|
138
|
+
}>, {
|
|
139
|
+
version: 1;
|
|
140
|
+
inputs: string[];
|
|
141
|
+
checks: {
|
|
142
|
+
timeout_seconds: number;
|
|
143
|
+
args: string[];
|
|
144
|
+
command: string;
|
|
145
|
+
env_allowlist: string[];
|
|
146
|
+
cwd: string;
|
|
147
|
+
id: string;
|
|
148
|
+
}[];
|
|
149
|
+
}, {
|
|
150
|
+
version: 1;
|
|
151
|
+
inputs: string[];
|
|
152
|
+
checks: {
|
|
153
|
+
args: string[];
|
|
154
|
+
command: string;
|
|
155
|
+
id: string;
|
|
156
|
+
timeout_seconds?: number | undefined;
|
|
157
|
+
env_allowlist?: string[] | undefined;
|
|
158
|
+
cwd?: string | undefined;
|
|
159
|
+
}[];
|
|
160
|
+
}>;
|
|
161
|
+
inputs: z.ZodArray<z.ZodObject<{
|
|
162
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
163
|
+
size_bytes: z.ZodNumber;
|
|
164
|
+
sha256: z.ZodString;
|
|
165
|
+
}, "strict", z.ZodTypeAny, {
|
|
166
|
+
path: string;
|
|
167
|
+
sha256: string;
|
|
168
|
+
size_bytes: number;
|
|
169
|
+
}, {
|
|
170
|
+
path: string;
|
|
171
|
+
sha256: string;
|
|
172
|
+
size_bytes: number;
|
|
173
|
+
}>, "many">;
|
|
174
|
+
node_version: z.ZodString;
|
|
175
|
+
expectations: z.ZodEffects<z.ZodObject<{
|
|
176
|
+
version: z.ZodLiteral<1>;
|
|
177
|
+
identity: z.ZodObject<{
|
|
178
|
+
source_sha256: z.ZodString;
|
|
179
|
+
build_sha256: z.ZodString;
|
|
180
|
+
procedure_sha256: z.ZodString;
|
|
181
|
+
boundary: z.ZodEnum<["workflow-handoff-fixture", "project-command-v1"]>;
|
|
182
|
+
}, "strict", z.ZodTypeAny, {
|
|
183
|
+
source_sha256: string;
|
|
184
|
+
build_sha256: string;
|
|
185
|
+
procedure_sha256: string;
|
|
186
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
187
|
+
}, {
|
|
188
|
+
source_sha256: string;
|
|
189
|
+
build_sha256: string;
|
|
190
|
+
procedure_sha256: string;
|
|
191
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
192
|
+
}>;
|
|
193
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
194
|
+
check_id: z.ZodString;
|
|
195
|
+
attempt_id: z.ZodString;
|
|
196
|
+
producer: z.ZodString;
|
|
197
|
+
artifact_path: z.ZodEffects<z.ZodString, string, string>;
|
|
198
|
+
}, "strict", z.ZodTypeAny, {
|
|
199
|
+
check_id: string;
|
|
200
|
+
artifact_path: string;
|
|
201
|
+
attempt_id: string;
|
|
202
|
+
producer: string;
|
|
203
|
+
}, {
|
|
204
|
+
check_id: string;
|
|
205
|
+
artifact_path: string;
|
|
206
|
+
attempt_id: string;
|
|
207
|
+
producer: string;
|
|
208
|
+
}>, "many">;
|
|
209
|
+
superseded_attempts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
210
|
+
check_id: z.ZodString;
|
|
211
|
+
attempt_id: z.ZodString;
|
|
212
|
+
}, "strict", z.ZodTypeAny, {
|
|
213
|
+
check_id: string;
|
|
214
|
+
attempt_id: string;
|
|
215
|
+
}, {
|
|
216
|
+
check_id: string;
|
|
217
|
+
attempt_id: string;
|
|
218
|
+
}>, "many">>;
|
|
219
|
+
}, "strict", z.ZodTypeAny, {
|
|
220
|
+
version: 1;
|
|
221
|
+
checks: {
|
|
222
|
+
check_id: string;
|
|
223
|
+
artifact_path: string;
|
|
224
|
+
attempt_id: string;
|
|
225
|
+
producer: string;
|
|
226
|
+
}[];
|
|
227
|
+
identity: {
|
|
228
|
+
source_sha256: string;
|
|
229
|
+
build_sha256: string;
|
|
230
|
+
procedure_sha256: string;
|
|
231
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
232
|
+
};
|
|
233
|
+
superseded_attempts: {
|
|
234
|
+
check_id: string;
|
|
235
|
+
attempt_id: string;
|
|
236
|
+
}[];
|
|
237
|
+
}, {
|
|
238
|
+
version: 1;
|
|
239
|
+
checks: {
|
|
240
|
+
check_id: string;
|
|
241
|
+
artifact_path: string;
|
|
242
|
+
attempt_id: string;
|
|
243
|
+
producer: string;
|
|
244
|
+
}[];
|
|
245
|
+
identity: {
|
|
246
|
+
source_sha256: string;
|
|
247
|
+
build_sha256: string;
|
|
248
|
+
procedure_sha256: string;
|
|
249
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
250
|
+
};
|
|
251
|
+
superseded_attempts?: {
|
|
252
|
+
check_id: string;
|
|
253
|
+
attempt_id: string;
|
|
254
|
+
}[] | undefined;
|
|
255
|
+
}>, {
|
|
256
|
+
version: 1;
|
|
257
|
+
checks: {
|
|
258
|
+
check_id: string;
|
|
259
|
+
artifact_path: string;
|
|
260
|
+
attempt_id: string;
|
|
261
|
+
producer: string;
|
|
262
|
+
}[];
|
|
263
|
+
identity: {
|
|
264
|
+
source_sha256: string;
|
|
265
|
+
build_sha256: string;
|
|
266
|
+
procedure_sha256: string;
|
|
267
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
268
|
+
};
|
|
269
|
+
superseded_attempts: {
|
|
270
|
+
check_id: string;
|
|
271
|
+
attempt_id: string;
|
|
272
|
+
}[];
|
|
273
|
+
}, {
|
|
274
|
+
version: 1;
|
|
275
|
+
checks: {
|
|
276
|
+
check_id: string;
|
|
277
|
+
artifact_path: string;
|
|
278
|
+
attempt_id: string;
|
|
279
|
+
producer: string;
|
|
280
|
+
}[];
|
|
281
|
+
identity: {
|
|
282
|
+
source_sha256: string;
|
|
283
|
+
build_sha256: string;
|
|
284
|
+
procedure_sha256: string;
|
|
285
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
286
|
+
};
|
|
287
|
+
superseded_attempts?: {
|
|
288
|
+
check_id: string;
|
|
289
|
+
attempt_id: string;
|
|
290
|
+
}[] | undefined;
|
|
291
|
+
}>;
|
|
292
|
+
}, "strict", z.ZodTypeAny, {
|
|
293
|
+
version: 1;
|
|
294
|
+
inputs: {
|
|
295
|
+
path: string;
|
|
296
|
+
sha256: string;
|
|
297
|
+
size_bytes: number;
|
|
298
|
+
}[];
|
|
299
|
+
project: string;
|
|
300
|
+
manifest_path: string;
|
|
301
|
+
manifest: {
|
|
302
|
+
version: 1;
|
|
303
|
+
inputs: string[];
|
|
304
|
+
checks: {
|
|
305
|
+
timeout_seconds: number;
|
|
306
|
+
args: string[];
|
|
307
|
+
command: string;
|
|
308
|
+
env_allowlist: string[];
|
|
309
|
+
cwd: string;
|
|
310
|
+
id: string;
|
|
311
|
+
}[];
|
|
312
|
+
};
|
|
313
|
+
node_version: string;
|
|
314
|
+
expectations: {
|
|
315
|
+
version: 1;
|
|
316
|
+
checks: {
|
|
317
|
+
check_id: string;
|
|
318
|
+
artifact_path: string;
|
|
319
|
+
attempt_id: string;
|
|
320
|
+
producer: string;
|
|
321
|
+
}[];
|
|
322
|
+
identity: {
|
|
323
|
+
source_sha256: string;
|
|
324
|
+
build_sha256: string;
|
|
325
|
+
procedure_sha256: string;
|
|
326
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
327
|
+
};
|
|
328
|
+
superseded_attempts: {
|
|
329
|
+
check_id: string;
|
|
330
|
+
attempt_id: string;
|
|
331
|
+
}[];
|
|
332
|
+
};
|
|
333
|
+
}, {
|
|
334
|
+
version: 1;
|
|
335
|
+
inputs: {
|
|
336
|
+
path: string;
|
|
337
|
+
sha256: string;
|
|
338
|
+
size_bytes: number;
|
|
339
|
+
}[];
|
|
340
|
+
project: string;
|
|
341
|
+
manifest_path: string;
|
|
342
|
+
manifest: {
|
|
343
|
+
version: 1;
|
|
344
|
+
inputs: string[];
|
|
345
|
+
checks: {
|
|
346
|
+
args: string[];
|
|
347
|
+
command: string;
|
|
348
|
+
id: string;
|
|
349
|
+
timeout_seconds?: number | undefined;
|
|
350
|
+
env_allowlist?: string[] | undefined;
|
|
351
|
+
cwd?: string | undefined;
|
|
352
|
+
}[];
|
|
353
|
+
};
|
|
354
|
+
node_version: string;
|
|
355
|
+
expectations: {
|
|
356
|
+
version: 1;
|
|
357
|
+
checks: {
|
|
358
|
+
check_id: string;
|
|
359
|
+
artifact_path: string;
|
|
360
|
+
attempt_id: string;
|
|
361
|
+
producer: string;
|
|
362
|
+
}[];
|
|
363
|
+
identity: {
|
|
364
|
+
source_sha256: string;
|
|
365
|
+
build_sha256: string;
|
|
366
|
+
procedure_sha256: string;
|
|
367
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
368
|
+
};
|
|
369
|
+
superseded_attempts?: {
|
|
370
|
+
check_id: string;
|
|
371
|
+
attempt_id: string;
|
|
372
|
+
}[] | undefined;
|
|
373
|
+
};
|
|
374
|
+
}>;
|
|
375
|
+
export declare const ResultSchema: z.ZodObject<{
|
|
376
|
+
version: z.ZodLiteral<1>;
|
|
377
|
+
check_id: z.ZodString;
|
|
378
|
+
attempt_id: z.ZodString;
|
|
379
|
+
source_before_sha256: z.ZodString;
|
|
380
|
+
source_after_sha256: z.ZodNullable<z.ZodString>;
|
|
381
|
+
exit_code: z.ZodNullable<z.ZodNumber>;
|
|
382
|
+
signal: z.ZodNullable<z.ZodString>;
|
|
383
|
+
reason: z.ZodEnum<["passed", "nonzero_exit", "spawn_error", "timeout", "cancelled", "capture_limit", "cleanup_failure"]>;
|
|
384
|
+
cleanup_ok: z.ZodBoolean;
|
|
385
|
+
stdout: z.ZodObject<{
|
|
386
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
387
|
+
size_bytes: z.ZodNumber;
|
|
388
|
+
sha256: z.ZodString;
|
|
389
|
+
}, "strict", z.ZodTypeAny, {
|
|
390
|
+
path: string;
|
|
391
|
+
sha256: string;
|
|
392
|
+
size_bytes: number;
|
|
393
|
+
}, {
|
|
394
|
+
path: string;
|
|
395
|
+
sha256: string;
|
|
396
|
+
size_bytes: number;
|
|
397
|
+
}>;
|
|
398
|
+
stderr: z.ZodObject<{
|
|
399
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
400
|
+
size_bytes: z.ZodNumber;
|
|
401
|
+
sha256: z.ZodString;
|
|
402
|
+
}, "strict", z.ZodTypeAny, {
|
|
403
|
+
path: string;
|
|
404
|
+
sha256: string;
|
|
405
|
+
size_bytes: number;
|
|
406
|
+
}, {
|
|
407
|
+
path: string;
|
|
408
|
+
sha256: string;
|
|
409
|
+
size_bytes: number;
|
|
410
|
+
}>;
|
|
411
|
+
}, "strict", z.ZodTypeAny, {
|
|
412
|
+
reason: "cancelled" | "timeout" | "passed" | "nonzero_exit" | "spawn_error" | "capture_limit" | "cleanup_failure";
|
|
413
|
+
version: 1;
|
|
414
|
+
signal: string | null;
|
|
415
|
+
stdout: {
|
|
416
|
+
path: string;
|
|
417
|
+
sha256: string;
|
|
418
|
+
size_bytes: number;
|
|
419
|
+
};
|
|
420
|
+
stderr: {
|
|
421
|
+
path: string;
|
|
422
|
+
sha256: string;
|
|
423
|
+
size_bytes: number;
|
|
424
|
+
};
|
|
425
|
+
check_id: string;
|
|
426
|
+
attempt_id: string;
|
|
427
|
+
source_before_sha256: string;
|
|
428
|
+
source_after_sha256: string | null;
|
|
429
|
+
exit_code: number | null;
|
|
430
|
+
cleanup_ok: boolean;
|
|
431
|
+
}, {
|
|
432
|
+
reason: "cancelled" | "timeout" | "passed" | "nonzero_exit" | "spawn_error" | "capture_limit" | "cleanup_failure";
|
|
433
|
+
version: 1;
|
|
434
|
+
signal: string | null;
|
|
435
|
+
stdout: {
|
|
436
|
+
path: string;
|
|
437
|
+
sha256: string;
|
|
438
|
+
size_bytes: number;
|
|
439
|
+
};
|
|
440
|
+
stderr: {
|
|
441
|
+
path: string;
|
|
442
|
+
sha256: string;
|
|
443
|
+
size_bytes: number;
|
|
444
|
+
};
|
|
445
|
+
check_id: string;
|
|
446
|
+
attempt_id: string;
|
|
447
|
+
source_before_sha256: string;
|
|
448
|
+
source_after_sha256: string | null;
|
|
449
|
+
exit_code: number | null;
|
|
450
|
+
cleanup_ok: boolean;
|
|
451
|
+
}>;
|
|
452
|
+
export declare const ObservationsSchema: z.ZodArray<z.ZodObject<{
|
|
453
|
+
check_id: z.ZodString;
|
|
454
|
+
attempt_id: z.ZodString;
|
|
455
|
+
producer: z.ZodString;
|
|
456
|
+
identity: z.ZodObject<{
|
|
457
|
+
source_sha256: z.ZodString;
|
|
458
|
+
build_sha256: z.ZodString;
|
|
459
|
+
procedure_sha256: z.ZodString;
|
|
460
|
+
boundary: z.ZodEnum<["workflow-handoff-fixture", "project-command-v1"]>;
|
|
461
|
+
}, "strict", z.ZodTypeAny, {
|
|
462
|
+
source_sha256: string;
|
|
463
|
+
build_sha256: string;
|
|
464
|
+
procedure_sha256: string;
|
|
465
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
466
|
+
}, {
|
|
467
|
+
source_sha256: string;
|
|
468
|
+
build_sha256: string;
|
|
469
|
+
procedure_sha256: string;
|
|
470
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
471
|
+
}>;
|
|
472
|
+
provenance: z.ZodEnum<["trusted_host", "provider"]>;
|
|
473
|
+
result: z.ZodEnum<["passed", "failed", "producer_failed", "evidence_missing"]>;
|
|
474
|
+
artifact: z.ZodOptional<z.ZodObject<{
|
|
475
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
476
|
+
size_bytes: z.ZodNumber;
|
|
477
|
+
sha256: z.ZodString;
|
|
478
|
+
}, "strict", z.ZodTypeAny, {
|
|
479
|
+
path: string;
|
|
480
|
+
sha256: string;
|
|
481
|
+
size_bytes: number;
|
|
482
|
+
}, {
|
|
483
|
+
path: string;
|
|
484
|
+
sha256: string;
|
|
485
|
+
size_bytes: number;
|
|
486
|
+
}>>;
|
|
487
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
488
|
+
}, "strict", z.ZodTypeAny, {
|
|
489
|
+
result: "failed" | "passed" | "producer_failed" | "evidence_missing";
|
|
490
|
+
provenance: "trusted_host" | "provider";
|
|
491
|
+
check_id: string;
|
|
492
|
+
identity: {
|
|
493
|
+
source_sha256: string;
|
|
494
|
+
build_sha256: string;
|
|
495
|
+
procedure_sha256: string;
|
|
496
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
497
|
+
};
|
|
498
|
+
attempt_id: string;
|
|
499
|
+
producer: string;
|
|
500
|
+
reason?: string | undefined;
|
|
501
|
+
artifact?: {
|
|
502
|
+
path: string;
|
|
503
|
+
sha256: string;
|
|
504
|
+
size_bytes: number;
|
|
505
|
+
} | undefined;
|
|
506
|
+
}, {
|
|
507
|
+
result: "failed" | "passed" | "producer_failed" | "evidence_missing";
|
|
508
|
+
provenance: "trusted_host" | "provider";
|
|
509
|
+
check_id: string;
|
|
510
|
+
identity: {
|
|
511
|
+
source_sha256: string;
|
|
512
|
+
build_sha256: string;
|
|
513
|
+
procedure_sha256: string;
|
|
514
|
+
boundary: "workflow-handoff-fixture" | "project-command-v1";
|
|
515
|
+
};
|
|
516
|
+
attempt_id: string;
|
|
517
|
+
producer: string;
|
|
518
|
+
reason?: string | undefined;
|
|
519
|
+
artifact?: {
|
|
520
|
+
path: string;
|
|
521
|
+
sha256: string;
|
|
522
|
+
size_bytes: number;
|
|
523
|
+
} | undefined;
|
|
524
|
+
}>, "many">;
|
|
525
|
+
export declare const CompletionSchema: z.ZodObject<{
|
|
526
|
+
version: z.ZodLiteral<1>;
|
|
527
|
+
observations_sha256: z.ZodString;
|
|
528
|
+
interrupted_signal: z.ZodNullable<z.ZodEnum<["SIGINT", "SIGTERM", "cancelled"]>>;
|
|
529
|
+
}, "strict", z.ZodTypeAny, {
|
|
530
|
+
version: 1;
|
|
531
|
+
observations_sha256: string;
|
|
532
|
+
interrupted_signal: "cancelled" | "SIGINT" | "SIGTERM" | null;
|
|
533
|
+
}, {
|
|
534
|
+
version: 1;
|
|
535
|
+
observations_sha256: string;
|
|
536
|
+
interrupted_signal: "cancelled" | "SIGINT" | "SIGTERM" | null;
|
|
537
|
+
}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { VerificationExpectationsSchema, VerificationObservationSchema } from "../../clinkx-workflows/dist/verification-proof.js";
|
|
3
|
+
export const RelativeFile = z.string().min(1).max(512).refine((value) => !value.includes("\\") && !/^[A-Za-z]:/.test(value) && !/[\u0000-\u001f\u007f]/.test(value)
|
|
4
|
+
&& value.split("/").every((part) => part !== "" && part !== "." && part !== ".."), "expected a project-relative path without traversal");
|
|
5
|
+
const Identifier = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/);
|
|
6
|
+
const Digest = z.string().regex(/^[a-f0-9]{64}$/);
|
|
7
|
+
export const ManifestSchema = z.object({
|
|
8
|
+
version: z.literal(1),
|
|
9
|
+
inputs: z.array(RelativeFile).min(1).max(1000),
|
|
10
|
+
checks: z.array(z.object({
|
|
11
|
+
id: Identifier,
|
|
12
|
+
command: z.string().min(1).max(4096).refine((value) => !value.includes("\0")),
|
|
13
|
+
args: z.array(z.string().max(8192).refine((value) => !value.includes("\0"))).max(100),
|
|
14
|
+
cwd: z.union([z.literal("."), RelativeFile]).default("."),
|
|
15
|
+
timeout_seconds: z.number().int().min(1).max(3600).default(300),
|
|
16
|
+
env_allowlist: z.array(z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/)).max(100).default([]),
|
|
17
|
+
}).strict()).min(1).max(100),
|
|
18
|
+
}).strict().superRefine((value, context) => {
|
|
19
|
+
for (const [name, entries] of [["inputs", value.inputs], ["checks", value.checks.map((check) => check.id)]]) {
|
|
20
|
+
if (new Set(entries).size !== entries.length)
|
|
21
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: [name], message: "duplicate entry" });
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export const FileFactSchema = z.object({ path: RelativeFile, size_bytes: z.number().int().min(0).max(16 * 1024 * 1024), sha256: Digest }).strict();
|
|
25
|
+
export const ExpectedSchema = z.object({
|
|
26
|
+
version: z.literal(1), project: z.string().min(1), manifest_path: RelativeFile,
|
|
27
|
+
manifest: ManifestSchema, inputs: z.array(FileFactSchema).min(1).max(1000),
|
|
28
|
+
node_version: z.string().min(1), expectations: VerificationExpectationsSchema,
|
|
29
|
+
}).strict();
|
|
30
|
+
export const ResultSchema = z.object({
|
|
31
|
+
version: z.literal(1), check_id: Identifier, attempt_id: z.string().min(1).max(128),
|
|
32
|
+
source_before_sha256: Digest, source_after_sha256: Digest.nullable(),
|
|
33
|
+
exit_code: z.number().int().nullable(), signal: z.string().nullable(),
|
|
34
|
+
reason: z.enum(["passed", "nonzero_exit", "spawn_error", "timeout", "cancelled", "capture_limit", "cleanup_failure"]),
|
|
35
|
+
cleanup_ok: z.boolean(), stdout: FileFactSchema, stderr: FileFactSchema,
|
|
36
|
+
}).strict();
|
|
37
|
+
export const ObservationsSchema = z.array(VerificationObservationSchema).max(100);
|
|
38
|
+
export const CompletionSchema = z.object({ version: z.literal(1), observations_sha256: Digest,
|
|
39
|
+
interrupted_signal: z.enum(["SIGINT", "SIGTERM", "cancelled"]).nullable() }).strict();
|
|
40
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/project-verification/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,8BAA8B,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAElI,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CACtE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC;OACvF,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,EACnF,oDAAoD,CAAC,CAAC;AACtD,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;AACxE,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IAC9C,MAAM,EAA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=> string;
|
|
4
|
+
export declare function inside(root: string, target: string): boolean;
|
|
5
|
+
export declare function safePath(root: string, path: string, directory?: boolean): string;
|
|
6
|
+
export declare function readBounded(root: string, path: string, cap?: number): Buffer;
|
|
7
|
+
export declare function fileFact(root: string, path: string): {
|
|
8
|
+
path: string;
|
|
9
|
+
size_bytes: number;
|
|
10
|
+
sha256: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function snapshot(project: string, manifest: Manifest): {
|
|
13
|
+
path: string;
|
|
14
|
+
size_bytes: number;
|
|
15
|
+
sha256: string;
|
|
16
|
+
}[];
|
|
17
|
+
export declare function readManifest(project: string, path: string): {
|
|
18
|
+
manifest: Manifest;
|
|
19
|
+
sha256: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function save(root: string, path: string, value: unknown): void;
|
|
22
|
+
export declare const PACKAGE_ROOT: string;
|
|
23
|
+
export declare function runtimeDigest(): string;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { closeSync, constants, fstatSync, lstatSync, openSync, readSync, realpathSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { ManifestSchema } from "./contract.js";
|
|
6
|
+
export const sha = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
7
|
+
export const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
|
8
|
+
export function inside(root, target) {
|
|
9
|
+
const path = relative(root, target);
|
|
10
|
+
return path === "" || (!isAbsolute(path) && path !== ".." && !path.startsWith(`..${sep}`));
|
|
11
|
+
}
|
|
12
|
+
export function safePath(root, path, directory = false) {
|
|
13
|
+
const target = resolve(root, path);
|
|
14
|
+
if (!inside(root, target))
|
|
15
|
+
throw Object.assign(new Error("path escapes its root"), { code: "E_PATH_UNSAFE" });
|
|
16
|
+
let current = root;
|
|
17
|
+
for (const part of relative(root, target).split(sep).filter(Boolean)) {
|
|
18
|
+
current = join(current, part);
|
|
19
|
+
if (lstatSync(current).isSymbolicLink())
|
|
20
|
+
throw Object.assign(new Error("symlink paths are not supported"), { code: "E_PATH_UNSAFE" });
|
|
21
|
+
}
|
|
22
|
+
const info = lstatSync(target);
|
|
23
|
+
if (directory ? !info.isDirectory() : !info.isFile())
|
|
24
|
+
throw new Error("path has the wrong file type");
|
|
25
|
+
return target;
|
|
26
|
+
}
|
|
27
|
+
export function readBounded(root, path, cap = 16 * 1024 * 1024) {
|
|
28
|
+
const fd = openSync(safePath(root, path), constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
29
|
+
try {
|
|
30
|
+
const info = fstatSync(fd);
|
|
31
|
+
if (!info.isFile() || info.size > cap)
|
|
32
|
+
throw new Error("input exceeds its file bound");
|
|
33
|
+
const bytes = Buffer.alloc(info.size + 1);
|
|
34
|
+
let count = 0;
|
|
35
|
+
while (count < bytes.length) {
|
|
36
|
+
const read = readSync(fd, bytes, count, bytes.length - count, null);
|
|
37
|
+
if (read === 0)
|
|
38
|
+
break;
|
|
39
|
+
count += read;
|
|
40
|
+
}
|
|
41
|
+
if (count !== info.size)
|
|
42
|
+
throw new Error("input changed size while reading");
|
|
43
|
+
return bytes.subarray(0, count);
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
closeSync(fd);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function fileFact(root, path) {
|
|
50
|
+
const bytes = readBounded(root, path);
|
|
51
|
+
return { path, size_bytes: bytes.length, sha256: sha(bytes) };
|
|
52
|
+
}
|
|
53
|
+
export function snapshot(project, manifest) {
|
|
54
|
+
let total = 0;
|
|
55
|
+
return manifest.inputs.map((path) => {
|
|
56
|
+
const fact = fileFact(project, path);
|
|
57
|
+
total += fact.size_bytes;
|
|
58
|
+
if (total > 64 * 1024 * 1024)
|
|
59
|
+
throw new Error("declared inputs exceed 64 MiB");
|
|
60
|
+
return fact;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export function readManifest(project, path) {
|
|
64
|
+
const bytes = readBounded(project, path, 256 * 1024);
|
|
65
|
+
return { manifest: ManifestSchema.parse(JSON.parse(bytes.toString("utf8"))), sha256: sha(bytes) };
|
|
66
|
+
}
|
|
67
|
+
export function save(root, path, value) {
|
|
68
|
+
writeFileSync(join(root, path), json(value), { mode: 0o600, flag: "wx" });
|
|
69
|
+
}
|
|
70
|
+
export const PACKAGE_ROOT = realpathSync(fileURLToPath(new URL("../../", import.meta.url)));
|
|
71
|
+
export function runtimeDigest() {
|
|
72
|
+
const paths = ["package.json", "dist/verification-tools.js", "dist/provider-doctor.js", "dist/project-verification/contract.js",
|
|
73
|
+
"dist/project-verification/files.js", "dist/project-verification/process.js", "dist/project-verification/runner.js",
|
|
74
|
+
"dist/project-verification/service.js", "dist/verified-repair/host.js", "dist/verified-repair/files.js", "dist/allowed-roots.js",
|
|
75
|
+
"clinkx-workflows/dist/verified-repair/contract.js", "clinkx-workflows/dist/contained-file.js", "dist/context-builder/secrets.js",
|
|
76
|
+
"clinkx-workflows/dist/dashboard/session-log-redaction.js",
|
|
77
|
+
"clinkx-workflows/dist/verification-proof.js", "scripts/provider-doctor-core.mjs", "scripts/provider-doctor-probe.mjs"];
|
|
78
|
+
return sha(json(paths.map((path) => fileFact(PACKAGE_ROOT, path))));
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=files.js.map
|