@dsh-enhanced/plugin-control-plane 0.1.48 → 0.1.53
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 +187 -15
- package/bin/dsh-live-qualification-authority.js +15 -0
- package/bin/dsh-local-release-adapter.js +331 -9
- package/bin/dsh-systemd-host-attestor.js +359 -9
- package/bin/dsh-systemd-host-authority.js +12 -0
- package/lib/adoption-coordinator.d.ts +3 -1
- package/lib/adoption-coordinator.d.ts.map +1 -1
- package/lib/adoption-coordinator.js +24 -9
- package/lib/adoption-coordinator.js.map +1 -1
- package/lib/cli.d.ts.map +1 -1
- package/lib/cli.js +33 -14
- package/lib/cli.js.map +1 -1
- package/lib/creation-capability-feedback.d.ts +23 -0
- package/lib/creation-capability-feedback.d.ts.map +1 -0
- package/lib/creation-capability-feedback.js +132 -0
- package/lib/creation-capability-feedback.js.map +1 -0
- package/lib/creation-capability-journal.d.ts +66 -0
- package/lib/creation-capability-journal.d.ts.map +1 -0
- package/lib/creation-capability-journal.js +775 -0
- package/lib/creation-capability-journal.js.map +1 -0
- package/lib/creation-capability-runtime.d.ts +63 -0
- package/lib/creation-capability-runtime.d.ts.map +1 -0
- package/lib/creation-capability-runtime.js +578 -0
- package/lib/creation-capability-runtime.js.map +1 -0
- package/lib/creation-capability-source.d.ts +37 -0
- package/lib/creation-capability-source.d.ts.map +1 -0
- package/lib/creation-capability-source.js +328 -0
- package/lib/creation-capability-source.js.map +1 -0
- package/lib/creation-capability-types.d.ts +265 -0
- package/lib/creation-capability-types.d.ts.map +1 -0
- package/lib/creation-capability-types.js +2 -0
- package/lib/creation-capability-types.js.map +1 -0
- package/lib/deployment-readiness.d.ts +16 -0
- package/lib/deployment-readiness.d.ts.map +1 -1
- package/lib/deployment-readiness.js +48 -1
- package/lib/deployment-readiness.js.map +1 -1
- package/lib/effect-blocked-replay.js +2 -2
- package/lib/effect-blocked-replay.js.map +1 -1
- package/lib/foreground-deployment-runtime.d.ts +3 -0
- package/lib/foreground-deployment-runtime.d.ts.map +1 -1
- package/lib/foreground-deployment-runtime.js +55 -13
- package/lib/foreground-deployment-runtime.js.map +1 -1
- package/lib/foreground-deployment.d.ts.map +1 -1
- package/lib/foreground-deployment.js +5 -0
- package/lib/foreground-deployment.js.map +1 -1
- package/lib/host-attestor.d.ts +2 -0
- package/lib/host-attestor.d.ts.map +1 -1
- package/lib/host-attestor.js +8 -1
- package/lib/host-attestor.js.map +1 -1
- package/lib/host-inputs.d.ts +13 -0
- package/lib/host-inputs.d.ts.map +1 -0
- package/lib/host-inputs.js +162 -0
- package/lib/host-inputs.js.map +1 -0
- package/lib/host-maintenance.d.ts +61 -0
- package/lib/host-maintenance.d.ts.map +1 -0
- package/lib/host-maintenance.js +158 -0
- package/lib/host-maintenance.js.map +1 -0
- package/lib/host-readiness.d.ts +5 -0
- package/lib/host-readiness.d.ts.map +1 -0
- package/lib/host-readiness.js +22 -0
- package/lib/host-readiness.js.map +1 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -1
- package/lib/live-qualification-authority.d.ts +32 -0
- package/lib/live-qualification-authority.d.ts.map +1 -0
- package/lib/live-qualification-authority.js +280 -0
- package/lib/live-qualification-authority.js.map +1 -0
- package/lib/live-qualification-client.d.ts +4 -0
- package/lib/live-qualification-client.d.ts.map +1 -0
- package/lib/live-qualification-client.js +22 -0
- package/lib/live-qualification-client.js.map +1 -0
- package/lib/live-qualification-runtime.d.ts +78 -0
- package/lib/live-qualification-runtime.d.ts.map +1 -0
- package/lib/live-qualification-runtime.js +367 -0
- package/lib/live-qualification-runtime.js.map +1 -0
- package/lib/live-qualification.d.ts +73 -0
- package/lib/live-qualification.d.ts.map +1 -0
- package/lib/live-qualification.js +164 -0
- package/lib/live-qualification.js.map +1 -0
- package/lib/native-source-build-worker.d.ts +4 -0
- package/lib/native-source-build-worker.d.ts.map +1 -0
- package/lib/native-source-build-worker.js +87 -0
- package/lib/native-source-build-worker.js.map +1 -0
- package/lib/native-source-build.d.ts +36 -0
- package/lib/native-source-build.d.ts.map +1 -0
- package/lib/native-source-build.js +143 -0
- package/lib/native-source-build.js.map +1 -0
- package/lib/native-source-pack.d.ts +11 -0
- package/lib/native-source-pack.d.ts.map +1 -0
- package/lib/native-source-pack.js +83 -0
- package/lib/native-source-pack.js.map +1 -0
- package/lib/owner-task-gaps.d.ts +2 -0
- package/lib/owner-task-gaps.d.ts.map +1 -1
- package/lib/owner-task-gaps.js +9 -1
- package/lib/owner-task-gaps.js.map +1 -1
- package/lib/runtime-epoch.d.ts +69 -0
- package/lib/runtime-epoch.d.ts.map +1 -0
- package/lib/runtime-epoch.js +139 -0
- package/lib/runtime-epoch.js.map +1 -0
- package/lib/runtime-observer-protocol.d.ts +3 -3
- package/lib/runtime-observer-protocol.js +5 -5
- package/lib/runtime-observer-protocol.js.map +1 -1
- package/lib/runtime-observer.d.ts.map +1 -1
- package/lib/runtime-observer.js +42 -6
- package/lib/runtime-observer.js.map +1 -1
- package/lib/service.d.ts +248 -4
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +1431 -64
- package/lib/service.js.map +1 -1
- package/lib/source-adoption-authority.d.ts +3 -0
- package/lib/source-adoption-authority.d.ts.map +1 -1
- package/lib/source-adoption-authority.js +13 -3
- package/lib/source-adoption-authority.js.map +1 -1
- package/lib/source-adoption-runner.d.ts +3 -0
- package/lib/source-adoption-runner.d.ts.map +1 -1
- package/lib/source-adoption-runner.js +16 -4
- package/lib/source-adoption-runner.js.map +1 -1
- package/lib/source-approval-authority.d.ts.map +1 -1
- package/lib/source-approval-authority.js +1 -0
- package/lib/source-approval-authority.js.map +1 -1
- package/lib/source-baseline.d.ts +37 -0
- package/lib/source-baseline.d.ts.map +1 -0
- package/lib/source-baseline.js +250 -0
- package/lib/source-baseline.js.map +1 -0
- package/lib/source-build.d.ts +43 -9
- package/lib/source-build.d.ts.map +1 -1
- package/lib/source-build.js +670 -57
- package/lib/source-build.js.map +1 -1
- package/lib/source-context.d.ts +18 -0
- package/lib/source-context.d.ts.map +1 -1
- package/lib/source-context.js +85 -11
- package/lib/source-context.js.map +1 -1
- package/lib/source-creation.d.ts +106 -0
- package/lib/source-creation.d.ts.map +1 -0
- package/lib/source-creation.js +664 -0
- package/lib/source-creation.js.map +1 -0
- package/lib/source-job-types.d.ts +28 -1
- package/lib/source-job-types.d.ts.map +1 -1
- package/lib/source-jobs.d.ts +33 -3
- package/lib/source-jobs.d.ts.map +1 -1
- package/lib/source-jobs.js +420 -43
- package/lib/source-jobs.js.map +1 -1
- package/lib/source-maintenance.d.ts +66 -0
- package/lib/source-maintenance.d.ts.map +1 -0
- package/lib/source-maintenance.js +177 -0
- package/lib/source-maintenance.js.map +1 -0
- package/lib/source-revision.d.ts +57 -0
- package/lib/source-revision.d.ts.map +1 -0
- package/lib/source-revision.js +175 -0
- package/lib/source-revision.js.map +1 -0
- package/lib/source-workspace.d.ts +19 -14
- package/lib/source-workspace.d.ts.map +1 -1
- package/lib/source-workspace.js +90 -17
- package/lib/source-workspace.js.map +1 -1
- package/lib/sqlite.d.ts +13 -3
- package/lib/sqlite.d.ts.map +1 -1
- package/lib/sqlite.js +362 -1
- package/lib/sqlite.js.map +1 -1
- package/lib/store.d.ts +258 -3
- package/lib/store.d.ts.map +1 -1
- package/lib/store.js +2257 -96
- package/lib/store.js.map +1 -1
- package/lib/systemd-host-authority.d.ts +68 -0
- package/lib/systemd-host-authority.d.ts.map +1 -0
- package/lib/systemd-host-authority.js +424 -0
- package/lib/systemd-host-authority.js.map +1 -0
- package/lib/task-observation-evidence.d.ts +32 -0
- package/lib/task-observation-evidence.d.ts.map +1 -0
- package/lib/task-observation-evidence.js +62 -0
- package/lib/task-observation-evidence.js.map +1 -0
- package/lib/task-observation-runtime.d.ts +2 -3
- package/lib/task-observation-runtime.d.ts.map +1 -1
- package/lib/task-observation-runtime.js +7 -39
- package/lib/task-observation-runtime.js.map +1 -1
- package/lib/task-observation-store.js +1 -1
- package/lib/trust.d.ts.map +1 -1
- package/lib/trust.js +0 -0
- package/lib/trust.js.map +1 -1
- package/lib/types.d.ts +57 -7
- package/lib/types.d.ts.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +22 -14
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { TaskObservationOwner, TaskObservationVote } from './task-observation-types.js';
|
|
2
|
+
export interface LiveQualificationTerms {
|
|
3
|
+
protocol: 'dsh-bounded-live/v1';
|
|
4
|
+
maximumWindowMs: number;
|
|
5
|
+
minimumTasks: number;
|
|
6
|
+
authority: string;
|
|
7
|
+
keyId: string;
|
|
8
|
+
}
|
|
9
|
+
/** A finite, profile-wide pre-adoption observation; no exposure cap is implied. */
|
|
10
|
+
export interface LiveQualificationBatch {
|
|
11
|
+
schemaVersion: 1;
|
|
12
|
+
kind: 'dsh-live-qualification';
|
|
13
|
+
id: string;
|
|
14
|
+
digest: string;
|
|
15
|
+
lane: string;
|
|
16
|
+
configDigest: string;
|
|
17
|
+
trustDigest: string;
|
|
18
|
+
planId: string;
|
|
19
|
+
planDigest: string;
|
|
20
|
+
installationId: string;
|
|
21
|
+
profilePath: string;
|
|
22
|
+
owner: TaskObservationOwner;
|
|
23
|
+
terms: LiveQualificationTerms;
|
|
24
|
+
activationId: string;
|
|
25
|
+
fence: number;
|
|
26
|
+
startedAt: number;
|
|
27
|
+
deadlineAt: number;
|
|
28
|
+
readinessDigest: string;
|
|
29
|
+
hostGeneration: number;
|
|
30
|
+
votes: readonly TaskObservationVote[];
|
|
31
|
+
createdAt: number;
|
|
32
|
+
expiresAt: number;
|
|
33
|
+
}
|
|
34
|
+
export interface LiveQualificationReceipt {
|
|
35
|
+
schemaVersion: 1;
|
|
36
|
+
kind: 'dsh-live-qualification-receipt';
|
|
37
|
+
receiptId: string;
|
|
38
|
+
authority: string;
|
|
39
|
+
keyId: string;
|
|
40
|
+
batchId: string;
|
|
41
|
+
batchDigest: string;
|
|
42
|
+
planId: string;
|
|
43
|
+
planDigest: string;
|
|
44
|
+
activationId: string;
|
|
45
|
+
fence: number;
|
|
46
|
+
hostGeneration: number;
|
|
47
|
+
disposition: 'qualified' | 'failed';
|
|
48
|
+
observedAt: number;
|
|
49
|
+
expiresAt: number;
|
|
50
|
+
signature: string;
|
|
51
|
+
}
|
|
52
|
+
export interface LiveQualificationRequest {
|
|
53
|
+
protocol: 'dsh-live-qualification/v1';
|
|
54
|
+
batchId: string;
|
|
55
|
+
batchDigest: string;
|
|
56
|
+
}
|
|
57
|
+
export interface LiveQualificationRecord {
|
|
58
|
+
batch: LiveQualificationBatch;
|
|
59
|
+
state: 'pending' | 'signed' | 'applied' | 'stale';
|
|
60
|
+
receipt?: LiveQualificationReceipt;
|
|
61
|
+
}
|
|
62
|
+
export declare function validateLiveQualificationTerms(value: unknown): asserts value is LiveQualificationTerms;
|
|
63
|
+
/** Content identity excludes the creation clock, as with task observation. */
|
|
64
|
+
export declare function liveQualificationId(batch: Omit<LiveQualificationBatch, 'schemaVersion' | 'kind' | 'id' | 'digest' | 'createdAt' | 'expiresAt'>): string;
|
|
65
|
+
export declare function liveQualificationDigest(batch: Omit<LiveQualificationBatch, 'digest'>): string;
|
|
66
|
+
export declare function assertLiveQualificationBatch(value: unknown): asserts value is LiveQualificationBatch;
|
|
67
|
+
export declare function parseLiveQualificationReceipt(value: unknown): LiveQualificationReceipt;
|
|
68
|
+
/** Domain-separated canonical signing payload; never valid as a Host phase receipt. */
|
|
69
|
+
export declare function liveQualificationSigningPayload(receipt: Omit<LiveQualificationReceipt, 'signature'>): string;
|
|
70
|
+
export declare function verifyLiveQualificationReceipt(receiptInput: unknown, batchInput: unknown, publicKeyPem: string | Buffer, now?: number): LiveQualificationReceipt;
|
|
71
|
+
/** Shared exact identity constructor for the independent authority. */
|
|
72
|
+
export declare function liveQualificationReceiptId(receipt: Omit<LiveQualificationReceipt, 'receiptId' | 'signature'>): string;
|
|
73
|
+
//# sourceMappingURL=live-qualification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-qualification.d.ts","sourceRoot":"","sources":["../src/live-qualification.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAY5F,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,qBAAqB,CAAA;IAC/B,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,mFAAmF;AACnF,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,CAAC,CAAA;IAChB,IAAI,EAAE,wBAAwB,CAAA;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,oBAAoB,CAAA;IAC3B,KAAK,EAAE,sBAAsB,CAAA;IAC7B,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,SAAS,mBAAmB,EAAE,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,CAAC,CAAA;IAChB,IAAI,EAAE,gCAAgC,CAAA;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB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FAAuF;AACvF,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,WAAW,CAAC,GAAG,MAAM,CAI5G;AASD,wBAAgB,8BAA8B,CAAC,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAa,GAAG,wBAAwB,CAoBpK;AAED,uEAAuE;AACvE,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,WAAW,GAAG,WAAW,CAAC,GAAG,MAAM,CAErH"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { createPublicKey, verify } from 'node:crypto';
|
|
2
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
3
|
+
import { controlPlaneDigest, ControlPlaneStoreError } from './store.js';
|
|
4
|
+
const ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,159}$/u;
|
|
5
|
+
const DIGEST = /^[a-f0-9]{64}$/u;
|
|
6
|
+
const SIGNATURE = /^[A-Za-z0-9+/]+={0,2}$/u;
|
|
7
|
+
const FIELDS = ['schemaVersion', 'kind', 'id', 'digest', 'lane', 'configDigest', 'trustDigest', 'planId', 'planDigest',
|
|
8
|
+
'installationId', 'profilePath', 'owner', 'terms', 'activationId', 'fence', 'startedAt', 'deadlineAt',
|
|
9
|
+
'readinessDigest', 'hostGeneration', 'votes', 'createdAt', 'expiresAt'];
|
|
10
|
+
const RECEIPT_FIELDS = ['schemaVersion', 'kind', 'receiptId', 'authority', 'keyId', 'batchId', 'batchDigest',
|
|
11
|
+
'planId', 'planDigest', 'activationId', 'fence', 'hostGeneration', 'disposition', 'observedAt', 'expiresAt', 'signature'];
|
|
12
|
+
function fail(message) { throw new ControlPlaneStoreError('invalid-input', message); }
|
|
13
|
+
function object(value) {
|
|
14
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
15
|
+
fail('live qualification object is invalid');
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
function exact(value, fields) {
|
|
19
|
+
if (Object.keys(value).sort().join('\0') !== [...fields].sort().join('\0'))
|
|
20
|
+
fail('live qualification fields differ');
|
|
21
|
+
}
|
|
22
|
+
function integer(value, minimum, maximum = Number.MAX_SAFE_INTEGER) {
|
|
23
|
+
return Number.isSafeInteger(value) && Number(value) >= minimum && Number(value) <= maximum;
|
|
24
|
+
}
|
|
25
|
+
function text(value) {
|
|
26
|
+
return typeof value === 'string' && value.length > 0 && Buffer.byteLength(value) <= 4096
|
|
27
|
+
&& value.normalize('NFC').trim() === value && !/[\p{Cc}]/u.test(value);
|
|
28
|
+
}
|
|
29
|
+
function path(value) { return text(value) && isAbsolute(value) && resolve(value) === value; }
|
|
30
|
+
function owner(value) {
|
|
31
|
+
const item = object(value);
|
|
32
|
+
exact(item, ['authorityId', 'authorityHash', 'principalId', 'principalRecordId', 'principalVersion', 'workspace', 'agentPreset']);
|
|
33
|
+
return [item.authorityId, item.principalId, item.principalRecordId, item.agentPreset].every(text)
|
|
34
|
+
&& typeof item.authorityHash === 'string' && DIGEST.test(item.authorityHash)
|
|
35
|
+
&& path(item.workspace) && integer(item.principalVersion, 1);
|
|
36
|
+
}
|
|
37
|
+
export function validateLiveQualificationTerms(value) {
|
|
38
|
+
const item = object(value);
|
|
39
|
+
exact(item, ['protocol', 'maximumWindowMs', 'minimumTasks', 'authority', 'keyId']);
|
|
40
|
+
if (item.protocol !== 'dsh-bounded-live/v1' || !integer(item.maximumWindowMs, 60_000, 86_400_000)
|
|
41
|
+
|| !integer(item.minimumTasks, 1, 32) || typeof item.authority !== 'string' || !ID.test(item.authority)
|
|
42
|
+
|| typeof item.keyId !== 'string' || !ID.test(item.keyId))
|
|
43
|
+
fail('live qualification terms are invalid');
|
|
44
|
+
}
|
|
45
|
+
/** Content identity excludes the creation clock, as with task observation. */
|
|
46
|
+
export function liveQualificationId(batch) {
|
|
47
|
+
return `live-qualification-${controlPlaneDigest({ lane: batch.lane, configDigest: batch.configDigest,
|
|
48
|
+
trustDigest: batch.trustDigest, planId: batch.planId, planDigest: batch.planDigest,
|
|
49
|
+
installationId: batch.installationId, profilePath: batch.profilePath, owner: batch.owner, terms: batch.terms,
|
|
50
|
+
activationId: batch.activationId, fence: batch.fence, startedAt: batch.startedAt,
|
|
51
|
+
deadlineAt: batch.deadlineAt, readinessDigest: batch.readinessDigest,
|
|
52
|
+
hostGeneration: batch.hostGeneration, votes: batch.votes })}`;
|
|
53
|
+
}
|
|
54
|
+
export function liveQualificationDigest(batch) {
|
|
55
|
+
const { digest: _digest, ...unsigned } = batch;
|
|
56
|
+
return controlPlaneDigest(unsigned);
|
|
57
|
+
}
|
|
58
|
+
export function assertLiveQualificationBatch(value) {
|
|
59
|
+
const item = object(value);
|
|
60
|
+
exact(item, FIELDS);
|
|
61
|
+
validateLiveQualificationTerms(item.terms);
|
|
62
|
+
const batch = item;
|
|
63
|
+
if (batch.schemaVersion !== 1 || batch.kind !== 'dsh-live-qualification'
|
|
64
|
+
|| !/^live-qualification-[a-f0-9]{64}$/u.test(batch.id) || !DIGEST.test(batch.digest)
|
|
65
|
+
|| !DIGEST.test(batch.lane) || !DIGEST.test(batch.configDigest) || !DIGEST.test(batch.trustDigest)
|
|
66
|
+
|| !ID.test(batch.planId) || !DIGEST.test(batch.planDigest) || !text(batch.installationId)
|
|
67
|
+
|| !path(batch.profilePath) || !owner(batch.owner) || !ID.test(batch.activationId)
|
|
68
|
+
|| !integer(batch.fence, 1) || !integer(batch.startedAt, 1) || !integer(batch.deadlineAt, batch.startedAt + 1)
|
|
69
|
+
|| batch.deadlineAt - batch.startedAt > batch.terms.maximumWindowMs || !DIGEST.test(batch.readinessDigest)
|
|
70
|
+
|| !integer(batch.hostGeneration, 1) || !Array.isArray(batch.votes)
|
|
71
|
+
|| !integer(batch.createdAt, batch.startedAt, batch.deadlineAt - 1)
|
|
72
|
+
|| !integer(batch.expiresAt, batch.createdAt + 1)
|
|
73
|
+
|| Buffer.byteLength(JSON.stringify(batch)) > 262_144)
|
|
74
|
+
fail('live qualification batch is invalid');
|
|
75
|
+
const seen = new Set();
|
|
76
|
+
for (const vote of batch.votes) {
|
|
77
|
+
if (!vote || !text(vote.inboxId) || !text(vote.outcomeId) || !DIGEST.test(vote.sourceDigest)
|
|
78
|
+
|| !DIGEST.test(vote.deploymentDigest) || !['achieved', 'not-achieved'].includes(vote.status)
|
|
79
|
+
|| !integer(vote.completedAt, batch.startedAt, Math.min(batch.createdAt, batch.deadlineAt - 1))
|
|
80
|
+
|| !vote.projection || vote.projection.subjectKind !== 'foreground-turn'
|
|
81
|
+
|| vote.projection.subjectRef !== vote.inboxId || vote.projection.disposition !== 'upsert'
|
|
82
|
+
|| !integer(vote.projection.version, 1) || !DIGEST.test(vote.projection.digest)
|
|
83
|
+
|| seen.has(vote.inboxId))
|
|
84
|
+
fail('live qualification vote is invalid');
|
|
85
|
+
seen.add(vote.inboxId);
|
|
86
|
+
}
|
|
87
|
+
const failed = batch.votes.some(vote => vote.status === 'not-achieved');
|
|
88
|
+
if (failed ? batch.votes.length < 1 : batch.votes.length < batch.terms.minimumTasks) {
|
|
89
|
+
fail('live qualification lacks the required task or failure evidence');
|
|
90
|
+
}
|
|
91
|
+
if (batch.id !== liveQualificationId(batch) || batch.digest !== liveQualificationDigest(batch))
|
|
92
|
+
fail('live qualification digest differs');
|
|
93
|
+
}
|
|
94
|
+
function receiptIdentity(receipt) {
|
|
95
|
+
return `live-qualification-receipt-${controlPlaneDigest(receipt)}`;
|
|
96
|
+
}
|
|
97
|
+
export function parseLiveQualificationReceipt(value) {
|
|
98
|
+
const item = object(value);
|
|
99
|
+
exact(item, RECEIPT_FIELDS);
|
|
100
|
+
const receipt = item;
|
|
101
|
+
if (receipt.schemaVersion !== 1 || receipt.kind !== 'dsh-live-qualification-receipt'
|
|
102
|
+
|| !/^live-qualification-receipt-[a-f0-9]{64}$/u.test(receipt.receiptId)
|
|
103
|
+
|| !ID.test(receipt.authority) || !ID.test(receipt.keyId)
|
|
104
|
+
|| !/^live-qualification-[a-f0-9]{64}$/u.test(receipt.batchId) || !DIGEST.test(receipt.batchDigest)
|
|
105
|
+
|| !ID.test(receipt.planId) || !DIGEST.test(receipt.planDigest) || !ID.test(receipt.activationId)
|
|
106
|
+
|| !integer(receipt.fence, 1) || !integer(receipt.hostGeneration, 1)
|
|
107
|
+
|| !['qualified', 'failed'].includes(receipt.disposition)
|
|
108
|
+
|| !integer(receipt.observedAt, 1) || !integer(receipt.expiresAt, receipt.observedAt + 1)
|
|
109
|
+
|| typeof receipt.signature !== 'string' || receipt.signature.length > 512
|
|
110
|
+
|| !SIGNATURE.test(receipt.signature)
|
|
111
|
+
|| Buffer.byteLength(JSON.stringify(receipt)) > 16_384)
|
|
112
|
+
fail('live qualification receipt is invalid');
|
|
113
|
+
const { receiptId: _receiptId, signature: _signature, ...identity } = receipt;
|
|
114
|
+
if (receipt.receiptId !== receiptIdentity(identity))
|
|
115
|
+
fail('live qualification receipt identity differs');
|
|
116
|
+
return receipt;
|
|
117
|
+
}
|
|
118
|
+
/** Domain-separated canonical signing payload; never valid as a Host phase receipt. */
|
|
119
|
+
export function liveQualificationSigningPayload(receipt) {
|
|
120
|
+
const { receiptId: _receiptId, ...identity } = receipt;
|
|
121
|
+
if (receipt.receiptId !== receiptIdentity(identity))
|
|
122
|
+
fail('live qualification receipt identity differs');
|
|
123
|
+
return `dsh-bounded-live/v1\n${controlPlaneCanonical(receipt)}`;
|
|
124
|
+
}
|
|
125
|
+
function controlPlaneCanonical(value) {
|
|
126
|
+
if (Array.isArray(value))
|
|
127
|
+
return `[${value.map(controlPlaneCanonical).join(',')}]`;
|
|
128
|
+
if (value !== null && typeof value === 'object')
|
|
129
|
+
return `{${Object.entries(value).sort(([a], [b]) => a.localeCompare(b))
|
|
130
|
+
.map(([key, part]) => `${JSON.stringify(key)}:${controlPlaneCanonical(part)}`).join(',')}}`;
|
|
131
|
+
return JSON.stringify(value);
|
|
132
|
+
}
|
|
133
|
+
export function verifyLiveQualificationReceipt(receiptInput, batchInput, publicKeyPem, now = Date.now()) {
|
|
134
|
+
assertLiveQualificationBatch(batchInput);
|
|
135
|
+
const batch = batchInput;
|
|
136
|
+
const receipt = parseLiveQualificationReceipt(receiptInput);
|
|
137
|
+
const failed = batch.votes.some(vote => vote.status === 'not-achieved');
|
|
138
|
+
if (receipt.authority !== batch.terms.authority || receipt.keyId !== batch.terms.keyId
|
|
139
|
+
|| receipt.batchId !== batch.id || receipt.batchDigest !== batch.digest || receipt.planId !== batch.planId
|
|
140
|
+
|| receipt.planDigest !== batch.planDigest || receipt.activationId !== batch.activationId
|
|
141
|
+
|| receipt.fence !== batch.fence || receipt.hostGeneration !== batch.hostGeneration
|
|
142
|
+
|| receipt.disposition !== (failed ? 'failed' : 'qualified')
|
|
143
|
+
|| receipt.observedAt < batch.createdAt || receipt.observedAt >= batch.deadlineAt
|
|
144
|
+
|| receipt.observedAt > now || now >= receipt.expiresAt
|
|
145
|
+
|| receipt.expiresAt > batch.expiresAt || !integer(now, 1))
|
|
146
|
+
fail('live qualification receipt context differs');
|
|
147
|
+
const { signature, ...unsigned } = receipt;
|
|
148
|
+
let key;
|
|
149
|
+
try {
|
|
150
|
+
key = createPublicKey(publicKeyPem);
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return fail('live qualification public key is invalid');
|
|
154
|
+
}
|
|
155
|
+
if (key.asymmetricKeyType !== 'ed25519' || !verify(null, Buffer.from(liveQualificationSigningPayload(unsigned)), key, Buffer.from(signature, 'base64'))) {
|
|
156
|
+
fail('live qualification signature is invalid');
|
|
157
|
+
}
|
|
158
|
+
return receipt;
|
|
159
|
+
}
|
|
160
|
+
/** Shared exact identity constructor for the independent authority. */
|
|
161
|
+
export function liveQualificationReceiptId(receipt) {
|
|
162
|
+
return receiptIdentity(receipt);
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=live-qualification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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elt. Candidate package scripts,
|
|
2
|
+
* tests, tsconfig files and JavaScript are never executed during preparation. */
|
|
3
|
+
export declare const NATIVE_SOURCE_COMPILER: string;
|
|
4
|
+
//# sourceMappingURL=native-source-build-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-source-build-worker.d.ts","sourceRoot":"","sources":["../src/native-source-build-worker.ts"],"names":[],"mappings":"AAAA;iFACiF;AACjF,eAAO,MAAM,sBAAsB,QAmFlC,CAAA"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** Fixed code run inside the native macOS Seatbelt. Candidate package scripts,
|
|
2
|
+
* tests, tsconfig files and JavaScript are never executed during preparation. */
|
|
3
|
+
export const NATIVE_SOURCE_COMPILER = String.raw `
|
|
4
|
+
import { readFileSync } from 'node:fs'
|
|
5
|
+
import { isAbsolute, posix, resolve, sep } from 'node:path'
|
|
6
|
+
import { pathToFileURL } from 'node:url'
|
|
7
|
+
|
|
8
|
+
const fail = reason => { process.stderr.write(String(reason).slice(0, 4096)); process.exitCode = 1 }
|
|
9
|
+
try {
|
|
10
|
+
const input = JSON.parse(readFileSync(0, 'utf8'))
|
|
11
|
+
if (!input || input.schemaVersion !== 1 || !Array.isArray(input.files) || input.files.length < 1 || input.files.length > 64
|
|
12
|
+
|| typeof input.modulesPath !== 'string' || !isAbsolute(input.modulesPath)) throw new Error('invalid compiler input')
|
|
13
|
+
const modulesPath = resolve(input.modulesPath)
|
|
14
|
+
const ts = await import(pathToFileURL(resolve(modulesPath, 'typescript/lib/typescript.js')).href)
|
|
15
|
+
const virtualRoot = '/candidate'
|
|
16
|
+
const sources = new Map()
|
|
17
|
+
let total = 0
|
|
18
|
+
for (const file of input.files) {
|
|
19
|
+
if (!file || typeof file.path !== 'string' || typeof file.content !== 'string'
|
|
20
|
+
|| !/^(?:src\/)?[A-Za-z0-9][A-Za-z0-9._/-]*\.(?:ts|tsx)$/u.test(file.path)
|
|
21
|
+
|| file.path.split('/').some(part => part === '.' || part === '..' || part === '')
|
|
22
|
+
|| Buffer.byteLength(file.content) > 65_536) throw new Error('unsafe compiler source')
|
|
23
|
+
total += Buffer.byteLength(file.content)
|
|
24
|
+
if (total > 262_144) throw new Error('compiler source limit')
|
|
25
|
+
const key = posix.join(virtualRoot, file.path)
|
|
26
|
+
if (sources.has(key)) throw new Error('duplicate compiler source')
|
|
27
|
+
sources.set(key, file.content)
|
|
28
|
+
}
|
|
29
|
+
const roots = [...sources.keys()].filter(name => name.startsWith('/candidate/src/') && /\.tsx?$/u.test(name))
|
|
30
|
+
if (roots.length < 1) throw new Error('missing plugin TypeScript source')
|
|
31
|
+
const options = { target: ts.ScriptTarget.ES2024, module: ts.ModuleKind.ESNext,
|
|
32
|
+
moduleResolution: ts.ModuleResolutionKind.Bundler, lib: ['lib.es2024.d.ts'],
|
|
33
|
+
rootDir: '/candidate/src', outDir: '/candidate/lib', strict: true,
|
|
34
|
+
noUncheckedIndexedAccess: true, exactOptionalPropertyTypes: true,
|
|
35
|
+
noImplicitOverride: true, noFallthroughCasesInSwitch: true,
|
|
36
|
+
noUnusedLocals: true, noUnusedParameters: true, verbatimModuleSyntax: true,
|
|
37
|
+
isolatedModules: true, skipLibCheck: true, declaration: true,
|
|
38
|
+
sourceMap: false, declarationMap: false, noEmitOnError: true,
|
|
39
|
+
typeRoots: [resolve(modulesPath, '@types')], types: ['node'] }
|
|
40
|
+
const permitted = new Set(['@deepseek-ai/cordis', '@deepseek-ai/dsh-tools', '@deepseek-ai/dsh-system-prompt'])
|
|
41
|
+
const outputs = new Map()
|
|
42
|
+
const host = ts.createCompilerHost(options, true)
|
|
43
|
+
const originalRead = host.readFile.bind(host)
|
|
44
|
+
const originalExists = host.fileExists.bind(host)
|
|
45
|
+
const withinRuntime = path => path === modulesPath || path.startsWith(modulesPath + sep)
|
|
46
|
+
host.readFile = path => sources.get(path) ?? (withinRuntime(path) ? originalRead(path) : undefined)
|
|
47
|
+
host.fileExists = path => sources.has(path) || withinRuntime(path) && originalExists(path)
|
|
48
|
+
host.directoryExists = path => path === '/candidate' || path === '/candidate/src'
|
|
49
|
+
|| [...sources.keys()].some(key => key.startsWith(path + '/'))
|
|
50
|
+
|| withinRuntime(path) && ts.sys.directoryExists(path)
|
|
51
|
+
host.getDirectories = path => withinRuntime(path) ? ts.sys.getDirectories(path) : []
|
|
52
|
+
host.resolveModuleNames = (names, containingFile) => names.map(name => {
|
|
53
|
+
if (name.startsWith('.')) {
|
|
54
|
+
if (withinRuntime(containingFile)) return ts.resolveModuleName(name, containingFile, options, host).resolvedModule
|
|
55
|
+
const target = posix.resolve(posix.dirname(containingFile), name)
|
|
56
|
+
if (!target.startsWith('/candidate/src/')) return undefined
|
|
57
|
+
return ts.resolveModuleName(name, containingFile, options, host).resolvedModule
|
|
58
|
+
}
|
|
59
|
+
if (withinRuntime(containingFile)) return ts.resolveModuleName(name, containingFile, options, host).resolvedModule
|
|
60
|
+
if (!permitted.has(name) && !name.startsWith('node:')) return undefined
|
|
61
|
+
if (name.startsWith('node:')) return ts.resolveModuleName(name, containingFile, options, host).resolvedModule
|
|
62
|
+
const manifest = JSON.parse(readFileSync(resolve(modulesPath, name, 'package.json'), 'utf8'))
|
|
63
|
+
const declaration = manifest.exports?.['.']?.types ?? manifest.types
|
|
64
|
+
if (typeof declaration !== 'string' || !/^\.?\/?[A-Za-z0-9._/-]+\.d\.ts$/u.test(declaration)
|
|
65
|
+
|| declaration.split('/').includes('..')) return undefined
|
|
66
|
+
const entry = resolve(modulesPath, name, declaration)
|
|
67
|
+
if (!withinRuntime(entry) || !host.fileExists(entry)) return undefined
|
|
68
|
+
return { resolvedFileName: entry, extension: ts.Extension.Dts, isExternalLibraryImport: true }
|
|
69
|
+
})
|
|
70
|
+
host.writeFile = (fileName, content) => {
|
|
71
|
+
if (!fileName.startsWith('/candidate/lib/') || !/\.(?:js|d\.ts)$/u.test(fileName)
|
|
72
|
+
|| Buffer.byteLength(content) > 131_072 || outputs.size >= 128 || outputs.has(fileName)) throw new Error('unsafe compiler output')
|
|
73
|
+
outputs.set(fileName.slice('/candidate/'.length), content)
|
|
74
|
+
}
|
|
75
|
+
const program = ts.createProgram(roots, options, host)
|
|
76
|
+
const diagnostics = ts.getPreEmitDiagnostics(program)
|
|
77
|
+
if (diagnostics.length) throw new Error('semantic TypeScript diagnostics: ' + ts.formatDiagnostics(diagnostics.slice(0, 8), {
|
|
78
|
+
getCanonicalFileName: name => name, getCurrentDirectory: () => virtualRoot, getNewLine: () => '\n' }).slice(0, 4096))
|
|
79
|
+
const emitted = program.emit()
|
|
80
|
+
if (emitted.emitSkipped || emitted.diagnostics.length || !outputs.has('lib/index.js') || !outputs.has('lib/index.d.ts')) {
|
|
81
|
+
throw new Error('TypeScript JS/declaration emit failed')
|
|
82
|
+
}
|
|
83
|
+
const files = [...outputs].sort(([a], [b]) => a.localeCompare(b)).map(([path, content]) => ({ path, content }))
|
|
84
|
+
process.stdout.write(JSON.stringify({ schemaVersion: 1, typescriptVersion: ts.version, checks: ['semantic-typecheck', 'js-declaration-emit'], files }))
|
|
85
|
+
} catch (error) { fail(error instanceof Error ? error.message : 'compiler failure') }
|
|
86
|
+
`;
|
|
87
|
+
//# sourceMappingURL=native-source-build-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-source-build-worker.js","sourceRoot":"","sources":["../src/native-source-build-worker.ts"],"names":[],"mappings":"AAAA;iFACiF;AACjF,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmF/C,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type NativeMacVerifierRunner } from '@dsh-enhanced/assistant-isolation';
|
|
2
|
+
import { type SourceCreationBinding } from './source-creation.js';
|
|
3
|
+
import { type SourceRevisionBinding } from './source-revision.js';
|
|
4
|
+
import { type ScopedPluginFile } from './source-workspace.js';
|
|
5
|
+
import type { CreationCapabilitySourceSnapshot } from './creation-capability-source.js';
|
|
6
|
+
import type { PluginCreationVerificationCertificate } from '@dsh-enhanced/assistant-growth-contract';
|
|
7
|
+
import type { NativeSourceBuildConfig, SourceBuildResult } from './source-build.js';
|
|
8
|
+
import type { NativeSourcePreparedEvidence } from './types.js';
|
|
9
|
+
interface NativeBuildInput {
|
|
10
|
+
config: NativeSourceBuildConfig;
|
|
11
|
+
runner: NativeMacVerifierRunner;
|
|
12
|
+
worktree: string;
|
|
13
|
+
baseCommit: string;
|
|
14
|
+
name: string;
|
|
15
|
+
scope: readonly string[];
|
|
16
|
+
environment: NodeJS.ProcessEnv;
|
|
17
|
+
signal: AbortSignal;
|
|
18
|
+
assertCurrent: () => Promise<void>;
|
|
19
|
+
preparedAt: number;
|
|
20
|
+
sourceJob: {
|
|
21
|
+
id: string;
|
|
22
|
+
};
|
|
23
|
+
creation?: SourceCreationBinding;
|
|
24
|
+
revision?: {
|
|
25
|
+
binding: SourceRevisionBinding;
|
|
26
|
+
parentSource: CreationCapabilitySourceSnapshot;
|
|
27
|
+
parentCertificate: PluginCreationVerificationCertificate;
|
|
28
|
+
files: readonly ScopedPluginFile[];
|
|
29
|
+
};
|
|
30
|
+
capturePack?: true;
|
|
31
|
+
}
|
|
32
|
+
/** Only the Host-scaffolded create/revise-created lane may call this. The
|
|
33
|
+
* candidate is passed to a fixed compiler as data, never launched as code. */
|
|
34
|
+
export declare function runNativePreparedChecks(input: NativeBuildInput): Promise<SourceBuildResult<NativeSourcePreparedEvidence>>;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=native-source-build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-source-build.d.ts","sourceRoot":"","sources":["../src/native-source-build.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkD,KAAK,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AAEhI,O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A4B,CAAC,CAAC,CAuD/H"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { lstat, readdir, readFile, realpath } from 'node:fs/promises';
|
|
3
|
+
import { join, resolve } from 'node:path';
|
|
4
|
+
import { nativeMacRuntimeDigest, verifyNativeMacRuntime } from '@dsh-enhanced/assistant-isolation';
|
|
5
|
+
import { ControlPlaneCliError } from './errors.js';
|
|
6
|
+
import { verifyCreatedPluginWorkspace } from './source-creation.js';
|
|
7
|
+
import { verifyRevisedPluginWorkspace } from './source-revision.js';
|
|
8
|
+
import { checkedSourceSnapshot } from './source-workspace.js';
|
|
9
|
+
import { NATIVE_SOURCE_COMPILER } from './native-source-build-worker.js';
|
|
10
|
+
import { packNativeCreatedPlugin } from './native-source-pack.js';
|
|
11
|
+
const DIGEST = /^[a-f0-9]{64}$/u;
|
|
12
|
+
const compilerSha256 = createHash('sha256').update(NATIVE_SOURCE_COMPILER).digest('hex');
|
|
13
|
+
function fail(message) { throw new ControlPlaneCliError('SOURCE_BOUNDARY', `native source build ${message}`); }
|
|
14
|
+
async function pluginFiles(root) {
|
|
15
|
+
const files = new Map();
|
|
16
|
+
let bytes = 0;
|
|
17
|
+
let count = 0;
|
|
18
|
+
const visit = async (directory, prefix, depth) => {
|
|
19
|
+
if (depth > 32)
|
|
20
|
+
fail('directory depth exceeds bound');
|
|
21
|
+
for (const name of (await readdir(directory)).sort()) {
|
|
22
|
+
if (!/^[A-Za-z0-9._-]+$/u.test(name) || name === '.' || name === '..')
|
|
23
|
+
fail('unsafe path');
|
|
24
|
+
const path = join(directory, name), relative = prefix === '' ? name : `${prefix}/${name}`;
|
|
25
|
+
const info = await lstat(path);
|
|
26
|
+
if (info.isSymbolicLink() || info.nlink !== 1 && info.isFile())
|
|
27
|
+
fail('linked plugin file');
|
|
28
|
+
if (info.isDirectory())
|
|
29
|
+
await visit(path, relative, depth + 1);
|
|
30
|
+
else if (info.isFile()) {
|
|
31
|
+
if (info.size > 65_536 || ++count > 64)
|
|
32
|
+
fail('file size/count exceeds bound');
|
|
33
|
+
const content = await readFile(path);
|
|
34
|
+
bytes += content.length;
|
|
35
|
+
if (bytes > 262_144 || content.includes(0))
|
|
36
|
+
fail('plugin bytes exceed bound');
|
|
37
|
+
const decoded = new TextDecoder('utf-8', { fatal: true }).decode(content);
|
|
38
|
+
if (!Buffer.from(decoded).equals(content))
|
|
39
|
+
fail('noncanonical UTF-8 plugin file');
|
|
40
|
+
files.set(relative, decoded);
|
|
41
|
+
}
|
|
42
|
+
else
|
|
43
|
+
fail('special plugin file');
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const canonical = await realpath(root);
|
|
47
|
+
if (canonical !== resolve(root) || !(await lstat(root)).isDirectory())
|
|
48
|
+
fail('plugin root is not canonical');
|
|
49
|
+
await visit(root, '', 0);
|
|
50
|
+
return files;
|
|
51
|
+
}
|
|
52
|
+
function compilerOutput(value) {
|
|
53
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
54
|
+
fail('compiler output is invalid');
|
|
55
|
+
const item = value;
|
|
56
|
+
if (Object.keys(item).sort().join() !== 'checks,files,schemaVersion,typescriptVersion'
|
|
57
|
+
|| item.schemaVersion !== 1 || !Array.isArray(item.checks)
|
|
58
|
+
|| item.checks.join() !== 'semantic-typecheck,js-declaration-emit'
|
|
59
|
+
|| !Array.isArray(item.files) || item.files.length < 2 || item.files.length > 128)
|
|
60
|
+
fail('compiler output contract differs');
|
|
61
|
+
const files = new Map();
|
|
62
|
+
let total = 0;
|
|
63
|
+
for (const value of item.files) {
|
|
64
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
65
|
+
fail('compiler file is invalid');
|
|
66
|
+
const file = value;
|
|
67
|
+
if (Object.keys(file).sort().join() !== 'content,path' || typeof file.path !== 'string' || typeof file.content !== 'string'
|
|
68
|
+
|| !/^lib\/[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*\.(?:js|d\.ts)$/u.test(file.path)
|
|
69
|
+
|| files.has(file.path))
|
|
70
|
+
fail('compiler file path is unsafe');
|
|
71
|
+
total += Buffer.byteLength(file.content);
|
|
72
|
+
if (total > 512 * 1024)
|
|
73
|
+
fail('compiler output exceeds bound');
|
|
74
|
+
files.set(file.path, file.content);
|
|
75
|
+
}
|
|
76
|
+
return files;
|
|
77
|
+
}
|
|
78
|
+
/** Only the Host-scaffolded create/revise-created lane may call this. The
|
|
79
|
+
* candidate is passed to a fixed compiler as data, never launched as code. */
|
|
80
|
+
export async function runNativePreparedChecks(input) {
|
|
81
|
+
if (process.platform !== 'darwin' || !/^source-job-[a-f0-9]{64}$/u.test(input.sourceJob.id)
|
|
82
|
+
|| !DIGEST.test(input.config.authorityDigest) || input.config.expiresAt <= Date.now()
|
|
83
|
+
|| (input.creation === undefined) === (input.revision === undefined))
|
|
84
|
+
fail('durable creation authority is required');
|
|
85
|
+
const verify = async () => {
|
|
86
|
+
const grant = input.creation?.grant ?? input.revision.binding.grant;
|
|
87
|
+
if (grant.expiresAt <= Date.now())
|
|
88
|
+
fail('creation or revision grant expired');
|
|
89
|
+
const result = input.creation === undefined
|
|
90
|
+
? await verifyRevisedPluginWorkspace({ worktree: input.worktree, baseCommit: input.baseCommit,
|
|
91
|
+
name: input.name, environment: input.environment, signal: input.signal, assertCurrent: input.assertCurrent,
|
|
92
|
+
revision: input.revision.binding, parentSource: input.revision.parentSource,
|
|
93
|
+
parentCertificate: input.revision.parentCertificate, files: input.revision.files })
|
|
94
|
+
: await verifyCreatedPluginWorkspace({ worktree: input.worktree, baseCommit: input.baseCommit,
|
|
95
|
+
name: input.name, environment: input.environment, signal: input.signal, assertCurrent: input.assertCurrent,
|
|
96
|
+
creation: input.creation });
|
|
97
|
+
const expected = [...input.scope].sort(), actual = [...result.scope].sort();
|
|
98
|
+
if (expected.length !== actual.length || expected.some((path, i) => path !== actual[i]))
|
|
99
|
+
fail('scope differs from Host scaffold');
|
|
100
|
+
await input.assertCurrent();
|
|
101
|
+
};
|
|
102
|
+
await verifyNativeMacRuntime(input.config.runtime);
|
|
103
|
+
await verify();
|
|
104
|
+
const before = await checkedSourceSnapshot(input.worktree, input.baseCommit, input.scope, input.environment, undefined, input.signal);
|
|
105
|
+
const files = await pluginFiles(join(input.worktree, 'plugins', input.name));
|
|
106
|
+
const sources = [...files].filter(([path]) => path.startsWith('src/') && /\.tsx?$/u.test(path))
|
|
107
|
+
.map(([path, content]) => ({ path, content }));
|
|
108
|
+
if (!sources.some(file => file.path === 'src/index.ts'))
|
|
109
|
+
fail('source entry is missing');
|
|
110
|
+
const result = await input.runner.run(input.sourceJob.id, [], JSON.stringify({ schemaVersion: 1,
|
|
111
|
+
modulesPath: input.config.runtime.modulesPath, files: sources }), input.signal);
|
|
112
|
+
await input.assertCurrent();
|
|
113
|
+
if (!result.quiescent || result.status !== 'succeeded' || result.exitCode !== 0 || result.stderr !== '') {
|
|
114
|
+
throw new ControlPlaneCliError('EXECUTOR_FAILED', `native source compiler ${result.status}: ${result.reason ?? result.stderr.slice(0, 512)}`);
|
|
115
|
+
}
|
|
116
|
+
let decoded;
|
|
117
|
+
try {
|
|
118
|
+
decoded = JSON.parse(result.stdout);
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
fail('compiler output is not JSON');
|
|
122
|
+
}
|
|
123
|
+
const compiler = compilerOutput(decoded);
|
|
124
|
+
if (decoded.typescriptVersion !== input.config.runtime.versions.typescript)
|
|
125
|
+
fail('TypeScript version differs');
|
|
126
|
+
const packed = packNativeCreatedPlugin(input.name, files, compiler);
|
|
127
|
+
await verifyNativeMacRuntime(input.config.runtime);
|
|
128
|
+
await verify();
|
|
129
|
+
const after = await checkedSourceSnapshot(input.worktree, input.baseCommit, input.scope, input.environment, undefined, input.signal);
|
|
130
|
+
if (after.checkedTreeDigest !== before.checkedTreeDigest || after.checkedPatchDigest !== before.checkedPatchDigest) {
|
|
131
|
+
fail('source changed during native compilation');
|
|
132
|
+
}
|
|
133
|
+
const checkedAt = Date.now();
|
|
134
|
+
return { treeDigest: after.checkedTreeDigest, patchDigest: after.checkedPatchDigest, checkedAt,
|
|
135
|
+
...(input.capturePack ? { packArtifact: packed.bytes } : {}),
|
|
136
|
+
evidence: Object.freeze({ schemaVersion: 2, kind: 'dsh-source-prepared-evidence',
|
|
137
|
+
boundary: 'macos-seatbelt-single-process-v1', runtimeDigest: nativeMacRuntimeDigest(input.config.runtime),
|
|
138
|
+
fixedCompilerSha256: compilerSha256,
|
|
139
|
+
checks: Object.freeze(['semantic-typecheck', 'js-declaration-emit', 'host-safe-pack']),
|
|
140
|
+
pack: Object.freeze({ name: packed.name, version: packed.version, sizeBytes: packed.bytes.length, sha256: packed.sha256 }),
|
|
141
|
+
preparedAt: input.preparedAt }) };
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=native-source-build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-source-build.js","sourceRoot":"","sources":["../src/native-source-build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAgC,MAAM,mCAAmC,CAAA;AAChI,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,4BAA4B,EAA8B,MAAM,sBAAsB,CAAA;AAC/F,OAAO,EAAE,4BAA4B,EAA8B,MAAM,sBAAsB,CAAA;AAC/F,OAAO,EAAE,qBAAqB,EAAyB,MAAM,uBAAuB,CAAA;AAIpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,MAAM,M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WAAW,EAAE,KAAK,CAAC,kBAAkB,EAAE,SAAS;QAC5F,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,IAAI,EAAE,8BAA8B;YAC9E,QAAQ,EAAE,kCAAkC,EAAE,aAAa,EAAE,sBAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;YACzG,mBAAmB,EAAE,cAAc;YACnC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,oBAAoB,EAAE,qBAAqB,EAAE,gBAAgB,CAAU,CAAC;YAC/F,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;YAC1H,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,EAAE,CAAA;AACvC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface NativePackedSource {
|
|
2
|
+
bytes: Buffer;
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
sha256: string;
|
|
6
|
+
}
|
|
7
|
+
/** Host-built deterministic npm-compatible ustar. The caller provides exact
|
|
8
|
+
* Host-verified fixed files and bounded compiler output, never a filesystem
|
|
9
|
+
* path, symlink or candidate-controlled archive. */
|
|
10
|
+
export declare function packNativeCreatedPlugin(name: string, fixed: ReadonlyMap<string, string>, emitted: ReadonlyMap<string, string>): NativePackedSource;
|
|
11
|
+
//# sourceMappingURL=native-source-pack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-source-pack.d.ts","sourceRoot":"","sources":["../src/native-source-pack.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf;AA4BD;;oDAEoD;AACpD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EACtF,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,kBAAkB,CAmC1D"}
|