@andares/pi-toolkits 1.2.4 → 1.3.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/CHANGELOG.md +15 -0
- package/README.md +39 -20
- package/README.zh-CN.md +30 -16
- package/package.json +5 -5
- package/src/features/autostart/autostart.ts +1 -1
- package/src/features/autostart/index.ts +2 -2
- package/src/features/compact/index.ts +1 -1
- package/src/features/favorites/constants.ts +2 -2
- package/src/features/favorites/patch-cycle.ts +4 -3
- package/src/features/favorites/patch-selector.ts +1 -1
- package/src/features/permission/policy.test.ts +11 -0
- package/src/features/permission/units.test.ts +168 -6
- package/src/features/permission/units.ts +441 -34
- package/src/features/spec/index.test.ts +184 -8
- package/src/features/spec/index.ts +136 -24
- package/src/features/spec/prompt.test.ts +20 -0
- package/src/features/spec/prompt.ts +46 -0
- package/src/features/stash/stash.ts +2 -2
- package/src/features/uat/assets/index-CPTHXggT.js +1 -0
- package/src/features/uat/assets/index-D9S_sCVr.css +1 -0
- package/src/features/uat/assets/index.html +3 -3
- package/src/features/uat/index.test.ts +96 -3
- package/src/features/uat/index.ts +42 -12
- package/src/features/uat/item-tool.ts +36 -8
- package/src/features/uat/ledger.test.ts +170 -14
- package/src/features/uat/ledger.ts +127 -44
- package/src/features/uat/prompt.ts +41 -8
- package/src/features/uat/records.test.ts +14 -0
- package/src/features/uat/records.ts +13 -1
- package/src/lib/gates.ts +3 -3
- package/src/features/uat/assets/index-D-W9zj0w.css +0 -1
- package/src/features/uat/assets/index-DCBQCsli.js +0 -1
|
@@ -100,7 +100,10 @@ export interface MergeEvent extends BaseEvent {
|
|
|
100
100
|
|
|
101
101
|
export interface DropEvent extends BaseEvent {
|
|
102
102
|
readonly type: "drop";
|
|
103
|
-
|
|
103
|
+
/** Item to retire. Optional: a drop may retire records without an item. */
|
|
104
|
+
readonly item?: string;
|
|
105
|
+
/** Records retired directly (no item is created for them). */
|
|
106
|
+
readonly reports?: string[];
|
|
104
107
|
readonly reason?: string;
|
|
105
108
|
}
|
|
106
109
|
|
|
@@ -129,7 +132,7 @@ export interface UatItemView {
|
|
|
129
132
|
/** Last time evidence was attached (item/link event), not just record time. */
|
|
130
133
|
evidenceUpdatedAt: string;
|
|
131
134
|
checkedAt?: string;
|
|
132
|
-
/**
|
|
135
|
+
/** Evidence newer than the last tick (minute-aligned): counts as unchecked. */
|
|
133
136
|
reopened: boolean;
|
|
134
137
|
dropped?: string;
|
|
135
138
|
mergedInto?: string;
|
|
@@ -143,6 +146,23 @@ export interface PendingCandidate extends RecordEntry {
|
|
|
143
146
|
area?: string;
|
|
144
147
|
spec?: string;
|
|
145
148
|
files?: string[];
|
|
149
|
+
/**
|
|
150
|
+
* True when a `candidate` event supplied a behaviour sentence.
|
|
151
|
+
*
|
|
152
|
+
* Records written before `record_change` existed have no behaviour line, and
|
|
153
|
+
* clustering them means reading every file by hand. They are kept in the
|
|
154
|
+
* queue but counted separately (`counts.pendingLegacy`) and only fed to a
|
|
155
|
+
* clustering run on explicit `/ask-uat legacy`.
|
|
156
|
+
*/
|
|
157
|
+
hasBehavior: boolean;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** One record retired without an item: a `none:` hint or an explicit drop. */
|
|
161
|
+
export interface RetiredRecord {
|
|
162
|
+
id: string;
|
|
163
|
+
title: string;
|
|
164
|
+
reason: "none" | "dropped";
|
|
165
|
+
at?: string;
|
|
146
166
|
}
|
|
147
167
|
|
|
148
168
|
export interface UatBatchView {
|
|
@@ -152,20 +172,27 @@ export interface UatBatchView {
|
|
|
152
172
|
}
|
|
153
173
|
|
|
154
174
|
export interface UatState {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
175
|
+
items: UatItemView[];
|
|
176
|
+
/** Items that still need the operator (never checked, or reopened). */
|
|
177
|
+
open: UatItemView[];
|
|
178
|
+
checked: UatItemView[];
|
|
179
|
+
pending: PendingCandidate[];
|
|
180
|
+
/** Records retired in place (none: hint, or a drop that named no item). */
|
|
181
|
+
retired: RetiredRecord[];
|
|
182
|
+
batches: UatBatchView[];
|
|
183
|
+
lastEventTs?: string;
|
|
184
|
+
counts: {
|
|
185
|
+
items: number;
|
|
186
|
+
open: number;
|
|
187
|
+
checked: number;
|
|
188
|
+
pending: number;
|
|
189
|
+
/** Pending records that carry a behaviour sentence (the default queue). */
|
|
190
|
+
pendingNew: number;
|
|
191
|
+
/** Pending records that exist only as files (need `/ask-uat legacy`). */
|
|
192
|
+
pendingLegacy: number;
|
|
193
|
+
retired: number;
|
|
194
|
+
totalRecords: number;
|
|
195
|
+
};
|
|
169
196
|
}
|
|
170
197
|
|
|
171
198
|
/** `<root>/.agents/uat/ledger.jsonl` */
|
|
@@ -246,8 +273,18 @@ function isEvent(value: unknown): value is UatEvent {
|
|
|
246
273
|
);
|
|
247
274
|
case "merge":
|
|
248
275
|
return string(event.item) && strings(event.sources);
|
|
249
|
-
case "drop":
|
|
250
|
-
|
|
276
|
+
case "drop": {
|
|
277
|
+
if (
|
|
278
|
+
!optionalString(event.item) ||
|
|
279
|
+
!optionalStrings(event.reports) ||
|
|
280
|
+
!optionalString(event.reason)
|
|
281
|
+
) {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
const hasItem = typeof event.item === "string" && event.item !== "";
|
|
285
|
+
const hasReports = Array.isArray(event.reports) && event.reports.length > 0;
|
|
286
|
+
return hasItem || hasReports;
|
|
287
|
+
}
|
|
251
288
|
default:
|
|
252
289
|
return false;
|
|
253
290
|
}
|
|
@@ -276,6 +313,8 @@ export function deriveState(
|
|
|
276
313
|
const items = new Map<string, UatItemView>();
|
|
277
314
|
const batches: UatBatchView[] = [];
|
|
278
315
|
const byId = new Map(records.map((record) => [record.id, record]));
|
|
316
|
+
/** Records retired without an item, and why (drop wins over a none: hint). */
|
|
317
|
+
const retired = new Map<string, "none" | "dropped">();
|
|
279
318
|
|
|
280
319
|
const ensure = (id: string, ts: string): UatItemView => {
|
|
281
320
|
const existing = items.get(id);
|
|
@@ -362,8 +401,11 @@ export function deriveState(
|
|
|
362
401
|
break;
|
|
363
402
|
}
|
|
364
403
|
case "drop": {
|
|
365
|
-
|
|
366
|
-
|
|
404
|
+
if (event.item !== undefined && event.item !== "") {
|
|
405
|
+
const item = ensure(event.item, event.ts);
|
|
406
|
+
item.dropped = event.reason ?? "dropped";
|
|
407
|
+
}
|
|
408
|
+
for (const report of event.reports ?? []) retired.set(report, "dropped");
|
|
367
409
|
break;
|
|
368
410
|
}
|
|
369
411
|
case "candidate":
|
|
@@ -376,13 +418,21 @@ export function deriveState(
|
|
|
376
418
|
for (const item of items.values()) {
|
|
377
419
|
if (item.dropped !== undefined) continue;
|
|
378
420
|
if (item.mergedInto !== undefined) continue;
|
|
379
|
-
|
|
421
|
+
// Only the evidence records' own timestamps decide whether an accepted
|
|
422
|
+
// item is out of date. `evidenceUpdatedAt` moves on every `link`, so using
|
|
423
|
+
// it would reopen an item merely because an old record was attached late.
|
|
424
|
+
const newestEvidence = item.reports.reduce(
|
|
425
|
+
(max, report) => Math.max(max, byId.get(report)?.epochMs ?? 0),
|
|
380
426
|
0,
|
|
381
|
-
Date.parse(item.evidenceUpdatedAt) || 0,
|
|
382
|
-
...item.reports.map((report) => byId.get(report)?.epochMs ?? 0),
|
|
383
427
|
);
|
|
384
|
-
item.
|
|
385
|
-
|
|
428
|
+
const checkedMs = Date.parse(item.checkedAt ?? "");
|
|
429
|
+
// Record headers are minute-precision, `check` events are not: round the
|
|
430
|
+
// tick down to its minute so a record written later in that same minute
|
|
431
|
+
// still counts as newer (better a redundant question than a missed one).
|
|
432
|
+
const checkedMinute = Number.isFinite(checkedMs)
|
|
433
|
+
? Math.floor(checkedMs / 60_000) * 60_000
|
|
434
|
+
: 0;
|
|
435
|
+
item.reopened = item.checkedAt !== undefined && newestEvidence >= checkedMinute;
|
|
386
436
|
item.missingReports = item.reports.filter((report) => !byId.has(report));
|
|
387
437
|
live.push(item);
|
|
388
438
|
}
|
|
@@ -391,28 +441,50 @@ export function deriveState(
|
|
|
391
441
|
// Dropped items still consume their evidence: otherwise abandoning work
|
|
392
442
|
// would resurrect the same records as fresh acceptance debt on the next run.
|
|
393
443
|
for (const item of items.values()) for (const report of item.reports) referenced.add(report);
|
|
444
|
+
// Records retired without an item leave the queue the same way.
|
|
445
|
+
for (const report of retired.keys()) referenced.add(report);
|
|
394
446
|
|
|
395
447
|
const candidates = candidateByReport(events);
|
|
396
|
-
const pending: PendingCandidate[] =
|
|
397
|
-
|
|
398
|
-
.
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
448
|
+
const pending: PendingCandidate[] = [];
|
|
449
|
+
for (const record of records) {
|
|
450
|
+
if (referenced.has(record.id)) continue;
|
|
451
|
+
const candidate = candidates.get(record.id);
|
|
452
|
+
if (candidate?.hint !== undefined && isNoneHint(candidate.hint)) {
|
|
453
|
+
// No user-visible effect was declared at implementation time: keep the
|
|
454
|
+
// record on disk, but out of the acceptance queue.
|
|
455
|
+
retired.set(record.id, "none");
|
|
456
|
+
continue;
|
|
457
|
+
}
|
|
458
|
+
pending.push({
|
|
459
|
+
...record,
|
|
460
|
+
hasBehavior: (candidate?.behavior ?? "").trim() !== "",
|
|
461
|
+
...(candidate
|
|
462
|
+
? {
|
|
463
|
+
behavior: candidate.behavior,
|
|
464
|
+
hint: candidate.hint,
|
|
465
|
+
area: candidate.area,
|
|
466
|
+
spec: candidate.spec,
|
|
467
|
+
files: candidate.files,
|
|
468
|
+
}
|
|
469
|
+
: {}),
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
// Newest first, independent of the caller's input order: the page and the
|
|
473
|
+
// clustering work order both read this queue top-down.
|
|
474
|
+
pending.sort((a, b) => b.epochMs - a.epochMs || a.id.localeCompare(b.id));
|
|
475
|
+
|
|
476
|
+
const retiredRecords: RetiredRecord[] = [...retired.entries()]
|
|
477
|
+
.map(([id, reason]) => {
|
|
478
|
+
const record = byId.get(id);
|
|
479
|
+
return { id, reason, title: record?.title ?? id, at: record?.at };
|
|
412
480
|
})
|
|
413
|
-
//
|
|
414
|
-
//
|
|
415
|
-
.sort(
|
|
481
|
+
// `at` retains the record's original timezone offset; compare epochs so
|
|
482
|
+
// records written in different zones still sort chronologically.
|
|
483
|
+
.sort(
|
|
484
|
+
(a, b) =>
|
|
485
|
+
(byId.get(b.id)?.epochMs ?? 0) - (byId.get(a.id)?.epochMs ?? 0) ||
|
|
486
|
+
a.id.localeCompare(b.id),
|
|
487
|
+
);
|
|
416
488
|
|
|
417
489
|
const open = live
|
|
418
490
|
.filter((item) => item.checkedAt === undefined || item.reopened)
|
|
@@ -429,6 +501,7 @@ export function deriveState(
|
|
|
429
501
|
open,
|
|
430
502
|
checked,
|
|
431
503
|
pending,
|
|
504
|
+
retired: retiredRecords,
|
|
432
505
|
batches,
|
|
433
506
|
lastEventTs: events.length > 0 ? events[events.length - 1]?.ts : undefined,
|
|
434
507
|
counts: {
|
|
@@ -436,11 +509,21 @@ export function deriveState(
|
|
|
436
509
|
open: open.length,
|
|
437
510
|
checked: checked.length,
|
|
438
511
|
pending: pending.length,
|
|
512
|
+
pendingNew: pending.filter((entry) => entry.hasBehavior).length,
|
|
513
|
+
pendingLegacy: pending.filter((entry) => !entry.hasBehavior).length,
|
|
514
|
+
retired: retiredRecords.length,
|
|
439
515
|
totalRecords: records.length,
|
|
440
516
|
},
|
|
441
517
|
};
|
|
442
518
|
}
|
|
443
519
|
|
|
520
|
+
/** `none: …` / `none:…` — a hint that says the change has no visible effect. */
|
|
521
|
+
const NONE_HINT_RE = /^none\s*[::]/i;
|
|
522
|
+
|
|
523
|
+
function isNoneHint(hint: string): boolean {
|
|
524
|
+
return NONE_HINT_RE.test(hint.trim());
|
|
525
|
+
}
|
|
526
|
+
|
|
444
527
|
function evidenceEpochOf(item: UatItemView, byId: Map<string, RecordEntry>): number {
|
|
445
528
|
let max = Date.parse(item.createdAt) || 0;
|
|
446
529
|
for (const report of item.reports) {
|
|
@@ -8,14 +8,24 @@
|
|
|
8
8
|
* The work order is a *contract about shape*, not a template to fill in. The
|
|
9
9
|
* number that matters is the ratio: many change records collapse into few
|
|
10
10
|
* acceptance items, because the operator verifies behaviour, not commits.
|
|
11
|
+
*
|
|
12
|
+
* The queue has two lanes. Records written by `record_change` carry a behaviour
|
|
13
|
+
* sentence and cluster cheaply; older files have only a title, so clustering
|
|
14
|
+
* them means opening every file. Only an explicit `/ask-uat legacy` pays that
|
|
15
|
+
* cost — a default run stays in the cheap lane and says how much it left out.
|
|
11
16
|
*/
|
|
12
17
|
import type { PendingCandidate, UatItemView, UatState } from "./ledger.js";
|
|
13
18
|
|
|
14
19
|
export interface KickoffInput {
|
|
20
|
+
/** The records this run may cluster (already selected by the caller). */
|
|
15
21
|
pending: readonly PendingCandidate[];
|
|
16
22
|
openItems: readonly UatItemView[];
|
|
17
23
|
maxCandidates: number;
|
|
18
24
|
maxItems: number;
|
|
25
|
+
/** The caller included historical (no-behaviour) records. */
|
|
26
|
+
legacy?: boolean;
|
|
27
|
+
/** Historical records this run still leaves out. */
|
|
28
|
+
legacyRemaining?: number;
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
function describeCandidate(candidate: PendingCandidate): string {
|
|
@@ -30,8 +40,10 @@ function describeCandidate(candidate: PendingCandidate): string {
|
|
|
30
40
|
}
|
|
31
41
|
|
|
32
42
|
export function buildUatKickoff(input: KickoffInput): string {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
43
|
+
const fresh = input.pending.filter((candidate) => candidate.hasBehavior);
|
|
44
|
+
const historical = input.pending.filter((candidate) => !candidate.hasBehavior);
|
|
45
|
+
const shownFresh = fresh.slice(0, input.maxCandidates);
|
|
46
|
+
const shownHistorical = historical.slice(0, Math.max(0, input.maxCandidates - shownFresh.length));
|
|
35
47
|
const existing =
|
|
36
48
|
input.openItems.length === 0
|
|
37
49
|
? "- (none)"
|
|
@@ -40,20 +52,32 @@ export function buildUatKickoff(input: KickoffInput): string {
|
|
|
40
52
|
.map((item) => `- ${item.id} | ${item.title} | ${item.summary}`)
|
|
41
53
|
.join("\n");
|
|
42
54
|
|
|
43
|
-
|
|
55
|
+
const lines = [
|
|
44
56
|
"UAT clustering run.",
|
|
45
57
|
"",
|
|
46
58
|
"The operator is about to accept user-visible behaviour in the browser page that is now open.",
|
|
47
59
|
"Turn the pending change records into a small number of acceptance items — not one item per record.",
|
|
48
60
|
"",
|
|
49
|
-
`Pending change records (${
|
|
50
|
-
...
|
|
61
|
+
`Pending change records (${shownFresh.length}${fresh.length > shownFresh.length ? ` of ${fresh.length}` : ""}):`,
|
|
62
|
+
...(shownFresh.length > 0 ? shownFresh.map(describeCandidate) : ["- (none)"]),
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
if (shownHistorical.length > 0) {
|
|
66
|
+
lines.push(
|
|
67
|
+
"",
|
|
68
|
+
`Records without a behaviour line (${shownHistorical.length}${historical.length > shownHistorical.length ? ` of ${historical.length}` : ""}).`,
|
|
69
|
+
"Open each file before you cluster it: the title alone is not a behaviour, and guessing one puts a wrong test in front of the operator.",
|
|
70
|
+
...shownHistorical.map(describeCandidate),
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
lines.push(
|
|
51
75
|
"",
|
|
52
76
|
"Already open acceptance items (link new evidence here instead of duplicating):",
|
|
53
77
|
existing,
|
|
54
78
|
"",
|
|
55
79
|
"Rules:",
|
|
56
|
-
|
|
80
|
+
"- One item is one behaviour a person can verify by hand. If two records land on the same screen or the same command, they are one item unless the operator must test them separately.",
|
|
57
81
|
"- summary: 2-3 sentences, user-facing. What can the operator now do, see, or stop worrying about. No file names, no function names, no implementation detail.",
|
|
58
82
|
"- steps: 3-6 concrete steps (what to open, click, type, run) and the expected result of each.",
|
|
59
83
|
"- edge: optional corner cases worth one quick try (empty input, wrong order, offline, permission denied).",
|
|
@@ -62,7 +86,16 @@ export function buildUatKickoff(input: KickoffInput): string {
|
|
|
62
86
|
`- Create at most ${input.maxItems} new items in this run; leftovers stay pending and show up next time.`,
|
|
63
87
|
"- Call `uat_item` once per item (or per link). Do not edit the ledger by hand, and do not change code in this phase.",
|
|
64
88
|
"- When you are done, reply with one line: how many items and links you recorded.",
|
|
65
|
-
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
if (input.legacy !== true && (input.legacyRemaining ?? 0) > 0) {
|
|
92
|
+
lines.push(
|
|
93
|
+
"",
|
|
94
|
+
`${input.legacyRemaining} record${input.legacyRemaining === 1 ? "" : "s"} without a behaviour line ${input.legacyRemaining === 1 ? "is" : "are"} not part of this run; \`/ask-uat legacy\` includes them.`,
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return lines.join("\n");
|
|
66
99
|
}
|
|
67
100
|
|
|
68
101
|
export const UAT_MODE_BANNER = [
|
|
@@ -74,5 +107,5 @@ export const UAT_MODE_BANNER = [
|
|
|
74
107
|
|
|
75
108
|
/** One-line status for the command notice. */
|
|
76
109
|
export function describeCounts(state: UatState): string {
|
|
77
|
-
return `${state.counts.open} open · ${state.counts.checked} accepted · ${state.counts.
|
|
110
|
+
return `${state.counts.open} open · ${state.counts.checked} accepted · ${state.counts.pendingNew} new · ${state.counts.pendingLegacy} unlabeled`;
|
|
78
111
|
}
|
|
@@ -105,6 +105,20 @@ describe("listRecords", () => {
|
|
|
105
105
|
);
|
|
106
106
|
expect(listRecords(root)).toEqual([]);
|
|
107
107
|
});
|
|
108
|
+
|
|
109
|
+
it("treats the directory README as documentation, not a record", () => {
|
|
110
|
+
writeRaw("README.md", "# Change records\n\nOne file per finished round.\n");
|
|
111
|
+
writeRaw("readme.md", "# duplicate on a case-insensitive filesystem\n");
|
|
112
|
+
writeRaw("2026-11-13_2107_real.md", "# 2026-11-13T21:07+08:00 — real\n");
|
|
113
|
+
expect(listRecords(root).map((record) => record.id)).toEqual(["2026-11-13_2107_real"]);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("skips _-prefixed drafts and archive notes", () => {
|
|
117
|
+
writeRaw("_draft.md", "# scratch\n");
|
|
118
|
+
writeRaw("__rollup-2026.md", "# rolled up\n");
|
|
119
|
+
writeRaw("2026-11-13_2107_real.md", "# 2026-11-13T21:07+08:00 — real\n");
|
|
120
|
+
expect(listRecords(root).map((record) => record.id)).toEqual(["2026-11-13_2107_real"]);
|
|
121
|
+
});
|
|
108
122
|
});
|
|
109
123
|
|
|
110
124
|
describe("createRecord", () => {
|
|
@@ -121,6 +121,18 @@ export function canonicalRecordName(at: string, slug: string): string {
|
|
|
121
121
|
return `${date}_${hhmm}_${slug}`;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Files that live in `.agents/implementations/` but are not change records.
|
|
126
|
+
* `README.md` documents the directory; `_`-prefixed files are drafts or
|
|
127
|
+
* roll-up notes (the standing convention is a double underscore, `__name.md`;
|
|
128
|
+
* a single one is skipped too so older drafts keep working). Neither should
|
|
129
|
+
* ever reach the acceptance queue — a README would be pending forever.
|
|
130
|
+
*/
|
|
131
|
+
function isRecordFile(name: string): boolean {
|
|
132
|
+
if (name.toLowerCase() === "readme.md") return false;
|
|
133
|
+
return !name.startsWith("_");
|
|
134
|
+
}
|
|
135
|
+
|
|
124
136
|
/**
|
|
125
137
|
* Read every top-level change record. Subdirectories (`archive/<year>/`) are
|
|
126
138
|
* skipped on purpose: archived records are rolled up already and would
|
|
@@ -131,7 +143,7 @@ export function listRecords(root: string): RecordEntry[] {
|
|
|
131
143
|
if (!existsSync(dir)) return [];
|
|
132
144
|
const entries: RecordEntry[] = [];
|
|
133
145
|
for (const name of readdirSync(dir)) {
|
|
134
|
-
if (!name.endsWith(".md")) continue;
|
|
146
|
+
if (!name.endsWith(".md") || !isRecordFile(name)) continue;
|
|
135
147
|
const absolute = join(dir, name);
|
|
136
148
|
let stat;
|
|
137
149
|
try {
|
package/src/lib/gates.ts
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
* promise. The queue serializes our own presentations; the host slot is
|
|
19
19
|
* still shared with other extensions (pi does not arbitrate globally).
|
|
20
20
|
* pi 1.4.0 stacks extension dialogs so a second one no longer strands the
|
|
21
|
-
* first (#11166), but the 1.2–1.3 hosts
|
|
22
|
-
* replace it — the queue stays, and it also keeps one confirmation
|
|
23
|
-
* at a time instead of a pile of stacked dialogs on later hosts.
|
|
21
|
+
* first (#11166), but the 1.2–1.3 hosts covered by the declared floor
|
|
22
|
+
* still replace it — the queue stays, and it also keeps one confirmation
|
|
23
|
+
* visible at a time instead of a pile of stacked dialogs on later hosts.
|
|
24
24
|
* - A gate that throws blocks the call (fail closed), matching pi's own
|
|
25
25
|
* `tool_call` handler contract.
|
|
26
26
|
*
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
:root{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;--bg:#191d24;--panel:#20252e;--panel-2:#262d38;--line:#333c4a;--text:#d7dee8;--muted:#8f9bb0;--accent:#7aa2f7;--ok:#7dcf8a;--warn:#e0af68;--bad:#f07178}*{box-sizing:border-box}body{background:var(--bg);color:var(--text);margin:0;font:14px/1.6 system-ui,-apple-system,Segoe UI,sans-serif}code{background:var(--panel-2);border-radius:4px;padding:.05rem .3rem;font-size:.92em}.shell{max-width:62rem;margin:0 auto;padding:2rem 1.5rem 4rem}.head{justify-content:space-between;align-items:flex-start;gap:1rem;margin-bottom:1.25rem;display:flex}.head h1{letter-spacing:.01em;margin:0;font-size:1.35rem}.sub{color:var(--muted);margin:.25rem 0 0;font-size:.9rem}.dot{margin:0 .4rem}.banner{border:1px solid var(--line);background:var(--panel);border-radius:6px;margin:0 0 .9rem;padding:.6rem .8rem;font-size:.92rem}.banner.warn{color:#f0d8a8;background:#2c2618;border-color:#6b5628}.banner.error{color:#f3b9bd;background:#2d1e21;border-color:#6e3a3f}.empty{color:var(--muted);text-align:center;padding:2rem 0}.items{flex-direction:column;gap:.6rem;margin:0;padding:0;list-style:none;display:flex}.item{background:var(--panel);border:1px solid var(--line);border-radius:8px;gap:.8rem;padding:.9rem 1rem;display:flex}.item.done{opacity:.72}.check{padding-top:.15rem}.check input{width:1.05rem;height:1.05rem;accent-color:var(--ok);cursor:pointer}.body{flex:1;min-width:0}.row{justify-content:space-between;align-items:baseline;gap:.75rem;display:flex}.row h2{margin:0;font-size:1rem;font-weight:600}.badges{flex-wrap:wrap;justify-content:flex-end;gap:.35rem;display:flex}.badge{color:var(--muted);border:1px solid var(--line);white-space:nowrap;border-radius:999px;padding:.05rem .45rem;font-size:.72rem}.badge.reopened{color:var(--warn);border-color:#6b5628}.badge.area{color:var(--accent);border-color:#35487a}.summary{color:#c3ccda;margin:.45rem 0 0}.more{color:var(--accent);font:inherit;cursor:pointer;background:0 0;border:none;margin-top:.5rem;padding:0;font-size:.85rem}.details{border-top:1px dashed var(--line);margin-top:.7rem;padding-top:.7rem}.steps,.edge{margin:.2rem 0 .6rem 1.2rem;padding:0}.steps li,.edge li{margin:.25rem 0}.label{text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin:.6rem 0 .3rem;font-size:.78rem}.skip{color:var(--muted);margin:.4rem 0 0;font-size:.88rem}.evidence{flex-wrap:wrap;gap:.35rem;display:flex}.chip{font:inherit;color:var(--text);background:var(--panel-2);border:1px solid var(--line);cursor:pointer;border-radius:5px;padding:.15rem .45rem;font-size:.76rem}.chip:hover{border-color:var(--accent)}.accepted{margin-top:1.75rem}.accepted summary{cursor:pointer;color:var(--muted);margin-bottom:.6rem;font-size:.9rem}.ghost{border:1px solid var(--line);color:var(--muted);font:inherit;cursor:pointer;background:0 0;border-radius:6px;padding:.25rem .6rem;font-size:.82rem}.ghost:hover{color:var(--text);border-color:var(--accent)}.drawer{border-top:1px solid var(--line);background:#12161c;flex-direction:column;max-height:70vh;display:flex;position:fixed;inset:auto 0 0;box-shadow:0 -12px 40px #00000073}.drawer-head{border-bottom:1px solid var(--line);justify-content:space-between;align-items:center;padding:.6rem 1.2rem;display:flex}.drawer pre{white-space:pre-wrap;color:#c8d2e0;margin:0;padding:1rem 1.2rem 2rem;font:12.5px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace;overflow:auto}.foot{color:#5f6b7e;word-break:break-all;margin-top:2.5rem;font-size:.75rem}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return t(this.context.count)},getNextContextId(){return t(this.context.count++)}};function t(t){let n=String(t),r=n.length-1;return e.context.id+(r?String.fromCharCode(96+r):``)+n}function n(t){e.context=t}var r=(e,t)=>e===t,i=Symbol(`solid-track`),a={equals:r},o=null,s=M,c=1,l=2,u={owned:null,cleanups:null,context:null,owner:null},d=null,f=null,p=null,m=null,h=null,g=0;function _(e,t){let n=p,r=d,i=e.length===0,a=t===void 0?r:t,o=i?u:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(v(o));d=o,p=null;try{return j(s,!0)}finally{p=n,d=r}}function v(e){return()=>S(()=>P(e))}function y(e,t){t=t?Object.assign({},a,t):a;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[T.bind(n),e=>(typeof e==`function`&&(e=f&&f.running&&f.sources.has(n)?e(n.tValue):e(n.value)),E(n,e))]}function b(e,t,n){D(k(e,t,!1,c))}function ee(e,t,n){s=oe;let r=k(e,t,!1,c),i=w&&ie(w);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),h?h.push(r):D(r)}function x(e,t,n){n=n?Object.assign({},a,n):a;let r=k(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,D(r),T.bind(r)}function S(e){if(p===null)return e();let t=p;p=null;try{return e()}finally{p=t}}function te(e){ee(()=>S(e))}function C(e){return d===null||(d.cleanups===null?d.cleanups=[e]:d.cleanups.push(e)),e}var[ne,re]=y(!1);function ie(e){let t;return d&&d.context&&(t=d.context[e.id])!==void 0?t:e.defaultValue}var w;function T(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state)){if((e?this.tState:this.state)===c)D(this);else{let e=m;m=null,j(()=>N(this),!1),m=e}}if(p){let e=this.observers;if(!e||e[e.length-1]!==p){let t=e?e.length:0;p.sources?(p.sources.push(this),p.sourceSlots.push(t)):(p.sources=[this],p.sourceSlots=[t]),e?(e.push(p),this.observerSlots.push(p.sources.length-1)):(this.observers=[p],this.observerSlots=[p.sources.length-1])}}return e&&f.sources.has(this)?this.tValue:this.value}function E(e,t,n){let r=f&&f.running&&f.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(f){let r=f.running;(r||!n&&f.sources.has(e))&&(f.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&j(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=f&&f.running;r&&f.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?m.push(n):h.push(n),n.observers&&se(n)),r?n.tState=c:n.state=c)}if(m.length>1e6)throw m=[],Error()},!1)}return t}function D(e){if(!e.fn)return;P(e);let t=g;O(e,f&&f.running&&f.sources.has(e)?e.tValue:e.value,t),f&&!f.running&&f.sources.has(e)&&queueMicrotask(()=>{j(()=>{f&&(f.running=!0),p=d=e,O(e,e.tValue,t),p=d=null},!1)})}function O(e,t,n){let r,i=d,a=p;p=d=e;try{r=e.fn(t)}catch(t){return e.pure&&(f&&f.running?(e.tState=c,e.tOwned&&e.tOwned.forEach(P),e.tOwned=void 0):(e.state=c,e.owned&&e.owned.forEach(P),e.owned=null)),e.updatedAt=n+1,L(t)}finally{p=a,d=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?E(e,r,!0):f&&f.running&&e.pure?(f.sources.has(e)||(e.value=r),f.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function k(e,t,n,r=c,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:d,context:d?d.context:null,pure:n};return f&&f.running&&(a.state=0,a.tState=r),d===null||d!==u&&(f&&f.running&&d.pure?d.tOwned?d.tOwned.push(a):d.tOwned=[a]:d.owned?d.owned.push(a):d.owned=[a]),a}function A(e){let t=f&&f.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===l)return N(e);if(e.suspense&&S(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<g);){if(t&&f.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(f.disposed.has(t))return}if((t?e.tState:e.state)===c)D(e);else if((t?e.tState:e.state)===l){let t=m;m=null,j(()=>N(e,n[0]),!1),m=t}}}function j(e,t){if(m)return e();let n=!1;t||(m=[]),h?n=!0:h=[],g++;try{let t=e();return ae(n),t}catch(e){n||(h=null),m=null,L(e)}}function ae(e){if(m&&=(M(m),null),e)return;let t;if(f){if(!f.promises.size&&!f.queue.size){let e=f.sources,n=f.disposed;h.push.apply(h,f.effects),t=f.resolve;for(let e of h)`tState`in e&&(e.state=e.tState),delete e.tState;f=null,j(()=>{for(let e of n)P(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)P(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}re(!1)},!1)}else if(f.running){f.running=!1,f.effects.push.apply(f.effects,h),h=null,re(!0);return}}let n=h;h=null,n.length&&j(()=>s(n),!1),t&&t()}function M(e){for(let t=0;t<e.length;t++)A(e[t])}function oe(t){let r,i=0;for(r=0;r<t.length;r++){let e=t[r];e.user?t[i++]=e:A(e)}if(e.context){if(e.count){e.effects||=[],e.effects.push(...t.slice(0,i));return}n()}for(e.effects&&(e.done||!e.count)&&(t=[...e.effects,...t],i+=e.effects.length,delete e.effects),r=0;r<i;r++)A(t[r])}function N(e,t){let n=f&&f.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===c?i!==t&&(!i.updatedAt||i.updatedAt<g)&&A(i):e===l&&N(i,t)}}}function se(e){let t=f&&f.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=l:r.state=l,r.pure?m.push(r):h.push(r),r.observers&&se(r))}}function P(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)P(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)F(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)P(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}f&&f.running?e.tState=0:e.state=0}function F(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)F(e.owned[t])}function ce(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function I(e,t,n){try{for(let n of t)n(e)}catch(e){L(e,n&&n.owner||null)}}function L(e,t=d){let n=o&&t&&t.context&&t.context[o],r=ce(e);if(!n)throw r;h?h.push({fn(){I(r,n,t)},state:c}):I(r,n,t)}var le=Symbol(`fallback`);function R(e){for(let t=0;t<e.length;t++)e[t]()}function ue(e,t,n={}){let r=[],a=[],o=[],s=0,c=t.length>1?[]:null;return C(()=>R(o)),()=>{let l=e()||[],u=l.length,d,f;return l[i],S(()=>{let e,t,i,m,h,g,v,y,b;if(u===0)s!==0&&(R(o),o=[],r=[],a=[],s=0,c&&=[]),n.fallback&&(r=[le],a[0]=_(e=>(o[0]=e,n.fallback())),s=1);else if(s===0){for(a=Array(u),f=0;f<u;f++)r[f]=l[f],a[f]=_(p);s=u}else{for(i=Array(u),m=Array(u),c&&(h=Array(u)),g=0,v=Math.min(s,u);g<v&&r[g]===l[g];g++);for(v=s-1,y=u-1;v>=g&&y>=g&&r[v]===l[y];v--,y--)i[y]=a[v],m[y]=o[v],c&&(h[y]=c[v]);for(e=new Map,t=Array(y+1),f=y;f>=g;f--)b=l[f],d=e.get(b),t[f]=d===void 0?-1:d,e.set(b,f);for(d=g;d<=v;d++)b=r[d],f=e.get(b),f!==void 0&&f!==-1?(i[f]=a[d],m[f]=o[d],c&&(h[f]=c[d]),f=t[f],e.set(b,f)):o[d]();for(f=g;f<u;f++)f in i?(a[f]=i[f],o[f]=m[f],c&&(c[f]=h[f],c[f](f))):a[f]=_(p);a=a.slice(0,s=u),r=l.slice(0)}return a});function p(e){if(o[f]=e,c){let[e,n]=y(f);return c[f]=n,t(l[f],e)}return t(l[f])}}}function z(e,t){return S(()=>e(t||{}))}var de=e=>`Stale read from <${e}>.`;function B(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return x(ue(()=>e.each,e.children,t||void 0))}function V(e){let t=e.keyed,n=x(()=>e.when,void 0,void 0),r=t?n:x(n,void 0,{equals:(e,t)=>!e==!t});return x(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?S(()=>a(t?i:()=>{if(!S(r))throw de(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var fe=e=>x(()=>e());function pe(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null){if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&(d=l.get(t[c]))!=null&&d===r+u;)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++}else t[o++].remove()}}}var H=`_$DX_DELEGATE`;function me(e,t,n,r={}){let i;return _(r=>{i=r,t===document?e():W(t,e(),!n&&t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function U(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>S(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function he(e,t=window.document){let n=t[H]||(t[H]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,_e))}}function W(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return G(e,t,r,n);b(r=>G(e,t(),r,n),r)}function ge(t){return!!e.context&&!e.done&&(!t||t.isConnected)}function _e(t){if(e.registry&&e.events&&e.events.find(([e,n])=>n===t))return;let n=t.target,r=`$$${t.type}`,i=t.target,a=t.currentTarget,o=e=>Object.defineProperty(t,"target",{configurable:!0,value:e}),s=()=>{let e=n[r];if(e&&!n.disabled){let i=n[`${r}Data`];if(i===void 0?e.call(n,t):e.call(n,i,t),t.cancelBubble)return}return n.host&&typeof n.host!=`string`&&!n.host._$host&&n.contains(t.target)&&o(n.host),!0},c=()=>{for(;s()&&(n=n._$host||n.parentNode||n.host););};Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return n||document}}),e.registry&&!e.done&&(e.done=_$HY.done=!0);try{if(t.composedPath){let e=t.composedPath();o(e[0]);for(let t=0;t<e.length-2&&(n=e[t],s());t++){if(n._$host){n=n._$host,c();break}if(n.parentNode===a)break}}else c();o(i)}finally{t=n=null}}function G(e,t,n,r,i){let a=ge(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=J(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=J(e,n,r)}else if(o===`function`)return b(()=>{let i=t();for(;typeof i==`function`;)i=i();n=G(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(K(o,t,n,i))return b(()=>n=G(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=J(e,n,r),s)return n}else c?n.length===0?q(e,o,r):pe(e,n,o):(n&&J(e),q(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=J(e,n,r,t);J(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function K(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(o!=null&&o!==!0&&o!==!1){if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=K(e,o,s)||i;else if(c===`function`){if(r){for(;typeof o==`function`;)o=o();i=K(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0}else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}}return i}function q(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function J(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}var Y=new URLSearchParams(window.location.search).get(`t`)??``;async function X(e,t={}){let n=await fetch(e,{...t,headers:{...t.body?{"content-type":`application/json`}:{},"x-plan-token":Y,...t.headers??{}}});if(!n.ok)throw Error(`${t.method??`GET`} ${e} → HTTP ${n.status}`);return await n.json()}function ve(){return X(`/api/state`)}async function ye(e,t){return(await X(`/api/toggle`,{method:`POST`,body:JSON.stringify({item:e,checked:t})})).state}function be(e){return X(`/api/report?id=${encodeURIComponent(e)}`)}function xe(e,t){let n=new EventSource(`/api/events?t=${encodeURIComponent(Y)}`);return n.addEventListener(`state`,()=>e()),n.onerror=()=>t(`connection lost — reopen the page from the extension`),()=>n.close()}var Se=U(`<p class="banner error">`),Ce=U(`<p class="banner warn"> change record<!> not clustered yet — run <code>/ask-uat</code> to turn them into acceptance items.`),we=U(`<p class=empty>Nothing to verify. Run <code>/ask-uat</code> after the next round of changes lands.`),Te=U(`<details class=accepted><summary> accepted — expand to undo a tick</summary><ul class="items compact">`),Ee=U(`<span>`),De=U(`<div class=shell><header class=head><div><h1>Acceptance</h1><p class=sub></p></div><button class=ghost>refresh</button></header><ul class=items></ul><footer class=foot>`),Oe=U(`<span> open`),Z=U(`<span class=dot>·`),ke=U(`<span> accepted`),Ae=U(`<span> records not clustered`),je=U(`<p class="banner error"> malformed ledger line(s) were skipped — check .agents/uat/ledger.jsonl.`),Me=U(`<span class="badge reopened">reopened`),Ne=U(`<span class="badge area">`),Pe=U(`<ol class=steps>`),Fe=U(`<p class=label>Edge cases`),Ie=U(`<ul class=edge>`),Le=U(`<p class=skip>Not under test: `),Re=U(`<p class=skip>Spec: `),ze=U(`<div class=details><p class=label>Evidence</p><div class=evidence>`),Be=U(`<li class=item><label class=check><input type=checkbox></label><div class=body><div class=row><h2></h2><span class=badges><span class=badge> record</span><span class=badge></span></span></div><p class=summary></p><button class=more>`),Q=U(`<li>`),Ve=U(`<button class=chip>`),He=U(`<div class=details><ol class=steps></ol><div class=evidence>`),Ue=U(`<li class="item done"><label class=check><input type=checkbox></label><div class=body><div class=row><h2></h2><span class=badges><span class=badge>accepted </span></span></div><p class=summary></p><button class=more>`),We=U(`<div class=drawer><div class=drawer-head><strong></strong><button class=ghost>close</button></div><pre>`);function Ge(){let[e,t]=y(),[n,r]=y(),[i,a]=y(new Set),[o,s]=y(),[c,l]=y();async function u(){try{t(await ve()),r(void 0)}catch(e){r(e instanceof Error?e.message:String(e))}}te(()=>{u(),C(xe(()=>void u(),e=>r(e)))});let d=x(()=>e()?.open??[]),f=x(()=>e()?.checked??[]),p=x(()=>e()?.pending??[]);function m(e){let t=new Set(i());t.has(e)?t.delete(e):t.add(e),a(t)}async function h(e,n){l(e);try{let i=await ye(e,n);t(i),r(void 0)}catch(e){r(e instanceof Error?e.message:String(e))}finally{l(void 0)}}async function g(e){try{s(await be(e))}catch(e){r(e instanceof Error?e.message:String(e))}}return(()=>{var t=De(),r=t.firstChild,a=r.firstChild,l=a.firstChild.nextSibling,_=a.nextSibling,v=r.nextSibling,y=v.nextSibling;return W(l,z(V,{get when(){return e()},fallback:`loading…`,children:e=>[(()=>{var t=Oe(),n=t.firstChild;return W(t,()=>e().counts.open,n),t})(),Z(),(()=>{var t=ke(),n=t.firstChild;return W(t,()=>e().counts.checked,n),t})(),Z(),(()=>{var t=Ae(),n=t.firstChild;return W(t,()=>e().counts.pending,n),t})()]})),_.$$click=()=>void u(),W(t,z(V,{get when(){return n()},get children(){var e=Se();return W(e,n),e}}),v),W(t,z(V,{get when(){return e()?.skipped},children:e=>(()=>{var t=je(),n=t.firstChild;return W(t,e,n),t})()}),v),W(t,z(V,{get when(){return p().length>0},get children(){var e=Ce(),t=e.firstChild,n=t.nextSibling;return n.nextSibling,W(e,()=>p().length,t),W(e,()=>p().length===1?``:`s`,n),e}}),v),W(t,z(V,{get when(){return fe(()=>!!e())()&&d().length===0},get children(){return we()}}),v),W(v,z(B,{get each(){return d()},children:e=>(()=>{var t=Be(),n=t.firstChild,r=n.firstChild,a=n.nextSibling,o=a.firstChild,s=o.firstChild,l=s.nextSibling,u=l.firstChild,d=u.firstChild,f=u.nextSibling,p=o.nextSibling,_=p.nextSibling;return r.addEventListener(`change`,()=>void h(e.id,!0)),r.checked=!1,W(s,()=>e.title),W(l,z(V,{get when(){return e.reopened},get children(){return Me()}}),u),W(u,()=>e.reports.length,d),W(u,()=>e.reports.length===1?``:`s`,null),W(f,()=>new Date(e.createdAt).toLocaleDateString()),W(l,z(V,{get when(){return e.area},get children(){var t=Ne();return W(t,()=>e.area),t}}),null),W(p,()=>e.summary),_.$$click=()=>m(e.id),W(_,()=>i().has(e.id)?`hide test plan`:`show test plan`),W(a,z(V,{get when(){return i().has(e.id)},get children(){var t=ze(),n=t.firstChild,r=n.nextSibling;return W(t,z(V,{get when(){return e.steps.length>0},get children(){var t=Pe();return W(t,z(B,{get each(){return e.steps},children:e=>(()=>{var t=Q();return W(t,e),t})()})),t}}),n),W(t,z(V,{get when(){return e.edge.length>0},get children(){return[Fe(),(()=>{var t=Ie();return W(t,z(B,{get each(){return e.edge},children:e=>(()=>{var t=Q();return W(t,e),t})()})),t})()]}}),n),W(t,z(V,{get when(){return e.skip},get children(){var t=Le();return t.firstChild,W(t,()=>e.skip,null),t}}),n),W(t,z(V,{get when(){return e.spec},get children(){var t=Re();return t.firstChild,W(t,()=>e.spec,null),t}}),n),W(r,z(B,{get each(){return e.reports},children:e=>(()=>{var t=Ve();return t.$$click=()=>void g(e),W(t,e),t})()})),t}}),null),b(()=>r.disabled=c()===e.id),t})()})),W(t,z(V,{get when(){return f().length>0},get children(){var e=Te(),t=e.firstChild,n=t.firstChild,r=t.nextSibling;return W(t,()=>f().length,n),W(r,z(B,{get each(){return f()},children:e=>(()=>{var t=Ue(),n=t.firstChild,r=n.firstChild,a=n.nextSibling,o=a.firstChild,s=o.firstChild,l=s.nextSibling.firstChild;l.firstChild;var u=o.nextSibling,d=u.nextSibling;return r.addEventListener(`change`,()=>void h(e.id,!1)),r.checked=!0,W(s,()=>e.title),W(l,()=>new Date(e.checkedAt??e.createdAt).toLocaleString(),null),W(u,()=>e.summary),d.$$click=()=>m(e.id),W(d,()=>i().has(e.id)?`hide test plan`:`show test plan`),W(a,z(V,{get when(){return i().has(e.id)},get children(){var t=He(),n=t.firstChild,r=n.nextSibling;return W(n,z(B,{get each(){return e.steps},children:e=>(()=>{var t=Q();return W(t,e),t})()})),W(r,z(B,{get each(){return e.reports},children:e=>(()=>{var t=Ve();return t.$$click=()=>void g(e),W(t,e),t})()})),t}}),null),b(()=>r.disabled=c()===e.id),t})()})),e}}),y),W(t,z(V,{get when(){return o()},children:e=>(()=>{var t=We(),n=t.firstChild,r=n.firstChild,i=r.nextSibling,a=n.nextSibling;return W(r,()=>e().id),i.$$click=()=>s(void 0),W(a,()=>e().text),t})()}),y),W(y,z(V,{get when(){return e()?.root},get children(){var t=Ee();return W(t,()=>e().root),t}})),t})()}he([`click`]);var $=document.getElementById(`root`);$&&me(()=>z(Ge,{}),$);
|