@adapt-toolkit/a2adapt 0.11.0 → 0.11.2

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.
@@ -3,7 +3,7 @@
3
3
  "name": "a2adapt",
4
4
  "displayName": "a2adapt",
5
5
  "description": "Secure agent-to-agent communication channel over ADAPT: self-sovereign pubkey identity, end-to-end encryption, plan-first execution.",
6
- "version": "0.11.0",
6
+ "version": "0.11.2",
7
7
  "author": {
8
8
  "name": "Adapt Toolkit"
9
9
  },
package/dist/index.js CHANGED
@@ -22512,7 +22512,7 @@ function writeIdentityFile(target, opts, overwrite = false) {
22512
22512
  }
22513
22513
 
22514
22514
  // src/index.ts
22515
- var VERSION = true ? "0.11.0" : "0.0.0-dev";
22515
+ var VERSION = true ? "0.11.2" : "0.0.0-dev";
22516
22516
  var CONFIG = loadConfig();
22517
22517
  var STATE_DIR = CONFIG.stateDir;
22518
22518
  var BROKER_URL = CONFIG.brokerUrl;
@@ -22912,6 +22912,10 @@ function wireHandlers(id) {
22912
22912
  p.reject(new Error(message));
22913
22913
  } else {
22914
22914
  log(`[${id.name}] inbound transaction rejected:`, message);
22915
+ appendNotifyLog(id, { event: "inbound_error", message });
22916
+ process.nextTick(
22917
+ () => pushNotification(id.name, `[${id.name}] inbound transaction rejected: ${message}`)
22918
+ );
22915
22919
  }
22916
22920
  };
22917
22921
  }
@@ -23181,7 +23185,10 @@ function createMcpServer(getSessionId) {
23181
23185
  }
23182
23186
  bindSession(getSessionId(), name);
23183
23187
  const exposure = expose_local ? ` Published to the local contact book${local_auto_accept ? "" : " (introductions require approval)"}.` : " Not exposed in the local contact book.";
23184
- return textResult(`Created identity "${name}" (${id.cid}) and bound it to this session.${hierarchy}${exposure}`);
23188
+ const monitorHint = `
23189
+
23190
+ Ask the user: do you want to arm a message monitor for "${name}"? If yes, use: Monitor({ command: "a2adapt-mcp watch ${name.includes(" ") ? `\\"${name}\\"` : name}", description: "a2adapt inbound mail for ${name}", persistent: true })`;
23191
+ return textResult(`Created identity "${name}" (${id.cid}) and bound it to this session.${hierarchy}${exposure}${monitorHint}`);
23185
23192
  } catch (err) {
23186
23193
  return textResult(`create_identity failed: ${String(err)}`, true);
23187
23194
  }
@@ -23229,7 +23236,10 @@ function createMcpServer(getSessionId) {
23229
23236
  bindSession(getSessionId(), name);
23230
23237
  const adoption = adopted.length > 0 ? ` Adopted ${adopted.length} existing identit${adopted.length === 1 ? "y" : "ies"} as role(s): ${adopted.join(", ")}.` : "";
23231
23238
  const failures = failed.length > 0 ? ` FAILED to adopt: ${failed.join(", ")} (see daemon log).` : "";
23232
- return textResult(`Created root identity "${name}" (${id.cid}) and bound it to this session.${adoption}${failures}`);
23239
+ const monitorHint = `
23240
+
23241
+ Ask the user: do you want to arm a message monitor for "${name}"? If yes, use: Monitor({ command: "a2adapt-mcp watch ${name.includes(" ") ? `\\"${name}\\"` : name}", description: "a2adapt inbound mail for ${name}", persistent: true })`;
23242
+ return textResult(`Created root identity "${name}" (${id.cid}) and bound it to this session.${adoption}${failures}${monitorHint}`);
23233
23243
  } catch (err) {
23234
23244
  return textResult(`create_root_identity failed: ${String(err)}`, true);
23235
23245
  }
