@moltzap/protocol 2026.504.1 → 2026.504.3
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/dist/network/actor-model.d.ts +68 -0
- package/dist/network/actor-model.d.ts.map +1 -0
- package/dist/network/actor-model.js +31 -0
- package/dist/network/actor-model.js.map +1 -0
- package/dist/network/actor-model.types-check.d.ts +32 -0
- package/dist/network/actor-model.types-check.d.ts.map +1 -0
- package/dist/network/actor-model.types-check.js +26 -0
- package/dist/network/actor-model.types-check.js.map +1 -0
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +6 -1
- package/dist/schema/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { BrandedString } from "../brands.js";
|
|
2
|
+
/** A user identity in the platform — owner of one or more agents. */
|
|
3
|
+
export type UserId = BrandedString<"UserId">;
|
|
4
|
+
/**
|
|
5
|
+
* Brand a raw string as a {@link UserId}. The caller is responsible for the
|
|
6
|
+
* value already being well-formed; wire boundaries decode via the matching
|
|
7
|
+
* TypeBox schema in `packages/protocol/src/schema/primitives.ts`, which
|
|
8
|
+
* checks the UUID format before producing the brand.
|
|
9
|
+
*/
|
|
10
|
+
export declare const userId: (value: string) => UserId;
|
|
11
|
+
/** An agent identity — the actor that connects, sends messages, and receives. */
|
|
12
|
+
export type AgentId = BrandedString<"AgentId">;
|
|
13
|
+
/** Brand a raw string as an {@link AgentId}. See {@link userId} for boundary semantics. */
|
|
14
|
+
export declare const agentId: (value: string) => AgentId;
|
|
15
|
+
/**
|
|
16
|
+
* A reachable address in the actor-model network.
|
|
17
|
+
*
|
|
18
|
+
* Stable across reconnects for registered task-manager endpoints (durable in
|
|
19
|
+
* the `tasks.tm_endpoint_address` column). Volatile per-WS-connection for
|
|
20
|
+
* agent endpoints, where the resolver holds a
|
|
21
|
+
* `HashMap<AgentId, Set<EndpointAddress>>` multimap keyed by agent.
|
|
22
|
+
*/
|
|
23
|
+
export type EndpointAddress = BrandedString<"EndpointAddress">;
|
|
24
|
+
/** Brand a raw string as an {@link EndpointAddress}. */
|
|
25
|
+
export declare const endpointAddress: (value: string) => EndpointAddress;
|
|
26
|
+
/**
|
|
27
|
+
* The kinds of endpoints the actor-model network resolves.
|
|
28
|
+
*
|
|
29
|
+
* - `"agent"` — a per-WS-connection endpoint resolved by `AgentId` via the
|
|
30
|
+
* resolver multimap. Volatile.
|
|
31
|
+
* - `"taskManager"` — a registered TM endpoint, durable in the `tasks` row.
|
|
32
|
+
* Persists across the TM's reconnect window.
|
|
33
|
+
*
|
|
34
|
+
* String-literal union: `switch` over `EndpointKind` is exhaustive at the
|
|
35
|
+
* type level, so adding a third kind here forces every downstream switch to
|
|
36
|
+
* handle it.
|
|
37
|
+
*/
|
|
38
|
+
export type EndpointKind = "agent" | "taskManager";
|
|
39
|
+
/**
|
|
40
|
+
* A registered endpoint as observed by the network layer. Discriminated by
|
|
41
|
+
* {@link EndpointKind}:
|
|
42
|
+
* - `agent` arms carry the resolved {@link AgentId} so the resolver can
|
|
43
|
+
* key the multimap.
|
|
44
|
+
* - `taskManager` arms carry only the address; ownership of the task is
|
|
45
|
+
* recorded out-of-band in the `tasks` row.
|
|
46
|
+
*/
|
|
47
|
+
export type EndpointRegistration = {
|
|
48
|
+
readonly kind: "agent";
|
|
49
|
+
readonly address: EndpointAddress;
|
|
50
|
+
readonly agentId: AgentId;
|
|
51
|
+
} | {
|
|
52
|
+
readonly kind: "taskManager";
|
|
53
|
+
readonly address: EndpointAddress;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The principal behind a connected agent — the post-`auth/connect` view.
|
|
57
|
+
*
|
|
58
|
+
* Both fields required: an authenticated identity names the owning user by
|
|
59
|
+
* definition. The wire-layer `AgentSchema.ownerUserId` is `Optional` to
|
|
60
|
+
* accommodate the un-claimed `pending_claim` storage state; the actor-model
|
|
61
|
+
* layer only sees identities that have already passed authentication, so the
|
|
62
|
+
* optionality is collapsed here.
|
|
63
|
+
*/
|
|
64
|
+
export type AuthenticatedIdentity = {
|
|
65
|
+
readonly agentId: AgentId;
|
|
66
|
+
readonly userId: UserId;
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=actor-model.d.ts.map
|
|
@@ -0,0 +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,wDAAwD;AACxD,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,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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actor-model network types: branded primitives, endpoint registrations, and
|
|
3
|
+
* the authenticated-identity record consumed by the network layer.
|
|
4
|
+
*
|
|
5
|
+
* Wire-layer boundary decoding (UUID format checks etc.) lives at the matching
|
|
6
|
+
* TypeBox primitives in `packages/protocol/src/schema/primitives.ts`. This
|
|
7
|
+
* module is the consumer-facing static type story; runtime exports are
|
|
8
|
+
* limited to nominal-brand factories that pass strings through unchanged.
|
|
9
|
+
*
|
|
10
|
+
* Plan: `docs/plans/layered-network-refactor-2026-05.md` (Slice F).
|
|
11
|
+
*
|
|
12
|
+
* Note: the brand types here intentionally don't appear on the flat-barrel
|
|
13
|
+
* `@moltzap/protocol` entry point. The negative canary at
|
|
14
|
+
* `./actor-model.types-check.ts` and `./actor-model.test.ts` holds that line.
|
|
15
|
+
*/
|
|
16
|
+
import { Brand } from "effect";
|
|
17
|
+
const UserIdBrand = Brand.nominal();
|
|
18
|
+
/**
|
|
19
|
+
* Brand a raw string as a {@link UserId}. The caller is responsible for the
|
|
20
|
+
* value already being well-formed; wire boundaries decode via the matching
|
|
21
|
+
* TypeBox schema in `packages/protocol/src/schema/primitives.ts`, which
|
|
22
|
+
* checks the UUID format before producing the brand.
|
|
23
|
+
*/
|
|
24
|
+
export const userId = (value) => UserIdBrand(value);
|
|
25
|
+
const AgentIdBrand = Brand.nominal();
|
|
26
|
+
/** Brand a raw string as an {@link AgentId}. See {@link userId} for boundary semantics. */
|
|
27
|
+
export const agentId = (value) => AgentIdBrand(value);
|
|
28
|
+
const EndpointAddressBrand = Brand.nominal();
|
|
29
|
+
/** Brand a raw string as an {@link EndpointAddress}. */
|
|
30
|
+
export const endpointAddress = (value) => EndpointAddressBrand(value);
|
|
31
|
+
//# sourceMappingURL=actor-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor-model.js","sourceRoot":"","sources":["../../src/network/actor-model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAS/B,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,EAAU,CAAC;AAC5C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAIpE,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,EAAW,CAAC;AAC9C,2FAA2F;AAC3F,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AAWvE,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,EAAmB,CAAC;AAC9D,wDAAwD;AACxD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAAmB,EAAE,CAChE,oBAAoB,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-level negative canary — Phase 3 / Slice F (#421).
|
|
3
|
+
*
|
|
4
|
+
* Asserts the actor-model brand-type names stay scoped to `./actor-model`
|
|
5
|
+
* and are NOT re-exported (as types or values) from the flat barrel
|
|
6
|
+
* `packages/protocol/src/index.ts`. Phase 2 (#420) freed those name slots so
|
|
7
|
+
* this module could own them; this file holds the line for future edits.
|
|
8
|
+
*
|
|
9
|
+
* Mechanics:
|
|
10
|
+
* each `import type { X } from "../index.js"` is expected to fail at
|
|
11
|
+
* compile time with TS2305 "Module has no exported member 'X'" because the
|
|
12
|
+
* flat barrel does not export the name. `@ts-expect-error` swallows that
|
|
13
|
+
* error. If a future edit re-exports the name from `index.ts`, the import
|
|
14
|
+
* succeeds and `@ts-expect-error` becomes "unused" — `tsc --noEmit` fails
|
|
15
|
+
* with TS2578 ("Unused '@ts-expect-error' directive") and the canary
|
|
16
|
+
* fires under `pnpm typecheck`.
|
|
17
|
+
*
|
|
18
|
+
* Build-only artifact: typechecked by `pnpm typecheck` (this filename does
|
|
19
|
+
* not match the `*.test.ts` exclude in `packages/protocol/tsconfig.json`).
|
|
20
|
+
* No runtime exports.
|
|
21
|
+
*
|
|
22
|
+
* Companion file `actor-model.test.ts` covers the runtime side
|
|
23
|
+
* (`Object.keys(flatBarrel)` assertion).
|
|
24
|
+
*/
|
|
25
|
+
import type { UserId as _UserId } from "../index.js";
|
|
26
|
+
import type { AgentId as _AgentId } from "../index.js";
|
|
27
|
+
import type { EndpointAddress as _EndpointAddress } from "../index.js";
|
|
28
|
+
import type { EndpointKind as _EndpointKind } from "../index.js";
|
|
29
|
+
import type { EndpointRegistration as _EndpointRegistration } from "../index.js";
|
|
30
|
+
import type { AuthenticatedIdentity as _AuthenticatedIdentity } from "../index.js";
|
|
31
|
+
export type _ActorModelBarrelCanary = _UserId | _AgentId | _EndpointAddress | _EndpointKind | _EndpointRegistration | _AuthenticatedIdentity;
|
|
32
|
+
//# sourceMappingURL=actor-model.types-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor-model.types-check.d.ts","sourceRoot":"","sources":["../../src/network/actor-model.types-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,IAAI,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEvE,OAAO,KAAK,EAAE,YAAY,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,KAAK,EAAE,oBAAoB,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEjF,OAAO,KAAK,EAAE,qBAAqB,IAAI,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAKnF,MAAM,MAAM,uBAAuB,GAC/B,OAAO,GACP,QAAQ,GACR,gBAAgB,GAChB,aAAa,GACb,qBAAqB,GACrB,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-level negative canary — Phase 3 / Slice F (#421).
|
|
3
|
+
*
|
|
4
|
+
* Asserts the actor-model brand-type names stay scoped to `./actor-model`
|
|
5
|
+
* and are NOT re-exported (as types or values) from the flat barrel
|
|
6
|
+
* `packages/protocol/src/index.ts`. Phase 2 (#420) freed those name slots so
|
|
7
|
+
* this module could own them; this file holds the line for future edits.
|
|
8
|
+
*
|
|
9
|
+
* Mechanics:
|
|
10
|
+
* each `import type { X } from "../index.js"` is expected to fail at
|
|
11
|
+
* compile time with TS2305 "Module has no exported member 'X'" because the
|
|
12
|
+
* flat barrel does not export the name. `@ts-expect-error` swallows that
|
|
13
|
+
* error. If a future edit re-exports the name from `index.ts`, the import
|
|
14
|
+
* succeeds and `@ts-expect-error` becomes "unused" — `tsc --noEmit` fails
|
|
15
|
+
* with TS2578 ("Unused '@ts-expect-error' directive") and the canary
|
|
16
|
+
* fires under `pnpm typecheck`.
|
|
17
|
+
*
|
|
18
|
+
* Build-only artifact: typechecked by `pnpm typecheck` (this filename does
|
|
19
|
+
* not match the `*.test.ts` exclude in `packages/protocol/tsconfig.json`).
|
|
20
|
+
* No runtime exports.
|
|
21
|
+
*
|
|
22
|
+
* Companion file `actor-model.test.ts` covers the runtime side
|
|
23
|
+
* (`Object.keys(flatBarrel)` assertion).
|
|
24
|
+
*/
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=actor-model.types-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor-model.types-check.js","sourceRoot":"","sources":["../../src/network/actor-model.types-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ContactId, userId, agentId, conversationId, messageId, contactId, InviteToken, } from "./primitives.js";
|
|
2
2
|
export * from "./identity.js";
|
|
3
3
|
export * from "./contacts.js";
|
|
4
4
|
export * from "./conversations.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,SAAS,EACT,MAAM,EACN,OAAO,EACP,cAAc,EACd,SAAS,EACT,SAAS,EACT,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
package/dist/schema/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// `UserId`, `AgentId`, `ConversationId`, `MessageId` are intentionally NOT
|
|
2
|
+
// re-exported here. The flat barrel and the `./schemas` subpath would shadow
|
|
3
|
+
// the actor-model brand types (Phase 3 Slice F) that own those names.
|
|
4
|
+
// Consumers needing the TypeBox schema values import directly from
|
|
5
|
+
// `@moltzap/protocol/schemas/primitives`. See plan §2.10 / #420.
|
|
6
|
+
export { ContactId, userId, agentId, conversationId, messageId, contactId, InviteToken, } from "./primitives.js";
|
|
2
7
|
export * from "./identity.js";
|
|
3
8
|
export * from "./contacts.js";
|
|
4
9
|
export * from "./conversations.js";
|
package/dist/schema/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,6EAA6E;AAC7E,sEAAsE;AACtE,mEAAmE;AACnE,iEAAiE;AACjE,OAAO,EACL,SAAS,EACT,MAAM,EACN,OAAO,EACP,cAAc,EACd,SAAS,EACT,SAAS,EACT,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PROTOCOL_VERSION = "2026.504.
|
|
1
|
+
export declare const PROTOCOL_VERSION = "2026.504.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moltzap/protocol",
|
|
3
|
-
"version": "2026.504.
|
|
3
|
+
"version": "2026.504.3",
|
|
4
4
|
"description": "Protocol types and validators for MoltZap messaging",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"types": "./dist/schema/index.d.ts",
|
|
23
23
|
"import": "./dist/schema/index.js"
|
|
24
24
|
},
|
|
25
|
+
"./schemas/primitives": {
|
|
26
|
+
"types": "./dist/schema/primitives.d.ts",
|
|
27
|
+
"import": "./dist/schema/primitives.js"
|
|
28
|
+
},
|
|
25
29
|
"./testing": {
|
|
26
30
|
"types": "./dist/testing/index.d.ts",
|
|
27
31
|
"import": "./dist/testing/index.js"
|