@moltzap/protocol 2026.505.3 → 2026.505.4

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.
@@ -25,12 +25,44 @@ export type EndpointAddress = BrandedString<"EndpointAddress">;
25
25
  * is the single edit point for new endpoint kinds. */
26
26
  export declare const ENDPOINT_ADDRESS_KINDS: readonly ["agent", "app"];
27
27
  export type EndpointAddressKind = (typeof ENDPOINT_ADDRESS_KINDS)[number];
28
+ /**
29
+ * Common prefix for every {@link EndpointAddress} on the wire — `tm:`.
30
+ * Exported so server-side code that mints addresses or routes by kind
31
+ * does not re-declare the same string and silently fork.
32
+ */
33
+ export declare const ENDPOINT_ADDRESS_PREFIX = "tm:";
28
34
  /** Predicate that an endpoint address has the canonical wire shape:
29
35
  * `tm:<kind>:<uuid>`. Exported for tests and reviewers. */
30
36
  export declare const isEndpointAddress: (value: unknown) => value is EndpointAddress;
31
37
  /** Brand a raw string as an {@link EndpointAddress}. Throws if the value
32
38
  * fails {@link isEndpointAddress}. */
33
39
  export declare const endpointAddress: (value: string) => EndpointAddress;
40
+ /**
41
+ * Read the `kind` segment out of a branded {@link EndpointAddress}.
42
+ *
43
+ * The brand predicate at {@link isEndpointAddress} already proves the
44
+ * shape `tm:<kind>:<uuid>` with `kind ∈ {@link ENDPOINT_ADDRESS_KINDS}`.
45
+ * This helper checks the kinds in declaration order and returns the
46
+ * first match. Adding a new kind to the const tuple automatically
47
+ * extends this dispatch as long as the brand predicate is updated in
48
+ * lockstep — the {@link ENDPOINT_ADDRESS_KINDS}-driven loop owns the
49
+ * exhaustiveness story.
50
+ *
51
+ * The trailing `return ENDPOINT_ADDRESS_KINDS[0]` is unreachable for any
52
+ * well-formed branded value (the brand guarantees at least one match)
53
+ * but appears for the type checker — `for...of` does not narrow to a
54
+ * non-empty result. The brand's own tests cover the malformed case.
55
+ */
56
+ export declare const endpointAddressKind: (address: EndpointAddress) => EndpointAddressKind;
57
+ /**
58
+ * Mint an `EndpointAddress` from a kind and a UUID. The single
59
+ * construction site for `tm:<kind>:<uuid>` strings — every other
60
+ * caller routes through here so the wire format does not fork.
61
+ *
62
+ * Throws if the resulting string fails {@link isEndpointAddress} (e.g.,
63
+ * `uuid` is not a UUID).
64
+ */
65
+ export declare const makeEndpointAddress: (kind: EndpointAddressKind, uuid: string) => EndpointAddress;
34
66
  /**
35
67
  * The kinds of endpoints the actor-model network resolves.
36
68
  *
@@ -1 +1 @@
1
- {"version":3,"file":"actor-model.d.ts","sourceRoot":"","sources":["../../src/network/actor-model.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAMlD,qEAAqE;AACrE,MAAM,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,MAAM,KAAG,MAA4B,CAAC;AAEpE,iFAAiF;AACjF,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/C,2FAA2F;AAC3F,eAAO,MAAM,OAAO,GAAI,OAAO,MAAM,KAAG,OAA8B,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC,iBAAiB,CAAC,CAAC;AAE/D;uDACuD;AACvD,eAAO,MAAM,sBAAsB,2BAA4B,CAAC;AAChE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAM1E;4DAC4D;AAC5D,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,eAW3D,CAAC;AASF;uCACuC;AACvC,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,eACnB,CAAC;AAM9B;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,aAAa,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,oBAA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AAO,MAAM,eAAe,GAAI,OAAO,MAAM,KAAG,eACnB,CAAC;AAE9B;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,eAAe,KACvB,mBAOF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,mBAAmB,EACzB,MAAM,MAAM,KACX,eAC2D,CAAC;AAM/D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,aAAa,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;CACnC,CAAC;AAMN;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC"}
@@ -28,7 +28,12 @@ export const agentId = (value) => AgentIdBrand(value);
28
28
  /** Endpoint kinds that may appear at the address prefix. Extending this list
29
29
  * is the single edit point for new endpoint kinds. */
