@opengeni/sdk 0.57.0 → 2.2.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -2
- package/dist/artifacts.js +5 -5
- package/dist/automations-client.d.ts +17 -0
- package/dist/automations.d.ts +3 -0
- package/dist/automations.js +78 -0
- package/dist/automations.js.map +1 -0
- package/dist/{chunk-JDLDDRNE.js → chunk-C2H7HBNP.js} +290 -33
- package/dist/chunk-C2H7HBNP.js.map +1 -0
- package/dist/{chunk-GU6JF75T.js → chunk-C4DJPZRU.js} +1 -1
- package/dist/{chunk-GU6JF75T.js.map → chunk-C4DJPZRU.js.map} +1 -1
- package/dist/{chunk-JRPFWI6T.js → chunk-G6LBVWKT.js} +2 -2
- package/dist/{chunk-HJ3HHUT5.js → chunk-GLDV5QY7.js} +16 -2
- package/dist/chunk-GLDV5QY7.js.map +1 -0
- package/dist/{chunk-ST5DDKJP.js → chunk-GW3EJ2GP.js} +52 -1
- package/dist/chunk-GW3EJ2GP.js.map +1 -0
- package/dist/{chunk-VWE2QIVO.js → chunk-XNG7YGR3.js} +23 -6
- package/dist/chunk-XNG7YGR3.js.map +1 -0
- package/dist/{chunk-PKQ377ED.js → chunk-YBQTKNTL.js} +696 -57
- package/dist/chunk-YBQTKNTL.js.map +1 -0
- package/dist/client.d.ts +151 -26
- package/dist/codex-realtime-controller.d.ts +3 -0
- package/dist/codex-realtime-controller.js +2 -2
- package/dist/codex-realtime-v3.d.ts +13 -2
- package/dist/company-brain.d.ts +32 -0
- package/dist/company-profile.d.ts +1 -1
- package/dist/core.js +4 -4
- package/dist/editable-artifacts/browser-session.d.ts +7 -3
- package/dist/editable-artifacts/controller.d.ts +4 -1
- package/dist/editable-artifacts/errors.d.ts +1 -1
- package/dist/editable-artifacts/http-live-transport.d.ts +6 -2
- package/dist/editable-artifacts/index.d.ts +2 -0
- package/dist/editable-artifacts/open-failure.d.ts +9 -0
- package/dist/editable-artifacts/types.d.ts +4 -3
- package/dist/editable-artifacts/worker/kernel-adapter.d.ts +1 -1
- package/dist/editable-artifacts-worker.js +44 -17
- package/dist/editable-artifacts-worker.js.map +1 -1
- package/dist/editable-artifacts.js +222 -119
- package/dist/editable-artifacts.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +61 -12
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +23 -0
- package/dist/interaction.js +4 -1
- package/dist/organization-private-session-settings.d.ts +6 -0
- package/dist/organization-private-session-settings.js +22 -0
- package/dist/organization-private-session-settings.js.map +1 -0
- package/dist/pr-review-client.d.ts +15 -0
- package/dist/pr-review.d.ts +4 -0
- package/dist/pr-review.js +56 -0
- package/dist/pr-review.js.map +1 -0
- package/dist/preference-registry.d.ts +8 -0
- package/dist/realtime.js +2 -2
- package/dist/retained-artifacts.d.ts +5 -1
- package/dist/types.d.ts +976 -17
- package/dist/workspace-instruction-policies.d.ts +22 -0
- package/dist/workspace-learning.d.ts +124 -0
- package/package.json +14 -2
- package/src/automations-client.ts +118 -0
- package/src/automations.ts +15 -0
- package/src/client.ts +974 -71
- package/src/codex-realtime-controller.ts +235 -5
- package/src/codex-realtime-v3.ts +162 -31
- package/src/company-brain.ts +99 -0
- package/src/company-profile.ts +4 -1
- package/src/editable-artifacts/browser-session.ts +36 -22
- package/src/editable-artifacts/controller.ts +66 -45
- package/src/editable-artifacts/errors.ts +2 -0
- package/src/editable-artifacts/http-live-transport.ts +62 -37
- package/src/editable-artifacts/index.ts +6 -0
- package/src/editable-artifacts/open-failure.ts +79 -0
- package/src/editable-artifacts/storage.ts +31 -40
- package/src/editable-artifacts/types.ts +4 -3
- package/src/editable-artifacts/worker/kernel-adapter.ts +23 -7
- package/src/editable-artifacts/worker/runtime.ts +26 -13
- package/src/editable-artifacts/worker/wire-codec.ts +23 -5
- package/src/errors.ts +1 -1
- package/src/index.ts +131 -0
- package/src/interaction.ts +95 -0
- package/src/organization-private-session-settings.ts +33 -0
- package/src/pr-review-client.ts +84 -0
- package/src/pr-review.ts +15 -0
- package/src/preference-registry.ts +9 -0
- package/src/retained-artifacts.ts +101 -0
- package/src/stream.ts +13 -2
- package/src/types.ts +1117 -16
- package/src/workspace-instruction-policies.ts +24 -0
- package/src/workspace-learning.ts +138 -0
- package/dist/chunk-HJ3HHUT5.js.map +0 -1
- package/dist/chunk-JDLDDRNE.js.map +0 -1
- package/dist/chunk-PKQ377ED.js.map +0 -1
- package/dist/chunk-ST5DDKJP.js.map +0 -1
- package/dist/chunk-VWE2QIVO.js.map +0 -1
- /package/dist/{chunk-JRPFWI6T.js.map → chunk-G6LBVWKT.js.map} +0 -0
|
@@ -3,6 +3,8 @@ export { createBrowserEditableArtifactSession, createEditableArtifactReplicaId,
|
|
|
3
3
|
export type { CreateBrowserEditableArtifactSessionOptions, EditableArtifactBrowserRuntime, } from "./browser-session.js";
|
|
4
4
|
export { EditableArtifactSyncError, EditableArtifactTransportError } from "./errors.js";
|
|
5
5
|
export type { EditableArtifactSyncErrorCode } from "./errors.js";
|
|
6
|
+
export { classifyEditableArtifactOpenFailure } from "./open-failure.js";
|
|
7
|
+
export type { EditableArtifactOpenFailureCategory, EditableArtifactOpenFailureEvent, EditableArtifactOpenFailureReporter, } from "./open-failure.js";
|
|
6
8
|
export { createEditableArtifactHttpLiveTransport } from "./http-live-transport.js";
|
|
7
9
|
export type { CreateEditableArtifactHttpLiveTransportOptions, EditableArtifactWebSocketCloseEvent, EditableArtifactWebSocketLike, EditableArtifactWebSocketMessageEvent, } from "./http-live-transport.js";
|
|
8
10
|
export { EditableArtifactStorageConflictError, IndexedDbEditableArtifactStorage, MemoryEditableArtifactStorage, } from "./storage.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type EditableArtifactOpenFailureCategory = "unsupported_old_format" | "byte_corruption" | "authored_causal_mismatch" | "runtime_package_mismatch" | "projection_parity_ci_failure";
|
|
2
|
+
/** Content-free, bounded telemetry safe to emit for workbook-open failures. */
|
|
3
|
+
export type EditableArtifactOpenFailureEvent = Readonly<{
|
|
4
|
+
category: EditableArtifactOpenFailureCategory;
|
|
5
|
+
code: string;
|
|
6
|
+
}>;
|
|
7
|
+
export type EditableArtifactOpenFailureReporter = (event: EditableArtifactOpenFailureEvent) => void;
|
|
8
|
+
/** Maps only stable error codes; messages and workbook/formula content are ignored. */
|
|
9
|
+
export declare function classifyEditableArtifactOpenFailure(error: unknown): EditableArtifactOpenFailureEvent | null;
|
|
@@ -33,7 +33,8 @@ type EditableArtifactSnapshotCommon = {
|
|
|
33
33
|
export type EditableArtifactSpreadsheetSnapshot = EditableArtifactSnapshotCommon & {
|
|
34
34
|
modality: "spreadsheet";
|
|
35
35
|
causalFrontier: EditableArtifactCausalFrontier;
|
|
36
|
-
|
|
36
|
+
operationProtocolVersion: number;
|
|
37
|
+
snapshotVersion: number;
|
|
37
38
|
};
|
|
38
39
|
export type EditableArtifactSerializedSnapshot = EditableArtifactSnapshotCommon & {
|
|
39
40
|
modality: EditableArtifactSerializedModality;
|
|
@@ -54,7 +55,7 @@ type EditableArtifactCommittedTransactionCommon = {
|
|
|
54
55
|
export type EditableArtifactSpreadsheetCommittedTransaction = EditableArtifactCommittedTransactionCommon & {
|
|
55
56
|
modality: "spreadsheet";
|
|
56
57
|
causalFrontier: EditableArtifactCausalFrontier;
|
|
57
|
-
|
|
58
|
+
operationProtocolVersion: number;
|
|
58
59
|
/** Exact whole canonical OGACO committed-transaction envelope. */
|
|
59
60
|
committedTransactionBytes: Uint8Array;
|
|
60
61
|
};
|
|
@@ -202,7 +203,7 @@ export type EditableArtifactStoredReplica = {
|
|
|
202
203
|
};
|
|
203
204
|
type EditableArtifactBootstrapCommon = {
|
|
204
205
|
artifactId: EditableArtifactId;
|
|
205
|
-
|
|
206
|
+
liveProtocolVersion: number;
|
|
206
207
|
headSequence: number;
|
|
207
208
|
headStateHash: string;
|
|
208
209
|
kernelVersion: string;
|
|
@@ -2,7 +2,7 @@ import type { ArtifactWorkerInitializeInput } from "./wire-codec.js";
|
|
|
2
2
|
import type { EditableArtifactModality } from "../types.js";
|
|
3
3
|
export type ArtifactWorkerKernelSession = {
|
|
4
4
|
readonly modality: EditableArtifactModality;
|
|
5
|
-
/** Replays one exact whole canonical
|
|
5
|
+
/** Replays one exact whole canonical OGACO002 transaction. */
|
|
6
6
|
applyCommitted: (committedTransactionBytes: Uint8Array) => void;
|
|
7
7
|
/** Authors and applies one exact OGATX001 intent over the current frontier. */
|
|
8
8
|
applyPending: (intentBytes: Uint8Array) => void;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
requireMatchingHash,
|
|
16
16
|
sha256Hex,
|
|
17
17
|
transferListForArtifactWorkerRpcMessage
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-XNG7YGR3.js";
|
|
19
19
|
|
|
20
20
|
// src/editable-artifacts/worker/kernel-adapter.ts
|
|
21
21
|
import {
|
|
@@ -23,9 +23,18 @@ import {
|
|
|
23
23
|
EDITABLE_ARTIFACT_INTENT_MAX_BYTES,
|
|
24
24
|
EDITABLE_ARTIFACT_INTENT_VERSION,
|
|
25
25
|
EDITABLE_ARTIFACT_PRODUCT_MAX_SNAPSHOT_BYTES,
|
|
26
|
-
SPREADSHEET_ARTIFACT_COMMAND_VERSION
|
|
26
|
+
SPREADSHEET_ARTIFACT_COMMAND_VERSION,
|
|
27
|
+
SPREADSHEET_ARTIFACT_MODEL_SCHEMA_VERSION
|
|
27
28
|
} from "@opengeni/contracts/editable-artifacts";
|
|
28
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
SPREADSHEET_COLLABORATION_SNAPSHOT_VERSION,
|
|
31
|
+
SPREADSHEET_KERNEL_COMMAND_VERSION,
|
|
32
|
+
SPREADSHEET_KERNEL_SNAPSHOT_VERSION
|
|
33
|
+
} from "@opengeni/contracts/editable-artifact-versions";
|
|
34
|
+
import {
|
|
35
|
+
COMMITTED_TRANSACTION_PROTOCOL_VERSION,
|
|
36
|
+
MAX_COMMITTED_TRANSACTION_BYTES
|
|
37
|
+
} from "@opengeni/contracts/editable-artifact-committed-transaction";
|
|
29
38
|
var ArtifactWorkerPendingProjectionError = class extends Error {
|
|
30
39
|
code;
|
|
31
40
|
constructor(code, message = "pending transaction cannot project over confirmed state") {
|
|
@@ -391,6 +400,7 @@ function decodeCapabilities(bytes) {
|
|
|
391
400
|
"safeRust",
|
|
392
401
|
"sessionForks",
|
|
393
402
|
"spreadsheetCommandVersion",
|
|
403
|
+
"spreadsheetModelSchemaVersion",
|
|
394
404
|
"statefulSessions",
|
|
395
405
|
"textLayout",
|
|
396
406
|
"textLayoutFontBundleVersion",
|
|
@@ -446,6 +456,10 @@ function decodeCapabilities(bytes) {
|
|
|
446
456
|
value.spreadsheetCommandVersion,
|
|
447
457
|
"spreadsheetCommandVersion"
|
|
448
458
|
),
|
|
459
|
+
spreadsheetModelSchemaVersion: positiveInteger(
|
|
460
|
+
value.spreadsheetModelSchemaVersion,
|
|
461
|
+
"spreadsheetModelSchemaVersion"
|
|
462
|
+
),
|
|
449
463
|
maxCellsPerBatch: positiveInteger(value.maxCellsPerBatch, "maxCellsPerBatch"),
|
|
450
464
|
maxCommands: positiveInteger(value.maxCommands, "maxCommands"),
|
|
451
465
|
maxSnapshotBytes: positiveInteger(value.maxSnapshotBytes, "maxSnapshotBytes"),
|
|
@@ -568,7 +582,7 @@ function decodeCapabilities(bytes) {
|
|
|
568
582
|
"workbookMetadataQueries"
|
|
569
583
|
)
|
|
570
584
|
};
|
|
571
|
-
if (normalized.abiVersion !== 1 || normalized.buildIdentityFormat !== "utf8" || normalized.canonicalStateHash !== "sha256:canonical-snapshot" || normalized.editableArtifactIntentVersion !== EDITABLE_ARTIFACT_INTENT_VERSION || normalized.spreadsheetCommandVersion !== SPREADSHEET_ARTIFACT_COMMAND_VERSION || normalized.collaborationSnapshotVersion !==
|
|
585
|
+
if (normalized.abiVersion !== 1 || normalized.buildIdentityFormat !== "utf8" || normalized.canonicalStateHash !== "sha256:canonical-snapshot" || normalized.editableArtifactIntentVersion !== EDITABLE_ARTIFACT_INTENT_VERSION || normalized.spreadsheetCommandVersion !== SPREADSHEET_ARTIFACT_COMMAND_VERSION || normalized.spreadsheetModelSchemaVersion !== SPREADSHEET_ARTIFACT_MODEL_SCHEMA_VERSION || normalized.collaborationSnapshotVersion !== SPREADSHEET_COLLABORATION_SNAPSHOT_VERSION || normalized.commandSchemaVersion !== SPREADSHEET_KERNEL_COMMAND_VERSION || normalized.committedTransactionVersion !== COMMITTED_TRANSACTION_PROTOCOL_VERSION || normalized.documentCommandVersion !== 1 || normalized.documentQueryResponseVersion !== 1 || normalized.documentQueryVersion !== 1 || normalized.documentReceiptVersion !== 1 || normalized.documentSnapshotVersion !== 1 || normalized.documentStatefulSessions !== normalized.document || normalized.kernelSnapshotVersion !== SPREADSHEET_KERNEL_SNAPSHOT_VERSION || normalized.maxCellsPerBatch !== WASM_MAX_CELLS_PER_BATCH || normalized.maxCommandBytes !== WASM_MAX_COMMAND_BYTES || normalized.maxSpreadsheetCommandBytes !== EDITABLE_ARTIFACT_COMMAND_MAX_BYTES || normalized.maxCommands !== 1e4 || normalized.maxIntentBytes !== EDITABLE_ARTIFACT_INTENT_MAX_BYTES || normalized.maxCommittedTransactionBytes !== MAX_COMMITTED_TRANSACTION_BYTES || normalized.maxDocumentCommandBytes !== WASM_MAX_COMMAND_BYTES || normalized.maxDocumentCommands !== 4096 || normalized.maxDocumentQueryBytes !== 256 || normalized.maxDocumentQueryResponseBytes !== 8 * 1024 * 1024 || normalized.maxDocumentSnapshotBytes !== WASM_MAX_SNAPSHOT_BYTES || normalized.maxMetadataScannedCells !== 4e6 || normalized.maxQueryBytes !== 68 || normalized.maxQueryResponseBytes !== 8 * 1024 * 1024 || normalized.maxViewportArea !== 1048576 || normalized.maxViewportCells !== 262144 || normalized.maxMetadataSheets !== 1e4 || normalized.maxPresentationCommandBytes !== 4 * 1024 * 1024 || normalized.maxPresentationQueryBytes !== 96 || normalized.maxPresentationResponseBytes !== 8 * 1024 * 1024 || normalized.maxPresentationSnapshotBytes !== WASM_MAX_SNAPSHOT_BYTES || normalized.maxTextLayoutFontBundleBytes !== 48 * 1024 * 1024 || normalized.maxTextLayoutRequestBytes !== 4 * 1024 * 1024 || normalized.maxTextLayoutResponseBytes !== 32 * 1024 * 1024 || normalized.maxSnapshotBytes !== WASM_MAX_SNAPSHOT_BYTES || normalized.queryResponseVersion !== 1 || normalized.queryVersion !== 1 || normalized.receiptSchemaVersion !== 1 || normalized.retainedRenderPatchVersion !== 1 || normalized.retainedRenderTileVersion !== 1 || normalized.presentationCommandVersion !== 1 || normalized.presentationQueryResponseVersion !== 1 || normalized.presentationQueryVersion !== 1 || normalized.presentationSnapshotVersion !== 1 || normalized.presentationStatefulSessions !== normalized.presentation || normalized.safeRust !== true || normalized.statefulSessions !== true || normalized.textLayoutFontBundleVersion !== 1 || normalized.textLayoutRequestVersion !== 1 || normalized.textLayoutResponseVersion !== 1 || normalized.textLayoutStatefulSessions !== normalized.textLayout || normalized.sessionForks !== true || normalized.transport !== "bounded-uint8array" || normalized.workbookMetadataQueries !== normalized.collaboration) {
|
|
572
586
|
throw adapterError(
|
|
573
587
|
"incompatible_wasm_build",
|
|
574
588
|
"WASM capabilities do not match the SDK protocol"
|
|
@@ -612,7 +626,7 @@ function capabilityProfile(modality, capabilities) {
|
|
|
612
626
|
);
|
|
613
627
|
}
|
|
614
628
|
return {
|
|
615
|
-
modelSchemaVersion: capabilities.
|
|
629
|
+
modelSchemaVersion: capabilities.spreadsheetModelSchemaVersion,
|
|
616
630
|
commandVersion: capabilities.spreadsheetCommandVersion,
|
|
617
631
|
maximumSnapshotBytes: capabilities.maxSnapshotBytes,
|
|
618
632
|
maximumCommandBytes: capabilities.maxSpreadsheetCommandBytes,
|
|
@@ -755,9 +769,13 @@ import {
|
|
|
755
769
|
decodeEditableArtifactMutationIntent,
|
|
756
770
|
hashEditableArtifactMutationIntent
|
|
757
771
|
} from "@opengeni/contracts/editable-artifacts";
|
|
758
|
-
import {
|
|
772
|
+
import {
|
|
773
|
+
COMMITTED_TRANSACTION_PROTOCOL_VERSION as COMMITTED_TRANSACTION_PROTOCOL_VERSION2,
|
|
774
|
+
decodeCommittedTransactionSummary
|
|
775
|
+
} from "@opengeni/contracts/editable-artifact-committed-transaction";
|
|
759
776
|
import { editableArtifactCodecFor } from "@opengeni/contracts/editable-artifact-codec-registry";
|
|
760
777
|
import { decodeEditableArtifactSerializedCommit } from "@opengeni/contracts/editable-artifact-serialized-commit";
|
|
778
|
+
import { SPREADSHEET_COLLABORATION_SNAPSHOT_VERSION as SPREADSHEET_COLLABORATION_SNAPSHOT_VERSION2 } from "@opengeni/contracts/editable-artifact-versions";
|
|
761
779
|
var MAX_KNOWN_REQUESTS = 64;
|
|
762
780
|
var MAX_QUEUED_REQUEST_BYTES = 192 * 1024 * 1024;
|
|
763
781
|
var MAX_PENDING_AGGREGATE_BYTES = 64 * 1024 * 1024;
|
|
@@ -920,15 +938,17 @@ var ArtifactWorkerRuntime = class {
|
|
|
920
938
|
"snapshot"
|
|
921
939
|
);
|
|
922
940
|
const snapshot = decodeSnapshotMetadata(frame.metadata, ownedBytes);
|
|
923
|
-
if (snapshot.modality !== initialization.modality || snapshot.modality !== adapter.modality || snapshot.modality === "spreadsheet" && snapshot.
|
|
941
|
+
if (snapshot.modality !== initialization.modality || snapshot.modality !== adapter.modality || snapshot.modality === "spreadsheet" && (snapshot.operationProtocolVersion !== COMMITTED_TRANSACTION_PROTOCOL_VERSION2 || snapshot.snapshotVersion !== SPREADSHEET_COLLABORATION_SNAPSHOT_VERSION2) || snapshot.modelSchemaVersion !== adapter.modelSchemaVersion) {
|
|
924
942
|
throw runtimeError(
|
|
925
943
|
"unsupported_protocol",
|
|
926
|
-
"snapshot protocol/
|
|
944
|
+
"snapshot protocol/schema is incompatible with the loaded collaboration kernel"
|
|
927
945
|
);
|
|
928
946
|
}
|
|
929
947
|
const digest = await sha256Hex(ownedBytes);
|
|
930
948
|
this.throwIfCancelled(frame.requestId);
|
|
931
|
-
|
|
949
|
+
if (digest !== snapshot.digest) {
|
|
950
|
+
throw runtimeError("byte_corruption", "snapshot digest does not match its bytes");
|
|
951
|
+
}
|
|
932
952
|
const canonical = requireBytesWithin(
|
|
933
953
|
adapter.canonicalizeSnapshot(ownedBytes),
|
|
934
954
|
initialization.maximumSnapshotBytes,
|
|
@@ -946,7 +966,12 @@ var ArtifactWorkerRuntime = class {
|
|
|
946
966
|
try {
|
|
947
967
|
stateHash = await nextConfirmed.stateHash();
|
|
948
968
|
this.throwIfCancelled(frame.requestId);
|
|
949
|
-
|
|
969
|
+
if (stateHash !== snapshot.stateHash) {
|
|
970
|
+
throw runtimeError(
|
|
971
|
+
"authored_causal_mismatch",
|
|
972
|
+
"snapshot authored state does not match its state hash"
|
|
973
|
+
);
|
|
974
|
+
}
|
|
950
975
|
if (snapshot.modality !== "spreadsheet" && nextConfirmed.nativeRevision() !== snapshot.nativeRevision) {
|
|
951
976
|
throw runtimeError(
|
|
952
977
|
"kernel_diverged",
|
|
@@ -968,7 +993,7 @@ var ArtifactWorkerRuntime = class {
|
|
|
968
993
|
artifactId: snapshot.artifactId,
|
|
969
994
|
modality: "spreadsheet",
|
|
970
995
|
sequence: snapshot.sequence,
|
|
971
|
-
protocolVersion:
|
|
996
|
+
protocolVersion: adapter.protocolVersion,
|
|
972
997
|
kernelVersion: snapshot.kernelVersion,
|
|
973
998
|
modelSchemaVersion: snapshot.modelSchemaVersion,
|
|
974
999
|
stateHash,
|
|
@@ -1172,7 +1197,7 @@ var ArtifactWorkerRuntime = class {
|
|
|
1172
1197
|
if (transaction.modality !== installed.modality) {
|
|
1173
1198
|
throw runtimeError("modality_mismatch", "committed transaction modality is incompatible");
|
|
1174
1199
|
}
|
|
1175
|
-
if (transaction.modality === "spreadsheet" && transaction.
|
|
1200
|
+
if (transaction.modality === "spreadsheet" && transaction.operationProtocolVersion !== COMMITTED_TRANSACTION_PROTOCOL_VERSION2)
|
|
1176
1201
|
throw runtimeError("unsupported_protocol", "committed transaction protocol is incompatible");
|
|
1177
1202
|
if (transaction.startSequence !== installed.sequence + 1) {
|
|
1178
1203
|
throw runtimeError("invalid_sequence", "committed transaction is not contiguous");
|
|
@@ -1559,14 +1584,14 @@ function assertCommittedEnvelopeMatchesOuter(transaction) {
|
|
|
1559
1584
|
} catch (error) {
|
|
1560
1585
|
throw new ArtifactWorkerProtocolError(
|
|
1561
1586
|
"invalid_committed_transaction",
|
|
1562
|
-
"committed transaction is not canonical
|
|
1587
|
+
"committed transaction is not canonical OGACO002",
|
|
1563
1588
|
{ cause: error }
|
|
1564
1589
|
);
|
|
1565
1590
|
}
|
|
1566
|
-
if (summary.operationProtocolVersion !== transaction.
|
|
1591
|
+
if (summary.operationProtocolVersion !== transaction.operationProtocolVersion || summary.transactionId !== transaction.transactionId || summary.priorStateHash !== transaction.priorStateHash || summary.stateHash !== transaction.stateHash || !frontiersEqual(summary.resultingCausalFrontier, transaction.causalFrontier)) {
|
|
1567
1592
|
throw runtimeError(
|
|
1568
1593
|
"committed_metadata_mismatch",
|
|
1569
|
-
"outer committed metadata disagrees with its exact
|
|
1594
|
+
"outer committed metadata disagrees with its exact OGACO002 envelope"
|
|
1570
1595
|
);
|
|
1571
1596
|
}
|
|
1572
1597
|
}
|
|
@@ -1638,8 +1663,9 @@ function asWorkerFailure(error) {
|
|
|
1638
1663
|
};
|
|
1639
1664
|
}
|
|
1640
1665
|
if (error instanceof Error) {
|
|
1666
|
+
const rawCode = error.code;
|
|
1641
1667
|
return {
|
|
1642
|
-
code: "kernel_failed",
|
|
1668
|
+
code: typeof rawCode === "string" ? normalizeErrorCode(rawCode) : "kernel_failed",
|
|
1643
1669
|
message: sanitizeErrorMessage(error.message || "artifact kernel failed"),
|
|
1644
1670
|
retryable: false
|
|
1645
1671
|
};
|
|
@@ -1655,7 +1681,8 @@ function asProtocolError(error) {
|
|
|
1655
1681
|
);
|
|
1656
1682
|
}
|
|
1657
1683
|
function normalizeErrorCode(value) {
|
|
1658
|
-
|
|
1684
|
+
const normalized = value.toLowerCase();
|
|
1685
|
+
return /^[a-z][a-z0-9_]{0,127}$/.test(normalized) ? normalized : "kernel_failed";
|
|
1659
1686
|
}
|
|
1660
1687
|
function sanitizeErrorMessage(value) {
|
|
1661
1688
|
let output = "";
|