@sjawhar/pi-legion 19.12.0 → 19.13.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/legion.js CHANGED
@@ -16813,7 +16813,6 @@ var ProjectSchema = strictObject({
16813
16813
  gated_steps: array(_enum2(GATED_STEPS)).optional(),
16814
16814
  created_at: string2()
16815
16815
  }).readonly();
16816
- var ProjectDefaultAssigneeSchema = strictObject({ project: string2(), assignee: string2().nullable() }).readonly();
16817
16816
  var RepoProjectSchema = strictObject({
16818
16817
  repo: string2(),
16819
16818
  project: string2(),
@@ -16835,6 +16834,11 @@ var ArchitectureSourceSchema = strictObject({
16835
16834
  components: number2().int()
16836
16835
  }).readonly();
16837
16836
  var RepoProjectUpdatedEventPayloadSchema = strictObject({ mapping: RepoProjectSchema, deleted: boolean2() }).readonly();
16837
+ var ProjectDefaultAssigneeUpdatedEventPayloadSchema = strictObject({
16838
+ project: string2(),
16839
+ assignee: string2().nullable(),
16840
+ thread_logins: array(string2()).optional()
16841
+ }).readonly();
16838
16842
  var ArchitectureSourceUpdatedEventPayloadSchema = strictObject({ source: ArchitectureSourceSchema, deleted: boolean2() }).readonly();
16839
16843
  var ArchitectureSyncedEventPayloadSchema = strictObject({
16840
16844
  repo: string2().optional(),
@@ -17052,7 +17056,7 @@ var OWNER_REFERENCE = "Exactly one of issue and project is required. An issue is
17052
17056
  var ASK_QUESTION_CONTRACT = "The question names the concrete case first: which machines, files, sessions or people, and the " + "numbers. It asks the choice in those terms, saying what happens to whom under each option " + '("Ship Friday and risk signing out 1,240 users, or hold to Monday?"), never "How should we ' + 'proceed?" or "Which option?", because a reader cannot work back from a general question to ' + "the case. It carries every fact the reader needs to decide and nothing " + "that does not change the decision. Generalize only after the specifics, if at all. Then give " + "your recommendation and its reason.";
17053
17057
  var ASK_OPTIONS_CONTRACT = "Options carry the genuinely different approaches. Each option has a label, and its description " + "says what that approach costs.";
17054
17058
  var ASK_IS_FOR_A_PERSON = "An ask is a question for a person, never a request to another agent. Ask an agent by envoy_send or a comment on the issue.";
17055
- var ASK_WAITS_ON_THE_ASSIGNEE = "An ask waits on the issue's assignee until a person hands it on. No agent can hand one on.";
17059
+ var ASK_WAITS_ON_THE_ASSIGNEE = "An ask waits on its asked-of person, else the issue's assignee, else the project's default assignee; no agent hands one on.";
17056
17060
  var HUMAN_AGREED_TO_DOCUMENT = "the human has agreed to every point in the document";
17057
17061
  function documentOwnerValidation(requireArtifact, alwaysRequireArtifact = false) {
17058
17062
  return {
@@ -17307,7 +17311,7 @@ var dispatchToolSpecs = [
17307
17311
  spec: z.string().describe(`Optional initial primary-document markdown. ${SPEC_WRITING_POINTER}`).optional(),
17308
17312
  labels: z.array(z.string({ min: 1, max: 40 }), { max: 20 }).describe("Optional initial labels, at most 20 labels of up to 40 characters.").optional(),
17309
17313
  priority: z.number({ int: true, min: 0, max: 3 }).describe("Optional coarse priority, a number from 0 to 3: 0 is highest and 3 is lowest.").optional(),
17310
- assignee: z.string().describe("Email of the person who answers this issue's asks (someone who has signed in to Dispatch); defaults to your owner when you act for a person, else the parent's assignee, else the project's default assignee when it still names a person who has signed in, else unassigned. Set it only when a person said who owns the issue.").optional(),
17314
+ assignee: z.string().describe("Email of the person who answers this issue's asks (someone who has signed in to Dispatch); defaults to your owner when you act for a person, else the parent's assignee, else the project's default assignee. Every project names a default assignee, so a new issue always has one. A question on it reaches the person it was handed to, else the issue's assignee, else the project's default assignee. Set it only when a person said who owns the issue.").optional(),
17311
17315
  components: componentsArgument(z).optional(),
17312
17316
  repo: z.string().describe("The repository the issue targets, owner/name, mapped to the issue's project in Settings; a child inherits its parent's when unset, and an issue with none on its parent chain takes the project's default.").optional()
17313
17317
  })
@@ -17319,7 +17323,7 @@ var dispatchToolSpecs = [
17319
17323
  priority: 1,
17320
17324
  before: "DSP-2"
17321
17325
  },
17322
- description: "Update an existing issue: move its lifecycle status, retitle it, replace its labels, set " + "its priority, set or clear its assignee, link a URL (the pull request that delivers it, a " + "run, a document), set its " + "route, set or clear its parent, replace the issues it is blocked by, attach it to " + "architecture components, set the repository it targets, or move it on its project's " + "board. Status is one of " + `${ISSUE_STATUSES.join(", ")}; outside Legion, move it yourself as the work advances; inside ` + "Legion the daemon moves it. A non-empty external_links is " + "merged into the issue's existing links by URL, so linking the pull request you just opened " + "keeps every earlier link; an empty external_links removes every link instead. components " + "replaces the issue's own attachment. Closing an issue " + "(status done) requires reason, the note that says why: it is posted on the issue as a " + "message, then the issue closes, so the close carries its note; closing an issue that is " + "already closed is refused (ISSUE_CLOSED) before anything is posted. Reason goes only " + "with status done. Closing an issue withdraws every open ask " + "it holds (resolution kind withdrawn, naming the closer), and reopening it brings exactly " + "those asks back. " + "A closed issue still takes messages and comments, though not asks or artifacts; of this " + "tool's fields it takes only a board move " + "(before, after), components, " + "a reopening status (any status but done), and an external_links write that adds no new " + "link (so a link can move to the issue that replaced it); everything else, priority " + "included, waits for the reopen. " + "priority is yours to set and a human overrides it. assignee is the person who answers " + "this issue's asks, and every ask on it waits on them until a person hands that ask on. " + "Passing null unassigns the issue. Set the assignee when a person said who owns the work, as you " + "file the issue or hand it over. before and after move the issue on " + "its project's board: before puts it above that issue, after below, and both together " + "land it between them. A project's board order is one agent's to keep; in a Legion " + "deployment that is the controller. Never reassign an issue a person holds to get a " + "faster answer: who holds it is their call. At least one " + `field besides issue is required. ${ISSUE_REFERENCE}`,
17326
+ description: "Update an existing issue: move its lifecycle status, retitle it, replace its labels, set " + "its priority, set or clear its assignee, link a URL (the pull request that delivers it, a " + "run, a document), set its " + "route, set or clear its parent, replace the issues it is blocked by, attach it to " + "architecture components, set the repository it targets, or move it on its project's " + "board. Status is one of " + `${ISSUE_STATUSES.join(", ")}; outside Legion, move it yourself as the work advances; inside ` + "Legion the daemon moves it. A non-empty external_links is " + "merged into the issue's existing links by URL, so linking the pull request you just opened " + "keeps every earlier link; an empty external_links removes every link instead. components " + "replaces the issue's own attachment. Closing an issue " + "(status done) requires reason, the note that says why: it is posted on the issue as a " + "message, then the issue closes, so the close carries its note; closing an issue that is " + "already closed is refused (ISSUE_CLOSED) before anything is posted. Reason goes only " + "with status done. Closing an issue withdraws every open ask " + "it holds (resolution kind withdrawn, naming the closer), and reopening it brings exactly " + "those asks back. " + "A closed issue still takes messages and comments, though not asks or artifacts; of this " + "tool's fields it takes only a board move " + "(before, after), components, " + "a reopening status (any status but done), and an external_links write that adds no new " + "link (so a link can move to the issue that replaced it); everything else, priority " + "included, waits for the reopen. " + "priority is yours to set and a human overrides it. assignee is the person who answers " + "this issue's asks, and every ask on it waits on them until a person hands that ask on. " + "Passing null unassigns the issue, and every ask on it then waits on the project's default " + "assignee: a question reaches the person it was handed to, else the issue's assignee, else " + "the project's default assignee, so every question reaches a person. " + "Set the assignee when a person said who owns the work, as you " + "file the issue or hand it over. before and after move the issue on " + "its project's board: before puts it above that issue, after below, and both together " + "land it between them. A project's board order is one agent's to keep; in a Legion " + "deployment that is the controller. Never reassign an issue a person holds to get a " + "faster answer: who holds it is their call. At least one " + `field besides issue is required. ${ISSUE_REFERENCE}`,
17323
17327
  arguments: (z) => ({
17324
17328
  issue: z.string().describe(ISSUE_REFERENCE),
17325
17329
  status: z.enum(ISSUE_STATUSES).describe("New lifecycle status.").optional(),
@@ -17327,7 +17331,7 @@ var dispatchToolSpecs = [
17327
17331
  title: z.string({ min: 1, max: ISSUE_TITLE_MAX }).describe("Replacement title, at most 1,000 characters.").optional(),
17328
17332
  labels: z.array(z.string({ min: 1, max: 40 }), { max: 20 }).describe("Replacement label set, at most 20 labels of up to 40 characters; replaces every existing label.").optional(),
17329
17333
  priority: z.number({ int: true, min: 0, max: 3 }).nullable().optional().describe("Coarse priority: 0 is P0 (highest) through 3 is P3 (lowest); null clears it."),
17330
- assignee: z.string().nullable().optional().describe("Email of the person who answers this issue's asks (someone who has signed in to Dispatch); null unassigns the issue. Set it only when a person said who owns the issue, never to move a question off the person holding it."),
17334
+ assignee: z.string().nullable().optional().describe("Email of the person who answers this issue's asks (someone who has signed in to Dispatch); null unassigns the issue, and every ask on it then waits on the project's default assignee. Set it only when a person said who owns the issue, never to move a question off the person holding it."),
17331
17335
  external_links: z.array(z.string({ min: 1 })).describe("URLs to link; a non-empty list merges into the issue's existing external links by URL, an empty list removes every link instead.").optional(),
17332
17336
  route: z.string().describe("Route the issue to role:<name> or session:<id>; an empty string clears it.").optional(),
17333
17337
  parent: z.string().describe("Parent issue key in the same project; an empty string clears the parent.").optional(),
@@ -17583,7 +17587,7 @@ var dispatchToolSpecs = [
17583
17587
  {
17584
17588
  name: "dispatch_request_approval",
17585
17589
  example: { issue: "DSP-1", summary: "A live sync replaces the nightly export." },
17586
- description: "Ask a human to approve a document at its current version. Before calling, have a fresh read-only reader check the spec against the code and the human's words, then resolve every finding; a Legion architect runs `plan-gap-analyst` and `plan-reviewer`. Opens an approval ask (Approve / " + "Request changes) in the human's Inbox whose question names the document and version, " + "followed by the summary; the answer pins a review to that version and arrives as " + "artifact.approved or artifact.changes_requested. An open request follows the document: a " + "later version moves it to that version and leaves it waiting on you, as a human's reply in " + "its thread does. Only the first move since the request was opened or handed back sends an " + "event, and never to the session whose version made it; dispatch doc-read shows whom it " + "waits on. Once the revision is complete and " + HUMAN_AGREED_TO_DOCUMENT + ", call this again to hand that same Inbox row back. The request carries nothing new. A " + "call while it already waits on the human hands nothing back: the same summary changes " + "nothing, and a different one is refused, since it would rewrite the card the human is " + "reading. Approve and Request changes each close the request, so the next call opens a new " + "one. Call it once per revision, when the revision is complete, never after each edit. An " + "approval goes stale when the document changes outside its decision blocks after it, until " + "a later version's text is exactly the approved version's again, as when an accidental " + "edit is undone exactly, and no decision block in it was decided since: that version " + "carries the approval and the document reads approved at it, so nothing is requested for " + "it. When the document does not read approved, request approval again once that revision " + "is complete and " + HUMAN_AGREED_TO_DOCUMENT + ", with a one-sentence summary naming what changed since the earlier approval: the card " + "names that approval (version, date, reviewer) and its Show diff control carries the detail. " + "A human's own answer to a decision block carries the approval to the version it writes when " + "that answer is the whole change since the approved version, so nothing is requested for " + "it. A new version of a Legion root spec closes its armed design gate until a human " + "approves it; a carried approval reopens it too. " + "Refused, with nothing sent, while the document holds an open decision block, even when a " + "human asked for approval: the refusal names each block; ask the human to answer or waive " + "it first. " + "Refused 409 PLAN_APPROVED_BY_REVIEW on an issue's plan, which its plan review approves " + "(dispatch plan-approve), never a person. " + "On an issue's spec the answer ends with a `Coverage of <name>:` line naming each requirement " + "the spec marks that no check serves, in any document of the issue or of its descendants, or saying " + "the spec marks no requirements; a spec every requirement of which has a check gets no such line. It never " + "names a missing plan task, and a gap refuses nothing. " + OWNER_REFERENCE,
17590
+ description: "Ask a human to approve a document at its current version. Before calling, have a fresh read-only reader check the spec against the code and the human's words, then resolve every finding; a Legion architect runs `plan-gap-analyst` and `plan-reviewer`. Opens an approval ask (Approve / " + "Request changes) in the human's Inbox whose question names the document and version, " + "followed by the summary; the answer pins a review to that version and arrives as " + "artifact.approved or artifact.changes_requested. " + "The request reaches the person it was handed to, else the issue's assignee, else the " + "project's default assignee, so it always reaches a person, and this tool's answer names " + "that person. " + "An open request follows the document: a " + "later version moves it to that version and leaves it waiting on you, as a human's reply in " + "its thread does. Only the first move since the request was opened or handed back sends an " + "event, and never to the session whose version made it; dispatch doc-read shows whom it " + "waits on. Once the revision is complete and " + HUMAN_AGREED_TO_DOCUMENT + ", call this again to hand that same Inbox row back. The request carries nothing new. A " + "call while it already waits on the human hands nothing back: the same summary changes " + "nothing, and a different one is refused, since it would rewrite the card the human is " + "reading. Approve and Request changes each close the request, so the next call opens a new " + "one. Call it once per revision, when the revision is complete, never after each edit. An " + "approval goes stale when the document changes outside its decision blocks after it, until " + "a later version's text is exactly the approved version's again, as when an accidental " + "edit is undone exactly, and no decision block in it was decided since: that version " + "carries the approval and the document reads approved at it, so nothing is requested for " + "it. When the document does not read approved, request approval again once that revision " + "is complete and " + HUMAN_AGREED_TO_DOCUMENT + ", with a one-sentence summary naming what changed since the earlier approval: the card " + "names that approval (version, date, reviewer) and its Show diff control carries the detail. " + "A human's own answer to a decision block carries the approval to the version it writes when " + "that answer is the whole change since the approved version, so nothing is requested for " + "it. A new version of a Legion root spec closes its armed design gate until a human " + "approves it; a carried approval reopens it too. " + "Refused, with nothing sent, while the document holds an open decision block, even when a " + "human asked for approval: the refusal names each block; ask the human to answer or waive " + "it first. " + "Refused 409 PLAN_APPROVED_BY_REVIEW on an issue's plan, which its plan review approves " + "(dispatch plan-approve), never a person. " + "On an issue's spec the answer ends with a `Coverage of <name>:` line naming each requirement " + "the spec marks that no check serves, in any document of the issue or of its descendants, or saying " + "the spec marks no requirements; a spec every requirement of which has a check gets no such line. It never " + "names a missing plan task, and a gap refuses nothing. " + OWNER_REFERENCE,
17587
17591
  arguments: (z) => ({
17588
17592
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
17589
17593
  project: z.string().describe("Project key owning the document.").optional(),
@@ -17742,10 +17746,11 @@ var dispatchToolSpecs = [
17742
17746
  {
17743
17747
  name: "dispatch_project",
17744
17748
  example: { key: "CORE", name: "Core" },
17745
- description: "Create a Dispatch project from a key and a name, so issues and project documents can be filed under it. " + "Projects cannot be renamed or deleted, so a mistyped key stays for good: check the keys that exist first " + "with dispatch projects. When a person asks for a project, make the key from its name. Check the key with " + "dispatch projects. If the key is free, create the project. Ask the person only when the key is in use. " + "A key that already exists is refused " + "with 409 PROJECT_EXISTS whoever created it, so after a retry it can mean the first call made the project. " + `A key that is not a project key (${PROJECT_KEY_RULE}) or an empty name is refused with 400 ` + `INVALID_PROJECT, and a name over ${PROJECT_NAME_MAX} characters with 400 CAP_EXCEEDED. When no person ` + "asked for a project and an existing project already covers the work, do not create a project. File an " + "issue in that project with dispatch issue.",
17749
+ description: "Create a Dispatch project from a key and a name, so issues and project documents can be filed under it. " + "Projects cannot be renamed or deleted, so a mistyped key stays for good: check the keys that exist first " + "with dispatch projects. When a person asks for a project, make the key from its name. Check the key with " + "dispatch projects. If the key is free, create the project. Ask the person only when the key is in use. " + "A key that already exists is refused " + "with 409 PROJECT_EXISTS whoever created it, so after a retry it can mean the first call made the project. " + `A key that is not a project key (${PROJECT_KEY_RULE}) or an empty name is refused with 400 ` + `INVALID_PROJECT, and a name over ${PROJECT_NAME_MAX} characters with 400 CAP_EXCEEDED. ` + "Every project names a default assignee, the person its unowned work lands on: the login " + "default_assignee names, else the person creating the project, else the person your " + "credential acts for. A call that names none under a credential acting for no person is " + "refused with 400 INVALID_PROJECT naming default_assignee, so ask a person who it should " + "be rather than choosing one. A login nobody has signed in with is refused with 400 " + "ASSIGNEE_NOT_ALLOWED. The answer names the default the project took. When no person " + "asked for a project and an existing project already covers the work, do not create a project. File an " + "issue in that project with dispatch issue.",
17746
17750
  arguments: (z) => ({
17747
17751
  key: z.string().describe("The new project's key, such as CORE."),
17748
- name: z.string({ max: PROJECT_NAME_MAX }).describe(`The project's name, shown beside its key, at most ${PROJECT_NAME_MAX} characters.`)
17752
+ name: z.string({ max: PROJECT_NAME_MAX }).describe(`The project's name, shown beside its key, at most ${PROJECT_NAME_MAX} characters.`),
17753
+ default_assignee: z.string().describe("Email of the person the project's unowned work lands on: a new issue with no assignee, and every question on an issue nobody holds. It must name a person who has signed in to Dispatch. Left out, it falls to the person creating the project, else the person your credential acts for; a credential that acts for nobody must name it.").optional()
17749
17754
  }),
17750
17755
  strict: true
17751
17756
  },
@@ -17792,7 +17797,7 @@ var dispatchToolSpecs = [
17792
17797
  {
17793
17798
  name: "dispatch_whoami",
17794
17799
  example: {},
17795
- description: "Who Dispatch takes this session for: {session, owner, service, project}. session is the session Dispatch records your writes as. It is the session your credential proved, and the tool says so when that is not the session you run in. owner is the lowercase email of the person you act for, and is the first choice of assignee for issues you create. owner is null under the shared token and under a broker token that names a service and no person. With a null owner, a create with no assignee falls back to the parent's assignee and then to the project's default assignee. service is the subject of the verified service-account token that authenticated you, or the fleet a broker token naming no person belongs to, or null. A broker token that names a service may read and is refused every write with SIGN_IN_REQUIRED, which names the command a person signs in on that machine with. project is the one project key your credential may write, or null when it names none.",
17800
+ description: "Who Dispatch takes this session for: {session, owner, service, project}. session is the session Dispatch records your writes as. It is the session your credential proved, and the tool says so when that is not the session you run in. owner is the lowercase email of the person you act for, and is the first choice of assignee for issues you create. owner is null under the shared token and under a broker token that names a service and no person. With a null owner, a create with no assignee falls back to the parent's assignee and then to the project's default assignee, which every project names, so every issue you create has an assignee. A question on an issue reaches the person it was handed to, else the issue's assignee, else the project's default assignee. service is the subject of the verified service-account token that authenticated you, or the fleet a broker token naming no person belongs to, or null. A broker token that names a service may read and is refused every write with SIGN_IN_REQUIRED, which names the command a person signs in on that machine with. project is the one project key your credential may write, or null when it names none.",
17796
17801
  arguments: () => ({}),
17797
17802
  strict: true
17798
17803
  },
@@ -22356,13 +22361,15 @@ function openAskAge(ageSeconds) {
22356
22361
  const days = Math.floor(hours / 24);
22357
22362
  return `${days}d${hours % 24 === 0 ? "" : ` ${hours % 24}h`}`;
22358
22363
  }
22359
- function openAskAskedOf(ask) {
22360
- const person = ask.waiting_on_person;
22361
- return person === undefined || person === "" ? "nobody" : person;
22364
+ function namedPerson(person) {
22365
+ return person === undefined || person === "" ? undefined : person;
22366
+ }
22367
+ function waitsOnPerson(ask) {
22368
+ return namedPerson(ask.waiting_on_person);
22362
22369
  }
22363
22370
  function openAskLine(ask, baseUrl) {
22364
22371
  const priority = ask.priority === null ? "" : `P${ask.priority} \xB7 `;
22365
- return `- ${openAskAge(ask.age_seconds)} \xB7 ${priority}${ownerTitle(ask.owner)} \xB7 asked of ${openAskAskedOf(ask)} \xB7 ${ask.question} \xB7 ${new URL(ask.ref, baseUrl).toString()}`;
22372
+ return `- ${openAskAge(ask.age_seconds)} \xB7 ${priority}${ownerTitle(ask.owner)} \xB7 asked of ${waitsOnPerson(ask) ?? "nobody"} \xB7 ${ask.question} \xB7 ${new URL(ask.ref, baseUrl).toString()}`;
22366
22373
  }
22367
22374
  function formatOpenAsksSummary(response, baseUrl) {
22368
22375
  const scope = "active open asks you authored on open issues and project documents";
@@ -22782,9 +22789,10 @@ async function askCommand(context) {
22782
22789
  });
22783
22790
  const declinedLines = ask.issue_key === null ? [] : declinedAskLines(ask.advice, ask.issue_key, linkBase);
22784
22791
  const adviceLines = await otherAdviceLines(() => renderAdvice(input.tool, askOwner.label, ask.advice, {}));
22792
+ const asked = waitsOnPerson(ask);
22785
22793
  return {
22786
22794
  text: [
22787
- `Asked ${ask.id} on ${askOwner.label} (urgency ${ask.urgency}): ${ask.question}`,
22795
+ `Asked ${ask.id} on ${askOwner.label} (urgency ${ask.urgency})${asked === undefined ? "" : `, waiting on ${asked}`}: ${ask.question}`,
22788
22796
  ...checkLines,
22789
22797
  ...declinedLines,
22790
22798
  await followsAsk(askOwner, input.subscriptions),
@@ -23370,9 +23378,10 @@ async function requestApprovalCommand(context) {
23370
23378
  }
23371
23379
  const details = await followedAskDetails(client, result.ask, resolved.artifact);
23372
23380
  const outcome = result.recorded ? `Approval requested for ${resolved.artifact.name} (document id ${resolved.artifact.id}) at version ${result.version} (ask ${result.ask.id}).` : `The approval request for ${resolved.artifact.name} (document id ${resolved.artifact.id}) at version ${result.version} (ask ${result.ask.id}) already waits on the human, so this call changed nothing: nothing since it last reached the human (a newer version, a human's reply in its thread, or your progress note) left it waiting on you.`;
23381
+ const waitsOn = waitsOnPerson(result.ask);
23373
23382
  return {
23374
23383
  text: [
23375
- `${outcome} The human's Inbox asks: ${JSON.stringify(result.ask.question)}. The answer arrives as artifact.approved or artifact.changes_requested. An edit before the answer moves this request to the new version and leaves it waiting on you, and a change outside the decision blocks after approval makes the approval stale: either way, request again for the new version once the human has agreed to every point in it, which hands this request back or opens a new one, with a --summary naming what changed since the earlier approval. The human's own answer to a decision block carries the approval when that answer is the whole change since the approved version, and answers an open request Approve in their name: request nothing then.`,
23384
+ `${outcome}${waitsOn === undefined ? "" : ` It waits on ${waitsOn}.`} The human's Inbox asks: ${JSON.stringify(result.ask.question)}. The answer arrives as artifact.approved or artifact.changes_requested. An edit before the answer moves this request to the new version and leaves it waiting on you, and a change outside the decision blocks after approval makes the approval stale: either way, request again for the new version once the human has agreed to every point in it, which hands this request back or opens a new one, with a --summary naming what changed since the earlier approval. The human's own answer to a decision block carries the approval when that answer is the whole change since the approved version, and answers an open request Approve in their name: request nothing then.`,
23376
23385
  ...coverageLines
23377
23386
  ].join(`
23378
23387
  `),
@@ -24415,15 +24424,23 @@ async function projectCommand(context) {
24415
24424
  project = await client.createProject({
24416
24425
  key: stringArg(args, "key"),
24417
24426
  name: stringArg(args, "name"),
24427
+ ...defined("default_assignee", optionalString(args, "default_assignee")),
24418
24428
  actor
24419
24429
  });
24420
24430
  } catch (error) {
24421
24431
  throw refusalWithCode(error);
24422
24432
  }
24423
24433
  const href = new URL(`/projects/${encodeURIComponent(project.key)}`, linkBase).toString();
24434
+ const projectDefault = namedPerson(project.default_assignee);
24424
24435
  return {
24425
- text: `Created project ${project.key} (${project.name}) at ${project.created_at}: ${href}`,
24426
- details: { project: project.key, name: project.name, created_at: project.created_at }
24436
+ text: `Created project ${project.key} (${project.name}) at ${project.created_at}: ${href}` + (projectDefault === undefined ? "" : `
24437
+ Its unowned work lands on ${projectDefault}: a question on an issue nobody holds reaches them.`),
24438
+ details: {
24439
+ project: project.key,
24440
+ name: project.name,
24441
+ created_at: project.created_at,
24442
+ ...defined("default_assignee", projectDefault)
24443
+ }
24427
24444
  };
24428
24445
  }
24429
24446
  async function projectsCommand(context) {
@@ -24791,7 +24808,7 @@ async function whoamiCommand(context) {
24791
24808
  const proved = identity.kind === "agent" ? identity.session ?? null : null;
24792
24809
  const project = identity.kind === "agent" ? identity.project ?? null : null;
24793
24810
  const session = proved ?? sessionId;
24794
- const unowned = "no owner, so an issue you create without an assignee takes its parent's assignee, else the project's default assignee, else nobody.";
24811
+ const unowned = "no owner, so an issue you create without an assignee takes its parent's assignee, else the project's default assignee, which every project names, so the issue always has one.";
24795
24812
  const signInNeeded = owner === null && service !== null && proved !== null;
24796
24813
  const acting = owner !== null ? `Session ${session} acts for ${owner}: issues you create without an assignee are assigned to ${owner}.` : service !== null ? signInNeeded ? `Session ${session} runs as service ${serviceSubjectLabel(service)} and no person, so it may read but Dispatch refuses every write it makes: run \`agent-secrets login\` on this machine to write as yourself.` : `Session ${session} runs as service ${serviceSubjectLabel(service)}: ${unowned}` : `Session ${session} runs under the shared token: ${unowned}`;
24797
24814
  const elsewhere = proved !== null && proved !== sessionId ? ` Your credential names session ${proved}, which is not this host session (${sessionId}): Dispatch records every write you make as ${proved}.` : "";
@@ -28499,7 +28516,7 @@ import { logger as logger3 } from "@oh-my-pi/pi-utils";
28499
28516
  // package.json
28500
28517
  var package_default = {
28501
28518
  name: "@sjawhar/pi-legion",
28502
- version: "19.12.0",
28519
+ version: "19.13.1",
28503
28520
  license: "Apache-2.0",
28504
28521
  type: "module",
28505
28522
  omp: {
@@ -28511,7 +28528,7 @@ var package_default = {
28511
28528
  ]
28512
28529
  },
28513
28530
  legion: {
28514
- daemonApiVersion: 98
28531
+ daemonApiVersion: 104
28515
28532
  },
28516
28533
  repository: {
28517
28534
  type: "git",
@@ -30425,7 +30442,7 @@ function createLegionTool(deps) {
30425
30442
  description: legionToolDescription({
30426
30443
  envoyPublish: "envoy_publish",
30427
30444
  before: PHASE_OP_SENTENCES.readRecord + PHASE_OP_SENTENCES.readReleaseRecords,
30428
- after: PHASE_OP_SENTENCES.requestBackwardMove + "retry_or_escalate decides an issue the daemon holds after its worker failed (issue, decision): retry puts the issue " + "back in the phase it was held from and starts that phase's worker again, escalate leaves it held for the controller, " + "and an optional reason says why you decided as you did: a retry writes it into the restarted worker's task and the " + "daemon's own log line for the release, and an escalation sends it to the controller with the hold. " + "sign_off is the architect's acceptance of an issue in accepting, moving it to retro; the daemon refuses it in every " + "other phase (SIGNOFF_OUTSIDE_ACCEPTING) and while an issue beneath it is still in the workflow " + "(SIGNOFF_CHILD_IN_WORKFLOW, naming each one), since a parent's head proves its children's merged work: run each one " + "to done, and sign off again. " + "Park one with park_child only when a person asked for that move, or when the work is done, folded into another issue or no longer needed, and say in a comment which of those it is. " + "Ask the person about a child that can reach neither done nor a park under that rule, and hold the acceptance until they answer. " + "close_root is refused the same way and with the same code while an issue beneath the root is still in the workflow, " + "since closing it would stop that work mid-turn: answer it the same way, park_child under the same rule included. " + "release_children and rerun_child are refused for a child whose ancestor is in retro or merging " + "(CHILD_UNDER_ACCEPTED_PARENT, naming the ancestor), since that ancestor's approved head cannot carry work released " + "under it now: wait for the ancestor to close, then release it. " + "The controller's read_state with no field returns a summary of the daemon's whole state \u2014 the project, admission, each " + "capability, one line per recorded issue, and under each issue Legion still runs its slot, hold, gate and each claim's " + "state with its last turn times \u2014 and with issue, issues, phase or settings returns the full records it names; " + "set_status moves an issue to todo, backlog or icebox. " + "Move an issue to backlog or icebox only when a person asked for that move, or when the work is done, folded into another issue or no longer needed, and cite that reason in a comment on the issue. " + "Two writes are not that move: a root's restart, which sets backlog and then todo in the same turn, and the " + "controller's report issue's icebox, because that issue holds no work. " + "fresh_session (issue, role) has one claim leave the session it runs in behind and start again in a new one: the daemon " + "stops the agent if it runs, forgets the session, and starts the claim, which loses everything that session held. A " + "phase worker that comes back owing no task is started through its issue's current phase, so it has that phase's work. " + "The answer is empty when the claim came back and nothing else is to be said, and names why nothing restarted the " + "phase (phaseNotRestarted) when the claim came back owing no task and the workflow refused that restart: the claim is " + "running, and no work was handed to it. " + "The daemon refuses it for a claim it records as working, which may be in a turn " + "(CLAIM_IN_A_TURN), for a claim left working over a process the daemon's last report " + "of it found gone, where no turn is running (CLAIM_IN_A_TURN as well), for a claim a " + "suspension is held over, in whatever state the hold found it (CLAIM_IN_A_TURN where " + "the claim is working, CLAIM_UNSETTLED where it is not), for a claim between states \u2014 " + "one queued, one whose launch is in flight, and one left working under a relaunch the " + "wake pacing parked (CLAIM_UNSETTLED) \u2014 and for role controller. " + "compact (issue, role) shortens one claim's session instead: the daemon has Oh My Pi write a text summary of the " + "session so far, and the claim keeps its session, its workspace and everything it knows of its issue and is sent " + "whatever task it owes again. Try compact before fresh_session for a claim that stays stuck. The answer says " + "whether the session was compacted and, when it was not, why; the claim is back either way. The daemon refuses " + "it for a claim that is suspended, failed or retired (CLAIM_NOT_RUNNING: fresh_session " + "reaches that one), for a claim it records as working, which may be in a turn " + "(CLAIM_IN_A_TURN), for a claim left working over a process the daemon's last report " + "of it found gone, where no turn is running (CLAIM_IN_A_TURN), for a claim a " + "suspension is held over (CLAIM_IN_A_TURN where the claim is working, CLAIM_UNSETTLED " + "where it is not), for a claim between states \u2014 one queued, one whose launch is in " + "flight, one whose agent has registered and is not ready yet, which fresh_session " + "reaches, and one left working under a relaunch the wake pacing parked " + "(CLAIM_UNSETTLED) \u2014 for a claim whose role runs on Claude Code (CLAIM_NOT_ON_OMP) " + "and for role controller. " + "Each refusal says what the claim does now and which operation reaches each state. It " + "names no moment to come back at: ask again later, and read the claim's state in " + "read_state. "
30445
+ after: PHASE_OP_SENTENCES.requestBackwardMove + "retry_or_escalate decides an issue the daemon holds after its worker failed (issue, decision): retry puts the issue " + "back in the phase it was held from and starts that phase's worker again, escalate leaves it held for the controller, " + "and an optional reason says why you decided as you did: a retry writes it into the restarted worker's task and the " + "daemon's own log line for the release, and an escalation sends it to the controller with the hold. " + "sign_off is the architect's acceptance of an issue in accepting, moving it to retro; the daemon refuses it in every " + "other phase (SIGNOFF_OUTSIDE_ACCEPTING) and while an issue beneath it is still in the workflow " + "(SIGNOFF_CHILD_IN_WORKFLOW, naming each one), since a parent's head proves its children's merged work: run each one " + "to done, and sign off again. " + "Park one with park_child only when a person asked for that move, or when the work is done, folded into another issue or no longer needed, and say in a comment which of those it is. " + "Ask the person about a child that can reach neither done nor a park under that rule, and hold the acceptance until they answer. " + "close_root is refused the same way and with the same code while an issue beneath the root is still in the workflow, " + "since closing it would stop that work mid-turn: answer it the same way, park_child under the same rule included. " + "release_children and rerun_child are refused for a child whose ancestor is in retro or merging " + "(CHILD_UNDER_ACCEPTED_PARENT, naming the ancestor), since that ancestor's approved head cannot carry work released " + "under it now: wait for the ancestor to close, then release it. " + "The controller's read_state with no field returns a summary of the daemon's whole state \u2014 the project, admission, each " + "capability, one line per recorded issue, and under each issue Legion still runs its slot, hold, gate and each claim's " + "state with its last turn times \u2014 and with issue, issues, phase or settings returns the full records it names; " + "set_status moves an issue to todo, backlog or icebox. " + "Move an issue to backlog or icebox only when a person asked for that move, or when the work is done, folded into another issue or no longer needed, and cite that reason in a comment on the issue. " + "Two writes are not that move: a root's restart, which sets backlog and then todo in the same turn, and the " + "controller's report issue's icebox, because that issue holds no work. " + "fresh_session (issue, role) has one claim leave the session it runs in behind and start again in a new one: the daemon " + "stops the agent if it runs, forgets the session, and starts the claim, which loses everything that session held. A " + "phase worker that comes back owing no task is started through its issue's current phase, so it has that phase's work. " + "The answer is empty when the claim came back and nothing else is to be said. phaseNotRestarted says why nothing " + "restarted the claim's phase, where the claim came back owing no task and the workflow refused that restart: the " + "claim is running, and no work was handed to it. It says what was refused, where this request stopped the claim " + "and a step that would have started it again was refused, and the state that left the claim in: read that state " + "in read_state, and ask for a fresh session again only where the claim is suspended. " + "It reaches a claim stored working that no process stands behind: the daemon reads that claim's process when the " + "request arrives, suspends the claim where it stands, and starts it again with the task its dead turn held. " + "The daemon refuses it for a claim whose process that read finds running " + "(CLAIM_IN_A_TURN), for a claim whose session is being compacted, which is not read at " + "all (CLAIM_IN_A_TURN), for a claim whose process the runtime would not answer for, for " + "one that records no process to read, and for one that moved under the request and that a second read " + "finds no longer working or gone once more, each left exactly as the request found it " + "(CLAIM_UNSETTLED; a claim that moved is otherwise answered as that second read finds it), for a claim a " + "suspension is held over, in whatever state the hold found it (CLAIM_IN_A_TURN where " + "the claim is working, CLAIM_UNSETTLED where it is not), for a claim between states \u2014 " + "one queued, one whose launch is in flight, and one left working under a relaunch the " + "wake pacing parked (CLAIM_UNSETTLED) \u2014 and for role controller. " + "compact (issue, role) shortens one claim's session instead: the daemon has Oh My Pi write a text summary of the " + "session so far, and the claim keeps its session, its workspace and everything it knows of its issue and is sent " + "whatever task it owes again. Try compact first for a claim whose session a provider keeps refusing, and " + "fresh_session for a claim no process stands behind, which compact refuses and fresh_session reaches. The answer " + "says whether the session was compacted and, when it was not, why; the claim is back either way. The daemon " + "refuses it for a claim that is suspended, failed or retired, and for one stored working " + "that no process stands behind (CLAIM_NOT_RUNNING: fresh_session reaches both), for a " + "claim whose process the daemon reads as running (CLAIM_IN_A_TURN), for a claim whose " + "session is being compacted already (CLAIM_IN_A_TURN), for a claim whose process the " + "runtime would not answer for, for one that records no process to read, and for one " + "that moved out of working while the request was made " + "(CLAIM_UNSETTLED), for a claim a " + "suspension is held over (CLAIM_IN_A_TURN where the claim is working, CLAIM_UNSETTLED " + "where it is not), for a claim between states \u2014 one queued, one whose launch is in " + "flight, one whose agent has registered and is not ready yet, which fresh_session " + "reaches, and one left working under a relaunch the wake pacing parked " + "(CLAIM_UNSETTLED) \u2014 for a claim whose role runs on Claude Code (CLAIM_NOT_ON_OMP) " + "and for role controller. " + "Each refusal says what the claim does now and which operation reaches each state. It " + "names no moment to come back at: ask again later, and read the claim's state in " + "read_state. "
30429
30446
  }),
30430
30447
  defaultInactive: true,
30431
30448
  parameters: toolSchema(pi),
@@ -26,8 +26,7 @@ legion({ op: "set_status", issue: "<report KEY>", status: "icebox" })
26
26
  ```
27
27
 
28
28
  With no person known, leave out `--assignee`: the issue then goes to your token's owner, or, under
29
- the shared token, to the project's default assignee when a person set one, and is otherwise
30
- unassigned.
29
+ the shared token, to the project's default assignee, which every project names.
31
30
 
32
31
  ## Keep it answerable
33
32
 
@@ -43,7 +42,8 @@ Each time you read it:
43
42
  (`400 ASSIGNEE_NOT_ALLOWED` names an email nobody has signed in to Dispatch with): name it, with
44
43
  its first line, in your summary.
45
44
  - While `Assignee:` says `unassigned`, open each report with one sentence asking a person to take
46
- the issue from its header, because its asks reach only the Inbox's `Unassigned` filter.
45
+ the issue from its header, because until someone does, its asks go to the project's default
46
+ assignee and not to the person the report is for.
47
47
 
48
48
  ## When
49
49
 
@@ -141,7 +141,7 @@ architect for it, whatever it asks. For a person's mention, take the first of th
141
141
  no label and waits for a person to hand it over. Never label a request outside the scope the
142
142
  deployment instructions state. Reply with the new issue's key, its title, the link and assignee
143
143
  the `Created` line names (naming nobody, Dispatch assigns the issue to your token's owner, or,
144
- under the shared token, to the project's default assignee when a person set one),
144
+ under the shared token, to the project's default assignee, which every project names),
145
145
  and whether Legion will take it: with the label, triage admits it in its next turn unless a
146
146
  person's request says to wait or puts it out of scope. That request is the request itself, the
147
147
  deployment instructions, or a line of the weekly plan that names the person's request behind it.
@@ -72,14 +72,14 @@ Read this on a `triage` wake, at every start, and when a person hands you an iss
72
72
  work is done, folded into another issue (name it) or no longer needed.
73
73
  For a root you admitted, say in that comment who will be asked: `Assigned to <login>,
74
74
  who will get this tree's questions and its design approval`, or, when `Assignee:` says
75
- `unassigned`, `Unassigned — nobody's Inbox shows this tree's questions or its design approval
76
- until someone takes it from the issue header (Assignee, beside Priority)`. Promise the design
77
- approval only when your system prompt's `Design gate steps:` sentence names at least one step;
78
- when it reads `Design gate steps: none.` nobody approves a design, so drop "and its design
79
- approval" (and "or its design approval"). Take the assignee from the read, never
80
- from how the issue was created, because an issue filed with no assignee still lands on the
81
- project's default assignee where a person set one. An unassigned root still runs, but its
82
- architect's asks reach only the Inbox's `Unassigned` filter.
75
+ `unassigned`, `Unassigned — this tree's questions and its design approval go to the project's
76
+ default assignee until someone takes it from the issue header (Assignee, beside Priority)`.
77
+ Promise the design approval only when your system prompt's `Design gate steps:` sentence names
78
+ at least one step; when it reads `Design gate steps: none.` nobody approves a design, so drop
79
+ "and its design approval". Take the assignee from the read, never from how the issue was
80
+ created: an issue filed with no assignee lands on the project's default assignee, which every
81
+ project names, but a person can clear an assignee later, and a root with none still has its
82
+ architect's asks reach the project's default assignee.
83
83
 
84
84
  ## Label an issue for a person
85
85
 
@@ -400,16 +400,31 @@ chain refuses the same work. Either way, `envoy_publish` the key, the role and t
400
400
  issue's architect, which is who can narrow the work. Re-admit nothing and park nothing, because
401
401
  the task is not lost and the session still runs.
402
402
 
403
- One claim that stays stuck after that is yours to act on, and `compact` is the first thing you
404
- reach for: it has the daemon shorten that claim's Oh My Pi session to a text summary and send it
403
+ One claim that stays stuck after that is yours to act on, and which door you use depends on what
404
+ the claim is doing. `compact` is the first thing for a claim whose session the provider keeps
405
+ refusing: it has the daemon shorten that claim's Oh My Pi session to a text summary and send it
405
406
  whatever task it owed again, and the claim keeps its session, its workspace and everything it
406
407
  knows of its issue. The answer says whether the session was compacted and, when it was not, why;
407
- the claim is back either way, and whatever task it owed has gone again. Use `fresh_session` only
408
- when the claim is still refused after a compaction, because a new session loses everything the old
408
+ the claim is back either way, and whatever task it owed has gone again. Use `fresh_session` once
409
+ the claim is still refused after a compaction, because a new session loses everything the old
409
410
  one held — what the worker learned of its issue, and what it had not yet pushed or written down —
410
411
  and cures nothing in a provider outage, where the next session's turns are refused as the last
411
412
  one's were.
412
413
 
414
+ `compact` is the wrong door for a claim no process stands behind, which is a role that died: it
415
+ refuses such a claim `CLAIM_NOT_RUNNING` and names `fresh_session`, because it has no agent to
416
+ ask. Ask for `fresh_session` there. It is the one way back for a dead role, a dead architect of
417
+ your project included: it suspends the claim where your request arrives, leaves the session that
418
+ claim recorded behind, and starts the claim again with the task its dead turn held. Both doors
419
+ read the claim's process at the moment you ask, not the daemon's memory of an older report,
420
+ which a daemon restart forgets. A refusal of `CLAIM_IN_A_TURN` is a claim whose process that
421
+ read found running, or one whose session is being compacted. A claim whose process the runtime
422
+ would not answer for, one that records no process to read, and one that moved under your
423
+ request and that a second read finds no longer working or gone once more are refused
424
+ `CLAIM_UNSETTLED`, each left exactly as your request found it, so ask again once the runtime
425
+ answers; a claim that moved is otherwise answered as that second read finds it. A claim under a relaunch the wake pacing parks is refused
426
+ `CLAIM_UNSETTLED` too.
427
+
413
428
  ## GitHub mentions
414
429
 
415
430
  Read the mention and its artifact. Answer a mention that asks you for triage or for information
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "19.12.0",
3
+ "version": "19.13.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {
@@ -12,7 +12,7 @@
12
12
  ]
13
13
  },
14
14
  "legion": {
15
- "daemonApiVersion": 98
15
+ "daemonApiVersion": 104
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",