@sixb/app 0.2.4 → 0.2.6
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/assets/connector-icons/README.md +1 -0
- package/assets/connector-icons/ctm.png +0 -0
- package/dist/agent/activity-label.d.ts.map +1 -1
- package/dist/agent/agent-chat.d.ts +3 -1
- package/dist/agent/agent-chat.d.ts.map +1 -1
- package/dist/agent/agent-panel.d.ts.map +1 -1
- package/dist/agent/artifact-panel.d.ts +3 -1
- package/dist/agent/artifact-panel.d.ts.map +1 -1
- package/dist/agent/components/agent-threads.d.ts.map +1 -1
- package/dist/agent/components/composer-place.d.ts.map +1 -1
- package/dist/agent/components/composer-settings.d.ts +1 -1
- package/dist/agent/components/composer-settings.d.ts.map +1 -1
- package/dist/agent/components/composer.d.ts +22 -5
- package/dist/agent/components/composer.d.ts.map +1 -1
- package/dist/agent/components/computer-place.d.ts +24 -6
- package/dist/agent/components/computer-place.d.ts.map +1 -1
- package/dist/agent/components/context-meter.d.ts +1 -1
- package/dist/agent/components/context-meter.d.ts.map +1 -1
- package/dist/agent/components/conversation-panel.d.ts +5 -2
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/message-parts.d.ts +2 -1
- package/dist/agent/components/message-parts.d.ts.map +1 -1
- package/dist/agent/components/message-view.d.ts +13 -3
- package/dist/agent/components/message-view.d.ts.map +1 -1
- package/dist/agent/components/pending-messages.d.ts +20 -0
- package/dist/agent/components/pending-messages.d.ts.map +1 -0
- package/dist/agent/components/sandbox-recovery.d.ts +11 -2
- package/dist/agent/components/sandbox-recovery.d.ts.map +1 -1
- package/dist/agent/components/threads-button.d.ts +1 -1
- package/dist/agent/components/threads-button.d.ts.map +1 -1
- package/dist/agent/components/transcript.d.ts +13 -0
- package/dist/agent/components/transcript.d.ts.map +1 -1
- package/dist/agent/conversation.d.ts +7 -6
- package/dist/agent/conversation.d.ts.map +1 -1
- package/dist/agent/delegation/interpret.d.ts +5 -0
- package/dist/agent/delegation/interpret.d.ts.map +1 -1
- package/dist/agent/delegation/use-children.d.ts.map +1 -1
- package/dist/agent/format.d.ts +7 -0
- package/dist/agent/format.d.ts.map +1 -1
- package/dist/agent/hooks/thread-queries.d.ts +1548 -0
- package/dist/agent/hooks/thread-queries.d.ts.map +1 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts +51 -6
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-lists.d.ts +80 -3
- package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-place.d.ts +49 -0
- package/dist/agent/hooks/use-thread-place.d.ts.map +1 -0
- package/dist/agent/hooks/use-thread-stream.d.ts.map +1 -1
- package/dist/agent/i18n/en.d.ts +107 -6
- 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 +180 -12
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/inbox-handoff.d.ts +10 -0
- package/dist/agent/inbox-handoff.d.ts.map +1 -0
- package/dist/agent/live-run.d.ts +8 -1
- package/dist/agent/live-run.d.ts.map +1 -1
- package/dist/agent/model-selection.d.ts +3 -2
- package/dist/agent/model-selection.d.ts.map +1 -1
- package/dist/agent/moves.d.ts +40 -0
- package/dist/agent/moves.d.ts.map +1 -0
- package/dist/agent/search/interpret.d.ts +101 -0
- package/dist/agent/search/interpret.d.ts.map +1 -0
- package/dist/agent/search/search-tool-view.d.ts +10 -0
- package/dist/agent/search/search-tool-view.d.ts.map +1 -0
- package/dist/agent/thread-reader-state.d.ts +30 -0
- package/dist/agent/thread-reader-state.d.ts.map +1 -0
- package/dist/agent/thread-state.d.ts +26 -0
- package/dist/agent/thread-state.d.ts.map +1 -0
- package/dist/agent/tool-views/built-in.d.ts.map +1 -1
- package/dist/agent/tool-views/registry.d.ts +5 -6
- package/dist/agent/tool-views/registry.d.ts.map +1 -1
- package/dist/agent/types.d.ts +9 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/view-file/view-file-tool-view.d.ts +2 -1
- package/dist/agent/view-file/view-file-tool-view.d.ts.map +1 -1
- package/dist/artifacts/card-preview.d.ts.map +1 -1
- package/dist/artifacts/editor/block-handle.d.ts +20 -0
- package/dist/artifacts/editor/block-handle.d.ts.map +1 -0
- package/dist/artifacts/editor/blocks.d.ts +34 -0
- package/dist/artifacts/editor/blocks.d.ts.map +1 -0
- package/dist/artifacts/editor/callout-view.d.ts +7 -0
- package/dist/artifacts/editor/callout-view.d.ts.map +1 -0
- package/dist/artifacts/editor/document-editor.d.ts +30 -0
- package/dist/artifacts/editor/document-editor.d.ts.map +1 -0
- package/dist/artifacts/editor/figure-view.d.ts +12 -0
- package/dist/artifacts/editor/figure-view.d.ts.map +1 -0
- package/dist/artifacts/editor/find-blocks.d.ts +6 -0
- package/dist/artifacts/editor/find-blocks.d.ts.map +1 -0
- package/dist/artifacts/editor/markdown-document.d.ts +12 -0
- package/dist/artifacts/editor/markdown-document.d.ts.map +1 -0
- package/dist/artifacts/editor/messages.d.ts +4 -0
- package/dist/artifacts/editor/messages.d.ts.map +1 -0
- package/dist/artifacts/editor/schema.d.ts +21 -0
- package/dist/artifacts/editor/schema.d.ts.map +1 -0
- package/dist/artifacts/editor/selection-toolbar.d.ts +35 -0
- package/dist/artifacts/editor/selection-toolbar.d.ts.map +1 -0
- package/dist/artifacts/editor/slash-menu.d.ts +43 -0
- package/dist/artifacts/editor/slash-menu.d.ts.map +1 -0
- package/dist/artifacts/editor/upload.d.ts +12 -0
- package/dist/artifacts/editor/upload.d.ts.map +1 -0
- package/dist/artifacts/file-source.d.ts +5 -0
- package/dist/artifacts/file-source.d.ts.map +1 -1
- package/dist/artifacts/frame-editor/bundle.d.ts +7 -0
- package/dist/artifacts/frame-editor/bundle.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/commands.d.ts +93 -0
- package/dist/artifacts/frame-editor/commands.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/entry.d.ts +2 -0
- package/dist/artifacts/frame-editor/entry.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/frame.d.ts +5 -0
- package/dist/artifacts/frame-editor/frame.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/keys.d.ts +8 -0
- package/dist/artifacts/frame-editor/keys.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/protocol.d.ts +186 -0
- package/dist/artifacts/frame-editor/protocol.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/schema.d.ts +34 -0
- package/dist/artifacts/frame-editor/schema.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/style.d.ts +2 -0
- package/dist/artifacts/frame-editor/style.d.ts.map +1 -0
- package/dist/artifacts/frame.d.ts +2 -2
- package/dist/artifacts/frame.d.ts.map +1 -1
- package/dist/artifacts/live/boards.d.ts +2 -0
- package/dist/artifacts/live/boards.d.ts.map +1 -1
- package/dist/artifacts/live/document.d.ts +32 -0
- package/dist/artifacts/live/document.d.ts.map +1 -0
- package/dist/artifacts/live/header.d.ts +4 -4
- package/dist/artifacts/live/header.d.ts.map +1 -1
- package/dist/artifacts/live/presence.d.ts.map +1 -1
- package/dist/artifacts/live/session.d.ts +2 -0
- package/dist/artifacts/live/session.d.ts.map +1 -1
- package/dist/artifacts/live/view.d.ts +4 -3
- package/dist/artifacts/live/view.d.ts.map +1 -1
- package/dist/artifacts/messages.d.ts +226 -2
- package/dist/artifacts/messages.d.ts.map +1 -1
- package/dist/artifacts/pdf.d.ts +8 -0
- package/dist/artifacts/pdf.d.ts.map +1 -0
- package/dist/artifacts/queries.d.ts +80 -0
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/artifacts/references/references.d.ts +3 -3
- package/dist/artifacts/references/references.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/board-editor.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts +4 -2
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comments-panel.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comments.d.ts +2 -1
- package/dist/artifacts/renderers/canvas/comments.d.ts.map +1 -1
- package/dist/artifacts/renderers/designed-document.d.ts +28 -0
- package/dist/artifacts/renderers/designed-document.d.ts.map +1 -0
- package/dist/artifacts/renderers/document-tree.d.ts +2 -0
- package/dist/artifacts/renderers/document-tree.d.ts.map +1 -1
- package/dist/artifacts/renderers/document.d.ts +9 -1
- package/dist/artifacts/renderers/document.d.ts.map +1 -1
- package/dist/artifacts/renderers/live-frame.d.ts +145 -0
- package/dist/artifacts/renderers/live-frame.d.ts.map +1 -0
- package/dist/artifacts/renderers/page-editor.d.ts +16 -0
- package/dist/artifacts/renderers/page-editor.d.ts.map +1 -0
- package/dist/artifacts/renderers/page.d.ts +10 -1
- package/dist/artifacts/renderers/page.d.ts.map +1 -1
- package/dist/artifacts/viewer.d.ts.map +1 -1
- package/dist/{chunk-pxd07kvx.js → chunk-096d52h2.js} +1 -1
- package/dist/{chunk-yrcm1pbg.js → chunk-94d7enwc.js} +491 -2128
- package/dist/chunk-94d7enwc.js.map +27 -0
- package/dist/{chunk-970s5nkn.js → chunk-ezntd3yy.js} +1 -1
- package/dist/{chunk-kymx9y5e.js → chunk-qjw5r2vk.js} +12729 -5044
- package/dist/chunk-qjw5r2vk.js.map +242 -0
- package/dist/chunk-y51c4tsz.js +11 -0
- package/dist/chunk-y51c4tsz.js.map +10 -0
- package/dist/createCustomApp.d.ts +8 -1
- package/dist/createCustomApp.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +5 -5
- package/dist/pages/console/data/accounts.d.ts +94 -0
- package/dist/pages/console/data/accounts.d.ts.map +1 -0
- package/dist/pages/console/data/connectors.d.ts.map +1 -1
- package/dist/pages/console/data/live-updates.d.ts.map +1 -1
- package/dist/pages/console/data/messages.d.ts +52 -0
- package/dist/pages/console/data/messages.d.ts.map +1 -1
- package/dist/pages/console/data/shared.d.ts.map +1 -1
- package/dist/pages/console/data/sync-button.d.ts.map +1 -1
- package/dist/pages/console/data/syncs.d.ts.map +1 -1
- package/dist/pages/settings/usage/breakdown.d.ts.map +1 -1
- package/dist/pages/settings/usage/page.d.ts +4 -1
- package/dist/pages/settings/usage/page.d.ts.map +1 -1
- package/dist/pages/settings/usage/spend-model.d.ts +43 -19
- package/dist/pages/settings/usage/spend-model.d.ts.map +1 -1
- package/dist/pages.js +23044 -22570
- package/dist/pages.js.map +17 -16
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +40 -3
- package/dist/server.js.map +3 -3
- package/dist/shell/search-command.d.ts.map +1 -1
- package/package.json +22 -5
- package/src/agent/activity-label.ts +3 -0
- package/src/agent/agent-chat.tsx +58 -39
- package/src/agent/agent-execution-trace.tsx +2 -2
- package/src/agent/agent-panel.tsx +6 -4
- package/src/agent/agent.css +254 -0
- package/src/agent/artifact-panel.tsx +77 -22
- package/src/agent/components/agent-threads.tsx +42 -2
- package/src/agent/components/composer-place.tsx +2 -7
- package/src/agent/components/composer-settings.tsx +20 -10
- package/src/agent/components/composer.tsx +342 -104
- package/src/agent/components/computer-place.tsx +415 -70
- package/src/agent/components/context-meter.tsx +7 -3
- package/src/agent/components/conversation-panel.tsx +99 -54
- package/src/agent/components/message-parts.tsx +367 -59
- package/src/agent/components/message-view.tsx +428 -9
- package/src/agent/components/pending-messages.tsx +342 -0
- package/src/agent/components/sandbox-recovery.tsx +36 -17
- package/src/agent/components/threads-button.tsx +3 -2
- package/src/agent/components/transcript.tsx +198 -38
- package/src/agent/conversation.ts +219 -55
- package/src/agent/delegation/interpret.ts +31 -7
- package/src/agent/format.ts +52 -0
- package/src/agent/hooks/thread-queries.ts +75 -0
- package/src/agent/hooks/use-agent-conversation.ts +801 -211
- package/src/agent/hooks/use-thread-lists.ts +72 -7
- package/src/agent/hooks/use-thread-place.ts +239 -0
- package/src/agent/hooks/use-thread-stream.ts +10 -0
- package/src/agent/i18n/en.ts +150 -27
- package/src/agent/i18n/fr.ts +148 -31
- package/src/agent/inbox-handoff.ts +47 -0
- package/src/agent/live-run.ts +61 -2
- package/src/agent/model-selection.ts +3 -2
- package/src/agent/moves.ts +174 -0
- package/src/agent/react-router.tsx +2 -2
- package/src/agent/search/interpret.ts +367 -0
- package/src/agent/search/search-tool-view.tsx +235 -0
- package/src/agent/thread-reader-state.ts +75 -0
- package/src/agent/thread-state.ts +114 -0
- package/src/agent/tool-views/built-in.tsx +16 -0
- package/src/agent/tool-views/registry.tsx +28 -2
- package/src/agent/types.ts +13 -0
- package/src/agent/view-file/view-file-tool-view.tsx +33 -19
- package/src/artifacts/artifacts.css +398 -0
- package/src/artifacts/card-preview.tsx +6 -1
- package/src/artifacts/editor/block-handle.tsx +278 -0
- package/src/artifacts/editor/blocks.ts +216 -0
- package/src/artifacts/editor/callout-view.tsx +31 -0
- package/src/artifacts/editor/document-editor.tsx +484 -0
- package/src/artifacts/editor/figure-view.tsx +66 -0
- package/src/artifacts/editor/find-blocks.ts +19 -0
- package/src/artifacts/editor/markdown-document.tsx +72 -0
- package/src/artifacts/editor/messages.ts +4 -0
- package/src/artifacts/editor/schema.ts +159 -0
- package/src/artifacts/editor/selection-toolbar.tsx +364 -0
- package/src/artifacts/editor/slash-menu.tsx +251 -0
- package/src/artifacts/editor/upload.ts +40 -0
- package/src/artifacts/file-source.ts +11 -0
- package/src/artifacts/frame-editor/bundle.ts +8 -0
- package/src/artifacts/frame-editor/commands.ts +565 -0
- package/src/artifacts/frame-editor/entry.ts +6 -0
- package/src/artifacts/frame-editor/frame.ts +847 -0
- package/src/artifacts/frame-editor/generated/editor.txt +149 -0
- package/src/artifacts/frame-editor/generated.d.ts +5 -0
- package/src/artifacts/frame-editor/keys.ts +323 -0
- package/src/artifacts/frame-editor/protocol.ts +151 -0
- package/src/artifacts/frame-editor/schema.ts +293 -0
- package/src/artifacts/frame-editor/style.ts +58 -0
- package/src/artifacts/frame.tsx +11 -3
- package/src/artifacts/live/boards.ts +46 -3
- package/src/artifacts/live/document.ts +89 -0
- package/src/artifacts/live/header.tsx +9 -14
- package/src/artifacts/live/presence.ts +5 -1
- package/src/artifacts/live/session.ts +9 -2
- package/src/artifacts/live/view.ts +14 -8
- package/src/artifacts/messages.ts +138 -2
- package/src/artifacts/pdf.ts +50 -0
- package/src/artifacts/references/references.tsx +46 -11
- package/src/artifacts/renderers/canvas/board-editor.tsx +11 -144
- package/src/artifacts/renderers/canvas/comment-pins.tsx +5 -0
- package/src/artifacts/renderers/canvas/comments-panel.tsx +58 -1
- package/src/artifacts/renderers/canvas/comments.ts +8 -4
- package/src/artifacts/renderers/designed-document.tsx +277 -0
- package/src/artifacts/renderers/document-tree.ts +9 -0
- package/src/artifacts/renderers/document.tsx +13 -102
- package/src/artifacts/renderers/live-frame.ts +163 -0
- package/src/artifacts/renderers/page-editor.tsx +613 -0
- package/src/artifacts/renderers/page.tsx +21 -4
- package/src/artifacts/viewer.tsx +87 -41
- package/src/createCustomApp.ts +57 -3
- package/src/index.ts +10 -0
- package/src/pages/console/data/accounts.tsx +509 -0
- package/src/pages/console/data/connectors.tsx +7 -15
- package/src/pages/console/data/live-updates.ts +2 -0
- package/src/pages/console/data/messages.ts +79 -0
- package/src/pages/console/data/projections.tsx +4 -0
- package/src/pages/console/data/shared.tsx +1 -0
- package/src/pages/console/data/sync-button.tsx +56 -16
- package/src/pages/console/data/syncs.tsx +66 -41
- package/src/pages/console/ontology/lineage/trail.tsx +3 -0
- package/src/pages/section-ui.tsx +1 -1
- package/src/pages/settings/usage/breakdown.tsx +5 -2
- package/src/pages/settings/usage/filter-menu.tsx +1 -1
- package/src/pages/settings/usage/page.tsx +32 -13
- package/src/pages/settings/usage/spend-chart.tsx +2 -2
- package/src/pages/settings/usage/spend-model.ts +118 -50
- package/src/server.ts +1 -0
- package/src/shell/search-command.tsx +2 -0
- package/dist/chunk-kymx9y5e.js.map +0 -211
- package/dist/chunk-yrcm1pbg.js.map +0 -34
- /package/dist/{chunk-pxd07kvx.js.map → chunk-096d52h2.js.map} +0 -0
- /package/dist/{chunk-970s5nkn.js.map → chunk-ezntd3yy.js.map} +0 -0
|
@@ -479,6 +479,10 @@ function Mapping({ projection }: { readonly projection: Projection }) {
|
|
|
479
479
|
? messages.editsWin
|
|
480
480
|
: messages.mostRecent(conflict.sourceTimestamp),
|
|
481
481
|
},
|
|
482
|
+
{
|
|
483
|
+
label: messages.missing,
|
|
484
|
+
value: projection.missing === "remove" ? messages.missingRemove : messages.missingKeep,
|
|
485
|
+
},
|
|
482
486
|
]}
|
|
483
487
|
/>
|
|
484
488
|
)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GetSyncResponse } from "@sixb/client"
|
|
1
2
|
import {
|
|
2
3
|
getSyncOptions,
|
|
3
4
|
getSyncQueryKey,
|
|
@@ -13,6 +14,9 @@ import { apiErrorMessage, useFormat } from "../../section-ui"
|
|
|
13
14
|
import { useSyncLiveUpdates } from "./live-updates"
|
|
14
15
|
import { useDataMessages } from "./messages"
|
|
15
16
|
|
|
17
|
+
type Sync = GetSyncResponse
|
|
18
|
+
type SyncStatus = { readonly text: string; readonly failed: boolean }
|
|
19
|
+
|
|
16
20
|
export interface SyncButtonProps {
|
|
17
21
|
/** The sync's id, as named in `syncs/`. */
|
|
18
22
|
readonly sync: string
|
|
@@ -44,10 +48,7 @@ export function SyncButton({
|
|
|
44
48
|
...getSyncOptions({ path }),
|
|
45
49
|
retry: false,
|
|
46
50
|
// Live updates refresh it as the run moves; polling covers a dropped event stream.
|
|
47
|
-
refetchInterval: (query) =>
|
|
48
|
-
const status = query.state.data?.latestRun?.status
|
|
49
|
-
return status === "queued" || status === "running" ? 5000 : false
|
|
50
|
-
},
|
|
51
|
+
refetchInterval: (query) => (query.state.data && isSyncing(query.state.data) ? 5000 : false),
|
|
51
52
|
})
|
|
52
53
|
const request = useMutation({
|
|
53
54
|
...requestSyncRunMutation(),
|
|
@@ -56,24 +57,17 @@ export function SyncButton({
|
|
|
56
57
|
queryClient.invalidateQueries({ queryKey: getSyncQueryKey({ path }) }),
|
|
57
58
|
queryClient.invalidateQueries({ queryKey: listSyncsQueryKey() }),
|
|
58
59
|
queryClient.invalidateQueries({ queryKey: listSyncRunsQueryKey() }),
|
|
60
|
+
queryClient.invalidateQueries({ queryKey: [{ _id: "listConnectorAccounts" }] }),
|
|
59
61
|
]),
|
|
60
62
|
})
|
|
61
63
|
|
|
62
|
-
const
|
|
63
|
-
const working =
|
|
64
|
-
request.isPending || latestRun?.status === "queued" || latestRun?.status === "running"
|
|
64
|
+
const working = request.isPending || (syncQuery.data ? isSyncing(syncQuery.data) : false)
|
|
65
65
|
|
|
66
|
-
let status:
|
|
66
|
+
let status: SyncStatus | null = null
|
|
67
67
|
if (request.isError) {
|
|
68
68
|
status = { text: apiErrorMessage(request.error, messages.requestFailed), failed: true }
|
|
69
|
-
} else if (!working && syncQuery.
|
|
70
|
-
|
|
71
|
-
else if (latestRun.status === "failed") status = { text: messages.failed, failed: true }
|
|
72
|
-
else if (latestRun.status === "succeeded")
|
|
73
|
-
status = {
|
|
74
|
-
text: messages.synced(format.relative(latestRun.finishedAt ?? latestRun.queuedAt)),
|
|
75
|
-
failed: false,
|
|
76
|
-
}
|
|
69
|
+
} else if (!working && syncQuery.data) {
|
|
70
|
+
status = syncStatus(syncQuery.data, messages, format)
|
|
77
71
|
}
|
|
78
72
|
|
|
79
73
|
return (
|
|
@@ -101,3 +95,49 @@ export function SyncButton({
|
|
|
101
95
|
</div>
|
|
102
96
|
)
|
|
103
97
|
}
|
|
98
|
+
|
|
99
|
+
/** Whether a run is under way: the latest one, or on a sync of an OAuth connector, any account's. */
|
|
100
|
+
function isSyncing(sync: Sync): boolean {
|
|
101
|
+
if (sync.accounts) return sync.accounts.running > 0
|
|
102
|
+
|
|
103
|
+
const status = sync.latestRun?.status
|
|
104
|
+
return status === "queued" || status === "running"
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* When it last synced, or that it failed. On a sync of an OAuth connector, the accounts you see
|
|
109
|
+
* tell: the latest run is only the account that ran last.
|
|
110
|
+
*/
|
|
111
|
+
function syncStatus(
|
|
112
|
+
sync: Sync,
|
|
113
|
+
messages: ReturnType<typeof useDataMessages>["syncButton"],
|
|
114
|
+
format: ReturnType<typeof useFormat>
|
|
115
|
+
): SyncStatus | null {
|
|
116
|
+
const accounts = sync.accounts
|
|
117
|
+
|
|
118
|
+
if (accounts) {
|
|
119
|
+
if (accounts.needsReconnecting > 0) {
|
|
120
|
+
return { text: messages.accountsNeedReconnecting(accounts.needsReconnecting), failed: true }
|
|
121
|
+
}
|
|
122
|
+
if (accounts.failing > 0) {
|
|
123
|
+
return { text: messages.accountsFailed(accounts.failing), failed: true }
|
|
124
|
+
}
|
|
125
|
+
if (accounts.lastSyncedAt) {
|
|
126
|
+
return { text: messages.synced(format.relative(accounts.lastSyncedAt)), failed: false }
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return { text: accounts.total === 0 ? messages.noAccounts : messages.never, failed: false }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const latestRun = sync.latestRun
|
|
133
|
+
if (!latestRun) return { text: messages.never, failed: false }
|
|
134
|
+
if (latestRun.status === "failed") return { text: messages.failed, failed: true }
|
|
135
|
+
if (latestRun.status === "succeeded") {
|
|
136
|
+
return {
|
|
137
|
+
text: messages.synced(format.relative(latestRun.finishedAt ?? latestRun.queuedAt)),
|
|
138
|
+
failed: false,
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return null
|
|
143
|
+
}
|
|
@@ -25,6 +25,14 @@ import {
|
|
|
25
25
|
useRunStatusLabels,
|
|
26
26
|
} from "../../section-ui"
|
|
27
27
|
import { MetaSkeleton, SkeletonBlock, StatsSkeleton, TrailingSkeleton } from "../skeletons"
|
|
28
|
+
import {
|
|
29
|
+
AccountsMeta,
|
|
30
|
+
needsReconnecting,
|
|
31
|
+
SyncStatusPill,
|
|
32
|
+
SyncTimeMeta,
|
|
33
|
+
useAccountsStats,
|
|
34
|
+
useConnectorAccounts,
|
|
35
|
+
} from "./accounts"
|
|
28
36
|
import { useSyncLiveUpdates } from "./live-updates"
|
|
29
37
|
import { useDataMessages } from "./messages"
|
|
30
38
|
import { SchemaPanel } from "./schema"
|
|
@@ -34,7 +42,6 @@ import { SyncButton } from "./sync-button"
|
|
|
34
42
|
/** Console › Syncs: what copies each connector's data into the project, and how it last went. */
|
|
35
43
|
export function ConsoleSyncsPage() {
|
|
36
44
|
const messages = useDataMessages()
|
|
37
|
-
const format = useFormat()
|
|
38
45
|
useSyncLiveUpdates()
|
|
39
46
|
const syncsQuery = useQuery({ ...listSyncsOptions(), retry: false })
|
|
40
47
|
const syncs = syncsQuery.data ?? []
|
|
@@ -77,23 +84,13 @@ export function ConsoleSyncsPage() {
|
|
|
77
84
|
{sync.triggers.map((trigger) => (
|
|
78
85
|
<ScheduleMeta key={trigger.scheduleId} id={trigger.scheduleId} />
|
|
79
86
|
))}
|
|
80
|
-
{sync
|
|
81
|
-
|
|
82
|
-
<MetaDot />
|
|
83
|
-
<span>
|
|
84
|
-
{format.relative(sync.latestRun.startedAt ?? sync.latestRun.queuedAt)}
|
|
85
|
-
</span>
|
|
86
|
-
</>
|
|
87
|
-
) : null}
|
|
87
|
+
<SyncTimeMeta sync={sync} />
|
|
88
|
+
{sync.accounts ? <AccountsMeta summary={sync.accounts} /> : null}
|
|
88
89
|
</>
|
|
89
90
|
}
|
|
90
91
|
trailing={
|
|
91
92
|
<>
|
|
92
|
-
{sync
|
|
93
|
-
<RunStatusPill status={sync.latestRun.status} />
|
|
94
|
-
) : (
|
|
95
|
-
<Pill tone="muted">{messages.common.neverRun}</Pill>
|
|
96
|
-
)}
|
|
93
|
+
<SyncStatusPill sync={sync} />
|
|
97
94
|
<ChevronRight className="size-4 text-muted-foreground/60" />
|
|
98
95
|
</>
|
|
99
96
|
}
|
|
@@ -124,6 +121,15 @@ export function ConsoleSyncPage() {
|
|
|
124
121
|
: false,
|
|
125
122
|
})
|
|
126
123
|
const sync = syncQuery.data
|
|
124
|
+
const accountsStats = useAccountsStats(sync?.accounts)
|
|
125
|
+
// Runs name their account: the connector's accounts give their labels.
|
|
126
|
+
const accountsQuery = useConnectorAccounts(sync?.connector.id ?? "", sync?.accounts !== undefined)
|
|
127
|
+
const accountLabels = new Map(
|
|
128
|
+
accountsQuery.data?.accounts.map(({ connection }) => [
|
|
129
|
+
connection.id,
|
|
130
|
+
connection.account.label,
|
|
131
|
+
]) ?? []
|
|
132
|
+
)
|
|
127
133
|
const back = { href: "/console/syncs", label: messages.syncs.title }
|
|
128
134
|
|
|
129
135
|
if (!sync) {
|
|
@@ -165,7 +171,8 @@ export function ConsoleSyncPage() {
|
|
|
165
171
|
)
|
|
166
172
|
}
|
|
167
173
|
|
|
168
|
-
|
|
174
|
+
// On a sync of an OAuth connector, the latest run is one account's: the accounts describe it.
|
|
175
|
+
const latestRun = sync.accounts ? null : sync.latestRun
|
|
169
176
|
// A failed latest run gets its own panel; its row leaves the failure out rather than repeat it.
|
|
170
177
|
const failedLatest = latestRun?.status === "failed" && latestRun.error ? latestRun : null
|
|
171
178
|
const dataset = sync.target.dataset
|
|
@@ -180,40 +187,44 @@ export function ConsoleSyncPage() {
|
|
|
180
187
|
title={humanize(sync.id)}
|
|
181
188
|
meta={
|
|
182
189
|
<>
|
|
183
|
-
{
|
|
184
|
-
<RunStatusPill status={latestRun.status} />
|
|
185
|
-
) : (
|
|
186
|
-
<Pill tone="muted">{messages.common.neverRun}</Pill>
|
|
187
|
-
)}
|
|
190
|
+
<SyncStatusPill sync={sync} />
|
|
188
191
|
<span>{messages.common.modes[sync.mode]}</span>
|
|
189
192
|
<MetaDot />
|
|
190
193
|
<Link to={datasetHref} className="hover:text-foreground hover:underline">
|
|
191
194
|
{messages.common.writes(dataset.id)}
|
|
192
195
|
</Link>
|
|
196
|
+
{sync.accounts ? (
|
|
197
|
+
<AccountsMeta
|
|
198
|
+
summary={sync.accounts}
|
|
199
|
+
href={`/console/connectors/${encodeURIComponent(sync.connector.id)}`}
|
|
200
|
+
/>
|
|
201
|
+
) : null}
|
|
193
202
|
</>
|
|
194
203
|
}
|
|
195
204
|
actions={<SyncButton sync={sync.id} variant="default" />}
|
|
196
205
|
>
|
|
197
206
|
<Stats
|
|
198
|
-
items={
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
207
|
+
items={
|
|
208
|
+
accountsStats ?? [
|
|
209
|
+
{
|
|
210
|
+
label: messages.common.lastRun,
|
|
211
|
+
value: latestRun ? (
|
|
212
|
+
statusLabels[latestRun.status]
|
|
213
|
+
) : (
|
|
214
|
+
<span className="text-muted-foreground">{messages.common.neverRun}</span>
|
|
215
|
+
),
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
label: messages.common.started,
|
|
219
|
+
value: latestRun ? format.relative(latestRun.startedAt ?? latestRun.queuedAt) : "—",
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
label: messages.common.took,
|
|
223
|
+
value: formatDuration(latestRun?.startedAt, latestRun?.finishedAt),
|
|
224
|
+
},
|
|
225
|
+
{ label: messages.syncs.rowsRead, value: numbers.count(latestRun?.rowsRead) },
|
|
226
|
+
]
|
|
227
|
+
}
|
|
217
228
|
/>
|
|
218
229
|
|
|
219
230
|
{failedLatest?.error ? (
|
|
@@ -250,6 +261,14 @@ export function ConsoleSyncPage() {
|
|
|
250
261
|
title={format.dateTime(run.startedAt ?? run.queuedAt)}
|
|
251
262
|
meta={
|
|
252
263
|
<>
|
|
264
|
+
{run.connectionId ? (
|
|
265
|
+
<>
|
|
266
|
+
<span className="truncate">
|
|
267
|
+
{accountLabels.get(run.connectionId) ?? run.connectionId}
|
|
268
|
+
</span>
|
|
269
|
+
<MetaDot />
|
|
270
|
+
</>
|
|
271
|
+
) : null}
|
|
253
272
|
<span>{messages.common.modes[run.mode]}</span>
|
|
254
273
|
{run.finishedAt ? (
|
|
255
274
|
<>
|
|
@@ -292,9 +311,15 @@ export function ConsoleSyncPage() {
|
|
|
292
311
|
) : null}
|
|
293
312
|
</>
|
|
294
313
|
}
|
|
295
|
-
trailing={
|
|
314
|
+
trailing={
|
|
315
|
+
needsReconnecting(run) ? (
|
|
316
|
+
<Pill tone="warn">{messages.syncs.needsReconnecting}</Pill>
|
|
317
|
+
) : (
|
|
318
|
+
<RunStatusPill status={run.status} />
|
|
319
|
+
)
|
|
320
|
+
}
|
|
296
321
|
>
|
|
297
|
-
{run.error && run.id !== failedLatest?.id ? (
|
|
322
|
+
{run.error && run.id !== failedLatest?.id && !needsReconnecting(run) ? (
|
|
298
323
|
<FailureSummary failure={run.error} compact />
|
|
299
324
|
) : null}
|
|
300
325
|
</PanelRow>
|
|
@@ -177,6 +177,9 @@ function describeEditor(
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
// A script is known by its file, which is what someone looking at this would search for.
|
|
181
|
+
if (executor?.type === "script") return { title: executor.path, run: null }
|
|
182
|
+
|
|
180
183
|
const title =
|
|
181
184
|
executor?.type === "agent"
|
|
182
185
|
? messages.agent
|
package/src/pages/section-ui.tsx
CHANGED
|
@@ -350,7 +350,7 @@ export function PanelRow({
|
|
|
350
350
|
}
|
|
351
351
|
|
|
352
352
|
return (
|
|
353
|
-
<div className="flex items-center gap-3.5 px-4 py-3.5">
|
|
353
|
+
<div className="group flex items-center gap-3.5 px-4 py-3.5">
|
|
354
354
|
{body}
|
|
355
355
|
{trailing ? <div className="flex shrink-0 items-center gap-2">{trailing}</div> : null}
|
|
356
356
|
</div>
|
|
@@ -83,9 +83,10 @@ export function Breakdown({
|
|
|
83
83
|
...(lens === "model" ? { provider: undefined, model: undefined } : { [lens]: undefined }),
|
|
84
84
|
}
|
|
85
85
|
const active = activeRange(range, filters)
|
|
86
|
+
const earlier = priorRange(active, range)
|
|
86
87
|
const base = useQuery({
|
|
87
88
|
...getAiAccountingOverviewOptions({
|
|
88
|
-
query: { ...active, bucket: range.bucket, ...apiFilters(others) },
|
|
89
|
+
query: { ...active, bucket: range.bucket, timeZone: range.timeZone, ...apiFilters(others) },
|
|
89
90
|
}),
|
|
90
91
|
retry: false,
|
|
91
92
|
})
|
|
@@ -102,6 +103,7 @@ export function Breakdown({
|
|
|
102
103
|
from: range.from,
|
|
103
104
|
to: range.to,
|
|
104
105
|
bucket: range.bucket,
|
|
106
|
+
timeZone: range.timeZone,
|
|
105
107
|
...apiFilters({ ...others, ...row.narrow, day: undefined }),
|
|
106
108
|
},
|
|
107
109
|
}),
|
|
@@ -112,8 +114,9 @@ export function Breakdown({
|
|
|
112
114
|
queries: shown.map((row) => ({
|
|
113
115
|
...getAiAccountingOverviewOptions({
|
|
114
116
|
query: {
|
|
115
|
-
...
|
|
117
|
+
...earlier,
|
|
116
118
|
bucket: range.bucket,
|
|
119
|
+
timeZone: range.timeZone,
|
|
117
120
|
...apiFilters({ ...others, ...row.narrow }),
|
|
118
121
|
},
|
|
119
122
|
}),
|
|
@@ -54,7 +54,7 @@ export function useFilterLabels(overview: Overview | undefined, range: SpendRang
|
|
|
54
54
|
value(key: FilterKey, value: string, filters: SpendFilters): string {
|
|
55
55
|
switch (key) {
|
|
56
56
|
case "day":
|
|
57
|
-
return bucketLabel(value, range.bucket, locale)
|
|
57
|
+
return bucketLabel(value, range.bucket, locale, range.timeZone)
|
|
58
58
|
case "model":
|
|
59
59
|
return value
|
|
60
60
|
case "provider":
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
modelPalette,
|
|
32
32
|
money,
|
|
33
33
|
percent,
|
|
34
|
+
periodKey,
|
|
34
35
|
priorRange,
|
|
35
36
|
rangeLabel,
|
|
36
37
|
readFilters,
|
|
@@ -40,6 +41,7 @@ import {
|
|
|
40
41
|
spendRanges,
|
|
41
42
|
splitMoney,
|
|
42
43
|
unpricedCalls,
|
|
44
|
+
viewerTimeZone,
|
|
43
45
|
} from "./spend-model"
|
|
44
46
|
|
|
45
47
|
type UsageTab = "spend" | "limits"
|
|
@@ -48,23 +50,30 @@ type UsageTab = "spend" | "limits"
|
|
|
48
50
|
* Settings › Usage: what models were called, what it cost and who asked, narrowed by the filters
|
|
49
51
|
* any number on the page sets, down to how one call was priced. Limits sit on their own tab.
|
|
50
52
|
*/
|
|
51
|
-
export function SettingsUsagePage(
|
|
53
|
+
export function SettingsUsagePage({
|
|
54
|
+
timeZone = viewerTimeZone(),
|
|
55
|
+
}: {
|
|
56
|
+
/** The zone the page's days follow; the reader's own unless a caller pins one. */
|
|
57
|
+
readonly timeZone?: string
|
|
58
|
+
} = {}) {
|
|
52
59
|
const messages = useAiUsageMessages()
|
|
53
60
|
const locale = useLocale()
|
|
54
61
|
const [params, setParams] = useSearchParams()
|
|
55
62
|
const tab: UsageTab = params.get("tab") === "limits" ? "limits" : "spend"
|
|
56
63
|
const rangeId = params.get("range")
|
|
57
64
|
// The range ends with the current period; choosing a range again moves it to now.
|
|
58
|
-
const range = useMemo(() => spendRange(rangeId), [rangeId])
|
|
59
|
-
const filters = useMemo(() => readFilters(params), [params])
|
|
65
|
+
const range = useMemo(() => spendRange(rangeId, timeZone), [rangeId, timeZone])
|
|
66
|
+
const filters = useMemo(() => readFilters(params, range), [params, range])
|
|
60
67
|
|
|
61
68
|
const update = (change: (next: URLSearchParams) => void) => {
|
|
62
69
|
const next = new URLSearchParams(params)
|
|
63
70
|
change(next)
|
|
64
71
|
setParams(next, { replace: true })
|
|
65
72
|
}
|
|
66
|
-
const setFilter = (key: FilterKey,
|
|
73
|
+
const setFilter = (key: FilterKey, filter: string | undefined) =>
|
|
67
74
|
update((next) => {
|
|
75
|
+
// A picked bar is spelled as its date, so the link opens the same day in another zone.
|
|
76
|
+
const value = key === "day" && filter !== undefined ? periodKey(filter, range) : filter
|
|
68
77
|
if (value === undefined || next.get(key) === value) next.delete(key)
|
|
69
78
|
else next.set(key, value)
|
|
70
79
|
// A model belongs to its provider; the two are one filter.
|
|
@@ -94,7 +103,7 @@ export function SettingsUsagePage() {
|
|
|
94
103
|
page="usage"
|
|
95
104
|
width="wide"
|
|
96
105
|
title={messages.title}
|
|
97
|
-
description={messages.subtitle(rangeLabel(range, locale))}
|
|
106
|
+
description={messages.subtitle(rangeLabel(range, locale, range.timeZone))}
|
|
98
107
|
actions={
|
|
99
108
|
<>
|
|
100
109
|
<Segmented
|
|
@@ -159,28 +168,32 @@ function Spend({ range, filters, onFilter, onModel, onClear, limitsHref }: Spend
|
|
|
159
168
|
const active = activeRange(range, filters)
|
|
160
169
|
const query = apiFilters(filters)
|
|
161
170
|
const bucket = range.bucket
|
|
171
|
+
const timeZone = range.timeZone
|
|
172
|
+
const earlier = priorRange(active, range)
|
|
162
173
|
|
|
163
174
|
const overview = useQuery({
|
|
164
|
-
...getAiAccountingOverviewOptions({ query: { ...active, bucket, ...query } }),
|
|
175
|
+
...getAiAccountingOverviewOptions({ query: { ...active, bucket, timeZone, ...query } }),
|
|
165
176
|
retry: false,
|
|
166
177
|
})
|
|
167
178
|
const chart = useQuery({
|
|
168
179
|
...getAiAccountingOverviewOptions({
|
|
169
|
-
query: { from: range.from, to: range.to, bucket, ...query },
|
|
180
|
+
query: { from: range.from, to: range.to, bucket, timeZone, ...query },
|
|
170
181
|
}),
|
|
171
182
|
retry: false,
|
|
172
183
|
})
|
|
173
184
|
const prior = useQuery({
|
|
174
|
-
...getAiAccountingOverviewOptions({ query: { ...
|
|
185
|
+
...getAiAccountingOverviewOptions({ query: { ...earlier, bucket, timeZone, ...query } }),
|
|
175
186
|
retry: false,
|
|
176
187
|
})
|
|
177
188
|
// Unfiltered, for each model's color and for what share of all spend a filter keeps.
|
|
178
189
|
const everything = useQuery({
|
|
179
|
-
...getAiAccountingOverviewOptions({
|
|
190
|
+
...getAiAccountingOverviewOptions({
|
|
191
|
+
query: { from: range.from, to: range.to, bucket, timeZone },
|
|
192
|
+
}),
|
|
180
193
|
retry: false,
|
|
181
194
|
})
|
|
182
195
|
const everythingActive = useQuery({
|
|
183
|
-
...getAiAccountingOverviewOptions({ query: { ...active, bucket } }),
|
|
196
|
+
...getAiAccountingOverviewOptions({ query: { ...active, bucket, timeZone } }),
|
|
184
197
|
enabled: narrowed,
|
|
185
198
|
retry: false,
|
|
186
199
|
})
|
|
@@ -306,8 +319,8 @@ function Spend({ range, filters, onFilter, onModel, onClear, limitsHref }: Spend
|
|
|
306
319
|
currency={currency}
|
|
307
320
|
priorLabel={
|
|
308
321
|
filters.day
|
|
309
|
-
? bucketLabel(
|
|
310
|
-
: rangeLabel(
|
|
322
|
+
? bucketLabel(earlier.from, bucket, locale, timeZone)
|
|
323
|
+
: rangeLabel(earlier, locale, timeZone)
|
|
311
324
|
}
|
|
312
325
|
limitsHref={limitsHref}
|
|
313
326
|
runsQuery={{ ...active, ...query }}
|
|
@@ -570,7 +583,13 @@ function ExportButton({ range, filters }: { range: SpendRange; filters: SpendFil
|
|
|
570
583
|
const messages = useAiUsageMessages()
|
|
571
584
|
const { data } = useQuery({
|
|
572
585
|
...getAiAccountingOverviewOptions({
|
|
573
|
-
query: {
|
|
586
|
+
query: {
|
|
587
|
+
from: range.from,
|
|
588
|
+
to: range.to,
|
|
589
|
+
bucket: range.bucket,
|
|
590
|
+
timeZone: range.timeZone,
|
|
591
|
+
...apiFilters(filters),
|
|
592
|
+
},
|
|
574
593
|
}),
|
|
575
594
|
retry: false,
|
|
576
595
|
})
|
|
@@ -264,7 +264,7 @@ export function SpendChart({
|
|
|
264
264
|
const isHover = hover === index
|
|
265
265
|
const values = series.map((entry) => entry.values[index] ?? 0)
|
|
266
266
|
const last = values.reduce((top, value, at) => (value > 0 ? at : top), -1)
|
|
267
|
-
const label = bucketLabel(period.start, range.bucket, locale)
|
|
267
|
+
const label = bucketLabel(period.start, range.bucket, locale, range.timeZone)
|
|
268
268
|
const segmentIndex = series.findIndex((entry) => entry.key === hoverSeries)
|
|
269
269
|
const hoveredSegment = segmentIndex >= 0 ? segmentIndex : undefined
|
|
270
270
|
return (
|
|
@@ -358,7 +358,7 @@ export function SpendChart({
|
|
|
358
358
|
)}
|
|
359
359
|
>
|
|
360
360
|
{index % every === 0 || picked === index || hover === index
|
|
361
|
-
? bucketLabel(start, range.bucket, locale)
|
|
361
|
+
? bucketLabel(start, range.bucket, locale, range.timeZone)
|
|
362
362
|
: ""}
|
|
363
363
|
</span>
|
|
364
364
|
))}
|