@masons/agent-network 0.6.15 → 0.6.16

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.
Files changed (41) hide show
  1. package/dist/_vendor/runtime-adapter-client/conformance.d.ts +8 -0
  2. package/dist/_vendor/runtime-adapter-client/conformance.d.ts.map +1 -0
  3. package/dist/_vendor/runtime-adapter-client/conformance.js +75 -0
  4. package/dist/_vendor/runtime-adapter-client/icm.d.ts +6 -0
  5. package/dist/_vendor/runtime-adapter-client/icm.d.ts.map +1 -0
  6. package/dist/_vendor/runtime-adapter-client/icm.js +86 -0
  7. package/dist/_vendor/runtime-adapter-client/index.d.ts +7 -0
  8. package/dist/_vendor/runtime-adapter-client/index.d.ts.map +1 -0
  9. package/dist/_vendor/runtime-adapter-client/index.js +6 -0
  10. package/dist/_vendor/runtime-adapter-client/runtime-adapter-api.d.ts +300 -0
  11. package/dist/_vendor/runtime-adapter-client/runtime-adapter-api.d.ts.map +1 -0
  12. package/dist/_vendor/runtime-adapter-client/runtime-adapter-api.js +3112 -0
  13. package/dist/_vendor/runtime-adapter-client/send-admission.d.ts +89 -0
  14. package/dist/_vendor/runtime-adapter-client/send-admission.d.ts.map +1 -0
  15. package/dist/_vendor/runtime-adapter-client/send-admission.js +169 -0
  16. package/dist/_vendor/runtime-adapter-client/types.d.ts +632 -0
  17. package/dist/_vendor/runtime-adapter-client/types.d.ts.map +1 -0
  18. package/dist/_vendor/runtime-adapter-client/types.js +33 -0
  19. package/dist/_vendor/runtime-adapter-client/work-target.d.ts +5 -0
  20. package/dist/_vendor/runtime-adapter-client/work-target.d.ts.map +1 -0
  21. package/dist/_vendor/runtime-adapter-client/work-target.js +47 -0
  22. package/dist/channel.d.ts.map +1 -1
  23. package/dist/channel.js +105 -29
  24. package/dist/connector-client.d.ts +2 -1
  25. package/dist/connector-client.d.ts.map +1 -1
  26. package/dist/connector-client.js +6 -1
  27. package/dist/plugin.d.ts +1 -1
  28. package/dist/plugin.d.ts.map +1 -1
  29. package/dist/plugin.js +15 -8
  30. package/dist/services-retained-recipient.d.ts +58 -0
  31. package/dist/services-retained-recipient.d.ts.map +1 -0
  32. package/dist/services-retained-recipient.js +324 -0
  33. package/dist/turn-context.d.ts +2 -0
  34. package/dist/turn-context.d.ts.map +1 -1
  35. package/dist/turn-context.js +9 -0
  36. package/dist/types.d.ts +5 -1
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.js +3 -0
  39. package/dist/version.d.ts +1 -1
  40. package/dist/version.js +1 -1
  41. package/package.json +3 -3
