@burdenoff/fe-libs 2026.930.1 → 2026.930.2

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.
@@ -1,7 +1,7 @@
1
1
  import { usePrefersReducedMotion as e } from "./usePrefersReducedMotion.js";
2
- import { WRITE_PROPOSAL_MASK as t, formatWriteProposalValue as n, redactWriteProposalText as r, useWriteProposalRemainingMs as i, writeProposalArgumentValues as a, writeProposalConfirmState as o, writeProposalCountdownText as ee, writeProposalGatewayText as s, writeProposalKindText as te, writeProposalRootFieldName as c, writeProposalSensitiveTexts as l, writeProposalVariableValues as u } from "./writeProposalPresentation.js";
3
- import { useEffect as d, useId as ne, useRef as f, useState as p } from "react";
4
- import { ShieldAlert as re } from "lucide-react";
2
+ import { WRITE_PROPOSAL_MASK as t, formatWriteProposalValue as n, redactWriteProposalText as r, useWriteProposalRemainingMs as i, writeProposalArgumentValues as a, writeProposalConfirmState as o, writeProposalCountdownText as ee, writeProposalGatewayText as s, writeProposalKindText as te, writeProposalRootFieldName as ne, writeProposalSensitiveTexts as c, writeProposalVariableValues as l } from "./writeProposalPresentation.js";
3
+ import { useEffect as u, useId as re, useRef as d, useState as f } from "react";
4
+ import { ShieldAlert as p } from "lucide-react";
5
5
  import { jsx as m, jsxs as h } from "react/jsx-runtime";
6
6
  //#region src/shared/assistant/ui/AssistantWriteProposalCard.tsx
