@hearsay-tools/squawk 0.18.0-pr4352.8504 → 0.18.0-pr4355.8519
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/ci-wait/controller.d.ts +7 -7
- package/dist/delegation/provision.d.ts +1 -2
- package/dist/delegation/provision.js +26 -45
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/routes.d.ts +65 -65
- package/dist/delegation/transport.d.ts +65 -65
- package/dist/runners/antigravity/acp/events.d.ts +1 -9
- package/dist/runners/antigravity/acp/events.js +11 -52
- package/dist/runners/antigravity/acp/events.js.map +1 -1
- package/dist/runners/antigravity/acp/protocol.d.ts +1 -12
- package/dist/runners/antigravity/acp/protocol.js.map +1 -1
- package/dist/runners/antigravity/acp/session.d.ts +0 -3
- package/dist/runners/antigravity/acp/session.js +0 -9
- package/dist/runners/antigravity/acp/session.js.map +1 -1
- package/dist/runners/antigravity/antigravity-runner.d.ts +2 -2
- package/dist/runners/antigravity/antigravity-session.d.ts +4 -4
- package/dist/runners/antigravity/antigravity-session.js +20 -48
- package/dist/runners/antigravity/antigravity-session.js.map +1 -1
- package/dist/runners/antigravity/antigravity-ui-mapper.d.ts +0 -2
- package/dist/runners/antigravity/antigravity-ui-mapper.js +3 -11
- package/dist/runners/antigravity/antigravity-ui-mapper.js.map +1 -1
- package/dist/runners/antigravity/facts.d.ts +2 -2
- package/dist/runners/antigravity/facts.js +5 -7
- package/dist/runners/antigravity/facts.js.map +1 -1
- package/dist/runners/antigravity/mock.d.ts +2 -4
- package/dist/runners/antigravity/mock.js +2 -3
- package/dist/runners/antigravity/mock.js.map +1 -1
- package/dist/runners/antigravity/spec-support.js +1 -1
- package/dist/runners/antigravity/spec-support.js.map +1 -1
- package/dist/runners/antigravity/subagent-guard.d.ts +17 -0
- package/dist/runners/antigravity/subagent-guard.js +38 -0
- package/dist/runners/antigravity/subagent-guard.js.map +1 -0
- package/dist/runners/antigravity/tool-normalization.d.ts +0 -2
- package/dist/runners/antigravity/tool-normalization.js +2 -44
- package/dist/runners/antigravity/tool-normalization.js.map +1 -1
- package/dist/runners/antigravity/tool-transcript.d.ts +50 -24
- package/dist/runners/antigravity/tool-transcript.js +192 -88
- package/dist/runners/antigravity/tool-transcript.js.map +1 -1
- package/dist/runners/antigravity/wire-updates.d.ts +6 -4
- package/dist/runners/antigravity/wire-updates.js +3 -25
- package/dist/runners/antigravity/wire-updates.js.map +1 -1
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/automations-routes.d.ts +150 -150
- package/dist/server/models-routes.d.ts +12 -12
- package/dist/server/project-settings-routes.d.ts +107 -107
- package/dist/server/projects-routes.d.ts +45 -45
- package/dist/server/provider-sign-in-routes.d.ts +2 -2
- package/dist/server/providers-routes.d.ts +57 -57
- package/dist/server/repo-routes.d.ts +34 -34
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/runners-routes.d.ts +10 -10
- package/dist/server/runs-routes.d.ts +304 -304
- package/dist/server/server.d.ts +1618 -1618
- package/dist/server/workspace-routes.d.ts +84 -84
- package/dist/workflows/run/continuation-session.js +1 -1
- package/dist/workflows/run/continuation-session.js.map +1 -1
- package/dist/workflows/run/launch-context.d.ts +1 -1
- package/dist/workflows/run/launch-context.js +2 -2
- package/dist/workflows/run/launch-context.js.map +1 -1
- package/dist/workflows/run/session-events.d.ts +2 -2
- package/dist/workflows/run/session-events.js +2 -2
- package/dist/workflows/run/session-events.js.map +1 -1
- package/dist/workflows/run/step-session.js +1 -1
- package/dist/workflows/run/step-session.js.map +1 -1
- package/dist/workflows/run-states.js +1 -1
- package/dist/workflows/run-states.js.map +1 -1
- package/package.json +4 -4
- package/scripts/mock-acp.mjs +15 -128
- package/web/dist/assets/{accounts-section-CuihHvuE.js → accounts-section-CCwiE2JK.js} +1 -1
- package/web/dist/assets/{activity-motion-bKmIl_Ai.js → activity-motion-Cg-COgbE.js} +1 -1
- package/web/dist/assets/{activity-route-Bnz_NdUs.js → activity-route-lIT_UVnM.js} +1 -1
- package/web/dist/assets/{agent-config-section-uQrQrvBR.js → agent-config-section-BKlHWNwW.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-1UTSo5HV.js → agent-defaults-section-BTlpdhU_.js} +1 -1
- package/web/dist/assets/{appearance-CZ0kce28.js → appearance-Dl76GTxK.js} +1 -1
- package/web/dist/assets/{automations-route-Dq90emTh.js → automations-route-BgS-3Z_m.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-Btc38N2Q.js → commit-diff-panel-Cp6sHj_0.js} +1 -1
- package/web/dist/assets/{diff-C3-63Zgu.js → diff-Dud7aqS-.js} +2 -2
- package/web/dist/assets/{diff-view-D2O2Nm5P.js → diff-view-D6CJhIxn.js} +1 -1
- package/web/dist/assets/{file-preview-Bnq2OKGK.js → file-preview-CgpgPd0B.js} +1 -1
- package/web/dist/assets/{git-toolbar-RA8rF90D.js → git-toolbar-Bk8dA6g0.js} +1 -1
- package/web/dist/assets/{github-BRAMTLRU.js → github-DfDrbDmt.js} +1 -1
- package/web/dist/assets/{global-activity-route-Ii_-Fqqo.js → global-activity-route-jm07Cb6r.js} +1 -1
- package/web/dist/assets/{index-DCw_bX8I.js → index-BofxUFzT.js} +4 -4
- package/web/dist/assets/{markdown-G8tjpJd_.js → markdown-Bw1armEd.js} +1 -1
- package/web/dist/assets/{notifications-section-Fk_ebhy_.js → notifications-section-B0ED_Mhm.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-8HkdMxOW.js → preview-pane-connected--wS7owyd.js} +1 -1
- package/web/dist/assets/{projects-section-Dmj4JFoi.js → projects-section-Co5Svq65.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-DzfD2GES.js → prompt-templates-section-D1FaocRX.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-CYiMrnys.js → remote-settings-notice-D7NLgaAV.js} +1 -1
- package/web/dist/assets/{repo-git-B3tTtvIQ.js → repo-git-B5ls2-l_.js} +1 -1
- package/web/dist/assets/{report-reader-DBGA_8LA.js → report-reader-CFgD92rW.js} +1 -1
- package/web/dist/assets/{reports-B-Q6u2X6.js → reports-_tK92sKK.js} +1 -1
- package/web/dist/assets/{resources-section-C5ndEonC.js → resources-section-gUcumxof.js} +1 -1
- package/web/dist/assets/{run-header-DK4CZ3hY.js → run-header-CH4wXjDy.js} +1 -1
- package/web/dist/assets/{session-context-section-BAw6x6P2.js → session-context-section-BEapVsGl.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-fkaIrncp.js → settings-agent-picker-EREf7w-5.js} +1 -1
- package/web/dist/assets/{settings-shell-dzuuT5tw.js → settings-shell-CYdHCugT.js} +1 -1
- package/web/dist/assets/{sidebar-section-BIQilcgt.js → sidebar-section-dglDftim.js} +1 -1
- package/web/dist/assets/{skills-C-jo20DK.js → skills-D5WuMAgz.js} +1 -1
- package/web/dist/assets/{task-changes-DnG-9vJh.js → task-changes-Bawz4jPr.js} +1 -1
- package/web/dist/assets/{task-commits-mqs3nfjk.js → task-commits-iiaKY02_.js} +1 -1
- package/web/dist/assets/{task-files-DKB3Xp3N.js → task-files-DO8zl6O9.js} +1 -1
- package/web/dist/assets/{task-github-item-BA7W64bU.js → task-github-item-DchCJCHN.js} +1 -1
- package/web/dist/assets/{task-thread-B8zgMgtO.js → task-thread-Dnckjm3r.js} +1 -1
- package/web/dist/assets/{thread-state-8okW1FLM.js → thread-state-C4rdpFWw.js} +1 -1
- package/web/dist/assets/use-hand-to-agent-state-Cgi2aScF.js +1 -0
- package/web/dist/assets/{workflows-BhQJM4JW.js → workflows-BxUyrGkZ.js} +1 -1
- package/web/dist/assets/{workspace-tools-BZs10pQZ.js → workspace-tools-C8rgWoTL.js} +1 -1
- package/web/dist/assets/{worktrees-section-BTNZUVnW.js → worktrees-section-D42ZNYv_.js} +1 -1
- package/web/dist/index.html +1 -1
- package/dist/runners/antigravity/subagent-tracker.d.ts +0 -50
- package/dist/runners/antigravity/subagent-tracker.js +0 -152
- package/dist/runners/antigravity/subagent-tracker.js.map +0 -1
- package/dist/runners/antigravity/subagent-transcript.d.ts +0 -41
- package/dist/runners/antigravity/subagent-transcript.js +0 -185
- package/dist/runners/antigravity/subagent-transcript.js.map +0 -1
- package/dist/runners/antigravity/transcript-tailer.d.ts +0 -56
- package/dist/runners/antigravity/transcript-tailer.js +0 -175
- package/dist/runners/antigravity/transcript-tailer.js.map +0 -1
- package/web/dist/assets/use-hand-to-agent-state-BwLk3gNd.js +0 -1
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { UiEvent, UiToolItem } from '../../plugin/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Pure mapper for a single child subagent's `transcript_full.jsonl` rows into nested `UiEvent`s
|
|
4
|
-
* carrying `parentItemId`. Deduplicates tool calls already forwarded live over ACP while passing
|
|
5
|
-
* their transcript result text to `consumeWireTool` so empty wire completions (MCP/read) recover it.
|
|
6
|
-
*/
|
|
7
|
-
export declare function mapChildTranscriptRow(value: unknown, childId: string, parentItemId: string, planned: Map<number, {
|
|
8
|
-
name: string;
|
|
9
|
-
args: unknown;
|
|
10
|
-
}>, seenSteps: Set<number>, consumeWireTool: (name: string, args: unknown, output: string) => boolean): UiEvent[];
|
|
11
|
-
/**
|
|
12
|
-
* Tails spawned Antigravity child transcripts (`brain/<childId>/.system_generated/logs/transcript_full.jsonl`)
|
|
13
|
-
* to surface non-prompting child steps (`read_file`, `send_message`, child thinking and replies)
|
|
14
|
-
* under `parentItemId`, deduplicate ACP-forwarded child tool calls, and recover outputs for
|
|
15
|
-
* forwarded child calls whose ACP completion carried none (MCP/read).
|
|
16
|
-
*/
|
|
17
|
-
export declare class AntigravityChildTranscripts {
|
|
18
|
-
private readonly emit;
|
|
19
|
-
private readonly readBytes;
|
|
20
|
-
private readonly children;
|
|
21
|
-
private readonly wireTools;
|
|
22
|
-
private readonly wireById;
|
|
23
|
-
private readonly poller;
|
|
24
|
-
constructor(emit: (event: UiEvent) => void, readBytes?: number);
|
|
25
|
-
/** Records a child tool call already seen on ACP so its transcript row is deduplicated and matched. */
|
|
26
|
-
recordWireTool(childId: string, toolCallId: string, name: string, args: unknown): void;
|
|
27
|
-
/** Notes a completed ACP-forwarded child tool; if it carried no output, amends from child transcript. */
|
|
28
|
-
completedWireTool(childId: string, item: UiToolItem): void;
|
|
29
|
-
/** Starts tailing a newly spawned child conversation from byte 0. */
|
|
30
|
-
openChild(childId: string, parentItemId: string, path: string): void;
|
|
31
|
-
poll(): Promise<void>;
|
|
32
|
-
/** Drains unread rows for a killed child and resumes polling any surviving open children. */
|
|
33
|
-
closeChild(childId: string): Promise<void>;
|
|
34
|
-
flushAll(): Promise<void>;
|
|
35
|
-
close(): void;
|
|
36
|
-
private hasOpenChildren;
|
|
37
|
-
private drainChild;
|
|
38
|
-
private readAll;
|
|
39
|
-
private readChild;
|
|
40
|
-
private amendWireOutput;
|
|
41
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { antigravityTranscriptTool } from './tool-normalization.js';
|
|
2
|
-
import { BoundedJsonlTailer, NOT_RESULT_ROW_TYPES, TRANSCRIPT_MAX_FLUSH_CHUNKS, TRANSCRIPT_READ_BYTES, TranscriptPoller, boundTranscriptOutput, transcriptCallKey, transcriptHookItem, transcriptResultText, transcriptRowSchema, } from './transcript-tailer.js';
|
|
3
|
-
const POLL_MS = 250;
|
|
4
|
-
const MAX_CHILD_TRANSCRIPTS = 32;
|
|
5
|
-
/**
|
|
6
|
-
* Pure mapper for a single child subagent's `transcript_full.jsonl` rows into nested `UiEvent`s
|
|
7
|
-
* carrying `parentItemId`. Deduplicates tool calls already forwarded live over ACP while passing
|
|
8
|
-
* their transcript result text to `consumeWireTool` so empty wire completions (MCP/read) recover it.
|
|
9
|
-
*/
|
|
10
|
-
export function mapChildTranscriptRow(value, childId, parentItemId, planned, seenSteps, consumeWireTool) {
|
|
11
|
-
const parsed = transcriptRowSchema.safeParse(value);
|
|
12
|
-
if (!parsed.success)
|
|
13
|
-
return [];
|
|
14
|
-
const row = parsed.data;
|
|
15
|
-
if (seenSteps.has(row.step_index))
|
|
16
|
-
return [];
|
|
17
|
-
seenSteps.add(row.step_index);
|
|
18
|
-
if (row.type === 'PLANNER_RESPONSE')
|
|
19
|
-
return mapPlannerRow(row, childId, parentItemId, planned);
|
|
20
|
-
if (row.type === 'SYSTEM_MESSAGE') {
|
|
21
|
-
const hook = transcriptHookItem(row, `${childId}:`);
|
|
22
|
-
return hook ? [{ type: 'item.completed', item: { ...hook, parentItemId } }] : [];
|
|
23
|
-
}
|
|
24
|
-
if (NOT_RESULT_ROW_TYPES.has(row.type))
|
|
25
|
-
return [];
|
|
26
|
-
const call = planned.get(row.step_index);
|
|
27
|
-
if (!call)
|
|
28
|
-
return [];
|
|
29
|
-
planned.delete(row.step_index);
|
|
30
|
-
const output = transcriptResultText(row);
|
|
31
|
-
if (consumeWireTool(call.name, call.args, output))
|
|
32
|
-
return [];
|
|
33
|
-
const item = {
|
|
34
|
-
kind: 'tool',
|
|
35
|
-
id: `${childId}:step_${row.step_index}`,
|
|
36
|
-
parentItemId,
|
|
37
|
-
status: row.status === 'ERROR' ? 'failed' : 'completed',
|
|
38
|
-
...antigravityTranscriptTool(call.name, call.args),
|
|
39
|
-
...(output ? { output } : {}),
|
|
40
|
-
};
|
|
41
|
-
return [{ type: 'item.started', item }, { type: 'item.completed', item }];
|
|
42
|
-
}
|
|
43
|
-
function mapPlannerRow(row, childId, parentItemId, planned) {
|
|
44
|
-
const events = [];
|
|
45
|
-
const thinking = row.thinking?.trim();
|
|
46
|
-
if (thinking) {
|
|
47
|
-
const item = { kind: 'reasoning', id: `${childId}:step_${row.step_index}:reasoning`, parentItemId, text: boundTranscriptOutput(thinking) };
|
|
48
|
-
events.push({ type: 'item.started', item }, { type: 'item.completed', item });
|
|
49
|
-
}
|
|
50
|
-
const text = row.content?.trim();
|
|
51
|
-
if (text) {
|
|
52
|
-
const item = { kind: 'message', id: `${childId}:step_${row.step_index}:message`, role: 'assistant', parentItemId, text: boundTranscriptOutput(text) };
|
|
53
|
-
events.push({ type: 'item.started', item }, { type: 'item.completed', item });
|
|
54
|
-
}
|
|
55
|
-
row.tool_calls?.forEach((call, index) => {
|
|
56
|
-
planned.set(row.step_index + 1 + index, { name: call.name, args: call.args });
|
|
57
|
-
});
|
|
58
|
-
return events;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Tails spawned Antigravity child transcripts (`brain/<childId>/.system_generated/logs/transcript_full.jsonl`)
|
|
62
|
-
* to surface non-prompting child steps (`read_file`, `send_message`, child thinking and replies)
|
|
63
|
-
* under `parentItemId`, deduplicate ACP-forwarded child tool calls, and recover outputs for
|
|
64
|
-
* forwarded child calls whose ACP completion carried none (MCP/read).
|
|
65
|
-
*/
|
|
66
|
-
export class AntigravityChildTranscripts {
|
|
67
|
-
emit;
|
|
68
|
-
readBytes;
|
|
69
|
-
children = new Map();
|
|
70
|
-
wireTools = new Map();
|
|
71
|
-
wireById = new Map();
|
|
72
|
-
poller;
|
|
73
|
-
constructor(emit, readBytes = TRANSCRIPT_READ_BYTES) {
|
|
74
|
-
this.emit = emit;
|
|
75
|
-
this.readBytes = readBytes;
|
|
76
|
-
this.poller = new TranscriptPoller(() => this.readAll(), () => this.hasOpenChildren(), POLL_MS);
|
|
77
|
-
}
|
|
78
|
-
/** Records a child tool call already seen on ACP so its transcript row is deduplicated and matched. */
|
|
79
|
-
recordWireTool(childId, toolCallId, name, args) {
|
|
80
|
-
if (this.wireById.has(toolCallId))
|
|
81
|
-
return;
|
|
82
|
-
const id = childId.toLowerCase();
|
|
83
|
-
const entry = { toolCallId, childId: id };
|
|
84
|
-
this.wireById.set(toolCallId, entry);
|
|
85
|
-
const byKey = this.wireTools.get(id) ?? new Map();
|
|
86
|
-
const key = transcriptCallKey(name, args);
|
|
87
|
-
byKey.set(key, [...byKey.get(key) ?? [], entry]);
|
|
88
|
-
this.wireTools.set(id, byKey);
|
|
89
|
-
}
|
|
90
|
-
/** Notes a completed ACP-forwarded child tool; if it carried no output, amends from child transcript. */
|
|
91
|
-
completedWireTool(childId, item) {
|
|
92
|
-
const entry = this.wireById.get(item.id);
|
|
93
|
-
if (!entry)
|
|
94
|
-
return;
|
|
95
|
-
entry.item = item;
|
|
96
|
-
if (item.output || entry.amended)
|
|
97
|
-
return;
|
|
98
|
-
const child = this.children.get(childId.toLowerCase());
|
|
99
|
-
if (entry.transcriptOutput) {
|
|
100
|
-
this.amendWireOutput(entry, child?.parentItemId ?? item.parentItemId, entry.transcriptOutput);
|
|
101
|
-
}
|
|
102
|
-
else if (child && !child.closed) {
|
|
103
|
-
this.poller.schedule(0);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
/** Starts tailing a newly spawned child conversation from byte 0. */
|
|
107
|
-
openChild(childId, parentItemId, path) {
|
|
108
|
-
const id = childId.toLowerCase();
|
|
109
|
-
if (this.poller.closed || this.children.has(id) || this.children.size >= MAX_CHILD_TRANSCRIPTS)
|
|
110
|
-
return;
|
|
111
|
-
this.children.set(id, { childId: id, parentItemId, tailer: new BoundedJsonlTailer(path, false, this.readBytes), planned: new Map(), seenSteps: new Set(), closed: false });
|
|
112
|
-
this.poller.schedule(0);
|
|
113
|
-
}
|
|
114
|
-
poll() { return this.poller.poll(); }
|
|
115
|
-
/** Drains unread rows for a killed child and resumes polling any surviving open children. */
|
|
116
|
-
async closeChild(childId) {
|
|
117
|
-
const child = this.children.get(childId.toLowerCase());
|
|
118
|
-
if (!child || child.closed)
|
|
119
|
-
return;
|
|
120
|
-
child.closed = true;
|
|
121
|
-
await this.poller.waitIdle();
|
|
122
|
-
await this.drainChild(child);
|
|
123
|
-
if (!this.poller.closed && this.hasOpenChildren())
|
|
124
|
-
this.poller.schedule(POLL_MS);
|
|
125
|
-
}
|
|
126
|
-
async flushAll() {
|
|
127
|
-
await this.poller.waitIdle();
|
|
128
|
-
for (const child of this.children.values()) {
|
|
129
|
-
if (!child.closed)
|
|
130
|
-
await this.drainChild(child);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
close() {
|
|
134
|
-
this.poller.close();
|
|
135
|
-
for (const child of this.children.values())
|
|
136
|
-
child.closed = true;
|
|
137
|
-
}
|
|
138
|
-
hasOpenChildren() {
|
|
139
|
-
return [...this.children.values()].some(child => !child.closed);
|
|
140
|
-
}
|
|
141
|
-
async drainChild(child) {
|
|
142
|
-
for (let chunk = 0; chunk < TRANSCRIPT_MAX_FLUSH_CHUNKS && !this.poller.closed; chunk++) {
|
|
143
|
-
await this.readChild(child);
|
|
144
|
-
if (!child.tailer.hasMore)
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
async readAll() {
|
|
149
|
-
for (const child of this.children.values()) {
|
|
150
|
-
if (!this.poller.closed && !child.closed)
|
|
151
|
-
await this.readChild(child);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
async readChild(child) {
|
|
155
|
-
const consume = (name, args, output) => {
|
|
156
|
-
const byKey = this.wireTools.get(child.childId);
|
|
157
|
-
const key = transcriptCallKey(name, args);
|
|
158
|
-
const queue = byKey?.get(key);
|
|
159
|
-
const entry = queue?.shift();
|
|
160
|
-
if (!entry)
|
|
161
|
-
return false;
|
|
162
|
-
if (!queue.length)
|
|
163
|
-
byKey.delete(key);
|
|
164
|
-
if (output)
|
|
165
|
-
this.amendWireOutput(entry, child.parentItemId, output);
|
|
166
|
-
return true;
|
|
167
|
-
};
|
|
168
|
-
await child.tailer.readNext(row => {
|
|
169
|
-
if (this.poller.closed)
|
|
170
|
-
return;
|
|
171
|
-
for (const event of mapChildTranscriptRow(row, child.childId, child.parentItemId, child.planned, child.seenSteps, consume)) {
|
|
172
|
-
this.emit(event);
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
amendWireOutput(entry, parentItemId, output) {
|
|
177
|
-
entry.transcriptOutput = output;
|
|
178
|
-
if (!entry.item || entry.item.output || entry.amended || this.poller.closed)
|
|
179
|
-
return;
|
|
180
|
-
entry.amended = true;
|
|
181
|
-
const item = { ...entry.item, ...(parentItemId ? { parentItemId } : {}), output };
|
|
182
|
-
this.emit({ type: 'item.updated', item, late: true });
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
//# sourceMappingURL=subagent-transcript.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-transcript.js","sourceRoot":"","sources":["../../../src/runners/antigravity/subagent-transcript.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,GAEpB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,OAAO,GAAG,GAAG,CAAC;AACpB,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAmBjC;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAc,EACd,OAAe,EACf,YAAoB,EACpB,OAAqD,EACrD,SAAsB,EACtB,eAAyE;IAEzE,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACpD,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC;IACxB,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC;QAAE,OAAO,EAAE,CAAC;IAC7C,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC9B,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB;QAAE,OAAO,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC/F,IAAI,GAAG,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;QAClC,MAA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: number;
|
|
3
|
-
export declare const TRANSCRIPT_READ_BYTES: number;
|
|
4
|
-
export declare const TRANSCRIPT_MAX_FLUSH_CHUNKS = 8;
|
|
5
|
-
export declare const NOT_RESULT_ROW_TYPES: ReadonlySet<string>;
|
|
6
|
-
export declare const transcriptRowSchema: z.ZodObject<{
|
|
7
|
-
step_index: z.ZodNumber;
|
|
8
|
-
type: z.ZodString;
|
|
9
|
-
source: z.ZodOptional<z.ZodString>;
|
|
10
|
-
status: z.ZodOptional<z.ZodString>;
|
|
11
|
-
content: z.ZodOptional<z.ZodString>;
|
|
12
|
-
error: z.ZodOptional<z.ZodString>;
|
|
13
|
-
thinking: z.ZodOptional<z.ZodString>;
|
|
14
|
-
tool_calls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
-
name: z.ZodString;
|
|
16
|
-
args: z.ZodOptional<z.ZodUnknown>;
|
|
17
|
-
}, z.core.$strip>>>;
|
|
18
|
-
}, z.core.$strip>;
|
|
19
|
-
export type TranscriptRow = z.infer<typeof transcriptRowSchema>;
|
|
20
|
-
export declare function antigravityTranscriptPath(geminiDir: string, sessionId: string): string;
|
|
21
|
-
/** A JSON value with object keys sorted, so two equal argument objects compare equal as text. */
|
|
22
|
-
export declare function canonicalJson(value: unknown): string;
|
|
23
|
-
export declare function transcriptCallKey(name: string, args: unknown): string;
|
|
24
|
-
export declare function boundTranscriptOutput(text: string): string;
|
|
25
|
-
/** The text the agent received, without the CLI's `Created At:`/`Completed At:` lines, bounded. */
|
|
26
|
-
export declare function transcriptResultText(row: TranscriptRow): string;
|
|
27
|
-
/** A `SYSTEM_SDK` `SYSTEM_MESSAGE` row injected by a native Antigravity hook, mapped to a hook item. */
|
|
28
|
-
export declare function transcriptHookItem(row: TranscriptRow, idPrefix?: string): UiHookItem | undefined;
|
|
29
|
-
/** Bounded append-only JSONL file tailer shared by parent and child Antigravity transcripts. */
|
|
30
|
-
export declare class BoundedJsonlTailer {
|
|
31
|
-
private readonly path;
|
|
32
|
-
private readonly readBytes;
|
|
33
|
-
private offset;
|
|
34
|
-
private tail;
|
|
35
|
-
private readonly decoder;
|
|
36
|
-
private skippingLine;
|
|
37
|
-
hasMore: boolean;
|
|
38
|
-
constructor(path: string, fromEnd: boolean, readBytes?: number);
|
|
39
|
-
readNext(onRow: (value: unknown) => void): Promise<void>;
|
|
40
|
-
private feed;
|
|
41
|
-
}
|
|
42
|
-
/** Serialized timer-driven poller shared by parent and child Antigravity transcript readers. */
|
|
43
|
-
export declare class TranscriptPoller {
|
|
44
|
-
private readonly step;
|
|
45
|
-
private readonly shouldContinue;
|
|
46
|
-
private readonly pollMs;
|
|
47
|
-
private readonly onError?;
|
|
48
|
-
private timer;
|
|
49
|
-
private reading;
|
|
50
|
-
closed: boolean;
|
|
51
|
-
constructor(step: () => Promise<void>, shouldContinue: () => boolean, pollMs: number, onError?: (() => void) | undefined);
|
|
52
|
-
schedule(delay: number): void;
|
|
53
|
-
poll(): Promise<void>;
|
|
54
|
-
waitIdle(): Promise<void>;
|
|
55
|
-
close(): void;
|
|
56
|
-
}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { statSync } from 'node:fs';
|
|
2
|
-
import { open } from 'node:fs/promises';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { StringDecoder } from 'node:string_decoder';
|
|
5
|
-
import { hookEventName, isVisibleHookItem } from '@hearsay-tools/squawk/plugin/runtime';
|
|
6
|
-
import { z } from '@hearsay-tools/squawk/plugin';
|
|
7
|
-
import { ANTIGRAVITY_APP_DATA_DIR } from './launch-args.js';
|
|
8
|
-
export const TRANSCRIPT_OUTPUT_CHARS = 64 * 1024;
|
|
9
|
-
export const TRANSCRIPT_READ_BYTES = 4 * 1024 * 1024;
|
|
10
|
-
export const TRANSCRIPT_MAX_FLUSH_CHUNKS = 8;
|
|
11
|
-
const LINE_BYTES = 8 * 1024 * 1024;
|
|
12
|
-
export const NOT_RESULT_ROW_TYPES = new Set(['PLANNER_RESPONSE', 'USER_INPUT', 'SYSTEM_MESSAGE', 'CHECKPOINT']);
|
|
13
|
-
const HEADER = /^(?:Created|Completed) At: .*$/;
|
|
14
|
-
const SYSTEM_BLOCK = /(?:^|\n)<SYSTEM_MESSAGE>\r?\n([\s\S]*)\r?\n<\/SYSTEM_MESSAGE>\s*$/;
|
|
15
|
-
const HOOK_HEADER = /^The following system message was injected by an? ([A-Za-z][A-Za-z0-9_-]*) hook:\r?\n?([\s\S]*)$/;
|
|
16
|
-
export const transcriptRowSchema = z.object({
|
|
17
|
-
step_index: z.number().int().nonnegative(), type: z.string(), source: z.string().optional(),
|
|
18
|
-
status: z.string().optional(), content: z.string().optional(), error: z.string().optional(),
|
|
19
|
-
thinking: z.string().optional(),
|
|
20
|
-
tool_calls: z.array(z.object({ name: z.string(), args: z.unknown().optional() })).optional(),
|
|
21
|
-
});
|
|
22
|
-
export function antigravityTranscriptPath(geminiDir, sessionId) {
|
|
23
|
-
return join(geminiDir, ANTIGRAVITY_APP_DATA_DIR, 'brain', sessionId, '.system_generated', 'logs', 'transcript_full.jsonl');
|
|
24
|
-
}
|
|
25
|
-
/** A JSON value with object keys sorted, so two equal argument objects compare equal as text. */
|
|
26
|
-
export function canonicalJson(value) {
|
|
27
|
-
if (Array.isArray(value))
|
|
28
|
-
return `[${value.map(canonicalJson).join(',')}]`;
|
|
29
|
-
if (value && typeof value === 'object') {
|
|
30
|
-
return `{${Object.keys(value).sort().map(key => `${JSON.stringify(key)}:${canonicalJson(value[key])}`).join(',')}}`;
|
|
31
|
-
}
|
|
32
|
-
return JSON.stringify(value ?? null);
|
|
33
|
-
}
|
|
34
|
-
export function transcriptCallKey(name, args) {
|
|
35
|
-
return `${name}\u0000${canonicalJson(args ?? {})}`;
|
|
36
|
-
}
|
|
37
|
-
export function boundTranscriptOutput(text) {
|
|
38
|
-
return text.length > TRANSCRIPT_OUTPUT_CHARS ? `${text.slice(0, TRANSCRIPT_OUTPUT_CHARS)}\n… (output truncated by Squawk)` : text;
|
|
39
|
-
}
|
|
40
|
-
/** The text the agent received, without the CLI's `Created At:`/`Completed At:` lines, bounded. */
|
|
41
|
-
export function transcriptResultText(row) {
|
|
42
|
-
const lines = (row.content ?? '').split('\n');
|
|
43
|
-
let first = 0;
|
|
44
|
-
while (first < lines.length && HEADER.test(lines[first]))
|
|
45
|
-
first++;
|
|
46
|
-
const text = lines.slice(first).join('\n') || (row.error ?? '');
|
|
47
|
-
return boundTranscriptOutput(text);
|
|
48
|
-
}
|
|
49
|
-
/** A `SYSTEM_SDK` `SYSTEM_MESSAGE` row injected by a native Antigravity hook, mapped to a hook item. */
|
|
50
|
-
export function transcriptHookItem(row, idPrefix = '') {
|
|
51
|
-
if (row.type !== 'SYSTEM_MESSAGE' || row.source !== 'SYSTEM_SDK')
|
|
52
|
-
return undefined;
|
|
53
|
-
const content = row.content ?? '';
|
|
54
|
-
const body = (SYSTEM_BLOCK.exec(content)?.[1] ?? content).trim();
|
|
55
|
-
const header = HOOK_HEADER.exec(body);
|
|
56
|
-
if (!header)
|
|
57
|
-
return undefined;
|
|
58
|
-
const status = row.status === 'ERROR' ? 'failed' : 'completed';
|
|
59
|
-
const text = header[2].trim();
|
|
60
|
-
const entries = text
|
|
61
|
-
? [{ kind: status === 'failed' ? 'error' : 'context', text: boundTranscriptOutput(text) }]
|
|
62
|
-
: row.error?.trim() ? [{ kind: 'error', text: boundTranscriptOutput(row.error.trim()) }] : [];
|
|
63
|
-
const item = { kind: 'hook', id: `${idPrefix}hook_step_${row.step_index}`, event: hookEventName(header[1]), status, entries };
|
|
64
|
-
return isVisibleHookItem(item) ? item : undefined;
|
|
65
|
-
}
|
|
66
|
-
/** Bounded append-only JSONL file tailer shared by parent and child Antigravity transcripts. */
|
|
67
|
-
export class BoundedJsonlTailer {
|
|
68
|
-
path;
|
|
69
|
-
readBytes;
|
|
70
|
-
offset = 0;
|
|
71
|
-
tail = '';
|
|
72
|
-
decoder = new StringDecoder('utf8');
|
|
73
|
-
skippingLine = false;
|
|
74
|
-
hasMore = false;
|
|
75
|
-
constructor(path, fromEnd, readBytes = TRANSCRIPT_READ_BYTES) {
|
|
76
|
-
this.path = path;
|
|
77
|
-
this.readBytes = readBytes;
|
|
78
|
-
if (fromEnd) {
|
|
79
|
-
try {
|
|
80
|
-
this.offset = statSync(path).size;
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
this.offset = 0;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async readNext(onRow) {
|
|
88
|
-
let file;
|
|
89
|
-
try {
|
|
90
|
-
file = await open(this.path, 'r');
|
|
91
|
-
}
|
|
92
|
-
catch {
|
|
93
|
-
this.hasMore = false;
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
try {
|
|
97
|
-
const { size } = await file.stat();
|
|
98
|
-
if (size <= this.offset) {
|
|
99
|
-
this.hasMore = false;
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const length = Math.min(size - this.offset, this.readBytes);
|
|
103
|
-
const buffer = Buffer.alloc(length);
|
|
104
|
-
const { bytesRead } = await file.read(buffer, 0, length, this.offset);
|
|
105
|
-
this.offset += bytesRead;
|
|
106
|
-
this.hasMore = bytesRead > 0 && this.offset < size;
|
|
107
|
-
this.feed(this.decoder.write(buffer.subarray(0, bytesRead)), onRow);
|
|
108
|
-
}
|
|
109
|
-
finally {
|
|
110
|
-
await file.close();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
feed(chunk, onRow) {
|
|
114
|
-
const lines = (this.tail + chunk).split('\n');
|
|
115
|
-
this.tail = lines.pop() ?? '';
|
|
116
|
-
for (const line of lines) {
|
|
117
|
-
if (this.skippingLine) {
|
|
118
|
-
this.skippingLine = false;
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
if (!line.trim())
|
|
122
|
-
continue;
|
|
123
|
-
try {
|
|
124
|
-
onRow(JSON.parse(line));
|
|
125
|
-
}
|
|
126
|
-
catch { /* A row the format no longer matches is skipped. */ }
|
|
127
|
-
}
|
|
128
|
-
if (this.tail.length > LINE_BYTES) {
|
|
129
|
-
this.tail = '';
|
|
130
|
-
this.skippingLine = true;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/** Serialized timer-driven poller shared by parent and child Antigravity transcript readers. */
|
|
135
|
-
export class TranscriptPoller {
|
|
136
|
-
step;
|
|
137
|
-
shouldContinue;
|
|
138
|
-
pollMs;
|
|
139
|
-
onError;
|
|
140
|
-
timer;
|
|
141
|
-
reading;
|
|
142
|
-
closed = false;
|
|
143
|
-
constructor(step, shouldContinue, pollMs, onError) {
|
|
144
|
-
this.step = step;
|
|
145
|
-
this.shouldContinue = shouldContinue;
|
|
146
|
-
this.pollMs = pollMs;
|
|
147
|
-
this.onError = onError;
|
|
148
|
-
}
|
|
149
|
-
schedule(delay) {
|
|
150
|
-
if (this.closed || this.timer)
|
|
151
|
-
return;
|
|
152
|
-
this.timer = setTimeout(() => {
|
|
153
|
-
this.timer = undefined;
|
|
154
|
-
void this.poll().then(() => { if (!this.closed && this.shouldContinue())
|
|
155
|
-
this.schedule(this.pollMs); });
|
|
156
|
-
}, delay);
|
|
157
|
-
this.timer.unref?.();
|
|
158
|
-
}
|
|
159
|
-
poll() {
|
|
160
|
-
this.reading ??= this.step().catch(() => { this.onError?.(); }).finally(() => { this.reading = undefined; });
|
|
161
|
-
return this.reading;
|
|
162
|
-
}
|
|
163
|
-
async waitIdle() {
|
|
164
|
-
clearTimeout(this.timer);
|
|
165
|
-
this.timer = undefined;
|
|
166
|
-
while (this.reading)
|
|
167
|
-
await this.reading;
|
|
168
|
-
}
|
|
169
|
-
close() {
|
|
170
|
-
this.closed = true;
|
|
171
|
-
clearTimeout(this.timer);
|
|
172
|
-
this.timer = undefined;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
//# sourceMappingURL=transcript-tailer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-tailer.js","sour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}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{n as r,t as i}from"./utils-DSMR_WLb.js";import{K as a,Mr as o,P as s,Z as c,at as l,di as u,q as d,r as f}from"./project-scope-context-C912rTJP.js";import{$t as p,A as m,Bt as h,St as g,Wt as _,_ as v,a as y,c as b,f as x,k as S,rn as C,sn as w}from"./queries-DRpvYgai.js";import{t as T}from"./useQuery-BOEhMTCg.js";import{n as E}from"./toaster-Bo5vCbz-.js";import{Y as D,c as O,ct as k,ft as A,g as j,it as M,k as N,l as ee,m as te,ot as P,r as F,tt as I,u as ne,ut as L,y as re}from"./design-icons-CzEoMH9c.js";import{t as R}from"./external-link-BE6y205O.js";import{t as ie}from"./eye-B8okNWXU.js";import{a as ae,i as z}from"./format-BNCkW110.js";import{t as oe}from"./message-square-B-MD-8rD.js";import{t as se}from"./play-CmVAj_fu.js";import{t as B}from"./button-BQ2y4XRB.js";import{i as ce,r as le,t as ue}from"./popover-BPgUYFyu.js";import{a as de,i as fe,o as pe,r as me,s as he,t as ge}from"./dialog-BVF6dIeS.js";import{t as V}from"./project-router-DucFIl_x.js";import{a as _e,i as H,o as U,r as ve,s as ye,t as be}from"./command-CDt1BsZy.js";import{d as xe,f as W,i as Se,o as Ce,p as we,s as Te,t as Ee,u as De}from"./skills-pM_PouEs.js";import{$ as Oe,F as ke,G as Ae,H as je,I as Me,J as Ne,K as Pe,L as Fe,M as Ie,N as Le,P as Re,Sn as ze,U as Be,Un as G,W as K,X as Ve,Z as He,et as Ue,ir as We,it as Ge,j as Ke,nt as qe,rt as Je,xt as q,yn as Ye}from"./index-DCw_bX8I.js";import{t as Xe}from"./markdown-G8tjpJd_.js";import{t as Ze}from"./textarea-vJt9undk.js";import{t as Qe}from"./diff-C3-63Zgu.js";import{t as $e}from"./tab-link-Bh6CcIR7.js";var J=e(t(),1),Y=n(),et={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function X({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:i(t,`text-success`)}):e===`failing`?(0,Y.jsx)(j,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:i(t,`text-danger`)}):e===`pending`?(0,Y.jsx)(ae,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:i(t,`animate-spin text-warning`)}):(0,Y.jsx)(te,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:i(t,`text-soft-foreground`)})}function tt(e){return e?.available?e.mergeState:null}function nt(e,t){return e&&t?.methods.includes(e)?e:t?.defaultMethod??t?.methods[0]??null}function rt(e){return e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:e.mergeable===`conflicting`?`Conflicts must be resolved`:e.canMerge?`Ready to merge`:e.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`}function it(e){return e===`approved`||e===`not-required`?`passing`:e===`unknown`?`unknown`:`failing`}function at(e){return e===`mergeable`?`passing`:e===`conflicting`?`failing`:`unknown`}function ot(e){return e===`conflicting`?`present`:e===`mergeable`?`none`:`unknown`}function st(e){return e===!0?` · required`:e===null?` · requiredness unknown`:``}function ct(e){return e?.available===!1?e.reason:`GitHub could not load merge requirements.`}function lt(e,t,n){return!!(e&&(t.canMerge||t.canOverride&&n))}function Z(e){return e?et[e]:`Merge`}function ut(e){return e===`conflicting`?`true`:void 0}function dt({check:e}){return(0,Y.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(X,{state:e.state}),(0,Y.jsxs)(`span`,{children:[e.name,` · `,e.state,st(e.required)]})]}),e.url&&r(e.url)?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]})}function ft({reason:e}){return(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Y.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:e})]})}function pt({state:e,selectedMethod:t,overrideRules:n,mergeEnabled:r,refreshPending:a,onRefresh:o,onRunAgent:s,onConfirm:c,onMethodChange:l,onOverrideChange:u}){let d=rt(e),f=it(e.reviewDecision),p=at(e.mergeable);return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.canMerge?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Y.jsx)(P,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold`,children:d}),(0,Y.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,onClick:o,children:[(0,Y.jsx)(D,{size:16,"aria-hidden":`true`,className:i(`size-3.5`,a&&`animate-spin`)}),`Refresh`]})]}),(0,Y.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[e.headRef,` (`,e.headSha.slice(0,7),`) → `,e.baseRef]}),(0,Y.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(X,{state:f}),(0,Y.jsxs)(`span`,{children:[`Reviews: `,e.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Y.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(X,{state:p}),(0,Y.jsxs)(`span`,{children:[`Conflicts: `,ot(e.mergeable)]})]}),e.checks.length===0?(0,Y.jsx)(`li`,{children:`No checks configured`}):e.checks.map(e=>(0,Y.jsx)(dt,{check:e},e.name)),e.blockers.map(e=>(0,Y.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),e.mergeable===`conflicting`&&s?(0,Y.jsx)(B,{className:`mt-4`,onClick:s,children:`Run agent on this PR`}):null,e.canOverride?(0,Y.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,Y.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Y.jsxs)(`span`,{children:[(0,Y.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Y.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,e.eligibility===`unknown`?(0,Y.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,e.state===`open`&&e.methods.length>0?(0,Y.jsxs)(`div`,{className:`mt-4 flex flex-col flex-wrap gap-2 sm:flex-row`,children:[(0,Y.jsx)(`select`,{"aria-label":`Merge method`,value:t??``,onChange:e=>l(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:e.methods.map(e=>(0,Y.jsx)(`option`,{value:e,children:et[e]},e))}),(0,Y.jsx)(B,{disabled:!r,onClick:c,children:Z(t)})]}):null]})]})}function mt({number:e,state:t,selectedMethod:n,confirming:r,overrideRules:i,mergePending:a,mergeError:o,onOpenChange:s,onMerge:c}){return(0,Y.jsx)(ge,{open:r,onOpenChange:s,children:(0,Y.jsxs)(me,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Y.jsxs)(pe,{children:[(0,Y.jsxs)(he,{children:[Z(n),` pull request #`,e,`?`]}),(0,Y.jsx)(fe,{asChild:!0,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`p`,{children:[`This will merge “`,t.title,`” into `,t.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),i&&t.canOverride?(0,Y.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),o?(0,Y.jsx)(`p`,{className:`text-sm text-danger`,children:o.message}):null,(0,Y.jsxs)(de,{children:[(0,Y.jsx)(B,{variant:`outline`,disabled:a,onClick:()=>s(!1),children:`Cancel`}),(0,Y.jsx)(B,{disabled:a,onClick:c,children:a?`Merging…`:Z(n)})]})]})})}function ht({number:e,onRunAgent:t}){let n=u(),r=x(),i=T({queryKey:h.githubMergeState(e),queryFn:({signal:t})=>d(e,{},{signal:t}),retry:!1}),a=tt(i.data),[o,s]=(0,J.useState)(null),[l,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),g=w({mutationFn:t=>d(e,{refresh:!0}),onSuccess:(e,t)=>n.setQueryData(t,e),onError:e=>E(e instanceof Error?e.message:String(e),{tone:`danger`})}),_=nt(o,a),v=()=>({mergeState:h.githubMergeState(e),list:h.githubPages(50),comments:h.githubComments(`pr`,e),item:h.githubItem(`pr`,e),refStatus:r===void 0?void 0:h.githubRefStatusOf(r)}),y=w({mutationFn:t=>{if(!a||!_)throw Error(`No merge method is available.`);return c(e,{method:_,expectedHeadSha:a.headSha,...p&&a.canOverride?{overrideRules:!0}:{}})},onSuccess:(t,r)=>{f(!1),E(`Pull request #${e} merged`),n.invalidateQueries({queryKey:r.mergeState}),n.invalidateQueries({queryKey:r.list}),n.invalidateQueries({queryKey:r.comments}),n.invalidateQueries({queryKey:r.item}),r.refStatus&&n.invalidateQueries({queryKey:r.refStatus})},onError:(e,t)=>{E(e instanceof Error?e.message:String(e),{tone:`danger`}),n.invalidateQueries({queryKey:t.mergeState})}});return i.isPending?(0,Y.jsx)(G,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`}):a?(0,Y.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":a.eligibility,"data-conflicting":ut(a.mergeable),"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(pt,{state:a,selectedMethod:_,overrideRules:p,mergeEnabled:lt(_,a,p),refreshPending:g.isPending,onRefresh:()=>g.mutate(h.githubMergeState(e)),onRunAgent:t,onConfirm:()=>f(!0),onMethodChange:s,onOverrideChange:m}),(0,Y.jsx)(mt,{number:e,state:a,selectedMethod:_,confirming:l,overrideRules:p,mergePending:y.isPending,mergeError:y.error,onOpenChange:f,onMerge:()=>y.mutate(v())})]}):(0,Y.jsx)(ft,{reason:ct(i.data)})}function gt(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function _t(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.author!==void 0&&e.author.toLowerCase()!==t.author.toLowerCase()||t.includeNumbers&&!t.includeNumbers.has(e.number)||t.excludeNumbers?.has(e.number)||t.projectId&&e.projectIds!==void 0&&!e.projectIds.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body??``}`.toLowerCase().includes(n))}function vt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function Q(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}function yt({label:e,color:t,plain:n=!1}){return(0,Y.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:Q(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[12px] font-medium`,children:e})}function bt(e){return e===`pr`?`pull request`:`issue`}function xt(e,t,n){return e===`pr`&&!!(t||n)}function St({backLink:e}){return e?(0,Y.jsxs)(V,{to:e.to,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Y.jsx)(F,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}):null}function Ct({item:e,kindWord:t,commentCount:n,hasDiffStat:i,additions:a,deletions:o}){return(0,Y.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Y.jsx)(`span`,{children:t}),`·`,(0,Y.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Y.jsxs)(`span`,{children:[z(e.createdAt),` ago`]}),n?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsx)(Kt,{count:n})]}):null,i?(0,Y.jsxs)(Y.Fragment,{children:[`·`,(0,Y.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,a??0]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,o??0]})]})]}):null,`·`,r(e.url)?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Y.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]})}function wt({item:e,subNav:t,changes:n}){return e.kind===`pr`?t?(0,Y.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Y.jsx)($e,{to:q(`prs`,t.filter,e.number),active:!n,children:`Conversation`}),(0,Y.jsx)($e,{to:q(`prs`,t.filter,e.number,`/changes`),active:n,children:`Changes`})]}):(0,Y.jsx)(V,{to:q(`prs`,null,e.number,`/changes`),"data-slot":`gh-files-changed`,className:`mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground hover:underline`,children:`Files changed`}):null}function Tt({item:e,colors:t,checks:n}){return e.labels.length>0||n?(0,Y.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Y.jsx)(yt,{label:e,color:t[e]},e)),n?(0,Y.jsx)(qt,{checks:n,url:e.url}):null]}):null}function Et({item:e,colors:t,body:n}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:n?(0,Y.jsx)(Xe,{children:n}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Y.jsx)(kt,{item:e,colors:t})]})}function Dt({item:e,colors:t,checks:n,comments:r,backLink:i,subNav:a,onRunAgent:o,afterHeading:s,children:c}){let l=a?.changes??!1,u=bt(e.kind),d=y(e.kind,e.number,!l).data?.detail,f=d?.body??e.body,p=d?.additions??e.additions,m=d?.deletions??e.deletions,h=xt(e.kind,p,m),g=r??e.comments;return(0,Y.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Y.jsx)(St,{backLink:i}),(0,Y.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Y.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Y.jsx)(Ct,{item:e,kindWord:u,commentCount:g,hasDiffStat:h,additions:p,deletions:m}),e.kind===`pr`?null:(0,Y.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),s,(0,Y.jsx)(wt,{item:e,subNav:a,changes:l}),(0,Y.jsx)(Tt,{item:e,colors:t,checks:n}),l&&e.kind===`pr`?(0,Y.jsx)(Ot,{item:e}):(0,Y.jsx)(Et,{item:e,colors:t,body:f})]}),e.kind===`pr`?(0,Y.jsx)(ht,{number:e.number,onRunAgent:o}):null,c]})}function Ot({item:e}){let t=u(),n=b(e.number),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(null),d=n.data,f=d?.available?d.files.filter(e=>e.path.toLowerCase().includes(o.toLowerCase())):[],p=f.findIndex(e=>e.path===c);(0,J.useEffect)(()=>{f.length>0&&!f.some(e=>e.path===c)&&l(f[0].path)},[d?.available?d.headSha:``,o]);let m=async()=>{let n=d?.available?d.headSha:null,r=h.githubPrChanges(e.number),i=await a(e.number,{refresh:!0});t.setQueryData(r,i),i.available&&n&&n!==i.headSha&&(l(i.files[0]?.path??null),E(`The reviewed revision changed.`))};if(n.isPending)return(0,Y.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!d)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!d.available)return(0,Y.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:d.reason});let g=f.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),_=r(e.url)?`${e.url}/files`:null,v=f.find(e=>e.path===c);return(0,Y.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Y.jsxs)(`strong`,{children:[d.files.length,` changed files`]}),(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,d.additions]}),(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,d.deletions]}),(0,Y.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:d.headSha,children:[`head `,d.headSha.slice(0,8)]}),(0,Y.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void m(),children:`Refresh`})]}),d.truncated?(0,Y.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[d.reason??`This response is incomplete.`,` `,_?(0,Y.jsx)(`a`,{href:_,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Y.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Y.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Y.jsx)(`input`,{"aria-label":`Filter changed files`,value:o,onChange:e=>s(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Y.jsx)(`select`,{"aria-label":`Select changed file`,value:c??``,onChange:e=>l(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:f.map(e=>(0,Y.jsx)(`option`,{children:e.path},e.path))}),(0,Y.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:f.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>l(e.path),className:i(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,c===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Y.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Y.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Y.jsx)(B,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:p<=0,onClick:()=>l(f[p-1]?.path??null),children:(0,Y.jsx)(We,{})}),(0,Y.jsx)(B,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:p<0||p>=f.length-1,onClick:()=>l(f[p+1]?.path??null),children:(0,Y.jsx)(ne,{size:16})})]}),f.length===0?(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Qe,{files:g.filter(e=>e.path===c),wrap:!0,className:`min-w-0`}),v&&!v.patch?(0,Y.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,v.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function kt({item:e,colors:t}){let n=y(e.kind,e.number),r=n.data,i=(0,J.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(At(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsx)(G,{className:`mb-3 h-3 w-24`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(G,{className:`h-14 w-full`}),(0,Y.jsx)(G,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Y.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Y.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Y.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Y.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-5`,children:jt(i).map(e=>e.group===`commits`?(0,Y.jsx)(Mt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Y.jsx)(Ht,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Y.jsx)(Nt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Y.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var At=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function jt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Mt({commits:e,colors:t}){let[n,r]=(0,J.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:$.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Y.jsx)(Nt,{event:e,colors:t},e.id))]}):(0,Y.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,children:$.committed}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Y.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:z(e[e.length-1].createdAt)})]})})}var $={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Nt({event:e,colors:t}){return(0,Y.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:i(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Y.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:$[e.kind]}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Y.jsx)(zt,{event:e,colors:t}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:z(e.createdAt)}),e.url?(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Pt({event:e}){return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Y.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Y.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Y.jsx)(Bt,{checks:e.checks})]})}function Ft({event:e,colors:t}){return(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Y.jsx)(`span`,{"data-slot":`gh-event-label`,style:Q(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[12px]`,children:e.label.name}):null,(0,Y.jsx)(`span`,{className:`shrink-0`,children:`label`})]})}function It({event:e}){return(0,Y.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]})}function Lt({event:e}){return(0,Y.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}var Rt={committed:e=>(0,Y.jsx)(Pt,{event:e}),labeled:(e,t)=>(0,Y.jsx)(Ft,{event:e,colors:t}),unlabeled:(e,t)=>(0,Y.jsx)(Ft,{event:e,colors:t}),assigned:e=>(0,Y.jsx)(It,{event:e}),unassigned:e=>(0,Y.jsx)(It,{event:e}),merged:()=>(0,Y.jsx)(`span`,{children:`merged this`}),closed:()=>(0,Y.jsx)(`span`,{children:`closed this`}),reopened:()=>(0,Y.jsx)(`span`,{children:`reopened this`}),head_ref_force_pushed:()=>(0,Y.jsx)(`span`,{children:`force-pushed`}),renamed:e=>(0,Y.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]}),"cross-referenced":e=>(0,Y.jsx)(Lt,{event:e})};function zt({event:e,colors:t}){return Rt[e.kind]?.(e,t)??null}function Bt({checks:e}){return e?(0,Y.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:i(`shrink-0`,Gt[e]),children:Wt[e]}):null}var Vt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Ht({comment:e}){let t=e.reviewState?Vt[e.reviewState]:null;return(0,Y.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Y.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Y.jsx)(Ut,{url:e.avatarUrl,login:e.author}),(0,Y.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Y.jsx)(`span`,{children:z(e.createdAt)}),t?(0,Y.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:i(`rounded-full border px-1.5 py-px font-sans text-[12px] font-medium`,t.tone),children:t.label}):null,(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Y.jsx)(R,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Y.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Y.jsx)(Xe,{children:e.body}):(0,Y.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Ut({url:e,login:t}){let[n,r]=(0,J.useState)(!1);return e&&!n?(0,Y.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Y.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Wt={passing:`✓`,failing:`✗`,pending:`○`},Gt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Kt({count:e}){return e?(0,Y.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Y.jsx)(oe,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function qt({checks:e,url:t}){let n=i(`text-[11px] font-medium`,Gt[e],t&&`hover:underline`),r=`${Wt[e]} checks ${e}`;return t?(0,Y.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Y.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function Jt({checks:e}){return(0,Y.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:i(`shrink-0 font-sans text-[11px] font-semibold`,Gt[e]),children:Wt[e]})}function Yt(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Xt(e,t=[]){let n=Yt(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Zt(t)),n}function Zt(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Qt(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function $t(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function en(e,t,n){let r=(n??``).trim();if(!r)return Xt(e,t);let i=Yt(e),a=r.startsWith(i)?i+Qt(r.slice(i.length),e):Qt(r,e),o=$t(a,e)?a:`${i}\n\n${a}`;return t.length?o+Zt(t):o}function tn(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function nn(e,t,n,r,i={}){return t?{...i,workflow:t,task:en(e,n.map(e=>e.id),r)}:n.length?{...i,steps:tn(n.map(e=>e.id)).map((e,t)=>({...e,...n[t]?.path===void 0?{}:{skillPath:n[t].path}})),task:en(e,[],r)}:{...i,workflow:`quick-task`,task:en(e,[],r)}}function rn(e){let t=g(),n=v(),r=p(),{runners:i,uninstalled:a,signedOut:o,accounts:s,repoAccount:c,accountFor:l}=ze(),u=n.data?.defaultRunner,d=Me(e.runner,i,u??i[0]??`claude`),f=n.data?.modelsLocked===!0,m=l(d,e.account),h=C(d,!0,m??c?.[d]),_=ke(f?null:e.model,d,r.data,n.data?.defaultModels,h.data),y=Ie(_,h.data);return{runner:d,runnerExplicit:e.runner!==null,model:_,effort:f?``:Re(e.effort,y),effortOptions:y,runners:i,uninstalled:a,signedOut:o,defaultRunner:u,canRun:t.isSuccess&&i.length>0,modelsLocked:f,providerPending:t.isPending,providerError:t.isError,accounts:s,account:m,repoAccount:c}}function an(e){return{runner:Fe(e.runner,e.defaultRunner,e.runnerExplicit),model:e.modelsLocked?void 0:e.model||void 0,effort:e.modelsLocked?void 0:e.effort||void 0}}function on(e){return{...an(e),...e.account?{agentProfile:e.account}:{}}}function sn(e,t){let{runners:n,uninstalled:r,signedOut:i}=e;return n.length>1||r.length>0||i.length>0||n.some(e=>Ye(t,e))}function cn({pick:e,onChange:t,disabled:n=!1,accounts:r=!1,layout:i}){let a=(0,J.useRef)(null),o=(0,J.useRef)(null),[s,c]=(0,J.useState)(()=>typeof window<`u`&&window.innerWidth<=767);(0,J.useLayoutEffect)(()=>{let e=a.current;if(i!==`row`||!e)return;let t=()=>{let t=window.innerWidth<=767||e.getBoundingClientRect().width<550,n=document.activeElement;o.current=n instanceof HTMLElement&&e.contains(n)?n:null,c(t)};t();let n=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return n?.observe(e),window.addEventListener(`resize`,t),()=>{n?.disconnect(),window.removeEventListener(`resize`,t)}},[i]),(0,J.useLayoutEffect)(()=>{let e=o.current;o.current=null,e&&e.isConnected&&document.activeElement!==e&&e.focus()},[s]);let l=rn(e),{runner:u,model:d,effort:f,effortOptions:m,runners:h,canRun:g,modelsLocked:_}=l,y=v(),b=p(),x=C(u,!0,l.account??l.repoAccount?.[u]),S=Le(u,b.data,x.data,[e.model,y.data?.defaultModels?.[u]]),w=n||!g,T=r?l.accounts:[],E=sn(l,T)?(0,Y.jsx)(Pe,{icon:(0,Y.jsx)(M,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:h,uninstalled:l.uninstalled,signedOut:l.signedOut,value:u,accounts:T,account:r?l.account:null,repoAccount:r?l.repoAccount:void 0,disabled:w,onPick:(n,i)=>t(r?{runner:n,account:i,model:n===u?e.model:null,effort:e.effort}:{runner:n,account:null,model:null,effort:e.effort})},`runner`):null,D=(0,Y.jsx)(K,{icon:(0,Y.jsx)(re,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`model-pill`,ariaLabel:`Model`,label:d===``?`Default`:S.find(e=>e.id===d).label,value:d,disabled:w,readOnly:_===!0,disabledHint:_?`Model selection is locked to native coding-agent settings.`:void 0,onPick:n=>{let r=Ie(n,x.data);t({...e,model:n,effort:e.effort===null?null:Re(e.effort,r)})},options:S.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Ke(u,b.data,x)},`model`),O=(0,Y.jsx)(K,{icon:(0,Y.jsx)(N,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`effort-pill`,ariaLabel:`Effort`,label:m.find(e=>e.value===f)?.label??`auto`,value:f,disabled:w,readOnly:_===!0,disabledHint:_?`Effort selection is locked to native coding-agent settings.`:void 0,onPick:n=>t({...e,effort:n}),options:m.map(e=>({value:e.value,label:e.label,desc:e.desc}))},`effort`);return i===`row`?(0,Y.jsx)(`div`,{ref:a,"data-slot":`engine-row-box`,children:(0,Y.jsx)(`div`,{"data-slot":`engine-row`,className:`engine-row`,role:`group`,"aria-label":`Agent settings`,children:(0,Y.jsx)(Ae,{children:s?[E,O,D]:[E,D,O]})})}):(0,Y.jsxs)(Ae,{children:[E,D,O]})}var ln={workflow:null,skills:[]},un=`cez-followup-selection`;function dn(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.flatMap(e=>typeof e==`string`?[{id:e}]:!e||typeof e!=`object`||typeof e.id!=`string`?[]:[{id:e.id,...typeof e.path==`string`?{path:e.path}:{}}]):[]}}function fn(){try{let e=localStorage.getItem(un);return e?dn(JSON.parse(e)):{...ln}}catch{return{...ln}}}function pn(e){try{localStorage.setItem(un,JSON.stringify(e))}catch{}}var mn=`cez-followup-prompt:`;function hn(e){try{return localStorage.getItem(mn+e)??``}catch{return``}}function gn(e,t){try{t===``?localStorage.removeItem(mn+e):localStorage.setItem(mn+e,t)}catch{}}function _n({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:c,engine:d,onEngineChange:f,queuedRunId:p,onQueued:m}){let g=u(),v=S(),y=e.kind===`pr`?`PR`:`issue`,b=rn(d),x=_(b.runner,b.account),C=o.filter(e=>x.unchecked||e.path===void 0||n.some(t=>t.id===e.id&&(e.path===void 0||t.path===e.path))),T=C.length!==o.length,[D]=(0,J.useState)(()=>Yt(e)),[k,A]=(0,J.useState)(()=>hn(e.url)||D),j=(0,J.useRef)(null),M=(0,J.useRef)(null);(0,J.useEffect)(()=>{gn(e.url,k===D?``:k)},[e.url,k,D]);let N=(0,J.useMemo)(()=>qe(v.data?.promptTemplates),[v.data?.promptTemplates]),ee=e=>{let t=j.current,n=Ge({prompt:k,base:D,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:M.current}),r=Ue(k,n,e);A(r.text),M.current=r.caret,requestAnimationFrame(()=>{j.current?.focus(),j.current?.setSelectionRange(r.caret,r.caret)})},te=Oe(N,C.map(e=>e.id)),P=(0,J.useRef)(k);P.current=k;let F=(0,J.useRef)(``);(0,J.useEffect)(()=>{let e=Je(P.current,F.current,te,D);F.current=e.applied,e.text!==P.current&&A(e.text)},[te,D]);let I=w({mutationFn:async()=>!b.canRun||T?null:l(nn(e,i,C,k,on(b))),onSuccess:t=>{if(t===null)return;let n=t;n&&m(e.url,n.id),E(`Added to the queue — ${y} #${e.number}`),C.length>0&&v.data!==void 0&&s({skillUsage:C.reduce((e,t)=>Ee(e,t.id),v.data.skillUsage)}).then(()=>g.invalidateQueries({queryKey:h.uiState})).catch(()=>{}),gn(e.url,``),A(D),F.current=``,g.invalidateQueries({queryKey:h.runs.all})},onError:e=>E(e.message,{tone:`danger`})}),ne=e=>{Ve({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!I.isPending&&b.canRun&&I.mutate())},L=e=>c(o.some(t=>W(t)===W(e))?o.filter(t=>W(t)!==W(e)):[...o,Te(e)]);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Y.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Y.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Y.jsx)(`span`,{children:`Instructions for the agent`}),(0,Y.jsx)(Ze,{ref:j,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:k,onChange:e=>A(e.target.value),onSelect:e=>{M.current=e.currentTarget.selectionStart},onKeyDown:ne,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Y.jsx)(Be,{templates:N,onInsert:ee}),(0,Y.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Workflow`}),(0,Y.jsx)(yn,{workflows:t,value:i,onChange:a})]}),(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Skills · select one or more`}),(0,Y.jsx)(xn,{skills:n,skillUsage:v.data?.skillUsage,selected:o,onToggle:L})]}),o.length>0?(0,Y.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:o.map(e=>(0,Y.jsx)(vn,{skill:e,skills:n,unchecked:x.unchecked,onRemove:()=>L(e)},W(e)))}):null,T?(0,Y.jsx)(`p`,{role:`alert`,children:`A selected skill path is unavailable. Remove it or choose a current copy before starting.`}):null,(0,Y.jsx)(cn,{layout:`row`,pick:d,onChange:f,disabled:I.isPending||!b.canRun,accounts:!0}),(0,Y.jsxs)(`div`,{className:`gh-field`,children:[(0,Y.jsx)(`span`,{children:`Account`}),(0,Y.jsx)(bn,{resolved:b,disabled:I.isPending||!b.canRun,onPick:e=>f({...d,account:e})})]}),!b.providerPending&&!b.canRun?(0,Y.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[b.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Y.jsx)(V,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Y.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Y.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[r(e.url)?(0,Y.jsx)(B,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Y.jsxs)(B,{variant:`primary`,"data-action":`gh-run`,disabled:I.isPending||!b.canRun||T,onClick:()=>I.mutate(),children:[(0,Y.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,y]}),(0,Y.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[11px] font-medium text-muted-foreground`,children:He()}),p?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Y.jsx)(V,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function vn({skill:e,skills:t,unchecked:n,onRemove:r}){let i=t.find(t=>t.id===e.id&&(e.path===void 0||t.path===e.path)),a=[i?.name??e.id,e.path].filter(Boolean).join(` · `),o=!n&&e.path!==void 0&&!i?` (unavailable)`:n||!i?` (unchecked)`:``;return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e.id,onClick:r,title:`Remove skill ${a}`,"aria-label":`Remove skill ${a}`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[a,o,(0,Y.jsx)(A,{size:16,"aria-hidden":`true`,className:`size-3`})]})}function yn({workflows:e,value:t,onChange:n}){let[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(``),c=(0,J.useRef)(null),l=xe(e,o);return(0,Y.jsxs)(ue,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Y.jsx)(ce,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:i(Ne,t&&`border-foreground/60 font-mono text-[11px] font-semibold text-foreground`),children:[(0,Y.jsx)(L,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Y.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Y.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(le,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(be,{shouldFilter:!1,children:[(0,Y.jsx)(_e,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Y.jsxs)(ye,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,Y.jsx)(ve,{children:`Nothing matches.`}):null,(0,Y.jsx)(H,{children:l.map(e=>{let r=t===e.name;return(0,Y.jsxs)(U,{value:`workflow ${e.name}`,keywords:we(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function bn({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:o,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,...e.configDir?{desc:e.configDir}:{}}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Y.jsx)(K,{icon:(0,Y.jsx)(k,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function xn({skills:e,skillUsage:t,selected:n,onToggle:r}){let[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(null),d=(0,J.useRef)(null),{mostUsed:f,project:p,global:m,ranked:h}=De(e,s,t),g=(e,t)=>{let a=n.some(t=>W(t)===W(e));return(0,Y.jsxs)(U,{value:W(e),keywords:we(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.id,"data-selected":a?`true`:void 0,onSelect:()=>r(Te(e)),children:[(0,Y.jsx)(`span`,{className:i(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.path?(0,Y.jsx)(`span`,{className:`min-w-0 truncate text-xs`,children:e.path}):null,e.description?(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Y.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Y.jsx)(ie,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,Y.jsx)(O,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},W(e))};return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(je,{skill:l,onClose:()=>u(null)}),(0,Y.jsxs)(ue,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,Y.jsx)(ce,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:i(Ne,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Y.jsx)(I,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Y.jsx)(ee,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Y.jsx)(le,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Y.jsxs)(be,{shouldFilter:!1,children:[(0,Y.jsx)(_e,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,Y.jsxs)(ye,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[s.trim()&&!e.some(e=>e.id===s.trim())?(0,Y.jsx)(H,{children:(0,Y.jsxs)(U,{value:`typed-skill`,onSelect:()=>r({id:s.trim()}),children:[`Use skill id “`,s.trim(),`” (unchecked)`]})}):null,(h?h.length===0:f.length===0&&p.length===0&&m.length===0)?(0,Y.jsx)(ve,{children:`Nothing matches.`}):null,h?h.length>0?(0,Y.jsx)(H,{children:h.map(e=>g(e,Se(e)))}):null:(0,Y.jsxs)(Y.Fragment,{children:[f.length>0?(0,Y.jsx)(H,{heading:`Most used`,children:f.map(e=>g(e,Se(e)))}):null,p.length>0?(0,Y.jsx)(H,{heading:`Project skills`,children:p.map(e=>g(e,!0))}):null,m.length>0?(0,Y.jsx)(H,{heading:`Global`,children:m.map(e=>g(e,!1))}):null]})]})]})})]})]})}var Sn=new WeakMap;function Cn(){let e=fn(),t={workflow:e.workflow,selectedSkills:e.skills,engine:{runner:null,model:null,effort:null,account:null},queued:new Map},n=new Set;return{snapshot:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),update:e=>{t={...t,...e},(e.workflow!==void 0||e.selectedSkills!==void 0)&&pn({workflow:t.workflow,skills:[...t.selectedSkills]}),n.forEach(e=>e())}}}function wn(){let e=u(),{projectId:t}=f(),n=Sn.get(e);n||Sn.set(e,n=new Map);let r=n.get(t);r||n.set(t,r=Cn());let{snapshot:i,subscribe:a,update:o}=r,s=(0,J.useSyncExternalStore)(a,i,i),c=m(),l=rn(s.engine),d=_(l.runner,l.account),p=S(),h=c.data?.workflows;(0,J.useEffect)(()=>{h&&s.workflow!==null&&!h.some(e=>e.name===s.workflow)&&o({workflow:null})},[o,h,s.workflow]);let g=(0,J.useMemo)(()=>Ce(d.data??[],p.data?.skillUsage),[d.data,p.data?.skillUsage]);return{...s,workflows:c,skillList:g,skillsUnchecked:d.unchecked,setWorkflow:e=>o({workflow:e}),setSelectedSkills:e=>o({selectedSkills:e}),setEngine:e=>o({engine:e}),onQueued:(e,t)=>o({queued:new Map(i().queued).set(e,t)})}}export{Kt as a,jt as c,Q as d,vt as f,Jt as i,gt as l,_n as n,Dt as o,Xt as r,yt as s,wn as t,_t as u};
|