@@ -0,0 +1,324 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { acquireServicesRetainedNodeRecipientMessage, consumeServicesRetainedNodeRecipientMessage, heartbeatRuntimeEndpoint, RuntimeAdapterApiError, registerRuntimeEndpoint, unregisterRuntimeEndpoint, } from "./_vendor/runtime-adapter-client/index.js";
3
+ const RETRY_DELAY_MS = 5_000;
4
+ const MIN_HEARTBEAT_DELAY_MS = 1_000;
5
+ export class ServicesRetainedRecipientConsumer {
6
+ clientConfig;
7
+ runtimeKey;
8
+ present;
9
+ logger;
10
+ endpointNonce;
11
+ retryDelayMs;
12
+ minimumHeartbeatDelayMs;
13
+ endpoint = null;
14
+ presentedOffer = null;
15
+ acquirePermanentlyBlocked = false;
16
+ consumptionPermanentlyBlocked = false;
17
+ consecutiveHeartbeatNotFound = 0;
18
+ stopped = true;
19
+ activationPromise = null;
20
+ drainPromise = null;
21
+ drainRequested = false;
22
+ activationRetryTimer = null;
23
+ drainRetryTimer = null;
24
+ heartbeatTimer = null;
25
+ stopPromise = null;
26
+ constructor(options) {
27
+ this.clientConfig = {
28
+ apiHost: options.apiHost,
29
+ ...(options.fetch && { fetch: options.fetch }),
30
+ };
31
+ this.runtimeKey = options.runtimeKey;
32
+ this.present = options.present;
33
+ this.logger = options.logger;
34
+ this.endpointNonce = options.endpointNonce ?? randomUUID();
35
+ this.retryDelayMs = options.retryDelayMs ?? RETRY_DELAY_MS;
36
+ this.minimumHeartbeatDelayMs =
37
+ options.minimumHeartbeatDelayMs ?? MIN_HEARTBEAT_DELAY_MS;
38
+ }
39
+ async start() {
40
+ if (!this.stopped)
41
+ return this.activationPromise ?? Promise.resolve();
42
+ const pendingStop = this.stopPromise;
43
+ if (pendingStop)
44
+ await pendingStop;
45
+ if (!this.stopped)
46
+ return this.activationPromise ?? Promise.resolve();
47
+ this.stopped = false;
48
+ await this.activate();
49
+ }
50
+ async stop() {
51
+ if (this.stopPromise)
52
+ return this.stopPromise;
53
+ this.stopped = true;
54
+ this.drainRequested = false;
55
+ this.clearActivationRetryTimer();
56
+ this.clearDrainRetryTimer();
57
+ this.clearHeartbeatTimer();
58
+ const endpoint = this.endpoint;
59
+ this.endpoint = null;
60
+ this.stopPromise = (async () => {
61
+ await this.activationPromise?.catch(() => undefined);
62
+ await this.drainPromise?.catch(() => undefined);
63
+ if (!endpoint)
64
+ return;
65
+ try {
66
+ await unregisterRuntimeEndpoint(this.clientConfig, this.runtimeKey, endpoint.id);
67
+ }
68
+ catch (error) {
69
+ this.logger.warn(`failed to withdraw Services-retained endpoint ${endpoint.id}: ${errorText(error)}`);
70
+ }
71
+ })().finally(() => {
72
+ this.stopPromise = null;
73
+ this.presentedOffer = null;
74
+ this.acquirePermanentlyBlocked = false;
75
+ this.consumptionPermanentlyBlocked = false;
76
+ });
77
+ return this.stopPromise;
78
+ }
79
+ async requestDrain() {
80
+ if (this.stopped)
81
+ return;
82
+ this.drainRequested = true;
83
+ if (!this.endpoint) {
84
+ await this.activate();
85
+ return;
86
+ }
87
+ if (this.drainPromise)
88
+ return this.drainPromise;
89
+ this.drainPromise = this.drain().finally(() => {
90
+ this.drainPromise = null;
91
+ if (this.drainRequested && !this.stopped)
92
+ void this.requestDrain();
93
+ });
94
+ return this.drainPromise;
95
+ }
96
+ async activate() {
97
+ if (this.stopped || this.endpoint)
98
+ return;
99
+ if (this.activationPromise)
100
+ return this.activationPromise;
101
+ this.activationPromise = (async () => {
102
+ try {
103
+ const response = await registerRuntimeEndpoint(this.clientConfig, this.runtimeKey, {
104
+ runtime_kind: "openclaw",
105
+ endpoint_nonce: this.endpointNonce,
106
+ display_label: "OpenClaw",
107
+ runtime_capabilities: ["node_recipient_admission_v1"],
108
+ node_recipient_admission_contract_id: "target-node-recipient-services-retained-v1",
109
+ });
110
+ if (this.stopped) {
111
+ await unregisterRuntimeEndpoint(this.clientConfig, this.runtimeKey, response.endpoint_id).catch(() => undefined);
112
+ return;
113
+ }
114
+ this.endpoint = {
115
+ id: response.endpoint_id,
116
+ nonce: this.endpointNonce,
117
+ heartbeatAfterSeconds: response.heartbeat_after_seconds,
118
+ };
119
+ this.consecutiveHeartbeatNotFound = 0;
120
+ this.acquirePermanentlyBlocked = false;
121
+ this.clearActivationRetryTimer();
122
+ this.logger.info(`Services-retained recipient active endpoint=${response.endpoint_id}`);
123
+ this.scheduleHeartbeat();
124
+ this.drainRequested = true;
125
+ }
126
+ catch (error) {
127
+ this.logger.error("Services-retained recipient declaration failed; live Connector participation remains available", error);
128
+ this.scheduleActivationRetry();
129
+ }
130
+ })().finally(() => {
131
+ this.activationPromise = null;
132
+ });
133
+ await this.activationPromise;
134
+ if (this.endpoint && this.drainRequested)
135
+ await this.requestDrain();
136
+ }
137
+ async drain() {
138
+ while (!this.stopped && this.endpoint) {
139
+ this.drainRequested = false;
140
+ const endpoint = this.endpoint;
141
+ if (this.presentedOffer) {
142
+ if (this.consumptionPermanentlyBlocked)
143
+ return;
144
+ if (!(await this.consumePresentedOffer(endpoint)))
145
+ return;
146
+ continue;
147
+ }
148
+ if (this.acquirePermanentlyBlocked)
149
+ return;
150
+ let acquired;
151
+ try {
152
+ acquired = await acquireServicesRetainedNodeRecipientMessage(this.clientConfig, this.runtimeKey, {
153
+ endpoint_id: endpoint.id,
154
+ endpoint_nonce: endpoint.nonce,
155
+ });
156
+ }
157
+ catch (error) {
158
+ this.logger.error("Services-retained acquire failed", error);
159
+ this.scheduleDrainRetry();
160
+ return;
161
+ }
162
+ if (this.stopped || this.endpoint !== endpoint)
163
+ return;
164
+ if (acquired.status === "empty")
165
+ return;
166
+ if (acquired.status === "rejected") {
167
+ this.logger.warn(`Services-retained acquire rejected reason=${acquired.reason} retryable=${String(acquired.retryable)}`);
168
+ if (acquired.reason === "endpoint_unavailable") {
169
+ this.recoverEndpoint(endpoint);
170
+ }
171
+ else {
172
+ this.acquirePermanentlyBlocked = true;
173
+ this.logger.error(`Services-retained acquire stopped on permanent provider rejection reason=${acquired.reason}`);
174
+ }
175
+ return;
176
+ }
177
+ let presented = false;
178
+ try {
179
+ presented = await this.present({
180
+ contentType: acquired.content_type,
181
+ envelope: acquired.envelope,
182
+ });
183
+ }
184
+ catch (error) {
185
+ this.logger.error(`OpenClaw inbound presentation failed message_ref=${acquired.message_ref}`, error);
186
+ }
187
+ if (!presented) {
188
+ this.scheduleDrainRetry();
189
+ return;
190
+ }
191
+ this.presentedOffer = {
192
+ messageRef: acquired.message_ref,
193
+ offerRef: acquired.offer_ref,
194
+ };
195
+ this.consumptionPermanentlyBlocked = false;
196
+ if (!(await this.consumePresentedOffer(endpoint)))
197
+ return;
198
+ }
199
+ }
200
+ async consumePresentedOffer(endpoint) {
201
+ const offer = this.presentedOffer;
202
+ if (!offer)
203
+ return true;
204
+ const outcome = await consumeServicesRetainedNodeRecipientMessage(this.clientConfig, this.runtimeKey, {
205
+ type: "runtime_node_recipient_message_consumption",
206
+ version: 1,
207
+ endpoint_id: endpoint.id,
208
+ endpoint_nonce: endpoint.nonce,
209
+ message_ref: offer.messageRef,
210
+ offer_ref: offer.offerRef,
211
+ });
212
+ if (outcome.ok) {
213
+ this.logger.info(`Services-retained message consumed message_ref=${offer.messageRef} status=${outcome.status}`);
214
+ this.presentedOffer = null;
215
+ this.consumptionPermanentlyBlocked = false;
216
+ this.drainRequested = true;
217
+ return true;
218
+ }
219
+ const reason = "providerStatus" in outcome ? outcome.reason : undefined;
220
+ this.logger.warn(`Services-retained consumption failed message_ref=${offer.messageRef} terminal=${String(outcome.terminal)}${reason ? ` reason=${reason}` : ""}`);
221
+ if (reason === "endpoint_unavailable") {
222
+ this.recoverEndpoint(endpoint);
223
+ return false;
224
+ }
225
+ if (reason === "processing_conflict" || !outcome.terminal) {
226
+ this.scheduleDrainRetry();
227
+ return false;
228
+ }
229
+ if (reason === "message_terminal") {
230
+ this.presentedOffer = null;
231
+ this.consumptionPermanentlyBlocked = false;
232
+ this.drainRequested = true;
233
+ return true;
234
+ }
235
+ this.consumptionPermanentlyBlocked = true;
236
+ this.logger.error(`Services-retained consumption stopped on permanent rejection message_ref=${offer.messageRef}${reason ? ` reason=${reason}` : ""}`);
237
+ return false;
238
+ }
239
+ scheduleHeartbeat() {
240
+ this.clearHeartbeatTimer();
241
+ if (this.stopped || !this.endpoint)
242
+ return;
243
+ const delay = Math.max(this.minimumHeartbeatDelayMs, this.endpoint.heartbeatAfterSeconds * 1_000);
244
+ this.heartbeatTimer = setTimeout(() => {
245
+ this.heartbeatTimer = null;
246
+ void this.heartbeat();
247
+ }, delay);
248
+ this.heartbeatTimer.unref?.();
249
+ }
250
+ async heartbeat() {
251
+ const endpoint = this.endpoint;
252
+ if (this.stopped || !endpoint)
253
+ return;
254
+ try {
255
+ await heartbeatRuntimeEndpoint(this.clientConfig, this.runtimeKey, endpoint.id);
256
+ this.consecutiveHeartbeatNotFound = 0;
257
+ void this.requestDrain();
258
+ }
259
+ catch (error) {
260
+ this.logger.warn(`Services-retained endpoint heartbeat failed endpoint=${endpoint.id}: ${errorText(error)}`);
261
+ if (error instanceof RuntimeAdapterApiError &&
262
+ error.status === 404 &&
263
+ error.code === "not_found") {
264
+ this.consecutiveHeartbeatNotFound++;
265
+ if (this.consecutiveHeartbeatNotFound >= 2) {
266
+ this.recoverEndpoint(endpoint);
267
+ }
268
+ }
269
+ else {
270
+ this.consecutiveHeartbeatNotFound = 0;
271
+ }
272
+ }
273
+ finally {
274
+ if (this.endpoint === endpoint)
275
+ this.scheduleHeartbeat();
276
+ }
277
+ }
278
+ recoverEndpoint(endpoint) {
279
+ if (this.stopped || this.endpoint !== endpoint)
280
+ return;
281
+ this.endpoint = null;
282
+ this.acquirePermanentlyBlocked = false;
283
+ this.consumptionPermanentlyBlocked = false;
284
+ this.consecutiveHeartbeatNotFound = 0;
285
+ this.clearHeartbeatTimer();
286
+ this.scheduleActivationRetry();
287
+ }
288
+ scheduleActivationRetry() {
289
+ if (this.stopped || this.activationRetryTimer)
290
+ return;
291
+ this.activationRetryTimer = setTimeout(() => {
292
+ this.activationRetryTimer = null;
293
+ void this.activate();
294
+ }, this.retryDelayMs);
295
+ this.activationRetryTimer.unref?.();
296
+ }
297
+ scheduleDrainRetry() {
298
+ if (this.stopped || this.drainRetryTimer)
299
+ return;
300
+ this.drainRetryTimer = setTimeout(() => {
301
+ this.drainRetryTimer = null;
302
+ void this.requestDrain();
303
+ }, this.retryDelayMs);
304
+ this.drainRetryTimer.unref?.();
305
+ }
306
+ clearActivationRetryTimer() {
307
+ if (this.activationRetryTimer)
308
+ clearTimeout(this.activationRetryTimer);
309
+ this.activationRetryTimer = null;
310
+ }
311
+ clearDrainRetryTimer() {
312
+ if (this.drainRetryTimer)
313
+ clearTimeout(this.drainRetryTimer);
314
+ this.drainRetryTimer = null;
315
+ }
316
+ clearHeartbeatTimer() {
317
+ if (this.heartbeatTimer)
318
+ clearTimeout(this.heartbeatTimer);
319
+ this.heartbeatTimer = null;
320
+ }
321
+ }
322
+ function errorText(error) {
323
+ return error instanceof Error ? error.message : String(error);
324
+ }
@@ -1,11 +1,13 @@
1
1
  import type { OwnerSignal } from "./owner-session-state.js";