7
7
  var g = new Set([
@@ -27,19 +27,23 @@ var v = 500, ie = [
27
27
  .8,
28
28
  .9,
29
29
  1
30
- ];
30
+ ], y = new Set([
31
+ "FORBIDDEN",
32
+ "PERMISSION_DENIED",
33
+ "HTTP_403"
34
+ ]);
35
+ function b(e) {
36
+ return (e.result?.errors ?? []).some((e) => e.code !== void 0 && y.has(e.code));
37
+ }
31
38
  function ae(e, t) {
32
39
  switch (e.status) {
33
40
  case "pending": return t("writeProposal.status.pending", "Waiting for you");
34
41
  case "executing": return t("writeProposal.status.executing", "Working…");
35
42
  case "succeeded": {
36
- let n = r((e.result?.summary || e.description.readbackPast).trim(), l(e));
43
+ let n = r((e.result?.summary || e.description.readbackPast).trim(), c(e));
37
44
  return n ? t("writeProposal.status.succeeded", "Done — {{summary}}", { summary: n }) : t("writeProposal.status.succeededNoDetail", "Done");
38
45
  }
39
- case "failed": {
40
- let n = r((e.result?.errors?.find((e) => e.message.trim())?.message ?? e.result?.summary ?? "").trim(), l(e));
41
- return n ? t("writeProposal.status.failed", "Didn't go through: {{error}}", { error: n }) : t("writeProposal.status.failedNoDetail", "Didn't go through");
42
- }
46
+ case "failed": return b(e) ? t("writeProposal.status.failedNotPermitted", "Didn't go through — you don't have permission") : t("writeProposal.status.failedNoDetail", "Didn't go through");
43
47
  case "outcome_unknown": return t("writeProposal.status.outcomeUnknown", "Couldn't confirm — check before trying again");
44
48
  case "declined": return t("writeProposal.status.declined", "Cancelled");
45
49
  case "superseded": return t("writeProposal.status.superseded", "Replaced — the conversation moved on");
@@ -58,7 +62,7 @@ function oe(e) {
58
62
  case "expired": return "border-border-subtle bg-bg-muted text-text-secondary";
59
63
  }
60
64
  }
61
- function y(e, t) {
65
+ function x(e, t) {
62
66
  return [
63
67
  {
64
68
  key: "label",
@@ -76,11 +80,11 @@ function y(e, t) {
76
80
  ...t,
77
81
  label: `${e.alias ?? e.field}.${t.label}`
78
82
  }))),
79
- ...u(e)
83
+ ...l(e)
80
84
  ];
81
85
  }
82
86
  function se(e, t, r) {
83
- let i = new Map(y(e, r).map((e) => [e.key, e])), a = y(t, r), o = [];
87
+ let i = new Map(x(e, r).map((e) => [e.key, e])), a = x(t, r), o = [];
84
88
  for (let e of a) {
85
89
  let t = i.get(e.key) ?? null;
86
90
  i.delete(e.key), (!t || n(t.value) !== n(e.value)) && o.push({
@@ -98,45 +102,45 @@ function se(e, t, r) {
98
102
  });
99
103
  return o;
100
104
  }
101
- function b(e) {
105
+ function S(e) {
102
106
  return typeof e == "object" && !!e && typeof e.then == "function";
103
107
  }
104
- var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight: S, tr: C, onApprove: ce, onDecline: le, onReview: ue, onPresented: w, previous: T }) => {
105
- let E = e(), D = ne(), O = f(null), k = g.status === "pending", A = i(g.expiresAt, v, k), j = A <= 0, [M, de] = p({
108
+ var C = ({ view: g, serverNow: v, arrivedAt: y, capabilities: b, inert: x = !1, turnInFlight: C, tr: w, onApprove: ce, onDecline: le, onReview: ue, onPresented: T, previous: E }) => {
109
+ let D = e(), O = re(), k = d(null), A = g.status === "pending", j = i(g.expiresAt, v, y, A), M = j <= 0, [N, de] = f({
106
110
  proposalId: g.proposalId,
107
111
  keys: /* @__PURE__ */ new Set()
108
- }), fe = M.proposalId === g.proposalId ? M.keys : /* @__PURE__ */ new Set(), pe = (e) => de((t) => {
112
+ }), fe = N.proposalId === g.proposalId ? N.keys : /* @__PURE__ */ new Set(), P = (e) => de((t) => {
109
113
  let n = new Set(t.proposalId === g.proposalId ? t.keys : []);
110
114
  return n.has(e) ? n.delete(e) : n.add(e), {
111
115
  proposalId: g.proposalId,
112
116
  keys: n
113
117
  };
114
- }), N = f(null), [P, F] = p(null), I = P?.proposalId === g.proposalId ? P.action : null, L = (e, t) => {
118
+ }), F = d(null), [I, L] = f(null), R = I?.proposalId === g.proposalId ? I.action : null, z = (e, t) => {
115
119
  let n = g.proposalId;
116
- if (N.current?.proposalId === n) return;
120
+ if (F.current?.proposalId === n) return;
117
121
  let r = {
118
122
  proposalId: n,
119
123
  action: e
120
124
  };
121
- N.current = r, F(r);
125
+ F.current = r, L(r);
122
126
  let i = () => {
123
- N.current === r && (N.current = null, F((e) => e === r ? null : e));
127
+ F.current === r && (F.current = null, L((e) => e === r ? null : e));
124
128
  }, a;
125
129
  try {
126
130
  a = t();
127
131
  } catch (e) {
128
132
  throw i(), e;
129
133
  }
130
- b(a) && a.then(i, i);
131
- }, { available: R, fenced: z, showControls: B, offerConfirm: V } = o(g, x ? null : y), H = f(w);
132
- d(() => {
133
- H.current = w;
134
+ S(a) && a.then(i, i);
135
+ }, { available: B, fenced: pe, showControls: V, offerConfirm: H } = o(g, x ? null : b), U = d(T);
136
+ u(() => {
137
+ U.current = T;
134
138
  });
135
- let U = f(null);
136
- d(() => {
139
+ let W = d(null);
140
+ u(() => {
137
141
  let e = g.proposalId;
138
- if (!k || !R || U.current === e) return;
139
- let t = O.current;
142
+ if (!A || !B || W.current === e) return;
143
+ let t = k.current;
140
144
  if (!t || typeof IntersectionObserver > "u") return;
141
145
  let n = null, r = () => {
142
146
  n !== null && clearTimeout(n), n = null;
@@ -148,7 +152,7 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
148
152
  return;
149
153
  }
150
154
  n === null && (n = setTimeout(() => {
151
- n = null, U.current !== e && (U.current = e, i.disconnect(), H.current("card"));
155
+ n = null, W.current !== e && (W.current = e, i.disconnect(), U.current("card"));
152
156
  }, 500));
153
157
  }
154
158
  }, { threshold: ie });
@@ -157,19 +161,19 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
157
161
  };
158
162
  }, [
159
163
  g.proposalId,
160
- k,
161
- R
164
+ A,
165
+ B
162
166
  ]);
163
- let W = _(g), G = S || I !== null, K = G || j, q = (e) => {
164
- e.isTrusted && (!V || W || K || L("approve", ce));
165
- }, me = () => {
166
- !B || G || L("decline", le);
167
+ let G = _(g), K = C || R !== null, q = K || M, me = (e) => {
168
+ e.isTrusted && (!H || G || q || z("approve", ce));
167
169
  }, he = () => {
168
- !V || !W || K || ue();
169
- }, ge = ae(g, C), J = [...new Set(g.risk.kinds)].map((e) => ({
170
+ !V || K || z("decline", le);
171
+ }, ge = () => {
172
+ !H || !G || q || ue();
173
+ }, _e = ae(g, w), J = [...new Set(g.risk.kinds)].map((e) => ({
170
174
  kind: e,
171
- text: te(e, C)
172
- })).filter((e) => !!e.text), Y = u(g), X = g.revision > 1 && T && T.proposalId === g.supersedes ? se(T, g, C) : null, Z = (e, r) => {
175
+ text: te(e, w)
176
+ })).filter((e) => !!e.text), Y = l(g), X = g.revision > 1 && E && E.proposalId === g.supersedes ? se(E, g, w) : null, Z = (e, r) => {
173
177
  let i = e.sensitive && !fe.has(e.key);
174
178
  return /* @__PURE__ */ h("span", {
175
179
  className: "inline-flex min-w-0 flex-wrap items-baseline gap-x-2",
@@ -181,25 +185,25 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
181
185
  children: t
182
186
  }), /* @__PURE__ */ m("span", {
183
187
  className: "sr-only",
184
- children: C("writeProposal.hiddenValue", "Hidden value")
188
+ children: w("writeProposal.hiddenValue", "Hidden value")
185
189
  })]
186
190
  }) : /* @__PURE__ */ m("span", {
187
191
  className: "min-w-0 whitespace-pre-wrap break-words font-medium text-text-primary",
188
192
  children: n(e.value)
189
193
  }), e.sensitive && r ? /* @__PURE__ */ m("button", {
190
194
  type: "button",
191
- onClick: () => pe(e.key),
195
+ onClick: () => P(e.key),
192
196
  "aria-pressed": !i,
193
197
  "aria-describedby": r,
194
198
  className: "rounded text-[11px] font-medium text-text-link underline focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
195
199
  "data-testid": "assistant-write-proposal-reveal",
196
- children: i ? C("writeProposal.showValue", "Show") : C("writeProposal.hideValue", "Hide")
200
+ children: i ? w("writeProposal.showValue", "Show") : w("writeProposal.hideValue", "Hide")
197
201
  }) : null]
198
202
  });
