@sjawhar/pi-legion 19.39.0 → 19.40.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/legion.js CHANGED
@@ -14349,7 +14349,7 @@ var SEARCH_QUERY_HINT = "search with a short phrase of a few words, not a passag
14349
14349
  var SEARCH_KIND_DEPTH = 100;
14350
14350
  var PROJECT_KEY_PATTERN = /^[A-Z][A-Z0-9]{1,9}$/;
14351
14351
  var PROJECT_KEY_RULE = "an uppercase letter, then 1 to 9 uppercase letters or digits, such as CORE";
14352
- var ARCHITECTURE_SOURCE_REPO_PATTERN = /^[A-Za-z0-9-]+\/(?!\.\.?$)[A-Za-z0-9._-]+$/;
14352
+ var ARCHITECTURE_SOURCE_REPO_PATTERN = /^[A-Za-z0-9_-]+\/(?!\.\.?$)[A-Za-z0-9._-]+$/;
14353
14353
  var ISSUE_STATUSES = [
14354
14354
  "triage",
14355
14355
  "icebox",
@@ -14395,7 +14395,7 @@ var dispatchToolSpecs = [
14395
14395
  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(),
14396
14396
  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(),
14397
14397
  components: componentsArgument(z).optional(),
14398
- 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()
14398
+ repo: z.string().describe("The repository the issue targets, owner/name. A child inherits its parent's when unset, and an issue with none on its parent chain takes the project's default.").optional()
14399
14399
  })
14400
14400
  },
14401
14401
  {
@@ -14421,7 +14421,7 @@ var dispatchToolSpecs = [
14421
14421
  advances: z.array(z.string({ min: 1 }), { max: MAX_ISSUE_ADVANCES }).describe("Replacement list of priority ids this issue advances, which dispatch priorities lists; [] clears the issue's own, leaving every priority it inherits from the issues above it. A set that moves two or more relations is a whole-set write and carries advances_revision; the call reads the issue and sends the revision that read answered, so pass advances_revision only to answer a 409 ADVANCES_REVISION.").optional(),
14422
14422
  advances_revision: z.number().describe("The advances_revision the read this set answers returned, sent with advances and alone changing nothing. Omit it and the call sends the revision of its own read; pass the revision a 409 ADVANCES_REVISION named to write the set you mean against it.").optional(),
14423
14423
  components: componentsArgument(z).optional(),
14424
- repo: z.string().describe("The repository the issue targets, owner/name, mapped to the issue's project in Settings; an empty string clears it, so the issue inherits its parent's or the project's default again.").optional(),
14424
+ repo: z.string().describe("The repository the issue targets, owner/name. An empty string clears it, so the issue inherits its parent's or the project's default again.").optional(),
14425
14425
  before: z.string().describe(`Move the issue above this issue on its project's board: an issue key in the same project. With after, the issue lands between the two. ${BOARD_NEIGHBOUR_REFUSAL}`).optional(),
14426
14426
  after: z.string().describe(`Move the issue below this issue on its project's board: an issue key in the same project. With before, the issue lands between the two. ${BOARD_NEIGHBOUR_REFUSAL}`).optional()
14427
14427
  }),
@@ -27309,14 +27309,20 @@ var legionCacheView = object({
27309
27309
  healthError: nonEmptyString2.optional(),
27310
27310
  retainedUntil: timestamp.optional()
27311
27311
  });
27312
+ var legionAppInstallations = object({ implement: boolean2(), review: boolean2() });
27312
27313
  var legionRepositories = object({
27313
27314
  owners: array(nonEmptyString2),
27314
27315
  mapped: array(object({
27315
27316
  repo: nonEmptyString2,
27316
27317
  default: boolean2(),
27318
+ apps: legionAppInstallations.optional(),
27317
27319
  cache: legionCacheView.optional()
27318
27320
  })),
27319
- refused: array(object({ repo: nonEmptyString2, reason: nonEmptyString2 })),
27321
+ refused: array(object({
27322
+ repo: nonEmptyString2,
27323
+ reason: nonEmptyString2,
27324
+ apps: legionAppInstallations.optional()
27325
+ })),
27320
27326
  withoutWebhookApp: array(object({ repo: nonEmptyString2, reason: nonEmptyString2 })),
27321
27327
  caches: array(legionCacheView)
27322
27328
  });
