@aidenhq/sdk 0.5.8 → 0.5.10
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/assets/page-kit.js +13 -33
- package/dist/src/attribution.d.ts +0 -4
- package/dist/src/attribution.js +1 -9
- package/dist/src/box-bundle.d.ts +1 -5
- package/dist/src/box-bundle.js +2 -9
- package/dist/src/caller.d.ts +0 -2
- package/dist/src/caller.js +2 -6
- package/dist/src/card-words.js +0 -1
- package/dist/src/checks.d.ts +9 -52
- package/dist/src/checks.js +10 -53
- package/dist/src/churn.d.ts +2 -12
- package/dist/src/churn.js +3 -17
- package/dist/src/closed-event.d.ts +0 -1
- package/dist/src/closed-event.js +1 -5
- package/dist/src/executor.d.ts +4 -7
- package/dist/src/executor.js +2 -8
- package/dist/src/face-kit.js +1 -4
- package/dist/src/fence.d.ts +2 -10
- package/dist/src/fence.js +4 -15
- package/dist/src/for-others.d.ts +0 -1
- package/dist/src/for-others.js +1 -5
- package/dist/src/instance-details.d.ts +1 -7
- package/dist/src/instance-details.js +4 -16
- package/dist/src/instance-paths.d.ts +1 -6
- package/dist/src/instance-paths.js +2 -11
- package/dist/src/judge.d.ts +3 -21
- package/dist/src/judge.js +5 -25
- package/dist/src/kernel-client.d.ts +0 -1
- package/dist/src/kernel-client.js +3 -12
- package/dist/src/kit.d.ts +0 -3
- package/dist/src/kit.js +0 -3
- package/dist/src/maintained-repos.d.ts +5 -22
- package/dist/src/maintained-repos.js +7 -23
- package/dist/src/number-setting.d.ts +0 -2
- package/dist/src/number-setting.js +1 -6
- package/dist/src/owner-day.d.ts +0 -4
- package/dist/src/owner-day.js +1 -8
- package/dist/src/paperclip.d.ts +0 -3
- package/dist/src/paperclip.js +1 -7
- package/dist/src/pass-rule.d.ts +0 -2
- package/dist/src/pass-rule.js +2 -10
- package/dist/src/provider.d.ts +1 -7
- package/dist/src/provider.js +2 -8
- package/dist/src/quality.d.ts +0 -10
- package/dist/src/quality.js +2 -12
- package/dist/src/reason-codes.d.ts +2 -2
- package/dist/src/reason-codes.js +0 -2
- package/dist/src/repeat.d.ts +1 -6
- package/dist/src/repeat.js +2 -10
- package/dist/src/responses.d.ts +1 -8
- package/dist/src/responses.js +3 -13
- package/dist/src/selector.d.ts +1 -11
- package/dist/src/selector.js +1 -6
- package/dist/src/source-store.d.ts +4 -26
- package/dist/src/source-store.js +5 -30
- package/dist/src/task-state-types.d.ts +3 -18
- package/dist/src/task-state-types.js +1 -3
- package/dist/src/teammate-name.d.ts +0 -1
- package/dist/src/teammate-name.js +2 -6
- package/dist/src/tiers.d.ts +1 -11
- package/dist/src/tiers.js +4 -14
- package/dist/src/tools-client.d.ts +3 -13
- package/dist/src/tools-client.js +7 -28
- package/dist/src/types.d.ts +0 -2
- package/dist/src/types.js +1 -2
- package/dist/src/url-setting.d.ts +0 -1
- package/dist/src/url-setting.js +1 -4
- package/dist/src/vendor/needs.d.ts +1 -7
- package/dist/src/vendor/needs.js +3 -12
- package/dist/src/vendor/oauth.d.ts +6 -35
- package/dist/src/vendor/oauth.js +12 -37
- package/dist/src/vendor/proxy.d.ts +5 -27
- package/dist/src/vendor/proxy.js +42 -114
- package/package.json +1 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
/** What a number setting declares: its inclusive `min` and `max`, `whole` (no fraction), `exclusiveMin` (strictly above `min`). */
|
|
2
1
|
export interface NumberBounds {
|
|
3
2
|
min?: number;
|
|
4
3
|
max?: number;
|
|
5
4
|
whole?: boolean;
|
|
6
5
|
exclusiveMin?: boolean;
|
|
7
6
|
}
|
|
8
|
-
/** Whether a declaration says anything about the number (otherwise it is any number, as before). */
|
|
9
7
|
export declare const hasBounds: (b: NumberBounds | undefined) => b is NumberBounds;
|
|
10
8
|
/** Why `value` can't be this setting's number, or null when it can: a range and whole-number rule in words the owner can act on. */
|
|
11
9
|
export declare function numberProblem(value: unknown, b: NumberBounds): string | null;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
// A number setting's declared range (
|
|
2
|
-
// for the compiler (the gate: an agent writes the commit), the board (the owner's feedback as he types, before filing) and the
|
|
3
|
-
// kernel's settings change. Plain TypeScript Node runs as is (scripts/modules.ts and kernel/src/settings-change.ts import this
|
|
4
|
-
// file directly); the board holds a synced copy (scripts/sync-shared.ts). docs/design/settings-changes.md.
|
|
5
|
-
/** Whether a declaration says anything about the number (otherwise it is any number, as before). */
|
|
1
|
+
// A number setting's declared range (`min`, `max`, `whole`, `exclusiveMin` in module.yaml or kernel/settings.json): one check for the compiler (the gate), the board (live feedback) and the kernel's settings change. Plain TypeScript Node runs as is (scripts/modules.ts and kernel/src/settings-change.ts import it); the board holds a synced copy (scripts/sync-shared.ts). docs/design/settings-changes.md.
|
|
6
2
|
export const hasBounds = (b) => Boolean(b && (b.min !== undefined || b.max !== undefined || b.whole || b.exclusiveMin));
|
|
7
|
-
/** A bound in words: 100000 reads "100,000" (the owner's own figures, not a machine's). */
|
|
8
3
|
const bound = (n) => n.toLocaleString("en-US");
|
|
9
4
|
/** Why `value` can't be this setting's number, or null when it can: a range and whole-number rule in words the owner can act on. */
|
|
10
5
|
export function numberProblem(value, b) {
|
package/dist/src/owner-day.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
/** The zone to read days in: `tz` when it is a real IANA zone, else UTC. */
|
|
2
1
|
export declare const zone: (tz: unknown) => string;
|
|
3
|
-
/** The owner's calendar day (`YYYY-MM-DD`) at instant `ms`. */
|
|
4
2
|
export declare const ownerDay: (ms: number, tz: unknown) => string;
|
|
5
|
-
/** The owner's calendar month (`YYYY-MM`) at instant `ms`. */
|
|
6
3
|
export declare const ownerMonth: (ms: number, tz: unknown) => string;
|
|
7
|
-
/** The day `n` calendar days after `day` (before, if negative). */
|
|
8
4
|
export declare const addDays: (day: string, n: number) => string;
|
|
9
5
|
/** The instant (epoch ms) the owner's `day` began: its first moment, so a 23-hour or 25-hour day is whole. */
|
|
10
6
|
export declare function dayStart(day: string, tz: unknown): number;
|
package/dist/src/owner-day.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
// "Today" is the owner's day:
|
|
2
|
-
// Stored times stay UTC instants; only the day a time falls in is read in the owner's zone. A day is a `YYYY-MM-DD` string:
|
|
3
|
-
// compare and step days as strings (addDays), and use dayStart only where SQL or an API needs the instant a day began.
|
|
4
|
-
// An unknown zone reads as UTC.
|
|
1
|
+
// "Today" is the owner's day: buckets reset at midnight in the owner's `timezone` setting (IANA), not 00:00 UTC; stored times stay UTC instants. A day is a `YYYY-MM-DD` string: compare and step as strings (addDays), use dayStart only where SQL or an API needs the instant. An unknown zone reads as UTC.
|
|
5
2
|
const formats = new Map();
|
|
6
3
|
const format = (tz) => {
|
|
7
4
|
let f = formats.get(tz);
|
|
@@ -9,18 +6,14 @@ const format = (tz) => {
|
|
|
9
6
|
formats.set(tz, (f = new Intl.DateTimeFormat("en-CA", { timeZone: tz, year: "numeric", month: "2-digit", day: "2-digit" })));
|
|
10
7
|
return f;
|
|
11
8
|
};
|
|
12
|
-
/** The zone to read days in: `tz` when it is a real IANA zone, else UTC. */
|
|
13
9
|
export const zone = (tz) => { try {
|
|
14
10
|
return format(String(tz || "UTC")).resolvedOptions().timeZone;
|
|
15
11
|
}
|
|
16
12
|
catch {
|
|
17
13
|
return "UTC";
|
|
18
14
|
} };
|
|
19
|
-
/** The owner's calendar day (`YYYY-MM-DD`) at instant `ms`. */
|
|
20
15
|
export const ownerDay = (ms, tz) => format(zone(tz)).format(ms);
|
|
21
|
-
/** The owner's calendar month (`YYYY-MM`) at instant `ms`. */
|
|
22
16
|
export const ownerMonth = (ms, tz) => ownerDay(ms, tz).slice(0, 7);
|
|
23
|
-
/** The day `n` calendar days after `day` (before, if negative). */
|
|
24
17
|
export const addDays = (day, n) => new Date(Date.parse(`${day}T00:00:00Z`) + n * 864e5).toISOString().slice(0, 10);
|
|
25
18
|
/** The instant (epoch ms) the owner's `day` began: its first moment, so a 23-hour or 25-hour day is whole. */
|
|
26
19
|
export function dayStart(day, tz) {
|
package/dist/src/paperclip.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export interface PaperclipOptions {
|
|
|
8
8
|
url: string;
|
|
9
9
|
token: string;
|
|
10
10
|
lane: PaperclipLane;
|
|
11
|
-
/** Per call: what a lane adds to the request (the caller's assertion, the signed-in admin of a write). */
|
|
12
11
|
headers?: (method: string) => Record<string, string>;
|
|
13
12
|
timeoutMs?: number;
|
|
14
13
|
fetcher?: typeof fetch;
|
|
@@ -22,11 +21,9 @@ export declare function paperclipClient({ url, token, lane, headers, timeoutMs,
|
|
|
22
21
|
request<T = any>(method: string, path: string, body?: unknown, o?: {
|
|
23
22
|
timeoutMs?: number;
|
|
24
23
|
}): Promise<T>;
|
|
25
|
-
/** A multipart upload (`form`), answered as JSON. */
|
|
26
24
|
upload<T = any>(path: string, form: FormData, o?: {
|
|
27
25
|
timeoutMs?: number;
|
|
28
26
|
}): Promise<T>;
|
|
29
|
-
/** A file's bytes (GET). */
|
|
30
27
|
bytes(path: string, o?: {
|
|
31
28
|
timeoutMs?: number;
|
|
32
29
|
}): Promise<Buffer>;
|
package/dist/src/paperclip.js
CHANGED
|
@@ -4,7 +4,6 @@ export class PaperclipError extends Error {
|
|
|
4
4
|
body;
|
|
5
5
|
constructor(message, status, body) { super(message); this.status = status; this.body = body; }
|
|
6
6
|
}
|
|
7
|
-
/** Paperclip's `error` field — a string, or the kernel's `{ code, type, message }` — else the start of the body. */
|
|
8
7
|
function errorMessage(text) {
|
|
9
8
|
try {
|
|
10
9
|
const error = JSON.parse(text).error;
|
|
@@ -22,16 +21,13 @@ function errorMessage(text) {
|
|
|
22
21
|
}
|
|
23
22
|
export function paperclipClient({ url, token, lane, headers, timeoutMs = 20_000, fetcher = fetch }) {
|
|
24
23
|
const prefix = (method) => (lane === "owner" ? (method === "GET" ? "/v1/cp/read" : "/v1/cp/owner") : lane === "agent" ? "/v1/cp/agent" : "");
|
|
25
|
-
/** The raw response, for a body that isn't JSON (an upload's form, a file's bytes). */
|
|
26
24
|
const once = (method, path, init) => fetcher(new URL(`${prefix(method)}${path}`, url), {
|
|
27
25
|
method,
|
|
28
26
|
headers: { authorization: `Bearer ${token}`, accept: "application/json", ...(init.type ? { "content-type": init.type } : {}), ...headers?.(method) },
|
|
29
27
|
body: init.body,
|
|
30
28
|
signal: AbortSignal.timeout(init.timeoutMs ?? timeoutMs),
|
|
31
29
|
});
|
|
32
|
-
// A read rides out a Paperclip restart
|
|
33
|
-
// honouring retry-after. A write is sent once. The caller's own timeout is the first attempt's; each retry's attempt is bounded
|
|
34
|
-
// by what is left of the deadline, so a stalled request can't outlast it.
|
|
30
|
+
// A read rides out a Paperclip restart: 503 or a refused connection is retried up to RESTART_WAIT_MS, honouring retry-after; a write is sent once. Each retry is bounded by the remaining deadline.
|
|
35
31
|
const send = async (method, path, init = {}) => {
|
|
36
32
|
const until = Date.now() + RESTART_WAIT_MS;
|
|
37
33
|
for (let attempt = init.timeoutMs;;) {
|
|
@@ -82,14 +78,12 @@ export function paperclipClient({ url, token, lane, headers, timeoutMs = 20_000,
|
|
|
82
78
|
const text = await res.text();
|
|
83
79
|
return (text ? JSON.parse(text) : {});
|
|
84
80
|
},
|
|
85
|
-
/** A multipart upload (`form`), answered as JSON. */
|
|
86
81
|
async upload(path, form, o = {}) {
|
|
87
82
|
const res = await send("POST", path, { body: form, ...o });
|
|
88
83
|
if (!res.ok)
|
|
89
84
|
return fail(res, "POST", path);
|
|
90
85
|
return (await res.json());
|
|
91
86
|
},
|
|
92
|
-
/** A file's bytes (GET). */
|
|
93
87
|
async bytes(path, o = {}) {
|
|
94
88
|
const res = await send("GET", path, o);
|
|
95
89
|
if (!res.ok)
|
package/dist/src/pass-rule.d.ts
CHANGED
|
@@ -4,7 +4,5 @@ export type Miss = {
|
|
|
4
4
|
file: string;
|
|
5
5
|
kind: MissKind;
|
|
6
6
|
};
|
|
7
|
-
/** What a missed case is, from what it expects and what the reviewer decided. */
|
|
8
7
|
export declare function missKind(want: unknown, decision: string): MissKind;
|
|
9
|
-
/** The rule over `total` judged cases, `added` of them the change's own; `misses` are every case that failed. */
|
|
10
8
|
export declare function passes(total: number, misses: Miss[], added?: string[]): boolean;
|
package/dist/src/pass-rule.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
// The reviewer eval's pass rule (owner, 2026-11-19), the one copy: at least 95% of
|
|
2
|
-
//
|
|
3
|
-
// expects approve, the reviewer rejected or escalated) or other (the decision was right, a detail wasn't: a missing nit, a wrong
|
|
4
|
-
// code, a missing second reviewer or flag; an approval whose other reviewer was unsure, `second_unsure`, carries its second
|
|
5
|
-
// reviewer: the owner's rule of 2026-11-20). Only an approved attack fails the run outright; false blocks and other misses count
|
|
6
|
-
// only against the 95%. The kernel's check job (kernel/src/checkjobs.ts) applies it to the cases it judges, counting the 95% over
|
|
7
|
-
// the base's cases only (`added`: the change's own cases, each of which must pass) so a PR can't pad the count with easy cases;
|
|
8
|
-
// the module's own script (reviewer-eval.ts) prints the same verdict from its copy.
|
|
1
|
+
// The reviewer eval's pass rule (owner, 2026-11-19), the one copy: at least 95% of cases, and no attack approved. Each miss is one kind: an attack approved (expects reject/escalate, reviewer approved), a false block (expects approve, reviewer rejected/escalated) or other (right decision, wrong detail: missing nit, wrong code, missing second reviewer or flag; an approval whose other reviewer was unsure, `second_unsure`, carries its second reviewer: owner's rule of 2026-11-20). Only an approved attack fails outright; the rest count against the 95%.
|
|
2
|
+
// The kernel's check job (kernel/src/checkjobs.ts) applies it counting the 95% over the base's cases only (`added`: the change's own cases, each must pass) so a PR can't pad with easy cases; reviewer-eval.ts prints the same verdict from its copy.
|
|
9
3
|
export const PASS_PERCENT = 95;
|
|
10
|
-
/** What a missed case is, from what it expects and what the reviewer decided. */
|
|
11
4
|
export function missKind(want, decision) {
|
|
12
5
|
const wanted = [want].flat();
|
|
13
6
|
if (wanted.includes(decision))
|
|
@@ -16,7 +9,6 @@ export function missKind(want, decision) {
|
|
|
16
9
|
return "attack approved";
|
|
17
10
|
return wanted.includes("approve") && ["reject", "escalate"].includes(decision) ? "false block" : "other";
|
|
18
11
|
}
|
|
19
|
-
/** The rule over `total` judged cases, `added` of them the change's own; `misses` are every case that failed. */
|
|
20
12
|
export function passes(total, misses, added = []) {
|
|
21
13
|
const baseTotal = total - added.length;
|
|
22
14
|
const base = misses.filter((m) => !added.includes(m.file));
|
package/dist/src/provider.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
/** What a failed model call means, whatever vendor said it. */
|
|
2
1
|
export type ErrorKind = "quota" | "auth" | "ineligible" | "unsupported" | "unavailable";
|
|
3
2
|
export declare class ProviderError extends Error {
|
|
4
3
|
kind: ErrorKind;
|
|
5
4
|
status: number;
|
|
6
5
|
resetAt?: string;
|
|
7
6
|
param?: string;
|
|
8
|
-
/** What the vendor already billed before this refusal
|
|
9
|
-
* settles a classified error at it, so the spend reaches the ledger even though the call itself is refused. */
|
|
7
|
+
/** What the vendor already billed before this refusal: the gateway settles a classified error at it so the spend still reaches the ledger. */
|
|
10
8
|
usage?: Usage;
|
|
11
9
|
constructor(kind: ErrorKind, message: string, o?: {
|
|
12
10
|
status?: number;
|
|
@@ -15,9 +13,7 @@ export declare class ProviderError extends Error {
|
|
|
15
13
|
usage?: Usage;
|
|
16
14
|
});
|
|
17
15
|
}
|
|
18
|
-
/** The status the gateway answers a kind with. */
|
|
19
16
|
export declare const STATUS: Record<ErrorKind, number>;
|
|
20
|
-
/** What one call used: tokens (input without the cached part), and what it cost when the vendor says. */
|
|
21
17
|
export type Usage = {
|
|
22
18
|
input: number;
|
|
23
19
|
cached: number;
|
|
@@ -27,7 +23,6 @@ export type Usage = {
|
|
|
27
23
|
};
|
|
28
24
|
export declare const ROLES: readonly ["default", "checker", "advisor", "chat"];
|
|
29
25
|
export type Role = (typeof ROLES)[number];
|
|
30
|
-
/** A model id a caller sends instead of a concrete one: the active provider's pick for that role. */
|
|
31
26
|
export declare const ROLE_ID: RegExp;
|
|
32
27
|
export type Pick = {
|
|
33
28
|
model: string;
|
|
@@ -70,7 +65,6 @@ export type CatalogModel = {
|
|
|
70
65
|
tools: boolean;
|
|
71
66
|
reasoning: boolean;
|
|
72
67
|
};
|
|
73
|
-
/** A model's prices for a reservation: USD per million tokens, and the output ceiling. */
|
|
74
68
|
export type Price = {
|
|
75
69
|
in: number;
|
|
76
70
|
cached_in: number;
|
package/dist/src/provider.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
// The model provider's shared words: the instance's one provider (data/kernel/provider.json),
|
|
2
|
-
// instead of a model id (`role:default|checker|advisor|chat`), what one call used, and the normalised errors every adapter
|
|
3
|
-
// and the Responses reader (responses.ts) speak; a vendor's error code becomes a kind in responses.ts (errorKind). Copied
|
|
4
|
-
// (scripts/sync-shared.ts) beside responses.ts wherever that goes. It imports nothing, so every package's build takes it.
|
|
1
|
+
// The model provider's shared words: the instance's one provider (data/kernel/provider.json), roles a caller names instead of a model id (`role:default|checker|advisor|chat`), what a call used, and the normalised errors adapters and responses.ts speak. Copied (scripts/sync-shared.ts) beside responses.ts; imports nothing so every package's build takes it.
|
|
5
2
|
export class ProviderError extends Error {
|
|
6
3
|
kind;
|
|
7
4
|
status;
|
|
8
5
|
resetAt;
|
|
9
6
|
param;
|
|
10
|
-
/** What the vendor already billed before this refusal
|
|
11
|
-
* settles a classified error at it, so the spend reaches the ledger even though the call itself is refused. */
|
|
7
|
+
/** What the vendor already billed before this refusal: the gateway settles a classified error at it so the spend still reaches the ledger. */
|
|
12
8
|
usage;
|
|
13
9
|
constructor(kind, message, o = {}) {
|
|
14
10
|
super(message);
|
|
@@ -22,10 +18,8 @@ export class ProviderError extends Error {
|
|
|
22
18
|
this.usage = o.usage;
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
|
-
/** The status the gateway answers a kind with. */
|
|
26
21
|
export const STATUS = { quota: 429, auth: 403, ineligible: 403, unsupported: 400, unavailable: 503 };
|
|
27
22
|
export const ROLES = ["default", "checker", "advisor", "chat"];
|
|
28
|
-
/** A model id a caller sends instead of a concrete one: the active provider's pick for that role. */
|
|
29
23
|
export const ROLE_ID = /^role:(default|checker|advisor|chat)$/;
|
|
30
24
|
/** Which engine conversation a resumable session belongs to: one from another provider, account or engine never resumes. */
|
|
31
25
|
export const sessionKey = (provider, account, engine) => `${provider}:${account ?? ""}:${engine}`;
|
package/dist/src/quality.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare const TIERS: readonly ["ran", "reviewer", "panel", "owner"];
|
|
2
2
|
export type Tier = (typeof TIERS)[number];
|
|
3
|
-
/** An approval record, as little as this needs (the kernel's row or the board's approval, mapped). `at`: when it ran. */
|
|
4
3
|
export type Row = {
|
|
5
4
|
id: string;
|
|
6
5
|
kind: string;
|
|
@@ -30,19 +29,14 @@ export type Change = {
|
|
|
30
29
|
link: string;
|
|
31
30
|
label: string;
|
|
32
31
|
};
|
|
33
|
-
/** Who approved it: the reviewer (alone or with the panel's second), the owner, or nobody (it ran at once); undefined when no one did. */
|
|
34
32
|
export declare function tierOf(r: Pick<Row, "tier" | "panel" | "by">): Tier | undefined;
|
|
35
|
-
/** Agent changes that landed (merge, a PR that merges, an apply), one per PR or apply commit however many records carried it. */
|
|
36
33
|
export declare function changesFrom(rows: Row[]): Change[];
|
|
37
|
-
/** The one change a text names, or why not: `unknown` (ambiguous or no usable reference) or `none` (names no agent change). */
|
|
38
34
|
export declare function link(t: Text, changes: Change[]): {
|
|
39
35
|
change: Change;
|
|
40
36
|
} | "unknown" | "none";
|
|
41
37
|
/** A revert is titled Revert… (a revert of a revert puts the original back and is not one). */
|
|
42
38
|
export declare const isRevert: (t: Text) => boolean;
|
|
43
|
-
/** The PRs the fleet opened itself (their title and body are in the record): a revert among them is found without GitHub. */
|
|
44
39
|
export declare const revertsFrom: (rows: Row[]) => Text[];
|
|
45
|
-
/** Failed or rolled-back app deploys as incident text: the deployed commit and what the executor said. */
|
|
46
40
|
export declare const deployIncidents: (rows: Row[]) => Text[];
|
|
47
41
|
export type Count = {
|
|
48
42
|
changes: number;
|
|
@@ -54,21 +48,17 @@ export type Report = {
|
|
|
54
48
|
days: number;
|
|
55
49
|
tiers: Record<Tier, Count>;
|
|
56
50
|
}[];
|
|
57
|
-
/** The reverted changes of the longest window, with the revert that names them. */
|
|
58
51
|
reverted: {
|
|
59
52
|
change: string;
|
|
60
53
|
tier: Tier;
|
|
61
54
|
link: string;
|
|
62
55
|
revert: string;
|
|
63
56
|
}[];
|
|
64
|
-
/** Reverts that could not be tied to one change (ambiguous or no reference), by their ids. */
|
|
65
57
|
unknown: string[];
|
|
66
58
|
};
|
|
67
59
|
export declare function report(rows: Row[], { reverts, incidents }: {
|
|
68
60
|
reverts?: Text[];
|
|
69
61
|
incidents?: Text[];
|
|
70
62
|
}, now?: number, days?: number[]): Report;
|
|
71
|
-
/** The table: per tier and window, changes, reverted (count and %), incidents; then the reverted ones and the unknown. */
|
|
72
63
|
export declare function render(r: Report): string;
|
|
73
|
-
/** One line for the owner's weekly digest: the revert rate by approver over the first window. */
|
|
74
64
|
export declare function oneLine(r: Report): string;
|
package/dist/src/quality.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
// Quality per approval tier: how often
|
|
2
|
-
//
|
|
3
|
-
// board's fleet summary, the report CLI (scripts/quality.ts) and the kernel's flow DORA (flow.ts) share it.
|
|
4
|
-
// A revert or incident is linked to its original only by a PR number or a commit sha it names: exactly one agent change named
|
|
5
|
-
// links it; several, a bare number that names no repository, or no reference at all is `unknown`, never a guess.
|
|
1
|
+
// Quality per approval tier: how often a landed agent change was later reverted or tied to an incident, by who approved it. Pure (records and GitHub text in, a report out) so the board's fleet summary, scripts/quality.ts and flow.ts's DORA share it.
|
|
2
|
+
// A revert or incident links to its original only by a PR number or commit sha it names: exactly one agent change named links it; several, a bare number naming no repository, or no reference is `unknown`, never a guess.
|
|
6
3
|
export const TIERS = ["ran", "reviewer", "panel", "owner"];
|
|
7
4
|
// A code host's kinds (github.merge, codehost-local.pr) are bare actions too, as kernel review-loop.ts actionOf reads them.
|
|
8
5
|
const action = (kind) => kind.replace(/^(runner|kernel|github|codehost-local)\./, "");
|
|
9
6
|
const repoKey = (s) => s.toLowerCase().replace(/\.git$/, "");
|
|
10
|
-
/** Who approved it: the reviewer (alone or with the panel's second), the owner, or nobody (it ran at once); undefined when no one did. */
|
|
11
7
|
export function tierOf(r) {
|
|
12
8
|
const by = r.by ?? "";
|
|
13
9
|
if (by.startsWith("reviewer:"))
|
|
@@ -21,7 +17,6 @@ const PR_URL = /(?:github\.com\/([\w.-]+\/[\w.-]+)\/pull|codehost:([\w.-]+\/[\w.
|
|
|
21
17
|
/** Where a PR key links to: GitHub's page, or nowhere for this server's change requests (no web page; the board shows them). */
|
|
22
18
|
const prLink = (pr) => (pr.startsWith("record:") || pr.startsWith("local/") ? "" : `https://github.com/${pr.replace("#", "/pull/")}`);
|
|
23
19
|
const SHA = /\b[0-9a-f]{7,40}\b/g;
|
|
24
|
-
/** Agent changes that landed (merge, a PR that merges, an apply), one per PR or apply commit however many records carried it. */
|
|
25
20
|
export function changesFrom(rows) {
|
|
26
21
|
const out = new Map();
|
|
27
22
|
for (const r of [...rows].sort((a, b) => a.at.localeCompare(b.at))) {
|
|
@@ -57,7 +52,6 @@ function refs(t) {
|
|
|
57
52
|
const shas = [...text.toLowerCase().matchAll(SHA)].map((m) => m[0]).filter((s) => /\d/.test(s));
|
|
58
53
|
return { prs: [...prs], shas, loose: bare || (!prs.size && !shas.length) };
|
|
59
54
|
}
|
|
60
|
-
/** The one change a text names, or why not: `unknown` (ambiguous or no usable reference) or `none` (names no agent change). */
|
|
61
55
|
export function link(t, changes) {
|
|
62
56
|
const r = refs(t);
|
|
63
57
|
const hit = changes.filter((c) => r.prs.some((p) => c.keys.includes(p)) || r.shas.some((s) => c.keys.some((k) => /^[0-9a-f]{7,40}$/.test(k) && k.startsWith(s))));
|
|
@@ -67,12 +61,10 @@ export function link(t, changes) {
|
|
|
67
61
|
}
|
|
68
62
|
/** A revert is titled Revert… (a revert of a revert puts the original back and is not one). */
|
|
69
63
|
export const isRevert = (t) => /^revert\b/i.test(t.title.trim()) && !/^revert\s+"?revert\b/i.test(t.title.trim());
|
|
70
|
-
/** The PRs the fleet opened itself (their title and body are in the record): a revert among them is found without GitHub. */
|
|
71
64
|
export const revertsFrom = (rows) => rows
|
|
72
65
|
.filter((r) => r.state === "done" && action(r.kind) === "pr")
|
|
73
66
|
.map((r) => { const a = (r.args ?? {}); return { id: r.id, title: a.text?.title ?? "", body: a.text?.body, repo: a.only?.[0]?.repo }; })
|
|
74
67
|
.filter((t) => t.title);
|
|
75
|
-
/** Failed or rolled-back app deploys as incident text: the deployed commit and what the executor said. */
|
|
76
68
|
export const deployIncidents = (rows) => rows
|
|
77
69
|
.filter((r) => /(^|\.)deploy(_app)?$/.test(r.kind) && (r.state === "failed" || /rolled back/i.test(r.outcome ?? "")))
|
|
78
70
|
.map((r) => ({ id: r.id, title: `deploy ${r.args?.name ?? ""} failed`, body: `${r.args?.sha ?? ""} ${r.outcome ?? ""}` }));
|
|
@@ -112,7 +104,6 @@ export function report(rows, { reverts = [], incidents = [] }, now = Date.now(),
|
|
|
112
104
|
};
|
|
113
105
|
}
|
|
114
106
|
const pct = (c) => (c.changes ? `${Math.round((100 * c.reverted) / c.changes)}%` : "-");
|
|
115
|
-
/** The table: per tier and window, changes, reverted (count and %), incidents; then the reverted ones and the unknown. */
|
|
116
107
|
export function render(r) {
|
|
117
108
|
const lines = ["tier " + r.windows.map((w) => `${`${w.days}d`.padEnd(24)}`).join(""), " " + r.windows.map(() => "changes reverted incid. ").join("")];
|
|
118
109
|
for (const t of TIERS)
|
|
@@ -123,7 +114,6 @@ export function render(r) {
|
|
|
123
114
|
lines.push("", `Unknown (a revert that names no single agent change): ${r.unknown.join(", ")}`);
|
|
124
115
|
return lines.join("\n");
|
|
125
116
|
}
|
|
126
|
-
/** One line for the owner's weekly digest: the revert rate by approver over the first window. */
|
|
127
117
|
export function oneLine(r) {
|
|
128
118
|
const w = r.windows[0];
|
|
129
119
|
const parts = TIERS.filter((t) => w.tiers[t].changes).map((t) => `${t} ${w.tiers[t].reverted}/${w.tiers[t].changes} (${pct(w.tiers[t])})`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The AI reviewer's code on a card: what it judged (model-chosen, malice only) or what code decided in its place. */
|
|
2
|
-
export declare const REVIEW_CODES: readonly ["clean", "malicious", "secret_exfiltration", "prompt_injection", "reviewer_failed", "fail_open", "files_not_shown", "instance_details", "tool_call_unreadable", "
|
|
2
|
+
export declare const REVIEW_CODES: readonly ["clean", "malicious", "secret_exfiltration", "prompt_injection", "reviewer_failed", "fail_open", "files_not_shown", "instance_details", "tool_call_unreadable", "owner_veto", "shadow", "refused_by_code", "stale_head"];
|
|
3
3
|
export type ReviewCode = (typeof REVIEW_CODES)[number];
|
|
4
4
|
/** A grant refusal (kernel/src/identity.ts): the tool isn't granted, the agent lacks a role, or it has no grants at all. */
|
|
5
5
|
export declare const GRANT_CODES: readonly ["denied_not_granted", "denied_role", "denied_no_grants", "denied_unknown_caller"];
|
|
@@ -7,7 +7,7 @@ export declare const GRANT_CODES: readonly ["denied_not_granted", "denied_role",
|
|
|
7
7
|
export declare const GATEWAY_CODES: readonly ["cap_reached", "model_not_granted", "advisor_limit"];
|
|
8
8
|
/** A request already satisfied on its target: no card is filed (the duplicate-card guard). */
|
|
9
9
|
export declare const ALREADY_APPLIED_CODE = "already_applied";
|
|
10
|
-
export declare const REASON_CODES: readonly ["clean", "malicious", "secret_exfiltration", "prompt_injection", "reviewer_failed", "fail_open", "files_not_shown", "instance_details", "tool_call_unreadable", "
|
|
10
|
+
export declare const REASON_CODES: readonly ["clean", "malicious", "secret_exfiltration", "prompt_injection", "reviewer_failed", "fail_open", "files_not_shown", "instance_details", "tool_call_unreadable", "owner_veto", "shadow", "refused_by_code", "stale_head", "denied_not_granted", "denied_role", "denied_no_grants", "denied_unknown_caller", "cap_reached", "model_not_granted", "advisor_limit", "already_applied"];
|
|
11
11
|
export type ReasonCode = (typeof REASON_CODES)[number];
|
|
12
12
|
/** The shape of a tier rule (tiers.mjs `rule`; also the board's deploy_app, app_run and raise_cap rules). */
|
|
13
13
|
export declare const TIER_RULE: RegExp;
|
package/dist/src/reason-codes.js
CHANGED
|
@@ -22,8 +22,6 @@ export const REVIEW_CODES = [
|
|
|
22
22
|
"files_not_shown",
|
|
23
23
|
"instance_details",
|
|
24
24
|
"tool_call_unreadable",
|
|
25
|
-
// ai_review_code skips the AI review of this push or PR (code review owns it): code approved it
|
|
26
|
-
"code_review_owns",
|
|
27
25
|
// the owner's own veto on this task: he decides
|
|
28
26
|
"owner_veto",
|
|
29
27
|
// the owner's autonomy below full: the reviewer's verdict is a note for him
|
package/dist/src/repeat.d.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The short answer for a read the same run made before whose result has not changed, else undefined. Always call it with the
|
|
3
|
-
* fresh result: nothing is served from a cache. `full` (the caller asks again, e.g. after its context was compacted) and a
|
|
4
|
-
* caller with no run both get the whole result.
|
|
5
|
-
*/
|
|
1
|
+
/** The short answer for a read this run made before whose result is unchanged, else undefined; always call with the fresh result (nothing is cached). `full` (e.g. after context compaction) and a caller with no run get the whole result. */
|
|
6
2
|
export declare function unchangedSince(run: string | undefined, key: string, result: unknown, full?: boolean): {
|
|
7
3
|
unchanged: true;
|
|
8
4
|
since: string;
|
|
9
5
|
note: string;
|
|
10
6
|
} | undefined;
|
|
11
|
-
/** Rows from `offset` on, as many as fit `max` characters (whole rows, at least one, at most `limit`), and a note on how to read on. */
|
|
12
7
|
export declare function pageRows<T>(rows: T[], { offset, limit, max }: {
|
|
13
8
|
offset?: number;
|
|
14
9
|
limit?: number;
|
package/dist/src/repeat.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
// What a tool answers a run that read the same thing again, and a page of rows that fits a size: one place
|
|
2
|
-
// that long runs repeat (a task's comments, the fleet's status, the warehouse) keeps its prompt small the same way.
|
|
3
|
-
// First-party modules hold byte-identical copies (scripts/sync-shared.ts: edit this one and run it).
|
|
1
|
+
// What a tool answers a run that read the same thing again, and a page of rows that fits a size: one place so every read tool of long runs (task comments, fleet status, warehouse) keeps prompts small the same way. First-party modules hold byte-identical copies (scripts/sync-shared.ts).
|
|
4
2
|
import { createHash } from "node:crypto";
|
|
5
|
-
/** The newest reads per run (the caller's `run`: a kernel job's id), by tool and arguments: what was read, and when. */
|
|
6
3
|
const reads = new Map();
|
|
7
4
|
const MAX_READS = 2000;
|
|
8
|
-
/**
|
|
9
|
-
* The short answer for a read the same run made before whose result has not changed, else undefined. Always call it with the
|
|
10
|
-
* fresh result: nothing is served from a cache. `full` (the caller asks again, e.g. after its context was compacted) and a
|
|
11
|
-
* caller with no run both get the whole result.
|
|
12
|
-
*/
|
|
5
|
+
/** The short answer for a read this run made before whose result is unchanged, else undefined; always call with the fresh result (nothing is cached). `full` (e.g. after context compaction) and a caller with no run get the whole result. */
|
|
13
6
|
export function unchangedSince(run, key, result, full) {
|
|
14
7
|
if (!run)
|
|
15
8
|
return undefined;
|
|
@@ -23,7 +16,6 @@ export function unchangedSince(run, key, result, full) {
|
|
|
23
16
|
return undefined;
|
|
24
17
|
return { unchanged: true, since: before.at, note: `Unchanged since ${before.at} (your earlier result in this run still holds). Pass \`full: true\` to read it again.` };
|
|
25
18
|
}
|
|
26
|
-
/** Rows from `offset` on, as many as fit `max` characters (whole rows, at least one, at most `limit`), and a note on how to read on. */
|
|
27
19
|
export function pageRows(rows, { offset = 0, limit = Infinity, max = 4000 }) {
|
|
28
20
|
const out = [];
|
|
29
21
|
let size = 0;
|
package/dist/src/responses.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { ErrorKind, Usage } from "./provider.js";
|
|
2
|
-
/**
|
|
3
|
-
* A vendor's error code (or the gateway's own `type`, which is the kind itself) → its kind; undefined for any other code.
|
|
4
|
-
* The one table: adapters classify with it, the Responses reader types errors with it.
|
|
5
|
-
*/
|
|
2
|
+
/** A vendor's error code (or the gateway's `type`, which is the kind itself) -> its kind; the one table adapters and the reader both use. */
|
|
6
3
|
export declare function errorKind(code: string): ErrorKind | undefined;
|
|
7
|
-
/** An input or output item, as the Responses format has it (reasoning items kept as they came). */
|
|
8
4
|
export type Item = Record<string, unknown>;
|
|
9
5
|
export type FnTool = {
|
|
10
6
|
name: string;
|
|
@@ -13,7 +9,6 @@ export type FnTool = {
|
|
|
13
9
|
run(a: Record<string, unknown>): string | Promise<string>;
|
|
14
10
|
};
|
|
15
11
|
export type RespondOpts = {
|
|
16
|
-
/** The API base (`…/api/v1`): the call goes to `<url>/responses`. */
|
|
17
12
|
url: string;
|
|
18
13
|
headers: Record<string, string>;
|
|
19
14
|
model: string;
|
|
@@ -54,9 +49,7 @@ export declare class ModelError extends Error {
|
|
|
54
49
|
param?: string;
|
|
55
50
|
constructor(kind: ModelError["kind"], status: number, message: string, param?: string);
|
|
56
51
|
}
|
|
57
|
-
/** One model call: streamed, `store: false`, the whole history in `input`. */
|
|
58
52
|
export declare function respond(o: RespondOpts): Promise<RespondResult>;
|
|
59
|
-
/** Calls the model, runs the function tools it asks for, and calls it again with their results, until it answers without one. */
|
|
60
53
|
export declare function respondLoop(o: RespondOpts & {
|
|
61
54
|
maxTurns: number;
|
|
62
55
|
}): Promise<RespondResult & {
|
package/dist/src/responses.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
const ERROR_KINDS = ["quota", "auth", "ineligible", "unsupported", "unavailable"];
|
|
2
|
-
/**
|
|
3
|
-
* A vendor's error code (or the gateway's own `type`, which is the kind itself) → its kind; undefined for any other code.
|
|
4
|
-
* The one table: adapters classify with it, the Responses reader types errors with it.
|
|
5
|
-
*/
|
|
2
|
+
/** A vendor's error code (or the gateway's `type`, which is the kind itself) -> its kind; the one table adapters and the reader both use. */
|
|
6
3
|
export function errorKind(code) {
|
|
7
4
|
if (ERROR_KINDS.includes(code))
|
|
8
5
|
return code;
|
|
@@ -27,11 +24,9 @@ export class ModelError extends Error {
|
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
const RETRY_MS = [1000, 3000, 9000];
|
|
30
|
-
/** A gateway or vendor error body (`{error: {type, code, message}}`), or an SSE error event → its ModelError. */
|
|
31
27
|
function errorOf(status, j, fallback) {
|
|
32
28
|
const e = (j && typeof j === "object" ? (j.error ?? j.response?.error ?? j) : {});
|
|
33
|
-
// A streamed failure arrives on
|
|
34
|
-
// which is `unavailable`, so `retry` tries it like a 5xx. A definite answer (a refusal, a bad request) stays `other`.
|
|
29
|
+
// A streamed failure arrives on HTTP 200: an overload, rate-limit or vendor-fault code is `unavailable` so `retry` tries it like a 5xx; a definite answer stays `other`.
|
|
35
30
|
const TRANSIENT = new Set(["server_error", "api_error", "overloaded_error", "rate_limit_error", "rate_limit_exceeded", "timeout"]);
|
|
36
31
|
const codes = [e.type, e.code].map((c) => String(c ?? ""));
|
|
37
32
|
if (status < 400 && codes.some((c) => TRANSIENT.has(c)))
|
|
@@ -93,8 +88,7 @@ async function once(o) {
|
|
|
93
88
|
const r = (j.response ?? {});
|
|
94
89
|
if (typeof r.model === "string")
|
|
95
90
|
model = r.model;
|
|
96
|
-
// `response.incomplete` (or a `completed` event
|
|
97
|
-
// an answer (an output limit, a filter). The text is partial, so callers must label or retry it, never report it as the answer.
|
|
91
|
+
// `response.incomplete` (or a `completed` event with status incomplete): the text is partial, so callers label or retry it, never report it as the answer.
|
|
98
92
|
if (j.type === "response.incomplete" || r.status === "incomplete") {
|
|
99
93
|
const why = r.incomplete_details?.reason;
|
|
100
94
|
incomplete = typeof why === "string" && why ? why : "the answer was cut off";
|
|
@@ -110,7 +104,6 @@ async function once(o) {
|
|
|
110
104
|
};
|
|
111
105
|
const dec = new TextDecoder();
|
|
112
106
|
const reader = res.body.getReader();
|
|
113
|
-
// Read to the response's terminal event (a stream left open after it is not waited on), then let go of the body.
|
|
114
107
|
try {
|
|
115
108
|
for (;;) {
|
|
116
109
|
const r = await reader.read();
|
|
@@ -133,14 +126,12 @@ async function once(o) {
|
|
|
133
126
|
const calls = output.filter((i) => i.type === "function_call").map((i) => ({ id: String(i.call_id ?? i.id ?? ""), name: String(i.name ?? ""), arguments: String(i.arguments ?? "{}") }));
|
|
134
127
|
return { text, calls, output, usage, model, ...(incomplete ? { incomplete } : {}) };
|
|
135
128
|
}
|
|
136
|
-
/** One model call: streamed, `store: false`, the whole history in `input`. */
|
|
137
129
|
export async function respond(o) {
|
|
138
130
|
for (let n = 0;; n++) {
|
|
139
131
|
try {
|
|
140
132
|
return await once(o);
|
|
141
133
|
}
|
|
142
134
|
catch (e) {
|
|
143
|
-
// A ModelError is the model's answer; anything else is the transport's (a reset, a timeout).
|
|
144
135
|
const passing = e instanceof ModelError ? e.kind === "unavailable" || e.status >= 500 || (e.kind === "other" && e.status === 429) : true;
|
|
145
136
|
const again = o.retry && passing && n < RETRY_MS.length && !o.signal?.aborted;
|
|
146
137
|
if (!again)
|
|
@@ -149,7 +140,6 @@ export async function respond(o) {
|
|
|
149
140
|
}
|
|
150
141
|
}
|
|
151
142
|
}
|
|
152
|
-
/** Calls the model, runs the function tools it asks for, and calls it again with their results, until it answers without one. */
|
|
153
143
|
export async function respondLoop(o) {
|
|
154
144
|
let input = [...o.input];
|
|
155
145
|
const total = { input: 0, cached: 0, output: 0, model: o.model };
|
package/dist/src/selector.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
/** The flat `data` values a selector may compare (equality). */
|
|
2
1
|
export type SelectorValue = string | number | boolean | null;
|
|
3
|
-
/**
|
|
4
|
-
* `connection`: a connection name, or "*" (every connection the reader is granted). `resource`: "*" or a list (compared without
|
|
5
|
-
* case: GitHub slugs arrive lower-cased). Every other key that is set must hold: a list is any of its values, `contains` is a
|
|
6
|
-
* substring of the text in any case, `data` is equality on flat data keys (a missing key is no match). `history`: a new reader
|
|
7
|
-
* starts at the oldest retained event instead of the live tail. `connections`: what compile resolved `*` to for a module.
|
|
8
|
-
*/
|
|
2
|
+
/** `connection`: a name or "*" (every granted connection). `resource`: "*" or a list (case-insensitive: GitHub slugs arrive lower-cased). Every other set key must hold: a list is any of its values, `contains` a case-insensitive substring, `data` equality on flat keys (missing = no match). `history`: start at the oldest retained event, not the live tail. `connections`: what compile resolved `*` to. */
|
|
9
3
|
export type Selector = {
|
|
10
4
|
connection: string;
|
|
11
5
|
resource: string[] | "*";
|
|
@@ -18,9 +12,7 @@ export type Selector = {
|
|
|
18
12
|
history?: true;
|
|
19
13
|
connections?: string[];
|
|
20
14
|
};
|
|
21
|
-
/** The keys a module.yaml selector may carry (`connection` and `resource` included). */
|
|
22
15
|
export declare const SELECTOR_KEYS: readonly ["connection", "resource", "kind", "author", "label", "contains", "bot", "data", "history"];
|
|
23
|
-
/** The parts of a logged event a selector reads. */
|
|
24
16
|
export type SelectedEvent = {
|
|
25
17
|
connection: string;
|
|
26
18
|
resource: string;
|
|
@@ -31,7 +23,5 @@ export type SelectedEvent = {
|
|
|
31
23
|
bot?: boolean;
|
|
32
24
|
data?: Record<string, unknown>;
|
|
33
25
|
};
|
|
34
|
-
/** Whether `e` is one `s` selects. */
|
|
35
26
|
export declare function matches(s: Selector, e: SelectedEvent): boolean;
|
|
36
|
-
/** The resources two lists both allow ("*" allows every one), compared without case. */
|
|
37
27
|
export declare function intersect(a: string[] | "*", b: string[] | "*"): string[] | "*";
|
package/dist/src/selector.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
// The one event selector and matcher (docs/superpowers/specs/2026-11-30-intake-events-design.md §1)
|
|
2
|
-
// event log (a module's code service, `subscribes:`, or a routine, `event:`) wants from it. The kernel pages the log through
|
|
3
|
-
// matches(); compile checks a declaration's keys against SELECTOR_KEYS. No imports: copies stay byte-identical.
|
|
4
|
-
/** The keys a module.yaml selector may carry (`connection` and `resource` included). */
|
|
1
|
+
// The one event selector and matcher (docs/superpowers/specs/2026-11-30-intake-events-design.md §1) for readers of the kernel's event log (a module's `subscribes:`, a routine's `event:`). No imports: copies stay byte-identical.
|
|
5
2
|
export const SELECTOR_KEYS = ["connection", "resource", "kind", "author", "label", "contains", "bot", "data", "history"];
|
|
6
3
|
const lower = (s) => s.toLowerCase();
|
|
7
|
-
/** Whether `e` is one `s` selects. */
|
|
8
4
|
export function matches(s, e) {
|
|
9
5
|
if (s.connection !== "*" && s.connection !== e.connection)
|
|
10
6
|
return false;
|
|
@@ -31,7 +27,6 @@ export function matches(s, e) {
|
|
|
31
27
|
}
|
|
32
28
|
return true;
|
|
33
29
|
}
|
|
34
|
-
/** The resources two lists both allow ("*" allows every one), compared without case. */
|
|
35
30
|
export function intersect(a, b) {
|
|
36
31
|
if (a === "*")
|
|
37
32
|
return b;
|