@masons/agent-network 0.5.1 → 0.5.12
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/channel.d.ts.map +1 -1
- package/dist/channel.js +125 -23
- package/dist/platform-client.d.ts +50 -10
- package/dist/platform-client.d.ts.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +11 -9
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +62 -8
- package/dist/types.d.ts +50 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/channel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAkC9D,oEAAoE;AACpE,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,OAAO,CAIrD;AAED,8EAA8E;AAC9E,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE/D;AAUD,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,oBAAoB,CAAC,CAAC;IAC9B,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAAC;IACvD,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC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function _setNudgePendingForTesting(value) {
|
|
|
44
44
|
}
|
|
45
45
|
// --- Sender identity ---
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Project a NodeRef view from `MESSAGE_RECEIVED.metadata.sender` when the
|
|
48
|
+
* Connector has projected a NodeRef onto the inbound envelope (Full Node
|
|
49
|
+
* sender path per `docs/concepts/human-node-capability-obligations.md § 2`
|
|
50
|
+
* + `apps/connector/src/routes/root.ts` § Piece 2 projection).
|
|
51
|
+
*
|
|
52
|
+
* Wire shape (the Connector's `metadata.sender = senderNodeRef` projection):
|
|
53
|
+
* ```
|
|
54
|
+
* metadata: {
|
|
55
|
+
* visitor_name?: string; // legacy back-compat
|
|
56
|
+
* is_owner?: boolean; // legacy back-compat
|
|
57
|
+
* client_type?: string; // legacy back-compat
|
|
58
|
+
* sender?: { // NEW under (b) Full Node
|
|
59
|
+
* kind: string;
|
|
60
|
+
* mstpAddress: string;
|
|
61
|
+
* handle?: string;
|
|
62
|
+
* displayName?: string;
|
|
63
|
+
* avatarUrl?: string;
|
|
64
|
+
* };
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* Returns the NodeRef view when `metadata.sender` is an object with
|
|
69
|
+
* `kind` and `mstpAddress` both string. Returns null otherwise — the
|
|
70
|
+
* caller falls back to the Client-side metadata shape (`visitor_name`,
|
|
71
|
+
* `is_owner`, `client_type`).
|
|
72
|
+
*
|
|
73
|
+
* Per `human-node-capability-obligations.md § 5`, consumers MUST accept
|
|
74
|
+
* future `kind` values (e.g., `"team"`); this projector treats `kind` as
|
|
75
|
+
* opaque and surfaces the value as-is.
|
|
76
|
+
*/
|
|
77
|
+
function tryProjectNodeRef(metadata) {
|
|
78
|
+
if (!metadata)
|
|
79
|
+
return null;
|
|
80
|
+
const sender = metadata.sender;
|
|
81
|
+
// Defensive: reject non-objects, null, and arrays. `typeof [] === "object"`
|
|
82
|
+
// and `[] !== null`, so an array would otherwise pass the next guard and
|
|
83
|
+
// produce undefined when indexed by `kind` / `mstpAddress`. Explicit
|
|
84
|
+
// rejection makes the contract self-documenting.
|
|
85
|
+
if (typeof sender !== "object" || sender === null || Array.isArray(sender))
|
|
86
|
+
return null;
|
|
87
|
+
const senderObj = sender;
|
|
88
|
+
const kind = senderObj.kind;
|
|
89
|
+
const mstpAddress = senderObj.mstpAddress;
|
|
90
|
+
if (typeof kind !== "string" || typeof mstpAddress !== "string")
|
|
91
|
+
return null;
|
|
92
|
+
const handle = typeof senderObj.handle === "string" ? senderObj.handle : undefined;
|
|
93
|
+
const displayName = typeof senderObj.displayName === "string"
|
|
94
|
+
? senderObj.displayName
|
|
95
|
+
: undefined;
|
|
96
|
+
const avatarUrl = typeof senderObj.avatarUrl === "string" ? senderObj.avatarUrl : undefined;
|
|
97
|
+
return { kind, mstpAddress, handle, displayName, avatarUrl };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Derive the sender display name for the visitor / Identified-Client /
|
|
101
|
+
* anonymous path (no NodeRef projection on metadata).
|
|
48
102
|
*
|
|
49
103
|
* Resolution order:
|
|
50
104
|
* 1. `metadata.visitor_name` — display name for Passport browser visitors
|
|
@@ -59,6 +113,26 @@ function deriveSenderName(event) {
|
|
|
59
113
|
// Extract handle from `from` address
|
|
60
114
|
return extractHandleFromAddress(event.from);
|
|
61
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Derive the sender display name for the Full Node sender path. Walks the
|
|
118
|
+
* fallback chain `displayName → handle → mstpAddress`-derived handle per
|
|
119
|
+
* `docs/concepts/human-node-capability-obligations.md § 2`.
|
|
120
|
+
*
|
|
121
|
+
* Note: the spec's terminal fallback is `mstpAddress` itself. This
|
|
122
|
+
* implementation uses `extractHandleFromAddress(fromAddress)` instead —
|
|
123
|
+
* the `from` field is already a routable address (the same one
|
|
124
|
+
* `mstpAddress` would parse to a handle from), and a parsed handle is
|
|
125
|
+
* higher-fidelity for display than the full URI. When `nodeRef.handle`
|
|
126
|
+
* is absent and `from` does not parse to a handle, both forms degrade
|
|
127
|
+
* equivalently to "unknown"-style strings.
|
|
128
|
+
*/
|
|
129
|
+
function deriveNodeName(nodeRef, fromAddress) {
|
|
130
|
+
if (nodeRef.displayName)
|
|
131
|
+
return nodeRef.displayName;
|
|
132
|
+
if (nodeRef.handle)
|
|
133
|
+
return nodeRef.handle;
|
|
134
|
+
return extractHandleFromAddress(fromAddress);
|
|
135
|
+
}
|
|
62
136
|
/**
|
|
63
137
|
* Extract the Connector host from a connectorUrl.
|
|
64
138
|
* `wss://preview.masons.ai/gw` -> `preview.masons.ai`
|
|
@@ -110,31 +184,59 @@ async function handleAddressedMessage(event, conversationManager, client, ctx) {
|
|
|
110
184
|
dbg("duplicate message suppressed from=%s sentAt=%s", fromAddress, event.sentAt);
|
|
111
185
|
return;
|
|
112
186
|
}
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
187
|
+
// Sender shape disambiguation per `docs/openclaw/program-demo-runbook.md § 4.2`:
|
|
188
|
+
// - Full Node sender (Node ↔ Node): `metadata.sender` is a NodeRef
|
|
189
|
+
// (`kind`, `mstpAddress`, optional `handle` / `displayName` /
|
|
190
|
+
// `avatarUrl`) per `docs/concepts/human-node-capability-obligations.md
|
|
191
|
+
// § 2` + Connector Piece 2 projection at
|
|
192
|
+
// `apps/connector/src/routes/root.ts`.
|
|
193
|
+
// Right-Fix lock per #1455 issuecomment-4354081096: route via standard
|
|
194
|
+
// Node-peer path; do NOT consult `metadata.is_owner`. `is_owner` is an
|
|
195
|
+
// ownership signal, not a routing signal — owner-self-chat walks the
|
|
196
|
+
// same wire as stranger-chat.
|
|
197
|
+
// - Visitor / Identified Client / Anonymous (Client → Node):
|
|
198
|
+
// `metadata.sender` is absent; only `visitor_name`, `is_owner`,
|
|
199
|
+
// `client_type` per
|
|
200
|
+
// `docs/concepts/client-to-node-capability-obligations.md § 2`.
|
|
201
|
+
// Existing visitor-mode owner-routing applies.
|
|
202
|
+
const nodeRef = tryProjectNodeRef(event.metadata);
|
|
203
|
+
if (nodeRef) {
|
|
204
|
+
// Full Node sender — standard Node-peer path. Skip is_owner consultation,
|
|
205
|
+
// owner-address marking, and the identity-linking nudge (those all key off
|
|
206
|
+
// the visitor-mode owner concept).
|
|
207
|
+
setCurrentTurnIsOwner(false);
|
|
208
|
+
dbg("Full Node sender: kind=%s mstpAddress=%s handle=%s", nodeRef.kind, nodeRef.mstpAddress, nodeRef.handle ?? "(absent)");
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
// Visitor-mode path — preserved behavior.
|
|
212
|
+
// Owner detection: first-message-sets, subsequent-inherits.
|
|
213
|
+
// Connector includes is_owner in metadata for Passport visitors.
|
|
214
|
+
if (event.metadata?.is_owner === true) {
|
|
215
|
+
markOwnerAddress(fromAddress);
|
|
216
|
+
// Record Passport address for tool auto-include (first visit only)
|
|
217
|
+
if (!storedOwnerPassportAddress) {
|
|
218
|
+
storedOwnerPassportAddress = fromAddress;
|
|
219
|
+
dbg("recorded owner Passport address: %s", fromAddress);
|
|
220
|
+
}
|
|
221
|
+
// --- dmScope-aware identity linking nudge (#986 redesign, #1158 fix) ---
|
|
222
|
+
// Detect that identity linking is available but not configured.
|
|
223
|
+
// Sets a flag (NOT enqueued into ownerNotesQueue) for delivery on the
|
|
224
|
+
// owner's next non-Passport turn, where the linking action is relevant.
|
|
225
|
+
// Separated from the queue to avoid the Passport drain deadlock (#1158).
|
|
226
|
+
if (getDmScope() !== "main" &&
|
|
227
|
+
!isIdentityLinksConfigured() &&
|
|
228
|
+
!notificationAttempted) {
|
|
229
|
+
notificationAttempted = true;
|
|
230
|
+
identityLinkingNudgePending = true;
|
|
231
|
+
dbg("identity linking nudge pending (dmScope=%s)", getDmScope());
|
|
232
|
+
}
|
|
133
233
|
}
|
|
234
|
+
setCurrentTurnIsOwner(isOwnerAddress(fromAddress));
|
|
134
235
|
}
|
|
135
|
-
setCurrentTurnIsOwner(isOwnerAddress(fromAddress));
|
|
136
236
|
// Resolve contact from address. Register inbound conversation if new.
|
|
137
|
-
const contact =
|
|
237
|
+
const contact = nodeRef
|
|
238
|
+
? deriveNodeName(nodeRef, fromAddress)
|
|
239
|
+
: deriveSenderName(event);
|
|
138
240
|
if (!conversationManager.getContactByAddress(fromAddress)) {
|
|
139
241
|
conversationManager.registerInbound(contact, fromAddress);
|
|
140
242
|
}
|
|
@@ -25,19 +25,45 @@ export interface RequestConnectionResponse {
|
|
|
25
25
|
requestIds: string[];
|
|
26
26
|
status: string;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Wire-level NodeRef view emitted by `apps/connector` on Connection
|
|
30
|
+
* responses (per `human-node-capability-obligations.md § 2`). Plugin uses
|
|
31
|
+
* this same shape consumer-side; it intentionally mirrors the
|
|
32
|
+
* `NodeRefView` interface in `./types.ts`.
|
|
33
|
+
*/
|
|
34
|
+
export interface ConnectionNodeRef {
|
|
35
|
+
kind: string;
|
|
36
|
+
mstpAddress: string;
|
|
37
|
+
handle?: string;
|
|
38
|
+
displayName?: string;
|
|
39
|
+
avatarUrl?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Back-compat counterparty shape on `ListRequestsItem.fromAgent` /
|
|
43
|
+
* `ListRequestsItem.toAgent`. Connector emits `{ handle, name }` only on
|
|
44
|
+
* these (per `apps/connector/src/routes/runtime/v1/connections/requests/`,
|
|
45
|
+
* NodeRef enrichment lives in `fromNode` / `toNode` instead). Marked
|
|
46
|
+
* `@deprecated` since #1450 Phase 1 — readers prefer `fromNode` / `toNode`.
|
|
47
|
+
*/
|
|
48
|
+
export interface BackCompatAgent {
|
|
49
|
+
handle: string;
|
|
50
|
+
name: string;
|
|
51
|
+
}
|
|
28
52
|
export interface ListRequestsItem {
|
|
29
53
|
id: string;
|
|
30
54
|
direction: "incoming" | "outgoing";
|
|
31
|
-
/**
|
|
32
|
-
fromAgent?:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
/** @deprecated since #1450 Phase 1 — use `fromNode` (NodeRef shape). */
|
|
56
|
+
fromAgent?: BackCompatAgent;
|
|
57
|
+
/** @deprecated since #1450 Phase 1 — use `toNode` (NodeRef shape). */
|
|
58
|
+
toAgent?: BackCompatAgent;
|
|
59
|
+
/** Present for incoming requests — the sender Node, NodeRef shape per
|
|
60
|
+
* `human-node-capability-obligations.md § 2`. Connector emits this
|
|
61
|
+
* alongside `fromAgent` since #1450 Phase 1. May be `null` when the
|
|
62
|
+
* Connector ran NodeRef enrichment but the entity record is missing. */
|
|
63
|
+
fromNode?: ConnectionNodeRef | null;
|
|
64
|
+
/** Present for outgoing requests — the target Node, NodeRef shape.
|
|
65
|
+
* Connector emits this alongside `toAgent` since #1450 Phase 1. */
|
|
66
|
+
toNode?: ConnectionNodeRef | null;
|
|
41
67
|
variant: string;
|
|
42
68
|
status: string;
|
|
43
69
|
matchmaking: {
|
|
@@ -53,10 +79,15 @@ export interface ListRequestsResponse {
|
|
|
53
79
|
}
|
|
54
80
|
export interface AcceptRequestResponse {
|
|
55
81
|
status: "accepted";
|
|
82
|
+
/** @deprecated since #1450 Phase 1 — use `counterparty` (NodeRef shape). */
|
|
56
83
|
connection: {
|
|
57
84
|
handle: string;
|
|
58
85
|
name: string;
|
|
59
86
|
};
|
|
87
|
+
/** Counterparty NodeRef per `human-node-capability-obligations.md § 2`.
|
|
88
|
+
* Connector emits this alongside `connection` since #1450 Phase 1. May
|
|
89
|
+
* be `null` when enrichment fails. */
|
|
90
|
+
counterparty?: ConnectionNodeRef | null;
|
|
60
91
|
}
|
|
61
92
|
export interface DeclineRequestResponse {
|
|
62
93
|
status: "declined";
|
|
@@ -79,8 +110,17 @@ export interface UpdateProfileResponse {
|
|
|
79
110
|
export interface ListConnectionsResponse {
|
|
80
111
|
total: number;
|
|
81
112
|
items: Array<{
|
|
113
|
+
/** @deprecated since #1450 Phase 1 — use
|
|
114
|
+
* `counterparty.displayName ?? counterparty.handle ?? counterparty.mstpAddress`. */
|
|
82
115
|
name: string;
|
|
116
|
+
/** @deprecated since #1450 Phase 1 — use `counterparty.mstpAddress`. */
|
|
83
117
|
address: string;
|
|
118
|
+
/** Counterparty NodeRef per `human-node-capability-obligations.md § 2`.
|
|
119
|
+
* Connector emits this alongside `name + address` since #1450
|
|
120
|
+
* Phase 1. Plugin renderer prefers `counterparty.kind` /
|
|
121
|
+
* `displayName` over the legacy fields when present; falls back to
|
|
122
|
+
* `name + address` for back-compat with older Connector versions. */
|
|
123
|
+
counterparty?: ConnectionNodeRef | null;
|
|
84
124
|
}>;
|
|
85
125
|
}
|
|
86
126
|
export interface ConnectionStatusResponse {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-client.d.ts","sourceRoot":"","sources":["../src/platform-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,wBAAwB;AACxB,eAAO,MAAM,gBAAgB,mCAAmC,CAAC;AAEjE,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,qBAAa,gBAAiB,SAAQ,KAAK;aAEvB,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,MAAM;gBADZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM;CAKlB;AAMD,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"platform-client.d.ts","sourceRoot":"","sources":["../src/platform-client.ts"],"names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,EAAE,oBAAoB,EACzB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,aAAa,CAAC,CAyDxB;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,oBAAoB,EACzB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAiB1C"}
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAiJA,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACjE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GAAG,IAAI,CAAC;CACnE;AAED,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;kBAaI,iBAAiB;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAiJA,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACjE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GAAG,IAAI,CAAC;CACnE;AAED,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;kBAaI,iBAAiB;CA6XhC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/plugin.js
CHANGED
|
@@ -133,14 +133,15 @@ const plugin = {
|
|
|
133
133
|
//
|
|
134
134
|
// History: 0.5.0 mounted this hook at `plugin.setup.configureInteractive`
|
|
135
135
|
// — a path no OpenClaw version reads, so `channels login` never worked.
|
|
136
|
-
// 0.5.1
|
|
137
|
-
//
|
|
136
|
+
// 0.5.1 corrected the mount point. 0.5.2 surfaces register errors
|
|
137
|
+
// instead of silently catching them — the previous "cheap guard"
|
|
138
|
+
// (`catch {}`) hid every kind of register-time failure including the
|
|
139
|
+
// ones we care about (schema validation, missing modules, IO errors).
|
|
138
140
|
//
|
|
139
|
-
// The
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
//
|
|
143
|
-
// and never wrong; removing it would require positive verification first.
|
|
141
|
+
// The new contract: log the error visibly AND re-throw, so OpenClaw
|
|
142
|
+
// surfaces the failure to the user rather than running with an
|
|
143
|
+
// un-registered channel that mysteriously "doesn't support login".
|
|
144
|
+
// Per Mingke's review of the 0.5.1 T1 failure (#1264, 2026-04-19).
|
|
144
145
|
try {
|
|
145
146
|
api.registerChannel({
|
|
146
147
|
plugin: {
|
|
@@ -149,8 +150,9 @@ const plugin = {
|
|
|
149
150
|
},
|
|
150
151
|
});
|
|
151
152
|
}
|
|
152
|
-
catch {
|
|
153
|
-
|
|
153
|
+
catch (err) {
|
|
154
|
+
console.error("[@masons/agent-network] api.registerChannel failed — channel will be unavailable:", err);
|
|
155
|
+
throw err;
|
|
154
156
|
}
|
|
155
157
|
// --- Layer B: Per-turn context injection ---
|
|
156
158
|
// Injects agent network awareness into every LLM turn via before_prompt_build.
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA6CH,UAAU,WAAW;IACnB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,CACP,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,OAAO,CAAC,WAAW,CAAC,CAAC;CAC3B;AAED,UAAU,OAAO;IACf,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CACzE;AAwCD,uDAAuD;AACvD,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA6CH,UAAU,WAAW;IACnB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,CACP,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,OAAO,CAAC,WAAW,CAAC,CAAC;CAC3B;AAED,UAAU,OAAO;IACf,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CACzE;AAwCD,uDAAuD;AACvD,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AA4ED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAm2BhD"}
|
package/dist/tools.js
CHANGED
|
@@ -98,6 +98,28 @@ function maybeAppendUpdateNotice(result) {
|
|
|
98
98
|
function withUpdateNotice(fn) {
|
|
99
99
|
return async (id, params) => maybeAppendUpdateNotice(await fn(id, params));
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Format a Node kind discriminator as a prefix label for list rendering.
|
|
103
|
+
*
|
|
104
|
+
* Returns:
|
|
105
|
+
* - "[Human Node] " when kind === "user"
|
|
106
|
+
* - "[Agent Node] " when kind === "agent"
|
|
107
|
+
* - "[Node:<kind>] " for future / unknown kinds (forward-compat per
|
|
108
|
+
* `docs/concepts/human-node-capability-obligations.md § 5` — never
|
|
109
|
+
* suppress, never crash)
|
|
110
|
+
* - "" (empty) when kind is absent — preserves backward-compatible
|
|
111
|
+
* rendering against Connector versions that have not adopted NodeRef
|
|
112
|
+
* projection.
|
|
113
|
+
*/
|
|
114
|
+
function formatKindLabel(kind) {
|
|
115
|
+
if (!kind)
|
|
116
|
+
return "";
|
|
117
|
+
if (kind === "user")
|
|
118
|
+
return "[Human Node] ";
|
|
119
|
+
if (kind === "agent")
|
|
120
|
+
return "[Agent Node] ";
|
|
121
|
+
return `[Node:${kind}] `;
|
|
122
|
+
}
|
|
101
123
|
function formatConnectionResult(requestIds, status) {
|
|
102
124
|
if (requestIds.length === 0) {
|
|
103
125
|
return "Already connected or request already pending — no new request needed.";
|
|
@@ -362,13 +384,28 @@ export function registerTools(api) {
|
|
|
362
384
|
}
|
|
363
385
|
const lines = result.items.map((item) => {
|
|
364
386
|
const dir = item.direction ?? direction;
|
|
365
|
-
// For incoming: sender is in
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
387
|
+
// For incoming: sender NodeRef is in `fromNode` (since #1450 Phase 1).
|
|
388
|
+
// For outgoing: target NodeRef is in `toNode`. Both may be null when
|
|
389
|
+
// the Connector ran NodeRef enrichment but the entity record was
|
|
390
|
+
// missing. Back-compat fallback: `fromAgent` / `toAgent` carry just
|
|
391
|
+
// `{ handle, name }` from older Connector versions or the back-compat
|
|
392
|
+
// shape #1450 still emits.
|
|
393
|
+
const node = dir === "outgoing" ? item.toNode : item.fromNode;
|
|
394
|
+
const compat = dir === "outgoing" ? item.toAgent : item.fromAgent;
|
|
395
|
+
// Display fallback chain per `human-node-capability-obligations.md § 2`:
|
|
396
|
+
// NodeRef.displayName → NodeRef.handle → back-compat name → handle → "unknown".
|
|
397
|
+
const otherName = node?.displayName ||
|
|
398
|
+
node?.handle ||
|
|
399
|
+
compat?.name ||
|
|
400
|
+
compat?.handle ||
|
|
401
|
+
"unknown";
|
|
402
|
+
const otherHandle = node?.handle || compat?.handle || "unknown";
|
|
403
|
+
// Kind discriminator: surface "Human Node" / "Agent Node" / future kinds
|
|
404
|
+
// when the Connector projects `kind` per the same doc § 5 forward-compat.
|
|
405
|
+
const kindLabel = formatKindLabel(node?.kind);
|
|
369
406
|
const dirArrow = dir === "outgoing" ? "→" : "←";
|
|
370
407
|
const parts = [
|
|
371
|
-
`• ${dirArrow} ${otherName} (@${otherHandle})`,
|
|
408
|
+
`• ${dirArrow} ${kindLabel}${otherName} (@${otherHandle})`,
|
|
372
409
|
` ID: ${item.id} | Variant: ${item.variant} | Status: ${item.status}`,
|
|
373
410
|
];
|
|
374
411
|
if (item.matchmaking?.title) {
|
|
@@ -416,8 +453,17 @@ export function registerTools(api) {
|
|
|
416
453
|
const requestId = params.requestId;
|
|
417
454
|
try {
|
|
418
455
|
const result = await acceptRequest(cfg, apiKey, requestId);
|
|
419
|
-
|
|
420
|
-
|
|
456
|
+
// Prefer NodeRef on `counterparty` (since #1450 Phase 1); fall
|
|
457
|
+
// back to legacy `connection.{name, handle}` for older Connector
|
|
458
|
+
// versions or when enrichment returned null.
|
|
459
|
+
const node = result.counterparty;
|
|
460
|
+
const who = node?.displayName ||
|
|
461
|
+
node?.handle ||
|
|
462
|
+
result.connection.name ||
|
|
463
|
+
result.connection.handle;
|
|
464
|
+
const handle = node?.handle || result.connection.handle;
|
|
465
|
+
const kindLabel = formatKindLabel(node?.kind);
|
|
466
|
+
return textResult(`Connected with ${kindLabel}${who} (@${handle})! You can now send messages using masons_send_message.`);
|
|
421
467
|
}
|
|
422
468
|
catch (err) {
|
|
423
469
|
if (err instanceof PlatformApiError && err.status === 404) {
|
|
@@ -476,7 +522,15 @@ export function registerTools(api) {
|
|
|
476
522
|
if (result.total === 0) {
|
|
477
523
|
return textResult("No connections yet. Use masons_send_connection_request to connect with other agents.");
|
|
478
524
|
}
|
|
479
|
-
const lines = result.items.map((item, i) =>
|
|
525
|
+
const lines = result.items.map((item, i) => {
|
|
526
|
+
// NodeRef on `counterparty` (since #1450 Phase 1); falls back to
|
|
527
|
+
// legacy `name + address` for older Connector versions.
|
|
528
|
+
const node = item.counterparty;
|
|
529
|
+
const displayName = node?.displayName || node?.handle || item.name || "(unnamed)";
|
|
530
|
+
const address = node?.mstpAddress || item.address;
|
|
531
|
+
const kindLabel = formatKindLabel(node?.kind);
|
|
532
|
+
return `${i + 1}. ${kindLabel}${displayName} (${address})`;
|
|
533
|
+
});
|
|
480
534
|
return textResult(`${result.total} connection(s):\n\n${lines.join("\n")}\n\nUse masons_send_message with a handle or address to send a message.`);
|
|
481
535
|
}),
|
|
482
536
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -61,7 +61,25 @@ export interface SendAckEvent {
|
|
|
61
61
|
messageId: string;
|
|
62
62
|
status: "delivered" | "stored";
|
|
63
63
|
}
|
|
64
|
-
/** Message received from a routable address.
|
|
64
|
+
/** Message received from a routable address.
|
|
65
|
+
*
|
|
66
|
+
* The `metadata` bag is intentionally `Record<string, unknown>` — the wire
|
|
67
|
+
* contract does not constrain it. Two shapes the Connector may project:
|
|
68
|
+
* - **Full Node sender** (Node ↔ Node): `metadata.sender` carries a
|
|
69
|
+
* NodeRef-shaped projection per
|
|
70
|
+
* `docs/concepts/human-node-capability-obligations.md § 2`, alongside
|
|
71
|
+
* the existing Identified-Client back-compat fields. See {@link NodeRefView}
|
|
72
|
+
* and `apps/connector/src/routes/root.ts` § Piece 2 projection.
|
|
73
|
+
* - **Identified / Anonymous Client sender** (Client → Node):
|
|
74
|
+
* `metadata.sender` is absent; only `visitor_name`, `is_owner`,
|
|
75
|
+
* `client_type` per
|
|
76
|
+
* `docs/concepts/client-to-node-capability-obligations.md § 2`.
|
|
77
|
+
*
|
|
78
|
+
* Discriminator semantics on the wire: when `metadata.sender` is present,
|
|
79
|
+
* it is the AUTHORITATIVE identity of the sender — consumers updated to
|
|
80
|
+
* recognise NodeRef MUST treat `metadata.sender` as the source of truth
|
|
81
|
+
* and the legacy fields as deprecated annotations. See `channel.ts §
|
|
82
|
+
* tryProjectNodeRef`. */
|
|
65
83
|
export interface AddressedMessageEvent {
|
|
66
84
|
event: "MESSAGE_RECEIVED";
|
|
67
85
|
from: string;
|
|
@@ -75,6 +93,37 @@ export interface AddressedMessageEvent {
|
|
|
75
93
|
* (online delivery + gap fill). (#1133) */
|
|
76
94
|
seq?: number;
|
|
77
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* NodeRef view, as carried under `AddressedMessageEvent.metadata.sender`
|
|
98
|
+
* by the Connector when the sender is a Full Node (per
|
|
99
|
+
* `docs/concepts/human-node-capability-obligations.md § 2` +
|
|
100
|
+
* `apps/connector/src/routes/root.ts` § Piece 2 projection).
|
|
101
|
+
*
|
|
102
|
+
* Fields:
|
|
103
|
+
* - `kind` — discriminator. MASONS Cloud emits `"user"` (Human Node) or
|
|
104
|
+
* `"agent"` (Agent Node). Consumers MUST accept other string values per
|
|
105
|
+
* the same doc § 5 (forward-compat).
|
|
106
|
+
* - `mstpAddress` — canonical Node identity URI. Always populated when
|
|
107
|
+
* `kind` is. Equality between two NodeRefs is defined as string-equality
|
|
108
|
+
* on `mstpAddress`.
|
|
109
|
+
* - `handle` — handle within the host's namespace. Populated for
|
|
110
|
+
* MASONS-Cloud-hosted Nodes; may be omitted for federated Nodes.
|
|
111
|
+
* - `displayName` — owner-set display name. Optional.
|
|
112
|
+
* - `avatarUrl` — image URL. Optional.
|
|
113
|
+
*
|
|
114
|
+
* Plugin consumption: `channel.ts § tryProjectNodeRef` extracts this view
|
|
115
|
+
* from `event.metadata.sender` when both `kind` and `mstpAddress` are
|
|
116
|
+
* strings. Callers that receive a non-null view route via the standard
|
|
117
|
+
* Node-peer dispatch path; callers that receive null fall through to the
|
|
118
|
+
* Client-side metadata shape (`visitor_name`, `is_owner`, `client_type`).
|
|
119
|
+
*/
|
|
120
|
+
export interface NodeRefView {
|
|
121
|
+
kind: string;
|
|
122
|
+
mstpAddress: string;
|
|
123
|
+
handle?: string;
|
|
124
|
+
displayName?: string;
|
|
125
|
+
avatarUrl?: string;
|
|
126
|
+
}
|
|
78
127
|
/** Notification that stored messages have been delivered. */
|
|
79
128
|
export interface DeliveryPendingEvent {
|
|
80
129
|
event: "DELIVERY_PENDING";
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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,aAAa;IAC5B,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;8EAE0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qDAAqD;A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AC7C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,MAAM,MAAM,sBAAsB,GAC9B,aAAa,GACb,kBAAkB,GAClB,oBAAoB,GACpB,yBAAyB,CAAC;AAE9B,MAAM,MAAM,sBAAsB,GAC9B,gBAAgB,GAChB,YAAY,GACZ,qBAAqB,GACrB,oBAAoB,GACpB,mBAAmB,GACnB,oBAAoB,CAAC;AAUzB,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,gBAAgB,CAErE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,YAAY,CAM7D;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,OAAO,GACZ,IAAI,IAAI,qBAAqB,CAO/B;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,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAO7E"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,eAAO,MAAM,cAAc,WAAW,CAAC"}
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Plugin version — must match package.json. Validated by prepublishOnly. */
|
|
2
|
-
export const PLUGIN_VERSION = "0.5.
|
|
2
|
+
export const PLUGIN_VERSION = "0.5.12";
|
package/package.json
CHANGED