199
203
  }, Q = (e, t) => /* @__PURE__ */ m("dl", {
200
204
  className: "mt-1 grid grid-cols-[minmax(0,auto)_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs",
201
205
  children: e.map((e, n) => {
202
- let r = `${D}-${t}-${n}`;
206
+ let r = `${O}-${t}-${n}`;
203
207
  return /* @__PURE__ */ h("div", {
204
208
  className: "contents",
205
209
  children: [/* @__PURE__ */ m("dt", {
@@ -212,12 +216,12 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
212
216
  })]
213
217
  }, `${n}:${e.key}`);
214
218
  })
215
- }), _e = l(g), $ = g.description.consequences.map((e) => r(e, _e));
219
+ }), ve = c(g), $ = g.description.consequences.map((e) => r(e, ve));
216
220
  return /* @__PURE__ */ h("div", {
217
- ref: O,
221
+ ref: k,
218
222
  role: "group",
219
- "aria-label": C("writeProposal.aria", "Proposed change: {{label}}", { label: g.description.label }),
220
- className: `my-2 overflow-hidden rounded-xl border ${k ? "border-status-warning bg-status-warning/10" : "border-border-subtle bg-bg-surface"}`,
223
+ "aria-label": w("writeProposal.aria", "Proposed change: {{label}}", { label: g.description.label }),
224
+ className: `my-2 overflow-hidden rounded-xl border ${A ? "border-status-warning bg-status-warning/10" : "border-border-subtle bg-bg-surface"}`,
221
225
  "data-testid": "assistant-write-proposal",
222
226
  "data-status": g.status,
223
227
  children: [
@@ -225,7 +229,7 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
225
229
  className: "flex items-start justify-between gap-2 border-b border-border-subtle px-3 py-2",
226
230
  children: [/* @__PURE__ */ h("div", {
227
231
  className: "flex min-w-0 items-start gap-2",
228
- children: [/* @__PURE__ */ m(re, {
232
+ children: [/* @__PURE__ */ m(p, {
229
233
  className: "mt-0.5 size-4 flex-shrink-0 text-status-warning",
230
234
  "aria-hidden": "true"
231
235
  }), /* @__PURE__ */ h("div", {
@@ -238,11 +242,11 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
238
242
  }),
239
243
  /* @__PURE__ */ m("p", {
240
244
  className: "text-[11px] text-text-muted",
241
- children: s(g, C)
245
+ children: s(g, w)
242
246
  }),
243
- V ? /* @__PURE__ */ m("p", {
247
+ H ? /* @__PURE__ */ m("p", {
244
248
  className: "text-[11px] text-text-secondary",
245
- children: C("writeProposal.title", "Review and approve this change.")
249
+ children: w("writeProposal.title", "Review and approve this change.")
246
250
  }) : null
247
251
  ]
248
252
  })]
@@ -252,7 +256,7 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
252
256
  "aria-atomic": "true",
253
257
  className: `max-w-[50%] flex-shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium break-words ${oe(g)}`,
254
258
  "data-testid": "assistant-write-proposal-status",
255
- children: ge
259
+ children: _e
256
260
  })]
257
261
  }),
258
262
  /* @__PURE__ */ h("div", {
@@ -272,7 +276,7 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
272
276
  "data-testid": "assistant-write-proposal-field",
273
277
  children: [/* @__PURE__ */ m("p", {
274
278
  className: "break-words font-mono text-xs text-text-primary",
275
- children: c(e)
279
+ children: ne(e)
276
280
  }), n.length > 0 ? Q(n, `field${t}`) : null]
277
281
  }, `${t}:${e.alias ?? e.field}`);
278
282
  }),
@@ -280,21 +284,21 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
280
284
  "data-testid": "assistant-write-proposal-variables",
281
285
  children: [/* @__PURE__ */ m("p", {
282
286
  className: "text-[11px] font-medium text-text-secondary",
283
- children: C("writeProposal.values", "Values")
287
+ children: w("writeProposal.values", "Values")
284
288
  }), Q(Y, "vars")]
285
289
  }) : null,