2
2
  export declare function setCurrentTurnSender(contact: string | null): void;
3
3
  export declare function setCurrentTurnSenderAddress(address: string | null): void;
4
+ export declare function setCurrentTurnReplyRoute(route: "routable" | "unavailable"): void;
4
5
  export declare function setCurrentTurnChannelId(channelId: string | null): void;
5
6
  export declare function setCurrentTurnIsOwnerForTools(value: boolean): void;
6
7
  export declare function setCurrentTurnOwnerSignalForTools(signal: OwnerSignal): void;
7
8
  export declare function consumeCurrentTurnSender(): string | null;
8
9
  export declare function consumeCurrentTurnSenderAddress(): string | null;
10
+ export declare function consumeCurrentTurnReplyRoute(): "routable" | "unavailable" | null;
9
11
  export declare function getCurrentTurnChannelId(): string | null;
10
12
  export declare function getCurrentTurnIsOwnerNonConsuming(): boolean;
11
13
  export declare function getCurrentTurnOwnerSignal(): OwnerSignal;
@@ -1 +1 @@
1
- {"version":3,"file":"turn-context.d.ts","sourceRoot":"","sources":["../src/turn-context.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAyC5D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEjE;AAUD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAExE;AAOD,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEtE;AAOD,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAElE;AAUD,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAE3E;AAUD,wBAAgB,wBAAwB,IAAI,MAAM,GAAG,IAAI,CAIxD;AAGD,wBAAgB,+BAA+B,IAAI,MAAM,GAAG,IAAI,CAI/D;AAMD,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAEvD;AAMD,wBAAgB,iCAAiC,IAAI,OAAO,CAE3D;AAOD,wBAAgB,yBAAyB,IAAI,WAAW,CAEvD"}
1
+ {"version":3,"file":"turn-context.d.ts","sourceRoot":"","sources":["../src/turn-context.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AA0C5D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEjE;AAUD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAExE;AAGD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,UAAU,GAAG,aAAa,GAChC,IAAI,CAEN;AAOD,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAEtE;AAOD,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAElE;AAUD,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAE3E;AAUD,wBAAgB,wBAAwB,IAAI,MAAM,GAAG,IAAI,CAIxD;AAGD,wBAAgB,+BAA+B,IAAI,MAAM,GAAG,IAAI,CAI/D;AAGD,wBAAgB,4BAA4B,IACxC,UAAU,GACV,aAAa,GACb,IAAI,CAIP;AAMD,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAEvD;AAMD,wBAAgB,iCAAiC,IAAI,OAAO,CAE3D;AAOD,wBAAgB,yBAAyB,IAAI,WAAW,CAEvD"}
@@ -1,5 +1,6 @@
1
1
  let currentTurnSender = null;
2
2
  let currentTurnSenderAddress = null;
3
+ let currentTurnReplyRoute = null;
3
4
  let currentTurnChannelId = null;
4
5
  let currentTurnIsOwner = false;
5
6
  let currentTurnOwnerSignalForTools = null;
@@ -9,6 +10,9 @@ export function setCurrentTurnSender(contact) {
9
10
  export function setCurrentTurnSenderAddress(address) {
10
11
  currentTurnSenderAddress = address;
11
12
  }
13
+ export function setCurrentTurnReplyRoute(route) {
14
+ currentTurnReplyRoute = route;
15
+ }
12
16
  export function setCurrentTurnChannelId(channelId) {
13
17
  currentTurnChannelId = channelId;
14
18
  }
@@ -28,6 +32,11 @@ export function consumeCurrentTurnSenderAddress() {
28
32
  currentTurnSenderAddress = null;
29
33
  return value;
30
34
  }
35
+ export function consumeCurrentTurnReplyRoute() {
36
+ const value = currentTurnReplyRoute;
37
+ currentTurnReplyRoute = null;
38
+ return value;
39
+ }
31
40
  export function getCurrentTurnChannelId() {
32
41
  return currentTurnChannelId;
33
42
  }
package/dist/types.d.ts CHANGED
@@ -71,6 +71,9 @@ export interface NodeRefView {
71
71
  displayName?: string;
72
72
  avatarUrl?: string;
73
73
  }
74
+ export interface CustodyPendingEvent {
75
+ event: "CUSTODY_PENDING";
76
+ }
74
77
  export interface DeliveryPendingEvent {
75
78
  event: "DELIVERY_PENDING";
76
79
  count: number;
@@ -104,10 +107,11 @@ export interface DeliverySkipEvent {
104
107
  deliveredAt?: string;
105
108
  }
106
109
  export type PluginToConnectorEvent = RegisterEvent | AddressedSendEvent | AddressedTypingEvent | AddressedDeliveryAckEvent | RequestGapFillEvent;
107
- export type ConnectorToPluginEvent = RegisterAckEvent | SendAckEvent | AddressedMessageEvent | DeliveryPendingEvent | DeliveryStatusEvent | DeliveryCursorEvent | DeliverySkipEvent | StructuredErrorEvent;
110
+ export type ConnectorToPluginEvent = RegisterAckEvent | SendAckEvent | AddressedMessageEvent | CustodyPendingEvent | DeliveryPendingEvent | DeliveryStatusEvent | DeliveryCursorEvent | DeliverySkipEvent | StructuredErrorEvent;
108
111
  export declare function isRegisterAck(data: unknown): data is RegisterAckEvent;
109
112
  export declare function isSendAck(data: unknown): data is SendAckEvent;
110
113
  export declare function isAddressedMessage(data: unknown): data is AddressedMessageEvent;
114
+ export declare function isCustodyPending(data: unknown): data is CustodyPendingEvent;
111
115
  export declare function isDeliveryPending(data: unknown): data is DeliveryPendingEvent;
112
116
  export declare function isDeliveryStatus(data: unknown): data is DeliveryStatusEvent;
113
117
  export declare function isDeliveryCursor(data: unknown): data is DeliveryCursorEvent;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAC1C,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAC9C,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAQ1C,MAAM,WAAW,a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C,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,qBAAqB,CAS/B;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,mBAAmB,CAE3E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAO7E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,mBAAmB,CAO3E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,mBAAmB,CAa3E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,iBAAiB,CAYvE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAO7E"}
package/dist/types.js CHANGED
@@ -25,6 +25,9 @@ export function isAddressedMessage(data) {
25
25
  typeof data.from === "string" &&
26
26
  typeof data.content === "string");
27
27
  }
28
+ export function isCustodyPending(data) {
29
+ return isObject(data) && data.event === "CUSTODY_PENDING";
30
+ }
28
31
  export function isDeliveryPending(data) {
29
32
  return (isObject(data) &&
30
33
  data.event === "DELIVERY_PENDING" &&
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const PLUGIN_VERSION = "0.6.15";
1
+ export declare const PLUGIN_VERSION = "0.6.16";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const PLUGIN_VERSION = "0.6.15";
1
+ export const PLUGIN_VERSION = "0.6.16";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masons/agent-network",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
4
4
  "description": "MASONS Agent Network — OpenClaw channel plugin for connecting agent runtimes to the Agent Network over MSTP.",
5
5
  "license": "MIT",
6
6
  "author": "MASONS.ai <hello@masons.ai> (https://masons.ai)",
@@ -24,11 +24,11 @@
24
24
  "scripts": {
25
25
  "build": "tsc",
26
26
  "dev": "tsc --watch",
27
- "test": "node ../../scripts/sync-vendored-trace-context.mjs && tsc -p test/tsconfig.json && node --test --loader ts-node/esm 'test/**/*.test.ts'",
27
+ "test": "node ../../scripts/sync-vendored-trace-context.mjs && node ../../scripts/sync-vendored-runtime-adapter-client.mjs agent-network && tsc -p test/tsconfig.json && node --test --loader ts-node/esm 'test/**/*.test.ts'",
28
28
  "biome:check": "biome check .",
29
29
  "biome:fix": "biome check . --write",
30
30
  "biome:ci": "biome ci .",
31
- "prepublishOnly": "node ../../scripts/sync-vendored-trace-context.mjs && bash scripts/check-version.sh && npm run build && npm run test",
31
+ "prepublishOnly": "node ../../scripts/sync-vendored-trace-context.mjs && node ../../scripts/sync-vendored-runtime-adapter-client.mjs agent-network && bash scripts/check-version.sh && npm run build && npm run test",
32
32
  "release": "pnpm publish --access public"
33
33
  },
34
34
  "files": [