reifyui 0.13.8 → 0.13.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sheet.d.ts CHANGED
@@ -10,6 +10,8 @@ export interface SheetCollab {
10
10
  /** Apply ops to the live document (the only way anyone writes). */
11
11
  ops(ops: SheetOp[]): void;
12
12
  peers: Array<Record<string, unknown>>;
13
+ /** Live editing was refused for this person (removed, signed out): the host says so, with a reload. */
14
+ stopped: boolean;
13
15
  setPresence(presence: Record<string, unknown> | null): void;
14
16
  [k: string]: unknown;
15
17
  }
package/dist/sheet.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  import "./chunk-J633KV57.js";
12
12
  import {
13
13
  useLiveDoc
14
- } from "./chunk-UKG4Z6QK.js";
14
+ } from "./chunk-Q342JSCO.js";
15
15
  import {
16
16
  peerColor
17
17
  } from "./chunk-ZYWE47EO.js";
@@ -96,7 +96,7 @@ function useSheetCollab(resourceId, { fetchTicket, me } = {}) {
96
96
  at: Date.now()
97
97
  });
98
98
  }, [live.setAwareness, who.id, who.name, who.email]);
99
- return { ready: live.ready, sheet, ops, liveRun, copilotBuilding, peers, setPresence };
99
+ return { ready: live.ready, stopped: live.stopped, sheet, ops, liveRun, copilotBuilding, peers, setPresence };
100
100
  }
101
101
 
102
102
  // src/sheet/useSheetRun.js
