@amalgm/shell 0.1.111 → 0.1.113

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.
@@ -282,7 +282,7 @@ export class WireClient {
282
282
  sendHello() {
283
283
  this.send({
284
284
  type: "hello",
285
- protocol_version: 12,
285
+ protocol_version: 13,
286
286
  runtime_version: this.options.runtimeVersion,
287
287
  instance_id: this.instance,
288
288
  boot_ts: this.boot,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amalgm/shell",
3
- "version": "0.1.111",
3
+ "version": "0.1.113",
4
4
  "description": "The Amalgm boot shell — the runtime assembled from published @amalgm SDK bricks. Composition and parity ground for the lego-driven engine rewrite.",
5
5
  "type": "module",
6
6
  "private": false,
@@ -40,7 +40,7 @@
40
40
  "@amalgm/browser": "0.1.0",
41
41
  "@amalgm/chat": "0.1.2",
42
42
  "@amalgm/core": "0.2.1",
43
- "@amalgm/live": "0.2.53",
43
+ "@amalgm/live": "0.2.54",
44
44
  "@amalgm/tools": "0.1.3",
45
45
  "@anthropic-ai/claude-agent-sdk": "^0.3.224",
46
46
  "@homebridge/node-pty-prebuilt-multiarch": "0.13.1",
@@ -1,28 +0,0 @@
1
- import type { WireClient } from "./wire-client.js";
2
- /** Per-message law mirrored from the gateway's MAX_OPERATION_BYTES: an
3
- * operation at or under this bound travels inline in the submit frame. */
4
- export declare const MAX_INLINE_OPERATION_BYTES: number;
5
- /** Byte slice size for staged pages, comfortably under the per-message law. */
6
- export declare const MUTATION_PAGE_BYTES: number;
7
- type Frame = Record<string, unknown> & {
8
- type: string;
9
- };
10
- /** Publishes one mutation operation of any size as ONE atomic commit.
11
- *
12
- * The operation arrives as its canonical UTF-8 bytes, serialized exactly
13
- * once by the caller — this function never re-serializes a graph. A small
14
- * operation travels inline in the submit frame, byte-identical to the
15
- * pre-paging wire. A larger one stages as byte pages of its canonical
16
- * JSON, then submits a reference the gateway assembles into the same commit
17
- * path — transport pages, the operation never does. Every attempt stages
18
- * afresh, so a replay after a lost acknowledgement or dropped connection is
19
- * self-sufficient: the authority answers a known mutation id with its
20
- * original acknowledgement.
21
- *
22
- * Requires wire protocol >= 8: an older gateway drops the stage frame at its
23
- * admission list and a paged publish could never complete. Paging is a
24
- * bridge — the gateway reassembles the whole graph and the database journals
25
- * it as one large operation; the eventual endpoint is immutable graph pages
26
- * with a small atomically-committed graph-head pointer. */
27
- export declare function submitMutationOperation(wire: Pick<WireClient, "request" | "requestBinary">, envelope: Record<string, unknown>, operation: Buffer, onLeg?: (leg: "stage" | "submit", durationMs: number) => void): Promise<Frame>;
28
- export {};
@@ -1,61 +0,0 @@
1
- import { createHash } from "node:crypto";
2
- /** Per-message law mirrored from the gateway's MAX_OPERATION_BYTES: an
3
- * operation at or under this bound travels inline in the submit frame. */
4
- export const MAX_INLINE_OPERATION_BYTES = 8 * 1024 * 1024;
5
- /** Byte slice size for staged pages, comfortably under the per-message law. */
6
- export const MUTATION_PAGE_BYTES = 4 * 1024 * 1024;
7
- /** Publishes one mutation operation of any size as ONE atomic commit.
8
- *
9
- * The operation arrives as its canonical UTF-8 bytes, serialized exactly
10
- * once by the caller — this function never re-serializes a graph. A small
11
- * operation travels inline in the submit frame, byte-identical to the
12
- * pre-paging wire. A larger one stages as byte pages of its canonical
13
- * JSON, then submits a reference the gateway assembles into the same commit
14
- * path — transport pages, the operation never does. Every attempt stages
15
- * afresh, so a replay after a lost acknowledgement or dropped connection is
16
- * self-sufficient: the authority answers a known mutation id with its
17
- * original acknowledgement.
18
- *
19
- * Requires wire protocol >= 8: an older gateway drops the stage frame at its
20
- * admission list and a paged publish could never complete. Paging is a
21
- * bridge — the gateway reassembles the whole graph and the database journals
22
- * it as one large operation; the eventual endpoint is immutable graph pages
23
- * with a small atomically-committed graph-head pointer. */
24
- export async function submitMutationOperation(wire, envelope, operation, onLeg) {
25
- const canonical = operation;
26
- const started = performance.now();
27
- if (canonical.byteLength <= MAX_INLINE_OPERATION_BYTES) {
28
- const frame = await wire.request({
29
- type: "shared.mutation.submit",
30
- envelope: { ...envelope, operation: JSON.parse(canonical.toString("utf8")) },
31
- }, ["shared.mutation.ack"]);
32
- onLeg?.("submit", performance.now() - started);
33
- return frame;
34
- }
35
- const staged = {
36
- page_count: Math.ceil(canonical.byteLength / MUTATION_PAGE_BYTES),
37
- operation_bytes: canonical.byteLength,
38
- operation_sha256: createHash("sha256").update(canonical).digest("hex"),
39
- };
40
- for (let index = 0; index < staged.page_count; index += 1) {
41
- const page = canonical.subarray(index * MUTATION_PAGE_BYTES, Math.min((index + 1) * MUTATION_PAGE_BYTES, canonical.byteLength));
42
- await wire.requestBinary({
43
- type: "shared.mutation.stage",
44
- resource_id: envelope.resourceId,
45
- mutation_id: envelope.mutationId,
46
- page_index: index,
47
- ...staged,
48
- bytes: page.byteLength,
49
- }, page, ["shared.mutation.staged"]);
50
- }
51
- const submitStarted = performance.now();
52
- onLeg?.("stage", submitStarted - started);
53
- const frame = await wire.request({
54
- type: "shared.mutation.submit",
55
- envelope,
56
- staged,
57
- }, ["shared.mutation.ack"]);
58
- onLeg?.("submit", performance.now() - submitStarted);
59
- return frame;
60
- }
61
- //# sourceMappingURL=paged-mutation-submit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"paged-mutation-submit.js","sourceRoot":"","sources":["../src/paged-mutation-submit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC;0EAC0E;AAC1E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAInD;;;;;;;;;;;;;;;;2DAgB2D;AAC3D,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAAmD,EACnD,QAAiC,EACjC,SAAiB,EACjB,KAA6D;IAE7D,MAAM,SAAS,GA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