@sjawhar/opencode-legion-envoy 3.2.1 → 3.2.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.
@@ -17267,7 +17267,7 @@ var envoyToolSpecs = [
17267
17267
  },
17268
17268
  {
17269
17269
  name: "envoy_whoami",
17270
- description: "Returns this session's Envoy identity: session ID, machine ID, port, and directory.",
17270
+ description: "Returns this session's Envoy identity: session ID, machine ID, port, and directory. session_id is the address a reply reaches. Where a host runs a task subagent inside its parent's process, such a subagent registers no Envoy session of its own, so its session_id is the parent session that spawned it and the result says so.",
17271
17271
  arguments: () => ({}),
17272
17272
  operation: EnvoyToolOperation.whoami,
17273
17273
  requiresSubscriptionCapability: false
@@ -17435,7 +17435,7 @@ function createEnvoyClient(config2) {
17435
17435
  const idempotencyKey = input.idempotencyKey ?? crypto.randomUUID();
17436
17436
  const response = EnvelopeResponseSchema.parse(JSON.parse(await post("/v1/messages/send", {
17437
17437
  source: input.source ?? "agent",
17438
- ...input.sourceSessionID === undefined ? {} : { source_session: input.sourceSessionID },
17438
+ ...sourceSession(input.sourceSessionID),
17439
17439
  target_session: input.targetSessionID,
17440
17440
  message: input.message,
17441
17441
  idempotency_key: idempotencyKey,
@@ -17451,7 +17451,7 @@ function createEnvoyClient(config2) {
17451
17451
  const idempotencyKey = input.idempotencyKey ?? crypto.randomUUID();
17452
17452
  const response = EnvelopeResponseSchema.parse(JSON.parse(await post("/v1/messages/publish", {
17453
17453
  source: input.source ?? "agent",
17454
- ...input.sourceSessionID === undefined ? {} : { source_session: input.sourceSessionID },
17454
+ ...sourceSession(input.sourceSessionID),
17455
17455
  topic: input.topic,
17456
17456
  message: input.message,
17457
17457
  ...input.payload === undefined ? {} : { payload: input.payload },
@@ -17514,6 +17514,9 @@ function messageMetadata(input) {
17514
17514
  ...input.expiresAt === undefined ? {} : { expires_at: input.expiresAt }
17515
17515
  };
17516
17516
  }
17517
+ function sourceSession(sessionID) {
17518
+ return sessionID === undefined || sessionID === "" ? {} : { source_session: sessionID };
17519
+ }
17517
17520
 
17518
17521
  // src/server.ts
17519
17522
  import { tool } from "@opencode-ai/plugin/tool";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/opencode-legion-envoy",
3
- "version": "3.2.1",
3
+ "version": "3.2.2",
4
4
  "type": "module",
5
5
  "main": "dist/src/server.js",
6
6
  "exports": {
@@ -106,6 +106,25 @@ envoy_send(
106
106
  )
107
107
  ```
108
108
 
109
+ ### Your own address, and a subagent's
110
+
111
+ `envoy_whoami`'s `session_id` is the address a reply to you reaches. Inside a `task` subagent it
112
+ is the session that spawned you: a subagent registers no Envoy session of its own, so a peer
113
+ answering it reaches that session, which relays to you over hub. The `subagent` field in that
114
+ output carries your own host session id — it is not an address, so never hand it to a peer.
115
+
116
+ `session_id` is empty when nothing can be reached: a process that took no Envoy identity, or a
117
+ subagent whose spawning session this process can no longer place (it forked away, and other
118
+ top-level sessions are running). Then your messages carry no sender either, so say who you are
119
+ in the message body. An empty address is deliberate — being handed an unrelated live session
120
+ would send your peers to an agent that never spawned you.
121
+
122
+ Your own `envoy_publish` never reaches the agent that spawned you. The listener delivers nothing
123
+ to the session a message names as its source, and inside a subagent that source is your parent,
124
+ so a publish to a role it holds — or to any topic it subscribes to — is accepted and delivered to
125
+ nobody. Use hub for that one hop. `envoy_send` to any other session, including a reply, is
126
+ unaffected.
127
+
109
128
  ### Delivery capabilities
110
129
 
111
130
  Each session row from `envoy_sessions` carries `capabilities`, the targeted-delivery modes that