286
290
  g.description.variablesOmitted ? /* @__PURE__ */ m("p", {
287
291
  className: "text-[11px] text-text-muted",
288
- children: C("writeProposal.variablesOmitted", "{{count}} more values not shown", { count: g.description.variablesOmitted })
292
+ children: w("writeProposal.variablesOmitted", "{{count}} more values not shown", { count: g.description.variablesOmitted })
289
293
  }) : null,
290
294
  g.description.targetCount > 0 ? /* @__PURE__ */ m("p", {
291
295
  className: "text-xs text-text-secondary",
292
296
  "data-testid": "assistant-write-proposal-target-count",
293
- children: C("writeProposal.targetCount", "Items affected: {{count}}", { count: g.description.targetCount })
297
+ children: w("writeProposal.targetCount", "Items affected: {{count}}", { count: g.description.targetCount })
294
298
  }) : null,
295
299
  $.length > 0 ? /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
296
300
  className: "text-[11px] font-medium text-text-secondary",
297
- children: C("writeProposal.consequences", "What this will do")
301
+ children: w("writeProposal.consequences", "What this will do")
298
302
  }), /* @__PURE__ */ m("ul", {
299
303
  className: "list-disc pl-4 text-xs text-text-primary",
300
304
  "data-testid": "assistant-write-proposal-consequences",
@@ -302,18 +306,18 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
302
306
  })] }) : null,
303
307
  g.repeatOf ? /* @__PURE__ */ m("p", {
304
308
  className: "text-xs text-status-warning-text",
305
- children: C("writeProposal.repeat", "You made this same change recently. Confirming makes it again.")
309
+ children: w("writeProposal.repeat", "You made this same change recently. Confirming makes it again.")
306
310
  }) : null,
307
311
  g.revision > 1 ? /* @__PURE__ */ h("div", {
308
312
  "data-testid": "assistant-write-proposal-revision",
309
313
  children: [
310
314
  /* @__PURE__ */ m("p", {
311
315
  className: "text-[11px] font-medium text-text-secondary",
312
- children: C("writeProposal.revision", "Revised — version {{revision}}", { revision: g.revision })
316
+ children: w("writeProposal.revision", "Revised — version {{revision}}", { revision: g.revision })
313
317
  }),
314
318
  X && X.length === 0 ? /* @__PURE__ */ m("p", {
315
319
  className: "text-[11px] text-text-muted",
316
- children: C("writeProposal.diff.none", "No values changed")
320
+ children: w("writeProposal.diff.none", "No values changed")
317
321
  }) : null,
318
322
  X && X.length > 0 ? /* @__PURE__ */ h("table", {
319
323
  className: "mt-1 w-full table-fixed text-xs",
@@ -326,18 +330,18 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
326
330
  className: "w-1/3 font-medium",
327
331
  children: /* @__PURE__ */ m("span", {
328
332
  className: "sr-only",
329
- children: C("writeProposal.diff.value", "Value")
333
+ children: w("writeProposal.diff.value", "Value")
330
334
  })
331
335
  }),
332
336
  /* @__PURE__ */ m("th", {
333
337
  scope: "col",
334
338
  className: "font-medium",
335
- children: C("writeProposal.diff.before", "Before")
339
+ children: w("writeProposal.diff.before", "Before")
336
340
  }),
337
341
  /* @__PURE__ */ m("th", {
338
342
  scope: "col",
339
343
  className: "font-medium",
340
- children: C("writeProposal.diff.after", "After")
344
+ children: w("writeProposal.diff.after", "After")
341
345
  })
342
346
  ]
343
347
  }) }), /* @__PURE__ */ m("tbody", { children: X.map((e) => /* @__PURE__ */ h("tr", {
@@ -355,14 +359,14 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
355
359
  sensitive: e.before.sensitive || !!e.after?.sensitive
356
360
  }, null) : /* @__PURE__ */ m("span", {
357
361
  className: "text-text-muted",
358
- children: C("writeProposal.diff.absent", "(not set)")
362
+ children: w("writeProposal.diff.absent", "(not set)")
359
363
  })
360
364
  }),
361
365
  /* @__PURE__ */ m("td", {
362
366
  className: "break-words",
363
367
  children: e.after ? Z(e.after, null) : /* @__PURE__ */ m("span", {
364
368
  className: "text-text-muted",
365
- children: C("writeProposal.diff.absent", "(not set)")
369
+ children: w("writeProposal.diff.absent", "(not set)")
366
370
  })
367
371
  })
368
372
  ]
@@ -372,63 +376,63 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
372
376
  }) : null
373
377
  ]
374
378
  }),
