@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,407 @@
|
|
|
1
|
+
import type { AgentChild } from "@sixb/client"
|
|
2
|
+
import { type AgentConversationMessage, normalizedTool } from "../conversation"
|
|
3
|
+
import type { AgentMessages } from "../i18n/en"
|
|
4
|
+
import { type NormalizedPart, type NormalizedTool, toolResultValue } from "../parts"
|
|
5
|
+
|
|
6
|
+
// What the parent's own parts say about the sub-agents it delegated to: which it spawned, what it
|
|
7
|
+
// told or answered each, and what each asked. A reader of the thread always has them, even without
|
|
8
|
+
// access to the children themselves, such as in a fork of someone else's conversation.
|
|
9
|
+
|
|
10
|
+
export type { AgentChild }
|
|
11
|
+
|
|
12
|
+
export type AgentChildRun = AgentChild["runs"][number]
|
|
13
|
+
|
|
14
|
+
/** A child as its `spawn_agent` call names it. `id` is the run the call answered with. */
|
|
15
|
+
export interface SpawnedChild {
|
|
16
|
+
/** Its first run's id, or `pending:<key>` while the call is still being made. */
|
|
17
|
+
readonly id: string
|
|
18
|
+
readonly key: string
|
|
19
|
+
readonly task: string
|
|
20
|
+
/** The model the call answered with, once it did. */
|
|
21
|
+
readonly model?: { readonly provider: string; readonly modelId: string }
|
|
22
|
+
/** The tier the Agent asked for, when it asked for one. */
|
|
23
|
+
readonly tier?: string
|
|
24
|
+
readonly pending: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** One line of what passed between the Agent and a child, oldest first. */
|
|
28
|
+
export interface ChildExchange {
|
|
29
|
+
readonly kind: "told" | "asked" | "answered"
|
|
30
|
+
readonly text: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** What `wait_agent` last said about one of a child's runs. */
|
|
34
|
+
export interface WaitedChild {
|
|
35
|
+
readonly status: string
|
|
36
|
+
readonly text?: string
|
|
37
|
+
readonly error?: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Everything the thread's parts say about its sub-agents, by the id of each one's first run. */
|
|
41
|
+
export interface ThreadDelegation {
|
|
42
|
+
/** The turn that spawned each child. */
|
|
43
|
+
readonly spawnedBy: ReadonlyMap<string, string | null>
|
|
44
|
+
readonly exchanges: ReadonlyMap<string, readonly ChildExchange[]>
|
|
45
|
+
/** By the id of the run waited on: a child's first run, or one that continued it. */
|
|
46
|
+
readonly waited: ReadonlyMap<string, WaitedChild>
|
|
47
|
+
/**
|
|
48
|
+
* The child a key named in a turn: the latest spawned under it by then. A call a child made is
|
|
49
|
+
* filed on the turn that ran it, under its key.
|
|
50
|
+
*/
|
|
51
|
+
readonly ownerOf: (key: string, runId?: string) => string | undefined
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** The child a `spawn_agent` call starts, from its input and, once it answered, its output. */
|
|
55
|
+
export function spawnedChild(tool: NormalizedTool): SpawnedChild | null {
|
|
56
|
+
if (tool.toolName !== "spawn_agent" || tool.state === "output-error") return null
|
|
57
|
+
|
|
58
|
+
const input = isRecord(tool.input) ? tool.input : {}
|
|
59
|
+
const key = typeof input.key === "string" ? input.key.trim() : ""
|
|
60
|
+
if (!key) return null
|
|
61
|
+
|
|
62
|
+
const task = typeof input.task === "string" ? input.task.trim() : ""
|
|
63
|
+
const tier = typeof input.model === "string" ? input.model : undefined
|
|
64
|
+
const output = tool.state === "output-available" ? toolResultValue(tool.output) : undefined
|
|
65
|
+
const runId = isRecord(output) && typeof output.runId === "string" ? output.runId : undefined
|
|
66
|
+
const model = isRecord(output) ? modelRef(output.model) : undefined
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
id: runId ?? `pending:${key}`,
|
|
70
|
+
key,
|
|
71
|
+
task,
|
|
72
|
+
...(model ? { model } : {}),
|
|
73
|
+
...(tier ? { tier } : {}),
|
|
74
|
+
pending: runId === undefined,
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** The children a run of work spawned, once each, in the order the Agent spawned them. */
|
|
79
|
+
export function spawnedChildren(parts: readonly NormalizedPart[]): readonly SpawnedChild[] {
|
|
80
|
+
const seen = new Set<string>()
|
|
81
|
+
return parts.flatMap((part) => {
|
|
82
|
+
if (part.kind !== "tool") return []
|
|
83
|
+
const child = spawnedChild(part.tool)
|
|
84
|
+
if (!child || seen.has(child.id) || seen.has(`pending:${child.key}`)) return []
|
|
85
|
+
seen.add(child.id)
|
|
86
|
+
return [child]
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** A turn's delegation calls: the tools that spawn, wait for or message a child. */
|
|
91
|
+
export interface DelegationTurn {
|
|
92
|
+
readonly runId: string | null
|
|
93
|
+
readonly tools: readonly NormalizedTool[]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const DELEGATION_TOOLS = new Set(["spawn_agent", "wait_agent", "message_agent"])
|
|
97
|
+
|
|
98
|
+
/** The delegation calls of each reply, oldest first, the one streaming last. */
|
|
99
|
+
export function delegationTurns(
|
|
100
|
+
messages: readonly AgentConversationMessage[]
|
|
101
|
+
): readonly DelegationTurn[] {
|
|
102
|
+
return messages.flatMap((message) => {
|
|
103
|
+
if (message.role !== "assistant") return []
|
|
104
|
+
const tools = message.parts.flatMap((part) =>
|
|
105
|
+
part.type === "tool" && DELEGATION_TOOLS.has(part.toolName) ? [normalizedTool(part)] : []
|
|
106
|
+
)
|
|
107
|
+
return [{ runId: message.runId, tools }]
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Read the thread's sub-agents from its turns, oldest first, the one streaming now last. Each
|
|
113
|
+
* `message_agent` and question goes to the child its key named at that point.
|
|
114
|
+
*/
|
|
115
|
+
export function readThreadDelegation(turns: readonly DelegationTurn[]): ThreadDelegation {
|
|
116
|
+
const spawnedBy = new Map<string, string | null>()
|
|
117
|
+
const exchanges = new Map<string, ChildExchange[]>()
|
|
118
|
+
const waited = new Map<string, WaitedChild>()
|
|
119
|
+
const owners = new Map<string, string>()
|
|
120
|
+
const ownersByTurn = new Map<string, ReadonlyMap<string, string>>()
|
|
121
|
+
|
|
122
|
+
const add = (key: string, exchange: ChildExchange) => {
|
|
123
|
+
const owner = owners.get(key)
|
|
124
|
+
if (!owner) return
|
|
125
|
+
const list = exchanges.get(owner) ?? []
|
|
126
|
+
// A question is listed by every wait until it is answered: it reads once.
|
|
127
|
+
const repeated = list.some(
|
|
128
|
+
(earlier) => earlier.kind === exchange.kind && earlier.text === exchange.text
|
|
129
|
+
)
|
|
130
|
+
if (exchange.kind === "asked" && repeated) return
|
|
131
|
+
exchanges.set(owner, [...list, exchange])
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const read = (runId: string | null, tool: NormalizedTool) => {
|
|
135
|
+
const child = spawnedChild(tool)
|
|
136
|
+
if (child && !child.pending) {
|
|
137
|
+
spawnedBy.set(child.id, runId)
|
|
138
|
+
owners.set(child.key, child.id)
|
|
139
|
+
return
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (tool.toolName === "message_agent" && tool.state === "output-available") {
|
|
143
|
+
const input = isRecord(tool.input) ? tool.input : {}
|
|
144
|
+
const output = toolResultValue(tool.output)
|
|
145
|
+
if (typeof input.key !== "string" || typeof input.text !== "string") return
|
|
146
|
+
const kind = isRecord(output) && output.delivery === "answer" ? "answered" : "told"
|
|
147
|
+
add(input.key.trim(), { kind, text: input.text.trim() })
|
|
148
|
+
return
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (tool.toolName !== "wait_agent" || tool.state !== "output-available") return
|
|
152
|
+
const output = toolResultValue(tool.output)
|
|
153
|
+
if (!isRecord(output)) return
|
|
154
|
+
|
|
155
|
+
for (const question of Array.isArray(output.questions) ? output.questions : []) {
|
|
156
|
+
if (!isRecord(question)) continue
|
|
157
|
+
if (typeof question.key !== "string" || typeof question.text !== "string") continue
|
|
158
|
+
add(question.key, { kind: "asked", text: question.text.trim() })
|
|
159
|
+
}
|
|
160
|
+
for (const result of Array.isArray(output.results) ? output.results : []) {
|
|
161
|
+
if (!isRecord(result) || typeof result.runId !== "string") continue
|
|
162
|
+
if (typeof result.status !== "string") continue
|
|
163
|
+
waited.set(result.runId, {
|
|
164
|
+
status: result.status,
|
|
165
|
+
...(typeof result.text === "string" ? { text: result.text } : {}),
|
|
166
|
+
...(isRecord(result.error) && typeof result.error.message === "string"
|
|
167
|
+
? { error: result.error.message }
|
|
168
|
+
: {}),
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
for (const turn of turns) {
|
|
174
|
+
for (const tool of turn.tools) read(turn.runId, tool)
|
|
175
|
+
if (turn.runId) ownersByTurn.set(turn.runId, new Map(owners))
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
spawnedBy,
|
|
180
|
+
exchanges,
|
|
181
|
+
waited,
|
|
182
|
+
ownerOf: (key, runId) =>
|
|
183
|
+
(runId ? ownersByTurn.get(runId) : undefined)?.get(key) ?? owners.get(key),
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Where a child stands, as its card says it. */
|
|
188
|
+
export type ChildState =
|
|
189
|
+
| "starting"
|
|
190
|
+
| "working"
|
|
191
|
+
| "asking"
|
|
192
|
+
| "approval"
|
|
193
|
+
| "answer"
|
|
194
|
+
| "resume"
|
|
195
|
+
| "done"
|
|
196
|
+
| "failed"
|
|
197
|
+
| "stopped"
|
|
198
|
+
| "ended"
|
|
199
|
+
| "unknown"
|
|
200
|
+
|
|
201
|
+
/** A child at work, or about to be: its card streams it. */
|
|
202
|
+
export function isActive(state: ChildState): boolean {
|
|
203
|
+
return state === "starting" || state === "working" || state === "asking"
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Where a child stands: from its view when the reader has it, else from the parent's parts. `asking`
|
|
208
|
+
* is a child at work that waits on its question to the Agent.
|
|
209
|
+
*/
|
|
210
|
+
export function childState(input: {
|
|
211
|
+
readonly view?: AgentChild
|
|
212
|
+
readonly spawned?: SpawnedChild
|
|
213
|
+
readonly waited?: WaitedChild
|
|
214
|
+
readonly asking?: boolean
|
|
215
|
+
/** Its turn is streaming now: a child it spawned and nobody listed yet is starting. */
|
|
216
|
+
readonly turnLive?: boolean
|
|
217
|
+
}): ChildState {
|
|
218
|
+
const { view } = input
|
|
219
|
+
if (view) {
|
|
220
|
+
if (view.awaiting?.type === "approval") return "approval"
|
|
221
|
+
if (view.awaiting?.type === "answer") return "answer"
|
|
222
|
+
if (view.awaiting?.type === "resume") return "resume"
|
|
223
|
+
if (view.ended) return "ended"
|
|
224
|
+
if (view.status === "queued") return "starting"
|
|
225
|
+
if (view.status === "running") return input.asking ? "asking" : "working"
|
|
226
|
+
if (view.status === "succeeded") return "done"
|
|
227
|
+
if (view.status === "failed") return "failed"
|
|
228
|
+
return "stopped"
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (input.spawned?.pending) return "starting"
|
|
232
|
+
switch (input.waited?.status) {
|
|
233
|
+
case "succeeded":
|
|
234
|
+
return "done"
|
|
235
|
+
case "failed":
|
|
236
|
+
return "failed"
|
|
237
|
+
case "cancelled":
|
|
238
|
+
return "stopped"
|
|
239
|
+
case "awaiting_approval":
|
|
240
|
+
return "approval"
|
|
241
|
+
case "awaiting_answer":
|
|
242
|
+
return "answer"
|
|
243
|
+
default:
|
|
244
|
+
return input.turnLive ? "starting" : "unknown"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** The run of a child at work, if any is: its thread's active run. */
|
|
249
|
+
export function activeRun(view: AgentChild | undefined): AgentChildRun | undefined {
|
|
250
|
+
return view?.runs.find((run) => run.id === view.activeRunId)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** The time a child spent at work, across its runs, at `now`. Waiting for a decision is not. */
|
|
254
|
+
export function workedMs(view: AgentChild, now: number): number {
|
|
255
|
+
return view.runs.reduce((total, run) => {
|
|
256
|
+
if (!run.startedAt) return total
|
|
257
|
+
const start = Date.parse(run.startedAt)
|
|
258
|
+
const end = run.completedAt ? Date.parse(run.completedAt) : now
|
|
259
|
+
return Number.isNaN(start) || Number.isNaN(end) ? total : total + Math.max(0, end - start)
|
|
260
|
+
}, 0)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* What children spent together, in the currency the first of them was priced in; nothing until a
|
|
265
|
+
* call was priced.
|
|
266
|
+
*/
|
|
267
|
+
export function childrenCost(
|
|
268
|
+
views: readonly (AgentChild | undefined)[],
|
|
269
|
+
locale: string
|
|
270
|
+
): string | null {
|
|
271
|
+
const amounts = views.flatMap((view) => view?.cost?.amounts ?? [])
|
|
272
|
+
const currency = amounts[0]?.currency
|
|
273
|
+
if (!currency) return null
|
|
274
|
+
|
|
275
|
+
const nanos = amounts
|
|
276
|
+
.filter((amount) => amount.currency === currency)
|
|
277
|
+
.reduce((total, amount) => total + BigInt(amount.amountNanos), 0n)
|
|
278
|
+
const value = Number(nanos) / 1_000_000_000
|
|
279
|
+
const format = (figure: number) =>
|
|
280
|
+
new Intl.NumberFormat(locale, {
|
|
281
|
+
style: "currency",
|
|
282
|
+
currency,
|
|
283
|
+
minimumFractionDigits: 2,
|
|
284
|
+
maximumFractionDigits: 2,
|
|
285
|
+
}).format(figure)
|
|
286
|
+
|
|
287
|
+
if (value > 0 && value < 0.01) return `< ${format(0.01)}`
|
|
288
|
+
return format(value)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* A child's name, from the key the Agent spawned it with: "supplier-terms" reads "Supplier terms",
|
|
293
|
+
* "checkINV4490" reads "Check INV4490". The key's own capitals stay.
|
|
294
|
+
*/
|
|
295
|
+
export function childTitle(key: string): string {
|
|
296
|
+
const words = key
|
|
297
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
298
|
+
.replace(/[_-]+/g, " ")
|
|
299
|
+
.replace(/\s+/g, " ")
|
|
300
|
+
.trim()
|
|
301
|
+
return words ? `${words.charAt(0).toUpperCase()}${words.slice(1)}` : key
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/** The question a child at work waits on, from its live parts: its `ask_parent` call in flight. */
|
|
305
|
+
export function liveQuestion(parts: readonly NormalizedPart[]): string | null {
|
|
306
|
+
for (let index = parts.length - 1; index >= 0; index -= 1) {
|
|
307
|
+
const part = parts[index]
|
|
308
|
+
if (part?.kind !== "tool" || part.tool.toolName !== "ask_parent") continue
|
|
309
|
+
if (part.tool.state !== "input-available") return null
|
|
310
|
+
const input = isRecord(part.tool.input) ? part.tool.input : {}
|
|
311
|
+
return typeof input.question === "string" ? input.question.trim() : null
|
|
312
|
+
}
|
|
313
|
+
return null
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** How long, in words: "48s", "1m 12s", "1h 5m". */
|
|
317
|
+
export function formatWorked(ms: number, messages: AgentMessages["delegation"]): string {
|
|
318
|
+
const seconds = Math.max(0, Math.floor(ms / 1000))
|
|
319
|
+
if (seconds < 60) return messages.seconds(seconds)
|
|
320
|
+
const minutes = Math.floor(seconds / 60)
|
|
321
|
+
if (minutes < 60) return messages.minutes(minutes, seconds % 60)
|
|
322
|
+
return messages.hours(Math.floor(minutes / 60), minutes % 60)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** The children a `wait_agent` call waits for, by key when the parts named them. */
|
|
326
|
+
function waitedKeys(tool: NormalizedTool, keys: ReadonlyMap<string, string>): readonly string[] {
|
|
327
|
+
const input = isRecord(tool.input) ? tool.input : {}
|
|
328
|
+
const ids = Array.isArray(input.runIds) ? input.runIds : []
|
|
329
|
+
return ids.flatMap((id) => (typeof id === "string" ? [keys.get(id) ?? ""] : []))
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* What a delegation call reads as in the work, while it is made and once it answered: the Agent's
|
|
334
|
+
* spawns and waits, and a sub-agent's question. `null` for any other tool.
|
|
335
|
+
*/
|
|
336
|
+
export function describeDelegationTool(
|
|
337
|
+
tool: NormalizedTool,
|
|
338
|
+
parts: readonly NormalizedPart[],
|
|
339
|
+
messages: AgentMessages
|
|
340
|
+
): { readonly title: string; readonly running: string } | null {
|
|
341
|
+
const labels = messages.delegation
|
|
342
|
+
if (tool.toolName === "spawn_agent") {
|
|
343
|
+
const input = isRecord(tool.input) ? tool.input : {}
|
|
344
|
+
const key = typeof input.key === "string" ? input.key.trim() : ""
|
|
345
|
+
if (tool.state === "output-error") {
|
|
346
|
+
const failed = labels.spawnFailed(childTitle(key))
|
|
347
|
+
return { title: failed, running: failed }
|
|
348
|
+
}
|
|
349
|
+
if (tool.state === "output-available") {
|
|
350
|
+
return {
|
|
351
|
+
title: labels.delegated(childTitle(key)),
|
|
352
|
+
running: labels.delegatingCount(countSpawns(parts)),
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
title: labels.delegating(childTitle(key)),
|
|
357
|
+
running: labels.delegatingCount(countSpawns(parts)),
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (tool.toolName === "ask_parent") {
|
|
362
|
+
const input = isRecord(tool.input) ? tool.input : {}
|
|
363
|
+
const question = typeof input.question === "string" ? input.question.trim() : ""
|
|
364
|
+
return { title: labels.askedAgent(question), running: labels.states.asking }
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (tool.toolName === "wait_agent") {
|
|
368
|
+
const keys = new Map<string, string>()
|
|
369
|
+
for (const part of parts) {
|
|
370
|
+
if (part.kind !== "tool") continue
|
|
371
|
+
const child = spawnedChild(part.tool)
|
|
372
|
+
if (child && !child.pending) keys.set(child.id, childTitle(child.key))
|
|
373
|
+
}
|
|
374
|
+
const waitedFor = waitedKeys(tool, keys)
|
|
375
|
+
const named = waitedFor.every(Boolean) ? waitedFor : []
|
|
376
|
+
const waiting =
|
|
377
|
+
named.length === 1
|
|
378
|
+
? labels.waitingFor(named[0] ?? "")
|
|
379
|
+
: labels.waitingForCount(waitedFor.length)
|
|
380
|
+
if (tool.state === "output-error")
|
|
381
|
+
return { title: labels.waitFailed, running: labels.waitFailed }
|
|
382
|
+
if (tool.state === "output-available") {
|
|
383
|
+
const heard =
|
|
384
|
+
named.length === 1
|
|
385
|
+
? labels.heardFrom(named[0] ?? "")
|
|
386
|
+
: labels.heardFromCount(waitedFor.length)
|
|
387
|
+
return { title: heard, running: heard }
|
|
388
|
+
}
|
|
389
|
+
return { title: waiting, running: waiting }
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return null
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function countSpawns(parts: readonly NormalizedPart[]): number {
|
|
396
|
+
return parts.filter((part) => part.kind === "tool" && part.tool.toolName === "spawn_agent").length
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function modelRef(value: unknown): SpawnedChild["model"] | undefined {
|
|
400
|
+
return isRecord(value) && typeof value.provider === "string" && typeof value.modelId === "string"
|
|
401
|
+
? { provider: value.provider, modelId: value.modelId }
|
|
402
|
+
: undefined
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
406
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
407
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { AgentApproval, TranscriptApprovals } from "../approvals"
|
|
2
|
+
import type { AgentMessages } from "../i18n/en"
|
|
3
|
+
import type { LiveRunState } from "../live-run"
|
|
4
|
+
import {
|
|
5
|
+
type AgentChild,
|
|
6
|
+
type ChildState,
|
|
7
|
+
childState,
|
|
8
|
+
isActive,
|
|
9
|
+
liveQuestion,
|
|
10
|
+
type SpawnedChild,
|
|
11
|
+
type ThreadDelegation,
|
|
12
|
+
type WaitedChild,
|
|
13
|
+
} from "./interpret"
|
|
14
|
+
|
|
15
|
+
// Where each child of a reply stands for this reader, derived once for its card and its group:
|
|
16
|
+
// from the child's own read (`awaiting`, `ended`) first, the reply's parts only without it.
|
|
17
|
+
|
|
18
|
+
/** Who a call waits on: the reader, someone they can name, or whoever decides. */
|
|
19
|
+
export type WaitingOn =
|
|
20
|
+
| { readonly kind: "you" }
|
|
21
|
+
| { readonly kind: "anyone" }
|
|
22
|
+
| { readonly kind: "person"; readonly name: string }
|
|
23
|
+
|
|
24
|
+
export interface ChildModel {
|
|
25
|
+
readonly child: SpawnedChild
|
|
26
|
+
readonly view?: AgentChild
|
|
27
|
+
/** Its run at work, as its stream shows it. */
|
|
28
|
+
readonly live?: LiveRunState
|
|
29
|
+
readonly state: ChildState
|
|
30
|
+
readonly waited?: WaitedChild
|
|
31
|
+
/** Its calls held under the turn that spawned it: their cards are in its card. */
|
|
32
|
+
readonly approvals: readonly AgentApproval[]
|
|
33
|
+
/** A call it holds under a later turn, which shows its card with that turn. */
|
|
34
|
+
readonly heldLater?: AgentApproval
|
|
35
|
+
/** Who its call waits on. */
|
|
36
|
+
readonly waitingOn: WaitingOn
|
|
37
|
+
/** The reader is the one to act: decide its call, or answer its question. */
|
|
38
|
+
readonly needsReader: boolean
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function childModel(input: {
|
|
42
|
+
readonly child: SpawnedChild
|
|
43
|
+
readonly view?: AgentChild
|
|
44
|
+
readonly live?: LiveRunState
|
|
45
|
+
/** The turn that spawned it. */
|
|
46
|
+
readonly runId: string | null
|
|
47
|
+
readonly turnLive: boolean
|
|
48
|
+
readonly observed: boolean
|
|
49
|
+
readonly delegation: ThreadDelegation
|
|
50
|
+
readonly approvals: TranscriptApprovals | null
|
|
51
|
+
}): ChildModel {
|
|
52
|
+
const { child, view, live, runId, turnLive, observed, delegation, approvals } = input
|
|
53
|
+
const question = live ? liveQuestion(live.parts) : null
|
|
54
|
+
const waited = waitedFor(delegation.waited, child, view)
|
|
55
|
+
const state = childState({ view, spawned: child, waited, asking: question !== null, turnLive })
|
|
56
|
+
|
|
57
|
+
// A call names the run that made it and the turn it is filed on: the spawning turn's sit in the
|
|
58
|
+
// card, a later turn's with that turn, as the transcript places them.
|
|
59
|
+
const runIds = new Set(view?.runs.map((run) => run.id) ?? [child.id])
|
|
60
|
+
const own = (approvals?.approvals ?? []).filter((approval) => runIds.has(approval.callerRunId))
|
|
61
|
+
const here = own.filter((approval) => approval.runId === runId)
|
|
62
|
+
const awaited = new Set(view?.awaiting?.type === "approval" ? view.awaiting.approvalIds : [])
|
|
63
|
+
const waitingFor = own.filter((approval) => awaited.has(approval.id))
|
|
64
|
+
const decides = waitingFor.some((approval) => approvals?.canDecide(approval) ?? false)
|
|
65
|
+
const first = waitingFor[0]
|
|
66
|
+
const heldLater = waitingFor.find((approval) => approval.runId !== runId)
|
|
67
|
+
const waitingOn: WaitingOn = decides
|
|
68
|
+
? { kind: "you" }
|
|
69
|
+
: first && approvals
|
|
70
|
+
? { kind: "person", name: approvals.requesterName(first) }
|
|
71
|
+
: { kind: "anyone" }
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
child,
|
|
75
|
+
...(view ? { view } : {}),
|
|
76
|
+
...(live ? { live } : {}),
|
|
77
|
+
state,
|
|
78
|
+
...(waited ? { waited } : {}),
|
|
79
|
+
approvals: here,
|
|
80
|
+
...(heldLater ? { heldLater } : {}),
|
|
81
|
+
waitingOn,
|
|
82
|
+
needsReader: (state === "approval" && decides) || (state === "answer" && !observed),
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Whether a sub-agent's call shows in its card: held under the turn that spawned it. */
|
|
87
|
+
export function heldInCard(approval: AgentApproval, delegation: ThreadDelegation): boolean {
|
|
88
|
+
if (!approval.caller) return false
|
|
89
|
+
const owner = delegation.ownerOf(approval.caller.key, approval.runId)
|
|
90
|
+
return owner !== undefined && delegation.spawnedBy.get(owner) === approval.runId
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Whether a group's children no longer change on their own: none works, waits or will continue. */
|
|
94
|
+
export function isSettled(state: ChildState): boolean {
|
|
95
|
+
return (
|
|
96
|
+
state === "done" ||
|
|
97
|
+
state === "failed" ||
|
|
98
|
+
state === "stopped" ||
|
|
99
|
+
state === "ended" ||
|
|
100
|
+
state === "unknown"
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** One part of a group's summary: how many stand where, and whether the reader must act. */
|
|
105
|
+
export interface SummaryPart {
|
|
106
|
+
readonly text: string
|
|
107
|
+
readonly urgent: boolean
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** How a group's children stand, in the order a reader cares: what waits on them first. */
|
|
111
|
+
export function groupSummary(
|
|
112
|
+
models: readonly ChildModel[],
|
|
113
|
+
messages: AgentMessages
|
|
114
|
+
): SummaryPart[] {
|
|
115
|
+
const labels = messages.delegation
|
|
116
|
+
const count = (test: (model: ChildModel) => boolean) => models.filter(test).length
|
|
117
|
+
const waiting = (model: ChildModel) =>
|
|
118
|
+
(model.state === "approval" || model.state === "answer") && !model.needsReader
|
|
119
|
+
|
|
120
|
+
const forYou = count((model) => model.needsReader)
|
|
121
|
+
const others = models.filter(waiting)
|
|
122
|
+
const names = new Set(
|
|
123
|
+
others.map((model) => (model.waitingOn.kind === "person" ? model.waitingOn.name : ""))
|
|
124
|
+
)
|
|
125
|
+
const [name] = names
|
|
126
|
+
const working = count((model) => isActive(model.state))
|
|
127
|
+
const later = count((model) => model.state === "resume")
|
|
128
|
+
const done = count((model) => model.state === "done")
|
|
129
|
+
const failed = count((model) => model.state === "failed")
|
|
130
|
+
const stopped = count((model) => model.state === "stopped" || model.state === "ended")
|
|
131
|
+
|
|
132
|
+
return [
|
|
133
|
+
forYou > 0 ? { text: labels.waitingYou(forYou), urgent: true } : null,
|
|
134
|
+
others.length > 0
|
|
135
|
+
? {
|
|
136
|
+
text:
|
|
137
|
+
names.size === 1 && name
|
|
138
|
+
? labels.waitingOn(others.length, name)
|
|
139
|
+
: labels.waitingOthers(others.length),
|
|
140
|
+
urgent: false,
|
|
141
|
+
}
|
|
142
|
+
: null,
|
|
143
|
+
working > 0 ? { text: labels.working(working), urgent: false } : null,
|
|
144
|
+
later > 0 ? { text: labels.later(later), urgent: false } : null,
|
|
145
|
+
done > 0 ? { text: labels.done(done), urgent: false } : null,
|
|
146
|
+
failed > 0 ? { text: labels.failed(failed), urgent: false } : null,
|
|
147
|
+
stopped > 0 ? { text: labels.stopped(stopped), urgent: false } : null,
|
|
148
|
+
].filter((part): part is SummaryPart => part !== null)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** What `wait_agent` last said of any of the child's runs. */
|
|
152
|
+
function waitedFor(
|
|
153
|
+
waited: ReadonlyMap<string, WaitedChild>,
|
|
154
|
+
child: SpawnedChild,
|
|
155
|
+
view: AgentChild | undefined
|
|
156
|
+
): WaitedChild | undefined {
|
|
157
|
+
const ids = view ? view.runs.map((run) => run.id) : [child.id]
|
|
158
|
+
return ids.reduce<WaitedChild | undefined>((last, id) => waited.get(id) ?? last, undefined)
|
|
159
|
+
}
|