@sjawhar/pi-legion-envoy 1.57.1 → 1.58.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.
- package/dist/envoy.js +24 -11
- package/dist/legion.js +8 -1
- package/dist/skills/dispatch/SKILL.md +1 -1
- package/package.json +1 -1
package/dist/envoy.js
CHANGED
|
@@ -29649,6 +29649,13 @@ function date4(params) {
|
|
|
29649
29649
|
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
29650
29650
|
config(en_default());
|
|
29651
29651
|
// ../contracts/src/dispatch-api.ts
|
|
29652
|
+
function serviceSubjectLabel(subject) {
|
|
29653
|
+
const parts = subject.split(":");
|
|
29654
|
+
if (parts.length === 4 && parts[0] === "system" && parts[1] === "serviceaccount" && parts[2] !== "" && parts[3] !== "") {
|
|
29655
|
+
return `${parts[2]}/${parts[3]}`;
|
|
29656
|
+
}
|
|
29657
|
+
return subject;
|
|
29658
|
+
}
|
|
29652
29659
|
var ASK_TURNS = ["human", "agent"];
|
|
29653
29660
|
var DELIVERY_CAPABILITIES = ["aside", "btw", "steer"];
|
|
29654
29661
|
var DispatchEventSchema = object({
|
|
@@ -33320,9 +33327,16 @@ function eventHead(event) {
|
|
|
33320
33327
|
return;
|
|
33321
33328
|
}
|
|
33322
33329
|
}
|
|
33330
|
+
function actorText(actor) {
|
|
33331
|
+
const service = actor.kind === "session" ? actor.service : undefined;
|
|
33332
|
+
if (service === undefined) {
|
|
33333
|
+
return `${actor.kind} ${actor.id}`;
|
|
33334
|
+
}
|
|
33335
|
+
return `${actor.kind} ${actor.id} (as ${serviceSubjectLabel(service)})`;
|
|
33336
|
+
}
|
|
33323
33337
|
function eventLine(event) {
|
|
33324
33338
|
const head = eventHead(event);
|
|
33325
|
-
return `- #${event.seq} ${event.type} \xB7 ${event.actor
|
|
33339
|
+
return `- #${event.seq} ${event.type} \xB7 ${actorText(event.actor)} \xB7 ${event.created_at}${head === undefined || head === "" ? "" : ` \xB7 ${head}`}`;
|
|
33326
33340
|
}
|
|
33327
33341
|
function childrenSummary(issue) {
|
|
33328
33342
|
return [
|
|
@@ -33335,7 +33349,7 @@ function childrenSummary(issue) {
|
|
|
33335
33349
|
function askSummary({ ask, replies }, graph) {
|
|
33336
33350
|
const answer = ask.answer;
|
|
33337
33351
|
const chain = replies.flatMap((reply) => [
|
|
33338
|
-
`${reply.id} \xB7 ${reply.author
|
|
33352
|
+
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
33339
33353
|
`Body: ${reply.body}`
|
|
33340
33354
|
]);
|
|
33341
33355
|
return [
|
|
@@ -33402,12 +33416,12 @@ function formatOpenAsksSummary(response, baseUrl) {
|
|
|
33402
33416
|
}
|
|
33403
33417
|
function commentSummary({ comment, replies }, graph) {
|
|
33404
33418
|
const root = [
|
|
33405
|
-
`${comment.id} \xB7 ${comment.author
|
|
33419
|
+
`${comment.id} \xB7 ${actorText(comment.author)}`,
|
|
33406
33420
|
...comment.anchor?.quote === undefined ? [] : [`> ${comment.anchor.quote}`],
|
|
33407
33421
|
`Body: ${comment.body}`
|
|
33408
33422
|
];
|
|
33409
33423
|
const chain = replies.flatMap((reply) => [
|
|
33410
|
-
`${reply.id} \xB7 ${reply.author
|
|
33424
|
+
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
33411
33425
|
...reply.anchor?.quote === undefined ? [] : [`> ${reply.anchor.quote}`],
|
|
33412
33426
|
`Body: ${reply.body}`
|
|
33413
33427
|
]);
|
|
@@ -33421,12 +33435,9 @@ function commentSummary({ comment, replies }, graph) {
|
|
|
33421
33435
|
`);
|
|
33422
33436
|
}
|
|
33423
33437
|
function messageSummary({ message, replies }, graph) {
|
|
33424
|
-
const root = [
|
|
33425
|
-
`${message.id} \xB7 ${message.author.kind} ${message.author.id}`,
|
|
33426
|
-
`Body: ${message.body}`
|
|
33427
|
-
];
|
|
33438
|
+
const root = [`${message.id} \xB7 ${actorText(message.author)}`, `Body: ${message.body}`];
|
|
33428
33439
|
const chain = replies.flatMap((reply) => [
|
|
33429
|
-
`${reply.id} \xB7 ${reply.author
|
|
33440
|
+
`${reply.id} \xB7 ${actorText(reply.author)}`,
|
|
33430
33441
|
`Body: ${reply.body}`
|
|
33431
33442
|
]);
|
|
33432
33443
|
return [
|
|
@@ -33508,9 +33519,11 @@ async function executeDispatchTool(input) {
|
|
|
33508
33519
|
const client = dispatchClient();
|
|
33509
33520
|
const identity = await client.whoami();
|
|
33510
33521
|
const owner = identity.kind === "agent" ? identity.owner : identity.login.toLowerCase();
|
|
33522
|
+
const service = identity.kind === "agent" ? identity.service ?? null : null;
|
|
33523
|
+
const unowned = "no owner, so issues you create without an assignee are unassigned (or inherit their parent's).";
|
|
33511
33524
|
return {
|
|
33512
|
-
text: owner
|
|
33513
|
-
details: { session: sessionId, owner }
|
|
33525
|
+
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}`,
|
|
33526
|
+
details: { session: sessionId, owner, service }
|
|
33514
33527
|
};
|
|
33515
33528
|
}
|
|
33516
33529
|
const args = parsed.success ? parsed.data : ownerArguments.args;
|
package/dist/legion.js
CHANGED
|
@@ -16145,7 +16145,7 @@ import { logger } from "@oh-my-pi/pi-utils";
|
|
|
16145
16145
|
// package.json
|
|
16146
16146
|
var package_default = {
|
|
16147
16147
|
name: "@sjawhar/pi-legion-envoy",
|
|
16148
|
-
version: "1.
|
|
16148
|
+
version: "1.58.0",
|
|
16149
16149
|
type: "module",
|
|
16150
16150
|
omp: {
|
|
16151
16151
|
extensions: [
|
|
@@ -28968,6 +28968,13 @@ function preprocess(fn, schema) {
|
|
|
28968
28968
|
return pipe(transform(fn), schema);
|
|
28969
28969
|
}
|
|
28970
28970
|
// ../contracts/src/dispatch-api.ts
|
|
28971
|
+
function serviceSubjectLabel(subject) {
|
|
28972
|
+
const parts = subject.split(":");
|
|
28973
|
+
if (parts.length === 4 && parts[0] === "system" && parts[1] === "serviceaccount" && parts[2] !== "" && parts[3] !== "") {
|
|
28974
|
+
return `${parts[2]}/${parts[3]}`;
|
|
28975
|
+
}
|
|
28976
|
+
return subject;
|
|
28977
|
+
}
|
|
28971
28978
|
var ASK_TURNS = ["human", "agent"];
|
|
28972
28979
|
var DELIVERY_CAPABILITIES = ["aside", "btw", "steer"];
|
|
28973
28980
|
var DispatchEventSchema = object({
|
|
@@ -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;
|
|
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
|