@sjawhar/opencode-legion-envoy 1.46.1 → 1.47.0

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.
@@ -13552,6 +13552,13 @@ function date4(params) {
13552
13552
  // ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/external.js
13553
13553
  config(en_default());
13554
13554
  // ../contracts/src/dispatch-api.ts
13555
+ function serviceSubjectLabel(subject) {
13556
+ const parts = subject.split(":");
13557
+ if (parts.length === 4 && parts[0] === "system" && parts[1] === "serviceaccount" && parts[2] !== "" && parts[3] !== "") {
13558
+ return `${parts[2]}/${parts[3]}`;
13559
+ }
13560
+ return subject;
13561
+ }
13555
13562
  var ASK_TURNS = ["human", "agent"];
13556
13563
  var DELIVERY_CAPABILITIES = ["aside", "btw", "steer"];
13557
13564
  var DispatchEventSchema = object({
@@ -16145,9 +16152,16 @@ function eventHead(event) {
16145
16152
  return;
16146
16153
  }
16147
16154
  }
16155
+ function actorText(actor) {
16156
+ const service = actor.kind === "session" ? actor.service : undefined;
16157
+ if (service === undefined) {
16158
+ return `${actor.kind} ${actor.id}`;
16159
+ }
16160
+ return `${actor.kind} ${actor.id} (as ${serviceSubjectLabel(service)})`;
16161
+ }
16148
16162
  function eventLine(event) {
16149
16163
  const head = eventHead(event);
16150
- return `- #${event.seq} ${event.type} \xB7 ${event.actor.kind} ${event.actor.id} \xB7 ${event.created_at}${head === undefined || head === "" ? "" : ` \xB7 ${head}`}`;
16164
+ return `- #${event.seq} ${event.type} \xB7 ${actorText(event.actor)} \xB7 ${event.created_at}${head === undefined || head === "" ? "" : ` \xB7 ${head}`}`;
16151
16165
  }
16152
16166
  function childrenSummary(issue) {
16153
16167
  return [
@@ -16160,7 +16174,7 @@ function childrenSummary(issue) {
16160
16174
  function askSummary({ ask, replies }, graph) {
16161
16175
  const answer = ask.answer;
16162
16176
  const chain = replies.flatMap((reply) => [
16163
- `${reply.id} \xB7 ${reply.author.kind} ${reply.author.id}`,
16177
+ `${reply.id} \xB7 ${actorText(reply.author)}`,
16164
16178
  `Body: ${reply.body}`
16165
16179
  ]);
16166
16180
  return [
@@ -16227,12 +16241,12 @@ function formatOpenAsksSummary(response, baseUrl) {
16227
16241
  }
16228
16242
  function commentSummary({ comment, replies }, graph) {
16229
16243
  const root = [
16230
- `${comment.id} \xB7 ${comment.author.kind} ${comment.author.id}`,
16244
+ `${comment.id} \xB7 ${actorText(comment.author)}`,
16231
16245
  ...comment.anchor?.quote === undefined ? [] : [`> ${comment.anchor.quote}`],
16232
16246
  `Body: ${comment.body}`
16233
16247
  ];
16234
16248
  const chain = replies.flatMap((reply) => [
16235
- `${reply.id} \xB7 ${reply.author.kind} ${reply.author.id}`,
16249
+ `${reply.id} \xB7 ${actorText(reply.author)}`,
16236
16250
  ...reply.anchor?.quote === undefined ? [] : [`> ${reply.anchor.quote}`],
16237
16251
  `Body: ${reply.body}`
16238
16252
  ]);
@@ -16246,12 +16260,9 @@ function commentSummary({ comment, replies }, graph) {
16246
16260
  `);
16247
16261
  }
16248
16262
  function messageSummary({ message, replies }, graph) {
16249
- const root = [
16250
- `${message.id} \xB7 ${message.author.kind} ${message.author.id}`,
16251
- `Body: ${message.body}`
16252
- ];
16263
+ const root = [`${message.id} \xB7 ${actorText(message.author)}`, `Body: ${message.body}`];
16253
16264
  const chain = replies.flatMap((reply) => [
16254
- `${reply.id} \xB7 ${reply.author.kind} ${reply.author.id}`,
16265
+ `${reply.id} \xB7 ${actorText(reply.author)}`,
16255
16266
  `Body: ${reply.body}`
16256
16267
  ]);
16257
16268
  return [
@@ -16333,9 +16344,11 @@ async function executeDispatchTool(input) {
16333
16344
  const client = dispatchClient();
16334
16345
  const identity = await client.whoami();
16335
16346
  const owner = identity.kind === "agent" ? identity.owner : identity.login.toLowerCase();
16347
+ const service = identity.kind === "agent" ? identity.service ?? null : null;
16348
+ const unowned = "no owner, so issues you create without an assignee are unassigned (or inherit their parent's).";
16336
16349
  return {
16337
- text: owner === null ? `Session ${sessionId} runs under the shared token: no owner, so issues you create without an assignee are unassigned (or inherit their parent's).` : `Session ${sessionId} acts for ${owner}: issues you create without an assignee are assigned to ${owner}.`,
16338
- details: { session: sessionId, owner }
16350
+ text: owner !== null ? `Session ${sessionId} acts for ${owner}: issues you create without an assignee are assigned to ${owner}.` : service !== null ? `Session ${sessionId} runs as service ${serviceSubjectLabel(service)}: ${unowned}` : `Session ${sessionId} runs under the shared token: ${unowned}`,
16351
+ details: { session: sessionId, owner, service }
16339
16352
  };
16340
16353
  }
16341
16354
  const args = parsed.success ? parsed.data : ownerArguments.args;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/opencode-legion-envoy",
3
- "version": "1.46.1",
3
+ "version": "1.47.0",
4
4
  "type": "module",
5
5
  "main": "dist/src/server.js",
6
6
  "exports": {
@@ -148,7 +148,7 @@ An ask goes to the issue's assignee: their Inbox opens on **Mine**, which lists
148
148
  ```ts
149
149
  dispatch_whoami({})
150
150
  ```
151
- It returns `details` `{ session, owner }`: `owner` is the lowercase login of the human whose personal token you run under, or `null` under the shared token. An issue you create without `assignee` goes to your owner; under the shared token it inherits its parent's assignee, or stays unassigned without a parent. If an issue you are asking on is unassigned and the answer matters, assign it to your owner (`PATCH /api/v1/issues/{key}` with `{"assignee": "<login>"}`; any authenticated caller may reassign, and an unlisted login is refused with `ASSIGNEE_NOT_ALLOWED`) or name in the question who should answer it. Never reassign an issue a human holds to get an answer faster: that is the human's call.
151
+ It returns `details` `{ session, owner, service }`: `owner` is the lowercase login of the human whose personal token you run under, or `null` under the shared token or a verified service token, in which case `service` is that token's subject (`system:serviceaccount:<namespace>:<name>`, `null` otherwise) and every write you make is rendered `(as <namespace>/<name>)` — the namespace is kept because every namespace has a `default` service account, and a subject that is not a Kubernetes one is shown whole. An issue you create without `assignee` goes to your owner; with no owner it inherits its parent's assignee, or stays unassigned without a parent. If an issue you are asking on is unassigned and the answer matters, assign it to your owner (`PATCH /api/v1/issues/{key}` with `{"assignee": "<login>"}`; any authenticated caller may reassign, and an unlisted login is refused with `ASSIGNEE_NOT_ALLOWED`) or name in the question who should answer it. Never reassign an issue a human holds to get an answer faster: that is the human's call.
152
152
 
153
153
  Architects create newly tracked child work with:
154
154
  ```ts