@wjarka/cezarion 0.14.9-dev.1015 → 0.14.9-dev.1017

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.
@@ -33,9 +33,8 @@ export declare function parseAskRequest(value: unknown): AskRequest | null;
33
33
  /**
34
34
  * The AskUser control marker: a trailing `CEZ:ASK <compact-json>` line (a
35
35
  * sibling of `CEZ:DONE` / `CEZ:MONITORING`). Detected on the *assembled* turn
36
- * text so delta-streaming backends can't split it — uniform across all three
37
- * backends. The JSON is greedily captured from the first `{` after the keyword
38
- * to the last `}` at end-of-text.
36
+ * text so delta-streaming backends can't split it. The marker must begin the
37
+ * last nonempty line; mentions in prose or quoted logs are ordinary text.
39
38
  */
40
39
  export declare const ASK_MARKER_RE: RegExp;
41
40
  /**
package/dist/core/ask.js CHANGED
@@ -13,14 +13,19 @@ export function parseAskRequest(value) {
13
13
  /**
14
14
  * The AskUser control marker: a trailing `CEZ:ASK <compact-json>` line (a
15
15
  * sibling of `CEZ:DONE` / `CEZ:MONITORING`). Detected on the *assembled* turn
16
- * text so delta-streaming backends can't split it — uniform across all three
17
- * backends. The JSON is greedily captured from the first `{` after the keyword
18
- * to the last `}` at end-of-text.
16
+ * text so delta-streaming backends can't split it. The marker must begin the
17
+ * last nonempty line; mentions in prose or quoted logs are ordinary text.
19
18
  */
20
- export const ASK_MARKER_RE = /CEZ:ASK[ \t]+(\{[\s\S]*\})\s*$/;
19
+ export const ASK_MARKER_RE = /(?:^|\n)CEZ:ASK[ \t]+(\{[^\r\n]*\})\s*$/;
21
20
  /** Looser than `ASK_MARKER_RE` so diagnostics can distinguish a malformed
22
21
  * trailing marker from ordinary assistant prose. */
23
- const ASK_MARKER_CANDIDATE_RE = /CEZ:ASK[ \t]+([\s\S]*)$/;
22
+ const ASK_MARKER_CANDIDATE_RE = /^CEZ:ASK[ \t]+(.*)$/;
23
+ function finalAskLine(text) {
24
+ const trimmed = text.trimEnd();
25
+ const lineStart = trimmed.lastIndexOf('\n') + 1;
26
+ const match = ASK_MARKER_CANDIDATE_RE.exec(trimmed.slice(lineStart));
27
+ return match?.[1] === undefined ? null : { prefix: trimmed.slice(0, lineStart), payload: match[1] };
28
+ }
24
29
  function isRecord(value) {
25
30
  return typeof value === 'object' && value !== null && !Array.isArray(value);
26
31
  }