package/dist/sheet.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/sheet/useSheetCollab.js","../src/sheet/useSheetRun.js","../src/sheet/RunStrip.jsx"],"sourcesContent":["// The sheet's live document, shared by every host that renders the grid (the\n// Sheets app, the studio's Spaces page). The Yjs document IS the sheet while\n// people edit it (sheetDoc.js holds the layout); this hook keeps a JSON\n// snapshot of it for rendering and hands out the ops the grid edits with,\n// each a Yjs transaction, so two people never clobber each other and every\n// change reaches every viewer as it happens. The service writes the same\n// document (copilot builds, batch runs) and keeps its own keys on `meta`\n// (run, copilot). Presence rides awareness on the shared live-document core.\n// Hosts differ in auth, so the ticket fetch and the current member are injected.\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport * as sheetDoc from './sheetDoc.js';\nimport { useLiveDoc } from '../collab/useLiveDoc.js';\nimport { peerColor } from '../collab/colors.js';\n\nexport { peerColor };\n\nconst COPILOT_STALE_MS = 15 * 60 * 1000;\n\n/** The ops a host edits with, bound to one document. Each is one transaction. */\nexport function sheetOps(doc) {\n const one = (op) => sheetDoc.apply(doc, [op], 'local');\n return {\n setCell: (tab, key, cell) => one({ op: 'set_cell', tab, key, cell }),\n setCells: (tab, cells) => one({ op: 'set_cells', tab, cells }),\n setColumn: (tab, column, at) => one({ op: 'set_column', tab, column, ...(Number.isInteger(at) ? { at } : {}) }),\n deleteColumn: (tab, id) => one({ op: 'delete_column', tab, id }),\n moveColumn: (tab, id, at) => one({ op: 'move_column', tab, id, at }),\n setRow: (tab, row, at) => one({ op: 'set_row', tab, row, ...(Number.isInteger(at) ? { at } : {}) }),\n deleteRow: (tab, id) => one({ op: 'delete_row', tab, id }),\n moveRow: (tab, id, at) => one({ op: 'move_row', tab, id, at }),\n setTab: (tab, at) => one({ op: 'set_tab', tab, ...(Number.isInteger(at) ? { at } : {}) }),\n deleteTab: (id) => one({ op: 'delete_tab', id }),\n moveTab: (id, at) => one({ op: 'move_tab', id, at }),\n setTitle: (title) => one({ op: 'set_meta', key: 'title', value: title }),\n };\n}\n\n/** Returns { ready, sheet, ops, liveRun, copilotBuilding, peers, setPresence }.\n * fetchTicket(resourceId) -> {url, doc, token} | null (host-authenticated).\n * me -> {id, name, email} of the current member, for presence.\n * Presence (awareness): {id, name, tab, sel: {a:[rowId,colId], f:[rowId,colId]}|null,\n * typing: {key, text}|null, at}; peers come back with their palette color. */\nexport function useSheetCollab(resourceId, { fetchTicket, me } = {}) {\n const live = useLiveDoc(resourceId, { fetchTicket, field: 'presence' });\n const [sheet, setSheet] = useState(null);\n const [liveRun, setLiveRun] = useState(null);\n const [copilotBuilding, setCopilotBuilding] = useState(false);\n const who = me || {};\n\n // One snapshot per tick however many updates arrive: the grid renders JSON,\n // the document stays the truth. A timer, not an animation frame, so a tab\n // in the background keeps converging and is current the moment someone\n // returns to it.\n useEffect(() => {\n const ydoc = live.doc;\n if (!ydoc) { setSheet(null); setLiveRun(null); setCopilotBuilding(false); return undefined; }\n const meta = ydoc.getMap('meta');\n let timer = 0;\n let dead = false;\n const snapshot = () => {\n timer = 0;\n if (dead) return;\n setSheet(sheetDoc.toJSON(ydoc));\n setLiveRun(meta.get('run') || null);\n const cop = meta.get('copilot');\n setCopilotBuilding(!!(cop && cop.building && (!cop.at || Date.now() - cop.at < COPILOT_STALE_MS)));\n };\n const onUpdate = () => { if (!timer) timer = window.setTimeout(snapshot, 0); };\n ydoc.on('update', onUpdate);\n snapshot();\n return () => { dead = true; ydoc.off('update', onUpdate); window.clearTimeout(timer); };\n }, [live.doc]);\n\n // Announce this person on join (no selection yet).\n useEffect(() => {\n live.setAwareness({ id: who.id || '', name: who.name || who.email || 'Someone', tab: null, sel: null, typing: null, at: Date.now() });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [resourceId, live.setAwareness]);\n\n // Everyone else in the document: every other client, including this same\n // person in another window (their selection there is worth seeing too).\n const peers = useMemo(() => {\n const out = [];\n for (const st of live.states) {\n const p = st.presence;\n if (!p || !p.id || st.clientId === live.selfClientId) continue;\n out.push({ ...p, clientId: st.clientId, color: peerColor(p.id) });\n }\n return out;\n }, [live.states, live.selfClientId]);\n\n const ops = useMemo(() => (live.doc ? sheetOps(live.doc) : null), [live.doc]);\n\n /** What this member is doing on a tab: their selection and, while they\n * type in a cell, the text so far. */\n const setPresence = useCallback((tab, state) => {\n live.setAwareness({ id: who.id || '', name: who.name || who.email || 'Someone', tab: tab || null,\n sel: (state && state.sel) || null, typing: (state && state.typing) || null, at: Date.now() });\n }, [live.setAwareness, who.id, who.name, who.email]);\n\n return { ready: live.ready, sheet, ops, liveRun, copilotBuilding, peers, setPresence };\n}\n","// A batch run of a sheet, as the grid's hosts see it. The service starts the\n// run; the document's live channel carries every finished cell and the run's\n// own transitions (useSheetCollab: sheet, liveRun), so this hook only\n// needs start and stop. Hosts differ in auth, so the API calls are injected:\n// api.startRun(id, {tab, columns, rows, concurrency}) -> run summary\n// api.cancelRun(id, runId) -> run summary\nimport { useCallback, useEffect, useState } from 'react';\n\nconst ACTIVE = new Set(['running', 'cancelling']);\nexport const isRunActive = (run) => !!run && ACTIVE.has(run.status);\n\nexport function useSheetRun(resourceId, api, liveRun) {\n const [run, setRun] = useState(null);\n const [error, setError] = useState('');\n\n useEffect(() => { setRun(null); setError(''); }, [resourceId]);\n\n // Adopt the channel's run when it is in progress (a reload, a run someone\n // else or the copilot started) or when it is the one already shown (its\n // outcome). A finished run from before this view opened stays out of the way.\n useEffect(() => {\n if (!liveRun) return;\n setRun((cur) => {\n if (isRunActive(liveRun) || (cur && cur.run_id === liveRun.run_id)) return liveRun;\n return cur;\n });\n }, [liveRun]);\n\n const start = useCallback(async (body) => {\n setError('');\n try {\n const r = await api.startRun(resourceId, body);\n setRun(r);\n return r;\n } catch (e) {\n setError(String(e?.message || e));\n return null;\n }\n }, [resourceId, api]);\n\n const cancel = useCallback(async () => {\n if (!isRunActive(run)) return;\n try { setRun(await api.cancelRun(resourceId, run.run_id)); }\n catch (e) { setError(String(e?.message || e)); }\n }, [resourceId, api, run]);\n\n const dismiss = useCallback(() => { setRun(null); setError(''); }, []);\n\n return { run, error, start, cancel, dismiss };\n}\n\n/** The tab with the run's pending cells shown as queued: every cell the run\n * will fill that the run has not written yet (running, done, failed or\n * skipped cells carry the run's id). */\nexport function withQueuedCells(tab, run) {\n if (!tab || !isRunActive(run) || run.tab_id !== tab.id) return tab;\n const rows = run.rows || (tab.rows || []).map((r) => r.id);\n const cells = { ...(tab.cells || {}) };\n let touched = false;\n for (const rid of rows) {\n for (const col of run.columns || []) {\n const key = `${rid}:${col.id}`;\n const cur = cells[key];\n if (cur && cur.run_id === run.run_id) continue;\n cells[key] = { ...(cur || {}), status: 'queued' };\n touched = true;\n }\n }\n return touched ? { ...tab, cells } : tab;\n}\n\n/** How many of the run's cells have a result so far. */\nexport function runProgress(tab, run) {\n if (!run) return 0;\n let n = 0;\n for (const cell of Object.values(tab?.cells || {})) {\n if (cell && cell.run_id === run.run_id && cell.status !== 'running') n += 1;\n }\n return n;\n}\n","// The run's one line in the tabs bar: what is filling, how far along, Stop;\n// then the outcome until dismissed. Every number is the run's own.\nimport React from 'react';\nimport { isRunActive } from './useSheetRun.js';\n\n// The outcome as counted from the document; a run closed while the document\n// could not be read carries no counts, and says nothing rather than zeros.\nfunction outcome(run) {\n const c = run.counts;\n if (!c) return '';\n const parts = [`${c.done || 0} done`];\n if (c.failed) parts.push(`${c.failed} failed`);\n if (c.skipped) parts.push(`${c.skipped} skipped`);\n return parts.join(', ');\n}\n\nexport function RunStrip({ run, error, filled = 0, onCancel, onDismiss }) {\n if (!run && !error) return null;\n let text = error;\n let tone = 'failed';\n if (run) {\n const names = (run.columns || []).map((c) => c.name).join(', ');\n const total = run.cell_count || 0;\n tone = run.status;\n if (run.status === 'running') {\n text = `Filling ${names}: ${filled} of ${total} cells, ${run.concurrency} rows at a time`;\n } else if (run.status === 'cancelling') {\n text = `Stopping after the cells in flight: ${filled} of ${total} cells`;\n } else if (run.status === 'done') {\n const o = outcome(run);\n text = o ? `Filled ${names}: ${o}` : `Filled ${names}`;\n } else if (run.status === 'cancelled') {\n const c = run.counts;\n const o = outcome(run);\n const notRun = c ? Math.max(0, total - ((c.done || 0) + (c.failed || 0) + (c.skipped || 0))) : null;\n text = o ? `Stopped: ${o}, ${notRun} not run` : 'Stopped';\n } else {\n const o = outcome(run);\n text = run.error ? `The run stopped early: ${run.error}` : 'The run could not start';\n if (o) text += ` (${o})`;\n tone = 'failed';\n }\n }\n const active = isRunActive(run);\n return (\n <div className={`shg-run shg-run-${tone}`} role=\"status\" aria-live=\"polite\">\n <span className=\"shg-run-dot\" aria-hidden=\"true\" />\n <span className=\"shg-run-text\" title={text}>{text}</span>\n {active ? (\n <button type=\"button\" className=\"shg-run-stop\" onClick={onCancel}\n disabled={run.status === 'cancelling'}>Stop</button>\n ) : (\n <button type=\"button\" className=\"shg-run-x\" onClick={onDismiss} aria-label=\"Dismiss\">×</button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,SAAS,aAAa,WAAW,SAAS,gBAAgB;AAO1D,IAAM,mBAAmB,KAAK,KAAK;AAG5B,SAAS,SAAS,KAAK;AAC5B,QAAM,MAAM,CAAC,OAAgB,MAAM,KAAK,CAAC,EAAE,GAAG,OAAO;AACrD,SAAO;AAAA,IACL,SAAS,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,IAAI,YAAY,KAAK,KAAK,KAAK,CAAC;AAAA,IACnE,UAAU,CAAC,KAAK,UAAU,IAAI,EAAE,IAAI,aAAa,KAAK,MAAM,CAAC;AAAA,IAC7D,WAAW,CAAC,KAAK,QAAQ,OAAO,IAAI,EAAE,IAAI,cAAc,KAAK,QAAQ,GAAI,OAAO,UAAU,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,EAAG,CAAC;AAAA,IAC9G,cAAc,CAAC,KAAK,OAAO,IAAI,EAAE,IAAI,iBAAiB,KAAK,GAAG,CAAC;AAAA,IAC/D,YAAY,CAAC,KAAK,IAAI,OAAO,IAAI,EAAE,IAAI,eAAe,KAAK,IAAI,GAAG,CAAC;AAAA,IACnE,QAAQ,CAAC,KAAK,KAAK,OAAO,IAAI,EAAE,IAAI,WAAW,KAAK,KAAK,GAAI,OAAO,UAAU,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,EAAG,CAAC;AAAA,IAClG,WAAW,CAAC,KAAK,OAAO,IAAI,EAAE,IAAI,cAAc,KAAK,GAAG,CAAC;AAAA,IACzD,SAAS,CAAC,KAAK,IAAI,OAAO,IAAI,EAAE,IAAI,YAAY,KAAK,IAAI,GAAG,CAAC;AAAA,IAC7D,QAAQ,CAAC,KAAK,OAAO,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wBAAC,UAAK,WAAU,eAAc,eAAY,QAAO;AAAA,IACjD,oBAAC,UAAK,WAAU,gBAAe,OAAO,MAAO,gBAAK;AAAA,IACjD,SACC;AAAA,MAAC;AAAA;AAAA,QAAO,MAAK;AAAA,QAAS,WAAU;AAAA,QAAe,SAAS;AAAA,QAChD,UAAU,IAAI,WAAW;AAAA,QAAc;AAAA;AAAA,IAAI,IAEnD,oBAAC,YAAO,MAAK,UAAS,WAAU,aAAY,SAAS,WAAW,cAAW,WAAU,kBAAC;AAAA,KAE1F;AAEJ;","names":["useCallback","useEffect","useState"]}
1
+ {"version":3,"sources":["../src/sheet/useSheetCollab.js","../src/sheet/useSheetRun.js","../src/sheet/RunStrip.jsx"],"sourcesContent":["// The sheet's live document, shared by every host that renders the grid (the\n// Sheets app, the studio's Spaces page). The Yjs document IS the sheet while\n// people edit it (sheetDoc.js holds the layout); this hook keeps a JSON\n// snapshot of it for rendering and hands out the ops the grid edits with,\n// each a Yjs transaction, so two people never clobber each other and every\n// change reaches every viewer as it happens. The service writes the same\n// document (copilot builds, batch runs) and keeps its own keys on `meta`\n// (run, copilot). Presence rides awareness on the shared live-document core.\n// Hosts differ in auth, so the ticket fetch and the current member are injected.\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport * as sheetDoc from './sheetDoc.js';\nimport { useLiveDoc } from '../collab/useLiveDoc.js';\nimport { peerColor } from '../collab/colors.js';\n\nexport { peerColor };\n\nconst COPILOT_STALE_MS = 15 * 60 * 1000;\n\n/** The ops a host edits with, bound to one document. Each is one transaction. */\nexport function sheetOps(doc) {\n const one = (op) => sheetDoc.apply(doc, [op], 'local');\n return {\n setCell: (tab, key, cell) => one({ op: 'set_cell', tab, key, cell }),\n setCells: (tab, cells) => one({ op: 'set_cells', tab, cells }),\n setColumn: (tab, column, at) => one({ op: 'set_column', tab, column, ...(Number.isInteger(at) ? { at } : {}) }),\n deleteColumn: (tab, id) => one({ op: 'delete_column', tab, id }),\n moveColumn: (tab, id, at) => one({ op: 'move_column', tab, id, at }),\n setRow: (tab, row, at) => one({ op: 'set_row', tab, row, ...(Number.isInteger(at) ? { at } : {}) }),\n deleteRow: (tab, id) => one({ op: 'delete_row', tab, id }),\n moveRow: (tab, id, at) => one({ op: 'move_row', tab, id, at }),\n setTab: (tab, at) => one({ op: 'set_tab', tab, ...(Number.isInteger(at) ? { at } : {}) }),\n deleteTab: (id) => one({ op: 'delete_tab', id }),\n moveTab: (id, at) => one({ op: 'move_tab', id, at }),\n setTitle: (title) => one({ op: 'set_meta', key: 'title', value: title }),\n };\n}\n\n/** Returns { ready, stopped, sheet, ops, liveRun, copilotBuilding, peers, setPresence }.\n * `stopped`: live editing was refused for this person (removed, signed out); the host says so.\n * fetchTicket(resourceId) -> {url, doc, token} | null (host-authenticated).\n * me -> {id, name, email} of the current member, for presence.\n * Presence (awareness): {id, name, tab, sel: {a:[rowId,colId], f:[rowId,colId]}|null,\n * typing: {key, text}|null, at}; peers come back with their palette color. */\nexport function useSheetCollab(resourceId, { fetchTicket, me } = {}) {\n const live = useLiveDoc(resourceId, { fetchTicket, field: 'presence' });\n const [sheet, setSheet] = useState(null);\n const [liveRun, setLiveRun] = useState(null);\n const [copilotBuilding, setCopilotBuilding] = useState(false);\n const who = me || {};\n\n // One snapshot per tick however many updates arrive: the grid renders JSON,\n // the document stays the truth. A timer, not an animation frame, so a tab\n // in the background keeps converging and is current the moment someone\n // returns to it.\n useEffect(() => {\n const ydoc = live.doc;\n if (!ydoc) { setSheet(null); setLiveRun(null); setCopilotBuilding(false); return undefined; }\n const meta = ydoc.getMap('meta');\n let timer = 0;\n let dead = false;\n const snapshot = () => {\n timer = 0;\n if (dead) return;\n setSheet(sheetDoc.toJSON(ydoc));\n setLiveRun(meta.get('run') || null);\n const cop = meta.get('copilot');\n setCopilotBuilding(!!(cop && cop.building && (!cop.at || Date.now() - cop.at < COPILOT_STALE_MS)));\n };\n const onUpdate = () => { if (!timer) timer = window.setTimeout(snapshot, 0); };\n ydoc.on('update', onUpdate);\n snapshot();\n return () => { dead = true; ydoc.off('update', onUpdate); window.clearTimeout(timer); };\n }, [live.doc]);\n\n // Announce this person on join (no selection yet).\n useEffect(() => {\n live.setAwareness({ id: who.id || '', name: who.name || who.email || 'Someone', tab: null, sel: null, typing: null, at: Date.now() });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [resourceId, live.setAwareness]);\n\n // Everyone else in the document: every other client, including this same\n // person in another window (their selection there is worth seeing too).\n const peers = useMemo(() => {\n const out = [];\n for (const st of live.states) {\n const p = st.presence;\n if (!p || !p.id || st.clientId === live.selfClientId) continue;\n out.push({ ...p, clientId: st.clientId, color: peerColor(p.id) });\n }\n return out;\n }, [live.states, live.selfClientId]);\n\n const ops = useMemo(() => (live.doc ? sheetOps(live.doc) : null), [live.doc]);\n\n /** What this member is doing on a tab: their selection and, while they\n * type in a cell, the text so far. */\n const setPresence = useCallback((tab, state) => {\n live.setAwareness({ id: who.id || '', name: who.name || who.email || 'Someone', tab: tab || null,\n sel: (state && state.sel) || null, typing: (state && state.typing) || null, at: Date.now() });\n }, [live.setAwareness, who.id, who.name, who.email]);\n\n return { ready: live.ready, stopped: live.stopped, sheet, ops, liveRun, copilotBuilding, peers, setPresence };\n}\n","// A batch run of a sheet, as the grid's hosts see it. The service starts the\n// run; the document's live channel carries every finished cell and the run's\n// own transitions (useSheetCollab: sheet, liveRun), so this hook only\n// needs start and stop. Hosts differ in auth, so the API calls are injected:\n// api.startRun(id, {tab, columns, rows, concurrency}) -> run summary\n// api.cancelRun(id, runId) -> run summary\nimport { useCallback, useEffect, useState } from 'react';\n\nconst ACTIVE = new Set(['running', 'cancelling']);\nexport const isRunActive = (run) => !!run && ACTIVE.has(run.status);\n\nexport function useSheetRun(resourceId, api, liveRun) {\n const [run, setRun] = useState(null);\n const [error, setError] = useState('');\n\n useEffect(() => { setRun(null); setError(''); }, [resourceId]);\n\n // Adopt the channel's run when it is in progress (a reload, a run someone\n // else or the copilot started) or when it is the one already shown (its\n // outcome). A finished run from before this view opened stays out of the way.\n useEffect(() => {\n if (!liveRun) return;\n setRun((cur) => {\n if (isRunActive(liveRun) || (cur && cur.run_id === liveRun.run_id)) return liveRun;\n return cur;\n });\n }, [liveRun]);\n\n const start = useCallback(async (body) => {\n setError('');\n try {\n const r = await api.startRun(resourceId, body);\n setRun(r);\n return r;\n } catch (e) {\n setError(String(e?.message || e));\n return null;\n }\n }, [resourceId, api]);\n\n const cancel = useCallback(async () => {\n if (!isRunActive(run)) return;\n try { setRun(await api.cancelRun(resourceId, run.run_id)); }\n catch (e) { setError(String(e?.message || e)); }\n }, [resourceId, api, run]);\n\n const dismiss = useCallback(() => { setRun(null); setError(''); }, []);\n\n return { run, error, start, cancel, dismiss };\n}\n\n/** The tab with the run's pending cells shown as queued: every cell the run\n * will fill that the run has not written yet (running, done, failed or\n * skipped cells carry the run's id). */\nexport function withQueuedCells(tab, run) {\n if (!tab || !isRunActive(run) || run.tab_id !== tab.id) return tab;\n const rows = run.rows || (tab.rows || []).map((r) => r.id);\n const cells = { ...(tab.cells || {}) };\n let touched = false;\n for (const rid of rows) {\n for (const col of run.columns || []) {\n const key = `${rid}:${col.id}`;\n const cur = cells[key];\n if (cur && cur.run_id === run.run_id) continue;\n cells[key] = { ...(cur || {}), status: 'queued' };\n touched = true;\n }\n }\n return touched ? { ...tab, cells } : tab;\n}\n\n/** How many of the run's cells have a result so far. */\nexport function runProgress(tab, run) {\n if (!run) return 0;\n let n = 0;\n for (const cell of Object.values(tab?.cells || {})) {\n if (cell && cell.run_id === run.run_id && cell.status !== 'running') n += 1;\n }\n return n;\n}\n","// The run's one line in the tabs bar: what is filling, how far along, Stop;\n// then the outcome until dismissed. Every number is the run's own.\nimport React from 'react';\nimport { isRunActive } from './useSheetRun.js';\n\n// The outcome as counted from the document; a run closed while the document\n// could not be read carries no counts, and says nothing rather than zeros.\nfunction outcome(run) {\n const c = run.counts;\n if (!c) return '';\n const parts = [`${c.done || 0} done`];\n if (c.failed) parts.push(`${c.failed} failed`);\n if (c.skipped) parts.push(`${c.skipped} skipped`);\n return parts.join(', ');\n}\n\nexport function RunStrip({ run, error, filled = 0, onCancel, onDismiss }) {\n if (!run && !error) return null;\n let text = error;\n let tone = 'failed';\n if (run) {\n const names = (run.columns || []).map((c) => c.name).join(', ');\n const total = run.cell_count || 0;\n tone = run.status;\n if (run.status === 'running') {\n text = `Filling ${names}: ${filled} of ${total} cells, ${run.concurrency} rows at a time`;\n } else if (run.status === 'cancelling') {\n text = `Stopping after the cells in flight: ${filled} of ${total} cells`;\n } else if (run.status === 'done') {\n const o = outcome(run);\n text = o ? `Filled ${names}: ${o}` : `Filled ${names}`;\n } else if (run.status === 'cancelled') {\n const c = run.counts;\n const o = outcome(run);\n const notRun = c ? Math.max(0, total - ((c.done || 0) + (c.failed || 0) + (c.skipped || 0))) : null;\n text = o ? `Stopped: ${o}, ${notRun} not run` : 'Stopped';\n } else {\n const o = outcome(run);\n text = run.error ? `The run stopped early: ${run.error}` : 'The run could not start';\n if (o) text += ` (${o})`;\n tone = 'failed';\n }\n }\n const active = isRunActive(run);\n return (\n <div className={`shg-run shg-run-${tone}`} role=\"status\" aria-live=\"polite\">\n <span className=\"shg-run-dot\" aria-hidden=\"true\" />\n <span className=\"shg-run-text\" title={text}>{text}</span>\n {active ? (\n <button type=\"button\" className=\"shg-run-stop\" onClick={onCancel}\n disabled={run.status === 'cancelling'}>Stop</button>\n ) : (\n <button type=\"button\" className=\"shg-run-x\" onClick={onDismiss} aria-label=\"Dismiss\">×</button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,SAAS,aAAa,WAAW,SAAS,gBAAgB;AAO1D,IAAM,mBAAmB,KAAK,KAAK;AAG5B,SAAS,SAAS,KAAK;AAC5B,QAAM,MAAM,CAAC,OAAgB,MAAM,KAAK,CAAC,EAAE,GAAG,OAAO;AACrD,SAAO;AAAA,IACL,SAAS,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,IAAI,YAAY,K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
3
+ "version": "0.13.10",
4
4
  "description": "The open-source rendering & interaction layer for agentic applications. Stream and render any agent's output as polished, application-native UI — model-agnostic, framework-agnostic, design-system-native. The foundation for building generative-UI and agent products.",
5
5
  "keywords": [
6
6
  "react",
@@ -23,6 +23,24 @@ export function GoogleButton({ onCredential, onError, divider = true }) {
23
23
  if (!CLIENT_ID || !ref.current) return undefined;
24
24
  const SRC = 'https://accounts.google.com/gsi/client';
25
25
  let done = false;
26
+ let drawn = 0;
27
+ let observer = null;
28
+ // Google draws its button at the width it is given (200 to 400 px). Give it
29
+ // the width of the box it sits in, the form's, so it lines up with the inputs
30
+ // and the Sign in button; draw it again when that width changes (a dialog
31
+ // that becomes a sheet on a phone).
32
+ const draw = () => {
33
+ const g = window.google;
34
+ if (!g?.accounts?.id || !ref.current) return;
35
+ const box = ref.current.getBoundingClientRect().width || 320;
36
+ const width = Math.round(Math.max(200, Math.min(400, box)));
37
+ if (Math.abs(width - drawn) < 2) return;
38
+ drawn = width;
39
+ ref.current.innerHTML = '';
40
+ g.accounts.id.renderButton(ref.current, {
41
+ theme: 'outline', size: 'large', shape: 'pill', text: 'continue_with', width,
42
+ });
43
+ };
26
44
  const render = () => {
27
45
  if (done) return;
28
46
  const g = window.google;
@@ -36,10 +54,11 @@ export function GoogleButton({ onCredential, onError, divider = true }) {
36
54
  else cb.current.onError?.('Google sign in was cancelled.');
37
55
  },
38
56
  });
39
- ref.current.innerHTML = '';
40
- g.accounts.id.renderButton(ref.current, {
41
- theme: 'outline', size: 'large', shape: 'pill', text: 'continue_with', width: 320,
42
- });
57
+ draw();
58
+ if (typeof ResizeObserver === 'function') {
59
+ observer = new ResizeObserver(() => { try { draw(); } catch { /* keep the last drawing */ } });
60
+ observer.observe(ref.current);
61
+ }
43
62
  } catch {
44
63
  setFailed(true);
45
64
  }
@@ -65,6 +84,7 @@ export function GoogleButton({ onCredential, onError, divider = true }) {
65
84
  return () => {
66
85
  s?.removeEventListener('load', render);
67
86
  window.clearTimeout(check);
87
+ observer?.disconnect();
68
88
  };
69
89
  }, []);
70
90
 
@@ -18,6 +18,8 @@ export interface LiveDoc {
18
18
  synced: boolean;
19
19
  status: string;
20
20
  awareness: unknown;
21
+ /** Live editing was refused for this person (the host's ticket route said 401/403): no retry. */
22
+ stopped?: boolean;
21
23
  [k: string]: unknown;
22
24
  }
23
25
  /** One live-document core: provider lifecycle, sync state, awareness, for any live surface. */
@@ -1,7 +1,10 @@
1
1
  // useLiveDoc — the one provider lifecycle for every live document on the
2
2
  // platform's realtime sidecar: a sheet, a graph canvas, a doc. It takes a
3
- // host-authenticated ticket ({url, doc, token}), connects, re-tickets when the
4
- // token ages out, retries quietly when realtime is unreachable, and exposes
3
+ // host-authenticated ticket ({url, doc, token}), connects, and asks the host
4
+ // for a fresh ticket on EVERY connect (the provider's token): the sidecar closes
5
+ // a connection when its ticket expires, so the person's access is checked again.
6
+ // fetchTicket returns a ticket, null (unreachable: retried quietly), or
7
+ // {refused: true} (the person's access was refused: `stopped`, no retry). It exposes
5
8
  // the document once synced, the awareness states of everyone in it, and one
6
9
  // field for what THIS person publishes (re-applied on every reconnect).
7
10
  // Surfaces build their own shape on top: what to read from the document and
@@ -10,12 +13,16 @@ import { useCallback, useEffect, useRef, useState } from 'react';
10
13
  import { HocuspocusProvider } from '@hocuspocus/provider';
11
14
  import { keepPresenceAlive } from './keepAlive.js';
12
15
 
16
+ const REFUSED = 'refused';
17
+ const DISCONNECT_GRACE_MS = 2_000; // a ticket's planned close re-syncs well inside this
18
+
13
19
  export function useLiveDoc(resourceId, { fetchTicket, field = 'presence' } = {}) {
14
20
  const [doc, setDoc] = useState(null); // the Y.Doc, once synced
15
21
  const [provider, setProvider] = useState(null);
16
22
  const [ready, setReady] = useState(false);
17
23
  const [states, setStates] = useState([]); // [{clientId, ...awareness}]
18
24
  const [selfClientId, setSelfClientId] = useState(null);
25
+ const [stopped, setStopped] = useState(false); // live access refused (removed, signed out): reload
19
26
  const providerRef = useRef(null);
20
27
  const lastRef = useRef(null); // this person's last published value
21
28
 
@@ -24,20 +31,34 @@ export function useLiveDoc(resourceId, { fetchTicket, field = 'presence' } = {})
24
31
  let dead = false;
25
32
  let current = null;
26
33
  let retry = null;
34
+ let grace = null;
27
35
  let stopKeepAlive = () => {};
28
36
 
29
37
  async function connect() {
30
38
  let ticket = null;
31
39
  try { ticket = await fetchTicket(resourceId); } catch { ticket = null; }
32
40
  if (dead) return;
41
+ if (ticket && ticket.refused) { setStopped(true); return; }
33
42
  if (!ticket) { retry = window.setTimeout(connect, 60_000); return; } // realtime unreachable: try later
43
+ let first = ticket.token;
34
44
  current = new HocuspocusProvider({
35
- url: ticket.url, name: ticket.doc, parameters: { cg_token: ticket.token },
36
- onAuthenticationFailed: () => {
37
- // The token aged out (or access was revoked): tear down and re-ticket.
45
+ url: ticket.url, name: ticket.doc,
46
+ token: async () => {
47
+ if (first) { const t = first; first = null; return t; }
48
+ let next = null;
49
+ try { next = await fetchTicket(resourceId); } catch { next = null; }
50
+ if (next && next.refused) throw new Error(REFUSED);
51
+ if (!next || !next.token) throw new Error('unavailable');
52
+ return next.token;
53
+ },
54
+ onAuthenticationFailed: ({ reason } = {}) => {
38
55
  stopKeepAlive();
39
56
  try { current.destroy(); } catch { /* down */ }
40
- if (!dead) retry = window.setTimeout(connect, 5_000);
57
+ if (dead) return;
58
+ window.clearTimeout(grace);
59
+ setReady(false);
60
+ if (String(reason || '').includes(REFUSED)) { setStopped(true); return; }
61
+ retry = window.setTimeout(connect, 5_000); // unavailable for now: a fresh ticket shortly
41
62
  },
42
63
  });
43
64
  stopKeepAlive = keepPresenceAlive(current.awareness);
@@ -47,15 +68,25 @@ export function useLiveDoc(resourceId, { fetchTicket, field = 'presence' } = {})
47
68
  current.on('awarenessUpdate', ({ states: next }) => { if (!dead) setStates(next || []); });
48
69
  current.on('synced', () => {
49
70
  if (dead) return;
71
+ window.clearTimeout(grace);
50
72
  setSelfClientId(current.awareness ? current.awareness.clientID : null);
51
73
  setDoc(current.document);
52
74
  setReady(true);
53
75
  });
54
- current.on('status', ({ status }) => { if (!dead && status === 'disconnected') setReady(false); });
76
+ current.on('status', ({ status }) => {
77
+ if (dead) return;
78
+ if (status === 'connected') window.clearTimeout(grace);
79
+ // a planned close at ticket expiry reconnects at once; only a real outage reads as offline
80
+ if (status === 'disconnected') {
81
+ window.clearTimeout(grace);
82
+ grace = window.setTimeout(() => { if (!dead) setReady(false); }, DISCONNECT_GRACE_MS);
83
+ }
84
+ });
55
85
  }
86
+ setStopped(false);
56
87
  connect();
57
88
  return () => {
58
- dead = true; window.clearTimeout(retry);
89
+ dead = true; window.clearTimeout(retry); window.clearTimeout(grace);
59
90
  stopKeepAlive();
60
91
  if (current) { try { current.destroy(); } catch { /* closing */ } }
61
92
  providerRef.current = null;
@@ -72,5 +103,5 @@ export function useLiveDoc(resourceId, { fetchTicket, field = 'presence' } = {})
72
103
  if (p) { try { p.setAwarenessField(field, value); } catch { /* closing */ } }
73
104
  }, [field]);
74
105
 
75
- return { doc, provider, ready, states, selfClientId, setAwareness };
106
+ return { doc, provider, ready, stopped, states, selfClientId, setAwareness };
76
107
  }
@@ -266,6 +266,7 @@ export function useGraphCollab(graphId, user, { fetchTicket } = {}) {
266
266
 
267
267
  return {
268
268
  ready,
269
+ stopped: live.stopped, // live editing was refused for this person: the host says so
269
270
  liveGraph,
270
271
  peers,
271
272
  copilotBuilding,
@@ -10,6 +10,8 @@ export interface SheetCollab {
10
10
  /** Apply ops to the live document (the only way anyone writes). */
11
11
  ops(ops: SheetOp[]): void;
12
12
  peers: Array<Record<string, unknown>>;
13
+ /** Live editing was refused for this person (removed, signed out): the host says so, with a reload. */
14
+ stopped: boolean;
13
15
  setPresence(presence: Record<string, unknown> | null): void;
14
16
  [k: string]: unknown;
15
17
  }
@@ -35,7 +35,8 @@ export function sheetOps(doc) {
35
35
  };
36
36
  }
37
37
 
38
- /** Returns { ready, sheet, ops, liveRun, copilotBuilding, peers, setPresence }.
38
+ /** Returns { ready, stopped, sheet, ops, liveRun, copilotBuilding, peers, setPresence }.
39
+ * `stopped`: live editing was refused for this person (removed, signed out); the host says so.
39
40
  * fetchTicket(resourceId) -> {url, doc, token} | null (host-authenticated).
40
41
  * me -> {id, name, email} of the current member, for presence.
41
42
  * Presence (awareness): {id, name, tab, sel: {a:[rowId,colId], f:[rowId,colId]}|null,
@@ -98,5 +99,5 @@ export function useSheetCollab(resourceId, { fetchTicket, me } = {}) {
98
99
  sel: (state && state.sel) || null, typing: (state && state.typing) || null, at: Date.now() });
99
100
  }, [live.setAwareness, who.id, who.name, who.email]);
100
101
 
101
- return { ready: live.ready, sheet, ops, liveRun, copilotBuilding, peers, setPresence };
102
+ return { ready: live.ready, stopped: live.stopped, sheet, ops, liveRun, copilotBuilding, peers, setPresence };
102
103
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/collab/keepAlive.js","../src/collab/useLiveDoc.js"],"sourcesContent":["// keepPresenceAlive — renew this client's awareness on a clock the browser\n// does not throttle.\n//\n// Yjs awareness renews a client's own state every 15s on a main-thread timer\n// and every other client drops a state it has not heard from for 30s. A tab\n// in the background gets its timers throttled to once a minute, so its\n// presence expires for everyone else and reappears when the timer finally\n// fires: a flag that flickers every minute on every other screen. Worker\n// clocks are not throttled, so the renewal runs there and the main thread\n// only relays it. One helper for every live document (sheets, canvases,\n// docs).\nconst TICK_MS = 10_000;\n\nexport function keepPresenceAlive(awareness, intervalMs = TICK_MS) {\n if (!awareness || typeof Worker === 'undefined' || typeof Blob === 'undefined') return () => {};\n let url = '';\n let worker = null;\n try {\n url = URL.createObjectURL(new Blob([`setInterval(() => postMessage(0), ${Math.max(1000, intervalMs)});`],\n { type: 'text/javascript' }));\n worker = new Worker(url);\n } catch {\n if (url) URL.revokeObjectURL(url);\n return () => {};\n }\n worker.onmessage = () => {\n const state = awareness.getLocalState();\n if (state !== null && state !== undefined) awareness.setLocalState(state); // same state, new clock\n };\n return () => {\n worker.terminate();\n URL.revokeObjectURL(url);\n };\n}\n","// useLiveDoc — the one provider lifecycle for every live document on the\n// platform's realtime sidecar: a sheet, a graph canvas, a doc. It takes a\n// host-authenticated ticket ({url, doc, token}), connects, re-tickets when the\n// token ages out, retries quietly when realtime is unreachable, and exposes\n// the document once synced, the awareness states of everyone in it, and one\n// field for what THIS person publishes (re-applied on every reconnect).\n// Surfaces build their own shape on top: what to read from the document and\n// what presence means for them.\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { HocuspocusProvider } from '@hocuspocus/provider';\nimport { keepPresenceAlive } from './keepAlive.js';\n\nexport function useLiveDoc(resourceId, { fetchTicket, field = 'presence' } = {}) {\n const [doc, setDoc] = useState(null); // the Y.Doc, once synced\n const [provider, setProvider] = useState(null);\n const [ready, setReady] = useState(false);\n const [states, setStates] = useState([]); // [{clientId, ...awareness}]\n const [selfClientId, setSelfClientId] = useState(null);\n const providerRef = useRef(null);\n const lastRef = useRef(null); // this person's last published value\n\n useEffect(() => {\n if (!resourceId || typeof fetchTicket !== 'function') return undefined;\n let dead = false;\n let current = null;\n let retry = null;\n let stopKeepAlive = () => {};\n\n async function connect() {\n let ticket = null;\n try { ticket = await fetchTicket(resourceId); } catch { ticket = null; }\n if (dead) return;\n if (!ticket) { retry = window.setTimeout(connect, 60_000); return; } // realtime unreachable: try later\n current = new HocuspocusProvider({\n url: ticket.url, name: ticket.doc, parameters: { cg_token: ticket.token },\n onAuthenticationFailed: () => {\n // The token aged out (or access was revoked): tear down and re-ticket.\n stopKeepAlive();\n try { current.destroy(); } catch { /* down */ }\n if (!dead) retry = window.setTimeout(connect, 5_000);\n },\n });\n stopKeepAlive = keepPresenceAlive(current.awareness);\n providerRef.current = current;\n setProvider(current);\n if (lastRef.current) { try { current.setAwarenessField(field, lastRef.current); } catch { /* not yet */ } }\n current.on('awarenessUpdate', ({ states: next }) => { if (!dead) setStates(next || []); });\n current.on('synced', () => {\n if (dead) return;\n setSelfClientId(current.awareness ? current.awareness.clientID : null);\n setDoc(current.document);\n setReady(true);\n });\n current.on('status', ({ status }) => { if (!dead && status === 'disconnected') setReady(false); });\n }\n connect();\n return () => {\n dead = true; window.clearTimeout(retry);\n stopKeepAlive();\n if (current) { try { current.destroy(); } catch { /* closing */ } }\n providerRef.current = null;\n setProvider(null); setDoc(null); setReady(false); setStates([]); setSelfClientId(null);\n };\n // fetchTicket is a host constant; re-subscribing on its identity would reconnect every render.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [resourceId]);\n\n /** Publish what this person is doing; kept and re-applied across reconnects. */\n const setAwareness = useCallback((value) => {\n lastRef.current = value;\n const p = providerRef.current;\n if (p) { try { p.setAwarenessField(field, value); } catch { /* closing */ } }\n }, [field]);\n\n return { doc, provider, ready, states, selfClientId, setAwareness };\n}\n"],"mappings":";AAWA,IAAM,UAAU;AAET,SAAS,kBAAkB,WAAW,aAAa,SAAS;AACjE,MAAI,CAAC,aAAa,OAAO,WAAW,eAAe,OAAO,SAAS,YAAa,QAAO,MAAM;AAAA,EAAC;AAC9F,MAAI,MAAM;AACV,MAAI,SAAS;AACb,MAAI;AACF,UAAM,IAAI,gBAAgB,IAAI;AAAA,MAAK,CAAC,qCAAqC,KAAK,IAAI,KAAM,UAAU,CAAC,IAAI;AAAA,MACnE,EAAE,MAAM,kBAAkB;AAAA,IAAC,CAAC;AAChE,aAAS,IAAI,OAAO,GAAG;AAAA,EACzB,QAAQ;AACN,QAAI,IAAK,KAAI,gBAAgB,GAAG;AAChC,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,SAAO,YAAY,MAAM;AACvB,UAAM,QAAQ,UAAU,cAAc;AACtC,QAAI,UAAU,QAAQ,UAAU,OAAW,WAAU,cAAc,KAAK;AAAA,EAC1E;AACA,SAAO,MAAM;AACX,WAAO,UAAU;AACjB,QAAI,gBAAgB,GAAG;AAAA,EACzB;AACF;;;ACzBA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,0BAA0B;AAG5B,SAAS,WAAW,YAAY,EAAE,aAAa,QAAQ,WAAW,IAA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