@agent-teams/engineering-foundation 0.17.0-rc.0 → 0.17.0-rc.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/README.md +11 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/changesets-prerelease-state.d.ts +10 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/changesets-prerelease-state.d.ts.map +1 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/changesets-prerelease-state.js +69 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/changesets-prerelease-state.js.map +1 -0
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/filesystem-public-api-repository.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/filesystem-public-api-repository.js +27 -7
- package/dist/capabilities/public-api-compatibility/adapters/outbound/filesystem/filesystem-public-api-repository.js.map +1 -1
- package/dist/capabilities/public-api-compatibility/application/model/public-api.d.ts +2 -0
- package/dist/capabilities/public-api-compatibility/application/model/public-api.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/application/use-cases/promote-public-api-baselines.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/application/use-cases/promote-public-api-baselines.js +21 -3
- package/dist/capabilities/public-api-compatibility/application/use-cases/promote-public-api-baselines.js.map +1 -1
- package/dist/document-authoring/composition/inspect-document-transaction.d.ts.map +1 -1
- package/dist/document-authoring/composition/inspect-document-transaction.js +11 -12
- package/dist/document-authoring/composition/inspect-document-transaction.js.map +1 -1
- package/dist/foundation-state-contract.d.ts +1 -0
- package/dist/foundation-state-contract.d.ts.map +1 -1
- package/dist/foundation-state-contract.js +1 -0
- package/dist/foundation-state-contract.js.map +1 -1
- package/dist/local-mode/inspection.d.ts.map +1 -1
- package/dist/local-mode/inspection.js +11 -1
- package/dist/local-mode/inspection.js.map +1 -1
- package/dist/mutation/index.d.ts +8 -0
- package/dist/mutation/index.d.ts.map +1 -1
- package/dist/mutation/index.js +4 -1
- package/dist/mutation/index.js.map +1 -1
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.d.ts +2 -0
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.d.ts.map +1 -1
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.js +31 -23
- package/dist/repository-mutation/adapters/node/node-bounded-regular-file.js.map +1 -1
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.d.ts +28 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.js +194 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-filesystem.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.d.ts +25 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.js +129 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-filesystem.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.d.ts +12 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.js +46 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-inspection.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.d.ts +21 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.js +178 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-journal-store.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.d.ts +4 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.js +43 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-receipt.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.d.ts +11 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.js +888 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.d.ts +20 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.js +546 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.js.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.d.ts +63 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.d.ts.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.js +15 -0
- package/dist/repository-mutation/application/model/known-file-transaction-journal.js.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction.d.ts +64 -0
- package/dist/repository-mutation/application/model/known-file-transaction.d.ts.map +1 -0
- package/dist/repository-mutation/application/model/known-file-transaction.js +2 -0
- package/dist/repository-mutation/application/model/known-file-transaction.js.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.d.ts +8 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.d.ts.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.js +241 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-envelope.js.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.d.ts +7 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.d.ts.map +1 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.js +215 -0
- package/dist/repository-mutation/application/policies/known-file-transaction-plan.js.map +1 -0
- package/dist/schema-catalog.d.ts.map +1 -1
- package/dist/schema-catalog.js +3 -0
- package/dist/schema-catalog.js.map +1 -1
- package/dist/schema-ids.d.ts +1 -1
- package/dist/schema-ids.d.ts.map +1 -1
- package/dist/schema-ids.js +3 -0
- package/dist/schema-ids.js.map +1 -1
- package/dist/semantic-version.d.ts +1 -0
- package/dist/semantic-version.d.ts.map +1 -1
- package/dist/semantic-version.js +11 -0
- package/dist/semantic-version.js.map +1 -1
- package/dist/transaction-coordination/adapters/node/document-transaction-status.d.ts +9 -0
- package/dist/transaction-coordination/adapters/node/document-transaction-status.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/document-transaction-status.js +26 -0
- package/dist/transaction-coordination/adapters/node/document-transaction-status.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/known-file-transaction-status.d.ts +8 -0
- package/dist/transaction-coordination/adapters/node/known-file-transaction-status.d.ts.map +1 -0
- package/dist/transaction-coordination/adapters/node/known-file-transaction-status.js +50 -0
- package/dist/transaction-coordination/adapters/node/known-file-transaction-status.js.map +1 -0
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.d.ts.map +1 -1
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.js +33 -37
- package/dist/transaction-coordination/adapters/node/node-foundation-transaction-slot.js.map +1 -1
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.d.ts +1 -1
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.d.ts.map +1 -1
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.js +12 -1
- package/dist/transaction-coordination/application/foundation-transaction-coordinator.js.map +1 -1
- package/dist/transaction-coordination/application/model/internal-transaction-status.d.ts +14 -2
- package/dist/transaction-coordination/application/model/internal-transaction-status.d.ts.map +1 -1
- package/dist/transaction-coordination/application/model/transaction-status.d.ts +6 -2
- package/dist/transaction-coordination/application/model/transaction-status.d.ts.map +1 -1
- package/package.json +4 -1
- package/schemas/foundation-transaction-envelope/v5.schema.json +94 -0
- package/schemas/known-file-transaction-plan/v1.schema.json +65 -0
- package/schemas/known-file-transaction-receipt/v1.schema.json +36 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-file-transaction-journal.d.ts","sourceRoot":"","sources":["../../../../src/repository-mutation/application/model/known-file-transaction-journal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAC3B,MAAM,6BAA6B,CAAC;AAErC,MAAM,WAAW,sCAAsC;IACrD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,gCAAgC;IACxC,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,oBAAoB,GAAG,WAAW,CAAC;IAClE,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,mBAAmB,CAAC;IAC3D,QAAQ,CAAC,iBAAiB,EAAE,sCAAsC,CAAC;IACnE,QAAQ,CAAC,YAAY,EAAE,sCAAsC,CAAC;CAC/D;AAED,MAAM,MAAM,sCAAsC,GAC9C;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,GAAG,sBAAsB,CAAC;IACzE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,yBAAyB,CAAC,EAAE,KAAK,CAAC;IAC3C,QAAQ,CAAC,wBAAwB,CAAC,EAAE,KAAK,CAAC;IAC1C,QAAQ,CAAC,wBAAwB,CAAC,EAAE,KAAK,CAAC;IAC1C,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;CAC7B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EACV,iBAAiB,GACjB,oBAAoB,GACpB,eAAe,GACf,mBAAmB,G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AmC,CAAC;IAC1D,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,6BAA6B,CAAC;IAChD,QAAQ,CAAC,aAAa,EAAE,eAAe,CAAC;IACxC,QAAQ,CAAC,cAAc,EAAE,eAAe,CAAC;CAC1C;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,oBAAoB,GAC7B,sCAAsC,CAMxC;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,sCAAsC,GAC/C,oBAAoB,CAMtB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function serializeKnownFileIdentity(identity) {
|
|
2
|
+
return Object.freeze({
|
|
3
|
+
birthtimeNs: identity.birthtimeNs.toString(),
|
|
4
|
+
dev: identity.dev.toString(),
|
|
5
|
+
ino: identity.ino.toString()
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export function deserializeKnownFileIdentity(identity) {
|
|
9
|
+
return {
|
|
10
|
+
birthtimeNs: BigInt(identity.birthtimeNs),
|
|
11
|
+
dev: BigInt(identity.dev),
|
|
12
|
+
ino: BigInt(identity.ino)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=known-file-transaction-journal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-file-transaction-journal.js","sourceRoot":"","sources":["../../../../src/repository-mutation/application/model/known-file-transaction-journal.ts"],"names":[],"mappings":"AA8EA,MAAM,UAAU,0BAA0B,CACxC,QAA8B;IAE9B,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE;QAC5C,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE;QAC5B,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE;KAC7B,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,QAAgD;IAEhD,OAAO;QACL,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC;QACzC,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QACzB,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export type KnownFileDigest = `sha256:${string}`;
|
|
2
|
+
export interface KnownFileImageV1 {
|
|
3
|
+
readonly contentBase64: string;
|
|
4
|
+
readonly digest: KnownFileDigest;
|
|
5
|
+
readonly mode: number;
|
|
6
|
+
readonly size: number;
|
|
7
|
+
}
|
|
8
|
+
export type KnownFilePreconditionV1 = {
|
|
9
|
+
readonly state: "absent";
|
|
10
|
+
} | {
|
|
11
|
+
readonly state: "known-file";
|
|
12
|
+
readonly acceptedPreimages: readonly KnownFileImageV1[];
|
|
13
|
+
};
|
|
14
|
+
export interface KnownFileTransactionOperationV1 {
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly precondition: KnownFilePreconditionV1;
|
|
17
|
+
readonly postimage: KnownFileImageV1;
|
|
18
|
+
}
|
|
19
|
+
export interface KnownFileTransactionPlanV1 {
|
|
20
|
+
readonly schemaVersion: 1;
|
|
21
|
+
readonly protocol: "foundation.replace-known-file/v1";
|
|
22
|
+
readonly operations: readonly KnownFileTransactionOperationV1[];
|
|
23
|
+
readonly planDigest: KnownFileDigest;
|
|
24
|
+
}
|
|
25
|
+
export type KnownFileTransactionOperationOutcome = "already-satisfied" | "created" | "replaced" | "rolled-back-to-absent" | "rolled-back-to-preimage";
|
|
26
|
+
export interface KnownFileTransactionReceiptV1 {
|
|
27
|
+
readonly schemaVersion: 1;
|
|
28
|
+
readonly protocol: "foundation.replace-known-file/v1";
|
|
29
|
+
readonly planDigest: KnownFileDigest;
|
|
30
|
+
readonly outcome: "already-satisfied" | "applied" | "rolled-back";
|
|
31
|
+
readonly operations: readonly {
|
|
32
|
+
readonly path: string;
|
|
33
|
+
readonly outcome: KnownFileTransactionOperationOutcome;
|
|
34
|
+
readonly resultDigest?: KnownFileDigest;
|
|
35
|
+
}[];
|
|
36
|
+
readonly receiptDigest: KnownFileDigest;
|
|
37
|
+
}
|
|
38
|
+
export type KnownFileTransactionOperationInput = {
|
|
39
|
+
readonly path: string;
|
|
40
|
+
readonly precondition: {
|
|
41
|
+
readonly state: "absent";
|
|
42
|
+
};
|
|
43
|
+
readonly postimage: {
|
|
44
|
+
readonly bytes: Uint8Array;
|
|
45
|
+
readonly mode?: number;
|
|
46
|
+
};
|
|
47
|
+
} | {
|
|
48
|
+
readonly path: string;
|
|
49
|
+
readonly precondition: {
|
|
50
|
+
readonly state: "known-file";
|
|
51
|
+
readonly acceptedPreimages: readonly {
|
|
52
|
+
readonly bytes: Uint8Array;
|
|
53
|
+
readonly mode: number;
|
|
54
|
+
}[];
|
|
55
|
+
};
|
|
56
|
+
readonly postimage: {
|
|
57
|
+
readonly bytes: Uint8Array;
|
|
58
|
+
readonly mode: number;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export interface CompileKnownFileTransactionPlanInput {
|
|
62
|
+
readonly operations: readonly KnownFileTransactionOperationInput[];
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=known-file-transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-file-transaction.d.ts","sourceRoot":"","sources":["../../../../src/repository-mutation/application/model/known-file-transaction.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,UAAU,MAAM,EAAE,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,u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ACtB,QAAQ,CAAC,YAAY,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;KAAE,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE;QAClB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;QAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;CACH,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE;QACrB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;QAC7B,QAAQ,CAAC,iBAAiB,EAAE,SAAS;YACnC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;YAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;SACvB,EAAE,CAAC;KACL,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE;QAClB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;QAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACvB,CAAC;CACH,CAAC;AAEN,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,UAAU,EAAE,SAAS,kCAAkC,EAAE,CAAC;CACpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-file-transaction.js","sourceRoot":"","sources":["../../../../src/repository-mutation/application/model/known-file-transaction.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { KnownFileTransactionEnvelopeV1, KnownFileTransactionJournalV1 } from "../model/known-file-transaction-journal.js";
|
|
2
|
+
export declare function compileKnownFileTransactionEnvelope(input: {
|
|
3
|
+
readonly foundation: KnownFileTransactionEnvelopeV1["foundation"];
|
|
4
|
+
readonly journal: KnownFileTransactionJournalV1;
|
|
5
|
+
readonly state: KnownFileTransactionEnvelopeV1["state"];
|
|
6
|
+
}): KnownFileTransactionEnvelopeV1;
|
|
7
|
+
export declare function assertKnownFileTransactionEnvelope(value: unknown): asserts value is KnownFileTransactionEnvelopeV1;
|
|
8
|
+
//# sourceMappingURL=known-file-transaction-envelope.d.ts.map
|
package/dist/repository-mutation/application/policies/known-file-transaction-envelope.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-file-transaction-envelope.d.ts","sourceRoot":"","sources":["../../../../src/repository-mutation/application/policies/known-file-transaction-envelope.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,4CAA4C,CAAC;AA6OpD,wBAAgB,mCAAmC,CAAC,KAAK,EAAE;IACzD,QAAQ,CAAC,UAAU,EAAE,8BAA8B,CAAC,YAAY,CAAC,CAAC;IAClE,QAAQ,CAAC,OAAO,EAAE,6BAA6B,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,8BAA8B,CAAC,OAAO,CAAC,CAAC;CACzD,GAAG,8BAA8B,CAUjC;AAED,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,KAAK,IAAI,8BAA8B,CAgCjD"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { canonicalJson, sha256Json } from "../../../canonical-json.js";
|
|
2
|
+
import { deserializeKnownFileIdentity } from "../model/known-file-transaction-journal.js";
|
|
3
|
+
import { portableRepositoryPathProblem } from "../model/repository-path.js";
|
|
4
|
+
import { assertKnownFileTransactionPlan } from "./known-file-transaction-plan.js";
|
|
5
|
+
const SHA256 = /^sha256:[0-9a-f]{64}$/u;
|
|
6
|
+
const POSITIVE_INTEGER = /^[1-9][0-9]*$/u;
|
|
7
|
+
class KnownFileTransactionEnvelopeError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = "KnownFileTransactionEnvelopeError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function record(value, subject) {
|
|
14
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
15
|
+
throw new KnownFileTransactionEnvelopeError(`${subject} is invalid.`);
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
function exactKeys(value, keys, subject) {
|
|
20
|
+
if (Object.keys(value).toSorted().join(",") !== [...keys].toSorted().join(",")) {
|
|
21
|
+
throw new KnownFileTransactionEnvelopeError(`${subject} has unknown or missing fields.`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function assertIdentity(value, subject) {
|
|
25
|
+
const identity = record(value, subject);
|
|
26
|
+
exactKeys(identity, ["birthtimeNs", "dev", "ino"], subject);
|
|
27
|
+
for (const field of ["birthtimeNs", "dev", "ino"]) {
|
|
28
|
+
if (!POSITIVE_INTEGER.test(String(identity[field]))) {
|
|
29
|
+
throw new KnownFileTransactionEnvelopeError(`${subject}.${field} is invalid.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
deserializeKnownFileIdentity(identity);
|
|
33
|
+
}
|
|
34
|
+
function journalOperationKeys(operation, withTemporary) {
|
|
35
|
+
if (!withTemporary) {
|
|
36
|
+
return operation["matchedPreimage"] === undefined
|
|
37
|
+
? ["path", "state"]
|
|
38
|
+
: ["matchedPreimage", "path", "state"];
|
|
39
|
+
}
|
|
40
|
+
return [
|
|
41
|
+
...(operation["matchedPreimage"] === undefined ? [] : ["matchedPreimage"]),
|
|
42
|
+
"path",
|
|
43
|
+
...(operation["rollbackTemporaryIdentity"] === undefined
|
|
44
|
+
? []
|
|
45
|
+
: ["rollbackTemporaryIdentity"]),
|
|
46
|
+
...(operation["captureDirectoryIdentity"] === undefined
|
|
47
|
+
? []
|
|
48
|
+
: ["captureDirectoryIdentity"]),
|
|
49
|
+
...(operation["capturedPreimageIdentity"] === undefined
|
|
50
|
+
? []
|
|
51
|
+
: ["capturedPreimageIdentity"]),
|
|
52
|
+
...(operation["retirement"] === undefined ? [] : ["retirement"]),
|
|
53
|
+
"state",
|
|
54
|
+
"temporaryIdentity"
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
function assertJournalOperationIdentities(options) {
|
|
58
|
+
const subject = `Known-file journal operation ${options.index}`;
|
|
59
|
+
assertIdentity(options.operation["temporaryIdentity"], `${subject} temporary identity`);
|
|
60
|
+
if (options.operation["rollbackTemporaryIdentity"] !== undefined) {
|
|
61
|
+
if (options.precondition?.state !== "known-file") {
|
|
62
|
+
throw new KnownFileTransactionEnvelopeError(`${subject} rollback identity is invalid.`);
|
|
63
|
+
}
|
|
64
|
+
assertIdentity(options.operation["rollbackTemporaryIdentity"], `${subject} rollback temporary identity`);
|
|
65
|
+
}
|
|
66
|
+
if (options.operation["captureDirectoryIdentity"] !== undefined) {
|
|
67
|
+
if (options.precondition?.state !== "known-file") {
|
|
68
|
+
throw new KnownFileTransactionEnvelopeError(`${subject} capture directory identity is invalid.`);
|
|
69
|
+
}
|
|
70
|
+
assertIdentity(options.operation["captureDirectoryIdentity"], `${subject} capture directory identity`);
|
|
71
|
+
}
|
|
72
|
+
if (options.operation["capturedPreimageIdentity"] !== undefined) {
|
|
73
|
+
if (options.precondition?.state !== "known-file" ||
|
|
74
|
+
options.operation["captureDirectoryIdentity"] === undefined ||
|
|
75
|
+
!["preimage-captured", "destination-retired", "publishing", "published", "rollback-restored"].includes(String(options.state))) {
|
|
76
|
+
throw new KnownFileTransactionEnvelopeError(`${subject} captured preimage identity is invalid.`);
|
|
77
|
+
}
|
|
78
|
+
assertIdentity(options.operation["capturedPreimageIdentity"], `${subject} captured preimage identity`);
|
|
79
|
+
}
|
|
80
|
+
if (options.operation["retirement"] !== undefined) {
|
|
81
|
+
const retirement = record(options.operation["retirement"], `${subject} retirement`);
|
|
82
|
+
exactKeys(retirement, ["directoryIdentity", "kind", "pathIdentity", "state"], `${subject} retirement`);
|
|
83
|
+
if (!["destination", "rollback-temporary", "temporary"].includes(String(retirement["kind"])) ||
|
|
84
|
+
!["ready", "captured", "unlink-authorized"].includes(String(retirement["state"]))) {
|
|
85
|
+
throw new KnownFileTransactionEnvelopeError(`${subject} retirement transition is invalid.`);
|
|
86
|
+
}
|
|
87
|
+
assertIdentity(retirement["directoryIdentity"], `${subject} retirement directory identity`);
|
|
88
|
+
assertIdentity(retirement["pathIdentity"], `${subject} retirement path identity`);
|
|
89
|
+
}
|
|
90
|
+
if (["capture-ready", "preimage-captured", "destination-retired"].includes(String(options.state)) &&
|
|
91
|
+
options.operation["captureDirectoryIdentity"] === undefined) {
|
|
92
|
+
throw new KnownFileTransactionEnvelopeError(`${subject} lacks capture directory identity.`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function assertJournalOperation(candidate, index, plan) {
|
|
96
|
+
const operation = record(candidate, `Known-file journal operation ${index}`);
|
|
97
|
+
const state = operation["state"];
|
|
98
|
+
const withTemporary = [
|
|
99
|
+
"temporary-ready", "capture-authorized", "capture-ready", "preimage-captured",
|
|
100
|
+
"destination-retired", "publishing", "published", "rollback-restored"
|
|
101
|
+
].includes(String(state));
|
|
102
|
+
exactKeys(operation, journalOperationKeys(operation, withTemporary), `Known-file journal operation ${index}`);
|
|
103
|
+
if (operation["path"] !== plan.operations[index]?.path ||
|
|
104
|
+
![
|
|
105
|
+
"already-satisfied", "pending", "temporary-authorized", "temporary-ready", "capture-authorized", "capture-ready",
|
|
106
|
+
"preimage-captured", "destination-retired", "publishing", "published", "rollback-restored"
|
|
107
|
+
].includes(String(state))) {
|
|
108
|
+
throw new KnownFileTransactionEnvelopeError(`Known-file journal operation ${index} is invalid.`);
|
|
109
|
+
}
|
|
110
|
+
const matched = operation["matchedPreimage"];
|
|
111
|
+
const precondition = plan.operations[index]?.precondition;
|
|
112
|
+
if (matched !== undefined &&
|
|
113
|
+
(!Number.isSafeInteger(matched) || matched < 0 ||
|
|
114
|
+
precondition?.state !== "known-file" || matched >= precondition.acceptedPreimages.length)) {
|
|
115
|
+
throw new KnownFileTransactionEnvelopeError(`Known-file journal operation ${index} preimage binding is invalid.`);
|
|
116
|
+
}
|
|
117
|
+
if (withTemporary) {
|
|
118
|
+
assertJournalOperationIdentities({ index, operation, precondition, state });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function permittedParentDirectories(plan) {
|
|
122
|
+
const permitted = new Set();
|
|
123
|
+
for (const operation of plan.operations) {
|
|
124
|
+
const segments = operation.path.split("/");
|
|
125
|
+
segments.pop();
|
|
126
|
+
for (let count = 1; count <= segments.length; count += 1) {
|
|
127
|
+
permitted.add(segments.slice(0, count).join("/"));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return permitted;
|
|
131
|
+
}
|
|
132
|
+
function assertCreatedDirectories(value, plan) {
|
|
133
|
+
if (!Array.isArray(value) || value.length > 128) {
|
|
134
|
+
throw new KnownFileTransactionEnvelopeError("Known-file created-directory evidence is invalid.");
|
|
135
|
+
}
|
|
136
|
+
const permitted = permittedParentDirectories(plan);
|
|
137
|
+
const paths = [];
|
|
138
|
+
for (const [index, candidate] of value.entries()) {
|
|
139
|
+
const directory = record(candidate, `Known-file created directory ${index}`);
|
|
140
|
+
exactKeys(directory, ["identity", "path"], `Known-file created directory ${index}`);
|
|
141
|
+
if (typeof directory["path"] !== "string" ||
|
|
142
|
+
portableRepositoryPathProblem(directory["path"]) !== undefined ||
|
|
143
|
+
directory["path"].normalize("NFC") !== directory["path"] ||
|
|
144
|
+
!permitted.has(directory["path"])) {
|
|
145
|
+
throw new KnownFileTransactionEnvelopeError(`Known-file created directory ${index} path is invalid.`);
|
|
146
|
+
}
|
|
147
|
+
assertIdentity(directory["identity"], `Known-file created directory ${index} identity`);
|
|
148
|
+
paths.push(directory["path"]);
|
|
149
|
+
}
|
|
150
|
+
if (new Set(paths).size !== paths.length) {
|
|
151
|
+
throw new KnownFileTransactionEnvelopeError("Known-file created-directory evidence contains duplicates.");
|
|
152
|
+
}
|
|
153
|
+
return paths;
|
|
154
|
+
}
|
|
155
|
+
function assertJournal(value) {
|
|
156
|
+
const journal = record(value, "Known-file transaction journal");
|
|
157
|
+
exactKeys(journal, ["authorizedDirectories", "createdDirectories", "operations", "plan", "schemaVersion"], "Known-file transaction journal");
|
|
158
|
+
if (journal["schemaVersion"] !== 1) {
|
|
159
|
+
throw new KnownFileTransactionEnvelopeError("Known-file transaction journal version is unsupported.");
|
|
160
|
+
}
|
|
161
|
+
assertKnownFileTransactionPlan(journal["plan"]);
|
|
162
|
+
const plan = journal["plan"];
|
|
163
|
+
if (!Array.isArray(journal["operations"]) || journal["operations"].length !== plan.operations.length) {
|
|
164
|
+
throw new KnownFileTransactionEnvelopeError("Known-file transaction journal operations do not bind the Plan.");
|
|
165
|
+
}
|
|
166
|
+
journal["operations"].forEach((candidate, index) => {
|
|
167
|
+
assertJournalOperation(candidate, index, plan);
|
|
168
|
+
});
|
|
169
|
+
const createdPaths = assertCreatedDirectories(journal["createdDirectories"], plan);
|
|
170
|
+
const authorizedDirectories = journal["authorizedDirectories"];
|
|
171
|
+
if (!Array.isArray(authorizedDirectories) || authorizedDirectories.length > 128 ||
|
|
172
|
+
authorizedDirectories.some((path) => typeof path !== "string" ||
|
|
173
|
+
portableRepositoryPathProblem(path) !== undefined || path.normalize("NFC") !== path ||
|
|
174
|
+
!permittedParentDirectories(plan).has(path)) ||
|
|
175
|
+
new Set(authorizedDirectories).size !== authorizedDirectories.length ||
|
|
176
|
+
authorizedDirectories.some((path) => createdPaths.includes(path))) {
|
|
177
|
+
throw new KnownFileTransactionEnvelopeError("Known-file authorized-directory evidence is invalid.");
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function body(input) {
|
|
181
|
+
const payloadDigest = sha256Json(input.journal);
|
|
182
|
+
return {
|
|
183
|
+
schemaVersion: 5,
|
|
184
|
+
operationKind: "known-file-transaction",
|
|
185
|
+
recoveryHandler: {
|
|
186
|
+
id: "foundation.replace-known-file",
|
|
187
|
+
contractVersion: 1
|
|
188
|
+
},
|
|
189
|
+
foundation: input.foundation,
|
|
190
|
+
adapterContractVersion: 1,
|
|
191
|
+
payloadKind: "known-file-transaction-journal/v1",
|
|
192
|
+
state: input.state,
|
|
193
|
+
journal: input.journal,
|
|
194
|
+
payloadDigest
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
export function compileKnownFileTransactionEnvelope(input) {
|
|
198
|
+
assertJournal(input.journal);
|
|
199
|
+
if (!SHA256.test(input.foundation.buildIdentity) || input.foundation.version.length === 0) {
|
|
200
|
+
throw new KnownFileTransactionEnvelopeError("Known-file transaction Foundation identity is invalid.");
|
|
201
|
+
}
|
|
202
|
+
const envelopeBody = body(input);
|
|
203
|
+
return Object.freeze({
|
|
204
|
+
...envelopeBody,
|
|
205
|
+
envelopeDigest: sha256Json(envelopeBody)
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
export function assertKnownFileTransactionEnvelope(value) {
|
|
209
|
+
const envelope = record(value, "Known-file transaction envelope");
|
|
210
|
+
exactKeys(envelope, [
|
|
211
|
+
"adapterContractVersion", "envelopeDigest", "foundation", "journal",
|
|
212
|
+
"operationKind", "payloadDigest", "payloadKind", "recoveryHandler",
|
|
213
|
+
"schemaVersion", "state"
|
|
214
|
+
], "Known-file transaction envelope");
|
|
215
|
+
const foundation = record(envelope["foundation"], "Known-file Foundation identity");
|
|
216
|
+
const recovery = record(envelope["recoveryHandler"], "Known-file recovery handler");
|
|
217
|
+
exactKeys(foundation, ["buildIdentity", "version"], "Known-file Foundation identity");
|
|
218
|
+
exactKeys(recovery, ["contractVersion", "id"], "Known-file recovery handler");
|
|
219
|
+
if (envelope["schemaVersion"] !== 5 ||
|
|
220
|
+
envelope["operationKind"] !== "known-file-transaction" ||
|
|
221
|
+
envelope["adapterContractVersion"] !== 1 ||
|
|
222
|
+
envelope["payloadKind"] !== "known-file-transaction-journal/v1" ||
|
|
223
|
+
!["APPLYING", "COMMITTED"].includes(String(envelope["state"])) ||
|
|
224
|
+
recovery["id"] !== "foundation.replace-known-file" ||
|
|
225
|
+
recovery["contractVersion"] !== 1 ||
|
|
226
|
+
typeof foundation["version"] !== "string" ||
|
|
227
|
+
!SHA256.test(String(foundation["buildIdentity"]))) {
|
|
228
|
+
throw new KnownFileTransactionEnvelopeError("Known-file transaction envelope binding is invalid.");
|
|
229
|
+
}
|
|
230
|
+
assertJournal(envelope["journal"]);
|
|
231
|
+
const reconstructed = compileKnownFileTransactionEnvelope({
|
|
232
|
+
foundation: foundation,
|
|
233
|
+
journal: envelope["journal"],
|
|
234
|
+
state: envelope["state"]
|
|
235
|
+
});
|
|
236
|
+
if (canonicalJson(reconstructed) !==
|
|
237
|
+
canonicalJson(value)) {
|
|
238
|
+
throw new KnownFileTransactionEnvelopeError("Known-file transaction envelope is non-canonical or tampered.");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=known-file-transaction-envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-file-transaction-envelope.js","sourceRoot":"","sources":["../../../../src/repository-mutation/application/policies/known-file-transaction-envelope.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,UAAU,EAEX,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAE1F,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF,MAAM,MAAM,GAAG,wBAAwB,CAAC;AACxC,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAE1C,MAAM,iCAAkC,SAAQ,KAAK;IACnD,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mCAAmC,CAAC;IAClD,CAAC;CACF;AAED,SAAS,MAAM,CAAC,KAAc,EAAE,OAAe;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,iCAAiC,CAAC,GAAG,O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,UAAU,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9D,QAAQ,CAAC,IAAI,CAAC,KAAK,+BAA+B;QAClD,QAAQ,CAAC,iBAAiB,CAAC,KAAK,CAAC;QACjC,OAAO,UAAU,CAAC,SAAS,CAAC,KAAK,QAAQ;QACzC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,iCAAiC,CAAC,qDAAqD,CAAC,CAAC;IACrG,CAAC;IACD,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IACnC,MAAM,aAAa,GAAG,mCAAmC,CAAC;QACxD,UAAU,EAAE,UAAqE;QACjF,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC;QAC5B,KAAK,EAAE,QAAQ,CAAC,OAAO,CAA4C;KACpE,CAAC,CAAC;IACH,IAAI,aAAa,CAAC,aAA8C,CAAC;QAC/D,aAAa,CAAC,KAA2B,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,iCAAiC,CAAC,+DAA+D,CAAC,CAAC;IAC/G,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CompileKnownFileTransactionPlanInput, KnownFileTransactionPlanV1 } from "../model/known-file-transaction.js";
|
|
2
|
+
export declare class KnownFileTransactionPlanError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare function compileKnownFileTransactionPlan(input: CompileKnownFileTransactionPlanInput): KnownFileTransactionPlanV1;
|
|
6
|
+
export declare function assertKnownFileTransactionPlan(value: unknown): asserts value is KnownFileTransactionPlanV1;
|
|
7
|
+
//# sourceMappingURL=known-file-transaction-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-file-transaction-plan.d.ts","sourceRoot":"","sources":["../../../../src/repository-mutation/application/policies/known-file-transaction-plan.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,oCAAoC,EAIpC,0BAA0B,EAC3B,MAAM,oCAAoC,CAAC;AAa5C,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,YAAmB,OAAO,EAAE,MAAM,EAGjC;CACF;AAuID,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,oCAAoC,GAC1C,0BAA0B,CAmD5B;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,KAAK,IAAI,0BAA0B,CAuD7C"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { canonicalJson, sha256Bytes, sha256Json } from "../../../canonical-json.js";
|
|
2
|
+
import { findPortableRepositoryPathCollision, portableRepositoryPathProblem } from "../model/repository-path.js";
|
|
3
|
+
const MAXIMUM_OPERATION_COUNT = 32;
|
|
4
|
+
const MAXIMUM_FILE_BYTES = 8 * 1024 * 1024;
|
|
5
|
+
// Keep the canonical Base64 journal comfortably below its separate 32 MiB
|
|
6
|
+
// serialized limit. Raw transaction evidence expands by at least 4/3.
|
|
7
|
+
const MAXIMUM_TRANSACTION_BYTES = 16 * 1024 * 1024;
|
|
8
|
+
const SHA256 = /^sha256:[0-9a-f]{64}$/u;
|
|
9
|
+
export class KnownFileTransactionPlanError extends Error {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "KnownFileTransactionPlanError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function binaryCompare(left, right) {
|
|
16
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
17
|
+
}
|
|
18
|
+
function assertMode(mode, subject) {
|
|
19
|
+
if (!Number.isSafeInteger(mode) || mode < 0 || mode > 0o777) {
|
|
20
|
+
throw new KnownFileTransactionPlanError(`${subject} mode must be one portable permission value.`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function assertBytes(bytes, subject) {
|
|
24
|
+
if (!(bytes instanceof Uint8Array)) {
|
|
25
|
+
throw new KnownFileTransactionPlanError(`${subject} bytes must be Uint8Array.`);
|
|
26
|
+
}
|
|
27
|
+
if (bytes.byteLength > MAXIMUM_FILE_BYTES) {
|
|
28
|
+
throw new KnownFileTransactionPlanError(`${subject} exceeds the ${MAXIMUM_FILE_BYTES} byte limit.`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function image(bytes, mode, subject) {
|
|
32
|
+
assertBytes(bytes, subject);
|
|
33
|
+
assertMode(mode, subject);
|
|
34
|
+
const copied = Buffer.from(bytes);
|
|
35
|
+
return Object.freeze({
|
|
36
|
+
contentBase64: copied.toString("base64"),
|
|
37
|
+
digest: sha256Bytes(copied),
|
|
38
|
+
mode,
|
|
39
|
+
size: copied.byteLength
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function compareImages(left, right) {
|
|
43
|
+
return binaryCompare(canonicalJson(left), canonicalJson(right));
|
|
44
|
+
}
|
|
45
|
+
function compileOperation(operation) {
|
|
46
|
+
const problem = portableRepositoryPathProblem(operation.path);
|
|
47
|
+
if (problem !== undefined) {
|
|
48
|
+
throw new KnownFileTransactionPlanError(`Operation path ${operation.path} is not portable: ${problem}.`);
|
|
49
|
+
}
|
|
50
|
+
if (operation.path.normalize("NFC") !== operation.path) {
|
|
51
|
+
throw new KnownFileTransactionPlanError(`Operation path ${operation.path} must use NFC normalization.`);
|
|
52
|
+
}
|
|
53
|
+
if (operation.path === ".agent-teams-local" ||
|
|
54
|
+
operation.path.startsWith(".agent-teams-local/")) {
|
|
55
|
+
throw new KnownFileTransactionPlanError(`Operation path ${operation.path} overlaps Foundation's internal state namespace.`);
|
|
56
|
+
}
|
|
57
|
+
if (operation.precondition.state === "absent") {
|
|
58
|
+
return Object.freeze({
|
|
59
|
+
path: operation.path,
|
|
60
|
+
precondition: Object.freeze({ state: "absent" }),
|
|
61
|
+
postimage: image(operation.postimage.bytes, operation.postimage.mode ?? 0o644, `${operation.path} postimage`)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (operation.precondition.acceptedPreimages.length === 0) {
|
|
65
|
+
throw new KnownFileTransactionPlanError(`${operation.path} replacement requires at least one exact preimage.`);
|
|
66
|
+
}
|
|
67
|
+
if (operation.precondition.acceptedPreimages.length > 16) {
|
|
68
|
+
throw new KnownFileTransactionPlanError(`${operation.path} replacement exceeds the 16 preimage limit.`);
|
|
69
|
+
}
|
|
70
|
+
const postimageMode = operation.postimage.mode;
|
|
71
|
+
if (postimageMode === undefined) {
|
|
72
|
+
throw new KnownFileTransactionPlanError(`${operation.path} replacement requires an exact file mode.`);
|
|
73
|
+
}
|
|
74
|
+
assertMode(postimageMode, `${operation.path} postimage`);
|
|
75
|
+
const acceptedPreimages = operation.precondition.acceptedPreimages
|
|
76
|
+
.map((entry, index) => {
|
|
77
|
+
if (entry.mode !== postimageMode) {
|
|
78
|
+
throw new KnownFileTransactionPlanError(`${operation.path} replacement must preserve the exact file mode.`);
|
|
79
|
+
}
|
|
80
|
+
return image(entry.bytes, entry.mode, `${operation.path} preimage ${index}`);
|
|
81
|
+
})
|
|
82
|
+
.toSorted(compareImages);
|
|
83
|
+
for (let index = 1; index < acceptedPreimages.length; index += 1) {
|
|
84
|
+
if (canonicalJson(acceptedPreimages[index - 1]) ===
|
|
85
|
+
canonicalJson(acceptedPreimages[index])) {
|
|
86
|
+
throw new KnownFileTransactionPlanError(`${operation.path} replacement contains a duplicate exact preimage.`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const postimage = image(operation.postimage.bytes, postimageMode, `${operation.path} postimage`);
|
|
90
|
+
return Object.freeze({
|
|
91
|
+
path: operation.path,
|
|
92
|
+
precondition: Object.freeze({
|
|
93
|
+
state: "known-file",
|
|
94
|
+
acceptedPreimages: Object.freeze(acceptedPreimages)
|
|
95
|
+
}),
|
|
96
|
+
postimage
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function planBody(operations) {
|
|
100
|
+
return {
|
|
101
|
+
schemaVersion: 1,
|
|
102
|
+
protocol: "foundation.replace-known-file/v1",
|
|
103
|
+
operations
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export function compileKnownFileTransactionPlan(input) {
|
|
107
|
+
if (!Array.isArray(input.operations) || input.operations.length > MAXIMUM_OPERATION_COUNT) {
|
|
108
|
+
throw new KnownFileTransactionPlanError(`A transaction supports at most ${MAXIMUM_OPERATION_COUNT} operations.`);
|
|
109
|
+
}
|
|
110
|
+
const operations = input.operations.map(compileOperation).toSorted((left, right) => binaryCompare(left.path, right.path));
|
|
111
|
+
const collision = findPortableRepositoryPathCollision(operations.map(({ path }) => path));
|
|
112
|
+
if (collision !== undefined) {
|
|
113
|
+
throw new KnownFileTransactionPlanError(`Operation paths collide portably: ${collision.first} and ${collision.second}.`);
|
|
114
|
+
}
|
|
115
|
+
for (let index = 1; index < operations.length; index += 1) {
|
|
116
|
+
const ancestor = operations[index - 1].path;
|
|
117
|
+
const descendant = operations[index].path;
|
|
118
|
+
if (descendant.startsWith(`${ancestor}/`)) {
|
|
119
|
+
throw new KnownFileTransactionPlanError(`Operation paths overlap as ancestor and descendant: ${ancestor} and ${descendant}.`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const totalBytes = operations.reduce((total, operation) => total + operation.postimage.size +
|
|
123
|
+
(operation.precondition.state === "known-file"
|
|
124
|
+
? operation.precondition.acceptedPreimages.reduce((preimageTotal, entry) => preimageTotal + entry.size, 0)
|
|
125
|
+
: 0), 0);
|
|
126
|
+
if (totalBytes > MAXIMUM_TRANSACTION_BYTES) {
|
|
127
|
+
throw new KnownFileTransactionPlanError(`Transaction evidence exceeds the ${MAXIMUM_TRANSACTION_BYTES} byte limit.`);
|
|
128
|
+
}
|
|
129
|
+
const frozenOperations = Object.freeze(operations);
|
|
130
|
+
const body = planBody(frozenOperations);
|
|
131
|
+
const planDigest = sha256Json({
|
|
132
|
+
domain: "agent-teams.foundation.known-file-transaction-plan/v1",
|
|
133
|
+
body
|
|
134
|
+
});
|
|
135
|
+
if (!SHA256.test(planDigest)) {
|
|
136
|
+
throw new KnownFileTransactionPlanError("Compiled Plan digest is invalid.");
|
|
137
|
+
}
|
|
138
|
+
return Object.freeze({ ...body, planDigest });
|
|
139
|
+
}
|
|
140
|
+
export function assertKnownFileTransactionPlan(value) {
|
|
141
|
+
if (typeof value !== "object" ||
|
|
142
|
+
value === null ||
|
|
143
|
+
Array.isArray(value) ||
|
|
144
|
+
Reflect.get(value, "schemaVersion") !== 1 ||
|
|
145
|
+
Reflect.get(value, "protocol") !== "foundation.replace-known-file/v1" ||
|
|
146
|
+
!SHA256.test(String(Reflect.get(value, "planDigest"))) ||
|
|
147
|
+
!Array.isArray(Reflect.get(value, "operations"))) {
|
|
148
|
+
throw new KnownFileTransactionPlanError("Known-file transaction Plan is invalid.");
|
|
149
|
+
}
|
|
150
|
+
const operations = Reflect.get(value, "operations");
|
|
151
|
+
const reconstructed = compileKnownFileTransactionPlan({
|
|
152
|
+
operations: operations.map((candidate) => {
|
|
153
|
+
if (typeof candidate !== "object" || candidate === null || Array.isArray(candidate)) {
|
|
154
|
+
throw new KnownFileTransactionPlanError("Known-file transaction operation is invalid.");
|
|
155
|
+
}
|
|
156
|
+
const path = String(Reflect.get(candidate, "path"));
|
|
157
|
+
const precondition = Reflect.get(candidate, "precondition");
|
|
158
|
+
const postimage = readImage(Reflect.get(candidate, "postimage"), `${path} postimage`);
|
|
159
|
+
if (typeof precondition !== "object" || precondition === null || Array.isArray(precondition)) {
|
|
160
|
+
throw new KnownFileTransactionPlanError(`${path} precondition is invalid.`);
|
|
161
|
+
}
|
|
162
|
+
if (Reflect.get(precondition, "state") === "absent") {
|
|
163
|
+
return { path, precondition: { state: "absent" }, postimage: {
|
|
164
|
+
bytes: postimage.bytes,
|
|
165
|
+
mode: postimage.mode
|
|
166
|
+
} };
|
|
167
|
+
}
|
|
168
|
+
const accepted = Reflect.get(precondition, "acceptedPreimages");
|
|
169
|
+
if (Reflect.get(precondition, "state") !== "known-file" || !Array.isArray(accepted)) {
|
|
170
|
+
throw new KnownFileTransactionPlanError(`${path} precondition is invalid.`);
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
path,
|
|
174
|
+
precondition: {
|
|
175
|
+
state: "known-file",
|
|
176
|
+
acceptedPreimages: accepted.map((entry, index) => {
|
|
177
|
+
const parsed = readImage(entry, `${path} preimage ${index}`);
|
|
178
|
+
return { bytes: parsed.bytes, mode: parsed.mode };
|
|
179
|
+
})
|
|
180
|
+
},
|
|
181
|
+
postimage: { bytes: postimage.bytes, mode: postimage.mode }
|
|
182
|
+
};
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
if (canonicalJson(reconstructed) !==
|
|
186
|
+
canonicalJson(value)) {
|
|
187
|
+
throw new KnownFileTransactionPlanError("Known-file transaction Plan is not canonical or has an invalid digest.");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function readImage(value, subject) {
|
|
191
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
192
|
+
throw new KnownFileTransactionPlanError(`${subject} is invalid.`);
|
|
193
|
+
}
|
|
194
|
+
const contentBase64 = Reflect.get(value, "contentBase64");
|
|
195
|
+
const digest = Reflect.get(value, "digest");
|
|
196
|
+
const mode = Reflect.get(value, "mode");
|
|
197
|
+
const size = Reflect.get(value, "size");
|
|
198
|
+
if (typeof contentBase64 !== "string" ||
|
|
199
|
+
typeof digest !== "string" ||
|
|
200
|
+
!SHA256.test(digest) ||
|
|
201
|
+
typeof mode !== "number" ||
|
|
202
|
+
typeof size !== "number") {
|
|
203
|
+
throw new KnownFileTransactionPlanError(`${subject} is invalid.`);
|
|
204
|
+
}
|
|
205
|
+
const bytes = Buffer.from(contentBase64, "base64");
|
|
206
|
+
const canonicalBase64 = bytes.toString("base64");
|
|
207
|
+
const expected = image(bytes, mode, subject);
|
|
208
|
+
if (contentBase64 !== canonicalBase64 ||
|
|
209
|
+
expected.digest !== digest ||
|
|
210
|
+
expected.size !== size) {
|
|
211
|
+
throw new KnownFileTransactionPlanError(`${subject} bytes or digest are invalid.`);
|
|
212
|
+
}
|
|
213
|
+
return Object.freeze({ ...expected, bytes });
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=known-file-transaction-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known-file-transaction-plan.js","sourceRoot":"","sources":["../../../../src/repository-mutation/application/policies/known-file-transaction-plan.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EAEX,MAAM,4BAA4B,CAAC;AAQpC,OAAO,EACL,mCAAmC,EACnC,6BAA6B,EAC9B,MAAM,6BAA6B,CAAC;AAErC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAC3C,0EAA0E;AAC1E,sEAAsE;AACtE,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACnD,MAAM,MAAM,GAAG,wBAAwB,CAAC;AAExC,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IACtD,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAC9C,CAAC;CACF;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,KAAa;IAChD,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,OAAe;IAC/C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;Q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K,IAAI,EACtB,CAAC;QACD,MAAM,IAAI,6BAA6B,CAAC,GAAG,OAAO,+BAA+B,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-catalog.d.ts","sourceRoot":"","sources":["../src/schema-catalog.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"schema-catalog.d.ts","sourceRoot":"","sources":["../src/schema-catalog.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACxB,MAAM,iBAAiB,CAAC;AA0CzB,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,kBAAkB,CAE/E;AAUD,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAEjB;AAwDD,wBAAsB,YAAY,CAChC,QAAQ,EAAE,yBAAyB,EACnC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAUf"}
|