@@ -144,16 +149,16 @@ function issuesOf(error) {
144
149
  * rejected so the raw fallback stays readable.
145
150
  */
146
151
  export function parseAskMarkerResult(turnText) {
147
- const match = ASK_MARKER_CANDIDATE_RE.exec(turnText.trimEnd());
148
- if (!match || match[1] === undefined)
152
+ const match = finalAskLine(turnText);
153
+ if (!match)
149
154
  return { kind: 'none' };
150
155
  let raw;
151
156
  let repaired = false;
152
157
  try {
153
- raw = JSON.parse(match[1]);
158
+ raw = JSON.parse(match.payload);
154
159
  }
155
160
  catch (error) {
156
- const closed = closeUnbalancedJson(match[1]);
161
+ const closed = closeUnbalancedJson(match.payload);
157
162
  try {
158
163
  if (closed === null)
159
164
  throw error;
@@ -209,6 +214,7 @@ export function stripAskMarker(text, allowRepair = true) {
209
214
  const result = parseAskMarkerResult(text);
210
215
  if (result.kind !== 'valid' || (!allowRepair && result.repaired))
211
216
  return text;
212
- return text.replace(/\s*CEZ:ASK[ \t]+[\s\S]*$/, '');
217
+ const marker = finalAskLine(text);
218
+ return marker ? marker.prefix.trimEnd() : text;
213
219
  }
214
220
  //# sourceMappingURL=ask.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ask.js","sourceRoot":"","sources":["../../src/core/ask.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAmB,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAqD,MAAM,8BAA8B,CAAC;AAkBvJ;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC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,EAAE,WAAW,GAAG,IAAI;IAC7D,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,WAAW,IAAI,MAAM,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9E,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC"}
@@ -4318,19 +4318,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4318
4318
  } & {
4319
4319
  "/repo/commit/:sha": {
4320
4320
  $get: {
4321
- output: string;
4322
- outputFormat: "text";
4323
- status: import("hono/utils/http-status").ContentfulStatusCode;
4324
- input: {
4325
- query: {
4326
- structured?: string | undefined;
4327
- };
4328
- } & {
4329
- param: {
4330
- sha: string;
4331
- };
4332
- };
4333
- } | {
4334
4321
  output: {
4335
4322
  error: string;
4336
4323
  code?: "invalid_input" | undefined;
@@ -4394,6 +4381,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4394
4381
  sha: string;
4395
4382
  };
4396
4383
  };
4384
+ } | {
4385
+ output: string;
4386
+ outputFormat: "text";
4387
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4388
+ input: {
4389
+ query: {
4390
+ structured?: string | undefined;
4391
+ };
4392
+ } & {
4393
+ param: {
4394
+ sha: string;
4395
+ };
4396
+ };
4397
4397
  };
4398
4398
  };
4399
4399
  } & {
@@ -12317,20 +12317,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
12317
12317
  } & {
12318
12318
  "/runs/:id/handoff": {
12319
12319
  $get: {
12320
- output: string;
12321
- outputFormat: "text";
12322
- status: 200;
12320
+ output: {
12321
+ error: string;
12322
+ };
12323
+ outputFormat: "json";
12324
+ status: 404;
12323
12325
  input: {
12324
12326
  param: {
12325
12327
  id: string;
12326
12328
  };
12327
12329
  };
12328
12330
  } | {
12329
- output: {
12330
- error: string;
12331
- };
12332
- outputFormat: "json";
12333
- status: 404;
12331
+ output: string;
12332
+ outputFormat: "text";
12333
+ status: 200;
12334
12334
  input: {
12335
12335
  param: {
12336
12336
  id: string;
@@ -12368,20 +12368,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
12368
12368
  } & {
12369
12369
  "/runs/:id/diff": {
12370
12370
  $get: {
12371
- output: string;
12372
- outputFormat: "text";
12373
- status: import("hono/utils/http-status").ContentfulStatusCode;
12371
+ output: {
12372
+ error: string;
12373
+ };
12374
+ outputFormat: "json";
12375
+ status: 404;
12374
12376
  input: {
12375
12377
  param: {
12376
12378
  id: string;
12377
12379
  };
12378
12380
  };
12379
12381
  } | {
12380
- output: {
12381
- error: string;
12382
- };
12383
- outputFormat: "json";
12384
- status: 404;
12382
+ output: string;
12383
+ outputFormat: "text";
12384
+ status: import("hono/utils/http-status").ContentfulStatusCode;
12385
12385
  input: {
12386
12386
  param: {
12387
12387
  id: string;
@@ -15250,19 +15250,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
15250
15250
  } & {
15251
15251
  "/repo/commit/:sha": {
15252
15252
  $get: {
15253
- output: string;
15254
- outputFormat: "text";
15255
- status: import("hono/utils/http-status").ContentfulStatusCode;
15256
- input: {
15257
- query: {
15258
- structured?: string | undefined;
15259
- };
15260
- } & {
15261
- param: {
15262
- sha: string;
15263
- };
15264
- };
15265
- } | {
15266
15253
  output: {
15267
15254
  error: string;
15268
15255
  code?: "invalid_input" | undefined;
@@ -15326,6 +15313,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
15326
15313
  sha: string;
15327
15314
  };
15328
15315
  };
15316
+ } | {
15317
+ output: string;
15318
+ outputFormat: "text";
15319
+ status: import("hono/utils/http-status").ContentfulStatusCode;
15320
+ input: {
15321
+ query: {
15322
+ structured?: string | undefined;
15323
+ };
15324
+ } & {
15325
+ param: {
15326
+ sha: string;
15327
+ };
15328
+ };
15329
15329
  };
15330
15330
  };
15331
15331
  } & {
@@ -23249,20 +23249,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
23249
23249
  } & {
23250
23250
  "/runs/:id/handoff": {
23251
23251
  $get: {
23252
- output: string;
23253
- outputFormat: "text";
23254
- status: 200;
23252
+ output: {
23253
+ error: string;
23254
+ };
23255
+ outputFormat: "json";
23256
+ status: 404;
23255
23257
  input: {
23256
23258
  param: {
23257
23259
  id: string;
23258
23260
  };
23259
23261
  };
23260
23262
  } | {
23261
- output: {
23262
- error: string;
23263
- };
23264
- outputFormat: "json";
23265
- status: 404;
23263
+ output: string;
23264
+ outputFormat: "text";
23265
+ status: 200;
23266
23266
  input: {
23267
23267
  param: {
23268
23268
  id: string;
@@ -23300,20 +23300,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
23300
23300
  } & {
23301
23301
  "/runs/:id/diff": {
23302
23302
  $get: {
23303
- output: string;
23304
- outputFormat: "text";
23305
- status: import("hono/utils/http-status").ContentfulStatusCode;
23303
+ output: {
23304
+ error: string;
23305
+ };
23306
+ outputFormat: "json";
23307
+ status: 404;
23306
23308
  input: {
23307
23309
  param: {
23308
23310
  id: string;
23309
23311
  };
23310
23312
  };
23311
23313
  } | {
23312
- output: {
23313
- error: string;
23314
- };
23315
- outputFormat: "json";
23316
- status: 404;
23314
+ output: string;
23315
+ outputFormat: "text";
23316
+ status: import("hono/utils/http-status").ContentfulStatusCode;
23317
23317
  input: {
23318
23318
  param: {
23319
23319
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wjarka/cezarion",
3
- "version": "0.14.9-dev.1015",
3
+ "version": "0.14.9-dev.1017",
4
4
  "description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -51,8 +51,8 @@
51
51
  "zod": "^4.4.3"
52
52
  },
53
53
  "devDependencies": {
54
- "@open-mercato/cezar-api-client": "0.14.9-dev.1015",
55
- "@open-mercato/cezar-contract": "0.14.9-dev.1015",
54
+ "@open-mercato/cezar-api-client": "0.14.9-dev.1017",
55
+ "@open-mercato/cezar-contract": "0.14.9-dev.1017",
56
56
  "@types/node": "^20.14.0",
57
57
  "@types/ws": "^8.18.1",
58
58
  "esbuild": "^0.28.1",
@@ -128,7 +128,11 @@ async function respond(userText, imageCount, uuid) {
128
128
  }
129
129
  // #401: result-only full text; mapResult and v1 use the same fallback.
130
130
  if (!userText.includes('[cez-namer]') && userText.includes('mock:ask-snapshot')) {
131
- emit({ type: 'result', subtype: 'success', result: 'Choose a test library.\nCEZ:ASK {"questions":[{"header":"Library","question":"Which test library?","options":[{"label":"Vitest"},{"label":"Node test"}]}]}', usage: { input_tokens: 10, output_tokens: 5 } });
131
+ emit({ type: 'result', subtype: 'success', result: 'Using the CEZ:ASK structured question format instead:\n\nCEZ:ASK {"questions":[{"header":"Library","question":"Which test library?","options":[{"label":"Vitest"},{"label":"Node test"}]}]}', usage: { input_tokens: 10, output_tokens: 5 } });
132
+ return;
133
+ }
134
+ if (!userText.includes('[cez-namer]') && userText.includes('mock:ask-prose')) {
135
+ emit({ type: 'result', subtype: 'success', result: 'Use `CEZ:ASK {"questions":[]}` in your reply.\n> CEZ:ASK {not valid json', usage: { input_tokens: 10, output_tokens: 5 } });
132
136
  return;
133
137
  }
134
138
  if (userText.includes('mock:ci-wait')) {
@@ -163,7 +163,12 @@ rl.on('line', async (line) => {
163
163
  }
164
164
  // #401: agentMessage completion without deltas (same item envelope as baseline).
165
165
  if (turnText.includes('mock:ask-snapshot')) {
166
- emit({ method: 'item/completed', params: { threadId: 'th_mock_1', turnId: 'turn_mock_1', item: { type: 'agentMessage', id: 'ask-snapshot', text: 'Choose a test library.\nCEZ:ASK {"questions":[{"header":"Library","question":"Which test library?","options":[{"label":"Vitest"},{"label":"Node test"}]}]}' } } });
166
+ emit({ method: 'item/completed', params: { threadId: 'th_mock_1', turnId: 'turn_mock_1', item: { type: 'agentMessage', id: 'ask-snapshot', text: 'Using the CEZ:ASK structured question format instead:\n\nCEZ:ASK {"questions":[{"header":"Library","question":"Which test library?","options":[{"label":"Vitest"},{"label":"Node test"}]}]}' } } });
167
+ emit({ method: 'turn/completed', params: { threadId: 'th_mock_1', turn: { id: 'turn_mock_1', status: 'completed' } } });
168
+ return;
169
+ }
170
+ if (turnText.includes('mock:ask-prose')) {
171
+ emit({ method: 'item/completed', params: { threadId: 'th_mock_1', turnId: 'turn_mock_1', item: { type: 'agentMessage', id: 'ask-prose', text: 'Use `CEZ:ASK {"questions":[]}` in your reply.\n> CEZ:ASK {not valid json' } } });
167
172
  emit({ method: 'turn/completed', params: { threadId: 'th_mock_1', turn: { id: 'turn_mock_1', status: 'completed' } } });
168
173
  return;
169
174
  }
@@ -73,8 +73,9 @@ async function prompt(id, content) {
73
73
  if (input.includes('mock:provider-error') && !input.includes('mock:provider-error-')) { text('\n\nError: [unauthenticated] Backend rejected authentication.'); complete(id); return; }
74
74
  // #401: ACP has chunks only, so completion must flush the same text to v1/v2.
75
75
  if (input.includes('mock:ask-snapshot')) {
76
- text('Choose a test library.\nCEZ:ASK {"questions":[{"header":"Library","question":"Which test library?","options":[{"label":"Vitest"},{"label":"Node test"}]}]}'); complete(id); return;
76
+ text('Using the CEZ:ASK structured question format instead:\n\nCEZ:ASK {"questions":[{"header":"Library","question":"Which test library?","options":[{"label":"Vitest"},{"label":"Node test"}]}]}'); complete(id); return;
77
77
  }
78
+ if (input.includes('mock:ask-prose')) { text('Use `CEZ:ASK {"questions":[]}` in your reply.\n> CEZ:ASK {not valid json'); complete(id); return; }
78
79
  if (input.includes('mock:ask-bad')) { pendingAsk = { id }; emit({ id: 'bad-question', method: 'cursor/ask_question', params: { questions: [] } }); return; }
79
80
  if (input.includes('mock:plan')) { pendingAsk = { id, input }; emit({ id: 'plan-1', method: 'cursor/create_plan', params: { name: 'Test plan', overview: 'Approve the changes?', plan: 'Implement the change and run tests.' } }); return; }
80
81
  if (input.includes('mock:multi-ask')) { pendingAsk = { id }; emit({ id: 'multi-question', method: 'cursor/ask_question', params: { title: 'Choices', questions: [question, { ...question, id: 'build', prompt: 'Which build tool?', options: [{ id: 'vite', label: 'Vite' }, { id: 'webpack', label: 'Webpack' }] }] } }); return; }
@@ -316,7 +316,13 @@ const server = createServer((req, res) => {
316
316
  // #401: one completed text snapshot, without an earlier streaming part.
317
317
  if (body.includes('mock:ask-snapshot')) {
318
318
  send({ type: 'message.updated', properties: { info: info({}) } });
319
- send({ type: 'message.part.updated', properties: { part: { id: 'ask-snapshot', messageID: MESSAGE_ID, sessionID: SESSION_ID, type: 'text', text: 'Choose a test library.\nCEZ:ASK {"questions":[{"header":"Library","question":"Which test library?","options":[{"label":"Vitest"},{"label":"Node test"}]}]}', time: { start: 1, end: 2 } } } });
319
+ send({ type: 'message.part.updated', properties: { part: { id: 'ask-snapshot', messageID: MESSAGE_ID, sessionID: SESSION_ID, type: 'text', text: 'Using the CEZ:ASK structured question format instead:\n\nCEZ:ASK {"questions":[{"header":"Library","question":"Which test library?","options":[{"label":"Vitest"},{"label":"Node test"}]}]}', time: { start: 1, end: 2 } } } });
320
+ send({ type: 'session.idle', properties: { sessionID: SESSION_ID } });
321
+ return;
322
+ }
323
+ if (body.includes('mock:ask-prose')) {
324
+ send({ type: 'message.updated', properties: { info: info({}) } });
325
+ send({ type: 'message.part.updated', properties: { part: { id: 'ask-prose', messageID: MESSAGE_ID, sessionID: SESSION_ID, type: 'text', text: 'Use `CEZ:ASK {"questions":[]}` in your reply.\n> CEZ:ASK {not valid json', time: { start: 1, end: 2 } } } });
320
326
  send({ type: 'session.idle', properties: { sessionID: SESSION_ID } });
321
327
  return;
322
328
  }
@@ -186,7 +186,13 @@ async function handle(command) {
186
186
  send({ id: command.id, type: 'response', command: 'prompt', success: true });
187
187
  send({ type: 'agent_start' });
188
188
  send({ type: 'turn_start' });
189
- send({ type: 'message_update', message: {}, assistantMessageEvent: { type: 'text_end', contentIndex: 0, content: 'Choose a test library.\nCEZ:ASK {"questions":[{"header":"Library","question":"Which test library?","options":[{"label":"Vitest"},{"label":"Node test"}]}]}', partial: {} } });
189
+ send({ type: 'message_update', message: {}, assistantMessageEvent: { type: 'text_end', contentIndex: 0, content: 'Using the CEZ:ASK structured question format instead:\n\nCEZ:ASK {"questions":[{"header":"Library","question":"Which test library?","options":[{"label":"Vitest"},{"label":"Node test"}]}]}', partial: {} } });
190
+ sendTurnEnd();
191
+ } else if (command.type === 'prompt' && command.message.includes('mock:ask-prose')) {
192
+ send({ id: command.id, type: 'response', command: 'prompt', success: true });
193
+ send({ type: 'agent_start' });
194
+ send({ type: 'turn_start' });
195
+ sendText(['Use `CEZ:ASK {"questions":[]}` in your reply.\n> CEZ:ASK {not valid json']);
190
196
  sendTurnEnd();
191
197
  } else if (command.type === 'prompt' && command.message.includes('mock:ask-bad')) {
192
198
  // A marker whose JSON body is invalid. `parseAskMarker` must render no card
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Rt as r,_t as i,lt as a}from"./centered-state-BS3y81sP.js";import{t as o}from"./utils-BTFBhZ55.js";import{t as s}from"./project-router-CYgfAd0B.js";import{h as c}from"./index-DzY_fd2W.js";import{t as l}from"./lib-BQXq3kEf.js";var u=e(t(),1),d=n(),f=77;function p({slot:e,commits:t,className:n,heading:i}){let[a,s]=(0,u.useState)(``),p=a.trim().toLowerCase(),h=p?t.filter(e=>e.subject.toLowerCase().includes(p)):t,g=h.length>150,_=(0,u.useRef)(null),v=(0,u.useRef)(null),[y,b]=(0,u.useState)(0);(0,u.useLayoutEffect)(()=>{if(!g)return;let e=()=>{let e=_.current,t=v.current;!e||!t||b(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[g]);let x=h.map(n=>(0,d.jsx)(m,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,d.jsx)(r,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,d.jsx)(c,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>s(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,d.jsxs)(`div`,{ref:e=>{_.current=e,e&&(v.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":g,className:o(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[i?(0,d.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,h.length===0?(0,d.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,g?(0,d.jsx)(l,{scrollRef:v,startMargin:y,itemSize:f,children:x}):x]})]})}function m({commit:e,detailed:t}){return(0,d.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,d.jsxs)(s,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:o(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,d.jsx)(i,{size:16,"aria-hidden":`true`,className:o(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,d.jsxs)(`span`,{className:o(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,d.jsx)(`span`,{className:o(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,d.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,d.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,d.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,d.jsx)(a,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}export{p as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Rt as r,_t as i,lt as a}from"./centered-state-BS3y81sP.js";import{t as o}from"./utils-BTFBhZ55.js";import{t as s}from"./project-router-CYgfAd0B.js";import{h as c}from"./index-vrmXsGqF.js";import{t as l}from"./lib-BQXq3kEf.js";var u=e(t(),1),d=n(),f=77;function p({slot:e,commits:t,className:n,heading:i}){let[a,s]=(0,u.useState)(``),p=a.trim().toLowerCase(),h=p?t.filter(e=>e.subject.toLowerCase().includes(p)):t,g=h.length>150,_=(0,u.useRef)(null),v=(0,u.useRef)(null),[y,b]=(0,u.useState)(0);(0,u.useLayoutEffect)(()=>{if(!g)return;let e=()=>{let e=_.current,t=v.current;!e||!t||b(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[g]);let x=h.map(n=>(0,d.jsx)(m,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,d.jsx)(r,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,d.jsx)(c,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>s(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,d.jsxs)(`div`,{ref:e=>{_.current=e,e&&(v.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":g,className:o(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[i?(0,d.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,h.length===0?(0,d.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,g?(0,d.jsx)(l,{scrollRef:v,startMargin:y,itemSize:f,children:x}):x]})]})}function m({commit:e,detailed:t}){return(0,d.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,d.jsxs)(s,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:o(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,d.jsx)(i,{size:16,"aria-hidden":`true`,className:o(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,d.jsxs)(`span`,{className:o(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,d.jsx)(`span`,{className:o(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,d.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,d.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,d.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,d.jsx)(a,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}export{p as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$i as r,Ba as i,Dn as a,En as o,Fr as s,Ga as c,Jr as l,Ra as u,Y as d,Z as f,a as p,c as m,d as h,fr as g,i as _,ii as v,in as y,jr as b,l as x,o as S,r as C,s as w,t as T,u as E,ui as D,ya as O}from"./centered-state-BS3y81sP.js";import{t as k}from"./utils-BTFBhZ55.js";import{n as A,r as j,t as M}from"./collapsible-B_5Byaac.js";import{c as N,t as P}from"./project-router-CYgfAd0B.js";import{t as F}from"./search-x-I9Q8pgUa.js";import{t as I}from"./markdown-Bxw0CkSS.js";import{n as L,t as R}from"./token-metrics-CqDOn3bu.js";import{g as z,m as B}from"./index-DzY_fd2W.js";import{t as V}from"./run-diff-wfKABrYX.js";var H=e(t(),1),U=n();function W(){let{groupId:e}=u(),t=o(e),n=R(a().data),r=c();if((0,H.useEffect)(()=>{e&&r.invalidateQueries({queryKey:y.groups.detail(e)})},[r,e,(g().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,U.jsx)(B,{});if(t.isError){let e=t.error instanceof D&&t.error.status===404;return(0,U.jsx)(`div`,{"data-route":`compare`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(T,{icon:e?(0,U.jsx)(F,{}):(0,U.jsx)(z,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load variants`,subtitle:e?`No runs share this group id. The group may have been deleted, or a winner was already picked and the others removed.`:t.error.message,actions:(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(h,{asChild:!0,variant:`outline`,children:(0,U.jsx)(P,{to:`/`,children:`Back to tasks`})}),e?null:(0,U.jsx)(h,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]})})})}return(0,U.jsx)(G,{groupId:e,variants:t.data.runs,showTokens:n.tokens,showCost:n.cost})}function G({groupId:e,variants:t,showTokens:n,showCost:a}){let o=N(),s=c(),[u,d]=(0,H.useState)(null),f=t.every(e=>b.has(e.status)),h=t[0]?l(t[0]):``,g=i({mutationFn:t=>r(e,t),onSuccess:(t,n)=>{s.invalidateQueries({queryKey:y.runs.all}),s.invalidateQueries({queryKey:y.groups.detail(e)}),o(`/tasks/${t.winner?.id??n}`)},onError:e=>O(e.message,{tone:`danger`})});return(0,U.jsxs)(`div`,{"data-route":`compare`,className:`task-flow-page flex w-full flex-col`,children:[(0,U.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,U.jsx)(z,{className:`size-5 shrink-0 text-accent-icon`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{children:`Compare variants`})]}),(0,U.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[h,` · `,t.length,` `,f?`completed variants with distinct committed diffs.`:`variants of the same task, each in its own worktree.`]})]}),f?null:(0,U.jsxs)(`section`,{role:`status`,className:`rounded-xl border border-border bg-card p-5`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-normal`,children:`Variants are still running`}),(0,U.jsx)(`p`,{className:`mt-3 text-[13px] text-muted-foreground`,children:`Compare progress now. Picking a result is disabled until every variant finishes.`})]}),(0,U.jsx)(`div`,{"data-slot":`compare-columns`,className:k(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,U.jsx)(K,{variant:e,allTerminal:f,pickPending:g.isPending,onPick:()=>d(e),showTokens:n,showCost:a},e.id))}),(0,U.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-[22px]`,children:t.map(e=>(0,U.jsx)(q,{variant:e},e.id))}),(0,U.jsx)(C,{open:u!==null,onOpenChange:e=>!e&&d(null),children:(0,U.jsxs)(S,{"data-slot":`variant-confirm-dialog`,children:[(0,U.jsxs)(x,{children:[(0,U.jsxs)(E,{children:[`Pick variant `,u?.variant,`?`]}),(0,U.jsxs)(w,{children:[`Variant `,u?.variant,`'s changes go to the review gate. The other`,` `,t.length-1==1?`variant is`:`${t.length-1} variants are`,` `,`cancelled if still open, archived, and their worktrees and branches removed. There is no undo.`]})]}),(0,U.jsxs)(m,{children:[(0,U.jsx)(p,{children:`Cancel`}),(0,U.jsxs)(_,{"data-slot":`confirm-pick`,onClick:()=>{u&&g.mutate(u.id),d(null)},children:[`Pick variant `,u?.variant]})]})]})})]})}function K({variant:e,allTerminal:t,pickPending:n,onPick:r,showTokens:i,showCost:a}){let o=v(e),c=s(e.costUsd),l=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,U.jsxs)(`article`,{"data-slot":`variant-column`,"data-variant":e.variant,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 shadow-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{"data-slot":`variant-letter`,"aria-label":`Variant ${e.variant}`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-accent-strong/15 font-mono text-xs font-semibold text-accent-text`,children:e.variant}),(0,U.jsxs)(`span`,{"data-slot":`variant-status`,className:`text-lg font-normal`,children:[`· `,(0,U.jsx)(`span`,{className:`capitalize`,children:o.label})]}),i&&l||a&&c?(0,U.jsxs)(`span`,{"data-slot":`variant-token-metrics`,className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-soft-foreground`,children:[i?(0,U.jsx)(L,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):null,i&&l&&a&&c?(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,a&&c?(0,U.jsx)(`span`,{className:`font-mono tabular-nums`,children:c}):null]}):null]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,U.jsx)(`pre`,{"data-slot":`variant-diffstat`,className:`max-h-36 overflow-auto rounded-md bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.diffStat.trimEnd()||`(no changes)`})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,U.jsx)(`div`,{"data-slot":`variant-progress`,className:`max-h-28 min-w-0 overflow-hidden text-[13px] text-muted-foreground [mask-image:linear-gradient(to_bottom,black_75%,transparent)]`,children:(0,U.jsx)(I,{children:e.handoffExcerpt})}):(0,U.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,U.jsx)(h,{asChild:!0,variant:`outline`,className:`self-start`,children:(0,U.jsx)(P,{to:`/tasks/${e.id}`,children:`Open task`})}),(0,U.jsxs)(h,{"data-slot":`variant-pick`,title:t?`Keep variant ${e.variant}'s changes and archive the others`:`Every variant must finish before you can pick`,disabled:!t||n,onClick:r,children:[(0,U.jsx)(d,{"aria-hidden":`true`}),`Pick variant `,e.variant]})]})}function q({variant:e}){let[t,n]=(0,H.useState)(!1);return(0,U.jsxs)(M,{open:t,onOpenChange:n,"data-slot":`variant-diff`,"data-variant":e.variant,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card`,children:[(0,U.jsxs)(j,{className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left text-[13px] font-medium hover:bg-muted/50`,children:[(0,U.jsx)(f,{className:k(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,U.jsx)(A,{children:(0,U.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,U.jsx)(V,{runId:e.id})})})]})}export{W as CompareVariantsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$i as r,Ba as i,Dn as a,En as o,Fr as s,Ga as c,Jr as l,Ra as u,Y as d,Z as f,a as p,c as m,d as h,fr as g,i as _,ii as v,in as y,jr as b,l as x,o as S,r as C,s as w,t as T,u as E,ui as D,ya as O}from"./centered-state-BS3y81sP.js";import{t as k}from"./utils-BTFBhZ55.js";import{n as A,r as j,t as M}from"./collapsible-B_5Byaac.js";import{c as N,t as P}from"./project-router-CYgfAd0B.js";import{t as F}from"./search-x-I9Q8pgUa.js";import{t as I}from"./markdown-Bxw0CkSS.js";import{n as L,t as R}from"./token-metrics-CqDOn3bu.js";import{g as z,m as B}from"./index-vrmXsGqF.js";import{t as V}from"./run-diff-wfKABrYX.js";var H=e(t(),1),U=n();function W(){let{groupId:e}=u(),t=o(e),n=R(a().data),r=c();if((0,H.useEffect)(()=>{e&&r.invalidateQueries({queryKey:y.groups.detail(e)})},[r,e,(g().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,U.jsx)(B,{});if(t.isError){let e=t.error instanceof D&&t.error.status===404;return(0,U.jsx)(`div`,{"data-route":`compare`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(T,{icon:e?(0,U.jsx)(F,{}):(0,U.jsx)(z,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load variants`,subtitle:e?`No runs share this group id. The group may have been deleted, or a winner was already picked and the others removed.`:t.error.message,actions:(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(h,{asChild:!0,variant:`outline`,children:(0,U.jsx)(P,{to:`/`,children:`Back to tasks`})}),e?null:(0,U.jsx)(h,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]})})})}return(0,U.jsx)(G,{groupId:e,variants:t.data.runs,showTokens:n.tokens,showCost:n.cost})}function G({groupId:e,variants:t,showTokens:n,showCost:a}){let o=N(),s=c(),[u,d]=(0,H.useState)(null),f=t.every(e=>b.has(e.status)),h=t[0]?l(t[0]):``,g=i({mutationFn:t=>r(e,t),onSuccess:(t,n)=>{s.invalidateQueries({queryKey:y.runs.all}),s.invalidateQueries({queryKey:y.groups.detail(e)}),o(`/tasks/${t.winner?.id??n}`)},onError:e=>O(e.message,{tone:`danger`})});return(0,U.jsxs)(`div`,{"data-route":`compare`,className:`task-flow-page flex w-full flex-col`,children:[(0,U.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,U.jsx)(z,{className:`size-5 shrink-0 text-accent-icon`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{children:`Compare variants`})]}),(0,U.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[h,` · `,t.length,` `,f?`completed variants with distinct committed diffs.`:`variants of the same task, each in its own worktree.`]})]}),f?null:(0,U.jsxs)(`section`,{role:`status`,className:`rounded-xl border border-border bg-card p-5`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-normal`,children:`Variants are still running`}),(0,U.jsx)(`p`,{className:`mt-3 text-[13px] text-muted-foreground`,children:`Compare progress now. Picking a result is disabled until every variant finishes.`})]}),(0,U.jsx)(`div`,{"data-slot":`compare-columns`,className:k(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,U.jsx)(K,{variant:e,allTerminal:f,pickPending:g.isPending,onPick:()=>d(e),showTokens:n,showCost:a},e.id))}),(0,U.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-[22px]`,children:t.map(e=>(0,U.jsx)(q,{variant:e},e.id))}),(0,U.jsx)(C,{open:u!==null,onOpenChange:e=>!e&&d(null),children:(0,U.jsxs)(S,{"data-slot":`variant-confirm-dialog`,children:[(0,U.jsxs)(x,{children:[(0,U.jsxs)(E,{children:[`Pick variant `,u?.variant,`?`]}),(0,U.jsxs)(w,{children:[`Variant `,u?.variant,`'s changes go to the review gate. The other`,` `,t.length-1==1?`variant is`:`${t.length-1} variants are`,` `,`cancelled if still open, archived, and their worktrees and branches removed. There is no undo.`]})]}),(0,U.jsxs)(m,{children:[(0,U.jsx)(p,{children:`Cancel`}),(0,U.jsxs)(_,{"data-slot":`confirm-pick`,onClick:()=>{u&&g.mutate(u.id),d(null)},children:[`Pick variant `,u?.variant]})]})]})})]})}function K({variant:e,allTerminal:t,pickPending:n,onPick:r,showTokens:i,showCost:a}){let o=v(e),c=s(e.costUsd),l=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,U.jsxs)(`article`,{"data-slot":`variant-column`,"data-variant":e.variant,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 shadow-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{"data-slot":`variant-letter`,"aria-label":`Variant ${e.variant}`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-accent-strong/15 font-mono text-xs font-semibold text-accent-text`,children:e.variant}),(0,U.jsxs)(`span`,{"data-slot":`variant-status`,className:`text-lg font-normal`,children:[`· `,(0,U.jsx)(`span`,{className:`capitalize`,children:o.label})]}),i&&l||a&&c?(0,U.jsxs)(`span`,{"data-slot":`variant-token-metrics`,className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-soft-foreground`,children:[i?(0,U.jsx)(L,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):null,i&&l&&a&&c?(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,a&&c?(0,U.jsx)(`span`,{className:`font-mono tabular-nums`,children:c}):null]}):null]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[12px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,U.jsx)(`pre`,{"data-slot":`variant-diffstat`,className:`max-h-36 overflow-auto rounded-md bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.diffStat.trimEnd()||`(no changes)`})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[11px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,U.jsx)(`div`,{"data-slot":`variant-progress`,className:`max-h-28 min-w-0 overflow-hidden text-[13px] text-muted-foreground [mask-image:linear-gradient(to_bottom,black_75%,transparent)]`,children:(0,U.jsx)(I,{children:e.handoffExcerpt})}):(0,U.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,U.jsx)(h,{asChild:!0,variant:`outline`,className:`self-start`,children:(0,U.jsx)(P,{to:`/tasks/${e.id}`,children:`Open task`})}),(0,U.jsxs)(h,{"data-slot":`variant-pick`,title:t?`Keep variant ${e.variant}'s changes and archive the others`:`Every variant must finish before you can pick`,disabled:!t||n,onClick:r,children:[(0,U.jsx)(d,{"aria-hidden":`true`}),`Pick variant `,e.variant]})]})}function q({variant:e}){let[t,n]=(0,H.useState)(!1);return(0,U.jsxs)(M,{open:t,onOpenChange:n,"data-slot":`variant-diff`,"data-variant":e.variant,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card`,children:[(0,U.jsxs)(j,{className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left text-[13px] font-medium hover:bg-muted/50`,children:[(0,U.jsx)(f,{className:k(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,U.jsx)(A,{children:(0,U.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,U.jsx)(V,{runId:e.id})})})]})}export{W as CompareVariantsRoute};