@joe-broadhead/messaging 0.7.1 → 0.8.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/CHANGELOG.md +214 -2
- package/dist/bin/messaging-mcp.js +5043 -4054
- package/dist/bin/messaging-relay.js +8263 -5425
- package/dist/bin/messaging.js +5982 -4906
- package/dist/bin/messagingd.js +19956 -13716
- package/dist/lib/modules/core/agent/operations.js +19 -327
- package/dist/lib/modules/core/agent/present.js +15 -55
- package/dist/lib/modules/core/agent-tools.js +23 -139
- package/dist/lib/modules/core/consent.js +1 -1
- package/dist/lib/modules/core/conversation/event.js +29 -4
- package/dist/lib/modules/core/conversation/guest-invitation.js +42 -0
- package/dist/lib/modules/core/conversation/log.js +287 -65
- package/dist/lib/modules/core/conversation/request-log.js +158 -0
- package/dist/lib/modules/core/conversation/request-seal.js +41 -0
- package/dist/lib/modules/core/conversation/requests.js +87 -0
- package/dist/lib/modules/core/conversation/seal.js +90 -37
- package/dist/lib/modules/core/conversation-agent-tools.js +69 -0
- package/dist/lib/modules/core/federation/directory-proof.js +83 -0
- package/dist/lib/modules/core/federation/proof-state.js +167 -0
- package/dist/lib/modules/core/federation/roster-proof.js +74 -0
- package/dist/lib/modules/core/index.js +8 -3
- package/dist/lib/modules/core/jelly-host.js +5 -5
- package/dist/lib/modules/core/schema/common.js +31 -5
- package/dist/lib/modules/core/schema/consent.js +5 -4
- package/dist/lib/modules/core/schema/contact-request.js +22 -0
- package/dist/lib/modules/core/schema/conv-frames.js +94 -0
- package/dist/lib/modules/core/schema/conversation.js +67 -33
- package/dist/lib/modules/core/schema/envelope.js +8 -24
- package/dist/lib/modules/core/schema/errors.js +4 -3
- package/dist/lib/modules/core/schema/guest-invitation.js +13 -0
- package/dist/lib/modules/core/schema/index.js +5 -0
- package/dist/lib/modules/core/schema/ipc/consent.js +13 -9
- package/dist/lib/modules/core/schema/ipc/conversation-views.js +80 -0
- package/dist/lib/modules/core/schema/ipc/conversations.js +128 -0
- package/dist/lib/modules/core/schema/ipc/device.js +2 -0
- package/dist/lib/modules/core/schema/ipc/jelly.js +3 -38
- package/dist/lib/modules/core/schema/ipc/shapes.js +14 -72
- package/dist/lib/modules/core/schema/ipc/surfaces.js +12 -195
- package/dist/lib/modules/core/schema/ipc/tasks.js +31 -0
- package/dist/lib/modules/core/schema/ipc.js +18 -44
- package/dist/lib/modules/core/testing.js +1 -1
- package/dist/lib/modules/core/version.js +1 -1
- package/dist/lib/modules/ipc/client.js +10 -2
- package/dist/lib/modules/ipc/server.js +14 -5
- package/dist/lib/modules/ipc/testing.js +13 -23
- package/dist/spec/messaging-v1.md +546 -409
- package/dist/third-party-notices.md +1 -1
- package/dist/third-party.json +1 -1
- package/dist/types/core/agent/operations.d.ts +5 -52
- package/dist/types/core/agent/present.d.ts +6 -21
- package/dist/types/core/agent-tools.d.ts +263 -442
- package/dist/types/core/conversation/event.d.ts +6 -6
- package/dist/types/core/conversation/guest-invitation.d.ts +8 -0
- package/dist/types/core/conversation/log.d.ts +28 -13
- package/dist/types/core/conversation/request-log.d.ts +24 -0
- package/dist/types/core/conversation/request-seal.d.ts +6 -0
- package/dist/types/core/conversation/requests.d.ts +14 -0
- package/dist/types/core/conversation/seal.d.ts +32 -9
- package/dist/types/core/conversation-agent-tools.d.ts +918 -0
- package/dist/types/core/federation/directory-proof.d.ts +8 -0
- package/dist/types/core/federation/proof-state.d.ts +114 -0
- package/dist/types/core/federation/roster-proof.d.ts +7 -0
- package/dist/types/core/index.d.ts +10 -5
- package/dist/types/core/jelly-host.d.ts +1 -1
- package/dist/types/core/schema/common.d.ts +31 -6
- package/dist/types/core/schema/consent.d.ts +7 -7
- package/dist/types/core/schema/contact-request.d.ts +264 -0
- package/dist/types/core/schema/conv-frames.d.ts +1200 -0
- package/dist/types/core/schema/conversation.d.ts +1410 -264
- package/dist/types/core/schema/envelope.d.ts +83 -130
- package/dist/types/core/schema/errors.d.ts +3 -1
- package/dist/types/core/schema/guest-invitation.d.ts +51 -0
- package/dist/types/core/schema/index.d.ts +5 -0
- package/dist/types/core/schema/ipc/consent.d.ts +89 -49
- package/dist/types/core/schema/ipc/conversation-views.d.ts +1023 -0
- package/dist/types/core/schema/ipc/conversations.d.ts +3987 -0
- package/dist/types/core/schema/ipc/device.d.ts +4 -0
- package/dist/types/core/schema/ipc/jelly.d.ts +2 -105
- package/dist/types/core/schema/ipc/shapes.d.ts +13 -95
- package/dist/types/core/schema/ipc/surfaces.d.ts +25 -427
- package/dist/types/core/schema/ipc/tasks.d.ts +208 -0
- package/dist/types/core/schema/ipc.d.ts +2671 -525
- package/dist/types/core/schema/relay.d.ts +8 -4
- package/dist/types/core/testing.d.ts +1 -1
- package/dist/types/core/version.d.ts +1 -1
- package/dist/types/ipc/client.d.ts +4 -1
- package/dist/types/ipc/server.d.ts +10 -1
- package/dist/types/ipc/testing.d.ts +21 -8
- package/package.json +1 -1
|
@@ -68,6 +68,7 @@ export declare const NackFrame: z.ZodObject<{
|
|
|
68
68
|
refused: "refused";
|
|
69
69
|
declined: "declined";
|
|
70
70
|
request_required: "request_required";
|
|
71
|
+
peer_outdated: "peer_outdated";
|
|
71
72
|
rate_limited: "rate_limited";
|
|
72
73
|
loop_guard: "loop_guard";
|
|
73
74
|
too_large: "too_large";
|
|
@@ -272,6 +273,7 @@ export declare const ErrorFrame: z.ZodObject<{
|
|
|
272
273
|
refused: "refused";
|
|
273
274
|
declined: "declined";
|
|
274
275
|
request_required: "request_required";
|
|
276
|
+
peer_outdated: "peer_outdated";
|
|
275
277
|
rate_limited: "rate_limited";
|
|
276
278
|
loop_guard: "loop_guard";
|
|
277
279
|
too_large: "too_large";
|
|
@@ -350,6 +352,7 @@ export declare const RelayToClient: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
350
352
|
refused: "refused";
|
|
351
353
|
declined: "declined";
|
|
352
354
|
request_required: "request_required";
|
|
355
|
+
peer_outdated: "peer_outdated";
|
|
353
356
|
rate_limited: "rate_limited";
|
|
354
357
|
loop_guard: "loop_guard";
|
|
355
358
|
too_large: "too_large";
|
|
@@ -549,6 +552,7 @@ export declare const RelayToClient: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
549
552
|
refused: "refused";
|
|
550
553
|
declined: "declined";
|
|
551
554
|
request_required: "request_required";
|
|
555
|
+
peer_outdated: "peer_outdated";
|
|
552
556
|
rate_limited: "rate_limited";
|
|
553
557
|
loop_guard: "loop_guard";
|
|
554
558
|
too_large: "too_large";
|
|
@@ -749,9 +753,9 @@ export declare const SendFrame: z.ZodObject<{
|
|
|
749
753
|
realm: z.ZodString;
|
|
750
754
|
type: z.ZodEnum<{
|
|
751
755
|
message: "message";
|
|
752
|
-
"task.cancel": "task.cancel";
|
|
753
756
|
receipt: "receipt";
|
|
754
757
|
presence: "presence";
|
|
758
|
+
"task.cancel": "task.cancel";
|
|
755
759
|
"task.status": "task.status";
|
|
756
760
|
"task.artifact": "task.artifact";
|
|
757
761
|
}>;
|
|
@@ -806,9 +810,9 @@ export declare const PresenceFrame: z.ZodObject<{
|
|
|
806
810
|
realm: z.ZodString;
|
|
807
811
|
type: z.ZodEnum<{
|
|
808
812
|
message: "message";
|
|
809
|
-
"task.cancel": "task.cancel";
|
|
810
813
|
receipt: "receipt";
|
|
811
814
|
presence: "presence";
|
|
815
|
+
"task.cancel": "task.cancel";
|
|
812
816
|
"task.status": "task.status";
|
|
813
817
|
"task.artifact": "task.artifact";
|
|
814
818
|
}>;
|
|
@@ -1016,9 +1020,9 @@ export declare const ClientToRelay: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1016
1020
|
realm: z.ZodString;
|
|
1017
1021
|
type: z.ZodEnum<{
|
|
1018
1022
|
message: "message";
|
|
1019
|
-
"task.cancel": "task.cancel";
|
|
1020
1023
|
receipt: "receipt";
|
|
1021
1024
|
presence: "presence";
|
|
1025
|
+
"task.cancel": "task.cancel";
|
|
1022
1026
|
"task.status": "task.status";
|
|
1023
1027
|
"task.artifact": "task.artifact";
|
|
1024
1028
|
}>;
|
|
@@ -1071,9 +1075,9 @@ export declare const ClientToRelay: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1071
1075
|
realm: z.ZodString;
|
|
1072
1076
|
type: z.ZodEnum<{
|
|
1073
1077
|
message: "message";
|
|
1074
|
-
"task.cancel": "task.cancel";
|
|
1075
1078
|
receipt: "receipt";
|
|
1076
1079
|
presence: "presence";
|
|
1080
|
+
"task.cancel": "task.cancel";
|
|
1077
1081
|
"task.status": "task.status";
|
|
1078
1082
|
"task.artifact": "task.artifact";
|
|
1079
1083
|
}>;
|
|
@@ -7,7 +7,7 @@ export { encodeTicket } from "./roster.js";
|
|
|
7
7
|
export { grantHash } from "./delegation.js";
|
|
8
8
|
export { signJellyToken } from "./directory/jelly-issuer.js";
|
|
9
9
|
export { jellyHostDouble, type JellyHostDouble } from "./jelly-host-double.js";
|
|
10
|
-
export { sealConvMetaWith, sealConvMsgWith,
|
|
10
|
+
export { sealConvMetaWith, sealConvMsgWith, sealConvStateWith, sealKeyShareWith, type ShareRandomness } from "./conversation/seal.js";
|
|
11
11
|
/**
|
|
12
12
|
* Narrows a result whose `kind` tells its shape (`item.read`, `conv.read`) to the expected kind, and
|
|
13
13
|
* throws with both kinds named otherwise: `client.call("item.read", p).then(asKind("received"))`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IpcEvent, IpcHello, MessagingError, type IpcMethod, type IpcParams, type IpcResult } from "../core/index.js";
|
|
1
|
+
import { IpcEvent, IpcHello, MessagingError, type IpcMethod, type IpcParams, type IpcResult, type ConversationMethod, type ConversationParams, type ConversationResult } from "../core/index.js";
|
|
2
2
|
import { type SocketTier } from "./paths.js";
|
|
3
3
|
export interface ClientOptions {
|
|
4
4
|
/** Explicit socket path (on Windows, the pipe pointer file). Defaults to the `tier` socket of `home`. */
|
|
@@ -76,6 +76,9 @@ export declare class MessagingClient {
|
|
|
76
76
|
get daemon(): IpcHello;
|
|
77
77
|
get closed(): boolean;
|
|
78
78
|
call<M extends IpcMethod>(method: M, params: IpcParams<M>, options?: CallOptions): Promise<IpcResult<M>>;
|
|
79
|
+
/** The staged conversation contract. Use only with a server that opted into it, until cut-over. */
|
|
80
|
+
callConversation<M extends ConversationMethod>(method: M, params: ConversationParams<M>, options?: CallOptions): Promise<ConversationResult<M>>;
|
|
81
|
+
private callWith;
|
|
79
82
|
onEvent(listener: (event: IpcEvent) => void): () => void;
|
|
80
83
|
onClose(listener: (error?: Error) => void): () => void;
|
|
81
84
|
close(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
|
-
import { IpcEvent, type IpcMethod, type IpcMethods, type IpcResult } from "../core/index.js";
|
|
2
|
+
import { IpcEvent, type IpcMethod, type IpcMethods, type IpcResult, type ConversationMethod, type ConversationParams, type ConversationResult } from "../core/index.js";
|
|
3
3
|
import { type SocketTier } from "./paths.js";
|
|
4
4
|
export interface ConnectionContext {
|
|
5
5
|
/** Unique across every server in this process, so a daemon with two sockets can key state by it. */
|
|
@@ -34,6 +34,11 @@ export type Handler<M extends IpcMethod> = (params: z.output<IpcMethods[M]["para
|
|
|
34
34
|
export type Handlers = {
|
|
35
35
|
[M in IpcMethod]?: Handler<M>;
|
|
36
36
|
};
|
|
37
|
+
/** Handler types for the opt-in conversation contract test server. */
|
|
38
|
+
export type ConversationHandler<M extends ConversationMethod> = (params: ConversationParams<M>, ctx: ConnectionContext, authority: CallAuthority | undefined) => Promise<ConversationResult<M>> | ConversationResult<M>;
|
|
39
|
+
export type ConversationHandlers = {
|
|
40
|
+
[M in ConversationMethod]?: ConversationHandler<M>;
|
|
41
|
+
};
|
|
37
42
|
export interface IpcServerOptions {
|
|
38
43
|
socketPath: string;
|
|
39
44
|
/**
|
|
@@ -92,3 +97,7 @@ export interface IpcServer {
|
|
|
92
97
|
* `group` is refused there: Node cannot give a pipe to a group.
|
|
93
98
|
*/
|
|
94
99
|
export declare function createIpcServer(options: IpcServerOptions): Promise<IpcServer>;
|
|
100
|
+
/** Used only by the test entry: never changes the real daemon's method table. */
|
|
101
|
+
export declare function createConversationIpcServerForTesting(options: Omit<IpcServerOptions, "handlers" | "authorize"> & {
|
|
102
|
+
handlers: ConversationHandlers;
|
|
103
|
+
}): Promise<IpcServer>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type net from "node:net";
|
|
2
|
-
import { type IpcEvent, type IpcMethod } from "../core/index.js";
|
|
2
|
+
import { CONVERSATION_METHODS, type ConversationMethod, type IpcEvent, type IpcMethod } from "../core/index.js";
|
|
3
3
|
import { MessagingClient } from "./client.js";
|
|
4
4
|
import { type SocketTier } from "./paths.js";
|
|
5
|
-
import { type Handler, type Handlers } from "./server.js";
|
|
5
|
+
import { type ConversationHandler, type ConversationHandlers, type Handler, type Handlers } from "./server.js";
|
|
6
6
|
/**
|
|
7
7
|
* `@messaging/ipc/testing`: helpers for tests only. Production code never imports this entry point.
|
|
8
8
|
*
|
|
@@ -26,8 +26,8 @@ export declare function listenAt(server: net.Server, socketPath: string, { pid }
|
|
|
26
26
|
export declare function rawEndpoint(socketPath: string): string;
|
|
27
27
|
/** A deterministic ULID for test fixtures: `ulid(7)` is `01JC0000000000000000000007`. */
|
|
28
28
|
export declare function ulid(n: number): string;
|
|
29
|
-
/** Polls
|
|
30
|
-
export declare function until(predicate: () => boolean,
|
|
29
|
+
/** Polls state with no notification; the enclosing test's timeout is the single bound. Legacy timeout and label are ignored. */
|
|
30
|
+
export declare function until(predicate: () => boolean, _timeoutMs?: number, _what?: string): Promise<void>;
|
|
31
31
|
/** One call the fake received: the method and a copy of its parsed params, taken before its handler ran. */
|
|
32
32
|
export interface Recorded {
|
|
33
33
|
method: IpcMethod;
|
|
@@ -35,6 +35,7 @@ export interface Recorded {
|
|
|
35
35
|
}
|
|
36
36
|
export type Params<M extends IpcMethod> = Parameters<Handler<M>>[0];
|
|
37
37
|
export interface RecordingDaemonOptions {
|
|
38
|
+
methods?: never;
|
|
38
39
|
/** Handlers by method; `handle` adds or replaces one later. Every other method is refused with `forbidden`. */
|
|
39
40
|
handlers?: Handlers;
|
|
40
41
|
/** Prefix of the temp home the fake creates (and removes on `close`). */
|
|
@@ -69,10 +70,6 @@ export interface RecordingDaemon {
|
|
|
69
70
|
handle<M extends IpcMethod>(method: M, handler: Handler<M>): void;
|
|
70
71
|
/** `IpcServer.publish`: to every connection that subscribed to the event's key (key-less: to all of them). */
|
|
71
72
|
publish(event: IpcEvent): void;
|
|
72
|
-
/** A `conv` event to the connections whose `conv.subscribe` succeeded, as messagingd sends it. */
|
|
73
|
-
conv(event: Extract<IpcEvent, {
|
|
74
|
-
type: "conv";
|
|
75
|
-
}>): void;
|
|
76
73
|
/** A client on the agent socket, or the `admin` one. */
|
|
77
74
|
connect(tier?: SocketTier): Promise<MessagingClient>;
|
|
78
75
|
/** Open connections on both sockets. */
|
|
@@ -86,4 +83,20 @@ export interface RecordingDaemon {
|
|
|
86
83
|
/** `stop`, and remove the temp home the fake created. */
|
|
87
84
|
close(): Promise<void>;
|
|
88
85
|
}
|
|
86
|
+
export interface ConversationRecordingDaemonOptions extends Omit<RecordingDaemonOptions, "handlers" | "methods"> {
|
|
87
|
+
/** Opt into the full conversation contract, including staged methods, instead of the live table. */
|
|
88
|
+
methods: typeof CONVERSATION_METHODS;
|
|
89
|
+
handlers?: ConversationHandlers;
|
|
90
|
+
}
|
|
91
|
+
export interface ConversationRecordingDaemon extends Omit<RecordingDaemon, "calls" | "methods" | "callsTo" | "last" | "handle"> {
|
|
92
|
+
readonly calls: {
|
|
93
|
+
method: ConversationMethod;
|
|
94
|
+
params: Record<string, unknown>;
|
|
95
|
+
}[];
|
|
96
|
+
methods(): ConversationMethod[];
|
|
97
|
+
callsTo<M extends ConversationMethod>(method: M): Parameters<ConversationHandler<M>>[0][];
|
|
98
|
+
last<M extends ConversationMethod>(method: M): Parameters<ConversationHandler<M>>[0] | undefined;
|
|
99
|
+
handle<M extends ConversationMethod>(method: M, handler: ConversationHandler<M>): void;
|
|
100
|
+
}
|
|
89
101
|
export declare function recordingDaemon(options?: RecordingDaemonOptions): Promise<RecordingDaemon>;
|
|
102
|
+
export declare function recordingDaemon(options: ConversationRecordingDaemonOptions): Promise<ConversationRecordingDaemon>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joe-broadhead/messaging",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Messaging: the relay, the per-machine daemon and its CLI, and the MCP server as bundled single files, plus the client libraries and the protocol spec. Zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|