@sentropic/h2a-cli 0.28.0 → 0.29.1
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/runtime/mirror/accept.d.ts +7 -1
- package/dist/runtime/mirror/accept.d.ts.map +1 -1
- package/dist/runtime/mirror/accept.js +8 -1
- package/dist/runtime/mirror/accept.js.map +1 -1
- package/dist/runtime/mirror/build.d.ts +7 -1
- package/dist/runtime/mirror/build.d.ts.map +1 -1
- package/dist/runtime/mirror/build.js +2 -1
- package/dist/runtime/mirror/build.js.map +1 -1
- package/dist/runtime/mirror/serve.d.ts.map +1 -1
- package/dist/runtime/mirror/serve.js +11 -0
- package/dist/runtime/mirror/serve.js.map +1 -1
- package/package.json +2 -2
- package/skills/h2a/SKILL.md +34 -5
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Never throws on rejection; only the caller-supplied `applyRegistration` may.
|
|
15
15
|
*/
|
|
16
|
-
import { type H2AActorRegistration, type H2AReplayGuard, type H2ASession } from "@sentropic/h2a";
|
|
16
|
+
import { type H2AActorRegistration, type H2AReplayGuard, type H2ASession, type H2ASubagentBinding } from "@sentropic/h2a";
|
|
17
17
|
export type H2AMirrorRejection = "malformed" | "not-mirror" | "no-signature" | "unauthorized-key" | "bad-signature" | "invalid-timestamp" | "expired" | "future" | "replayed" | "stale-sequence" | "instance-key-mismatch";
|
|
18
18
|
export type H2AMirrorResult = {
|
|
19
19
|
ok: true;
|
|
@@ -44,6 +44,12 @@ export interface AcceptMirrorOptions {
|
|
|
44
44
|
* beat. Omit to skip fencing (P1 behavior).
|
|
45
45
|
*/
|
|
46
46
|
fenceSequence?: (signerInstance: string, seq: number) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* P3: apply a subagent binding (the impl is idempotent — a known binding is a
|
|
49
|
+
* no-op). Only called for bindings whose `parentInstance` is owned by the
|
|
50
|
+
* verified key. Omit to ignore subagents (P1/P2 behavior).
|
|
51
|
+
*/
|
|
52
|
+
applySubagent?: (binding: H2ASubagentBinding) => void;
|
|
47
53
|
/** Reference time (ms epoch) for the guard. Defaults to `Date.now()`. */
|
|
48
54
|
now?: number;
|
|
49
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accept.d.ts","sourceRoot":"","sources":["../../../src/runtime/mirror/accept.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAGL,KAAK,oBAAoB,EAGzB,KAAK,cAAc,EACnB,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"accept.d.ts","sourceRoot":"","sources":["../../../src/runtime/mirror/accept.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAGL,KAAK,oBAAoB,EAGzB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAIxB,MAAM,MAAM,kBAAkB,GAC1B,WAAW,GACX,YAAY,GACZ,cAAc,GACd,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,SAAS,GACT,QAAQ,GACR,UAAU,GACV,gBAAgB,GAChB,uBAAuB,CAAC;AAE5B,MAAM,MAAM,eAAe,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAE9C,MAAM,WAAW,mBAAmB;IAClC,oGAAoG;IACpG,iBAAiB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;IACxD,oGAAoG;IACpG,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,oFAAoF;IACpF,KAAK,EAAE,cAAc,CAAC;IACtB,yEAAyE;IACzE,iBAAiB,EAAE,CAAC,YAAY,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAChE;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9C;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACjE;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,eAAe,CAsDpG"}
|
|
@@ -50,14 +50,21 @@ export function acceptMirrorEnvelope(payload, options) {
|
|
|
50
50
|
}
|
|
51
51
|
for (const reg of authorized)
|
|
52
52
|
options.applyRegistration(reg);
|
|
53
|
+
const owned = new Set(authorized.map((r) => r.instance ?? r.id));
|
|
53
54
|
// P2 presence — only sessions whose instance the verified key owns.
|
|
54
55
|
if (options.applyPresence && Array.isArray(body.presence)) {
|
|
55
|
-
const owned = new Set(authorized.map((r) => r.instance ?? r.id));
|
|
56
56
|
for (const session of body.presence) {
|
|
57
57
|
if (owned.has(session.instance))
|
|
58
58
|
options.applyPresence(session);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
// P3 subagents — only bindings whose parent the verified key owns.
|
|
62
|
+
if (options.applySubagent && Array.isArray(body.subagents)) {
|
|
63
|
+
for (const binding of body.subagents) {
|
|
64
|
+
if (owned.has(binding.parentInstance))
|
|
65
|
+
options.applySubagent(binding);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
61
68
|
return { ok: true, applied: authorized.map((r) => r.instance ?? r.id), signer };
|
|
62
69
|
}
|
|
63
70
|
//# sourceMappingURL=accept.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accept.js","sourceRoot":"","sources":["../../../src/runtime/mirror/accept.ts"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ority anchor).
|
|
10
10
|
*/
|
|
11
|
-
import { type H2AActorRegistration, type H2AEnvelope, type H2ASession } from "@sentropic/h2a";
|
|
11
|
+
import { type H2AActorRegistration, type H2AEnvelope, type H2ASession, type H2ASubagentBinding } from "@sentropic/h2a";
|
|
12
12
|
import { type LocalStore } from "../local-files/index.js";
|
|
13
13
|
export declare const H2A_MIRROR_BODY_KIND: "mirror.instances";
|
|
14
14
|
export interface H2AInstanceMirrorBody {
|
|
@@ -27,6 +27,12 @@ export interface H2AInstanceMirrorBody {
|
|
|
27
27
|
* (fencing), so a replayed older beat cannot resurrect stale presence.
|
|
28
28
|
*/
|
|
29
29
|
readonly seq?: number;
|
|
30
|
+
/**
|
|
31
|
+
* P3: the sender's subagent bindings (NHI inventory). Append-only on the
|
|
32
|
+
* remote (idempotent — re-mirroring a known binding is a no-op). Only bindings
|
|
33
|
+
* whose `parentInstance` the verified key owns are applied. Omitted in P1/P2.
|
|
34
|
+
*/
|
|
35
|
+
readonly subagents?: H2ASubagentBinding[];
|
|
30
36
|
}
|
|
31
37
|
/**
|
|
32
38
|
* Build the unsigned mirror envelope for `instance` from the local store.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/runtime/mirror/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/runtime/mirror/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAExE,eAAO,MAAM,oBAAoB,EAAG,kBAA2B,CAAC;AAEhE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,oBAAoB,CAAC;IAC3C,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,EAAE,oBAAoB,EAAE,CAAC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC3C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,WAAW,CAAC,qBAAqB,CAAC,CAiBpC"}
|
|
@@ -22,6 +22,7 @@ export function buildInstanceMirror(store, instance, nowMs) {
|
|
|
22
22
|
if (!reg)
|
|
23
23
|
throw new Error(`mirror: unknown local instance ${instance}`);
|
|
24
24
|
const presence = listPresence(store.paths.root, { now: nowMs }).filter((s) => s.instance === instance);
|
|
25
|
+
const subagents = store.listSubagentsOf(instance);
|
|
25
26
|
return {
|
|
26
27
|
protocol: H2A_PROTOCOL,
|
|
27
28
|
version: H2A_VERSION,
|
|
@@ -29,7 +30,7 @@ export function buildInstanceMirror(store, instance, nowMs) {
|
|
|
29
30
|
type: "event",
|
|
30
31
|
actor: { instance, role: reg.roles?.[0] ?? "AGENTS", scope: "scope:default" },
|
|
31
32
|
target: { instance },
|
|
32
|
-
body: { kind: H2A_MIRROR_BODY_KIND, registrations: [reg], presence, seq: nowMs },
|
|
33
|
+
body: { kind: H2A_MIRROR_BODY_KIND, registrations: [reg], presence, seq: nowMs, subagents },
|
|
33
34
|
createdAt: new Date(nowMs).toISOString()
|
|
34
35
|
};
|
|
35
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/runtime/mirror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CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE;QAC3F,SAAS,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE;KACzC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/runtime/mirror/serve.ts"],"names":[],"mappings":"AAUA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAGtD,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAgD,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACxG,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA+B5E,MAAM,WAAW,2BAA2B;IAC1C,kFAAkF;IAClF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,8DAA8D;AAC9D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAmBxE;AAED,8DAA8D;AAC9D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,GAAE,2BAAgC,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/runtime/mirror/serve.ts"],"names":[],"mappings":"AAUA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAGtD,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,OAAO,EAAgD,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACxG,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA+B5E,MAAM,WAAW,2BAA2B;IAC1C,kFAAkF;IAClF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,8DAA8D;AAC9D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAmBxE;AAED,8DAA8D;AAC9D,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,GAAE,2BAAgC,GAAG,MAAM,CAoEzG"}
|
|
@@ -118,6 +118,17 @@ export function mirrorServerForStore(store, options = {}) {
|
|
|
118
118
|
// Re-stamp heartbeatAt with the REMOTE clock → freshness derives from the
|
|
119
119
|
// beat (no local-clock skew, no immortal ghost when the agent dies).
|
|
120
120
|
applyPresence: (session) => writePresence(root, { ...session, heartbeatAt: new Date(stampMs).toISOString(), state: "live" }),
|
|
121
|
+
// Idempotent: registerSubagent throws on a known id — re-mirroring a beat
|
|
122
|
+
// re-sends the same bindings, so treat "already registered" as a no-op.
|
|
123
|
+
applySubagent: (binding) => {
|
|
124
|
+
try {
|
|
125
|
+
store.registerSubagent(binding);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
if (!/already registered/i.test(error.message))
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
},
|
|
121
132
|
fenceSequence,
|
|
122
133
|
now: stampMs
|
|
123
134
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/runtime/mirror/serve.ts"],"names":[],"mappings":"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AE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;gBAClG,0EAA0E;gBAC1E,wEAAwE;gBACxE,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE;oBACzB,IAAI,CAAC;wBACH,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;oBAClC,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAE,KAAe,CAAC,OAAO,CAAC;4BAAE,MAAM,KAAK,CAAC;oBACzE,CAAC;gBACH,CAAC;gBACD,aAAa;gBACb,GAAG,EAAE,OAAO;aACb,CAAC,CAAC;YACH,IAAI,MAAM,CAAC,EAAE;gBAAE,OAAO,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;YACjG,OAAO,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7F,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentropic/h2a-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.1",
|
|
4
4
|
"description": "Unified CLI surface for h2a hosts and MCP-oriented coordination flows.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@hono/mcp": "^0.3.0",
|
|
44
44
|
"@hono/node-server": "^2.0.4",
|
|
45
45
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
46
|
-
"@sentropic/h2a": "^0.
|
|
46
|
+
"@sentropic/h2a": "^0.29.1",
|
|
47
47
|
"hono": "^4.12.23"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
package/skills/h2a/SKILL.md
CHANGED
|
@@ -35,8 +35,8 @@ Steps:
|
|
|
35
35
|
1. Verify the `h2a` binary is on PATH (`h2a --help`). If absent, instruct the user to run `npm i -g @sentropic/h2a-cli@latest` and stop.
|
|
36
36
|
2. Decide the shared root. If `[root]` was passed, use it; otherwise prefer `<this-workspace>/.h2a`, else `~/h2a-workspace/.h2a`. Confirm with the user only if ambiguous.
|
|
37
37
|
3. Run `h2a init --root <root>` (idempotent).
|
|
38
|
-
4.
|
|
39
|
-
5. Call the MCP tool `h2a_session_open` with `{ instance, host, interests: { scopes: ["scope:default"], negotiations: [] } }
|
|
38
|
+
4. **Resolve YOUR perennial identity — do NOT invent it.** Run `h2a connect --host <h> --root <root>`; it returns the perennial instance id `host:slug(label):uuid12` (DEC-114/116), bound per `(host, workspace)` and reclaimed on reconnect — the same workspace always gets the same id (never mint `host:workspace-leaf` by hand; that bare `host:label` form is the *channel* alias, see "Identity & addressing"). Use the returned `instance`.
|
|
39
|
+
5. Call the MCP tool `h2a_session_open` with `{ instance, host, interests: { scopes: ["scope:default"], negotiations: [] } }` (instance = the resolved perennial id from step 4).
|
|
40
40
|
6. Print a short summary: instance id, session id, peers currently live, the four notification topics this session is subscribed to.
|
|
41
41
|
|
|
42
42
|
End with the cue: *"Connected. Try `/h2a discover` to see who else is around, or `/h2a send <peer> \"hi\"` to message someone."*
|
|
@@ -70,7 +70,10 @@ Compose and route an envelope to a named peer.
|
|
|
70
70
|
|
|
71
71
|
Steps:
|
|
72
72
|
|
|
73
|
-
1.
|
|
73
|
+
1. **Resolve the target + check liveness FIRST (`h2a_discover_sessions`).** Pick the addressing form (see "Identity & addressing"):
|
|
74
|
+
- target is a **specific live agent** → use its **full perennial id** `host:slug:uuid12` from discover (NOT the bare `host:label`, which is ambiguous when several agents share a workspace);
|
|
75
|
+
- target is a **role/channel or a known-dormant peer** → use the **channel** form `host:label`.
|
|
76
|
+
- If `<peer>` is missing, list discover and ask the user to pick.
|
|
74
77
|
2. If `"<text>"` is missing, prompt the user for the content.
|
|
75
78
|
3. Compose an `H2AEnvelope` JSON:
|
|
76
79
|
```json
|
|
@@ -89,7 +92,9 @@ Steps:
|
|
|
89
92
|
}
|
|
90
93
|
```
|
|
91
94
|
4. Call `h2a_inbox` with `{ action: "put", instance: "<peer>", envelope }`.
|
|
92
|
-
5.
|
|
95
|
+
5. **Report honestly per the target's liveness** (h2a writes the inbox unconditionally — it does NOT yet error on a dead target, so YOU must say which it was):
|
|
96
|
+
- target was **live** in discover → *"Delivered to `<peer>` (live) — push fires if subscribed."*
|
|
97
|
+
- target was **NOT live** → *"`<peer>` is dormant — envelope deposited for its wake (no live session; it will only see this once woken)."* Never claim "Delivered" to a dormant/unknown peer.
|
|
93
98
|
|
|
94
99
|
For richer payloads (file pointer, deliverable, status update), set `body.kind` to a category and add the relevant fields; ask the user if ambiguous.
|
|
95
100
|
|
|
@@ -158,12 +163,36 @@ Print the command map at the top of this file. Concise, no extra prose.
|
|
|
158
163
|
|
|
159
164
|
---
|
|
160
165
|
|
|
166
|
+
## Identity & addressing (DEC-114/116 — read before sending)
|
|
167
|
+
|
|
168
|
+
There are **two addressable forms**; pick deliberately:
|
|
169
|
+
|
|
170
|
+
- **Agent (perennial, specific):** `host:slug(label):uuid12` — e.g.
|
|
171
|
+
`claude:sentropic:cbf32fe0800b`. This is YOUR identity (resolved by `h2a
|
|
172
|
+
connect`, reclaimed per `(host, workspace)`) and how you address **one specific
|
|
173
|
+
live agent**. Get a peer's full id from `/h2a discover` — never guess the uuid.
|
|
174
|
+
- **Channel (role / alias):** `host:label` — e.g. `claude:sentropic-scale`. The
|
|
175
|
+
bare `host:label` form is a **named mailbox/alias**, not a specific agent; use
|
|
176
|
+
it for a role, a known-dormant peer you want to leave a message for, or a wake
|
|
177
|
+
drop. A perennial agent also reads its own `host:label` alias inbox (dedup), so
|
|
178
|
+
channel messages reach whichever agent adopts that label.
|
|
179
|
+
|
|
180
|
+
Consequences to respect:
|
|
181
|
+
- **One perennial id per `(host, workspace)`** — several *concurrent sessions* of
|
|
182
|
+
the same agent share that id and its inbox (they are distinguishable in
|
|
183
|
+
`/h2a discover` by `sessionId`, but inbox delivery is per-agent, not
|
|
184
|
+
per-session). To reach "whoever is working in project X", address the agent id;
|
|
185
|
+
there is no per-session inbox today.
|
|
186
|
+
- **Liveness is not enforced on send** — `h2a_inbox put` writes even to a dead
|
|
187
|
+
target. Always `/h2a discover` first and report truthfully (see `/h2a send`):
|
|
188
|
+
*delivered (live)* vs *deposited for wake (dormant)*.
|
|
189
|
+
|
|
161
190
|
## Defaults and conventions
|
|
162
191
|
|
|
163
192
|
- **Auto-connect (recommended)**: register the MCP server with `mcp-serve --auto-open --host <h>` so a session opens at host startup (EVO-6/DEC-105); `/h2a disconnect` leaves early. `/h2a connect` stays available for manual/explicit connect.
|
|
164
193
|
|
|
165
194
|
- **Shared root**: same `<root>/.h2a/` for every cooperating CLI. If the user has not declared one, look for `<cwd>/.h2a/`, then `~/h2a-workspace/.h2a`, ask if neither exists.
|
|
166
|
-
- **Instance id**:
|
|
195
|
+
- **Instance id**: the **perennial** `host:slug(label):uuid12` resolved by `h2a connect` (reclaimed per `(host, workspace)`) — do NOT hand-mint `host:workspace-leaf`; that bare form is the channel alias.
|
|
167
196
|
- **Subscriptions**: when opening a session, subscribe to all four canonical notification topics (`presence.peer_joined`, `presence.peer_left`, `inbox.envelope_arrived`, `negotiation.event_appended`) unless the user narrows the scope.
|
|
168
197
|
- **JSON-RPC notifications**: `notifications/h2a` messages arrive on stdout interleaved with tool responses. They have no `id` field and use `method: "notifications/h2a"`. React to them in real time rather than polling.
|
|
169
198
|
|