@sixb/app 0.1.13 → 0.1.14
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/README.md +6 -0
- package/dist/agent/activity-label.d.ts.map +1 -1
- package/dist/agent/agent-chat.d.ts +1 -1
- package/dist/agent/agent-chat.d.ts.map +1 -1
- package/dist/agent/agent-context-provider.d.ts +1 -0
- package/dist/agent/agent-context-provider.d.ts.map +1 -1
- package/dist/agent/approvals.d.ts +110 -0
- package/dist/agent/approvals.d.ts.map +1 -0
- package/dist/agent/artifact-panel.d.ts +11 -7
- package/dist/agent/artifact-panel.d.ts.map +1 -1
- package/dist/agent/bash/bash-tool-view.d.ts +13 -0
- package/dist/agent/bash/bash-tool-view.d.ts.map +1 -1
- package/dist/agent/bash/interpret.d.ts +46 -2
- package/dist/agent/bash/interpret.d.ts.map +1 -1
- package/dist/agent/bash/model-media-view.d.ts +14 -0
- package/dist/agent/bash/model-media-view.d.ts.map +1 -0
- package/dist/agent/bash/shell.d.ts.map +1 -1
- package/dist/agent/components/agent-message-body.d.ts +21 -0
- package/dist/agent/components/agent-message-body.d.ts.map +1 -0
- package/dist/agent/components/agent-thread-switcher.d.ts +22 -1
- package/dist/agent/components/agent-thread-switcher.d.ts.map +1 -1
- package/dist/agent/components/approval-card.d.ts +17 -0
- package/dist/agent/components/approval-card.d.ts.map +1 -0
- package/dist/agent/components/approval-mode-chip.d.ts +17 -0
- package/dist/agent/components/approval-mode-chip.d.ts.map +1 -0
- package/dist/agent/components/auto-model-chip.d.ts +24 -0
- package/dist/agent/components/auto-model-chip.d.ts.map +1 -0
- package/dist/agent/components/composer.d.ts +21 -2
- package/dist/agent/components/composer.d.ts.map +1 -1
- package/dist/agent/components/context-chips.d.ts +4 -2
- package/dist/agent/components/context-chips.d.ts.map +1 -1
- package/dist/agent/components/conversation-panel.d.ts +13 -55
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/message-parts.d.ts +17 -3
- package/dist/agent/components/message-parts.d.ts.map +1 -1
- package/dist/agent/components/message-view.d.ts +19 -21
- package/dist/agent/components/message-view.d.ts.map +1 -1
- package/dist/agent/components/model-controls.d.ts +8 -2
- package/dist/agent/components/model-controls.d.ts.map +1 -1
- package/dist/agent/components/model-picker-row.d.ts +5 -1
- package/dist/agent/components/model-picker-row.d.ts.map +1 -1
- package/dist/agent/components/participant-input.d.ts +29 -0
- package/dist/agent/components/participant-input.d.ts.map +1 -0
- package/dist/agent/components/provider-logo.d.ts +5 -4
- package/dist/agent/components/provider-logo.d.ts.map +1 -1
- package/dist/agent/components/reasoning-effort-slider.d.ts +8 -7
- package/dist/agent/components/reasoning-effort-slider.d.ts.map +1 -1
- package/dist/agent/components/sandbox-recovery.d.ts +8 -2
- package/dist/agent/components/sandbox-recovery.d.ts.map +1 -1
- package/dist/agent/components/shared-thread-notice.d.ts +10 -0
- package/dist/agent/components/shared-thread-notice.d.ts.map +1 -0
- package/dist/agent/components/thread-artifacts-menu.d.ts +8 -2
- package/dist/agent/components/thread-artifacts-menu.d.ts.map +1 -1
- package/dist/agent/components/thread-people.d.ts +24 -0
- package/dist/agent/components/thread-people.d.ts.map +1 -0
- package/dist/agent/components/transcript.d.ts +22 -29
- package/dist/agent/components/transcript.d.ts.map +1 -1
- package/dist/agent/conversation.d.ts +201 -0
- package/dist/agent/conversation.d.ts.map +1 -0
- package/dist/agent/delegation/child-card.d.ts +19 -0
- package/dist/agent/delegation/child-card.d.ts.map +1 -0
- package/dist/agent/delegation/child-cards.d.ts +9 -0
- package/dist/agent/delegation/child-cards.d.ts.map +1 -0
- package/dist/agent/delegation/child-group.d.ts +14 -0
- package/dist/agent/delegation/child-group.d.ts.map +1 -0
- package/dist/agent/delegation/child-parts.d.ts +50 -0
- package/dist/agent/delegation/child-parts.d.ts.map +1 -0
- package/dist/agent/delegation/child-work.d.ts +31 -0
- package/dist/agent/delegation/child-work.d.ts.map +1 -0
- package/dist/agent/delegation/context.d.ts +22 -0
- package/dist/agent/delegation/context.d.ts.map +1 -0
- package/dist/agent/delegation/interpret.d.ts +104 -0
- package/dist/agent/delegation/interpret.d.ts.map +1 -0
- package/dist/agent/delegation/model.d.ts +52 -0
- package/dist/agent/delegation/model.d.ts.map +1 -0
- package/dist/agent/delegation/use-children.d.ts +1007 -0
- package/dist/agent/delegation/use-children.d.ts.map +1 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts +692 -131
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-sharing.d.ts +35 -0
- package/dist/agent/hooks/use-thread-sharing.d.ts.map +1 -0
- package/dist/agent/i18n/en.d.ts +313 -0
- package/dist/agent/i18n/en.d.ts.map +1 -1
- package/dist/agent/i18n/fr.d.ts.map +1 -1
- package/dist/agent/i18n/index.d.ts +608 -0
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/live-run.d.ts.map +1 -1
- package/dist/agent/memory-paths.d.ts +18 -0
- package/dist/agent/memory-paths.d.ts.map +1 -0
- package/dist/agent/message-agent/interpret.d.ts +21 -0
- package/dist/agent/message-agent/interpret.d.ts.map +1 -0
- package/dist/agent/message-authors.d.ts +56 -0
- package/dist/agent/message-authors.d.ts.map +1 -0
- package/dist/agent/model-selection.d.ts +10 -0
- package/dist/agent/model-selection.d.ts.map +1 -1
- package/dist/agent/observed-conversation.d.ts +26 -0
- package/dist/agent/observed-conversation.d.ts.map +1 -0
- package/dist/agent/observed-thread.d.ts +9 -0
- package/dist/agent/observed-thread.d.ts.map +1 -0
- package/dist/agent/parts.d.ts +5 -0
- package/dist/agent/parts.d.ts.map +1 -1
- package/dist/agent/publish-artifact/use-live-publishes.d.ts +5 -2
- package/dist/agent/publish-artifact/use-live-publishes.d.ts.map +1 -1
- package/dist/agent/read/interpret.d.ts +2 -0
- package/dist/agent/read/interpret.d.ts.map +1 -1
- package/dist/agent/run-presentation.d.ts +11 -0
- package/dist/agent/run-presentation.d.ts.map +1 -1
- package/dist/agent/sharing.d.ts +42 -0
- package/dist/agent/sharing.d.ts.map +1 -0
- package/dist/agent/tool-views/built-in.d.ts +5 -0
- package/dist/agent/tool-views/built-in.d.ts.map +1 -0
- package/dist/agent/tool-views/define.d.ts +79 -0
- package/dist/agent/tool-views/define.d.ts.map +1 -0
- package/dist/agent/tool-views/registry.d.ts +28 -0
- package/dist/agent/tool-views/registry.d.ts.map +1 -0
- package/dist/agent/utils/radio-group.d.ts +11 -0
- package/dist/agent/utils/radio-group.d.ts.map +1 -0
- package/dist/artifacts/card-details.d.ts.map +1 -1
- package/dist/artifacts/card-preview.d.ts.map +1 -1
- package/dist/artifacts/downloads.d.ts +26 -0
- package/dist/artifacts/downloads.d.ts.map +1 -0
- package/dist/artifacts/edit-session.d.ts +36 -0
- package/dist/artifacts/edit-session.d.ts.map +1 -0
- package/dist/artifacts/file-source.d.ts +27 -1
- package/dist/artifacts/file-source.d.ts.map +1 -1
- package/dist/artifacts/file-type-icon.d.ts +14 -0
- package/dist/artifacts/file-type-icon.d.ts.map +1 -0
- package/dist/artifacts/frame-embeds.d.ts +20 -0
- package/dist/artifacts/frame-embeds.d.ts.map +1 -0
- package/dist/artifacts/frame.d.ts +12 -1
- package/dist/artifacts/frame.d.ts.map +1 -1
- package/dist/artifacts/gallery.d.ts.map +1 -1
- package/dist/artifacts/history.d.ts +15 -0
- package/dist/artifacts/history.d.ts.map +1 -0
- package/dist/artifacts/kind-icon.d.ts +7 -0
- package/dist/artifacts/kind-icon.d.ts.map +1 -1
- package/dist/artifacts/messages.d.ts +518 -4
- package/dist/artifacts/messages.d.ts.map +1 -1
- package/dist/artifacts/page-queries.d.ts +22 -0
- package/dist/artifacts/page-queries.d.ts.map +1 -0
- package/dist/artifacts/page-state.d.ts +21 -0
- package/dist/artifacts/page-state.d.ts.map +1 -0
- package/dist/artifacts/people.d.ts +12 -0
- package/dist/artifacts/people.d.ts.map +1 -0
- package/dist/artifacts/person-avatar.d.ts +23 -0
- package/dist/artifacts/person-avatar.d.ts.map +1 -0
- package/dist/artifacts/publish-edit.d.ts +29 -0
- package/dist/artifacts/publish-edit.d.ts.map +1 -0
- package/dist/artifacts/queries.d.ts +77 -1
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/artifacts/references/references.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/arrows.d.ts +21 -0
- package/dist/artifacts/renderers/canvas/arrows.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/board.d.ts +54 -0
- package/dist/artifacts/renderers/canvas/board.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/canvas.d.ts +27 -0
- package/dist/artifacts/renderers/canvas/canvas.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/controls.d.ts +8 -0
- package/dist/artifacts/renderers/canvas/controls.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/draft.d.ts +77 -0
- package/dist/artifacts/renderers/canvas/draft.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/edit-mode.d.ts +55 -0
- package/dist/artifacts/renderers/canvas/edit-mode.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/editing.d.ts +40 -0
- package/dist/artifacts/renderers/canvas/editing.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/focus.d.ts +15 -0
- package/dist/artifacts/renderers/canvas/focus.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/items.d.ts +13 -0
- package/dist/artifacts/renderers/canvas/items.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/layout.d.ts +46 -0
- package/dist/artifacts/renderers/canvas/layout.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/renderer.d.ts +13 -0
- package/dist/artifacts/renderers/canvas/renderer.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/thumbnail.d.ts +10 -0
- package/dist/artifacts/renderers/canvas/thumbnail.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/toolbar.d.ts +15 -0
- package/dist/artifacts/renderers/canvas/toolbar.d.ts.map +1 -0
- package/dist/artifacts/renderers/notice.d.ts.map +1 -1
- package/dist/artifacts/renderers/page.d.ts +34 -0
- package/dist/artifacts/renderers/page.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/cell-editor.d.ts +21 -0
- package/dist/artifacts/renderers/sheet/cell-editor.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/cells.d.ts +93 -0
- package/dist/artifacts/renderers/sheet/cells.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/chart-data.d.ts +27 -7
- package/dist/artifacts/renderers/sheet/chart-data.d.ts.map +1 -1
- package/dist/artifacts/renderers/sheet/chart-icon.d.ts +5 -0
- package/dist/artifacts/renderers/sheet/chart-icon.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/chart-locked.d.ts +9 -0
- package/dist/artifacts/renderers/sheet/chart-locked.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/chart.d.ts +2 -1
- package/dist/artifacts/renderers/sheet/chart.d.ts.map +1 -1
- package/dist/artifacts/renderers/sheet/column-format.d.ts +28 -0
- package/dist/artifacts/renderers/sheet/column-format.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/column-menu.d.ts +51 -0
- package/dist/artifacts/renderers/sheet/column-menu.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/downloads.d.ts +10 -0
- package/dist/artifacts/renderers/sheet/downloads.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/draft.d.ts +131 -0
- package/dist/artifacts/renderers/sheet/draft.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/filter-panel.d.ts +20 -0
- package/dist/artifacts/renderers/sheet/filter-panel.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/filter.d.ts +40 -0
- package/dist/artifacts/renderers/sheet/filter.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/find-bar.d.ts +42 -0
- package/dist/artifacts/renderers/sheet/find-bar.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/find.d.ts +18 -0
- package/dist/artifacts/renderers/sheet/find.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/fit.d.ts +15 -0
- package/dist/artifacts/renderers/sheet/fit.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/format.d.ts +14 -6
- package/dist/artifacts/renderers/sheet/format.d.ts.map +1 -1
- package/dist/artifacts/renderers/sheet/frame.d.ts +69 -0
- package/dist/artifacts/renderers/sheet/frame.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/grid.d.ts +69 -6
- package/dist/artifacts/renderers/sheet/grid.d.ts.map +1 -1
- package/dist/artifacts/renderers/sheet/highlight.d.ts +32 -0
- package/dist/artifacts/renderers/sheet/highlight.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/input.d.ts +30 -0
- package/dist/artifacts/renderers/sheet/input.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/locked.d.ts +17 -0
- package/dist/artifacts/renderers/sheet/locked.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/mini-chart.d.ts.map +1 -1
- package/dist/artifacts/renderers/sheet/model.d.ts +26 -4
- package/dist/artifacts/renderers/sheet/model.d.ts.map +1 -1
- package/dist/artifacts/renderers/sheet/selection.d.ts +30 -6
- package/dist/artifacts/renderers/sheet/selection.d.ts.map +1 -1
- package/dist/artifacts/renderers/sheet/sheet.d.ts +5 -5
- package/dist/artifacts/renderers/sheet/sheet.d.ts.map +1 -1
- package/dist/artifacts/renderers/sheet/totals.d.ts +16 -0
- package/dist/artifacts/renderers/sheet/totals.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/view.d.ts +44 -0
- package/dist/artifacts/renderers/sheet/view.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/workbook.d.ts +23 -3
- package/dist/artifacts/renderers/sheet/workbook.d.ts.map +1 -1
- package/dist/artifacts/renderers/sheet/xlsx.d.ts +18 -0
- package/dist/artifacts/renderers/sheet/xlsx.d.ts.map +1 -0
- package/dist/artifacts/renderers/sheet/zip.d.ts +12 -0
- package/dist/artifacts/renderers/sheet/zip.d.ts.map +1 -0
- package/dist/artifacts/renderers/slides/slides.d.ts.map +1 -1
- package/dist/artifacts/tones.d.ts +4 -0
- package/dist/artifacts/tones.d.ts.map +1 -0
- package/dist/artifacts/viewer.d.ts +2 -0
- package/dist/artifacts/viewer.d.ts.map +1 -1
- package/dist/auth.d.ts +6 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/chunk-0yb22w6m.js +1487 -0
- package/dist/chunk-0yb22w6m.js.map +18 -0
- package/dist/{chunk-c7gy61rx.js → chunk-1rhht9y0.js} +165 -4
- package/dist/chunk-1rhht9y0.js.map +10 -0
- package/dist/{chunk-gn3k23q5.js → chunk-53z5653y.js} +64 -3
- package/dist/chunk-53z5653y.js.map +11 -0
- package/dist/chunk-aes17xmx.js +29190 -0
- package/dist/chunk-aes17xmx.js.map +172 -0
- package/dist/{chunk-g3f4cm8x.js → chunk-k4epnkcr.js} +1 -1
- package/dist/{chunk-ng0hdnrq.js → chunk-sw3pyqgy.js} +3 -1
- package/dist/chunk-sw3pyqgy.js.map +10 -0
- package/dist/{chunk-3schcf10.js → chunk-vtp6nk44.js} +1 -1
- package/dist/codegen.d.ts.map +1 -1
- package/dist/createCustomApp.d.ts +1 -0
- package/dist/createCustomApp.d.ts.map +1 -1
- package/dist/index.d.ts +18 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -7
- package/dist/index.js.map +3 -3
- package/dist/locale-messages.d.ts +1 -0
- package/dist/locale-messages.d.ts.map +1 -1
- package/dist/locale.d.ts +1 -0
- package/dist/locale.d.ts.map +1 -1
- package/dist/locale.js +1 -1
- package/dist/metadata.d.ts.map +1 -1
- package/dist/pages/observability/action-run.d.ts.map +1 -1
- package/dist/pages/observability/activity/messages.d.ts +14 -0
- package/dist/pages/observability/activity/messages.d.ts.map +1 -1
- package/dist/pages/observability/activity/thread.d.ts +6 -0
- package/dist/pages/observability/activity/thread.d.ts.map +1 -0
- package/dist/pages/observability/activity/timeline.d.ts.map +1 -1
- package/dist/pages/observability/ai-usage/calls.d.ts.map +1 -1
- package/dist/pages/observability/ai-usage/format.d.ts +16 -5
- package/dist/pages/observability/ai-usage/format.d.ts.map +1 -1
- package/dist/pages/observability/ai-usage/kinds.d.ts +40 -0
- package/dist/pages/observability/ai-usage/kinds.d.ts.map +1 -0
- package/dist/pages/observability/ai-usage/messages.d.ts +74 -12
- package/dist/pages/observability/ai-usage/messages.d.ts.map +1 -1
- package/dist/pages/observability/ai-usage/page.d.ts.map +1 -1
- package/dist/pages/observability/messages.d.ts +4 -0
- package/dist/pages/observability/messages.d.ts.map +1 -1
- package/dist/pages/ontology/actions.d.ts.map +1 -1
- package/dist/pages/ontology/components/action-button.d.ts +6 -0
- package/dist/pages/ontology/components/action-button.d.ts.map +1 -1
- package/dist/pages/ontology/components/user-picker.d.ts +37 -0
- package/dist/pages/ontology/components/user-picker.d.ts.map +1 -0
- package/dist/pages/ontology/workflows/run-input-form.d.ts.map +1 -1
- package/dist/pages/routes.d.ts +2 -0
- package/dist/pages/routes.d.ts.map +1 -1
- package/dist/pages/section-page.d.ts +13 -0
- package/dist/pages/section-page.d.ts.map +1 -1
- package/dist/pages/section-ui.d.ts.map +1 -1
- package/dist/pages/settings/controls.d.ts.map +1 -1
- package/dist/pages/settings/members.d.ts.map +1 -1
- package/dist/pages/settings/memory-contents.d.ts +30 -0
- package/dist/pages/settings/memory-contents.d.ts.map +1 -0
- package/dist/pages/settings/memory-entries.d.ts +42 -0
- package/dist/pages/settings/memory-entries.d.ts.map +1 -0
- package/dist/pages/settings/memory-files.d.ts +49 -0
- package/dist/pages/settings/memory-files.d.ts.map +1 -0
- package/dist/pages/settings/memory-history.d.ts +8 -0
- package/dist/pages/settings/memory-history.d.ts.map +1 -0
- package/dist/pages/settings/memory.d.ts +21 -0
- package/dist/pages/settings/memory.d.ts.map +1 -0
- package/dist/pages/settings/messages.d.ts +206 -0
- package/dist/pages/settings/messages.d.ts.map +1 -1
- package/dist/pages/settings/personal.d.ts +2 -2
- package/dist/pages/settings/personal.d.ts.map +1 -1
- package/dist/pages/settings/sessions.d.ts.map +1 -1
- package/dist/pages/values.d.ts +1 -0
- package/dist/pages/values.d.ts.map +1 -1
- package/dist/pages.d.ts +13 -16
- package/dist/pages.d.ts.map +1 -1
- package/dist/pages.js +6729 -4370
- package/dist/pages.js.map +32 -26
- package/dist/sections/catalog.d.ts.map +1 -1
- package/dist/sections/sections.d.ts.map +1 -1
- package/dist/server.js +68 -39
- package/dist/server.js.map +5 -5
- package/package.json +4 -4
- package/src/agent/activity-label.ts +17 -2
- package/src/agent/agent-chat.tsx +92 -104
- package/src/agent/agent-context-provider.tsx +1 -0
- package/src/agent/agent.css +82 -0
- package/src/agent/approvals.ts +268 -0
- package/src/agent/artifact-panel.tsx +22 -13
- package/src/agent/bash/bash-tool-view.tsx +98 -6
- package/src/agent/bash/interpret.ts +265 -3
- package/src/agent/bash/model-media-view.tsx +474 -0
- package/src/agent/bash/shell.ts +3 -2
- package/src/agent/components/agent-message-body.tsx +56 -0
- package/src/agent/components/agent-thread-switcher.tsx +216 -43
- package/src/agent/components/approval-card.tsx +840 -0
- package/src/agent/components/approval-mode-chip.tsx +227 -0
- package/src/agent/components/auto-model-chip.tsx +283 -0
- package/src/agent/components/composer.tsx +73 -3
- package/src/agent/components/context-chips.tsx +5 -6
- package/src/agent/components/conversation-panel.tsx +27 -149
- package/src/agent/components/message-parts.tsx +169 -54
- package/src/agent/components/message-view.tsx +114 -167
- package/src/agent/components/model-controls.tsx +29 -3
- package/src/agent/components/model-picker-row.tsx +22 -4
- package/src/agent/components/participant-input.tsx +165 -0
- package/src/agent/components/provider-logo.tsx +6 -1
- package/src/agent/components/reasoning-effort-slider.tsx +10 -8
- package/src/agent/components/sandbox-recovery.tsx +24 -5
- package/src/agent/components/shared-thread-notice.tsx +34 -0
- package/src/agent/components/thread-artifacts-menu.tsx +29 -12
- package/src/agent/components/thread-people.tsx +521 -0
- package/src/agent/components/transcript.tsx +314 -147
- package/src/agent/conversation.ts +634 -0
- package/src/agent/delegation/child-card.tsx +398 -0
- package/src/agent/delegation/child-cards.tsx +144 -0
- package/src/agent/delegation/child-group.tsx +150 -0
- package/src/agent/delegation/child-parts.tsx +321 -0
- package/src/agent/delegation/child-work.tsx +244 -0
- package/src/agent/delegation/context.ts +28 -0
- package/src/agent/delegation/interpret.ts +407 -0
- package/src/agent/delegation/model.ts +159 -0
- package/src/agent/delegation/use-children.ts +235 -0
- package/src/agent/hooks/use-agent-conversation.ts +856 -93
- package/src/agent/hooks/use-thread-sharing.ts +197 -0
- package/src/agent/i18n/en.ts +322 -0
- package/src/agent/i18n/fr.ts +334 -0
- package/src/agent/live-run.ts +23 -40
- package/src/agent/memory-paths.ts +41 -0
- package/src/agent/message-agent/interpret.ts +60 -0
- package/src/agent/message-authors.ts +115 -0
- package/src/agent/model-selection.ts +15 -0
- package/src/agent/observed-conversation.tsx +210 -0
- package/src/agent/observed-thread.ts +13 -0
- package/src/agent/parts.ts +23 -0
- package/src/agent/publish-artifact/use-live-publishes.ts +5 -2
- package/src/agent/read/interpret.ts +18 -0
- package/src/agent/read/read-tool-view.tsx +2 -2
- package/src/agent/run-presentation.ts +37 -1
- package/src/agent/sharing.ts +95 -0
- package/src/agent/tool-views/built-in.tsx +56 -0
- package/src/agent/tool-views/define.ts +150 -0
- package/src/agent/tool-views/registry.tsx +125 -0
- package/src/agent/utils/radio-group.ts +29 -0
- package/src/artifacts/artifacts.css +96 -0
- package/src/artifacts/card-details.ts +9 -1
- package/src/artifacts/card-preview.tsx +23 -12
- package/src/artifacts/downloads.tsx +130 -0
- package/src/artifacts/edit-session.tsx +115 -0
- package/src/artifacts/file-source.ts +94 -4
- package/src/artifacts/file-type-icon.tsx +114 -0
- package/src/artifacts/frame-embeds.tsx +113 -0
- package/src/artifacts/frame.tsx +143 -19
- package/src/artifacts/gallery.tsx +3 -0
- package/src/artifacts/history.ts +42 -0
- package/src/artifacts/kind-icon.tsx +31 -1
- package/src/artifacts/messages.ts +601 -16
- package/src/artifacts/page-queries.ts +80 -0
- package/src/artifacts/page-state.ts +211 -0
- package/src/artifacts/people.ts +19 -0
- package/src/artifacts/person-avatar.tsx +40 -0
- package/src/artifacts/publish-edit.ts +90 -0
- package/src/artifacts/queries.ts +242 -5
- package/src/artifacts/references/references.tsx +219 -18
- package/src/artifacts/renderers/canvas/arrows.tsx +134 -0
- package/src/artifacts/renderers/canvas/board.tsx +108 -0
- package/src/artifacts/renderers/canvas/canvas.tsx +195 -0
- package/src/artifacts/renderers/canvas/controls.tsx +75 -0
- package/src/artifacts/renderers/canvas/draft.ts +322 -0
- package/src/artifacts/renderers/canvas/edit-mode.tsx +301 -0
- package/src/artifacts/renderers/canvas/editing.tsx +187 -0
- package/src/artifacts/renderers/canvas/focus.tsx +128 -0
- package/src/artifacts/renderers/canvas/items.tsx +380 -0
- package/src/artifacts/renderers/canvas/layout.ts +132 -0
- package/src/artifacts/renderers/canvas/renderer.tsx +110 -0
- package/src/artifacts/renderers/canvas/thumbnail.tsx +144 -0
- package/src/artifacts/renderers/canvas/toolbar.tsx +316 -0
- package/src/artifacts/renderers/notice.tsx +3 -1
- package/src/artifacts/renderers/page.tsx +152 -0
- package/src/artifacts/renderers/sheet/cell-editor.tsx +125 -0
- package/src/artifacts/renderers/sheet/cells.tsx +462 -0
- package/src/artifacts/renderers/sheet/chart-data.ts +124 -14
- package/src/artifacts/renderers/sheet/chart-icon.ts +18 -0
- package/src/artifacts/renderers/sheet/chart-locked.tsx +30 -0
- package/src/artifacts/renderers/sheet/chart.tsx +153 -3
- package/src/artifacts/renderers/sheet/column-format.tsx +413 -0
- package/src/artifacts/renderers/sheet/column-menu.tsx +198 -0
- package/src/artifacts/renderers/sheet/downloads.tsx +88 -0
- package/src/artifacts/renderers/sheet/draft.ts +589 -0
- package/src/artifacts/renderers/sheet/filter-panel.tsx +255 -0
- package/src/artifacts/renderers/sheet/filter.ts +182 -0
- package/src/artifacts/renderers/sheet/find-bar.tsx +177 -0
- package/src/artifacts/renderers/sheet/find.ts +50 -0
- package/src/artifacts/renderers/sheet/fit.ts +54 -0
- package/src/artifacts/renderers/sheet/format.ts +48 -7
- package/src/artifacts/renderers/sheet/frame.tsx +531 -0
- package/src/artifacts/renderers/sheet/grid.tsx +1266 -287
- package/src/artifacts/renderers/sheet/highlight.ts +83 -0
- package/src/artifacts/renderers/sheet/input.ts +191 -0
- package/src/artifacts/renderers/sheet/locked.ts +112 -0
- package/src/artifacts/renderers/sheet/mini-chart.tsx +72 -4
- package/src/artifacts/renderers/sheet/model.ts +69 -8
- package/src/artifacts/renderers/sheet/selection.ts +136 -9
- package/src/artifacts/renderers/sheet/sheet.tsx +440 -264
- package/src/artifacts/renderers/sheet/totals.ts +54 -0
- package/src/artifacts/renderers/sheet/view.ts +96 -0
- package/src/artifacts/renderers/sheet/workbook.ts +107 -8
- package/src/artifacts/renderers/sheet/xlsx.ts +516 -0
- package/src/artifacts/renderers/sheet/zip.ts +108 -0
- package/src/artifacts/renderers/slides/slides.tsx +3 -55
- package/src/artifacts/tones.ts +14 -0
- package/src/artifacts/viewer.tsx +915 -96
- package/src/auth.ts +8 -2
- package/src/codegen.ts +29 -12
- package/src/createCustomApp.ts +59 -18
- package/src/index.ts +72 -2
- package/src/locale-messages.ts +2 -0
- package/src/metadata.ts +16 -3
- package/src/pages/observability/action-run.tsx +5 -1
- package/src/pages/observability/activity/messages.ts +16 -0
- package/src/pages/observability/activity/thread.tsx +150 -0
- package/src/pages/observability/activity/timeline.tsx +40 -3
- package/src/pages/observability/ai-usage/calls.tsx +61 -18
- package/src/pages/observability/ai-usage/format.ts +61 -8
- package/src/pages/observability/ai-usage/kinds.tsx +156 -0
- package/src/pages/observability/ai-usage/messages.ts +91 -14
- package/src/pages/observability/ai-usage/page.tsx +157 -48
- package/src/pages/observability/messages.ts +3 -0
- package/src/pages/ontology/actions.tsx +25 -4
- package/src/pages/ontology/components/action-button.tsx +53 -17
- package/src/pages/ontology/components/user-picker.tsx +161 -0
- package/src/pages/ontology/object-type.tsx +6 -0
- package/src/pages/ontology/workflows/run-input-form.tsx +12 -1
- package/src/pages/routes.ts +5 -0
- package/src/pages/section-page.tsx +27 -0
- package/src/pages/section-ui.tsx +3 -2
- package/src/pages/settings/controls.tsx +10 -2
- package/src/pages/settings/members.tsx +1 -5
- package/src/pages/settings/memory-contents.tsx +173 -0
- package/src/pages/settings/memory-entries.ts +112 -0
- package/src/pages/settings/memory-files.ts +195 -0
- package/src/pages/settings/memory-history.tsx +559 -0
- package/src/pages/settings/memory.tsx +993 -0
- package/src/pages/settings/messages.ts +232 -2
- package/src/pages/settings/personal.tsx +247 -27
- package/src/pages/settings/service-accounts.tsx +1 -1
- package/src/pages/settings/sessions.tsx +1 -4
- package/src/pages/values.tsx +65 -10
- package/src/pages.ts +16 -26
- package/src/sections/catalog.ts +18 -1
- package/src/sections/sections.tsx +2 -0
- package/dist/chunk-c7gy61rx.js.map +0 -10
- package/dist/chunk-gn3k23q5.js.map +0 -10
- package/dist/chunk-ng0hdnrq.js.map +0 -10
- package/dist/chunk-xxpdn63v.js +0 -15018
- package/dist/chunk-xxpdn63v.js.map +0 -105
- /package/dist/{chunk-g3f4cm8x.js.map → chunk-k4epnkcr.js.map} +0 -0
- /package/dist/{chunk-3schcf10.js.map → chunk-vtp6nk44.js.map} +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { parseSheetNumber, type SheetHighlight } from "@sixb/core/artifacts"
|
|
2
|
+
import type { SheetModel } from "./model"
|
|
3
|
+
|
|
4
|
+
/** A highlighted column's values from least to greatest, across every row of the sheet. */
|
|
5
|
+
export interface HighlightRange {
|
|
6
|
+
readonly highlight: SheetHighlight
|
|
7
|
+
readonly min: number
|
|
8
|
+
readonly max: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The span each highlighted column's values cover. It is the whole sheet's, as a spreadsheet's
|
|
13
|
+
* conditional format is the column's: a filter or sort leaves every shade where it was.
|
|
14
|
+
*/
|
|
15
|
+
export function highlightRanges(model: SheetModel): ReadonlyMap<number, HighlightRange> {
|
|
16
|
+
const ranges = new Map<number, HighlightRange>()
|
|
17
|
+
model.columns.forEach((column, index) => {
|
|
18
|
+
const highlight = column.format.highlight
|
|
19
|
+
if (!highlight) return
|
|
20
|
+
let min = Number.POSITIVE_INFINITY
|
|
21
|
+
let max = Number.NEGATIVE_INFINITY
|
|
22
|
+
for (const row of model.rows) {
|
|
23
|
+
const number = parseSheetNumber(row[index] ?? "")
|
|
24
|
+
if (number === undefined) continue
|
|
25
|
+
min = Math.min(min, number)
|
|
26
|
+
max = Math.max(max, number)
|
|
27
|
+
}
|
|
28
|
+
if (min <= max) ranges.set(index, { highlight, min, max })
|
|
29
|
+
})
|
|
30
|
+
return ranges
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** How one cell is highlighted: a bar's extent in the cell, or a shade behind it. */
|
|
34
|
+
export type CellHighlight =
|
|
35
|
+
| { readonly kind: "bar"; readonly from: number; readonly to: number; readonly negative: boolean }
|
|
36
|
+
| { readonly kind: "shade"; readonly color: string }
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A value's highlight in its column. A bar runs from zero, or from the column's least value when
|
|
40
|
+
* every value is past zero, so a column of all equal values fills its cells. A scale shades from
|
|
41
|
+
* light at the least value to dark at the greatest, and the middle when all are equal. Diverging
|
|
42
|
+
* shades positive values in the theme's success color and negative ones in its destructive color,
|
|
43
|
+
* deeper the farther from zero. An empty cell or one that is not a number has none.
|
|
44
|
+
*/
|
|
45
|
+
export function cellHighlight(range: HighlightRange, value: string): CellHighlight | undefined {
|
|
46
|
+
const number = parseSheetNumber(value)
|
|
47
|
+
if (number === undefined) return undefined
|
|
48
|
+
const { min, max } = range
|
|
49
|
+
switch (range.highlight) {
|
|
50
|
+
case "bars": {
|
|
51
|
+
const low = Math.min(0, min)
|
|
52
|
+
const high = Math.max(0, max)
|
|
53
|
+
if (high === low) return undefined
|
|
54
|
+
const at = (point: number) => (point - low) / (high - low)
|
|
55
|
+
const zero = at(0)
|
|
56
|
+
const end = at(number)
|
|
57
|
+
return {
|
|
58
|
+
kind: "bar",
|
|
59
|
+
from: Math.min(zero, end),
|
|
60
|
+
to: Math.max(zero, end),
|
|
61
|
+
negative: number < 0,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
case "scale": {
|
|
65
|
+
const share = max === min ? 0.5 : (number - min) / (max - min)
|
|
66
|
+
return { kind: "shade", color: mix("var(--foreground)", 3 + share * 14) }
|
|
67
|
+
}
|
|
68
|
+
case "diverging": {
|
|
69
|
+
const reach = Math.max(Math.abs(min), Math.abs(max))
|
|
70
|
+
if (number === 0 || reach === 0) return undefined
|
|
71
|
+
const share = Math.abs(number) / reach
|
|
72
|
+
return {
|
|
73
|
+
kind: "shade",
|
|
74
|
+
color: mix(number > 0 ? "var(--success)" : "var(--destructive)", 5 + share * 19),
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** A theme color mixed into the cell's background, `percent` of it. */
|
|
81
|
+
function mix(color: string, percent: number): string {
|
|
82
|
+
return `color-mix(in oklab, ${color} ${Math.round(percent)}%, var(--sheet-cell))`
|
|
83
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isArtifactAddress,
|
|
3
|
+
parseSheetDate,
|
|
4
|
+
parseSheetNumber,
|
|
5
|
+
type SheetColumnFormat,
|
|
6
|
+
} from "@sixb/core/artifacts"
|
|
7
|
+
|
|
8
|
+
/** Why what a reader typed can't be a column's value: the column's type, which says what fits. */
|
|
9
|
+
export type CellInputError = "number" | "date" | "link" | "image" | "boolean"
|
|
10
|
+
|
|
11
|
+
/** What a cell stores from what a reader typed, or why it can't. */
|
|
12
|
+
export type CellInput = { readonly value: string } | { readonly error: CellInputError }
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Reads what a reader typed into a cell as the column's type stores it, in the reader's locale:
|
|
16
|
+
* `12%` in a percent column is `0.12`, `$1,200` in a currency column is `1200`, `23/11/2026` is
|
|
17
|
+
* `2026-11-23` where the day comes first. Empty is always a value: the cell is cleared.
|
|
18
|
+
*
|
|
19
|
+
* A pasted value is read as a sheet copies one: a number as it stores it first, then in the
|
|
20
|
+
* locale's form, and a percent without its sign as the fraction, `0.12`, not 12 points.
|
|
21
|
+
*/
|
|
22
|
+
export function parseCellInput(
|
|
23
|
+
text: string,
|
|
24
|
+
format: SheetColumnFormat,
|
|
25
|
+
locale: string,
|
|
26
|
+
options: {
|
|
27
|
+
/** Whether a path is one of the artifact's images. */
|
|
28
|
+
readonly image?: (path: string) => boolean
|
|
29
|
+
/** Read as pasted from a sheet, not typed. */
|
|
30
|
+
readonly pasted?: boolean
|
|
31
|
+
} = {}
|
|
32
|
+
): CellInput {
|
|
33
|
+
const pasted = options.pasted ?? false
|
|
34
|
+
const trimmed = text.trim()
|
|
35
|
+
if (!trimmed) return { value: "" }
|
|
36
|
+
switch (format.type) {
|
|
37
|
+
case "number":
|
|
38
|
+
case "currency": {
|
|
39
|
+
const number =
|
|
40
|
+
(pasted ? parseSheetNumber(trimmed) : undefined) ??
|
|
41
|
+
localeNumber(trimmed, locale, format.type === "currency")
|
|
42
|
+
return number === undefined ? { error: "number" } : { value: String(number) }
|
|
43
|
+
}
|
|
44
|
+
case "percent": {
|
|
45
|
+
// A percent is typed in points, with or without its sign: 12 and 12% are both 0.12. Pasted
|
|
46
|
+
// without its sign, it is the fraction a sheet stores.
|
|
47
|
+
const signed = /%$/.test(trimmed)
|
|
48
|
+
if (pasted && !signed) {
|
|
49
|
+
const number = parseSheetNumber(trimmed) ?? localeNumber(trimmed, locale, false)
|
|
50
|
+
return number === undefined ? { error: "number" } : { value: String(number) }
|
|
51
|
+
}
|
|
52
|
+
const number = localeNumber(trimmed.replace(/\s*%$/, ""), locale, false)
|
|
53
|
+
return number === undefined ? { error: "number" } : { value: String(fraction(number)) }
|
|
54
|
+
}
|
|
55
|
+
case "date": {
|
|
56
|
+
const date = localeDate(trimmed, locale)
|
|
57
|
+
return date === undefined ? { error: "date" } : { value: date }
|
|
58
|
+
}
|
|
59
|
+
case "boolean": {
|
|
60
|
+
const word = trimmed.toLowerCase()
|
|
61
|
+
if (TRUE_WORDS.has(word)) return { value: "true" }
|
|
62
|
+
if (FALSE_WORDS.has(word)) return { value: "false" }
|
|
63
|
+
return { error: "boolean" }
|
|
64
|
+
}
|
|
65
|
+
case "link": {
|
|
66
|
+
if (isArtifactAddress(trimmed) || /^https?:\/\/\S+$/i.test(trimmed)) return { value: trimmed }
|
|
67
|
+
// A bare address, as a reader types one, is a web address.
|
|
68
|
+
return /^[\w-]+(\.[\w-]+)+(\/\S*)?$/.test(trimmed)
|
|
69
|
+
? { value: `https://${trimmed}` }
|
|
70
|
+
: { error: "link" }
|
|
71
|
+
}
|
|
72
|
+
case "image":
|
|
73
|
+
return isArtifactAddress(trimmed) || options.image?.(trimmed)
|
|
74
|
+
? { value: trimmed }
|
|
75
|
+
: { error: "image" }
|
|
76
|
+
case "text":
|
|
77
|
+
case "tag":
|
|
78
|
+
return { value: text }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A stored value as the reader types it back to change it: a number in the locale's digits
|
|
84
|
+
* without grouping, a percent in points with its sign. What doesn't read as its type is shown
|
|
85
|
+
* as stored.
|
|
86
|
+
*/
|
|
87
|
+
export function cellInputText(raw: string, format: SheetColumnFormat, locale: string): string {
|
|
88
|
+
switch (format.type) {
|
|
89
|
+
case "number":
|
|
90
|
+
case "currency":
|
|
91
|
+
case "percent": {
|
|
92
|
+
const number = parseSheetNumber(raw)
|
|
93
|
+
if (number === undefined) return raw
|
|
94
|
+
const plain = new Intl.NumberFormat(locale, {
|
|
95
|
+
useGrouping: false,
|
|
96
|
+
maximumFractionDigits: 15,
|
|
97
|
+
})
|
|
98
|
+
return format.type === "percent" ? `${plain.format(points(number))}%` : plain.format(number)
|
|
99
|
+
}
|
|
100
|
+
default:
|
|
101
|
+
return raw
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const TRUE_WORDS = new Set(["true", "yes", "y", "1", "x", "✓", "✔", "vrai", "oui"])
|
|
106
|
+
const FALSE_WORDS = new Set(["false", "no", "n", "0", "faux", "non"])
|
|
107
|
+
const MULTIPLIERS: Readonly<Record<string, number>> = { k: 1e3, m: 1e6, b: 1e9, bn: 1e9 }
|
|
108
|
+
|
|
109
|
+
/** A percent's points as a fraction, without the float noise of a division: 12.3 → 0.123. */
|
|
110
|
+
function fraction(points: number): number {
|
|
111
|
+
return Number((points / 100).toPrecision(15))
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function points(fraction: number): number {
|
|
115
|
+
return Number((fraction * 100).toPrecision(15))
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* A number as the locale writes it: its grouping and decimal marks, a leading or trailing minus,
|
|
120
|
+
* accounting parentheses, and `k`, `m`, or `b` for thousands, millions, and billions. A currency
|
|
121
|
+
* may carry its symbol or code.
|
|
122
|
+
*/
|
|
123
|
+
function localeNumber(text: string, locale: string, currency: boolean): number | undefined {
|
|
124
|
+
const { group, decimal } = separators(locale)
|
|
125
|
+
let value = text.replace(/[\s ]/g, "")
|
|
126
|
+
if (currency) value = value.replace(/\p{Sc}/gu, "").replace(/^[A-Z]{3}|[A-Z]{3}$/g, "")
|
|
127
|
+
let negative = false
|
|
128
|
+
if (/^\(.*\)$/.test(value)) {
|
|
129
|
+
negative = true
|
|
130
|
+
value = value.slice(1, -1)
|
|
131
|
+
}
|
|
132
|
+
if (/^[-−]/.test(value)) {
|
|
133
|
+
negative = !negative
|
|
134
|
+
value = value.slice(1)
|
|
135
|
+
} else if (/[-−]$/.test(value)) {
|
|
136
|
+
negative = !negative
|
|
137
|
+
value = value.slice(0, -1)
|
|
138
|
+
}
|
|
139
|
+
let multiplier = 1
|
|
140
|
+
const suffix = /(bn|[kmb])$/i.exec(value)
|
|
141
|
+
if (suffix) {
|
|
142
|
+
multiplier = MULTIPLIERS[(suffix[1] as string).toLowerCase()] ?? 1
|
|
143
|
+
value = value.slice(0, -(suffix[1] as string).length)
|
|
144
|
+
}
|
|
145
|
+
// A grouping mark that isn't a space is dropped; the decimal mark becomes a point.
|
|
146
|
+
if (group && !/\s/.test(group)) value = value.split(group).join("")
|
|
147
|
+
if (decimal !== ".") value = value.replace(decimal, ".")
|
|
148
|
+
const number = parseSheetNumber(value)
|
|
149
|
+
if (number === undefined) return undefined
|
|
150
|
+
const signed = negative ? -number : number
|
|
151
|
+
return multiplier === 1 ? signed : Number((signed * multiplier).toPrecision(15))
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function separators(locale: string): { readonly group: string; readonly decimal: string } {
|
|
155
|
+
const parts = new Intl.NumberFormat(locale).formatToParts(12345.6)
|
|
156
|
+
return {
|
|
157
|
+
group: parts.find((part) => part.type === "group")?.value ?? "",
|
|
158
|
+
decimal: parts.find((part) => part.type === "decimal")?.value ?? ".",
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* A date in ISO form or in the locale's order of day, month, and year, with `/`, `.`, or `-`
|
|
164
|
+
* between them and a two-digit year in this century: `YYYY-MM-DD`, or the ISO date and time
|
|
165
|
+
* as typed.
|
|
166
|
+
*/
|
|
167
|
+
function localeDate(text: string, locale: string): string | undefined {
|
|
168
|
+
if (parseSheetDate(text)) return text
|
|
169
|
+
const fields = text.split(/[/.\-\s]+/).filter(Boolean)
|
|
170
|
+
if (fields.length !== 3 || fields.some((field) => !/^\d{1,4}$/.test(field))) return undefined
|
|
171
|
+
const values: Partial<Record<"day" | "month" | "year", number>> = {}
|
|
172
|
+
dateOrder(locale).forEach((part, index) => {
|
|
173
|
+
values[part] = Number(fields[index])
|
|
174
|
+
})
|
|
175
|
+
const { day, month } = values
|
|
176
|
+
let year = values.year
|
|
177
|
+
if (day === undefined || month === undefined || year === undefined) return undefined
|
|
178
|
+
if (year < 100) year += 2000
|
|
179
|
+
const iso = `${String(year).padStart(4, "0")}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}`
|
|
180
|
+
const date = parseSheetDate(iso)
|
|
181
|
+
// A day past the month's end rolls over in a Date: the 31st of April is no date.
|
|
182
|
+
return date && date.getUTCDate() === day && date.getUTCMonth() + 1 === month ? iso : undefined
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function dateOrder(locale: string): readonly ("day" | "month" | "year")[] {
|
|
186
|
+
return new Intl.DateTimeFormat(locale, { year: "numeric", month: "numeric", day: "numeric" })
|
|
187
|
+
.formatToParts(new Date(2026, 10, 23))
|
|
188
|
+
.flatMap((part) =>
|
|
189
|
+
part.type === "day" || part.type === "month" || part.type === "year" ? [part.type] : []
|
|
190
|
+
)
|
|
191
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { formulaReferences, parseFormula } from "@sixb/core/artifacts"
|
|
2
|
+
import type { ArtifactMessages } from "../../messages"
|
|
3
|
+
import { isLocked, lockedColumns, type SheetModel } from "./model"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* What locks a live sheet's values, in the words a reader can act on. A property the reader is not
|
|
7
|
+
* cleared for is a permission they can ask for; a computed column has none of its own, so what
|
|
8
|
+
* locks it is the properties its formula reads, through as many computed columns as it reads.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** Each column's formula references, by column index: none for a column that is not computed. */
|
|
12
|
+
const REFERENCES = new WeakMap<SheetModel, readonly (ColumnReferences | null)[]>()
|
|
13
|
+
|
|
14
|
+
interface ColumnReferences {
|
|
15
|
+
readonly row: readonly number[]
|
|
16
|
+
readonly whole: readonly number[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function references(model: SheetModel): readonly (ColumnReferences | null)[] {
|
|
20
|
+
const cached = REFERENCES.get(model)
|
|
21
|
+
if (cached) return cached
|
|
22
|
+
|
|
23
|
+
const indexOf = new Map(model.columns.map((column, index) => [column.name, index]))
|
|
24
|
+
const indexes = (names: ReadonlySet<string>) =>
|
|
25
|
+
[...names].map((name) => indexOf.get(name)).filter((index) => index !== undefined)
|
|
26
|
+
|
|
27
|
+
const read = model.columns.map((column) => {
|
|
28
|
+
if (!column.format.formula) return null
|
|
29
|
+
const { row, whole } = formulaReferences(parseFormula(column.format.formula))
|
|
30
|
+
return { row: indexes(row), whole: indexes(whole) }
|
|
31
|
+
})
|
|
32
|
+
REFERENCES.set(model, read)
|
|
33
|
+
return read
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The properties that lock a column's values, by name in the sheet's order: the column itself when
|
|
38
|
+
* it shows one, else the locked ones its formula reads. With `row`, only what locks that row's cell:
|
|
39
|
+
* a value of the row, or of a column the formula reads whole.
|
|
40
|
+
*/
|
|
41
|
+
export function lockedBy(model: SheetModel, column: number, row?: number): string[] {
|
|
42
|
+
const read = references(model)
|
|
43
|
+
const anywhere = new Set(
|
|
44
|
+
lockedColumns(model).map((name) => model.columns.findIndex((entry) => entry.name === name))
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
const sources = new Set<number>()
|
|
48
|
+
const seen = new Set<string>()
|
|
49
|
+
const visit = (index: number, at: number | undefined) => {
|
|
50
|
+
const key = `${index}:${at ?? "*"}`
|
|
51
|
+
if (seen.has(key)) return
|
|
52
|
+
seen.add(key)
|
|
53
|
+
|
|
54
|
+
const formula = read[index]
|
|
55
|
+
if (!formula) {
|
|
56
|
+
const locked = at === undefined ? anywhere.has(index) : isLocked(model, at, index)
|
|
57
|
+
if (locked) sources.add(index)
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
for (const each of formula.row) visit(each, at)
|
|
62
|
+
for (const each of formula.whole) visit(each, undefined)
|
|
63
|
+
}
|
|
64
|
+
visit(column, row)
|
|
65
|
+
|
|
66
|
+
return model.columns.flatMap((entry, index) => (sources.has(index) ? [entry.name] : []))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** The properties that lock any of these columns, by name in the sheet's order. */
|
|
70
|
+
export function lockedByAny(model: SheetModel, columns: readonly string[]): string[] {
|
|
71
|
+
const names = new Set(
|
|
72
|
+
columns.flatMap((name) => {
|
|
73
|
+
const index = model.columns.findIndex((entry) => entry.name === name)
|
|
74
|
+
return index < 0 ? [] : lockedBy(model, index)
|
|
75
|
+
})
|
|
76
|
+
)
|
|
77
|
+
return model.columns.flatMap((entry) => (names.has(entry.name) ? [entry.name] : []))
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The properties whose values the reader may not see somewhere in the sheet, never a computed column. */
|
|
81
|
+
export function hiddenProperties(model: SheetModel): string[] {
|
|
82
|
+
return lockedColumns(model).filter(
|
|
83
|
+
(name) => !model.columns.find((entry) => entry.name === name)?.format.formula
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Why a data row's locked cell is locked: the permission it lacks, or what it is computed from. */
|
|
88
|
+
export function lockedCellLabel(
|
|
89
|
+
model: SheetModel,
|
|
90
|
+
row: number,
|
|
91
|
+
column: number,
|
|
92
|
+
messages: ArtifactMessages["sheet"]
|
|
93
|
+
): string {
|
|
94
|
+
const name = model.columns[column]?.name ?? ""
|
|
95
|
+
const sources = lockedBy(model, column, row)
|
|
96
|
+
return model.columns[column]?.format.formula && sources.length > 0
|
|
97
|
+
? messages.lockedComputed(name, sources)
|
|
98
|
+
: messages.locked(name)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Why a column's total is locked: a permission it lacks, or what the column is computed from. */
|
|
102
|
+
export function lockedTotalLabel(
|
|
103
|
+
model: SheetModel,
|
|
104
|
+
column: number,
|
|
105
|
+
messages: ArtifactMessages["sheet"]
|
|
106
|
+
): string {
|
|
107
|
+
const name = model.columns[column]?.name ?? ""
|
|
108
|
+
const sources = lockedBy(model, column)
|
|
109
|
+
return model.columns[column]?.format.formula && sources.length > 0
|
|
110
|
+
? messages.lockedTotalComputed(name, sources)
|
|
111
|
+
: messages.lockedTotal(name)
|
|
112
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { WorkbookChart } from "@sixb/core/artifacts"
|
|
2
2
|
import { useLocale } from "@sixb/ui/lib/i18n"
|
|
3
3
|
import { useMemo } from "react"
|
|
4
|
-
import {
|
|
4
|
+
import { useArtifactMessages } from "../../messages"
|
|
5
|
+
import { chartData, chartLockedColumns } from "./chart-data"
|
|
6
|
+
import { ChartLocked } from "./chart-locked"
|
|
5
7
|
import type { SheetModel } from "./model"
|
|
6
8
|
|
|
7
9
|
// A chart at a glance, as a card previews it: the shape of the data in the theme's chart colors,
|
|
@@ -16,10 +18,17 @@ export function MiniChart({
|
|
|
16
18
|
readonly chart: WorkbookChart
|
|
17
19
|
readonly model: SheetModel
|
|
18
20
|
}) {
|
|
19
|
-
const
|
|
21
|
+
const messages = useArtifactMessages().sheet
|
|
22
|
+
const locked = useMemo(() => chartLockedColumns(chart, model), [chart, model])
|
|
23
|
+
const data = useMemo(
|
|
24
|
+
() => (locked.length > 0 ? null : chartData(chart, model)),
|
|
25
|
+
[locked, chart, model]
|
|
26
|
+
)
|
|
27
|
+
if (locked.length > 0) return <ChartLocked label={messages.chartLocked(locked)} compact />
|
|
20
28
|
if (!data) return null
|
|
21
29
|
const series = data.series.map((entry) => ({
|
|
22
30
|
color: entry.color,
|
|
31
|
+
line: entry.line,
|
|
23
32
|
values: data.rows.map((row) => {
|
|
24
33
|
const value = row[entry.key]
|
|
25
34
|
return typeof value === "number" ? value : null
|
|
@@ -38,8 +47,17 @@ export function MiniChart({
|
|
|
38
47
|
className="block size-full overflow-visible"
|
|
39
48
|
aria-hidden="true"
|
|
40
49
|
>
|
|
41
|
-
{chart.type === "
|
|
42
|
-
<
|
|
50
|
+
{chart.type === "scatter" ? (
|
|
51
|
+
<Points
|
|
52
|
+
xs={data.rows.map((row) => (typeof row.x === "number" ? row.x : null))}
|
|
53
|
+
series={series}
|
|
54
|
+
/>
|
|
55
|
+
) : chart.type === "bar" ? (
|
|
56
|
+
<>
|
|
57
|
+
<Bars series={series.filter((entry) => !entry.line)} stacked={chart.stacked} />
|
|
58
|
+
{/* Lines over the bars, on their own scale as the full chart's right axis is. */}
|
|
59
|
+
<Lines series={series.filter((entry) => entry.line)} area={false} stacked={false} />
|
|
60
|
+
</>
|
|
43
61
|
) : (
|
|
44
62
|
<Lines series={series} area={chart.type === "area"} stacked={chart.stacked} />
|
|
45
63
|
)}
|
|
@@ -52,6 +70,56 @@ interface Series {
|
|
|
52
70
|
readonly values: readonly (number | null)[]
|
|
53
71
|
}
|
|
54
72
|
|
|
73
|
+
/** A scatter's points, each series' values against the shared x values, both fitted to the box. */
|
|
74
|
+
function Points({
|
|
75
|
+
xs,
|
|
76
|
+
series,
|
|
77
|
+
}: {
|
|
78
|
+
readonly xs: readonly (number | null)[]
|
|
79
|
+
readonly series: readonly Series[]
|
|
80
|
+
}) {
|
|
81
|
+
const known = xs.filter((value): value is number => value !== null)
|
|
82
|
+
const ys = series.flatMap((entry) =>
|
|
83
|
+
entry.values.filter((value): value is number => value !== null)
|
|
84
|
+
)
|
|
85
|
+
if (known.length === 0 || ys.length === 0) return null
|
|
86
|
+
const scale = (values: number[], size: number, flip: boolean) => {
|
|
87
|
+
const min = Math.min(...values)
|
|
88
|
+
const span = Math.max(...values) - min || 1
|
|
89
|
+
return (value: number) => {
|
|
90
|
+
const share = 0.08 + ((value - min) / span) * 0.84
|
|
91
|
+
return (flip ? 1 - share : share) * size
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const x = scale(known, WIDTH, false)
|
|
95
|
+
const y = scale(ys, HEIGHT, true)
|
|
96
|
+
return (
|
|
97
|
+
<>
|
|
98
|
+
{series.flatMap((entry, position) =>
|
|
99
|
+
entry.values.map((value, index) => {
|
|
100
|
+
const at = xs[index]
|
|
101
|
+
return value === null || at === null || at === undefined ? null : (
|
|
102
|
+
// A round dot however the card stretches the drawing: a line with no length, its
|
|
103
|
+
// round cap drawn at a fixed width.
|
|
104
|
+
<line
|
|
105
|
+
key={`${position}:${index}`}
|
|
106
|
+
x1={x(at)}
|
|
107
|
+
y1={y(value)}
|
|
108
|
+
x2={x(at)}
|
|
109
|
+
y2={y(value)}
|
|
110
|
+
stroke={entry.color}
|
|
111
|
+
strokeOpacity={0.85}
|
|
112
|
+
strokeWidth={5}
|
|
113
|
+
strokeLinecap="round"
|
|
114
|
+
vectorEffect="non-scaling-stroke"
|
|
115
|
+
/>
|
|
116
|
+
)
|
|
117
|
+
})
|
|
118
|
+
)}
|
|
119
|
+
</>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
55
123
|
function Bars({
|
|
56
124
|
series,
|
|
57
125
|
stacked,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type CsvTable,
|
|
3
|
+
evaluateComputedColumns,
|
|
3
4
|
NUMERIC_COLUMN_TYPES,
|
|
4
5
|
parseSheetNumber,
|
|
5
6
|
type SheetColumnFormat,
|
|
7
|
+
type SheetTotal,
|
|
6
8
|
type WorkbookSheet,
|
|
7
9
|
} from "@sixb/core/artifacts"
|
|
8
10
|
|
|
@@ -14,6 +16,10 @@ export interface SheetColumn {
|
|
|
14
16
|
/** Digits after the decimal point: the format's, else as many as the column's values need. */
|
|
15
17
|
readonly decimals: number
|
|
16
18
|
readonly width: number
|
|
19
|
+
/** What the column means, from the workbook. */
|
|
20
|
+
readonly description?: string
|
|
21
|
+
/** What the totals row shows under it. */
|
|
22
|
+
readonly total?: SheetTotal
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
/** A sheet ready to draw: its columns, and its data rows each as wide as the columns. */
|
|
@@ -24,25 +30,73 @@ export interface SheetModel {
|
|
|
24
30
|
/** Grid rows that stay in view, the header row included. */
|
|
25
31
|
readonly frozenRows: number
|
|
26
32
|
readonly frozenColumns: number
|
|
33
|
+
/** Whether a totals row is pinned under the rows: some column has a total. */
|
|
34
|
+
readonly totals: boolean
|
|
35
|
+
/**
|
|
36
|
+
* A live sheet's cells the reader may not see, by data row, then column: drawn locked, and a
|
|
37
|
+
* total over one is locked too. Their values are empty.
|
|
38
|
+
*/
|
|
39
|
+
readonly locked?: ReadonlyMap<number, ReadonlySet<number>>
|
|
40
|
+
/** A live sheet's rows are the first its query returns: the cap left the others out. */
|
|
41
|
+
readonly truncated?: boolean
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** What a live sheet's rows add to its model: the reader's locked cells, and whether rows were left out. */
|
|
45
|
+
export type LiveRows = Pick<SheetModel, "locked" | "truncated">
|
|
46
|
+
|
|
47
|
+
/** Whether the reader may not see a data row's value in a column. */
|
|
48
|
+
export function isLocked(model: SheetModel, row: number, column: number): boolean {
|
|
49
|
+
return model.locked?.get(row)?.has(column) ?? false
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The names of the columns that hold a value the reader may not see, in the sheet's order. */
|
|
53
|
+
export function lockedColumns(model: SheetModel): string[] {
|
|
54
|
+
if (!model.locked) return []
|
|
55
|
+
|
|
56
|
+
const columns = new Set<number>()
|
|
57
|
+
for (const cells of model.locked.values()) for (const column of cells) columns.add(column)
|
|
58
|
+
return model.columns.flatMap((column, index) => (columns.has(index) ? [column.name] : []))
|
|
27
59
|
}
|
|
28
60
|
|
|
29
61
|
type SheetLayout = Pick<
|
|
30
62
|
WorkbookSheet,
|
|
31
63
|
"name" | "frozenRows" | "frozenColumns" | "columns" | "widths"
|
|
32
|
-
>
|
|
64
|
+
> &
|
|
65
|
+
Partial<Pick<WorkbookSheet, "descriptions" | "totals">>
|
|
33
66
|
|
|
34
|
-
/**
|
|
35
|
-
|
|
67
|
+
/**
|
|
68
|
+
* A sheet of a workbook, laid out as its workbook says, its computed columns filled. Publishing
|
|
69
|
+
* refused formulas that can't compute, so they all do here. A live sheet's rows bring `live`.
|
|
70
|
+
*/
|
|
71
|
+
export function sheetModel(sheet: SheetLayout, source: CsvTable, live: LiveRows = {}): SheetModel {
|
|
72
|
+
const table = evaluateComputedColumns(sheet, source).table
|
|
36
73
|
const columns = table.header.map((name, index) => {
|
|
37
74
|
const format = sheet.columns[name] ?? { type: "text" as const }
|
|
38
|
-
|
|
75
|
+
const description = sheet.descriptions?.[name]
|
|
76
|
+
const total = sheet.totals?.[name]
|
|
77
|
+
return {
|
|
78
|
+
...column(name, format, table.rows, index, sheet.widths[name]),
|
|
79
|
+
...(description ? { description } : {}),
|
|
80
|
+
...(total ? { total } : {}),
|
|
81
|
+
}
|
|
39
82
|
})
|
|
83
|
+
// A formula computes a locked cell over the values the reader sees: it stays empty, as the
|
|
84
|
+
// values it read are, so no download or total shows what it computed without them.
|
|
85
|
+
const rows = table.rows.map((row, index) => {
|
|
86
|
+
const locked = live.locked?.get(index)
|
|
87
|
+
const padded = pad(row, columns.length)
|
|
88
|
+
return locked ? padded.map((value, column) => (locked.has(column) ? "" : value)) : padded
|
|
89
|
+
})
|
|
90
|
+
|
|
40
91
|
return {
|
|
41
92
|
name: sheet.name,
|
|
42
93
|
columns,
|
|
43
|
-
rows
|
|
94
|
+
rows,
|
|
44
95
|
frozenRows: Math.min(sheet.frozenRows, table.rows.length + 1),
|
|
45
96
|
frozenColumns: Math.min(sheet.frozenColumns, columns.length),
|
|
97
|
+
totals: columns.some((entry) => entry.total),
|
|
98
|
+
...(live.locked && live.locked.size > 0 ? { locked: live.locked } : {}),
|
|
99
|
+
...(live.truncated ? { truncated: true } : {}),
|
|
46
100
|
}
|
|
47
101
|
}
|
|
48
102
|
|
|
@@ -67,6 +121,7 @@ export function fileSheetModel(name: string, table: CsvTable): SheetModel {
|
|
|
67
121
|
rows: table.rows.map((row) => pad(row, width)),
|
|
68
122
|
frozenRows: 1,
|
|
69
123
|
frozenColumns: 0,
|
|
124
|
+
totals: false,
|
|
70
125
|
}
|
|
71
126
|
}
|
|
72
127
|
|
|
@@ -116,9 +171,15 @@ function estimatedWidth(
|
|
|
116
171
|
sample: readonly string[],
|
|
117
172
|
format: SheetColumnFormat
|
|
118
173
|
): number {
|
|
119
|
-
// Formatting adds currency signs, grouping, and
|
|
120
|
-
|
|
121
|
-
|
|
174
|
+
// Formatting adds currency signs, grouping, month names, and a tag's chip; compact takes digits
|
|
175
|
+
// away, and a checkbox is narrow.
|
|
176
|
+
const extra = format.compact
|
|
177
|
+
? -2
|
|
178
|
+
: format.type === "currency" || format.type === "tag"
|
|
179
|
+
? 4
|
|
180
|
+
: format.type === "number" || format.type === "date"
|
|
181
|
+
? 2
|
|
182
|
+
: 0
|
|
122
183
|
const longest = Math.max(
|
|
123
184
|
...sample.map((value) => value.length + extra),
|
|
124
185
|
format.type === "image" ? 4 : 0
|