375
- k ? /* @__PURE__ */ h("div", {
379
+ A ? /* @__PURE__ */ h("div", {
376
380
  className: "space-y-1 border-t border-border-subtle px-3 py-2 text-[11px]",
377
381
  children: [
378
382
  /* @__PURE__ */ m("p", {
379
383
  className: "text-text-secondary",
380
384
  "data-testid": "assistant-write-proposal-countdown",
381
- children: j ? C("writeProposal.timeUp", "Time's up — this can no longer be confirmed") : ee(A, E, C)
385
+ children: M ? w("writeProposal.timeUp", "Time's up — this can no longer be confirmed") : ee(j, D, w)
382
386
  }),
383
387
  x ? /* @__PURE__ */ m("p", {
384
388
  className: "text-text-secondary",
385
389
  "data-testid": "assistant-write-proposal-inert",
386
- children: C("writeProposal.inert", "This change can no longer be confirmed here. Nothing was done; ask the assistant to prepare it again if you still want it.")
387
- }) : R ? g.approvable ? z ? /* @__PURE__ */ m("p", {
390
+ children: w("writeProposal.inert", "This change can no longer be confirmed here. Nothing was done; ask the assistant to prepare it again if you still want it.")
391
+ }) : B ? g.approvable ? pe ? /* @__PURE__ */ m("p", {
388
392
  className: "text-text-secondary",
389
393
  "data-testid": "assistant-write-proposal-fenced",
390
- children: C("writeProposal.executionFenced", "You can review or cancel this change. Running it from the assistant becomes available once secure confirmation is enabled.")
394
+ children: w("writeProposal.executionFenced", "You can review or cancel this change. Running it from the assistant becomes available once secure confirmation is enabled.")
391
395
  }) : null : /* @__PURE__ */ m("p", {
392
396
  className: "text-text-secondary",
393
397
  "data-testid": "assistant-write-proposal-not-approvable",
394
- children: C("writeProposal.notApprovable", "This change isn't ready to confirm. If it stays this way, ask the assistant to prepare it again.")
398
+ children: w("writeProposal.notApprovable", "This change isn't ready to confirm. If it stays this way, ask the assistant to prepare it again.")
395
399
  }) : /* @__PURE__ */ m("p", {
396
400
  className: "text-text-secondary",
397
401
  "data-testid": "assistant-write-proposal-not-available",
398
- children: C("writeProposal.notAvailableYet", "Confirming changes from the assistant isn't available in this session yet.")
402
+ children: w("writeProposal.notAvailableYet", "Confirming changes from the assistant isn't available in this session yet.")
399
403
  }),
400
- B && S ? /* @__PURE__ */ m("p", {
404
+ V && C ? /* @__PURE__ */ m("p", {
401
405
  className: "text-text-muted",
402
- children: C("writeProposal.waitForTurn", "You can confirm once the assistant finishes replying.")
406
+ children: w("writeProposal.waitForTurn", "You can confirm once the assistant finishes replying.")
403
407
  }) : null
404
408
  ]
405
409
  }) : null,
406
- B ? /* @__PURE__ */ h("div", {
410
+ V ? /* @__PURE__ */ h("div", {
407
411
  className: "flex flex-wrap justify-end gap-2 border-t border-border-subtle px-3 py-2",
408
412
  children: [
409
413
  /* @__PURE__ */ m("button", {
410
414
  type: "button",
411
- onClick: me,
412
- disabled: G,
415
+ onClick: he,
416
+ disabled: K,
413
417
  className: "rounded-md border border-action-secondary-border bg-action-secondary-bg px-3 py-1.5 text-xs font-medium text-action-secondary-fg hover:bg-action-secondary-bg-hover disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
414
418
  "data-testid": "assistant-write-proposal-cancel",
415
- children: C("writeProposal.cancel", "Cancel")
419
+ children: w("writeProposal.cancel", "Cancel")
416
420
  }),
417
- V && W ? /* @__PURE__ */ m("button", {
421
+ H && G ? /* @__PURE__ */ m("button", {
418
422
  type: "button",
419
- onClick: he,
420
- disabled: K,
423
+ onClick: ge,
424
+ disabled: q,
421
425
  className: "rounded-md bg-action-primary-bg px-3 py-1.5 text-xs font-medium text-action-primary-fg hover:bg-action-primary-bg-hover disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
422
426
  "data-testid": "assistant-write-proposal-review",
423
- children: C("writeProposal.review", "Review & confirm…")
427
+ children: w("writeProposal.review", "Review & confirm…")
424
428
  }) : null,
425
- V && !W ? /* @__PURE__ */ m("button", {
429
+ H && !G ? /* @__PURE__ */ m("button", {
426
430
  type: "button",
427
- onClick: q,
428
- disabled: K,
431
+ onClick: me,
432
+ disabled: q,
429
433
  className: "rounded-md bg-action-primary-bg px-3 py-1.5 text-xs font-medium text-action-primary-fg hover:bg-action-primary-bg-hover disabled:opacity-60 focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
430
434
  "data-testid": "assistant-write-proposal-confirm",
431
- children: I === "approve" ? C("writeProposal.confirming", "Confirming…") : g.description.confirmLabel.trim() || C("writeProposal.confirmFallback", "Confirm this change")
435
+ children: R === "approve" ? w("writeProposal.confirming", "Confirming…") : g.description.confirmLabel.trim() || w("writeProposal.confirmFallback", "Confirm this change")
432
436
  }) : null
433
437
  ]
434
438
  }) : null
@@ -436,4 +440,4 @@ var x = ({ view: g, serverNow: v, capabilities: y, inert: x = !1, turnInFlight:
436
440
  });
437
441
  };
438
442
  //#endregion
439
- export { x as AssistantWriteProposalCard, g as WRITE_PROPOSAL_DIALOG_KINDS, v as WRITE_PROPOSAL_PRESENTED_AFTER_MS, _ as writeProposalUsesDialog };
443
+ export { C as AssistantWriteProposalCard, g as WRITE_PROPOSAL_DIALOG_KINDS, v as WRITE_PROPOSAL_PRESENTED_AFTER_MS, _ as writeProposalUsesDialog };
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantWriteProposalSlot.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantWriteProposalSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACzC,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,+DAA+D;IAC/D,cAAc,EAAE,CACd,SAAS,EAAE,MAAM,KACd,wBAAwB,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD,uEAAuE;IACvE,YAAY,EAAE,OAAO,CAAC;IACtB,EAAE,EAAE,WAAW,CAAC;IAChB,oDAAoD;IACpD,QAAQ,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,0BAA0B,EAAE,EAAE,CACzC,+BAA+B,CAoDhC,CAAC"}
1
+ {"version":3,"file":"AssistantWriteProposalSlot.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/AssistantWriteProposalSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACzC,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,+DAA+D;IAC/D,cAAc,EAAE,CACd,SAAS,EAAE,MAAM,KACd,wBAAwB,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD,uEAAuE;IACvE,YAAY,EAAE,OAAO,CAAC;IACtB,EAAE,EAAE,WAAW,CAAC;IAChB,oDAAoD;IACpD,QAAQ,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,0BAA0B,EAAE,EAAE,CACzC,+BAA+B,CAqDhC,CAAC"}
@@ -15,10 +15,11 @@ var a = ({ refs: a, conversationId: o, panel: s, entries: c, capabilitiesOf: l,
15
15
  ]), /* @__PURE__ */ i(r, { children: a.map((t) => {
16
16
  let n = c[t.proposalId];
17
17
  if (!n) return null;
18
- let { view: r, serverNow: a } = n, o = r.supersedes ? c[r.supersedes]?.view ?? null : null;
18
+ let { view: r, serverNow: a, arrivedAt: o } = n, m = r.supersedes ? c[r.supersedes]?.view ?? null : null;
19
19
  return /* @__PURE__ */ i(e, {
20
20
  view: r,
21
21
  serverNow: a,
22
+ arrivedAt: o,
22
23
  capabilities: l(n.session.sandboxId),
23
24
  inert: p?.has(n.session.sandboxId) ?? !1,
24
25
  turnInFlight: u,
@@ -27,7 +28,7 @@ var a = ({ refs: a, conversationId: o, panel: s, entries: c, capabilitiesOf: l,
27
28
  onDecline: () => s.decline(r, "user_declined", "card"),
28
29
  onReview: () => f(r),
29
30
  onPresented: (e) => void s.presented(r, e),
30
- previous: o
31
+ previous: m
31
32
  }, t.proposalId);
32
33
  }) });
33
34
  };
@@ -20,8 +20,8 @@ import { AssistantWriteConfirmDialogProps } from './AssistantWriteConfirmDialog'
20
20
  *
21
21
  * const confirm = useWriteProposalConfirm(actions);
22
22
  * <AssistantWriteProposalCard … onReview={() => confirm.review(view)} />
23
- * <AssistantWriteConfirmDialog {...confirm.dialog} serverNow=… capabilities=…
24
- * turnInFlight=… tr=… />
23
+ * <AssistantWriteConfirmDialog {...confirm.dialog} serverNow=… arrivedAt=…
24
+ * capabilities=… turnInFlight=… tr=… />
25
25
  *
26
26
  * Call `dismiss()` when the proposal can no longer be confirmed here (it was
27
27
  * replaced, the conversation or mode changed): that closes the default dialog
@@ -62,6 +62,12 @@ export interface WriteProposalEntry {
62
62
  view: WriteProposalView;
63
63
  /** That sandbox's clock at the read the view came from (`list().serverNow`). */
64
64
  serverNow: number;
65
+ /**
66
+ * This device's clock when that read arrived: with `serverNow`, one sample
67
+ * of the sandbox's clock, which stays true however long after it a card is
68
+ * drawn (BOFF-8163).
69
+ */
70
+ arrivedAt: number;
65
71
  /** Where the proposal lives: its issuing sandbox, session and conversation. */
66
72
  session: WriteProposalSession;
67
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useWriteProposals.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/useWriteProposals.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,OAAO,EAML,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB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;IACnB,sBAAsB;IACtB,OAAO,EAAE,CACP,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,4BAA4B,KAClC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,8BAA8B;IAC9B,SAAS,EAAE,CACT,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,gCAAgC,KACtC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,kDAAkD;IAClD,KAAK,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS,CAAC;IAC9D;;;;OAIG;IACH,OAAO,EAAE,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,KAAK,mBAAmB,CAAC;IAC5E;;;;;;;OAOG;IACH,eAAe,EAAE,CACf,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,uBAAuB,EAC/B,MAAM,EAAE,sBAAsB,KAC3B,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,mFAAmF;IACnF,QAAQ,EAAE,CACR,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,4BAA4B,KACjC,IAAI,CAAC;IACV;;;OAGG;IACH,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AA+FD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,EAAE,EAAE,WAAW,CAAC;IAChB;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,iBAAiB,CAAC;CAC1C,GAAG;IACF,KAAK,EAAE,kBAAkB,CAAC;IAC1B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,4DAA4D;IAC5D,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACvC,CA6YA"}
1
+ {"version":3,"file":"useWriteProposals.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/useWriteProposals.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;A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().sandboxWriteCapabilities[e],
104
104
  actorOf: () => A.current.userId,
105
105
  onList: (e, t, r) => {
106
- P.current.set(x(e), t.serverNow), n(t.proposals.map((n) => ({
107
- view: n,
106
+ let a = {
108
107
  serverNow: t.serverNow,
108
+ arrivedAt: Date.now()
109
+ };
110
+ P.current.set(x(e), a), n(t.proposals.map((t) => ({
111
+ view: t,
112
+ ...a,
109
113
  session: e
110
114
  }))), i(e, t.proposals, r.turnMessageId);
111
115
  },
112
116
  onView: (e, t) => {
117
+ let r = N.current[t.proposalId];
113
118
  n([{
114
119
  view: t,
115
- serverNow: P.current.get(x(e)) ?? N.current[t.proposalId]?.serverNow ?? NaN,
120
+ ...P.current.get(x(e)) ?? {
121
+ serverNow: r?.serverNow ?? NaN,
122
+ arrivedAt: r?.arrivedAt ?? NaN
123
+ },
116
124
  session: e
117
125
  }]);
118
126
  },
@@ -47,14 +47,34 @@ export declare function writeProposalVariableValues(view: WriteProposalView): Wr
47
47
  /** "Expires in 4:59", or, under reduced motion, words that move once a minute. */
48
48
  export declare function writeProposalCountdownText(remainingMs: number, reducedMotion: boolean, tr: AssistantTr): string;
49
49
  /**
50
- * How long until `expiresAt`, on the ISSUING sandbox's clock.
50
+ * How long until `expiresAt`, on the ISSUING sandbox's clock, when this
51
+ * device's clock reads `localNow`.
51
52
  *
52
- * `serverNow` is that sandbox's clock when the record was read
53
- * (`list().serverNow`); the difference from this device's clock is measured
54
- * again whenever a fresh read arrives. While `ticking`, the value moves once a
55
- * second.
53
+ * `serverNow` is that sandbox's clock at the read the record came from
54
+ * (`list().serverNow`), and `arrivedAt` is this device's clock when that read
55
+ * arrived. Together they are one sample of the sandbox's clock, so what has
56
+ * passed since is `localNow - arrivedAt` whenever the question is asked.
57
+ *
58
+ * ★★ BOFF-8163: the sample is taken when the read ARRIVES, never when a card
59
+ * mounts. A card first drawn minutes after the read (the voice tray, a
60
+ * conversation reopened before its fresh read lands, a dialog opened late)
61
+ * used to count those minutes as time still left, and kept its confirm
62
+ * enabled past the record's expiry.
63
+ *
64
+ * An unreadable sample (either value not finite) leaves this device's clock
65
+ * as the only one there is.
66
+ */
67
+ export declare function writeProposalRemainingMs(expiresAt: number, serverNow: number, arrivedAt: number, localNow: number): number;
68
+ /**
69
+ * `writeProposalRemainingMs` for a surface, kept current while `ticking`.
70
+ *
71
+ * It ticks on the countdown's own whole seconds, so it reaches 0 at the
72
+ * moment the record expires rather than up to a second later, and stops
73
+ * there: nothing changes after that until a fresh read does. Each time
74
+ * ticking starts (a dialog opening) this device's clock is read at once, so a
75
+ * surface that was idle never shows a stale figure.
56
76
  */
57
- export declare function useWriteProposalRemainingMs(expiresAt: number, serverNow: number, ticking: boolean): number;
77
+ export declare function useWriteProposalRemainingMs(expiresAt: number, serverNow: number, arrivedAt: number, ticking: boolean): number;
58
78
  /** Whether a proposal's controls, and its confirm, may be offered. */
59
79
  export interface WriteProposalConfirmState {
60
80
  /** The issuing sandbox speaks the v1 protocol and enforces it. */
@@ -1 +1 @@
1
- {"version":3,"file":"writeProposalPresentation.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/writeProposalPresentation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;GASG;AAEH,sCAAsC;AACtC,eAAO,MAAM,mBAAmB,yCAAW,CAAC;AAY5C,4EAA4E;AAC5E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQ/D;AAkBD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAW7E;AAqBD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,MAAM,CA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E,iBAAiB,EACvB,YAAY,EAAE,wBAAwB,GAAG,IAAI,GAAG,SAAS,GACxD,yBAAyB,CAY3B"}
1
+ {"version":3,"file":"writeProposalPresentation.d.ts","sourceRoot":"","sources":["../../../../src/shared/assistant/ui/writeProposalPresentation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;GASG;AAEH,sCAAsC;AACtC,eAAO,MAAM,mBAAmB,yCAAW,CAAC;AAY5C,4EAA4E;AAC5E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQ/D;AAkBD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAW7E;AAqBD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,MAAM,CAUR;AAED,mFAAmF;AACnF,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,qBAAqB,EAC3B,EAAE,EAAE,WAAW,GACd,MAAM,GAAG,IAAI,CAkBf;AAED,+CAA+C;AAC/C,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,iBAAiB,EACvB,EAAE,EAAE,WAAW,GACd,MAAM,CAIR;AAED,8EAA8E;AAC9E,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,2EAA2E;AAC3E,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,OAAO,CAAC,GACrD,MAAM,CAER;AAED,iEAAiE;AACjE,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,sBAAsB,GAC5B,uBAAuB,EAAE,CAQ3B;AAED,kEAAkE;AAClE,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,iBAAiB,GACtB,uBAAuB,EAAE,CAO3B;AAED,kFAAkF;AAClF,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,OAAO,EACtB,EAAE,EAAE,WAAW,GACd,MAAM,CAeR;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,MAAM,CAKR;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,GACf,MAAM,CAwBR;AAED,sEAAsE;AACtE,MAAM,WAAW,yBAAyB;IACxC,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,MAAM,EAAE,OAAO,CAAC;IAChB,+EAA+E;IAC/E,YAAY,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,iBAAiB,EACvB,YAAY,EAAE,wBAAwB,GAAG,IAAI,GAAG,SAAS,GACxD,yBAAyB,CAY3B"}
@@ -81,23 +81,30 @@ function h(e, t, n) {
81
81
  let r = Math.ceil(e / 1e3);
82
82
  return n("writeProposal.expiresIn", "Expires in {{time}}", { time: `${Math.floor(r / 60)}:${String(r % 60).padStart(2, "0")}` });
83
83
  }
84
- function g(n, r, i) {
85
- let [a, o] = t(() => ({
86
- serverNow: r,
87
- offset: Number.isFinite(r) ? r - Date.now() : 0
88
- })), s = a.offset;
89
- Object.is(a.serverNow, r) || (s = Number.isFinite(r) ? r - Date.now() : 0, o({
90
- serverNow: r,
91
- offset: s
92
- }));
93
- let [c, l] = t(() => Date.now());
84
+ function g(e, t, n, r) {
85
+ return !Number.isFinite(t) || !Number.isFinite(n) ? e - r : e - (t + (r - n));
86
+ }
87
+ function _(n, r, i, a) {
88
+ let [o, s] = t(() => Date.now());
94
89
  return e(() => {
95
- if (!i) return;
96
- let e = setInterval(() => l(Date.now()), 1e3);
97
- return () => clearInterval(e);
98
- }, [i]), n - (c + s);
90
+ if (!a) return;
91
+ let e = null, t = () => {
92
+ let a = Date.now();
93
+ s(a);
94
+ let o = g(n, r, i, a);
95
+ o <= 0 || (e = setTimeout(t, (o - 1) % 1e3 + 1));
96
+ };
97
+ return t(), () => {
98
+ e !== null && clearTimeout(e);
99
+ };
100
+ }, [
101
+ a,
102
+ n,
103
+ r,
104
+ i
105
+ ]), g(n, r, i, o);
99
106
  }
100
- function _(e, t) {
107
+ function v(e, t) {
101
108
  let n = t?.proposals === !0 && t.writeApprovalMode === "proposal-v1", r = e.execution.enabled !== !0 || t?.writeExecution !== "enabled", i = e.status === "pending" && e.approvable && n;
102
109
  return {
103
110
  available: n,
@@ -107,4 +114,4 @@ function _(e, t) {
107
114
  };
108
115
  }
109
116
  //#endregion
110
- export { n as WRITE_PROPOSAL_MASK, a as formatWriteProposalValue, l as redactWriteProposalText, g as useWriteProposalRemainingMs, p as writeProposalArgumentValues, _ as writeProposalConfirmState, h as writeProposalCountdownText, d as writeProposalGatewayText, u as writeProposalKindText, f as writeProposalRootFieldName, s as writeProposalSensitiveTexts, m as writeProposalVariableValues };
117
+ export { n as WRITE_PROPOSAL_MASK, a as formatWriteProposalValue, l as redactWriteProposalText, _ as useWriteProposalRemainingMs, p as writeProposalArgumentValues, v as writeProposalConfirmState, h as writeProposalCountdownText, d as writeProposalGatewayText, u as writeProposalKindText, g as writeProposalRemainingMs, f as writeProposalRootFieldName, s as writeProposalSensitiveTexts, m as writeProposalVariableValues };