@codyswann/lisa 4.97.2 → 4.97.4
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/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +28 -13
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/validate-config.mjs +115 -6
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +28 -9
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-cycle.mjs +7 -2
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-manager.mjs +9 -2
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-runtime.mjs +9 -4
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +11 -5
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/human-answer.mjs +38 -9
- package/plugins/lisa/.codex-plugin/skills/lisa-setup-session-manager/SKILL.md +15 -2
- package/plugins/lisa/rules/reference/config-resolution.md +8 -5
- package/plugins/lisa/scripts/operator-id-kinds.mjs +120 -0
- package/plugins/lisa/scripts/ready-queue-order.mjs +89 -15
- package/plugins/lisa/skills/lisa-secrets-access/scripts/validate-config.mjs +115 -6
- package/plugins/lisa/skills/lisa-session-manager/SKILL.md +28 -9
- package/plugins/lisa/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-cycle.mjs +7 -2
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-manager.mjs +9 -2
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-runtime.mjs +9 -4
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +11 -5
- package/plugins/lisa/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa/skills/lisa-session-manager/scripts/human-answer.mjs +38 -9
- package/plugins/lisa/skills/lisa-setup-session-manager/SKILL.md +15 -2
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/scripts/operator-id-kinds.mjs +120 -0
- package/plugins/lisa-agy/scripts/ready-queue-order.mjs +89 -15
- package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/validate-config.mjs +115 -6
- package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +28 -9
- package/plugins/lisa-agy/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-cycle.mjs +7 -2
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-manager.mjs +9 -2
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-runtime.mjs +9 -4
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +11 -5
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/human-answer.mjs +38 -9
- package/plugins/lisa-agy/skills/lisa-setup-session-manager/SKILL.md +15 -2
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/rules/reference/config-resolution.md +8 -5
- package/plugins/lisa-copilot/scripts/operator-id-kinds.mjs +120 -0
- package/plugins/lisa-copilot/scripts/ready-queue-order.mjs +89 -15
- package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/validate-config.mjs +115 -6
- package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +28 -9
- package/plugins/lisa-copilot/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-cycle.mjs +7 -2
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-manager.mjs +9 -2
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-runtime.mjs +9 -4
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +11 -5
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/human-answer.mjs +38 -9
- package/plugins/lisa-copilot/skills/lisa-setup-session-manager/SKILL.md +15 -2
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +8 -5
- package/plugins/lisa-cursor/scripts/operator-id-kinds.mjs +120 -0
- package/plugins/lisa-cursor/scripts/ready-queue-order.mjs +89 -15
- package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/validate-config.mjs +115 -6
- package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +28 -9
- package/plugins/lisa-cursor/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-cycle.mjs +7 -2
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-manager.mjs +9 -2
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-runtime.mjs +9 -4
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +11 -5
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/human-answer.mjs +38 -9
- package/plugins/lisa-cursor/skills/lisa-setup-session-manager/SKILL.md +15 -2
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/rules/reference/config-resolution.md +8 -5
- package/plugins/lisa-devin/scripts/operator-id-kinds.mjs +120 -0
- package/plugins/lisa-devin/scripts/ready-queue-order.mjs +89 -15
- package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/validate-config.mjs +115 -6
- package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +28 -9
- package/plugins/lisa-devin/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-cycle.mjs +7 -2
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-manager.mjs +9 -2
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-runtime.mjs +9 -4
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +11 -5
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/human-answer.mjs +38 -9
- package/plugins/lisa-devin/skills/lisa-setup-session-manager/SKILL.md +15 -2
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/rules/reference/config-resolution.md +8 -5
- package/plugins/src/base/scripts/operator-id-kinds.mjs +120 -0
- package/plugins/src/base/scripts/ready-queue-order.mjs +89 -15
- package/plugins/src/base/skills/lisa-secrets-access/scripts/validate-config.mjs +115 -6
- package/plugins/src/base/skills/lisa-session-manager/SKILL.md +28 -9
- package/plugins/src/base/skills/lisa-session-manager/references/runbook-template.md +4 -2
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-cycle.mjs +7 -2
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-manager.mjs +9 -2
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-runtime.mjs +9 -4
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +11 -5
- package/plugins/src/base/skills/lisa-session-manager/scripts/config.mjs +2 -1
- package/plugins/src/base/skills/lisa-session-manager/scripts/human-answer.mjs +38 -9
- package/plugins/src/base/skills/lisa-setup-session-manager/SKILL.md +15 -2
- package/typescript/package-lisa/package.lisa.json +2 -2
|
@@ -18,8 +18,11 @@
|
|
|
18
18
|
* login or numeric id, a Jira accountId, a Linear user id, never a display
|
|
19
19
|
* name or email, which anyone can set. An all-digit allowed entry is a
|
|
20
20
|
* numeric id and matches only the `id` or `accountId` field, never a login,
|
|
21
|
-
* which its owner chooses and may make all digits (#4571).
|
|
22
|
-
*
|
|
21
|
+
* which its owner chooses and may make all digits (#4571). A kind-keyed
|
|
22
|
+
* entry names one identity for this matcher, the queue and the claim alike
|
|
23
|
+
* (#4623): `login:<v>` matches only a `login`, `id:<v>` only an `id` or
|
|
24
|
+
* `accountId`, and an entry with an unknown prefix or an empty value matches
|
|
25
|
+
* nobody. The text is carried as data.
|
|
23
26
|
*
|
|
24
27
|
* The question the answer must follow is the comment whose id the manager
|
|
25
28
|
* recorded last; with no recorded id, the latest comment that STARTS with
|
|
@@ -28,6 +31,7 @@
|
|
|
28
31
|
* answer by posting the marker after it.
|
|
29
32
|
* @module session-manager/human-answer
|
|
30
33
|
*/
|
|
34
|
+
import { parseIdEntries } from "../../../scripts/operator-id-kinds.mjs";
|
|
31
35
|
import { QUESTION_MARKER } from "./human-needed.mjs";
|
|
32
36
|
|
|
33
37
|
/** Body markers that make a comment a machine's, never a human's answer. */
|
|
@@ -46,6 +50,9 @@ const QUOTE_LINE = /^\s*>/;
|
|
|
46
50
|
/** The comment fields that carry its tracker id. */
|
|
47
51
|
const COMMENT_ID_KEYS = ["id", "node_id"];
|
|
48
52
|
|
|
53
|
+
/** The author field a `login:` entry matches. */
|
|
54
|
+
const LOGIN_KEYS = ["login"];
|
|
55
|
+
|
|
49
56
|
/** The author fields that are stable ids, never settable display text. */
|
|
50
57
|
const STABLE_ID_KEYS = ["login", "id", "accountId"];
|
|
51
58
|
|
|
@@ -60,6 +67,28 @@ const NUMERIC_ID_KEYS = ["id", "accountId"];
|
|
|
60
67
|
/** An allowed entry that is a numeric account id, never a login. */
|
|
61
68
|
const ALL_DIGITS = /^\d+$/;
|
|
62
69
|
|
|
70
|
+
/**
|
|
71
|
+
* The allowed values, split by the author fields each may match. A plain
|
|
72
|
+
* entry keeps its #4571 meaning (all digits: an id only; otherwise a login
|
|
73
|
+
* or an id); a kind-keyed entry matches its own kind only.
|
|
74
|
+
* @param {readonly unknown[]} allowed - Answerer entries
|
|
75
|
+
* @returns {{ ids: Set<string>, logins: Set<string>, named: Set<string> }}
|
|
76
|
+
* Values matched against id fields, login fields, and any stable field
|
|
77
|
+
*/
|
|
78
|
+
function answererSets(allowed) {
|
|
79
|
+
const entries = parseIdEntries(allowed);
|
|
80
|
+
const plain = entries.filter(entry => entry.kind === "plain");
|
|
81
|
+
const valuesOf = list => new Set(list.map(entry => entry.value));
|
|
82
|
+
return {
|
|
83
|
+
ids: valuesOf([
|
|
84
|
+
...plain.filter(entry => ALL_DIGITS.test(entry.value)),
|
|
85
|
+
...entries.filter(entry => entry.kind === "id"),
|
|
86
|
+
]),
|
|
87
|
+
logins: valuesOf(entries.filter(entry => entry.kind === "login")),
|
|
88
|
+
named: valuesOf(plain.filter(entry => !ALL_DIGITS.test(entry.value))),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
63
92
|
/**
|
|
64
93
|
* The string or number values of `keys` on `value`, as strings.
|
|
65
94
|
* @param {unknown} value - Object to read
|
|
@@ -148,11 +177,12 @@ function questionIndex(rows, managerCommentIds, authorOf) {
|
|
|
148
177
|
* reported in `refused`, never returned: returning it made every later cycle
|
|
149
178
|
* pick the same reply and fail on it again, so a corrected reply posted after
|
|
150
179
|
* it was never read (CodySwannGT/lisa#4571).
|
|
151
|
-
* @param {{comments: unknown, allowed: readonly string[],
|
|
180
|
+
* @param {{comments: unknown, allowed: readonly (string|number)[],
|
|
152
181
|
* managerCommentIds?: readonly (string|number)[],
|
|
153
182
|
* refuses?: (text: string) => string | null | undefined}} input - The
|
|
154
|
-
* item's comments, the answerer
|
|
155
|
-
* reply's text may not be queued (null
|
|
183
|
+
* item's comments, the answerer entries (plain, `login:` or `id:`), the
|
|
184
|
+
* ids the manager posted, and why a reply's text may not be queued (null
|
|
185
|
+
* when it may)
|
|
156
186
|
* @returns {{answer: {text: string, author: string, at: string|null} | null,
|
|
157
187
|
* reason: string, refused?: {id: string|null, author: string, why: string}[]}}
|
|
158
188
|
* The answer, or null with why there is none, and (only when any were)
|
|
@@ -168,13 +198,12 @@ export function pickItemAnswer({
|
|
|
168
198
|
throw new Error('stdin must be JSON {"comments":[...]}');
|
|
169
199
|
}
|
|
170
200
|
const rows = comments.filter(row => row && typeof row === "object");
|
|
171
|
-
const
|
|
172
|
-
const numeric = new Set(allow.filter(id => ALL_DIGITS.test(id)));
|
|
173
|
-
const named = new Set(allow.filter(id => !ALL_DIGITS.test(id)));
|
|
201
|
+
const { ids, logins, named } = answererSets(allowed);
|
|
174
202
|
const authorOf = row => {
|
|
175
203
|
const author = row.author ?? row.user;
|
|
176
204
|
return (
|
|
177
|
-
idsOf(author, NUMERIC_ID_KEYS).find(id =>
|
|
205
|
+
idsOf(author, NUMERIC_ID_KEYS).find(id => ids.has(id)) ??
|
|
206
|
+
idsOf(author, LOGIN_KEYS).find(login => logins.has(login)) ??
|
|
178
207
|
idsOf(author, STABLE_ID_KEYS).find(id => named.has(id))
|
|
179
208
|
);
|
|
180
209
|
};
|
|
@@ -68,7 +68,10 @@ writes `$SM`, and pass `--project-root "$ROOT"` (the absolute project root) on e
|
|
|
68
68
|
set `sessionManager.trustedAuthorIds`. Without it, any author's Ready item reaches a
|
|
69
69
|
bypass-permissions worker; say so plainly. The list holds stable tracker user ids as strings,
|
|
70
70
|
never logins: the GitHub numeric user id (`gh api users/<login> --jq .id`), the Jira
|
|
71
|
-
`accountId`, or the Linear user id. A login matches no one
|
|
71
|
+
`accountId`, or the Linear user id. A plain login matches no one in the queue and silently
|
|
72
|
+
excludes every item; to trust a GitHub login on purpose write it as `login:<login>`, and to say
|
|
73
|
+
outright that an entry is an id write `id:<id>`. A login GitHub frees (after a rename or a
|
|
74
|
+
deleted account) can be re-registered by someone else, so prefer `id:` for trust.
|
|
72
75
|
4. Set `sessionManager.operatorIds` to a non-empty **array** holding the operator's own tracker
|
|
73
76
|
user id, e.g. `"operatorIds": ["<operator-id>"]` (a bare string fails `validate`). Look up the
|
|
74
77
|
OPERATOR, not the credential: `gh api user` / `viewer.id` return whoever the tracker credential
|
|
@@ -81,6 +84,13 @@ writes `$SM`, and pass `--project-root "$ROOT"` (the absolute project root) on e
|
|
|
81
84
|
"me", spelled as the tracker API returns it: the GitHub **login** (`gh api users/<login> --jq
|
|
82
85
|
.login`), the Jira `accountId`, or the Linear user id (the operator's entry in the team's member
|
|
83
86
|
list, or `viewer.id` only when the operator runs the lookup with their own credential).
|
|
87
|
+
**Prefer the kind-keyed form**, which every reader (the queue, the claim and answers on the
|
|
88
|
+
item) matches the same way: `"login:<github-login>"` on GitHub, `"id:<accountId or user id>"` on
|
|
89
|
+
Jira and Linear. A plain entry still works as before, but a plain **all-digit** GitHub login is
|
|
90
|
+
read as a login by the queue and as a numeric id by the answer matcher, so the operator could
|
|
91
|
+
not answer on the item and the unrelated account whose numeric id equals it could; `validate`
|
|
92
|
+
warns about it (in `warnings`, never failing) and names both forms. An unknown prefix
|
|
93
|
+
(`user:octocat`) or an empty value (`login:`) fails `validate`, naming the entry.
|
|
84
94
|
**Recommend setting it in every setup**, even a single-user one: it is also who may answer a
|
|
85
95
|
human-needed question by replying on the item. With neither `operatorIds` nor
|
|
86
96
|
`trustedAuthorIds` set, the manager reads no answer off the item at all, because the tracker
|
|
@@ -91,10 +101,13 @@ writes `$SM`, and pass `--project-root "$ROOT"` (the absolute project root) on e
|
|
|
91
101
|
is exhausted and a worker slot is still free, the manager then looks at backlog items (open
|
|
92
102
|
leaves in no lifecycle role) that nobody else is assigned to, that are not human-held and have
|
|
93
103
|
no unfinished blocker. Each one that passes the full tracker validation, including the
|
|
94
|
-
stateless-pickup check, is assigned to the first `operatorIds` entry
|
|
104
|
+
stateless-pickup check, is assigned to the first `operatorIds` entry (its bare login or id,
|
|
105
|
+
without the `login:` / `id:` prefix), moved to Ready and
|
|
95
106
|
dispatched. Say plainly that this lets the manager start work nobody marked Ready, so it needs
|
|
96
107
|
`operatorIds` and should go with `trustedAuthorIds` on any tracker outsiders can write to.
|
|
97
108
|
6. `node "$SM/session-manager.mjs" validate --project-root "$ROOT"` must print `valid: true`.
|
|
109
|
+
Show the operator every entry of `warnings`, when there is one, in plain words, and offer to
|
|
110
|
+
rewrite a plain all-digit operator entry in the `login:` / `id:` form it names.
|
|
98
111
|
|
|
99
112
|
## Step 3: Store the bot token
|
|
100
113
|
|
|
@@ -741,9 +741,9 @@ operator chooses Telegram (`init-config --notify telegram`).
|
|
|
741
741
|
| `sessionManager.stall.requestionHours` | no | `4` | How long an unanswered worker question waits before the manager asks again (zero or positive). |
|
|
742
742
|
| `sessionManager.notify.provider` | no | `none` | `none` (no notification channel) or `telegram`. Absent, like an absent `notify` block, means `none`. Any other value fails validation. |
|
|
743
743
|
| `sessionManager.notify.stateDir` | **yes** with `telegram`; must be absent otherwise | — | This project's own Telegram state dir. A `stateDir` without the `telegram` provider fails validation, because no bot would use it. Never the shared default `~/.claude/channels/telegram`, because one bot per state dir is how projects stay isolated. Setup writes `~/.claude/channels/telegram-<project>`. |
|
|
744
|
-
| `sessionManager.trustedAuthorIds` | no | — | Optional list of **stable tracker user ids**, as strings: the GitHub numeric user id (`gh api users/<login> --jq .id`), the Jira `accountId`, or the Linear user id. Not logins or display names: matching compares ids, so a login silently matches no one and excludes every item. When set, the manager takes only items authored by these people. |
|
|
745
|
-
| `sessionManager.operatorIds` | no | — | Optional, non-empty list of the people the manager works for, as tracker user ids matched against the **assignee** the same way "me" is: the GitHub **login**, the Jira `accountId`, or the Linear user id, spelled exactly as the tracker API returns it (matching is case-sensitive, so look the OPERATOR up rather than typing from memory: `gh api users/<operator-login> --jq .login` returns the canonical GitHub spelling. Do not use `gh api user`, which returns whoever the credential belongs to — the agent account, when that is the case this key exists for). Dispatch order is assigned to an operator, then to "me" (the tracker credential's identity), then unassigned; items assigned to anyone else are skipped. Set it whenever the tracker credential is not the operator's own (an agent account), or the operator's Ready items are never dispatched. |
|
|
746
|
-
| `sessionManager.backlogPickup` | no | `false` | Opt-in lowest dispatch tier. When the Ready queue is exhausted and capacity remains, the manager considers backlog items (open leaves in no lifecycle role) with the Ready exclusions plus any unfinished blocker; each one that passes the tracker validator (all gates, including the stateless-pickup dry-run) is assigned to the first `operatorIds` entry, moved to Ready in one write, read back and dispatched. A failed validation is cached against the item's `updatedAt`, so it is re-judged only after the item changes. Requires `operatorIds`. |
|
|
744
|
+
| `sessionManager.trustedAuthorIds` | no | — | Optional list of **stable tracker user ids**, as strings: the GitHub numeric user id (`gh api users/<login> --jq .id`), the Jira `accountId`, or the Linear user id. Not logins or display names: matching compares ids, so a plain login silently matches no one and excludes every item. An entry may name its kind: `id:<v>` is an id, `login:<v>` a GitHub login (matched by the queue and on-item answers; the hold-release check compares ids only and ignores it). A login GitHub frees (after a rename or a deleted account) can be re-registered by someone else, so prefer `id:` for trust. An unknown prefix or an empty value fails validation. When set, the manager takes only items authored by these people. |
|
|
745
|
+
| `sessionManager.operatorIds` | no | — | Optional, non-empty list of the people the manager works for, as tracker user ids matched against the **assignee** the same way "me" is: the GitHub **login**, the Jira `accountId`, or the Linear user id, spelled exactly as the tracker API returns it (matching is case-sensitive, so look the OPERATOR up rather than typing from memory: `gh api users/<operator-login> --jq .login` returns the canonical GitHub spelling. Do not use `gh api user`, which returns whoever the credential belongs to — the agent account, when that is the case this key exists for). Dispatch order is assigned to an operator, then to "me" (the tracker credential's identity), then unassigned; items assigned to anyone else are skipped. Set it whenever the tracker credential is not the operator's own (an agent account), or the operator's Ready items are never dispatched. Prefer the kind-keyed form, which the queue, the claim and on-item answers all match the same way: `login:<GitHub login>` matches only a GitHub login, `id:<v>` only an account id (GitHub numeric id, Jira `accountId`, Linear user id). A plain entry keeps its meaning, but a plain all-digit entry is a login to the queue and the claim and a numeric id to on-item answers, so validation warns about it (without failing) and names both forms. An unknown prefix or an empty value fails validation. A Jira accountId holding a colon (`557058:…`, `qm:…`) is still plain. |
|
|
746
|
+
| `sessionManager.backlogPickup` | no | `false` | Opt-in lowest dispatch tier. When the Ready queue is exhausted and capacity remains, the manager considers backlog items (open leaves in no lifecycle role) with the Ready exclusions plus any unfinished blocker; each one that passes the tracker validator (all gates, including the stateless-pickup dry-run) is assigned to the first `operatorIds` entry (without its `login:` / `id:` prefix), moved to Ready in one write, read back and dispatched. A failed validation is cached against the item's `updatedAt`, so it is re-judged only after the item changes. Requires `operatorIds`. |
|
|
747
747
|
|
|
748
748
|
- **Non-secret only.** A credential-named field or a token-shaped value anywhere in this block is a
|
|
749
749
|
validation error. With Telegram, where the bot token lives follows the project's `secrets` block
|
|
@@ -769,7 +769,8 @@ operator chooses Telegram (`init-config --notify telegram`).
|
|
|
769
769
|
both, so neither name is ever hard-coded.
|
|
770
770
|
- **Who may answer on the item.** A reply on a human-needed item is taken as the answer only from
|
|
771
771
|
`sessionManager.operatorIds` or `trustedAuthorIds`, matched on stable ids (GitHub login or
|
|
772
|
-
numeric id, Jira `accountId`, Linear user id; never a display name or email
|
|
772
|
+
numeric id, Jira `accountId`, Linear user id; never a display name or email; a plain all-digit
|
|
773
|
+
entry is a numeric id only, `login:<v>` only a login, `id:<v>` only an id), and never from a
|
|
773
774
|
machine comment, which is excluded first, whoever wrote it: one starting with a Lisa or Claude
|
|
774
775
|
tag such as `[lisa-…]` or `[claude-sync]`, holding `[lisa-` or `<!-- lisa:`, saying "Written by
|
|
775
776
|
Claude", carrying the agent-attribution footer, or whose id the manager recorded as its own
|
|
@@ -782,7 +783,9 @@ operator chooses Telegram (`init-config --notify telegram`).
|
|
|
782
783
|
with the `answerCommand` that `status` lists. Set `operatorIds` even in a single-user setup.
|
|
783
784
|
- **Shape check.** `validateSessionManager` in
|
|
784
785
|
`lisa-secrets-access/scripts/validate-config.mjs` runs as part of `validateConfig`, so
|
|
785
|
-
`/lisa:doctor` reports a malformed block.
|
|
786
|
+
`/lisa:doctor` reports a malformed block. `sessionManagerWarnings` reports what works but is
|
|
787
|
+
ambiguous (a plain all-digit operator entry): doctor prints it as a warning and the
|
|
788
|
+
session manager's `validate` returns it in `warnings`; neither fails on it.
|
|
786
789
|
|
|
787
790
|
### Env-keyed `done`
|
|
788
791
|
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kind-keyed identity entries for `sessionManager.operatorIds` and
|
|
3
|
+
* `sessionManager.trustedAuthorIds` (CodySwannGT/lisa#4623).
|
|
4
|
+
*
|
|
5
|
+
* ## Why this exists
|
|
6
|
+
*
|
|
7
|
+
* One plain config value used to mean two identities. An all-digit entry was
|
|
8
|
+
* a numeric account id to the answer matcher (#4571: anyone can register an
|
|
9
|
+
* all-digit login, nobody picks their own numeric id) but a login to the
|
|
10
|
+
* Ready-queue order and the claim. So an operator whose GitHub login is all
|
|
11
|
+
* digits could not answer on the item, and the stranger whose numeric id
|
|
12
|
+
* equals that login could; switching the entry to the numeric id fixed the
|
|
13
|
+
* answers and broke the queue. A kind-keyed entry names one identity, and
|
|
14
|
+
* every reader matches it the same way:
|
|
15
|
+
*
|
|
16
|
+
* - `login:<v>` is a GitHub login and matches only a `login` field.
|
|
17
|
+
* - `id:<v>` is an account id (a GitHub numeric id, a Jira accountId, a
|
|
18
|
+
* Linear user id) and matches only an id field.
|
|
19
|
+
* - A plain entry (no prefix) keeps exactly the meaning each reader gave it
|
|
20
|
+
* before kind-keyed entries existed. Changing that is a later, breaking
|
|
21
|
+
* change.
|
|
22
|
+
*
|
|
23
|
+
* ## The prefix rule
|
|
24
|
+
*
|
|
25
|
+
* A prefix is one run of ASCII letters followed by `:` at the very start.
|
|
26
|
+
* Jira accountIds can hold a colon (`557058:<uuid>`), but their part before
|
|
27
|
+
* it is digits, so they stay plain. Jira Service Management portal customers
|
|
28
|
+
* have accountIds that start with letters (`qm:<id>`); `qm` is therefore not
|
|
29
|
+
* a prefix and such an id stays plain too. Any other letters-and-colon start
|
|
30
|
+
* is an unknown prefix, and an entry whose prefix is followed by nothing is
|
|
31
|
+
* an empty value. Both are invalid: a reader matches them against nobody and
|
|
32
|
+
* `validate-config.mjs` refuses them, naming the entry.
|
|
33
|
+
*
|
|
34
|
+
* The validator ships as a standalone payload script and keeps its own copy
|
|
35
|
+
* of this grammar; `tests/unit/scripts/operator-id-kinds.test.ts` pins the
|
|
36
|
+
* two together on a table of entries.
|
|
37
|
+
* @module operator-id-kinds
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/** The kinds a prefixed entry may name. */
|
|
41
|
+
export const ID_ENTRY_KINDS = Object.freeze(["login", "id"]);
|
|
42
|
+
|
|
43
|
+
/** A letters-only prefix at the start of an entry. */
|
|
44
|
+
const PREFIX = /^([A-Za-z]+):/;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Letters-and-colon starts that belong to a real tracker id, never a prefix:
|
|
48
|
+
* Jira Service Management portal customers' accountIds start `qm:`.
|
|
49
|
+
*/
|
|
50
|
+
const PLAIN_ID_STARTS = new Set(["qm"]);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @typedef {{ kind: "login" | "id" | "plain", value: string }
|
|
54
|
+
* | { kind: "invalid", problem: "unknown-prefix" | "empty-value", prefix: string }} IdEntry
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Parse one entry. A number (a hand-written numeric id) reads as its string,
|
|
59
|
+
* exactly as the readers have always taken it.
|
|
60
|
+
* @param {unknown} entry - One `operatorIds` / `trustedAuthorIds` entry
|
|
61
|
+
* @returns {IdEntry | null} The parsed entry; null for a non-string,
|
|
62
|
+
* non-number value
|
|
63
|
+
*/
|
|
64
|
+
export function parseIdEntry(entry) {
|
|
65
|
+
if (typeof entry === "number") return { kind: "plain", value: String(entry) };
|
|
66
|
+
if (typeof entry !== "string") return null;
|
|
67
|
+
const prefix = PREFIX.exec(entry)?.[1];
|
|
68
|
+
if (prefix === undefined || PLAIN_ID_STARTS.has(prefix)) {
|
|
69
|
+
return { kind: "plain", value: entry };
|
|
70
|
+
}
|
|
71
|
+
if (!ID_ENTRY_KINDS.includes(prefix)) {
|
|
72
|
+
return { kind: "invalid", problem: "unknown-prefix", prefix };
|
|
73
|
+
}
|
|
74
|
+
const value = entry.slice(prefix.length + 1).trim();
|
|
75
|
+
return value === ""
|
|
76
|
+
? { kind: "invalid", problem: "empty-value", prefix }
|
|
77
|
+
: { kind: prefix, value };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Parse a configured list, dropping values that are not entries at all.
|
|
82
|
+
* @param {unknown} entries - The configured list
|
|
83
|
+
* @returns {IdEntry[]} Parsed entries, invalid ones kept so a reader can
|
|
84
|
+
* count them (an invalid trusted entry still means a filter is set)
|
|
85
|
+
*/
|
|
86
|
+
export function parseIdEntries(entries) {
|
|
87
|
+
return (Array.isArray(entries) ? entries : [])
|
|
88
|
+
.map(parseIdEntry)
|
|
89
|
+
.filter(entry => entry !== null);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Whether one parsed entry names the identity whose fields are given. Each
|
|
94
|
+
* field is the reader's value for that kind: `plain` is what a plain entry
|
|
95
|
+
* has always been compared with there, `login` the GitHub login (null when
|
|
96
|
+
* the tracker has none), `id` the account id. A missing field never matches.
|
|
97
|
+
* @param {IdEntry} entry - Parsed entry
|
|
98
|
+
* @param {{ plain?: string | null, login?: string | null, id?: string | null }} fields
|
|
99
|
+
* @returns {boolean} Whether it matches
|
|
100
|
+
*/
|
|
101
|
+
export function entryMatches(entry, fields) {
|
|
102
|
+
if (entry.kind === "invalid") return false;
|
|
103
|
+
const actual = fields[entry.kind];
|
|
104
|
+
return typeof actual === "string" && actual !== "" && actual === entry.value;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The values an id-only comparator may hold, for a reader that compares
|
|
109
|
+
* account ids and nothing else (the hold-release check in
|
|
110
|
+
* `intake-blocker-reprobe.mjs`): plain entries as written and `id:` values.
|
|
111
|
+
* A `login:` entry names a login, which such a reader never sees, so it is
|
|
112
|
+
* dropped rather than compared with an id it could collide with.
|
|
113
|
+
* @param {unknown} entries - The configured list
|
|
114
|
+
* @returns {string[]} Values to compare as ids
|
|
115
|
+
*/
|
|
116
|
+
export function idComparableValues(entries) {
|
|
117
|
+
return parseIdEntries(entries)
|
|
118
|
+
.filter(entry => entry.kind === "plain" || entry.kind === "id")
|
|
119
|
+
.map(entry => entry.value);
|
|
120
|
+
}
|
|
@@ -27,6 +27,13 @@
|
|
|
27
27
|
* {@link assertPagedToCompletion} refuses to order a half-read queue, because
|
|
28
28
|
* a truncated sweep silently reorders by omission (#3529, #4105).
|
|
29
29
|
*
|
|
30
|
+
* Operator and trusted-author entries may be kind-keyed (#4623): `login:<v>`
|
|
31
|
+
* matches only a GitHub login, `id:<v>` only an account id, and a plain entry
|
|
32
|
+
* is compared exactly as before (with the normalized assignee id, or the
|
|
33
|
+
* normalized author id). Each normalizer therefore also carries the login and
|
|
34
|
+
* the account id of the assignee and the login of the author, where its
|
|
35
|
+
* tracker has them, so the kinds never have to be guessed.
|
|
36
|
+
*
|
|
30
37
|
* Held items are judged by {@link isHumanGated}, the one shared answer to "is
|
|
31
38
|
* a person holding this?", rather than by a local label check (#3805).
|
|
32
39
|
*
|
|
@@ -42,6 +49,7 @@ import {
|
|
|
42
49
|
DEFAULT_HUMAN_NEEDED_LABEL,
|
|
43
50
|
isHumanGated,
|
|
44
51
|
} from "./intake-blocker-reprobe.mjs";
|
|
52
|
+
import { entryMatches, parseIdEntries } from "./operator-id-kinds.mjs";
|
|
45
53
|
|
|
46
54
|
/** Rank for GitHub `priority:<value>` labels; no label ranks 4. */
|
|
47
55
|
const GITHUB_PRIORITY_RANKS = Object.freeze({
|
|
@@ -187,13 +195,18 @@ export function normalizeGithubIssue(issue, options = {}) {
|
|
|
187
195
|
title: text(issue.title),
|
|
188
196
|
// GitHub "me" is the login (`gh api user --jq .login`), so match on it.
|
|
189
197
|
assigneeId: idOrNull(assignee?.login),
|
|
198
|
+
assigneeLogin: idOrNull(assignee?.login),
|
|
199
|
+
assigneeAccountId: idOrNull(assignee?.id),
|
|
190
200
|
priorityRank: ranks.length > 0 ? Math.min(...ranks) : GITHUB_NO_PRIORITY,
|
|
191
201
|
createdAt: text(issue.created_at),
|
|
192
202
|
updatedAt: text(issue.updated_at),
|
|
193
203
|
labels,
|
|
194
204
|
body: text(issue.body),
|
|
195
|
-
//
|
|
205
|
+
// Plain and `id:` trusted-author entries trust by stable id (ready-role-
|
|
206
|
+
// filing); a `login:` entry trusts a login the operator opted into
|
|
207
|
+
// explicitly, knowing a freed login can be re-registered (#4623).
|
|
196
208
|
authorId: idOrNull(issue.user?.id),
|
|
209
|
+
authorLogin: idOrNull(issue.user?.login),
|
|
197
210
|
isContainer: Number(summary?.total ?? 0) > Number(summary?.completed ?? 0),
|
|
198
211
|
// `blocked_by` in the dependency summary counts only OPEN blockers.
|
|
199
212
|
openBlockers: count(issue.issue_dependencies_summary?.blocked_by),
|
|
@@ -225,12 +238,15 @@ export function normalizeJiraIssue(issue) {
|
|
|
225
238
|
ref: text(issue?.key),
|
|
226
239
|
title: text(fields.summary),
|
|
227
240
|
assigneeId: idOrNull(fields.assignee?.accountId),
|
|
241
|
+
assigneeLogin: null,
|
|
242
|
+
assigneeAccountId: idOrNull(fields.assignee?.accountId),
|
|
228
243
|
priorityRank: JIRA_PRIORITY_RANKS[priority] ?? JIRA_UNKNOWN_PRIORITY,
|
|
229
244
|
createdAt: text(fields.created),
|
|
230
245
|
updatedAt: text(fields.updated),
|
|
231
246
|
labels,
|
|
232
247
|
body: adfText(fields.description),
|
|
233
248
|
authorId: idOrNull(fields.reporter?.accountId ?? fields.creator?.accountId),
|
|
249
|
+
authorLogin: null,
|
|
234
250
|
isContainer:
|
|
235
251
|
Number(type.hierarchyLevel ?? 0) > 0 ||
|
|
236
252
|
text(type.name).toLowerCase() === "epic" ||
|
|
@@ -265,6 +281,8 @@ export function normalizeLinearIssue(issue) {
|
|
|
265
281
|
ref: text(issue?.identifier),
|
|
266
282
|
title: text(issue?.title),
|
|
267
283
|
assigneeId: idOrNull(issue?.assignee?.id),
|
|
284
|
+
assigneeLogin: null,
|
|
285
|
+
assigneeAccountId: idOrNull(issue?.assignee?.id),
|
|
268
286
|
priorityRank:
|
|
269
287
|
Number.isInteger(native) && native >= 1 && native <= 4
|
|
270
288
|
? native - 1
|
|
@@ -274,6 +292,7 @@ export function normalizeLinearIssue(issue) {
|
|
|
274
292
|
labels,
|
|
275
293
|
body: text(issue?.description),
|
|
276
294
|
authorId: idOrNull(issue?.creator?.id),
|
|
295
|
+
authorLogin: null,
|
|
277
296
|
isContainer: children.some(
|
|
278
297
|
child => !LINEAR_FINISHED_STATE_TYPES.has(child?.state?.type)
|
|
279
298
|
),
|
|
@@ -285,32 +304,73 @@ export function normalizeLinearIssue(issue) {
|
|
|
285
304
|
* The one item shape every normalizer returns, in a fixed key order.
|
|
286
305
|
* `updatedAt` keys the backlog tier's validation cache; `openBlockers` counts
|
|
287
306
|
* dependencies whose blocker is not finished. The Ready tier ignores both.
|
|
288
|
-
*
|
|
307
|
+
* `assigneeLogin` / `authorLogin` are GitHub logins (null on trackers with
|
|
308
|
+
* none) and `assigneeAccountId` the assignee's account id, for kind-keyed
|
|
309
|
+
* entries (#4623).
|
|
310
|
+
* @param {{ ref: string, title: string, assigneeId: string | null, assigneeLogin: string | null, assigneeAccountId: string | null, priorityRank: number, createdAt: string, updatedAt: string, labels: string[], body: string, authorId: string | null, authorLogin: string | null, isContainer: boolean, openBlockers: number }} input
|
|
289
311
|
*/
|
|
290
312
|
function shape(input) {
|
|
291
313
|
return {
|
|
292
314
|
ref: input.ref,
|
|
293
315
|
title: input.title,
|
|
294
316
|
assigneeId: input.assigneeId,
|
|
317
|
+
assigneeLogin: input.assigneeLogin,
|
|
318
|
+
assigneeAccountId: input.assigneeAccountId,
|
|
295
319
|
priorityRank: input.priorityRank,
|
|
296
320
|
createdAt: input.createdAt,
|
|
297
321
|
updatedAt: input.updatedAt,
|
|
298
322
|
labels: input.labels,
|
|
299
323
|
body: input.body,
|
|
300
324
|
authorId: input.authorId,
|
|
325
|
+
authorLogin: input.authorLogin,
|
|
301
326
|
isContainer: input.isContainer,
|
|
302
327
|
openBlockers: input.openBlockers,
|
|
303
328
|
repoLabels: repoLabelsOf(input.labels),
|
|
304
329
|
};
|
|
305
330
|
}
|
|
306
331
|
|
|
332
|
+
/**
|
|
333
|
+
* Whether an operator entry names the item's assignee: a plain entry by the
|
|
334
|
+
* normalized assignee id, as before; `login:` by the assignee's GitHub login;
|
|
335
|
+
* `id:` by the assignee's account id.
|
|
336
|
+
* @param {Record<string, any>} item
|
|
337
|
+
* @param {ReturnType<typeof orderingContext>} context
|
|
338
|
+
* @returns {boolean}
|
|
339
|
+
*/
|
|
340
|
+
function isOperatorItem(item, context) {
|
|
341
|
+
const fields = {
|
|
342
|
+
plain: idOrNull(item.assigneeId),
|
|
343
|
+
login: idOrNull(item.assigneeLogin),
|
|
344
|
+
id: idOrNull(item.assigneeAccountId),
|
|
345
|
+
};
|
|
346
|
+
return context.operators.some(entry => entryMatches(entry, fields));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Whether a trusted-author entry names the item's author: a plain entry by
|
|
351
|
+
* the normalized author id, as before; `login:` by the author's GitHub login;
|
|
352
|
+
* `id:` by the author id (a GitHub numeric id, Jira accountId, Linear id).
|
|
353
|
+
* @param {Record<string, any>} item
|
|
354
|
+
* @param {ReturnType<typeof orderingContext>} context
|
|
355
|
+
* @returns {boolean}
|
|
356
|
+
*/
|
|
357
|
+
function isTrustedAuthor(item, context) {
|
|
358
|
+
const author = idOrNull(item.authorId);
|
|
359
|
+
const fields = {
|
|
360
|
+
plain: author,
|
|
361
|
+
login: idOrNull(item.authorLogin),
|
|
362
|
+
id: author,
|
|
363
|
+
};
|
|
364
|
+
return context.trusted.some(entry => entryMatches(entry, fields));
|
|
365
|
+
}
|
|
366
|
+
|
|
307
367
|
/**
|
|
308
368
|
* Why an item may not be dispatched, or null when it may.
|
|
309
369
|
*
|
|
310
370
|
* Order matters only for the reason reported: an item can fail several rules,
|
|
311
371
|
* and "someone else owns it" is the most useful thing to say about it.
|
|
312
372
|
* @param {Record<string, any>} item
|
|
313
|
-
* @param {
|
|
373
|
+
* @param {ReturnType<typeof orderingContext>} context
|
|
314
374
|
* @returns {string | null}
|
|
315
375
|
*/
|
|
316
376
|
function exclusionReason(item, context) {
|
|
@@ -318,7 +378,7 @@ function exclusionReason(item, context) {
|
|
|
318
378
|
if (
|
|
319
379
|
assignee !== null &&
|
|
320
380
|
assignee !== context.me &&
|
|
321
|
-
!context
|
|
381
|
+
!isOperatorItem(item, context)
|
|
322
382
|
) {
|
|
323
383
|
return "assigned-to-other";
|
|
324
384
|
}
|
|
@@ -334,10 +394,7 @@ function exclusionReason(item, context) {
|
|
|
334
394
|
) {
|
|
335
395
|
return "human-gated";
|
|
336
396
|
}
|
|
337
|
-
if (
|
|
338
|
-
context.trusted.size > 0 &&
|
|
339
|
-
!context.trusted.has(idOrNull(item.authorId))
|
|
340
|
-
) {
|
|
397
|
+
if (context.trusted.length > 0 && !isTrustedAuthor(item, context)) {
|
|
341
398
|
return "untrusted-author";
|
|
342
399
|
}
|
|
343
400
|
return null;
|
|
@@ -366,8 +423,10 @@ function compareWithinGroup(left, right) {
|
|
|
366
423
|
* `me` and no operators, every assigned item is someone else's — the safe
|
|
367
424
|
* direction, since claiming assigned work steals it.
|
|
368
425
|
*
|
|
369
|
-
* `operators`
|
|
370
|
-
* GitHub login, Jira accountId, Linear user id.
|
|
426
|
+
* A plain `operators` entry matches the way `me` does, against the
|
|
427
|
+
* normalized assignee id: GitHub login, Jira accountId, Linear user id. A
|
|
428
|
+
* `login:` entry matches only a GitHub assignee login, an `id:` entry only
|
|
429
|
+
* the assignee's account id (#4623).
|
|
371
430
|
* @param {readonly Record<string, any>[]} items - Normalized items
|
|
372
431
|
* @param {{ me?: string | null, operators?: readonly unknown[], trustedAuthorIds?: readonly unknown[], humanNeededLabel?: string }} [options]
|
|
373
432
|
* @returns {{ ordered: Record<string, any>[], excluded: { ref: string, reason: string }[] }}
|
|
@@ -411,6 +470,23 @@ export function orderBacklogQueue(items, options = {}) {
|
|
|
411
470
|
);
|
|
412
471
|
}
|
|
413
472
|
|
|
473
|
+
/**
|
|
474
|
+
* Parsed operator or trusted-author entries. A plain entry is trimmed and a
|
|
475
|
+
* blank one dropped, as before; an invalid kind-keyed entry is kept so it
|
|
476
|
+
* still counts as a configured filter while matching nobody.
|
|
477
|
+
* @param {readonly unknown[] | undefined} entries
|
|
478
|
+
* @returns {import("./operator-id-kinds.mjs").IdEntry[]}
|
|
479
|
+
*/
|
|
480
|
+
function configuredEntries(entries) {
|
|
481
|
+
return parseIdEntries(entries)
|
|
482
|
+
.map(entry =>
|
|
483
|
+
entry.kind === "plain"
|
|
484
|
+
? { ...entry, value: idOrNull(entry.value) }
|
|
485
|
+
: entry
|
|
486
|
+
)
|
|
487
|
+
.filter(entry => entry.kind !== "plain" || entry.value !== null);
|
|
488
|
+
}
|
|
489
|
+
|
|
414
490
|
/**
|
|
415
491
|
* The identities and policy every ordering judges against.
|
|
416
492
|
* @param {{ me?: string | null, operators?: readonly unknown[], trustedAuthorIds?: readonly unknown[], humanNeededLabel?: string }} options
|
|
@@ -418,10 +494,8 @@ export function orderBacklogQueue(items, options = {}) {
|
|
|
418
494
|
function orderingContext(options) {
|
|
419
495
|
return {
|
|
420
496
|
me: idOrNull(options.me),
|
|
421
|
-
operators:
|
|
422
|
-
trusted:
|
|
423
|
-
(options.trustedAuthorIds ?? []).map(idOrNull).filter(Boolean)
|
|
424
|
-
),
|
|
497
|
+
operators: configuredEntries(options.operators),
|
|
498
|
+
trusted: configuredEntries(options.trustedAuthorIds),
|
|
425
499
|
humanNeededLabel: options.humanNeededLabel ?? DEFAULT_HUMAN_NEEDED_LABEL,
|
|
426
500
|
};
|
|
427
501
|
}
|
|
@@ -441,7 +515,7 @@ function rank(items, judge, context) {
|
|
|
441
515
|
const group = item => {
|
|
442
516
|
const assignee = idOrNull(item.assigneeId);
|
|
443
517
|
if (assignee === null) return 2;
|
|
444
|
-
return context
|
|
518
|
+
return isOperatorItem(item, context) ? 0 : 1;
|
|
445
519
|
};
|
|
446
520
|
|
|
447
521
|
return {
|