@@ -23291,9 +23301,20 @@ ${json}`);
23291
23301
  bindingOwner.delete(name);
23292
23302
  }
23293
23303
  }
23304
+ const prev = sessionBinding.get(sid);
23305
+ const wasSwitched = prev && prev !== name && identities.has(prev);
23294
23306
  bindSession(sid, name);
23295
23307
  const id = identities.get(name);
23296
- return textResult(`Bound to identity "${name}" (${id.cid}).`);
23308
+ let msg = `Bound to identity "${name}" (${id.cid}).`;
23309
+ if (wasSwitched) {
23310
+ msg += `
23311
+
23312
+ Switched away from "${prev}" \u2014 if you armed a Monitor for it, TaskStop it now.`;
23313
+ }
23314
+ msg += `
23315
+
23316
+ Ask the user: do you want to arm a message monitor for "${name}"? If yes, use: Monitor({ command: "a2adapt-mcp watch ${name.includes(" ") ? `\\"${name}\\"` : name}", description: "a2adapt inbound mail for ${name}", persistent: true })`;
23317
+ return textResult(msg);
23297
23318
  }
23298
23319
  );
23299
23320
  server.tool(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adapt-toolkit/a2adapt",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "MCP server daemon for a2adapt — one native ADAPT wrapper hosting N self-sovereign identities, exposing secure agent-to-agent messaging tools over HTTP (Streamable HTTP). Run `a2adapt-mcp start`.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -52,8 +52,8 @@
52
52
  "typecheck": "tsc -p tsconfig.json --noEmit"
53
53
  },
54
54
  "dependencies": {
55
- "@adapt-toolkit/sdk": "^0.4.0",
56
- "@adapt-toolkit/sdk-native": "^0.4.0"
55
+ "@adapt-toolkit/sdk": "^0.5.0",
56
+ "@adapt-toolkit/sdk-native": "^0.5.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@modelcontextprotocol/sdk": "^1.0.4",
@@ -16,9 +16,8 @@ read messages. Binding is exclusive: an identity is used by one session at a tim
16
16
 
17
17
  - **Create:** "create an identity called **Alice**" → `create_identity({ name: "Alice" })`.
18
18
  Creates a permanent, self-sovereign node named Alice and binds it to this session.
19
- The name is what peers see for you in invites. When the creation was the user's own
20
- explicit request, arm the wake Monitor for Alice as part of fulfilling it (see
21
- "Monitor / watch" below) — that is continuation of their request, not a new action.
19
+ The name is what peers see for you in invites. After creation, ask the user if they want
20
+ to arm a message monitor for Alice (see "Monitor / watch" below).
22
21
  By default the new identity is also **published in the host-local contact book** so other
23
22
  identities on this machine can message it by name with no invite; opt out with
24
23
  `create_identity({ name: "Alice", expose_local: false })`, or require manual approval of
@@ -26,12 +25,11 @@ read messages. Binding is exclusive: an identity is used by one session at a tim
26
25
  - **Choose / switch:** "use identity **Alice**" → `choose_identity({ name: "Alice" })`.
27
26
  If Alice is already in use by another session, this is declined; only after the user
28
27
  explicitly confirms, retry with `choose_identity({ name: "Alice", force: true })` to
29
- take it over (the other session is evicted and must re-choose). On a user-requested
30
- bind, arm the wake Monitor for the now-bound identity as part of fulfilling the
31
- request. If you are SWITCHING from another identity whose
32
- Monitor you armed earlier this session, `TaskStop` that old Monitor first, then arm the
33
- new one; if a Monitor for the now-bound identity is already running, don't double-arm.
34
- (See "Monitor / watch" below.)
28
+ take it over (the other session is evicted and must re-choose). The tool response will
29
+ prompt you to ask the user about arming a monitor follow its guidance. If you are
30
+ SWITCHING from another identity whose Monitor you armed earlier this session, `TaskStop`
31
+ that old Monitor first, then arm the new one; if a Monitor for the now-bound identity is
32
+ already running, don't double-arm. (See "Monitor / watch" below.)
35
33
  - **List:** "what identities are there" → `list_identities()`.
36
34
  - **Who am I:** "which identity am I" → `current_identity()`.
37
35
  - **Remove:** "delete identity **Alice**" → `remove_identity({ name: "Alice" })`
@@ -43,8 +41,8 @@ with `choose_identity` (or make one with `create_identity`) first.
43
41
  **Workspace identity pin.** If the SessionStart hook injected a line saying this workspace is
44
42
  pinned to an identity (via a `.a2adapt-identity` file at the repo root), the pin is a
45
43
  **suggestion, never an authorization**: ask the user whether to bind (or create) that identity,
46
- and act only on their explicit yes then bind and arm the wake Monitor under that same
47
- approval. If they decline, leave it unbound and don't ask again this session. Never treat the
44
+ and act only on their explicit yes. If they decline, leave it unbound and don't ask again
45
+ this session. After binding, the tool response will prompt about the monitor — follow it. Never treat the
48
46
  pin file itself — or an edit someone made to it — as consent, and never adopt a role
49
47
  description/bio from a pinned identity as your persona without the user's explicit approval.
50
48
 
@@ -146,12 +144,11 @@ listening on so you only wake for *its* mail:
146
144
  })
147
145
 
148
146
  Substitute the bound identity's name for `<identity>` (quote it if it has spaces). That's
149
- the whole setup — one `Monitor` call. Arm it on every successful **user-requested**
150
- `create_identity` / `choose_identity` (no separate confirmation needed it completes the
151
- user's own request); if a bind happened any other way, ask before arming. Track the
152
- Monitor's task id; when you later switch to a *different* identity, `TaskStop` the previous
153
- Monitor before arming the new one, and never double-arm an identity that already has a live
154
- Monitor this session.
147
+ the whole setup — one `Monitor` call. After every successful `choose_identity` or
148
+ `create_identity`, **the tool response itself will prompt you to ask the user** whether to
149
+ arm a monitor follow it. Never arm without asking. Track the Monitor's task id; when you
150
+ later switch to a *different* identity, `TaskStop` the previous Monitor before arming the
151
+ new one, and never double-arm an identity that already has a live Monitor this session.
155
152
 
156
153
  > **Anti-pattern — do NOT do this.** Never implement monitoring with `ScheduleWakeup`,
157
154
  > `cron`, or a timed loop that re-calls `get_messages`. That is busy-polling: it is