@superxd-studio/adptr 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/GENERATIVE.md +1 -1
  2. package/README.md +20 -11
  3. package/REUSE.md +11 -1
  4. package/REVIEW.md +2 -2
  5. package/THIRD-PARTY-NOTICES.md +1 -1
  6. package/chunks/{callout-DKMHSnjc.js → callout-B89MDU9m.js} +31 -35
  7. package/chunks/{canvas-BJ15-XxE.js → canvas-Dd78FPe0.js} +9 -9
  8. package/chunks/{text-field-BLtoaZFn.js → text-field-mMHllx03.js} +1 -1
  9. package/chunks/thinking-DlBmZsgc.js +13 -0
  10. package/chunks/{ui-9DyNsYXY.js → ui-WR0qTNm7.js} +309 -260
  11. package/generative/index.js +156 -155
  12. package/interactions/index.js +1073 -499
  13. package/package.json +2 -1
  14. package/source/components/icons.tsx +14 -0
  15. package/source/components/peek.tsx +113 -0
  16. package/source/components/thinking.tsx +13 -2
  17. package/source/reusable/generative/index.tsx +14 -9
  18. package/source/reusable/generative/vocabulary.tsx +4 -2
  19. package/source/reusable/interactions/context.tsx +4 -0
  20. package/source/reusable/interactions/copy.ts +39 -0
  21. package/source/reusable/interactions/gate.tsx +246 -0
  22. package/source/reusable/interactions/index.ts +14 -0
  23. package/source/reusable/interactions/presentation.tsx +4 -1
  24. package/source/reusable/interactions/progress.tsx +240 -0
  25. package/source/reusable/interactions/receipt.tsx +230 -0
  26. package/source/reusable/interactions/run.tsx +206 -0
  27. package/source/reusable/ui/index.ts +1 -0
  28. package/source/reusable/web/review/index.tsx +21 -10
  29. package/source/styles/library.css +56 -0
  30. package/styles.css +1 -1
  31. package/types/components/icons.d.ts +8 -0
  32. package/types/components/peek.d.ts +17 -0
  33. package/types/components/thinking.d.ts +3 -1
  34. package/types/reusable/interactions/context.d.ts +39 -0
  35. package/types/reusable/interactions/copy.d.ts +43 -0
  36. package/types/reusable/interactions/gate.d.ts +39 -0
  37. package/types/reusable/interactions/index.d.ts +8 -0
  38. package/types/reusable/interactions/progress.d.ts +45 -0
  39. package/types/reusable/interactions/receipt.d.ts +54 -0
  40. package/types/reusable/interactions/run.d.ts +83 -0
  41. package/types/reusable/ui/index.d.ts +1 -0
  42. package/ui/index.js +3 -3
  43. package/web/index.js +350 -353
@@ -1,39 +1,40 @@
1
1
  "use client";
2
- import { n as e, o as t, t as n } from "../chunks/callout-DKMHSnjc.js";
3
- import { n as r, r as i, u as a } from "../chunks/canvas-BJ15-XxE.js";
4
- import { t as o } from "../chunks/text-field-BLtoaZFn.js";
5
- import { A as s, O as c, S as l, T as u, b as d, d as f, f as p, j as m } from "../chunks/ui-9DyNsYXY.js";
6
- import { createContext as h, useContext as g, useLayoutEffect as _, useRef as v, useState as y, useSyncExternalStore as b } from "react";
7
- import { Link as x } from "react-aria-components";
8
- import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
9
- import { z as T } from "zod";
2
+ import { A as e, E as t, M as n, N as r, S as i, b as a, d as o, m as s, n as c, o as l, p as u, s as d, t as f } from "../chunks/callout-B89MDU9m.js";
3
+ import { t as p } from "../chunks/thinking-DlBmZsgc.js";
4
+ import { n as m, r as h, u as g } from "../chunks/canvas-Dd78FPe0.js";
5
+ import { t as _ } from "../chunks/text-field-mMHllx03.js";
6
+ import { C as v, D as y, E as b, M as x, f as S, g as ee, i as C, j as w, k as T, p as E, x as D } from "../chunks/ui-WR0qTNm7.js";
7
+ import { createContext as O, useContext as k, useEffect as A, useId as te, useLayoutEffect as j, useRef as M, useState as N, useSyncExternalStore as P } from "react";
8
+ import { Link as ne } from "react-aria-components";
9
+ import { Fragment as F, jsx as I, jsxs as L } from "react/jsx-runtime";
10
+ import { z as R } from "zod";
10
11
  //#region src/reusable/interactions/store.ts
