@sjawhar/opencode-legion-envoy 0.1.4 → 0.1.6

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/index.js CHANGED
@@ -12587,9 +12587,9 @@ var src_default = async (input) => {
12587
12587
  }
12588
12588
  }),
12589
12589
  envoy_publish: tool({
12590
- description: "Publish an Envoy message to any topic. Use for broadcast to named topics like notifications.legion.controller, team channels, or custom routing. Subscribers matching the topic will receive the message. This is for BROADCAST, not session-targeted delivery (use envoy_send for that).",
12590
+ description: "Publish an Envoy message to any topic. Use for broadcast to named topics like notifications.role.legion-controller, team channels, or custom routing. Subscribers matching the topic will receive the message. This is for BROADCAST, not session-targeted delivery (use envoy_send for that).",
12591
12591
  args: {
12592
- topic: tool.schema.string().describe("NATS-style topic to publish to, e.g. notifications.legion.controller"),
12592
+ topic: tool.schema.string().describe("NATS-style topic to publish to, e.g. notifications.role.legion-controller"),
12593
12593
  message: tool.schema.string().describe("Message body to broadcast")
12594
12594
  },
12595
12595
  async execute(args, ctx) {
@@ -12604,6 +12604,23 @@ var src_default = async (input) => {
12604
12604
  })
12605
12605
  });
12606
12606
  }
12607
+ }),
12608
+ envoy_role_set: tool({
12609
+ description: "Set the current session as the holder of a named role. Messages published to notifications.role.<role> will route to this session. Only one session holds a role at a time \u2014 claiming it removes it from the previous holder.",
12610
+ args: {
12611
+ role: tool.schema.string().describe("Role name to claim (lowercase alphanumeric, hyphens, underscores). E.g. opencode-dev, legion-controller, legion-po")
12612
+ },
12613
+ async execute(args, ctx) {
12614
+ ctx.metadata({ title: "Set Envoy role" });
12615
+ return call("/v1/roles/set", {
12616
+ method: "POST",
12617
+ headers: { "Content-Type": "application/json" },
12618
+ body: JSON.stringify({
12619
+ session_id: ctx.sessionID,
12620
+ role: args.role
12621
+ })
12622
+ });
12623
+ }
12607
12624
  })
12608
12625
  }
12609
12626
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/opencode-legion-envoy",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -256,11 +256,11 @@ export default async (input: { serverUrl: URL }) => {
256
256
  }),
257
257
  envoy_publish: tool({
258
258
  description:
259
- "Publish an Envoy message to any topic. Use for broadcast to named topics like notifications.legion.controller, team channels, or custom routing. Subscribers matching the topic will receive the message. This is for BROADCAST, not session-targeted delivery (use envoy_send for that).",
259
+ "Publish an Envoy message to any topic. Use for broadcast to named topics like notifications.role.legion-controller, team channels, or custom routing. Subscribers matching the topic will receive the message. This is for BROADCAST, not session-targeted delivery (use envoy_send for that).",
260
260
  args: {
261
261
  topic: tool.schema
262
262
  .string()
263
- .describe("NATS-style topic to publish to, e.g. notifications.legion.controller"),
263
+ .describe("NATS-style topic to publish to, e.g. notifications.role.legion-controller"),
264
264
  message: tool.schema.string().describe("Message body to broadcast"),
265
265
  },
266
266
  async execute(args, ctx) {
@@ -276,6 +276,28 @@ export default async (input: { serverUrl: URL }) => {
276
276
  });
277
277
  },
278
278
  }),
279
+ envoy_role_set: tool({
280
+ description:
281
+ "Set the current session as the holder of a named role. Messages published to notifications.role.<role> will route to this session. Only one session holds a role at a time — claiming it removes it from the previous holder.",
282
+ args: {
283
+ role: tool.schema
284
+ .string()
285
+ .describe(
286
+ "Role name to claim (lowercase alphanumeric, hyphens, underscores). E.g. opencode-dev, legion-controller, legion-po"
287
+ ),
288
+ },
289
+ async execute(args, ctx) {
290
+ ctx.metadata({ title: "Set Envoy role" });
291
+ return call("/v1/roles/set", {
292
+ method: "POST",
293
+ headers: { "Content-Type": "application/json" },
294
+ body: JSON.stringify({
295
+ session_id: ctx.sessionID,
296
+ role: args.role,
297
+ }),
298
+ });
299
+ },
300
+ }),
279
301
  },
280
302
  };
281
303
  };