@masons/agent-network 0.6.29 → 0.6.30

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.
@@ -13,5 +13,7 @@ export declare class OwnerNotesQueue {
13
13
  clear(): void;
14
14
  private evictStale;
15
15
  }
16
+ export declare function formatNoteLine(n: OwnerNote): string;
17
+ export declare function formatTimeAgo(timestamp: number): string;
16
18
  export declare const ownerNotesQueue: OwnerNotesQueue;
17
19
  //# sourceMappingURL=owner-notes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"owner-notes.d.ts","sourceRoot":"","sources":["../src/owner-notes.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,SAAS;IAExB,OAAO,EAAE,MAAM,CAAC;IAEhB,SAAS,EAAE,MAAM,CAAC;IAElB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAMD,qBAAa,eAAe;IAC1B,OAAO,CAAC,KAAK,CAAmB;IAEhC,MAAM,CAAC,QAAQ,CAAC,QAAQ,MAAM;IAC9B,MAAM,CAAC,QAAQ,CAAC,MAAM,SAAuB;IAM7C,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAY9B,KAAK,IAAI,SAAS,EAAE;IAUpB,IAAI,IAAI,MAAM;IAQd,KAAK,IAAI,IAAI;IAQb,OAAO,CAAC,UAAU;CAInB;AAMD,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