@@ -27465,7 +27471,9 @@ var LegionControllerCredentialResponse = object({
27465
27471
  })),
27466
27472
  default: nonEmptyString2,
27467
27473
  app: _enum2(["implement", "review"]),
27468
- expiresAt: timestamp
27474
+ expiresAt: timestamp,
27475
+ renames: array(object({ from: nonEmptyString2, to: nonEmptyString2 })).optional(),
27476
+ installed: array(nonEmptyString2)
27469
27477
  });
27470
27478
  var LegionErrorResponse = object({
27471
27479
  error: nonEmptyString2,
@@ -29920,7 +29928,7 @@ import { logger as logger3 } from "@oh-my-pi/pi-utils";
29920
29928
  // package.json
29921
29929
  var package_default = {
29922
29930
  name: "@sjawhar/pi-legion",
29923
- version: "19.39.0",
29931
+ version: "19.40.0",
29924
29932
  license: "Apache-2.0",
29925
29933
  type: "module",
29926
29934
  omp: {
@@ -29932,7 +29940,7 @@ var package_default = {
29932
29940
  ]
29933
29941
  },
29934
29942
  legion: {
29935
- daemonApiVersion: 151
29943
+ daemonApiVersion: 152
29936
29944
  },
29937
29945
  repository: {
29938
29946
  type: "git",
@@ -183,8 +183,8 @@ merges, because the child's work must build on the merged change. Name the merge
183
183
  task (`gh api repos/<owner>/<repo>/pulls/<n> --jq .merge_commit_sha`); for a repository that pins the
184
184
  other one by commit (a lock file or dependency pin), the pin is that commit. Do not hold such a
185
185
  child with `--blocked-by` instead, because Legion would start it at the blocker's close, before you
186
- name the merged commit. Read the other repositories with your gh's read-only access
187
- (`-R owner/repo`).
186
+ name the merged commit. Read another repository with your gh, which reaches every repository your
187
+ role's App is installed on (`-R owner/repo`).
188
188
 
189
189
  ## Recording a wait on other work
190
190
 
@@ -23,7 +23,7 @@ and 7 (a conflict, the hand-over, the close) is in
23
23
  | `child-status` | A child of your tree left the workflow or re-entered it, or joined your tree from the admission queue or from a closed tree; the reason names the child and its new status, or reads `<KEY> joined the tree of <ROOT> from the admission queue`, or, for a member of a closed tree your release took, `<KEY> joined the tree of <ROOT> from the closed tree of <OLD ROOT>`. A reason that says a child starts planning comes at the child's first phase, and it also says that the child's own architect starts with it. From then on that architect owns the child while it holds its role: its decomposition, its children and its acceptance. While that architect holds its role, you hear only the child's `child-status` and `child-closed`, and its architect's `worker-died` and `worker-stalled`. The child's other notices come to you too while that architect does not hold its role, which the daemon's `holdsRole` decides. `todo` (a human's move, your `release_children`, or your `rerun_child`) means it runs again under your tree from planning, and the daemon starts it; you start nothing. A child held for a blocker starts the same way once nothing holds it, and the reason, naming it and its root, says what cleared the hold: its last blocker's close, naming the issues it waited on, now done, or a person or you taking its blocked-by links off; you start nothing for it either. `backlog`, `icebox` or `triage` (a human's move, or your `park_child`) means the child stopped as workflow's `leave` decides, and it advances no further until it is set back to `todo`. The child's next start resumes its architect's session, and that architect starts in a new session only once supervise's `forgetSession` has dropped that one. A `park_child` and then a `rerun_child` is that child's restart and not a park, because the daemon refuses `rerun_child` on a child whose phase is not `done` (`CHILD_RUNNING`, `packages/daemon/internal/api/architect.go`). Joined from the admission queue means a root that waited for a slot and never ran, which a person made a child of your tree or your `release_children` adopted, now runs in your tree as a child, from planning when it is `todo` and parked otherwise. It takes an admission slot of its own when its work starts, and its own architect starts with its first phase. One that waits on an unfinished blocked-by issue is held for that blocker like any other child, and starts when nothing holds it. You start nothing. A reason saying an issue is beneath an ancestor whose reviewed head the daemon has already accepted is a person's `todo` the daemon recorded and holds at `admitted`: nothing starts it until that ancestor closes, and a `request_backward_move` of the ancestor is what runs it under the ancestor now. What the other issues you own do is your decision. When a park leaves no child that an issue in `accepting` waits on, run that issue's last round (`skill://legion-architect/references/acceptance.md`). |
24
24
  | `child-closed` | Read the child completion and remaining open children. Re-scope open work, and take out with `park_child` each child the result makes unneeded (first take its link off each sibling that waits on it, or park that sibling too when its work ends with the parked child, under the same rule, as section 2 says) and say why with `dispatch comment`. Park a child only when a person asked for that move, or when the work is done, folded into another issue or no longer needed. Then file any new child the result calls for, after the red-team check in `skill://legion-architect/references/decomposition.md`, and release it at once with `release_children`, blocked by what it builds on (section 2). When a worker waits on this child for a missing surface (see `phase-finished`), tell it to continue with `envoy_publish` to its role topic. The last child's close is not the end-game (section 3). When it was the last child an issue in `accepting` waits on, run that issue's last round (`skill://legion-architect/references/acceptance.md`). |
25
25
  | `child-release-stalled` | Its `reason` names a child that a `release_children` released and your tree has not recorded, its parent, and why, one of three: the parent's release has not reached the daemon after three tries; or GitHub did not answer the App installation read, or the default-branch read past GitHub's rate limit, of a repository on the child's parent chain, and the release left the child unrecorded because a parent on that chain is not `todo`, or did not write the child `todo` because its parent is not recorded; or the daemon's recovery of such a repository, once GitHub answered, still left children unrecorded. The first two come to the architect whose `release_children` it was. The recovery's notice goes, whoever ran the release, to the architect that owns each child's parent where your tree records that parent, and to the tree root's architect for the rest: a notice on each recorded parent lists that parent's children, and one on the tree root lists the rest, each with its parent. Read the parent's record with the `legion` tool's `read_record` (`issue` the parent); release the parent first when the `reason` says to, then run `release_children` for the child again once the parent is recorded in your tree, and tell the controller if it never is. |
26
- | `child-not-recorded` | Its `reason` names a child your tree did not record and why: its repository resolves to none (neither it nor an ancestor names one, and the project has no default), or to one not mapped to the project, or to one the daemon leaves out for a missing GitHub App. The daemon said why on the child too. Set the child's repository to one of the project's (`dispatch issue-update --repo owner/name`), then release it again with `release_children`; tell the controller when the repository it needs is not served. |
26
+ | `child-not-recorded` | Its `reason` names a child your tree did not record and why: its repository resolves to none (neither it nor an ancestor names one, and the project has no default), or a role GitHub App is not installed on that repository, which the reason names. The daemon said why on the child too. Set the child's repository (`dispatch issue-update --repo owner/name`), or get the named App installed on the repository it has, then release it again with `release_children`. Tell the controller when neither is yours to do. |
27
27
  | `children-first` | An issue of your tree at `admitted` starts no phase of its own while Dispatch shows an open child under it, a child you filed and have not released included. The reason names the parent and each open child with the Dispatch status that holds it, and each cycle it found (a child `blocked_by` an issue above it on its own parent chain, which only a person taking that link off ends: open a `dispatch ask`). It comes once per issue and run of its tree. Release every child that should run. Park a child 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 child. A released child, a held one included, stays under the parent, because the parent's wait ends when that child leaves the workflow. Move out from under the parent only a child you have not released and that should not run now. Move it under another issue you own (section 3 says which) that has started a phase and has not reached `accepting`, and never under an issue it waits on: that move ends this wait and leaves the child in the tree (section 3). After the move, ask the person on the root (`dispatch ask`) when that child's work should run or stop: release it when they say to run it; when they say to stop it, close it, or move it to `icebox` under the rule when they say its work should wait, citing their answer. Until they answer, sign off neither the issue you moved it under nor any issue above it that you accept. Never give such a child the `legion` label, and never clear its parent while the tree is live, because such a child would then run nowhere (section 3). Where you own no issue to move the child under, ask the person. A child's architect sends each of these questions to the architect above it, as "Every turn" in `skill://legion-architect` says. The parent's first phase can start once the last open child has left the workflow; a parent the daemon has already started gives its admission slot back while it waits for its children, and takes one again by itself; nothing of its work stops meanwhile, and you do nothing for it (https://cybermonklabs.github.io/legion/legion/concepts/#admission-and-the-legion-label, which also names the three roots that keep their slot through a wait); a parent the daemon has not started waits in the line for a slot. You start nothing. |
28
28
  | `design-approved` | Its `version` is the approved one, and it names no step: under more than one gated step, read `gatedSteps` in your own record (the `legion` tool's `read_record`) to see which step that version opened and whether another still holds the tree. A human approved the document of one gated step at its current version; that step is open. Proceed to section 2 once every gated step is `approved` — except on a root whose catch-up said `handed_over`: its workers already run their phases, so start nothing. One whose `version` is the version a human's own answer to a decision block wrote, after an earlier approval (Dispatch carried that approval to it, "After approval" in `skill://legion-architect/references/design-gate.md`), opens nothing new: carry on, and release no wave because of it. A root that was waiting on a question in `awaiting_person` gets no such notice: the task that resumes it says "Your spec is approved at version N and the design gate is open: this resume is your design-approved wake", and that resume is this wake — proceed to section 2 on it. |
29
29
  | `design-changes-requested` | Its `version` and `reason`, and no step: under more than one gated step, read `gatedSteps` in your own record (the `legion` tool's `read_record`) and take the step whose `status` is `changes_requested`. A human asked for changes to that step's document at `version`, for `reason`. Revise that document as the reason asks and request approval again as "The armed gate" in `skill://legion-architect/references/design-gate.md` says; end your turn; that step is closed. On a root that was waiting on a question in `awaiting_person`, a review the human gave after the wait began comes in the resume task, not in this notice, whether it answered the wait or came after something else did: the task names the review with its version and reason, unless a later approval superseded it. A `version` below the latest, or a second request for one version, is a request that reached the daemon late: read it as the same section's last paragraph says. Each request arrives once. |
@@ -51,7 +51,8 @@ answer to your ask, a mention), Envoy or Slack. No `legion controller start` can
51
51
  owner a command names (`-R owner/repo`, `repos/owner/repo` in `gh api`, a GitHub URL), and with the
52
52
  first owner's token (`GH_CONFIG_DIR`) otherwise, so always name the repository: another owner's repository read with
53
53
  the first owner's token can fail. The tokens sit in `LEGION_GH_OWNERS_DIR`, one read-only directory
54
- per owner, each token reaching that owner's repositories in the project and no others, refreshed
54
+ per owner the review App is installed on, each token reaching every repository that owner's
55
+ installation holds, refreshed
55
56
  every minute. When the daemon has no GitHub App, `legion controller start`
56
57
  prints `[legion] the daemon has no GitHub App to act as; the controller's gh acts as nobody`.
57
58
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "19.39.0",
3
+ "version": "19.40.0",
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": 151
15
+ "daemonApiVersion": 152
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",