11
- function E(e, t = 0, n = { nodes: 0 }) {
12
- return ++n.nodes > 1e4 || t > 20 ? !1 : e === null || typeof e == "string" || typeof e == "boolean" ? !0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.every((e) => E(e, t + 1, n)) : typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype && Object.entries(e).every(([e, r]) => e.length <= 200 && E(r, t + 1, n));
12
+ function z(e, t = 0, n = { nodes: 0 }) {
13
+ return ++n.nodes > 1e4 || t > 20 ? !1 : e === null || typeof e == "string" || typeof e == "boolean" ? !0 : typeof e == "number" ? Number.isFinite(e) : Array.isArray(e) ? e.every((e) => z(e, t + 1, n)) : typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype && Object.entries(e).every(([e, r]) => e.length <= 200 && z(r, t + 1, n));
13
14
  }
14
- var D = T.custom((e) => E(e) && JSON.stringify(e).length <= 1e5), O = T.string().min(1).max(200).refine((e) => e === e.trim(), "Identity must be canonical"), k = T.string().trim().min(1).max(2e3), A = T.string().max(1e5), j = () => crypto.randomUUID();
15
- function M(e) {
16
- return e && typeof e == "object" && !Object.isFrozen(e) && (Object.values(e).forEach(M), Object.freeze(e)), e;
15
+ var B = R.custom((e) => z(e) && JSON.stringify(e).length <= 1e5), V = R.string().min(1).max(200).refine((e) => e === e.trim(), "Identity must be canonical"), H = R.string().trim().min(1).max(2e3), U = R.string().max(1e5), W = () => crypto.randomUUID();
16
+ function G(e) {
17
+ return e && typeof e == "object" && !Object.isFrozen(e) && (Object.values(e).forEach(G), Object.freeze(e)), e;
17
18
  }
18
- var N = class {
19
+ var K = class {
19
20
  state;
20
21
  disposed = !1;
21
22
  generation = 0;
22
23
  abort;
23
24
  usedIds = /* @__PURE__ */ new Set();
24
- requestIdentity(e = j) {
25
- let t = O.parse(e());
25
+ requestIdentity(e = W) {
26
+ let t = V.parse(e());
26
27
  if (this.usedIds.has(t)) throw Error("Request identity must be unique");
27
28
  return this.usedIds.add(t), t;
28
29
  }
29
30
  listeners = /* @__PURE__ */ new Set();
30
31
  constructor(e) {
31
- this.state = M(structuredClone(e));
32
+ this.state = G(structuredClone(e));
32
33
  }
33
34
  getSnapshot = () => this.state;
34
35
  subscribe = (e) => (this.listeners.add(e), () => this.listeners.delete(e));
35
36
  publish(e) {
36
- this.disposed || (this.state = M(structuredClone(e)), this.listeners.forEach((e) => e()));
37
+ this.disposed || (this.state = G(structuredClone(e)), this.listeners.forEach((e) => e()));
37
38
  }
38
39
  request() {
39
40
  return this.abort?.abort(), this.abort = new AbortController(), {
@@ -47,32 +48,32 @@ var N = class {
47
48
  dispose() {
48
49
  this.disposed = !0, ++this.generation, this.abort?.abort(), this.listeners.clear();
49
50
  }
50
- }, P = T.strictObject({
51
- id: O,
52
- title: k,
53
- tool: k,
54
- input: D,
55
- scope: k
56
- }), F = T.discriminatedUnion("status", [
57
- T.strictObject({
58
- requestId: O,
59
- status: T.literal("completed"),
60
- output: A
51
+ }, q = R.strictObject({
52
+ id: V,
53
+ title: H,
54
+ tool: H,
55
+ input: B,
56
+ scope: H
57
+ }), re = R.discriminatedUnion("status", [
58
+ R.strictObject({
59
+ requestId: V,
60
+ status: R.literal("completed"),
61
+ output: U
61
62
  }),
62
- T.strictObject({
63
- requestId: O,
64
- status: T.literal("rejected"),
65
- reason: k
63
+ R.strictObject({
64
+ requestId: V,
65
+ status: R.literal("rejected"),
66
+ reason: H
66
67
  }),
67
- T.strictObject({
68
- requestId: O,
69
- status: T.literal("unknown")
68
+ R.strictObject({
69
+ requestId: V,
70
+ status: R.literal("unknown")
70
71
  })
71
- ]), ee = T.union([F, T.strictObject({
72
- requestId: O,
73
- status: T.enum(["pending", "not-found"])
72
+ ]), ie = R.union([re, R.strictObject({
73
+ requestId: V,
74
+ status: R.enum(["pending", "not-found"])
74
75
  })]);
75
- function I(e, t) {
76
+ function ae(e, t) {
76
77
  switch (t.type) {
77
78
  case "propose": return {
78
79
  ...e,
@@ -141,25 +142,25 @@ function I(e, t) {
141
142
  }
142
143
  }
143
144
  }
144
- var te = class extends N {
145
+ var oe = class extends K {
145
146
  adapter;
146
147
  options;
147
148
  expiry;
148
149
  ttl;
149
150
  constructor(e, t, n = {}) {
150
- let r = T.array(P).min(1).max(50).parse(t);
151
+ let r = R.array(q).min(1).max(50).parse(t);
151
152
  if (new Set(r.map((e) => e.id)).size !== r.length) throw Error("Duplicate plan step");
152
153
  super({
153
154
  steps: r,
154
155
  completed: [],
155
156
  phase: "ready"
156
- }), this.adapter = e, this.options = n, this.ttl = T.number().finite().min(1e3).max(3e5).parse(n.approvalMs ?? 6e4);
157
+ }), this.adapter = e, this.options = n, this.ttl = R.number().finite().min(1e3).max(3e5).parse(n.approvalMs ?? 6e4);
157
158
  }
158
159
  now() {
159
160
  return (this.options.now ?? Date.now)();
160
161
  }
161
162
  send(e) {
162
- this.publish(I(this.state, e));
163
+ this.publish(ae(this.state, e));
163
164
  }
164
165
  propose(e) {
165
166
  clearTimeout(this.expiry), this.send({
@@ -171,7 +172,7 @@ var te = class extends N {
171
172
  }
172
173
  revise(e) {
173
174
  if (this.disposed || this.state.phase !== "ready" || this.state.completed.length) return !1;
174
- let t = T.array(P).min(1).max(50).safeParse(e);
175
+ let t = R.array(q).min(1).max(50).safeParse(e);
175
176
  return !t.success || new Set(t.data.map((e) => e.id)).size !== t.data.length ? !1 : (this.send({
176
177
  type: "revise",
177
178
  steps: t.data
@@ -181,7 +182,7 @@ var te = class extends N {
181
182
  if (this.disposed || this.state.phase !== "ready") return !1;
182
183
  let e = this.state.steps.find((e) => !this.state.completed.some((t) => t.stepId === e.id));
183
184
  return e ? (this.propose({
184
- requestId: this.requestIdentity(this.options.id ?? j),
185
+ requestId: this.requestIdentity(this.options.id ?? W),
185
186
  step: e,
186
187
  approvedUntil: this.now() + this.ttl
187
188
  }), !0) : !1;
@@ -195,13 +196,13 @@ var te = class extends N {
195
196
  try {
196
197
  let r = await this.adapter.execute(e, n, (n) => {
197
198
  if (this.current(t) && this.state.phase === "running" && this.state.request?.requestId === e.requestId) {
198
- let e = k.safeParse(n);
199
+ let e = H.safeParse(n);
199
200
  e.success && this.send({
200
201
  type: "progress",
201
202
  message: e.data
202
203
  });
203
204
  }
204
- }), i = F.parse(r);
205
+ }), i = re.parse(r);
205
206
  if (i.requestId !== e.requestId) throw Error("Wrong receipt");
206
207
  this.current(t) && this.send({
207
208
  type: "settle",
@@ -221,7 +222,7 @@ var te = class extends N {
221
222
  renew() {
222
223
  return this.disposed || !["failed", "expired"].includes(this.state.phase) || !this.state.request ? !1 : (this.propose({
223
224
  ...this.state.request,
224
- requestId: this.state.phase === "failed" ? this.requestIdentity(this.options.id ?? j) : this.state.request.requestId,
225
+ requestId: this.state.phase === "failed" ? this.requestIdentity(this.options.id ?? W) : this.state.request.requestId,
225
226
  approvedUntil: this.now() + this.ttl
226
227
  }), !0);
227
228
  }
@@ -230,7 +231,7 @@ var te = class extends N {
230
231
  let e = this.state.request, { token: t, signal: n } = this.request();
231
232
  return this.send({ type: "check" }), (async () => {
232
233
  try {
233
- let r = ee.parse(await this.adapter.lookup(e.requestId, n));
234
+ let r = ie.parse(await this.adapter.lookup(e.requestId, n));
234
235
  if (r.requestId !== e.requestId) throw Error("Wrong receipt");
235
236
  if (!this.current(t)) return;
236
237
  r.status === "not-found" ? this.propose({
@@ -238,7 +239,7 @@ var te = class extends N {
238
239
  approvedUntil: this.now() + this.ttl
239
240
  }) : r.status === "pending" ? this.send({ type: "uncertain" }) : this.send({
240
241
  type: "settle",
241
- result: F.parse(r)
242
+ result: re.parse(r)
242
243
  });
243
244
  } catch {
244
245
  this.current(t) && this.send({ type: "uncertain" });
@@ -248,41 +249,41 @@ var te = class extends N {
248
249
  dispose() {
249
250
  clearTimeout(this.expiry), super.dispose();
250
251
  }
251
- }, L = T.strictObject({
252
- id: O,
253
- title: k,
254
- revision: O,
255
- content: A,
256
- canEdit: T.boolean(),
257
- history: T.array(T.strictObject({
258
- revision: O,
259
- content: A
252
+ }, J = R.strictObject({
253
+ id: V,
254
+ title: H,
255
+ revision: V,
256
+ content: U,
257
+ canEdit: R.boolean(),
258
+ history: R.array(R.strictObject({
259
+ revision: V,
260
+ content: U
260
261
  })).max(100)
261
- }).refine((e) => new Set(e.history.map((e) => e.revision)).size === e.history.length, "Duplicate revision"), R = T.discriminatedUnion("status", [
262
- T.strictObject({
263
- requestId: O,
264
- status: T.literal("saved"),
265
- record: L
262
+ }).refine((e) => new Set(e.history.map((e) => e.revision)).size === e.history.length, "Duplicate revision"), Y = R.discriminatedUnion("status", [
263
+ R.strictObject({
264
+ requestId: V,
265
+ status: R.literal("saved"),
266
+ record: J
266
267
  }),
267
- T.strictObject({
268
- requestId: O,
269
- status: T.literal("conflict"),
270
- record: L
268
+ R.strictObject({
269
+ requestId: V,
270
+ status: R.literal("conflict"),
271
+ record: J
271
272
  }),
272
- T.strictObject({
273
- requestId: O,
274
- status: T.literal("rejected"),
275
- reason: k
273
+ R.strictObject({
274
+ requestId: V,
275
+ status: R.literal("rejected"),
276
+ reason: H
276
277
  }),
277
- T.strictObject({
278
- requestId: O,
279
- status: T.literal("unknown")
278
+ R.strictObject({
279
+ requestId: V,
280
+ status: R.literal("unknown")
280
281
  })
281
- ]), ne = T.union([R, T.strictObject({
282
- requestId: O,
283
- status: T.enum(["pending", "not-found"])
282
+ ]), se = R.union([Y, R.strictObject({
283
+ requestId: V,
284
+ status: R.enum(["pending", "not-found"])
284
285
  })]);
285
- function z(e, t) {
286
+ function ce(e, t) {
286
287
  switch (t.type) {
287
288
  case "load": return {
288
289
  ...e,
@@ -348,17 +349,17 @@ function z(e, t) {
348
349
  };
349
350
  }
350
351
  }
351
- var B = class extends N {
352
+ var le = class extends K {
352
353
  adapter;
353
354
  id;
354
- constructor(e, t = j) {
355
+ constructor(e, t = W) {
355
356
  super({
356
357
  phase: "idle",
357
358
  draft: ""
358
359
  }), this.adapter = e, this.id = t;
359
360
  }
360
361
  send(e) {
361
- this.publish(z(this.state, e));
362
+ this.publish(ce(this.state, e));
362
363
  }
363
364
  open(e) {
364
365
  if (this.disposed || [
@@ -367,7 +368,7 @@ var B = class extends N {
367
368
  "checking",
368
369
  "conflict"
369
370
  ].includes(this.state.phase) || this.state.record && this.state.draft !== this.state.record.content) return !1;
370
- let t = O.safeParse(e);
371
+ let t = V.safeParse(e);
371
372
  if (!t.success) return !1;
372
373
  let { token: n, signal: r } = this.request();
373
374
  return this.send({
@@ -375,7 +376,7 @@ var B = class extends N {
375
376
  id: t.data
376
377
  }), (async () => {
377
378
  try {
378
- let e = L.parse(await this.adapter.load(t.data, r));
379
+ let e = J.parse(await this.adapter.load(t.data, r));
379
380
  if (e.id !== t.data) throw Error("Wrong artifact");
380
381
  this.current(n) && this.send({
381
382
  type: "loaded",
@@ -387,7 +388,7 @@ var B = class extends N {
387
388
  })(), !0;
388
389
  }
389
390
  edit(e) {
390
- return this.disposed || !this.state.record?.canEdit || !["viewing", "editing"].includes(this.state.phase) || !A.safeParse(e).success ? !1 : (this.send({
391
+ return this.disposed || !this.state.record?.canEdit || !["viewing", "editing"].includes(this.state.phase) || !U.safeParse(e).success ? !1 : (this.send({
391
392
  type: "edit",
392
393
  content: e
393
394
  }), !0);
@@ -416,7 +417,7 @@ var B = class extends N {
416
417
  request: t
417
418
  }), (async () => {
418
419
  try {
419
- let e = R.parse(await this.adapter.save(t, r));
420
+ let e = Y.parse(await this.adapter.save(t, r));
420
421
  this.validateResult(e, t), this.current(n) && this.send({
421
422
  type: "settle",
422
423
  result: e
@@ -440,29 +441,29 @@ var B = class extends N {
440
441
  let e = this.state.request, { token: t, signal: n } = this.request();
441
442
  return this.send({ type: "check" }), (async () => {
442
443
  try {
443
- let r = ne.parse(await this.adapter.lookup(e.requestId, n));
444
+ let r = se.parse(await this.adapter.lookup(e.requestId, n));
444
445
  if (r.requestId !== e.requestId) throw Error("Wrong receipt");
445
446
  if (!this.current(t)) return;
446
- r.status === "not-found" ? this.send({ type: "not-found" }) : r.status === "pending" ? this.send({ type: "unknown" }) : (this.validateResult(R.parse(r), e), this.send({
447
+ r.status === "not-found" ? this.send({ type: "not-found" }) : r.status === "pending" ? this.send({ type: "unknown" }) : (this.validateResult(Y.parse(r), e), this.send({
447
448
  type: "settle",
448
- result: R.parse(r)
449
+ result: Y.parse(r)
449
450
  }));
450
451
  } catch {
451
452
  this.current(t) && this.send({ type: "unknown" });
452
453
  }
453
454
  })(), !0;
454
455
  }
455
- }, V = T.strictObject({
456
- requestId: O,
457
- responseId: O,
458
- rating: T.enum(["helpful", "unhelpful"]),
459
- comment: T.string().max(5e3)
460
- }), H = class extends N {
456
+ }, ue = R.strictObject({
457
+ requestId: V,
458
+ responseId: V,
459
+ rating: R.enum(["helpful", "unhelpful"]),
460
+ comment: R.string().max(5e3)
461
+ }), de = class extends K {
461
462
  adapter;
462
463
  id;
463
- constructor(e, t, n = j) {
464
+ constructor(e, t, n = W) {
464
465
  super({
465
- responseId: O.parse(t),
466
+ responseId: V.parse(t),
466
467
  rating: null,
467
468
  comment: "",
468
469
  phase: "editing"
@@ -479,7 +480,7 @@ var B = class extends N {
479
480
  }
480
481
  save() {
481
482
  if (this.disposed || !this.state.rating || !["editing", "error"].includes(this.state.phase)) return !1;
482
- let e = this.state.request ?? Object.freeze(V.parse({
483
+ let e = this.state.request ?? Object.freeze(ue.parse({
483
484
  requestId: this.requestIdentity(this.id),
484
485
  responseId: this.state.responseId,
485
486
  rating: this.state.rating,
@@ -491,9 +492,9 @@ var B = class extends N {
491
492
  request: e
492
493
  }), (async () => {
493
494
  try {
494
- let r = T.strictObject({
495
- requestId: O,
496
- responseId: O
495
+ let r = R.strictObject({
496
+ requestId: V,
497
+ responseId: V
497
498
  }).parse(await this.adapter.save(e, n));
498
499
  if (r.requestId !== e.requestId || r.responseId !== e.responseId) throw Error("Wrong feedback receipt");
499
500
  this.current(t) && this.publish({
@@ -508,11 +509,11 @@ var B = class extends N {
508
509
  }
509
510
  })(), !0;
510
511
  }
511
- }, U = T.strictObject({
512
- id: O,
513
- title: k,
514
- archived: T.boolean()
515
- }), W = U.extend({ payload: D }), re = class extends N {
512
+ }, X = R.strictObject({
513
+ id: V,
514
+ title: H,
515
+ archived: R.boolean()
516
+ }), fe = X.extend({ payload: B }), pe = class extends K {
516
517
  adapter;
517
518
  canLeave;
518
519
  constructor(e, t = () => !0) {
@@ -534,7 +535,7 @@ var B = class extends N {
534
535
  operation: "list"
535
536
  }), (async () => {
536
537
  try {
537
- let n = T.array(U).max(1e3).parse(await this.adapter.list(t));
538
+ let n = R.array(X).max(1e3).parse(await this.adapter.list(t));
538
539
  if (new Set(n.map((e) => e.id)).size !== n.length) throw Error("Duplicate thread");
539
540
  this.current(e) && this.publish({
540
541
  ...this.state,
@@ -560,7 +561,7 @@ var B = class extends N {
560
561
  operation: "open"
561
562
  }), (async () => {
562
563
  try {
563
- let r = W.parse(await this.adapter.load(e, n));
564
+ let r = fe.parse(await this.adapter.load(e, n));
564
565
  if (r.id !== e) throw Error("Wrong thread");
565
566
  this.current(t) && this.publish({
566
567
  ...this.state,
@@ -579,7 +580,7 @@ var B = class extends N {
579
580
  })(), !0;
580
581
  }
581
582
  rename(e, t) {
582
- let n = k.safeParse(t);
583
+ let n = H.safeParse(t);
583
584
  return n.success ? this.mutate(e, "rename", (t) => this.adapter.rename(e, n.data, t)) : !1;
584
585
  }
585
586
  archive(e, t) {
@@ -595,7 +596,7 @@ var B = class extends N {
595
596
  operation: t
596
597
  }), (async () => {
597
598
  try {
598
- let t = U.parse(await n(i));
599
+ let t = X.parse(await n(i));
599
600
  if (t.id !== e) throw Error("Wrong thread");
600
601
  this.current(r) && this.publish({
601
602
  ...this.state,
@@ -617,7 +618,7 @@ var B = class extends N {
617
618
  }
618
619
  })(), !0;
619
620
  }
620
- }, G = {
621
+ }, me = {
621
622
  code: "Code",
622
623
  files: "Files",
623
624
  checks: "Checks",
@@ -730,10 +731,49 @@ var B = class extends N {
730
731
  chooseThread: "Choose a conversation to see its saved context.",
731
732
  noThreads: "No conversations in this view.",
732
733
  threadError: "Couldn’t complete that request. The current conversation is still here.",
733
- loading: "Loading"
734
- }, K = h(G);
735
- function q({ copy: e = {}, children: t }) {
736
- let n = g(K), r = {
734
+ loading: "Loading",
735
+ gate: {
736
+ review: "Review",
737
+ approve: "Approve once",
738
+ approving: "Approving",
739
+ decline: "Decline",
740
+ edit: "Edit before approving",
741
+ irreversible: "Can't be undone",
742
+ waiting: "Waiting for your approval",
743
+ changed: "Something changed while you were deciding",
744
+ reviewChange: "Review the change",
745
+ reconsider: "Reconsider"
746
+ },
747
+ receipt: {
748
+ whatChanged: "What changed",
749
+ checking: "Checking what happened",
750
+ states: {
751
+ changed: "Changed",
752
+ "not-changed": "Not changed",
753
+ unknown: "Not known yet",
754
+ reverted: "Reverted"
755
+ },
756
+ minutesLeft: (e) => e === 1 ? "1 min left" : `${e} min left`,
757
+ closed: "Undo has closed"
758
+ },
759
+ progress: {
760
+ showStages: "Show stages",
761
+ stagesDone: (e, t) => `${e} of ${t} stages`,
762
+ noAction: "No action needed",
763
+ review: "Review",
764
+ stageWords: {
765
+ done: "done",
766
+ now: "now",
767
+ next: "to come"
768
+ }
769
+ },
770
+ run: {
771
+ number: (e) => new Intl.NumberFormat("en").format(e),
772
+ lines: (e, t) => `${e} lines added, ${t} removed`
773
+ }
774
+ }, he = O(me);
775
+ function ge({ copy: e = {}, children: t }) {
776
+ let n = k(he), r = {
737
777
  ...n,
738
778
  ...e,
739
779
  toolStates: {
@@ -751,75 +791,91 @@ function q({ copy: e = {}, children: t }) {
751
791
  connection: {
752
792
  ...n.connection,
753
793
  ...e.connection
794
+ },
795
+ gate: {
796
+ ...n.gate,
797
+ ...e.gate
798
+ },
799
+ run: {
800
+ ...n.run,
801
+ ...e.run
802
+ },
803
+ receipt: {
804
+ ...n.receipt,
805
+ ...e.receipt
806
+ },
807
+ progress: {
808
+ ...n.progress,
809
+ ...e.progress
754
810
  }
755
811
  };
756
- return /* @__PURE__ */ C(K.Provider, {
812
+ return /* @__PURE__ */ I(he.Provider, {
757
813
  value: r,
758
814
  children: t
759
815
  });
760
816
  }
761
- var J = () => g(K);
817
+ var Z = () => k(he);
762
818
  //#endregion
763
819
  //#region src/reusable/interactions/presentation.tsx
764
- function Y(e) {
820
+ function _e(e) {
765
821
  if (!(typeof e != "string" || e.length > 2e3)) try {
766
822
  let t = new URL(e);
767
823
  if (["https:", "http:"].includes(t.protocol) && !t.username && !t.password) return t.href;
768
824
  } catch {}
769
825
  }
770
- var ie = T.strictObject({
771
- id: O,
772
- title: k,
773
- url: T.string().max(2e3).optional(),
774
- excerpt: A.optional(),
775
- claim: k.optional()
826
+ var ve = R.strictObject({
827
+ id: V,
828
+ title: H,
829
+ url: R.string().max(2e3).optional(),
830
+ excerpt: U.optional(),
831
+ claim: H.optional()
776
832
  });
777
- function X({ sources: e, label: t }) {
778
- let r = J();
779
- t ??= r.sources;
780
- let i = T.array(ie).max(100).safeParse(e);
781
- return i.success ? /* @__PURE__ */ w("section", {
833
+ function ye({ sources: e, label: t }) {
834
+ let n = Z();
835
+ t ??= n.sources;
836
+ let r = R.array(ve).max(100).safeParse(e);
837
+ return r.success ? /* @__PURE__ */ L("section", {
782
838
  "aria-label": t,
783
839
  className: "min-w-0",
784
840
  children: [
785
- /* @__PURE__ */ C("h3", {
841
+ /* @__PURE__ */ I("h3", {
786
842
  className: "mb-3 type-heading text-fg-emphasis",
787
843
  children: t
788
844
  }),
789
- !i.data.length && /* @__PURE__ */ C("p", {
845
+ !r.data.length && /* @__PURE__ */ I("p", {
790
846
  className: "type-body text-fg-subtle",
791
- children: r.noSources
847
+ children: n.noSources
792
848
  }),
793
- /* @__PURE__ */ C("ol", {
849
+ /* @__PURE__ */ I("ol", {
794
850
  className: "flex flex-col gap-4",
795
- children: i.data.map((e, t) => {
796
- let n = Y(e.url);
797
- return /* @__PURE__ */ w("li", {
851
+ children: r.data.map((e, t) => {
852
+ let r = _e(e.url);
853
+ return /* @__PURE__ */ L("li", {
798
854
  className: "min-w-0 rounded-control border border-line-subtle bg-surface p-4",
799
855
  children: [
800
- /* @__PURE__ */ C("span", {
856
+ /* @__PURE__ */ I("span", {
801
857
  className: "mr-2 font-mono type-caption text-fg-subtle",
802
858
  children: t + 1
803
859
  }),
804
- n ? /* @__PURE__ */ C(x, {
805
- href: n,
860
+ r ? /* @__PURE__ */ I(ne, {
861
+ href: r,
806
862
  target: "_blank",
807
863
  rel: "noopener noreferrer",
808
- "aria-label": r.source(t + 1, e.title),
864
+ "aria-label": n.source(t + 1, e.title),
809
865
  className: "rounded-cell type-label break-words text-fg-emphasis underline outline-none data-focus-visible:focus-ring",
810
866
  children: e.title
811
- }) : /* @__PURE__ */ w("span", {
867
+ }) : /* @__PURE__ */ L("span", {
812
868
  className: "type-label text-fg-emphasis",
813
- children: [e.title, /* @__PURE__ */ C("span", {
869
+ children: [e.title, /* @__PURE__ */ I("span", {
814
870
  className: "ml-2 type-caption text-fg-subtle",
815
- children: r.unavailable
871
+ children: n.unavailable
816
872
  })]
817
873
  }),
818
- e.claim && /* @__PURE__ */ C("p", {
874
+ e.claim && /* @__PURE__ */ I("p", {
819
875
  className: "mt-2 type-body text-fg",
820
876
  children: e.claim
821
877
  }),
822
- e.excerpt && /* @__PURE__ */ C("blockquote", {
878
+ e.excerpt && /* @__PURE__ */ I("blockquote", {
823
879
  className: "mt-2 border-l-2 border-line-emphasis pl-3 type-body whitespace-pre-wrap text-fg-subtle",
824
880
  children: e.excerpt
825
881
  })
@@ -828,14 +884,14 @@ function X({ sources: e, label: t }) {
828
884
  })
829
885
  })
830
886
  ]
831
- }) : /* @__PURE__ */ C(n, {
887
+ }) : /* @__PURE__ */ I(f, {
832
888
  tone: "error",
833
- children: r.invalid
889
+ children: n.invalid
834
890
  });
835
891
  }
836
- function ae({ source: e, index: t }) {
837
- let n = J(), r = Y(e.url);
838
- return r ? /* @__PURE__ */ w(x, {
892
+ function be({ source: e, index: t }) {
893
+ let n = Z(), r = _e(e.url);
894
+ return r ? /* @__PURE__ */ L(ne, {
839
895
  href: r,
840
896
  target: "_blank",
841
897
  rel: "noopener noreferrer",
@@ -846,7 +902,7 @@ function ae({ source: e, index: t }) {
846
902
  t,
847
903
  "]"
848
904
  ]
849
- }) : /* @__PURE__ */ w("span", {
905
+ }) : /* @__PURE__ */ L("span", {
850
906
  "aria-label": n.unavailable,
851
907
  className: "font-mono type-caption text-fg-subtle",
852
908
  children: [
@@ -856,16 +912,16 @@ function ae({ source: e, index: t }) {
856
912
  ]
857
913
  });
858
914
  }
859
- function oe({ documents: e }) {
860
- let t = J();
861
- return /* @__PURE__ */ C(d, {
915
+ function xe({ documents: e }) {
916
+ let t = Z();
917
+ return /* @__PURE__ */ I(D, {
862
918
  label: t.retrieval,
863
919
  items: [{
864
920
  id: "context",
865
921
  title: t.retrieval,
866
- content: /* @__PURE__ */ C("div", {
922
+ content: /* @__PURE__ */ I("div", {
867
923
  className: "flex flex-col gap-4",
868
- children: e.map((e, n) => /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C(f, { children: e.included ? t.included : t.excluded }), /* @__PURE__ */ C(X, {
924
+ children: e.map((e, n) => /* @__PURE__ */ L("div", { children: [/* @__PURE__ */ I(S, { children: e.included ? t.included : t.excluded }), /* @__PURE__ */ I(ye, {
869
925
  label: e.title,
870
926
  sources: [{
871
927
  id: e.id,
@@ -879,19 +935,19 @@ function oe({ documents: e }) {
879
935
  }]
880
936
  });
881
937
  }
882
- function se({ text: e, status: n = "complete", label: r }) {
883
- let i = J();
884
- return r ??= i.explanation, /* @__PURE__ */ w("div", {
938
+ function Se({ text: e, status: t = "complete", label: n }) {
939
+ let r = Z();
940
+ return n ??= r.explanation, /* @__PURE__ */ L("div", {
885
941
  className: "min-w-0",
886
- children: [/* @__PURE__ */ w("div", {
942
+ children: [/* @__PURE__ */ L("div", {
887
943
  className: "flex items-center gap-2 type-caption text-fg-subtle",
888
- children: [n === "working" && /* @__PURE__ */ C(t, {}), i.supplied]
889
- }), /* @__PURE__ */ C(d, {
890
- label: r,
944
+ children: [t === "working" && /* @__PURE__ */ I(l, {}), r.supplied]
945
+ }), /* @__PURE__ */ I(D, {
946
+ label: n,
891
947
  items: [{
892
948
  id: "explanation",
893
- title: r,
894
- content: /* @__PURE__ */ C("p", {
949
+ title: n,
950
+ content: /* @__PURE__ */ I("p", {
895
951
  className: "type-body break-words whitespace-pre-wrap",
896
952
  children: e
897
953
  })
@@ -899,143 +955,143 @@ function se({ text: e, status: n = "complete", label: r }) {
899
955
  })]
900
956
  });
901
957
  }
902
- function Z({ title: e, status: r, input: i, output: o }) {
903
- let s = J(), c = D.safeParse(i);
904
- return c.success ? /* @__PURE__ */ w(p, {
958
+ function Ce({ title: e, status: t, input: n, output: r }) {
959
+ let i = Z(), a = B.safeParse(n);
960
+ return a.success ? /* @__PURE__ */ L(E, {
905
961
  "aria-label": e,
906
- children: [/* @__PURE__ */ w("div", {
962
+ children: [/* @__PURE__ */ L("div", {
907
963
  className: "mb-3 flex flex-wrap items-center justify-between gap-3",
908
- children: [/* @__PURE__ */ C("h3", {
964
+ children: [/* @__PURE__ */ I("h3", {
909
965
  className: "type-heading text-fg-emphasis",
910
966
  children: e
911
- }), /* @__PURE__ */ w(f, {
912
- tone: r === "completed" ? "success" : r === "unknown" ? "attention" : "neutral",
913
- children: [r === "running" && /* @__PURE__ */ C(t, {}), s.toolStates[r]]
967
+ }), /* @__PURE__ */ L(S, {
968
+ tone: t === "completed" ? "success" : t === "unknown" ? "attention" : "neutral",
969
+ children: [t === "running" && /* @__PURE__ */ I(l, {}), i.toolStates[t]]
914
970
  })]
915
- }), /* @__PURE__ */ C(d, {
916
- label: s.tool,
971
+ }), /* @__PURE__ */ I(D, {
972
+ label: i.tool,
917
973
  items: [{
918
974
  id: "input",
919
- title: s.inputs,
920
- content: /* @__PURE__ */ C(a, {
921
- code: JSON.stringify(c.data, null, 2),
975
+ title: i.inputs,
976
+ content: /* @__PURE__ */ I(g, {
977
+ code: JSON.stringify(a.data, null, 2),
922
978
  language: "json"
923
979
  })
924
- }, ...o === void 0 ? [] : [{
980
+ }, ...r === void 0 ? [] : [{
925
981
  id: "output",
926
- title: s.output,
927
- content: /* @__PURE__ */ C("p", {
982
+ title: i.output,
983
+ content: /* @__PURE__ */ I("p", {
928
984
  className: "type-body break-words whitespace-pre-wrap",
929
- children: o
985
+ children: r
930
986
  })
931
987
  }]],
932
988
  allowsMultipleExpanded: !0
933
989
  })]
934
- }) : /* @__PURE__ */ C(n, {
990
+ }) : /* @__PURE__ */ I(f, {
935
991
  tone: "error",
936
- children: s.invalid
992
+ children: i.invalid
937
993
  });
938
994
  }
939
- function ce({ claim: e, explanation: t }) {
940
- let r = J();
941
- return /* @__PURE__ */ w(n, {
995
+ function we({ claim: e, explanation: t }) {
996
+ let n = Z();
997
+ return /* @__PURE__ */ L(f, {
942
998
  tone: "attention",
943
- title: r.checkClaim,
944
- children: [/* @__PURE__ */ C("p", { children: e }), /* @__PURE__ */ C("p", {
999
+ title: n.checkClaim,
1000
+ children: [/* @__PURE__ */ I("p", { children: e }), /* @__PURE__ */ I("p", {
945
1001
  className: "mt-2",
946
1002
  children: t
947
1003
  })]
948
1004
  });
949
1005
  }
950
- function le({ reason: t, alternatives: r, onChoose: i }) {
951
- let a = J();
952
- return /* @__PURE__ */ C(n, {
1006
+ function Te({ reason: e, alternatives: t, onChoose: n }) {
1007
+ let r = Z();
1008
+ return /* @__PURE__ */ I(f, {
953
1009
  tone: "attention",
954
- title: a.blocked,
955
- actions: r.map((t) => /* @__PURE__ */ C(e, {
1010
+ title: r.blocked,
1011
+ actions: t.map((e) => /* @__PURE__ */ I(c, {
956
1012
  size: "sm",
957
- onPress: () => i(t.id),
958
- children: t.label
959
- }, t.id)),
960
- children: t
1013
+ onPress: () => n(e.id),
1014
+ children: e.label
1015
+ }, e.id)),
1016
+ children: e
961
1017
  });
962
1018
  }
963
- function ue({ state: t, onReconnect: r }) {
964
- let i = J();
965
- return /* @__PURE__ */ C(n, {
966
- tone: t === "connected" ? "neutral" : "attention",
967
- title: i.connection[t],
968
- actions: t === "disconnected" && r ? /* @__PURE__ */ C(e, {
1019
+ function Ee({ state: e, onReconnect: t }) {
1020
+ let n = Z();
1021
+ return /* @__PURE__ */ I(f, {
1022
+ tone: e === "connected" ? "neutral" : "attention",
1023
+ title: n.connection[e],
1024
+ actions: e === "disconnected" && t ? /* @__PURE__ */ I(c, {
969
1025
  size: "sm",
970
- onPress: r,
971
- children: i.reconnect
1026
+ onPress: t,
1027
+ children: n.reconnect
972
1028
  }) : void 0,
973
- children: t !== "connected" && i.disconnected
1029
+ children: e !== "connected" && n.disconnected
974
1030
  });
975
1031
  }
976
- function de({ models: e, model: t, onModelChange: n, contexts: r = [], selectedContext: i = [], onContextChange: a, commands: o = [], onCommand: s }) {
977
- let u = J();
978
- return /* @__PURE__ */ w("div", {
1032
+ function De({ models: e, model: t, onModelChange: n, contexts: r = [], selectedContext: i = [], onContextChange: a, commands: o = [], onCommand: s }) {
1033
+ let c = Z();
1034
+ return /* @__PURE__ */ L("div", {
979
1035
  className: "flex min-w-0 flex-col gap-4",
980
1036
  children: [
981
- /* @__PURE__ */ C(m, {
982
- label: u.model,
1037
+ /* @__PURE__ */ I(x, {
1038
+ label: c.model,
983
1039
  options: e,
984
1040
  selectedKey: t,
985
1041
  onSelectionChange: (e) => {
986
1042
  e !== null && n(String(e));
987
1043
  }
988
1044
  }),
989
- r.length > 0 && a && /* @__PURE__ */ C(c, {
990
- label: u.context,
1045
+ r.length > 0 && a && /* @__PURE__ */ I(T, {
1046
+ label: c.context,
991
1047
  options: r,
992
1048
  value: [...i],
993
1049
  onChange: a
994
1050
  }),
995
1051
  " ",
996
- o.length > 0 && s && /* @__PURE__ */ C(l, {
997
- label: u.commands,
1052
+ o.length > 0 && s && /* @__PURE__ */ I("div", { children: /* @__PURE__ */ I(v, {
1053
+ label: c.commands,
998
1054
  items: o,
999
1055
  onAction: s
1000
- })
1056
+ }) })
1001
1057
  ]
1002
1058
  });
1003
1059
  }
1004
- function fe({ quote: t, onReply: n }) {
1005
- let r = J();
1006
- return /* @__PURE__ */ w(p, {
1007
- "aria-label": r.quote,
1060
+ function Oe({ quote: e, onReply: t }) {
1061
+ let n = Z();
1062
+ return /* @__PURE__ */ L(E, {
1063
+ "aria-label": n.quote,
1008
1064
  children: [
1009
- /* @__PURE__ */ C("blockquote", {
1065
+ /* @__PURE__ */ I("blockquote", {
1010
1066
  className: "border-l-2 border-line-emphasis pl-3 type-body break-words whitespace-pre-wrap",
1011
- children: t.text
1067
+ children: e.text
1012
1068
  }),
1013
- /* @__PURE__ */ C("p", {
1069
+ /* @__PURE__ */ I("p", {
1014
1070
  className: "mt-3 type-caption text-fg-subtle",
1015
- children: t.sourceTitle
1071
+ children: e.sourceTitle
1016
1072
  }),
1017
- n && /* @__PURE__ */ C(e, {
1073
+ t && /* @__PURE__ */ I(c, {
1018
1074
  size: "sm",
1019
1075
  className: "mt-4",
1020
- onPress: () => n({ ...t }),
1021
- children: r.reply
1076
+ onPress: () => t({ ...e }),
1077
+ children: n.reply
1022
1078
  })
1023
1079
  ]
1024
1080
  });
1025
1081
  }
1026
- function pe({ code: e, files: t, output: n, tests: r }) {
1027
- let i = J(), o = [
1082
+ function ke({ code: e, files: t, output: n, tests: r }) {
1083
+ let i = Z(), a = [
1028
1084
  ...e === void 0 ? [] : [{
1029
1085
  id: "code",
1030
1086
  label: i.code,
1031
- content: /* @__PURE__ */ C(a, { code: e })
1087
+ content: /* @__PURE__ */ I(g, { code: e })
1032
1088
  }],
1033
1089
  ...t === void 0 ? [] : [{
1034
1090
  id: "files",
1035
1091
  label: i.files,
1036
- content: /* @__PURE__ */ C("ul", {
1092
+ content: /* @__PURE__ */ I("ul", {
1037
1093
  className: "flex flex-col gap-2 font-mono type-caption",
1038
- children: t.map((e, t) => /* @__PURE__ */ C("li", {
1094
+ children: t.map((e, t) => /* @__PURE__ */ I("li", {
1039
1095
  className: "break-words",
1040
1096
  children: e
1041
1097
  }, t))
@@ -1044,7 +1100,7 @@ function pe({ code: e, files: t, output: n, tests: r }) {
1044
1100
  ...n === void 0 ? [] : [{
1045
1101
  id: "output",
1046
1102
  label: i.output,
1047
- content: /* @__PURE__ */ C("pre", {
1103
+ content: /* @__PURE__ */ I("pre", {
1048
1104
  className: "type-caption break-words whitespace-pre-wrap",
1049
1105
  children: n
1050
1106
  })
@@ -1052,14 +1108,14 @@ function pe({ code: e, files: t, output: n, tests: r }) {
1052
1108
  ...r === void 0 ? [] : [{
1053
1109
  id: "tests",
1054
1110
  label: i.checks,
1055
- content: /* @__PURE__ */ C("ul", {
1111
+ content: /* @__PURE__ */ I("ul", {
1056
1112
  className: "flex flex-col gap-3",
1057
- children: r.map((e, t) => /* @__PURE__ */ w("li", {
1113
+ children: r.map((e, t) => /* @__PURE__ */ L("li", {
1058
1114
  className: "flex flex-wrap gap-2",
1059
- children: [/* @__PURE__ */ C(f, {
1115
+ children: [/* @__PURE__ */ I(S, {
1060
1116
  tone: e.passed ? "success" : "error",
1061
1117
  children: e.passed ? i.passed : i.failed
1062
- }), /* @__PURE__ */ C("span", {
1118
+ }), /* @__PURE__ */ I("span", {
1063
1119
  className: "type-body",
1064
1120
  children: e.name
1065
1121
  })]
@@ -1067,520 +1123,520 @@ function pe({ code: e, files: t, output: n, tests: r }) {
1067
1123
  })
1068
1124
  }]
1069
1125
  ];
1070
- return /* @__PURE__ */ C(u, {
1126
+ return /* @__PURE__ */ I(b, {
1071
1127
  label: i.tool,
1072
- items: o
1128
+ items: a
1073
1129
  });
1074
1130
  }
1075
- function me({ measurements: e }) {
1076
- let t = J();
1077
- return /* @__PURE__ */ w("section", {
1131
+ function Ae({ measurements: e }) {
1132
+ let t = Z();
1133
+ return /* @__PURE__ */ L("section", {
1078
1134
  "aria-label": t.trace,
1079
- children: [/* @__PURE__ */ C("h3", {
1135
+ children: [/* @__PURE__ */ I("h3", {
1080
1136
  className: "mb-3 type-heading text-fg-emphasis",
1081
1137
  children: t.trace
1082
- }), /* @__PURE__ */ C("dl", {
1138
+ }), /* @__PURE__ */ I("dl", {
1083
1139
  className: "grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-2 type-body",
1084
- children: e.map((e, n) => /* @__PURE__ */ w("div", {
1140
+ children: e.map((e, n) => /* @__PURE__ */ L("div", {
1085
1141
  className: "contents",
1086
- children: [/* @__PURE__ */ C("dt", {
1142
+ children: [/* @__PURE__ */ I("dt", {
1087
1143
  className: "text-fg-subtle",
1088
1144
  children: e.label
1089
- }), /* @__PURE__ */ C("dd", {
1145
+ }), /* @__PURE__ */ I("dd", {
1090
1146
  className: "text-right break-words numeric",
1091
- children: e.value === void 0 ? t.notReported : /* @__PURE__ */ w(S, { children: [e.value, e.unit && ` ${e.unit}`] })
1147
+ children: e.value === void 0 ? t.notReported : /* @__PURE__ */ L(F, { children: [e.value, e.unit && ` ${e.unit}`] })
1092
1148
  })]
1093
1149
  }, n))
1094
1150
  })]
1095
1151
  });
1096
1152
  }
1097
- function Q({ label: e, status: t, children: n }) {
1098
- return /* @__PURE__ */ w("div", {
1153
+ function je({ label: e, status: t, children: n }) {
1154
+ return /* @__PURE__ */ L("div", {
1099
1155
  className: "flex min-w-0 flex-col gap-2",
1100
- children: [/* @__PURE__ */ w("div", {
1156
+ children: [/* @__PURE__ */ L("div", {
1101
1157
  className: "flex flex-wrap items-center justify-between gap-3",
1102
- children: [/* @__PURE__ */ C("h3", {
1158
+ children: [/* @__PURE__ */ I("h3", {
1103
1159
  className: "type-heading text-fg-emphasis",
1104
1160
  children: e
1105
- }), /* @__PURE__ */ C(f, { children: t })]
1161
+ }), /* @__PURE__ */ I(S, { children: t })]
1106
1162
  }), n]
1107
1163
  });
1108
1164
  }
1109
1165
  //#endregion
1110
1166
  //#region src/reusable/interactions/web.tsx
1111
- function $({ phase: e, label: t, children: n, terminal: r = !1 }) {
1112
- let a = v(null), o = v(!1);
1113
- return _(() => {
1114
- o.current && document.activeElement === document.body && a.current?.focus({ preventScroll: !0 }), o.current = !1;
1115
- }, [e]), /* @__PURE__ */ C(i, {
1167
+ function Me({ phase: e, label: t, children: n, terminal: r = !1 }) {
1168
+ let i = M(null), a = M(!1);
1169
+ return j(() => {
1170
+ a.current && document.activeElement === document.body && i.current?.focus({ preventScroll: !0 }), a.current = !1;
1171
+ }, [e]), /* @__PURE__ */ I(h, {
1116
1172
  phase: e,
1117
1173
  label: t,
1118
1174
  terminal: r,
1119
1175
  frameClassName: "max-w-2xl",
1120
- children: /* @__PURE__ */ C("div", {
1121
- ref: a,
1176
+ children: /* @__PURE__ */ I("div", {
1177
+ ref: i,
1122
1178
  tabIndex: -1,
1123
1179
  role: "group",
1124
1180
  "aria-label": t,
1125
1181
  onPointerDownCapture: () => {
1126
- o.current = !0;
1182
+ a.current = !0;
1127
1183
  },
1128
1184
  onKeyDownCapture: () => {
1129
- o.current = !0;
1185
+ a.current = !0;
1130
1186
  },
1131
1187
  onClickCapture: () => {
1132
- o.current = !0;
1188
+ a.current = !0;
1133
1189
  },
1134
1190
  className: "mx-auto w-full max-w-2xl min-w-0 outline-none",
1135
1191
  children: n
1136
1192
  })
1137
1193
  });
1138
1194
  }
1139
- function he({ controller: e, label: t }) {
1140
- let n = J();
1141
- return t ??= n.agent, /* @__PURE__ */ C(r, { children: /* @__PURE__ */ C(ge, {
1195
+ function Ne({ controller: e, label: t }) {
1196
+ let n = Z();
1197
+ return t ??= n.agent, /* @__PURE__ */ I(m, { children: /* @__PURE__ */ I(Pe, {
1142
1198
  controller: e,
1143
1199
  label: t
1144
1200
  }) });
1145
1201
  }
1146
- function ge({ controller: e, label: t }) {
1147
- let n = J(), r = b(e.subscribe, e.getSnapshot, e.getSnapshot);
1148
- return /* @__PURE__ */ C($, {
1202
+ function Pe({ controller: e, label: t }) {
1203
+ let n = Z(), r = P(e.subscribe, e.getSnapshot, e.getSnapshot);
1204
+ return /* @__PURE__ */ I(Me, {
1149
1205
  phase: `agent-${r.completed.length}-${r.phase}`,
1150
1206
  label: n.agentStates[r.phase],
1151
1207
  terminal: r.phase === "complete" || r.phase === "denied",
1152
- children: /* @__PURE__ */ C(_e, {
1208
+ children: /* @__PURE__ */ I(Fe, {
1153
1209
  state: r,
1154
1210
  label: t,
1155
1211
  controller: e
1156
1212
  })
1157
1213
  });
1158
1214
  }
1159
- function _e({ state: r, label: i, controller: a }) {
1160
- let o = J();
1161
- return /* @__PURE__ */ w(p, {
1162
- "aria-label": i,
1215
+ function Fe({ state: e, label: t, controller: n }) {
1216
+ let r = Z();
1217
+ return /* @__PURE__ */ L(E, {
1218
+ "aria-label": t,
1163
1219
  children: [
1164
- /* @__PURE__ */ w("div", {
1220
+ /* @__PURE__ */ L("div", {
1165
1221
  className: "flex flex-wrap items-center justify-between gap-3",
1166
- children: [/* @__PURE__ */ C("h2", {
1222
+ children: [/* @__PURE__ */ I("h2", {
1167
1223
  className: "type-heading text-fg-emphasis",
1168
- children: i
1169
- }), /* @__PURE__ */ C("span", {
1224
+ children: t
1225
+ }), /* @__PURE__ */ I("span", {
1170
1226
  role: "status",
1171
1227
  className: "type-caption text-fg-subtle",
1172
- children: o.agentStates[r.phase]
1228
+ children: r.agentStates[e.phase]
1173
1229
  })]
1174
1230
  }),
1175
- /* @__PURE__ */ C("ol", {
1176
- "aria-label": o.plan,
1231
+ /* @__PURE__ */ I("ol", {
1232
+ "aria-label": r.plan,
1177
1233
  className: "mt-4 flex flex-col gap-3",
1178
- children: r.steps.map((e) => /* @__PURE__ */ w("li", {
1234
+ children: e.steps.map((t) => /* @__PURE__ */ L("li", {
1179
1235
  className: "flex flex-wrap items-center justify-between gap-3 type-body",
1180
- children: [/* @__PURE__ */ C("span", { children: e.title }), /* @__PURE__ */ C(f, {
1181
- tone: r.completed.some((t) => t.stepId === e.id) ? "success" : "neutral",
1182
- children: r.completed.some((t) => t.stepId === e.id) ? o.toolStates.completed : o.toolStates.pending
1236
+ children: [/* @__PURE__ */ I("span", { children: t.title }), /* @__PURE__ */ I(S, {
1237
+ tone: e.completed.some((e) => e.stepId === t.id) ? "success" : "neutral",
1238
+ children: e.completed.some((e) => e.stepId === t.id) ? r.toolStates.completed : r.toolStates.pending
1183
1239
  })]
1184
- }, e.id))
1240
+ }, t.id))
1185
1241
  }),
1186
- r.completed.map((e) => /* @__PURE__ */ C(Z, {
1187
- title: r.steps.find((t) => t.id === e.stepId)?.title ?? o.tool,
1242
+ e.completed.map((t) => /* @__PURE__ */ I(Ce, {
1243
+ title: e.steps.find((e) => e.id === t.stepId)?.title ?? r.tool,
1188
1244
  status: "completed",
1189
- input: r.steps.find((t) => t.id === e.stepId)?.input ?? null,
1190
- output: e.output
1191
- }, e.requestId)),
1192
- r.request && /* @__PURE__ */ w("div", {
1245
+ input: e.steps.find((e) => e.id === t.stepId)?.input ?? null,
1246
+ output: t.output
1247
+ }, t.requestId)),
1248
+ e.request && /* @__PURE__ */ L("div", {
1193
1249
  className: "mt-6 flex flex-col gap-4",
1194
1250
  children: [
1195
- /* @__PURE__ */ C(Z, {
1196
- title: r.request.step.title,
1197
- status: r.phase === "approval" ? "approval" : r.phase === "running" ? "running" : r.phase === "failed" ? "rejected" : "unknown",
1198
- input: r.request.step.input
1251
+ /* @__PURE__ */ I(Ce, {
1252
+ title: e.request.step.title,
1253
+ status: e.phase === "approval" ? "approval" : e.phase === "running" ? "running" : e.phase === "failed" ? "rejected" : "unknown",
1254
+ input: e.request.step.input
1199
1255
  }),
1200
- /* @__PURE__ */ w("p", {
1256
+ /* @__PURE__ */ L("p", {
1201
1257
  className: "type-body",
1202
- children: [/* @__PURE__ */ w("span", {
1258
+ children: [/* @__PURE__ */ L("span", {
1203
1259
  className: "type-label",
1204
- children: [o.scope, ": "]
1205
- }), r.request.step.scope]
1260
+ children: [r.scope, ": "]
1261
+ }), e.request.step.scope]
1206
1262
  }),
1207
- r.phase === "approval" && /* @__PURE__ */ C("p", {
1263
+ e.phase === "approval" && /* @__PURE__ */ I("p", {
1208
1264
  className: "type-caption text-fg-subtle",
1209
- children: o.approvalHint
1265
+ children: r.approvalHint
1210
1266
  })
1211
1267
  ]
1212
1268
  }),
1213
- r.progress && /* @__PURE__ */ C("p", {
1269
+ e.progress && /* @__PURE__ */ I("p", {
1214
1270
  role: "status",
1215
1271
  className: "mt-4 type-body",
1216
- children: r.progress
1272
+ children: e.progress
1217
1273
  }),
1218
- r.phase === "uncertain" && /* @__PURE__ */ C(n, {
1274
+ e.phase === "uncertain" && /* @__PURE__ */ I(f, {
1219
1275
  tone: "attention",
1220
1276
  className: "mt-4",
1221
- children: o.unknown
1277
+ children: r.unknown
1222
1278
  }),
1223
- r.reason && /* @__PURE__ */ C(n, {
1279
+ e.reason && /* @__PURE__ */ I(f, {
1224
1280
  tone: "error",
1225
1281
  className: "mt-4",
1226
- children: r.reason
1282
+ children: e.reason
1227
1283
  }),
1228
- r.phase === "expired" && /* @__PURE__ */ C(n, {
1284
+ e.phase === "expired" && /* @__PURE__ */ I(f, {
1229
1285
  tone: "attention",
1230
1286
  className: "mt-4",
1231
- children: o.expires
1287
+ children: r.expires
1232
1288
  }),
1233
- r.phase === "denied" && /* @__PURE__ */ C("p", {
1289
+ e.phase === "denied" && /* @__PURE__ */ I("p", {
1234
1290
  className: "mt-4 type-body",
1235
- children: o.denied
1291
+ children: r.denied
1236
1292
  }),
1237
- r.phase === "complete" && /* @__PURE__ */ C("p", {
1293
+ e.phase === "complete" && /* @__PURE__ */ I("p", {
1238
1294
  className: "mt-4 type-body",
1239
- children: o.complete
1295
+ children: r.complete
1240
1296
  }),
1241
- /* @__PURE__ */ w("div", {
1297
+ /* @__PURE__ */ L("div", {
1242
1298
  className: "mt-6 flex flex-wrap gap-3",
1243
1299
  children: [
1244
- r.phase === "ready" && /* @__PURE__ */ C(e, {
1245
- onPress: () => a.next(),
1246
- children: o.request
1300
+ e.phase === "ready" && /* @__PURE__ */ I(c, {
1301
+ onPress: () => n.next(),
1302
+ children: r.request
1247
1303
  }),
1248
- r.phase === "approval" && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(e, {
1304
+ e.phase === "approval" && /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I(c, {
1249
1305
  variant: "primary",
1250
- onPress: () => a.approve(),
1251
- children: o.allow
1252
- }), /* @__PURE__ */ C(e, {
1253
- onPress: () => a.deny(),
1254
- children: o.deny
1306
+ onPress: () => n.approve(),
1307
+ children: r.allow
1308
+ }), /* @__PURE__ */ I(c, {
1309
+ onPress: () => n.deny(),
1310
+ children: r.deny
1255
1311
  })] }),
1256
- r.phase === "running" && /* @__PURE__ */ C(e, {
1257
- onPress: () => a.stop(),
1258
- children: o.stop
1312
+ e.phase === "running" && /* @__PURE__ */ I(c, {
1313
+ onPress: () => n.stop(),
1314
+ children: r.stop
1259
1315
  }),
1260
- r.phase === "uncertain" && /* @__PURE__ */ C(e, {
1261
- onPress: () => a.check(),
1262
- children: o.check
1316
+ e.phase === "uncertain" && /* @__PURE__ */ I(c, {
1317
+ onPress: () => n.check(),
1318
+ children: r.check
1263
1319
  }),
1264
- (r.phase === "failed" || r.phase === "expired") && /* @__PURE__ */ C(e, {
1265
- onPress: () => a.renew(),
1266
- children: o.renew
1320
+ (e.phase === "failed" || e.phase === "expired") && /* @__PURE__ */ I(c, {
1321
+ onPress: () => n.renew(),
1322
+ children: r.renew
1267
1323
  }),
1268
- r.phase === "checking" && /* @__PURE__ */ C(t, {})
1324
+ e.phase === "checking" && /* @__PURE__ */ I(l, {})
1269
1325
  ]
1270
1326
  })
1271
1327
  ]
1272
1328
  });
1273
1329
  }
1274
- function ve({ controller: e, label: t }) {
1275
- let n = J();
1276
- return t ??= n.artifact, /* @__PURE__ */ C(r, { children: /* @__PURE__ */ C(ye, {
1330
+ function Ie({ controller: e, label: t }) {
1331
+ let n = Z();
1332
+ return t ??= n.artifact, /* @__PURE__ */ I(m, { children: /* @__PURE__ */ I(Le, {
1277
1333
  controller: e,
1278
1334
  label: t
1279
1335
  }) });
1280
1336
  }
1281
- function ye({ controller: e, label: t }) {
1282
- let n = J(), r = b(e.subscribe, e.getSnapshot, e.getSnapshot);
1283
- return /* @__PURE__ */ C($, {
1337
+ function Le({ controller: e, label: t }) {
1338
+ let n = Z(), r = P(e.subscribe, e.getSnapshot, e.getSnapshot);
1339
+ return /* @__PURE__ */ I(Me, {
1284
1340
  phase: `artifact-${r.record?.revision ?? "idle"}-${r.phase}`,
1285
1341
  label: n.artifactStates[r.phase],
1286
- children: /* @__PURE__ */ C(be, {
1342
+ children: /* @__PURE__ */ I(Re, {
1287
1343
  state: r,
1288
1344
  label: t,
1289
1345
  controller: e
1290
1346
  })
1291
1347
  });
1292
1348
  }
1293
- function be({ state: r, label: i, controller: a }) {
1294
- let s = J(), [c, l] = y(), d = r.record, h = d?.history.find((e) => e.revision === c);
1295
- return /* @__PURE__ */ w(p, {
1296
- "aria-label": i,
1349
+ function Re({ state: e, label: t, controller: n }) {
1350
+ let r = Z(), [i, a] = N(), o = e.record, s = o?.history.find((e) => e.revision === i);
1351
+ return /* @__PURE__ */ L(E, {
1352
+ "aria-label": t,
1297
1353
  children: [
1298
- /* @__PURE__ */ w("div", {
1354
+ /* @__PURE__ */ L("div", {
1299
1355
  className: "flex flex-wrap items-center justify-between gap-3",
1300
- children: [/* @__PURE__ */ C("h2", {
1356
+ children: [/* @__PURE__ */ I("h2", {
1301
1357
  className: "type-heading text-fg-emphasis",
1302
- children: d?.title ?? i
1303
- }), /* @__PURE__ */ C("span", {
1358
+ children: o?.title ?? t
1359
+ }), /* @__PURE__ */ I("span", {
1304
1360
  role: "status",
1305
1361
  className: "type-caption text-fg-subtle",
1306
- children: s.artifactStates[r.phase]
1362
+ children: r.artifactStates[e.phase]
1307
1363
  })]
1308
1364
  }),
1309
- (r.phase === "loading" || r.phase === "checking") && /* @__PURE__ */ C(t, {}),
1310
- r.phase === "idle" && /* @__PURE__ */ C("p", {
1365
+ (e.phase === "loading" || e.phase === "checking") && /* @__PURE__ */ I(l, {}),
1366
+ e.phase === "idle" && /* @__PURE__ */ I("p", {
1311
1367
  className: "mt-4 type-body",
1312
- children: s.idleArtifact
1368
+ children: r.idleArtifact
1313
1369
  }),
1314
- r.phase === "load-error" && /* @__PURE__ */ C(n, {
1370
+ e.phase === "load-error" && /* @__PURE__ */ I(f, {
1315
1371
  tone: "error",
1316
1372
  className: "mt-4",
1317
- actions: /* @__PURE__ */ C(e, {
1373
+ actions: /* @__PURE__ */ I(c, {
1318
1374
  size: "sm",
1319
- onPress: () => r.loadId && a.open(r.loadId),
1320
- children: s.retry
1375
+ onPress: () => e.loadId && n.open(e.loadId),
1376
+ children: r.retry
1321
1377
  }),
1322
- children: s.loadError
1378
+ children: r.loadError
1323
1379
  }),
1324
- d && /* @__PURE__ */ w("div", {
1380
+ o && /* @__PURE__ */ L("div", {
1325
1381
  className: "mt-4 flex flex-col gap-4",
1326
1382
  children: [
1327
- /* @__PURE__ */ w(f, { children: [
1328
- s.revision,
1383
+ /* @__PURE__ */ L(S, { children: [
1384
+ r.revision,
1329
1385
  ": ",
1330
- d.revision
1386
+ o.revision
1331
1387
  ] }),
1332
- r.phase === "viewing" && d.history.length > 0 && /* @__PURE__ */ C(m, {
1333
- label: s.revision,
1388
+ e.phase === "viewing" && o.history.length > 0 && /* @__PURE__ */ I(x, {
1389
+ label: r.revision,
1334
1390
  options: [{
1335
- id: d.revision,
1336
- label: d.revision
1337
- }, ...d.history.filter((e) => e.revision !== d.revision).map((e) => ({
1391
+ id: o.revision,
1392
+ label: o.revision
1393
+ }, ...o.history.filter((e) => e.revision !== o.revision).map((e) => ({
1338
1394
  id: e.revision,
1339
1395
  label: e.revision
1340
1396
  }))],
1341
- selectedKey: h?.revision ?? d.revision,
1342
- onSelectionChange: (e) => l(e === null ? void 0 : String(e))
1397
+ selectedKey: s?.revision ?? o.revision,
1398
+ onSelectionChange: (e) => a(e === null ? void 0 : String(e))
1343
1399
  }),
1344
- r.phase === "conflict" && r.latest ? /* @__PURE__ */ w(S, { children: [
1345
- /* @__PURE__ */ C(n, {
1400
+ e.phase === "conflict" && e.latest ? /* @__PURE__ */ L(F, { children: [
1401
+ /* @__PURE__ */ I(f, {
1346
1402
  tone: "attention",
1347
- children: s.conflict
1403
+ children: r.conflict
1348
1404
  }),
1349
- /* @__PURE__ */ C(u, {
1350
- label: s.revision,
1405
+ /* @__PURE__ */ I(b, {
1406
+ label: r.revision,
1351
1407
  items: [{
1352
1408
  id: "draft",
1353
- label: s.localDraft,
1354
- content: /* @__PURE__ */ C("pre", {
1409
+ label: r.localDraft,
1410
+ content: /* @__PURE__ */ I("pre", {
1355
1411
  className: "type-body break-words whitespace-pre-wrap",
1356
- children: r.draft
1412
+ children: e.draft
1357
1413
  })
1358
1414
  }, {
1359
1415
  id: "latest",
1360
- label: s.latest,
1361
- content: /* @__PURE__ */ C("pre", {
1416
+ label: r.latest,
1417
+ content: /* @__PURE__ */ I("pre", {
1362
1418
  className: "type-body break-words whitespace-pre-wrap",
1363
- children: r.latest.content
1419
+ children: e.latest.content
1364
1420
  })
1365
1421
  }]
1366
1422
  }),
1367
- /* @__PURE__ */ w("div", {
1423
+ /* @__PURE__ */ L("div", {
1368
1424
  className: "flex flex-wrap gap-3",
1369
- children: [/* @__PURE__ */ C(e, {
1370
- onPress: () => a.adoptLatest(!1),
1371
- children: s.useLatest
1372
- }), /* @__PURE__ */ C(e, {
1373
- onPress: () => a.adoptLatest(!0),
1374
- children: s.keepDraft
1425
+ children: [/* @__PURE__ */ I(c, {
1426
+ onPress: () => n.adoptLatest(!1),
1427
+ children: r.useLatest
1428
+ }), /* @__PURE__ */ I(c, {
1429
+ onPress: () => n.adoptLatest(!0),
1430
+ children: r.keepDraft
1375
1431
  })]
1376
1432
  })
1377
- ] }) : r.phase === "viewing" ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("pre", {
1433
+ ] }) : e.phase === "viewing" ? /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I("pre", {
1378
1434
  className: "type-body break-words whitespace-pre-wrap",
1379
- children: h?.content ?? d.content
1380
- }), d.canEdit && !h && /* @__PURE__ */ C(e, {
1381
- onPress: () => a.edit(d.content),
1382
- children: s.edit
1383
- })] }) : /* @__PURE__ */ C(o, {
1384
- label: s.artifactContent,
1435
+ children: s?.content ?? o.content
1436
+ }), o.canEdit && !s && /* @__PURE__ */ I(c, {
1437
+ onPress: () => n.edit(o.content),
1438
+ children: r.edit
1439
+ })] }) : /* @__PURE__ */ I(_, {
1440
+ label: r.artifactContent,
1385
1441
  multiline: !0,
1386
- value: r.draft,
1387
- onChange: (e) => a.edit(e),
1388
- isDisabled: r.phase !== "editing"
1442
+ value: e.draft,
1443
+ onChange: (e) => n.edit(e),
1444
+ isDisabled: e.phase !== "editing"
1389
1445
  }),
1390
- r.reason && /* @__PURE__ */ C(n, {
1446
+ e.reason && /* @__PURE__ */ I(f, {
1391
1447
  tone: "error",
1392
- children: r.reason
1448
+ children: e.reason
1393
1449
  }),
1394
- r.phase === "editing" && /* @__PURE__ */ w("div", {
1450
+ e.phase === "editing" && /* @__PURE__ */ L("div", {
1395
1451
  className: "flex flex-wrap gap-3",
1396
- children: [/* @__PURE__ */ C(e, {
1452
+ children: [/* @__PURE__ */ I(c, {
1397
1453
  variant: "primary",
1398
- isDisabled: r.draft === d.content,
1399
- onPress: () => a.save(),
1400
- children: s.save
1401
- }), /* @__PURE__ */ C(e, {
1402
- onPress: () => a.discard(),
1403
- children: s.discard
1454
+ isDisabled: e.draft === o.content,
1455
+ onPress: () => n.save(),
1456
+ children: r.save
1457
+ }), /* @__PURE__ */ I(c, {
1458
+ onPress: () => n.discard(),
1459
+ children: r.discard
1404
1460
  })]
1405
1461
  }),
1406
- r.phase === "unknown" && /* @__PURE__ */ C(n, {
1462
+ e.phase === "unknown" && /* @__PURE__ */ I(f, {
1407
1463
  tone: "attention",
1408
- actions: /* @__PURE__ */ C(e, {
1409
- onPress: () => a.check(),
1410
- children: s.check
1464
+ actions: /* @__PURE__ */ I(c, {
1465
+ onPress: () => n.check(),
1466
+ children: r.check
1411
1467
  }),
1412
- children: s.unknown
1468
+ children: r.unknown
1413
1469
  })
1414
1470
  ]
1415
1471
  })
1416
1472
  ]
1417
1473
  });
1418
1474
  }
1419
- function xe({ controller: e, label: t }) {
1420
- let n = J();
1475
+ function ze({ controller: e, label: t }) {
1476
+ let n = Z();
1421
1477
  t ??= n.feedback;
1422
- let r = b(e.subscribe, e.getSnapshot, e.getSnapshot);
1423
- return /* @__PURE__ */ C(Se, {
1478
+ let r = P(e.subscribe, e.getSnapshot, e.getSnapshot);
1479
+ return /* @__PURE__ */ I(Be, {
1424
1480
  state: r,
1425
1481
  label: t,
1426
1482
  controller: e
1427
1483
  });
1428
1484
  }
1429
- function Se({ state: t, label: n, controller: r }) {
1430
- let i = J(), a = t.phase === "saving" || t.phase === "error";
1431
- return /* @__PURE__ */ w(p, {
1432
- "aria-label": n,
1485
+ function Be({ state: e, label: t, controller: n }) {
1486
+ let r = Z(), i = e.phase === "saving" || e.phase === "error";
1487
+ return /* @__PURE__ */ L(E, {
1488
+ "aria-label": t,
1433
1489
  children: [
1434
- /* @__PURE__ */ C(s, {
1435
- label: n,
1490
+ /* @__PURE__ */ I(w, {
1491
+ label: t,
1436
1492
  options: [{
1437
1493
  id: "helpful",
1438
- label: i.helpful
1494
+ label: r.helpful
1439
1495
  }, {
1440
1496
  id: "unhelpful",
1441
- label: i.unhelpful
1497
+ label: r.unhelpful
1442
1498
  }],
1443
- value: t.rating ?? "",
1444
- onChange: (e) => r.edit(e),
1445
- isDisabled: a
1499
+ value: e.rating ?? "",
1500
+ onChange: (e) => n.edit(e),
1501
+ isDisabled: i
1446
1502
  }),
1447
- /* @__PURE__ */ C(o, {
1503
+ /* @__PURE__ */ I(_, {
1448
1504
  className: "mt-4",
1449
- label: i.comment,
1505
+ label: r.comment,
1450
1506
  multiline: !0,
1451
- value: t.comment,
1452
- onChange: (e) => r.edit(t.rating, e),
1453
- isDisabled: a
1507
+ value: e.comment,
1508
+ onChange: (t) => n.edit(e.rating, t),
1509
+ isDisabled: i
1454
1510
  }),
1455
- /* @__PURE__ */ C("div", {
1511
+ /* @__PURE__ */ I("div", {
1456
1512
  className: "mt-4",
1457
- children: /* @__PURE__ */ C(e, {
1458
- isDisabled: !t.rating || t.phase === "saving" || t.phase === "saved",
1459
- onPress: () => r.save(),
1460
- children: t.phase === "error" ? i.retry : i.sendFeedback
1513
+ children: /* @__PURE__ */ I(c, {
1514
+ isDisabled: !e.rating || e.phase === "saving" || e.phase === "saved",
1515
+ onPress: () => n.save(),
1516
+ children: e.phase === "error" ? r.retry : r.sendFeedback
1461
1517
  })
1462
1518
  }),
1463
- /* @__PURE__ */ C("p", {
1519
+ /* @__PURE__ */ I("p", {
1464
1520
  role: "status",
1465
1521
  className: "mt-3 type-body text-fg-subtle",
1466
- children: t.phase === "saved" ? i.savedFeedback : t.phase === "error" ? i.failedFeedback : t.phase === "saving" ? i.saving : ""
1522
+ children: e.phase === "saved" ? r.savedFeedback : e.phase === "error" ? r.failedFeedback : e.phase === "saving" ? r.saving : ""
1467
1523
  })
1468
1524
  ]
1469
1525
  });
1470
1526
  }
1471
- function Ce({ controller: e, renderThread: t, label: n }) {
1472
- let r = J();
1527
+ function Ve({ controller: e, renderThread: t, label: n }) {
1528
+ let r = Z();
1473
1529
  n ??= r.threads;
1474
- let i = b(e.subscribe, e.getSnapshot, e.getSnapshot);
1475
- return /* @__PURE__ */ C(we, {
1530
+ let i = P(e.subscribe, e.getSnapshot, e.getSnapshot);
1531
+ return /* @__PURE__ */ I(He, {
1476
1532
  state: i,
1477
1533
  controller: e,
1478
1534
  renderThread: t,
1479
1535
  label: n
1480
1536
  });
1481
1537
  }
1482
- function we({ state: t, controller: r, renderThread: i, label: a }) {
1483
- let s = J(), [c, l] = y("active"), [u, d] = y(), [f, h] = y(""), g = v(null), _ = !["ready", "error"].includes(t.phase), b = t.items.filter((e) => e.archived === (c === "archived"));
1484
- return /* @__PURE__ */ C("div", {
1485
- ref: g,
1538
+ function He({ state: e, controller: t, renderThread: n, label: r }) {
1539
+ let i = Z(), [a, o] = N("active"), [s, l] = N(), [u, d] = N(""), p = M(null), m = !["ready", "error"].includes(e.phase), h = e.items.filter((e) => e.archived === (a === "archived"));
1540
+ return /* @__PURE__ */ I("div", {
1541
+ ref: p,
1486
1542
  role: "group",
1487
- "aria-label": a,
1543
+ "aria-label": r,
1488
1544
  tabIndex: -1,
1489
1545
  className: "min-w-0 outline-none",
1490
- children: /* @__PURE__ */ w(p, {
1491
- "aria-label": a,
1546
+ children: /* @__PURE__ */ L(E, {
1547
+ "aria-label": r,
1492
1548
  children: [
1493
- /* @__PURE__ */ w("div", {
1549
+ /* @__PURE__ */ L("div", {
1494
1550
  className: "flex flex-wrap items-center justify-between gap-3",
1495
- children: [/* @__PURE__ */ C("h2", {
1551
+ children: [/* @__PURE__ */ I("h2", {
1496
1552
  className: "type-heading text-fg-emphasis",
1497
- children: a
1498
- }), /* @__PURE__ */ C(e, {
1553
+ children: r
1554
+ }), /* @__PURE__ */ I(c, {
1499
1555
  size: "sm",
1500
- isDisabled: _ && t.phase !== "idle",
1501
- onPress: () => r.refresh(),
1502
- children: s.refresh
1556
+ isDisabled: m && e.phase !== "idle",
1557
+ onPress: () => t.refresh(),
1558
+ children: i.refresh
1503
1559
  })]
1504
1560
  }),
1505
- /* @__PURE__ */ C(m, {
1561
+ /* @__PURE__ */ I(x, {
1506
1562
  className: "mt-4",
1507
- label: a,
1508
- selectedKey: c,
1509
- onSelectionChange: (e) => l(String(e)),
1563
+ label: r,
1564
+ selectedKey: a,
1565
+ onSelectionChange: (e) => o(String(e)),
1510
1566
  options: [{
1511
1567
  id: "active",
1512
- label: s.active
1568
+ label: i.active
1513
1569
  }, {
1514
1570
  id: "archived",
1515
- label: s.archived
1571
+ label: i.archived
1516
1572
  }]
1517
1573
  }),
1518
- t.phase === "error" && /* @__PURE__ */ C(n, {
1574
+ e.phase === "error" && /* @__PURE__ */ I(f, {
1519
1575
  tone: "error",
1520
1576
  className: "mt-4",
1521
- children: s.threadError
1577
+ children: i.threadError
1522
1578
  }),
1523
- /* @__PURE__ */ C("ul", {
1579
+ /* @__PURE__ */ I("ul", {
1524
1580
  className: "mt-4 flex flex-col gap-4",
1525
- children: b.map((n) => /* @__PURE__ */ w("li", {
1581
+ children: h.map((n) => /* @__PURE__ */ L("li", {
1526
1582
  className: "flex flex-col gap-3 rounded-control border border-line-subtle p-3",
1527
1583
  children: [
1528
- /* @__PURE__ */ C(e, {
1584
+ /* @__PURE__ */ I(c, {
1529
1585
  className: "justify-start text-left whitespace-normal",
1530
- isDisabled: ["listing", "mutating"].includes(t.phase),
1586
+ isDisabled: ["listing", "mutating"].includes(e.phase),
1531
1587
  onPress: () => {
1532
- r.open(n.id) && d(void 0);
1588
+ t.open(n.id) && l(void 0);
1533
1589
  },
1534
1590
  children: n.title
1535
1591
  }),
1536
- /* @__PURE__ */ w("div", {
1592
+ /* @__PURE__ */ L("div", {
1537
1593
  className: "flex flex-wrap gap-3",
1538
- children: [/* @__PURE__ */ C(e, {
1594
+ children: [/* @__PURE__ */ I(c, {
1539
1595
  size: "sm",
1540
- isDisabled: _,
1596
+ isDisabled: m,
1541
1597
  onPress: () => {
1542
- d(n.id), h(n.title);
1598
+ l(n.id), d(n.title);
1543
1599
  },
1544
- children: s.rename
1545
- }), /* @__PURE__ */ C(e, {
1600
+ children: i.rename
1601
+ }), /* @__PURE__ */ I(c, {
1546
1602
  size: "sm",
1547
- isDisabled: _,
1603
+ isDisabled: m,
1548
1604
  onPress: () => {
1549
- r.archive(n.id, !n.archived) && g.current?.focus({ preventScroll: !0 });
1605
+ t.archive(n.id, !n.archived) && p.current?.focus({ preventScroll: !0 });
1550
1606
  },
1551
- children: n.archived ? s.restore : s.archive
1607
+ children: n.archived ? i.restore : i.archive
1552
1608
  })]
1553
1609
  }),
1554
- u === n.id && /* @__PURE__ */ w("div", {
1610
+ s === n.id && /* @__PURE__ */ L("div", {
1555
1611
  className: "flex flex-col gap-3",
1556
- children: [/* @__PURE__ */ C(o, {
1557
- label: s.title,
1558
- value: f,
1559
- onChange: h,
1560
- isDisabled: _
1561
- }), /* @__PURE__ */ C(e, {
1562
- isDisabled: _ || !f.trim(),
1563
- onPress: () => r.rename(n.id, f),
1564
- children: s.saveTitle
1612
+ children: [/* @__PURE__ */ I(_, {
1613
+ label: i.title,
1614
+ value: u,
1615
+ onChange: d,
1616
+ isDisabled: m
1617
+ }), /* @__PURE__ */ I(c, {
1618
+ isDisabled: m || !u.trim(),
1619
+ onPress: () => t.rename(n.id, u),
1620
+ children: i.saveTitle
1565
1621
  })]
1566
1622
  })
1567
1623
  ]
1568
1624
  }, n.id))
1569
1625
  }),
1570
- !b.length && t.phase !== "idle" && /* @__PURE__ */ C("p", {
1626
+ !h.length && e.phase !== "idle" && /* @__PURE__ */ I("p", {
1571
1627
  className: "mt-4 type-body text-fg-subtle",
1572
- children: s.noThreads
1628
+ children: i.noThreads
1573
1629
  }),
1574
- /* @__PURE__ */ C("div", {
1630
+ /* @__PURE__ */ I("div", {
1575
1631
  role: "status",
1576
1632
  className: "mt-4 type-caption text-fg-subtle",
1577
- children: _ && t.phase !== "idle" ? s.loading : ""
1633
+ children: m && e.phase !== "idle" ? i.loading : ""
1578
1634
  }),
1579
- /* @__PURE__ */ C("div", {
1635
+ /* @__PURE__ */ I("div", {
1580
1636
  className: "mt-6 min-w-0",
1581
- children: t.selected ? i(t.selected) : /* @__PURE__ */ C("p", {
1637
+ children: e.selected ? n(e.selected) : /* @__PURE__ */ I("p", {
1582
1638
  className: "type-body text-fg-subtle",
1583
- children: s.chooseThread
1639
+ children: i.chooseThread
1584
1640
  })
1585
1641
  })
1586
1642
  ]
@@ -1588,4 +1644,522 @@ function we({ state: t, controller: r, renderThread: i, label: a }) {
1588
1644
  });
1589
1645
  }
1590
1646
  //#endregion
1591
- export { te as AgentController, Q as AgentStatus, he as AgentSupervision, B as ArtifactController, ve as ArtifactWorkspace, ae as Citation, de as ComposerTools, ce as Confidence, ue as ConnectionStatus, Ce as ConversationHistory, pe as ExecutionInspector, H as FeedbackController, le as Guardrail, q as InteractionProvider, me as Observability, fe as QuotedExcerpt, se as Reasoning, xe as ResponseFeedback, oe as RetrievalInspection, X as Sources, re as ThreadController, Z as ToolCall, I as agentReducer, P as agentStepSchema, z as artifactReducer, L as artifactSchema, Y as evidenceUrl, G as interactionCopy, D as jsonSchema, W as threadDocumentSchema, U as threadSummarySchema };
1647
+ //#region src/reusable/interactions/run.tsx
1648
+ var Ue = O(!1), We = () => k(Ue);
1649
+ function Ge({ label: e, children: t }) {
1650
+ return /* @__PURE__ */ I(Ue.Provider, {
1651
+ value: !0,
1652
+ children: /* @__PURE__ */ I("ol", {
1653
+ "aria-label": e,
1654
+ className: "run-timeline flex flex-col gap-4",
1655
+ children: t
1656
+ })
1657
+ });
1658
+ }
1659
+ function Q({ dot: e, card: t = !1, children: n }) {
1660
+ return /* @__PURE__ */ L("li", {
1661
+ "data-card": t || void 0,
1662
+ className: "run-entry grid gap-x-3 type-body",
1663
+ children: [/* @__PURE__ */ I("span", {
1664
+ "aria-hidden": "true",
1665
+ className: "run-dot flex items-center justify-center",
1666
+ children: e === "working" ? /* @__PURE__ */ I(p, {}) : /* @__PURE__ */ I("span", { className: r("relative rounded-pill", e === "thought" ? "size-1" : "size-1.5", e === "success" && "bg-success-line", (e === "note" || e === "thought") && "bg-line-emphasis", e === "waiting" && "animate-pulse-soft bg-info") })
1667
+ }), /* @__PURE__ */ I("div", {
1668
+ className: "min-w-0 type-body wrap-anywhere",
1669
+ children: n
1670
+ })]
1671
+ });
1672
+ }
1673
+ function Ke({ file: e }) {
1674
+ return /* @__PURE__ */ I(C, {
1675
+ look: "file",
1676
+ label: e.name,
1677
+ title: e.path,
1678
+ children: /* @__PURE__ */ L("div", {
1679
+ className: "flex flex-col gap-2",
1680
+ children: [/* @__PURE__ */ I("span", {
1681
+ className: "font-mono type-caption text-fg-subtle",
1682
+ children: e.path
1683
+ }), /* @__PURE__ */ I("pre", {
1684
+ className: "rounded-control bg-surface-muted px-3 py-2 font-mono type-caption whitespace-pre-wrap text-fg",
1685
+ children: e.lines.join("\n")
1686
+ })]
1687
+ })
1688
+ });
1689
+ }
1690
+ var qe = {
1691
+ read: o,
1692
+ edit: a,
1693
+ run: e
1694
+ };
1695
+ function Je({ kind: e, icon: t, verb: n, file: r, command: i, result: a, added: o, removed: s, preview: c = !1 }) {
1696
+ let l = Z().run, u = o !== void 0 && s !== void 0, d = e ? qe[e] : void 0, f = t ?? (d ? /* @__PURE__ */ I(d, { className: "size-3.5" }) : null);
1697
+ return /* @__PURE__ */ I(Q, {
1698
+ dot: "success",
1699
+ children: /* @__PURE__ */ L("div", {
1700
+ className: "flex gap-2.5",
1701
+ children: [f ? /* @__PURE__ */ I("span", {
1702
+ "aria-hidden": "true",
1703
+ className: "flex h-5 shrink-0 items-center text-fg-subtle",
1704
+ children: f
1705
+ }) : null, /* @__PURE__ */ L("div", {
1706
+ className: "flex min-w-0 flex-1 flex-col gap-1",
1707
+ children: [
1708
+ /* @__PURE__ */ L("div", { children: [
1709
+ /* @__PURE__ */ I("span", {
1710
+ className: "run-verb font-medium text-fg-emphasis",
1711
+ children: n
1712
+ }),
1713
+ " ",
1714
+ r ? /* @__PURE__ */ I(Ke, { file: r }) : i ? /* @__PURE__ */ I("code", {
1715
+ className: "font-mono text-fg",
1716
+ children: i
1717
+ }) : null
1718
+ ] }),
1719
+ u || a ? /* @__PURE__ */ L("p", {
1720
+ className: "type-caption text-fg-subtle",
1721
+ children: [u ? /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ L("span", {
1722
+ "aria-hidden": "true",
1723
+ children: [
1724
+ /* @__PURE__ */ L("span", {
1725
+ className: "text-success",
1726
+ children: ["+", l.number(o)]
1727
+ }),
1728
+ " ",
1729
+ /* @__PURE__ */ L("span", {
1730
+ className: "text-error",
1731
+ children: ["−", l.number(s)]
1732
+ })
1733
+ ]
1734
+ }), /* @__PURE__ */ I("span", {
1735
+ className: "sr-only",
1736
+ children: l.lines(l.number(o), l.number(s))
1737
+ })] }) : null, a]
1738
+ }) : null,
1739
+ c && r ? /* @__PURE__ */ I("div", {
1740
+ "aria-hidden": "true",
1741
+ className: "mt-1 rounded-control border border-line-subtle bg-surface-muted px-3 py-2",
1742
+ children: /* @__PURE__ */ I("pre", {
1743
+ className: "run-preview-fade max-h-[3lh] overflow-hidden font-mono type-caption whitespace-pre-wrap text-fg",
1744
+ children: r.lines.join("\n")
1745
+ })
1746
+ }) : null
1747
+ ]
1748
+ })]
1749
+ })
1750
+ });
1751
+ }
1752
+ function Ye({ children: e }) {
1753
+ return /* @__PURE__ */ I(Q, {
1754
+ dot: "thought",
1755
+ children: /* @__PURE__ */ I("span", {
1756
+ className: "text-fg-subtle",
1757
+ children: e
1758
+ })
1759
+ });
1760
+ }
1761
+ function Xe({ children: e }) {
1762
+ return /* @__PURE__ */ I(Q, {
1763
+ dot: "note",
1764
+ children: /* @__PURE__ */ I("div", {
1765
+ className: "text-pretty text-fg",
1766
+ children: e
1767
+ })
1768
+ });
1769
+ }
1770
+ function Ze({ children: e }) {
1771
+ return /* @__PURE__ */ I(Q, {
1772
+ dot: "working",
1773
+ children: /* @__PURE__ */ I("span", {
1774
+ className: "text-fg-emphasis",
1775
+ children: e
1776
+ })
1777
+ });
1778
+ }
1779
+ //#endregion
1780
+ //#region src/reusable/interactions/gate.tsx
1781
+ var $ = "h-auto min-h-control-sm whitespace-normal break-words py-1.5 text-center";
1782
+ function Qe(e) {
1783
+ let t = /* @__PURE__ */ I($e, { ...e });
1784
+ if (!We()) return t;
1785
+ let n = e.status ?? "waiting";
1786
+ return /* @__PURE__ */ I(Q, {
1787
+ card: !0,
1788
+ dot: n === "approved" ? "success" : n === "declined" ? "note" : "waiting",
1789
+ children: t
1790
+ });
1791
+ }
1792
+ function $e({ title: e, irreversible: t = !1, status: i = "waiting", approvedTitle: o, declinedTitle: l, children: f, onApprove: m, onDecline: h, onEdit: g, editor: _, changed: v, onReviewChange: b, onReconsider: x, approvingLabel: S, defaultExpanded: ee = !1 }) {
1793
+ let C = Z().gate, [w, T] = N(ee), E = te(), D = i === "approved", O = i === "declined", k = D || O, A = _ != null, j = !k && (w || A), M = i === "waiting" && !v && !A, P = D ? o ?? e : O ? l ?? e : e;
1794
+ return /* @__PURE__ */ L("div", {
1795
+ className: "@container/gate overflow-hidden rounded-surface border border-line-subtle bg-surface-muted",
1796
+ children: [
1797
+ /* @__PURE__ */ I("p", {
1798
+ role: "status",
1799
+ className: "sr-only",
1800
+ children: D || O ? P : i === "approving" ? S ?? C.approving : v ? C.changed : ""
1801
+ }),
1802
+ /* @__PURE__ */ L("div", {
1803
+ className: "flex flex-wrap items-start gap-3 p-3",
1804
+ children: [
1805
+ /* @__PURE__ */ I("span", {
1806
+ ...k ? { "aria-hidden": !0 } : {
1807
+ role: "img",
1808
+ "aria-label": C.waiting
1809
+ },
1810
+ className: r("flex size-10 shrink-0 items-center justify-center rounded-control border border-line-subtle bg-surface", D && "border-done bg-done text-on-done"),
1811
+ children: D ? /* @__PURE__ */ I(u, { className: "size-4 animate-done-in" }) : O ? /* @__PURE__ */ I(n, { className: "size-4 text-fg-subtle" }) : /* @__PURE__ */ I(p, { tone: "info" })
1812
+ }),
1813
+ /* @__PURE__ */ L("div", {
1814
+ className: "flex min-h-10 min-w-0 flex-1 basis-24 items-center gap-1.5",
1815
+ children: [/* @__PURE__ */ I("span", {
1816
+ className: r("min-w-0 type-label text-fg-emphasis", j ? "text-pretty wrap-anywhere" : "truncate"),
1817
+ children: P
1818
+ }), t && !k && !j ? /* @__PURE__ */ I("span", {
1819
+ role: "img",
1820
+ "aria-label": C.irreversible,
1821
+ className: "flex shrink-0",
1822
+ children: /* @__PURE__ */ I(d, { className: "size-4 text-error" })
1823
+ }) : null]
1824
+ }),
1825
+ /* @__PURE__ */ I("span", {
1826
+ className: "ml-auto flex min-h-10 shrink-0 items-center",
1827
+ children: k ? O && x ? /* @__PURE__ */ I(c, {
1828
+ size: "sm",
1829
+ className: $,
1830
+ onPress: x,
1831
+ children: C.reconsider
1832
+ }) : null : /* @__PURE__ */ L(c, {
1833
+ size: "sm",
1834
+ className: r("group/trigger", $),
1835
+ "aria-label": C.review,
1836
+ "aria-expanded": j,
1837
+ "aria-controls": E,
1838
+ isDisabled: A,
1839
+ onPress: () => T((e) => !e),
1840
+ children: [/* @__PURE__ */ I("span", {
1841
+ className: "@max-sm/gate:hidden",
1842
+ children: C.review
1843
+ }), /* @__PURE__ */ I(s, { className: "transition-[rotate] duration-(--duration-settle) ease-settle group-aria-expanded/trigger:rotate-180 motion-reduce:transition-none" })]
1844
+ })
1845
+ })
1846
+ ]
1847
+ }),
1848
+ v && !k ? /* @__PURE__ */ L("div", {
1849
+ className: "flex flex-col gap-3 border-t border-line-subtle px-4 py-3",
1850
+ children: [/* @__PURE__ */ I("p", {
1851
+ className: "type-body text-pretty text-attention",
1852
+ children: v
1853
+ }), b ? /* @__PURE__ */ I("div", {
1854
+ className: "flex justify-end",
1855
+ children: /* @__PURE__ */ I(c, {
1856
+ size: "sm",
1857
+ className: $,
1858
+ onPress: b,
1859
+ children: C.reviewChange
1860
+ })
1861
+ }) : null]
1862
+ }) : null,
1863
+ j ? /* @__PURE__ */ I("div", {
1864
+ id: E,
1865
+ className: "flex animate-reveal-in flex-col gap-4 border-t border-line-subtle bg-surface p-4",
1866
+ children: A ? _ : /* @__PURE__ */ L(F, { children: [
1867
+ t ? /* @__PURE__ */ L("span", {
1868
+ className: "inline-flex items-center gap-1 self-start rounded-pill border border-error-line bg-error-subtle px-2 py-0.5 type-caption break-words text-error",
1869
+ children: [/* @__PURE__ */ I(d, { className: "size-3.5 shrink-0" }), C.irreversible]
1870
+ }) : null,
1871
+ /* @__PURE__ */ I("div", {
1872
+ className: "type-body text-pretty wrap-anywhere text-fg",
1873
+ children: f
1874
+ }),
1875
+ /* @__PURE__ */ L("div", {
1876
+ className: "flex flex-wrap items-center justify-end gap-2",
1877
+ children: [
1878
+ g ? /* @__PURE__ */ I(y, {
1879
+ content: C.edit,
1880
+ children: /* @__PURE__ */ I(c, {
1881
+ variant: "secondary",
1882
+ size: "icon-sm",
1883
+ "aria-label": C.edit,
1884
+ onPress: g,
1885
+ isDisabled: !M,
1886
+ children: /* @__PURE__ */ I(a, {})
1887
+ })
1888
+ }) : null,
1889
+ /* @__PURE__ */ I(c, {
1890
+ variant: "secondary",
1891
+ size: "sm",
1892
+ className: r("text-error", $),
1893
+ onPress: h,
1894
+ isDisabled: !M,
1895
+ children: C.decline
1896
+ }),
1897
+ /* @__PURE__ */ I(c, {
1898
+ variant: "primary",
1899
+ size: "sm",
1900
+ className: $,
1901
+ onPress: m,
1902
+ isDisabled: !!v,
1903
+ isPending: i === "approving",
1904
+ pendingLabel: S ?? C.approving,
1905
+ children: C.approve
1906
+ })
1907
+ ]
1908
+ })
1909
+ ] })
1910
+ }) : null
1911
+ ]
1912
+ });
1913
+ }
1914
+ //#endregion
1915
+ //#region src/reusable/interactions/receipt.tsx
1916
+ function et(e) {
1917
+ let t = e?.getTime(), n = t !== void 0 && Number.isFinite(t) ? t : void 0, [r, i] = N(() => ({
1918
+ deadline: n,
1919
+ now: Date.now()
1920
+ }));
1921
+ return r.deadline !== n && i(() => ({
1922
+ deadline: n,
1923
+ now: Date.now()
1924
+ })), A(() => {
1925
+ if (n === void 0) return;
1926
+ let e = () => i((e) => e.deadline === n ? {
1927
+ deadline: n,
1928
+ now: Date.now()
1929
+ } : e), t = window.setInterval(e, 15e3), r = window.setTimeout(e, Math.max(0, n - Date.now()));
1930
+ return () => {
1931
+ window.clearInterval(t), window.clearTimeout(r);
1932
+ };
1933
+ }, [n]), n === void 0 ? 0 : Math.max(0, Math.ceil((n - r.now) / 6e4));
1934
+ }
1935
+ function tt({ outcome: e, checking: a }) {
1936
+ let o = !a && (e === "done" || e === "different");
1937
+ return /* @__PURE__ */ I("span", {
1938
+ "aria-hidden": "true",
1939
+ className: r("flex size-8 shrink-0 items-center justify-center rounded-control border", a && "border-line-subtle bg-surface", o && "border-done bg-done text-on-done", !a && e === "partial" && "border-attention-line bg-attention-subtle text-attention", !a && e === "failed" && "border-error-line bg-error-subtle text-error", !a && (e === "unknown" || e === "undone") && "border-line-subtle bg-surface text-fg-subtle"),
1940
+ children: a ? /* @__PURE__ */ I(p, {}) : I(o ? u : e === "partial" ? d : e === "failed" ? n : e === "unknown" ? i : t, { className: "size-4" })
1941
+ });
1942
+ }
1943
+ function nt({ outcome: e, title: t, meta: n, note: i, changes: a, ask: o, actions: s = [], undoClosesAt: l, undoClosesLabel: u, checking: d = !1 }) {
1944
+ let f = Z().receipt, p = et(l), m = !!l && p > 0 && e !== "undone", h = e === "different" || e === "partial" ? "text-attention" : e === "failed" ? "text-error" : "text-fg", g = [...s].sort((e, t) => Number(!!e.primary) - Number(!!t.primary));
1945
+ return /* @__PURE__ */ L("article", {
1946
+ className: "flex w-full min-w-0 flex-col gap-4 rounded-surface border border-line-subtle bg-surface p-5",
1947
+ children: [
1948
+ /* @__PURE__ */ L("p", {
1949
+ role: "status",
1950
+ className: "sr-only",
1951
+ children: [d ? f.checking : t, !d && l && !m && e !== "undone" ? ` ${f.closed}` : null]
1952
+ }),
1953
+ /* @__PURE__ */ L("div", {
1954
+ className: "flex items-start gap-3",
1955
+ children: [/* @__PURE__ */ I(tt, {
1956
+ outcome: e,
1957
+ checking: d
1958
+ }), /* @__PURE__ */ L("div", {
1959
+ className: "flex min-w-0 flex-col gap-0.5",
1960
+ children: [/* @__PURE__ */ I("span", {
1961
+ className: "type-label text-pretty text-fg-emphasis",
1962
+ children: d ? f.checking : t
1963
+ }), n ? /* @__PURE__ */ I("span", {
1964
+ className: "font-mono type-caption text-fg-subtle",
1965
+ children: n
1966
+ }) : null]
1967
+ })]
1968
+ }),
1969
+ d ? null : /* @__PURE__ */ L(F, { children: [
1970
+ i ? /* @__PURE__ */ I("p", {
1971
+ className: r("type-body text-pretty", h),
1972
+ children: i
1973
+ }) : null,
1974
+ /* @__PURE__ */ L("div", {
1975
+ className: "flex flex-col gap-2",
1976
+ children: [/* @__PURE__ */ I("span", {
1977
+ className: "font-mono type-caption text-fg-subtle",
1978
+ children: f.whatChanged
1979
+ }), /* @__PURE__ */ I("ul", {
1980
+ className: "flex flex-col divide-y divide-line-subtle rounded-control border border-line-subtle bg-surface",
1981
+ children: a.map((e) => {
1982
+ let t = e.state ?? "changed";
1983
+ return /* @__PURE__ */ L("li", {
1984
+ className: "flex flex-wrap items-center gap-x-3 p-3 type-body",
1985
+ children: [
1986
+ /* @__PURE__ */ I("span", {
1987
+ className: "font-medium text-fg-emphasis",
1988
+ children: e.what
1989
+ }),
1990
+ /* @__PURE__ */ I("span", {
1991
+ className: "min-w-0 flex-1 text-fg-subtle",
1992
+ children: e.detail
1993
+ }),
1994
+ /* @__PURE__ */ I("span", {
1995
+ className: "flex h-control-sm shrink-0 items-center",
1996
+ children: t !== "changed" || e.stateLabel ? /* @__PURE__ */ I("span", {
1997
+ className: r("type-caption", t === "not-changed" ? "text-attention" : "text-fg-subtle"),
1998
+ children: e.stateLabel ?? f.states[t]
1999
+ }) : e.back && m ? /* @__PURE__ */ I(c, {
2000
+ size: "sm",
2001
+ "aria-label": `${e.back.label} ${e.what.toLowerCase()}`,
2002
+ onPress: () => {
2003
+ l && Date.now() < l.getTime() && e.back?.onPress();
2004
+ },
2005
+ children: e.back.label
2006
+ }) : null
2007
+ })
2008
+ ]
2009
+ }, e.id);
2010
+ })
2011
+ })]
2012
+ }),
2013
+ o ? /* @__PURE__ */ I("p", {
2014
+ className: "type-body text-pretty text-fg-emphasis",
2015
+ children: o
2016
+ }) : null,
2017
+ g.length || l ? /* @__PURE__ */ L("div", {
2018
+ className: "flex flex-wrap items-center justify-end gap-2",
2019
+ children: [g.map((e) => /* @__PURE__ */ I(c, {
2020
+ size: "sm",
2021
+ variant: e.primary ? "primary" : "secondary",
2022
+ onPress: e.onPress,
2023
+ children: e.label
2024
+ }, e.id)), l && e !== "undone" ? /* @__PURE__ */ L("span", {
2025
+ className: "font-mono type-label text-fg-subtle",
2026
+ children: [m ? f.minutesLeft(p) : f.closed, m && u ? /* @__PURE__ */ L("span", {
2027
+ className: "sr-only",
2028
+ children: [" ", u]
2029
+ }) : null]
2030
+ }) : null]
2031
+ }) : null
2032
+ ] })
2033
+ ]
2034
+ });
2035
+ }
2036
+ //#endregion
2037
+ //#region src/reusable/interactions/progress.tsx
2038
+ function rt({ task: e, now: t, stages: n, stage: i, status: a = "working", estimate: o, basis: l, counted: f, changed: m, needs: h, onReview: g, moves: _ = [], defaultExpanded: v = !1 }) {
2039
+ let y = Z().progress, [b, x] = N(v), S = te(), C = n.length, w = a === "done", T = [..._].sort((e, t) => Number(!!e.primary) - Number(!!t.primary));
2040
+ return /* @__PURE__ */ L("article", {
2041
+ className: "flex w-full min-w-0 flex-col overflow-hidden rounded-surface border border-line-subtle bg-surface-muted",
2042
+ children: [/* @__PURE__ */ L("div", {
2043
+ className: "flex flex-wrap items-center gap-x-3 gap-y-2 p-3",
2044
+ children: [
2045
+ /* @__PURE__ */ I("span", {
2046
+ "aria-hidden": "true",
2047
+ className: r("flex size-8 shrink-0 items-center justify-center rounded-control border border-line-subtle bg-surface", w && "border-done bg-done text-on-done", a === "stuck" && "border-attention-line bg-attention-subtle text-attention"),
2048
+ children: w ? /* @__PURE__ */ I(u, { className: "size-4" }) : a === "stuck" ? /* @__PURE__ */ I(d, { className: "size-4" }) : /* @__PURE__ */ I(p, { tone: a === "needs-you" ? "info" : "brand" })
2049
+ }),
2050
+ /* @__PURE__ */ L("div", {
2051
+ role: "status",
2052
+ className: "flex min-w-0 flex-1 flex-col gap-1",
2053
+ children: [/* @__PURE__ */ I("span", {
2054
+ className: "truncate type-label text-fg-emphasis",
2055
+ children: w ? e : t
2056
+ }), /* @__PURE__ */ L("span", {
2057
+ className: "flex flex-wrap gap-1.5 type-caption text-fg-subtle",
2058
+ children: [
2059
+ /* @__PURE__ */ I("span", { children: y.stagesDone(Math.min(i, C), C) }),
2060
+ /* @__PURE__ */ I("span", {
2061
+ "aria-hidden": "true",
2062
+ children: "·"
2063
+ }),
2064
+ /* @__PURE__ */ I("span", {
2065
+ className: r(a === "stuck" && "text-attention", a === "needs-you" && "text-info"),
2066
+ children: o
2067
+ })
2068
+ ]
2069
+ })]
2070
+ }),
2071
+ a === "needs-you" && g ? /* @__PURE__ */ I(c, {
2072
+ size: "sm",
2073
+ variant: "primary",
2074
+ onPress: g,
2075
+ children: y.review
2076
+ }) : null,
2077
+ /* @__PURE__ */ I(c, {
2078
+ size: "sm",
2079
+ variant: "ghost",
2080
+ className: "group/trigger",
2081
+ "aria-label": y.showStages,
2082
+ "aria-expanded": b,
2083
+ "aria-controls": S,
2084
+ onPress: () => x((e) => !e),
2085
+ children: /* @__PURE__ */ I(s, { className: "transition-[rotate] duration-(--duration-settle) ease-settle group-aria-expanded/trigger:rotate-180 motion-reduce:transition-none" })
2086
+ })
2087
+ ]
2088
+ }), b ? /* @__PURE__ */ L("div", {
2089
+ id: S,
2090
+ className: "flex animate-reveal-in flex-col gap-4 border-t border-line-subtle bg-surface p-4",
2091
+ children: [
2092
+ /* @__PURE__ */ I("ol", {
2093
+ className: "flex flex-col gap-2.5",
2094
+ children: n.map((e, n) => {
2095
+ let o = n < i, s = n === i && !w;
2096
+ return /* @__PURE__ */ L("li", {
2097
+ className: "flex gap-3 type-body",
2098
+ children: [/* @__PURE__ */ I("span", {
2099
+ "aria-hidden": "true",
2100
+ className: "flex h-5 shrink-0 items-center",
2101
+ children: /* @__PURE__ */ I("span", {
2102
+ className: "flex size-4 items-center justify-center",
2103
+ children: o ? /* @__PURE__ */ I(u, { className: "size-3.5 text-success" }) : s ? a === "stuck" ? /* @__PURE__ */ I(d, { className: "size-3.5 text-attention" }) : /* @__PURE__ */ I(p, { tone: a === "needs-you" ? "info" : "brand" }) : /* @__PURE__ */ I("span", { className: "size-2 rounded-pill border border-line-emphasis" })
2104
+ })
2105
+ }), /* @__PURE__ */ L("div", {
2106
+ className: "flex min-w-0 flex-1 flex-col gap-1.5",
2107
+ children: [/* @__PURE__ */ L("span", {
2108
+ className: r(s ? "font-medium text-fg-emphasis" : o ? "text-fg" : "text-fg-subtle"),
2109
+ children: [e, /* @__PURE__ */ L("span", {
2110
+ className: "sr-only",
2111
+ children: [
2112
+ " ",
2113
+ "·",
2114
+ " ",
2115
+ o ? y.stageWords.done : s ? y.stageWords.now : y.stageWords.next
2116
+ ]
2117
+ })]
2118
+ }), s ? /* @__PURE__ */ L(F, { children: [/* @__PURE__ */ I("span", {
2119
+ className: "type-caption text-fg-subtle",
2120
+ children: t
2121
+ }), f ? /* @__PURE__ */ I(ee, {
2122
+ label: f.label,
2123
+ value: f.value,
2124
+ maxValue: f.max,
2125
+ valueLabel: f.valueLabel
2126
+ }) : null] }) : null]
2127
+ })]
2128
+ }, e);
2129
+ })
2130
+ }),
2131
+ m ? /* @__PURE__ */ I("p", {
2132
+ className: "rounded-control border border-attention-line bg-attention-subtle px-3 py-2 type-body text-attention",
2133
+ children: m
2134
+ }) : null,
2135
+ /* @__PURE__ */ L("div", {
2136
+ className: "flex flex-wrap items-start justify-between gap-4 border-t border-line-subtle pt-3",
2137
+ children: [/* @__PURE__ */ L("div", {
2138
+ className: "flex min-w-0 flex-col gap-0.5",
2139
+ children: [/* @__PURE__ */ I("span", {
2140
+ className: "type-label text-fg-emphasis",
2141
+ children: o
2142
+ }), l ? /* @__PURE__ */ I("span", {
2143
+ className: "type-caption text-fg-subtle",
2144
+ children: l
2145
+ }) : null]
2146
+ }), /* @__PURE__ */ L("span", {
2147
+ className: r("flex items-center gap-1.5 type-label", a === "stuck" ? "text-attention" : a === "needs-you" ? "text-info" : "text-fg-subtle"),
2148
+ children: [a === "stuck" ? /* @__PURE__ */ I(d, { className: "size-4" }) : a === "needs-you" ? /* @__PURE__ */ I(p, { tone: "info" }) : /* @__PURE__ */ I(u, { className: "size-4" }), h ?? y.noAction]
2149
+ })]
2150
+ }),
2151
+ T.length && a !== "needs-you" ? /* @__PURE__ */ I("div", {
2152
+ className: "flex flex-wrap justify-end gap-2",
2153
+ children: T.map((e) => /* @__PURE__ */ I(c, {
2154
+ size: "sm",
2155
+ variant: e.primary ? "primary" : "secondary",
2156
+ onPress: e.onPress,
2157
+ children: e.label
2158
+ }, e.id))
2159
+ }) : null
2160
+ ]
2161
+ }) : null]
2162
+ });
2163
+ }
2164
+ //#endregion
2165
+ export { nt as ActionReceipt, oe as AgentController, je as AgentStatus, Ne as AgentSupervision, le as ArtifactController, Ie as ArtifactWorkspace, be as Citation, De as ComposerTools, we as Confidence, Ee as ConnectionStatus, Ve as ConversationHistory, Qe as DecisionGate, ke as ExecutionInspector, de as FeedbackController, Te as Guardrail, ge as InteractionProvider, Ae as Observability, Oe as QuotedExcerpt, Se as Reasoning, ze as ResponseFeedback, xe as RetrievalInspection, Xe as RunMessage, Je as RunStep, Ye as RunThought, Ge as RunTimeline, Ze as RunWorking, ye as Sources, rt as TaskProgress, pe as ThreadController, Ce as ToolCall, ae as agentReducer, q as agentStepSchema, ce as artifactReducer, J as artifactSchema, _e as evidenceUrl, me as interactionCopy, B as jsonSchema, fe as threadDocumentSchema, X as threadSummarySchema };