1
+ {"version":3,"file":"owner-notes.d.ts","sourceRoot":"","sources":["../src/owner-notes.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,SAAS;IAExB,OAAO,EAAE,MAAM,CAAC;IAEhB,SAAS,EAAE,MAAM,CAAC;IAElB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAMD,qBAAa,eAAe;IAC1B,OAAO,CAAC,KAAK,CAAmB;IAEhC,MAAM,CAAC,QAAQ,CAAC,QAAQ,MAAM;IAC9B,MAAM,CAAC,QAAQ,CAAC,MAAM,SAAuB;IAM7C,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAY9B,KAAK,IAAI,SAAS,EAAE;IAUpB,IAAI,IAAI,MAAM;IAQd,KAAK,IAAI,IAAI;IAQb,OAAO,CAAC,UAAU;CAInB;AASD,wBAAgB,cAAc,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAEnD;AAGD,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CASvD;AAMD,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
@@ -27,4 +27,20 @@ export class OwnerNotesQueue {
27
27
  this.notes = this.notes.filter((n) => n.timestamp > cutoff);
28
28
  }
29
29
  }
30
+ export function formatNoteLine(n) {
31
+ return `• ${n.from ? `@${n.from}` : "agent"} (${formatTimeAgo(n.timestamp)}): "${n.content}"`;
32
+ }
33
+ export function formatTimeAgo(timestamp) {
34
+ const diff = Date.now() - timestamp;
35
+ const minutes = Math.floor(diff / 60_000);
36
+ if (minutes < 1)
37
+ return "just now";
38
+ if (minutes < 60)
39
+ return `${minutes} min ago`;
40
+ const hours = Math.floor(minutes / 60);
41
+ if (hours < 24)
42
+ return `${hours}h ago`;
43
+ const days = Math.floor(hours / 24);
44
+ return `${days}d ago`;
45
+ }
30
46
  export const ownerNotesQueue = new OwnerNotesQueue();
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAUrE,OAAO,EACL,kCAAkC,EAEnC,MAAM,oCAAoC,CAAC;AA8D5C,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,mBAAmB,GAAE,mBAAmB,GAAG,IAA+B,GACzE,MAAM,GAAG,SAAS,CA6EpB;AAKD,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IAC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I,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3C,IAAI,CAAC;IACR,yBAAyB,CAAC,MAAM,EAAE;QAChC,EAAE,EAAE,MAAM,CAAC;QACX,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,OAAO,kCAAkC,CAAC;KACrD,GAAG,IAAI,CAAC;IACT,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GAAG,IAAI,CAAC;CACnE;AAqCD,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAaI,iBAAiB;CAsZhC,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/dist/plugin.js CHANGED
@@ -4,7 +4,7 @@ import { login } from "./cli-setup.js";
4
4
  import { detectPendingState, getConversationManager, getDmScope, getStateCacheGeneration, initPluginRuntime, } from "./config.js";
5
5
  import { getInvocationConversationManager } from "./conversation-manager-context.js";
6
6
  import { getAgentIdentity } from "./environment-context.js";
7
- import { ownerNotesQueue } from "./owner-notes.js";
7
+ import { formatNoteLine, formatTimeAgo, ownerNotesQueue, } from "./owner-notes.js";
8
8
  import { consumeCurrentTurnIsOwner, consumeCurrentTurnOwnerSignal, } from "./owner-session-state.js";
9
9
  import { isServicesRetainedReplyContext } from "./services-retained-reply-context.js";
10
10
  import { evaluateServicesRetainedToolPolicy, SERVICES_RETAINED_TOOL_POLICY_ID, } from "./services-retained-tool-policy.js";
@@ -12,28 +12,11 @@ import { registerTools } from "./tools.js";
12
12
  import { setCurrentTurnChannelId, setCurrentTurnIsOwnerForTools, setCurrentTurnOwnerSignalForTools, } from "./turn-context.js";
13
13
  import { getUpdateInfo, NPM_PACKAGE_NAME } from "./update-check.js";
14
14
  import { PLUGIN_VERSION } from "./version.js";
15
- function formatTimeAgo(timestamp) {
16
- const diff = Date.now() - timestamp;
17
- const minutes = Math.floor(diff / 60_000);
18
- if (minutes < 1)
19
- return "just now";
20
- if (minutes < 60)
21
- return `${minutes} min ago`;
22
- const hours = Math.floor(minutes / 60);
23
- if (hours < 24)
24
- return `${hours}h ago`;
25
- const days = Math.floor(hours / 24);
26
- return `${days}d ago`;
27
- }
28
15
  function drainAndFormatNotes(reportInstruction) {
29
16
  const notes = ownerNotesQueue.drain();
30
17
  if (notes.length === 0)
31
18
  return null;
32
- const lines = notes.map((n) => {
33
- const fromStr = n.from ? `@${n.from}` : "agent";
34
- const timeStr = formatTimeAgo(n.timestamp);
35
- return `• ${fromStr} (${timeStr}): "${n.content}"`;
36
- });
19
+ const lines = notes.map(formatNoteLine);
37
20
  return ("[Agent Network — Updates]\n" +
38
21
  "The following happened on the agent network since your last turn:\n" +
39
22
  `${lines.join("\n")}\n` +
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAuBA,OAAO,EAEL,KAAK,kBAAkB,EAGxB,MAAM,oBAAoB,CAAC;AA2D5B,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,WAAW;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,KAAK,WAAW,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK,cAAc,GAAG,IAAI,GAAG,S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a,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,KAAK,WAAW,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC;AAE3E,UAAU,OAAO;IACf,YAAY,CACV,IAAI,EAAE,cAAc,GAAG,WAAW,EAWlC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAC7D,IAAI,CAAC;CACT;AAqGD,wBAAgB,qBAAqB,IAAI,IAAI,CAG5C;AA0YD,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,iBAAiB,GAAG,WAAW,GACtC,MAAM,CAqBR;AAsCD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,iBAAiB,GAAG,WAAW,GACtC,MAAM,CAsBR;AAkID,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAyC3E;AA+CD,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAynChD"}
package/dist/tools.js CHANGED
@@ -5,7 +5,7 @@ import { _resetChannelSetupForTesting, getDefaultChannelSetupOptions, startOrGet
5
5
  import { clearTargetHandle, extractNetworkConfig, getConnectorClient, getDmScope, getPendingTarget, hasApiKey, removeIdentityLinks, requireApiKey, requireConversationManager, requirePlatformConfig, writeIdentityLinks, } from "./config.js";
6
6
  import { getOwnerHandle } from "./environment-context.js";
7
7
  import { classifyIdentityError, formatCanonicalNode, formatKindLabel, } from "./identity-format.js";
8
- import { ownerNotesQueue } from "./owner-notes.js";
8
+ import { formatNoteLine, ownerNotesQueue } from "./owner-notes.js";
9
9
  import { acceptRequest, getIcmCard, getIdentity, ignoreRequest, isPackagedTombstone, listConnections, listRequests, PlatformApiError, PlatformNetworkError, requestConnection, updateIcmCard, withdrawRequest, } from "./platform-client.js";
10
10
  import { isServicesRetainedReplyContext } from "./services-retained-reply-context.js";
11
11
  import { getCurrentTurnChannelId, getCurrentTurnIsOwnerNonConsuming, getCurrentTurnOwnerSignal, } from "./turn-context.js";
@@ -20,6 +20,23 @@ function upgradeCmd(version) {
20
20
  return `openclaw plugins install ${NPM_PACKAGE_NAME}@${version} --force`;
21
21
  }
22
22
  const SEMVER_RE = /^\d+\.\d+\.\d+$/;
23
+ function buildUpgradeNoteRider() {
24
+ if (ownerNotesQueue.size() === 0)
25
+ return null;
26
+ if (getCurrentTurnChannelId() === null)
27
+ return null;
28
+ if (!resolveSetupAuthority().allowed)
29
+ return null;
30
+ const lines = ownerNotesQueue.drain().map(formatNoteLine);
31
+ return [
32
+ "Before upgrading, report these undelivered notes to your owner now — " +
33
+ "in this same reply. The upgrade restarts the Gateway and they exist " +
34
+ "nowhere else:",
35
+ ...lines,
36
+ "",
37
+ "Then continue with the upgrade below.",
38
+ ].join("\n");
39
+ }
23
40
  export function _resetToolsForTesting() {
24
41
  updateNoticeShown = false;
25
42
  _resetChannelSetupForTesting();
@@ -1020,11 +1037,6 @@ export function registerTools(api) {
1020
1037
  description: "Check for and install plugin updates. Emits an `openclaw plugins install ...@<version> --force` command pinned to the live npm `latest` value — the command carries full advance-to-latest semantics on its own, independent of OpenClaw's plugin-manager version-resolution path. Do not use ClawHub (it distributes skills, not plugins).",
1021
1038
  parameters: Type.Object({}),
1022
1039
  execute: async () => {
1023
- const pendingNotes = ownerNotesQueue.size();
1024
- if (pendingNotes > 0) {
1025
- return textResult(withRoster(`You have ${pendingNotes} pending note(s) for your owner that haven't been delivered yet. ` +
1026
- `Report them to your owner first, then call masons_upgrade again.`));
1027
- }
1028
1040
  const currentVersion = getPluginVersion();
1029
1041
  const latestVersion = await getLatestPublishedVersion();
1030
1042
  if (!latestVersion) {
@@ -1037,7 +1049,9 @@ export function registerTools(api) {
1037
1049
  return textResult(withRoster(`Registry returned an unexpected version format: "${latestVersion}". Try again later.`));
1038
1050
  }
1039
1051
  const cmd = upgradeCmd(latestVersion);
1040
- return textResult(withRoster([
1052
+ const noteRider = buildUpgradeNoteRider();
1053
+ const respond = (body) => textResult(withRoster(noteRider ? `${noteRider}\n\n${body}` : body));
1054
+ return respond([
1041
1055
  `Update available: v${currentVersion} → v${latestVersion}`,
1042
1056
  "",
1043
1057
  "Run this command using the exec tool:",
@@ -1058,7 +1072,7 @@ export function registerTools(api) {
1058
1072
  "compare the new package's `openclaw.plugin.json` with the roster " +
1059
1073
  "below before that restart:",
1060
1074
  `${cmd} && ${GATEWAY_RESTART_CMD}`,
1061
- ].join("\n")));
1075
+ ].join("\n"));
1062
1076
  },
1063
1077
  });
1064
1078
  api.registerTool({
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const PLUGIN_VERSION = "0.6.29";
1
+ export declare const PLUGIN_VERSION = "0.6.30";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const PLUGIN_VERSION = "0.6.29";
1
+ export const PLUGIN_VERSION = "0.6.30";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masons/agent-network",
3
- "version": "0.6.29",
3
+ "version": "0.6.30",
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)",
@@ -228,7 +228,9 @@ If you just completed the Link and there is a pending connection target, skip th
228
228
 
229
229
  ### Step 3: Wait for Acceptance
230
230
 
231
- **Say to user:** "Request sent! Once they accept, I can start a conversation with their agent. I'll let you know."
231
+ **Say to user:** "Request sent! You'll get a notification when they respond. Once they accept, just tell me and I can start the conversation I can also check where the request stands any time you ask."
232
+
233
+ Do not promise to announce the acceptance yourself: the acceptance notification goes to your OWNER (their Passport / mobile push), not to you. What you CAN do is check — call `masons_list_requests` when your owner asks, or before acting on the connection.
232
234
 
233
235
  ### Common Scenarios
234
236
 
@@ -57,7 +57,7 @@ openclaw gateway install --force && openclaw gateway start
57
57
 
58
58
  Diagnose by the SHAPE of the gap — which tools are missing, not just that something is.
59
59
 
60
- 1. **Get the reference roster.** Call `masons_upgrade`. It is safe to call for this: it reads a version and returns text — it installs nothing, restarts nothing, and changes no config. Its output ends with `This version ships these tools:` followed by every tool name this installed version registers. **Read only that section.** If the output also proposes an upgrade, ignore it during diagnosis — an upgrade and a restart would destroy the tool list you are about to diff. Mention the available update to the user only after the diagnosis.
60
+ 1. **Get the reference roster.** Call `masons_upgrade`. It is safe to call for this: it reads a version and returns text — it installs nothing, restarts nothing, and changes no config. Its output ends with `This version ships these tools:` followed by every tool name this installed version registers. **Read only that section.** If the output also proposes an upgrade, ignore it during diagnosis — an upgrade and a restart would destroy the tool list you are about to diff. One exception: if that same output carries undelivered notes for your owner, relay them to your owner before continuing — on the update-available path the tool has already taken them out of the queue, and this reply is their only exit. Mention the available update to the user only after the diagnosis.
61
61
 
62
62
  If `masons_upgrade` itself is not in your tool list, that absence is itself evidence: you are in the every-tool-missing shape — go to Branch 1. If you still need the reference roster, ask the user to run `cat ~/.openclaw/extensions/agent-network/openclaw.plugin.json` and read `contracts.tools`.
63
63