30
30
  export const ENDPOINT_ADDRESS_KINDS = ["agent", "app"];
31
- const ENDPOINT_ADDRESS_PREFIX = "tm:";
31
+ /**
32
+ * Common prefix for every {@link EndpointAddress} on the wire — `tm:`.
33
+ * Exported so server-side code that mints addresses or routes by kind
34
+ * does not re-declare the same string and silently fork.
35
+ */
36
+ export const ENDPOINT_ADDRESS_PREFIX = "tm:";
32
37
  const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
33
38
  /** Predicate that an endpoint address has the canonical wire shape:
34
39
  * `tm:<kind>:<uuid>`. Exported for tests and reviewers. */
@@ -50,4 +55,38 @@ const EndpointAddressBrand = Brand.refined(isEndpointAddress, (value) => Brand.e
50
55
  /** Brand a raw string as an {@link EndpointAddress}. Throws if the value
51
56
  * fails {@link isEndpointAddress}. */
52
57
  export const endpointAddress = (value) => EndpointAddressBrand(value);
58
+ /**
59
+ * Read the `kind` segment out of a branded {@link EndpointAddress}.
60
+ *
61
+ * The brand predicate at {@link isEndpointAddress} already proves the
62
+ * shape `tm:<kind>:<uuid>` with `kind ∈ {@link ENDPOINT_ADDRESS_KINDS}`.
63
+ * This helper checks the kinds in declaration order and returns the
64
+ * first match. Adding a new kind to the const tuple automatically
65
+ * extends this dispatch as long as the brand predicate is updated in
66
+ * lockstep — the {@link ENDPOINT_ADDRESS_KINDS}-driven loop owns the
67
+ * exhaustiveness story.
68
+ *
69
+ * The trailing `return ENDPOINT_ADDRESS_KINDS[0]` is unreachable for any
70
+ * well-formed branded value (the brand guarantees at least one match)
71
+ * but appears for the type checker — `for...of` does not narrow to a
72
+ * non-empty result. The brand's own tests cover the malformed case.
73
+ */
74
+ export const endpointAddressKind = (address) => {
75
+ const raw = address;
76
+ const rest = raw.slice(ENDPOINT_ADDRESS_PREFIX.length);
77
+ for (const kind of ENDPOINT_ADDRESS_KINDS) {
78
+ if (rest.startsWith(`${kind}:`))
79
+ return kind;
80
+ }
81
+ return ENDPOINT_ADDRESS_KINDS[0];
82
+ };
83
+ /**
84
+ * Mint an `EndpointAddress` from a kind and a UUID. The single
85
+ * construction site for `tm:<kind>:<uuid>` strings — every other
86
+ * caller routes through here so the wire format does not fork.
87
+ *
88
+ * Throws if the resulting string fails {@link isEndpointAddress} (e.g.,
89
+ * `uuid` is not a UUID).
90
+ */
91
+ export const makeEndpointAddress = (kind, uuid) => endpointAddress(`${ENDPOINT_ADDRESS_PREFIX}${kind}:${uuid}`);
53
92
  //# sourceMappingURL=actor-model.js.map
@@ -1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CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,IAAyB,EACzB,IAAY,EACK,EAAE,CACnB,eAAe,CAAC,GAAG,uBAAuB,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const PROTOCOL_VERSION = "2026.505.3";
1
+ export declare const PROTOCOL_VERSION = "2026.505.4";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Auto-bumped by publish workflow
2
- export const PROTOCOL_VERSION = "2026.505.3";
2
+ export const PROTOCOL_VERSION = "2026.505.4";
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moltzap/protocol",
3
- "version": "2026.505.3",
3
+ "version": "2026.505.4",
4
4
  "description": "Protocol types and validators for MoltZap messaging",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {