@agent-native/core 0.189.0 → 0.190.0-nightly-20260925211446
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/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/analysis-workspace/SKILL.md +10 -0
- package/corpus/templates/analytics/.agents/skills/data-querying/SKILL.md +1 -1
- package/corpus/templates/analytics/AGENTS.md +11 -22
- package/corpus/templates/analytics/actions/list-data-dictionary.ts +7 -9
- package/corpus/templates/analytics/actions/search-analytics-query-catalog.ts +1 -1
- package/corpus/templates/analytics/app/components/AnalyticsReviewArtifactPreview.tsx +201 -0
- package/corpus/templates/analytics/app/i18n/en-US.ts +2 -0
- package/corpus/templates/analytics/app/pages/Settings.tsx +50 -3
- package/corpus/templates/analytics/changelog/2026-09-25-first-run-onboarding-records-setup-choices-and-builder-conne.md +6 -0
- package/corpus/templates/analytics/changelog/2026-09-25-human-review-previews-analytics-dashboards-as-real-charts.md +6 -0
- package/corpus/templates/analytics/changelog/2026-09-25-org-admins-can-review-agent-runs-from-settings.md +6 -0
- package/corpus/templates/analytics/changelog/2026-09-25-proactive-query-context.md +6 -0
- package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +98 -2
- package/corpus/templates/analytics/server/lib/analytics-agent-context.ts +557 -0
- package/corpus/templates/analytics/server/lib/analytics-query-catalog.ts +217 -46
- package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +2 -2
- package/corpus/templates/analytics/server/lib/dashboards-store.ts +39 -5
- package/corpus/templates/analytics/server/lib/data-dictionary-context.ts +4 -0
- package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +268 -2
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +44 -9
- package/corpus/templates/calendar/AGENTS.md +5 -0
- package/corpus/templates/calendar/CHANGELOG.md +6 -0
- package/corpus/templates/calendar/actions/get-event-rules-status.ts +47 -0
- package/corpus/templates/calendar/actions/list-events.ts +50 -4
- package/corpus/templates/calendar/actions/undo-calendar-event-rule.ts +229 -0
- package/corpus/templates/calendar/actions/update-settings.ts +8 -0
- package/corpus/templates/calendar/app/i18n/en-US.ts +27 -0
- package/corpus/templates/calendar/app/pages/Settings.tsx +196 -1
- package/corpus/templates/calendar/changelog/2026-09-25-calendar-feeds-with-the-same-url-keep-their-own-names-and-co.md +6 -0
- package/corpus/templates/calendar/changelog/2026-09-25-calendar-invitation-rules-surface-expired-connections-and-un.md +6 -0
- package/corpus/templates/calendar/changelog/2026-09-25-restore-locally-hidden-events-from-activity-after-disconnect.md +6 -0
- package/corpus/templates/calendar/server/lib/calendar-settings.ts +44 -10
- package/corpus/templates/calendar/server/lib/google-api.ts +15 -1
- package/corpus/templates/calendar/server/lib/google-calendar.ts +1 -1
- package/corpus/templates/calendar/server/plugins/event-rules.ts +628 -0
- package/corpus/templates/calendar/shared/api.ts +13 -0
- package/corpus/templates/calendar/shared/settings.ts +71 -1
- package/corpus/templates/clips/actions/create-recording.ts +83 -2
- package/corpus/templates/clips/actions/finalize-recording.ts +610 -110
- package/corpus/templates/clips/actions/get-recording-player-data.ts +6 -0
- package/corpus/templates/clips/actions/import-loom-recording.ts +2 -0
- package/corpus/templates/clips/actions/lib/create-recording-schema.ts +7 -0
- package/corpus/templates/clips/actions/lib/loom-import-job.ts +15 -1
- package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +126 -26
- package/corpus/templates/clips/app/hooks/use-drop-video-upload.ts +75 -15
- package/corpus/templates/clips/app/routes/_app.r.$recordingId.tsx +5 -1
- package/corpus/templates/clips/app/routes/record.tsx +134 -40
- package/corpus/templates/clips/chrome-extension/src/background.ts +3 -0
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +73 -16
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +188 -18
- package/corpus/templates/clips/desktop/src/lib/recording-request.ts +1 -0
- package/corpus/templates/clips/server/db/schema.ts +4 -0
- package/corpus/templates/clips/server/jobs/media-verification.ts +78 -4
- package/corpus/templates/clips/server/jobs/recording-failure-backfill.ts +142 -0
- package/corpus/templates/clips/server/lib/media-verification-state.ts +29 -0
- package/corpus/templates/clips/server/lib/post-finalize-dispatch.ts +2 -0
- package/corpus/templates/clips/server/lib/recording-failures.ts +111 -0
- package/corpus/templates/clips/server/lib/recordings.ts +6 -1
- package/corpus/templates/clips/server/lib/s3-upload-provider.ts +8 -3
- package/corpus/templates/clips/server/lib/upload-lease.ts +25 -6
- package/corpus/templates/clips/server/plugins/calendar-jobs.ts +2 -0
- package/corpus/templates/clips/server/plugins/db.ts +18 -0
- package/corpus/templates/clips/server/routes/api/_agent-native-background/post-finalize-worker.post.ts +48 -5
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +322 -31
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +223 -61
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/interrupt.post.ts +62 -4
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/reset-chunks.post.ts +74 -7
- package/corpus/templates/clips/shared/recording-core.ts +27 -0
- package/corpus/templates/design/actions/get-design.ts +35 -6
- package/corpus/templates/mail/.agents/skills/inbox-automations/SKILL.md +4 -0
- package/corpus/templates/mail/actions/consolidate-ai-filter-rules.ts +41 -0
- package/corpus/templates/mail/actions/get-ai-priority.ts +48 -8
- package/corpus/templates/mail/actions/record-ai-priority-feedback.ts +69 -0
- package/corpus/templates/mail/actions/update-mail-preferences.ts +2 -0
- package/corpus/templates/mail/app/components/email/EmailList.tsx +179 -32
- package/corpus/templates/mail/app/components/email/EmailListItem.tsx +97 -9
- package/corpus/templates/mail/app/components/email/EmailThread.tsx +55 -1
- package/corpus/templates/mail/app/components/email/ImportanceFeedbackMenu.tsx +52 -0
- package/corpus/templates/mail/app/components/email/compose-autocomplete.ts +2 -1
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +219 -188
- package/corpus/templates/mail/app/components/onboarding/AiInboxSetup.tsx +338 -0
- package/corpus/templates/mail/app/components/settings/AiFilterSection.tsx +597 -781
- package/corpus/templates/mail/app/components/settings/AiRulePromptField.tsx +37 -0
- package/corpus/templates/mail/app/global.css +42 -26
- package/corpus/templates/mail/app/hooks/use-ai-priority-feedback.ts +43 -0
- package/corpus/templates/mail/app/hooks/use-automations.ts +23 -0
- package/corpus/templates/mail/app/i18n/en-US.ts +58 -3
- package/corpus/templates/mail/app/pages/InboxPage.tsx +47 -10
- package/corpus/templates/mail/changelog/2026-09-25-editing-importance-rules-preserves-disabled-instructions-and.md +6 -0
- package/corpus/templates/mail/changelog/2026-09-25-handle-astral-unicode-letters-in-autocomplete-word-boundarie.md +6 -0
- package/corpus/templates/mail/changelog/2026-09-25-jev-priority-feedback-and-inbox-settings.md +6 -0
- package/corpus/templates/mail/changelog/2026-09-25-keep-existing-ai-filter-rules-intact-when-saving-a-prompt.md +6 -0
- package/corpus/templates/mail/server/lib/automation-engine.ts +21 -12
- package/corpus/templates/mail/server/lib/automations.ts +100 -1
- package/corpus/templates/mail/shared/types.ts +3 -0
- package/corpus/templates/plan/app/i18n/en-US.ts +6 -0
- package/corpus/templates/plan/app/lib/plan-invite-suggestion.ts +43 -0
- package/corpus/templates/plan/app/pages/PlansPage.tsx +249 -4
- package/corpus/templates/slides/actions/create-deck.ts +11 -1
- package/corpus/templates/slides/app/components/deck/SlideRenderer.tsx +117 -1
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +373 -330
- package/corpus/templates/slides/app/components/design-system/builder-index-response.ts +36 -5
- package/corpus/templates/slides/app/components/editor/BlockBubbleMenu.tsx +21 -53
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +347 -671
- package/corpus/templates/slides/app/components/editor/bullet-editing.ts +55 -8
- package/corpus/templates/slides/app/components/editor/in-place-text-session.ts +2082 -0
- package/corpus/templates/slides/app/components/editor/list-editing.ts +174 -16
- package/corpus/templates/slides/app/components/editor/rich-text-selection.ts +497 -62
- package/corpus/templates/slides/app/components/editor/slide-text-targets.ts +102 -20
- package/corpus/templates/slides/app/context/DeckContext.tsx +9 -4
- package/corpus/templates/slides/app/global.css +7 -219
- package/corpus/templates/slides/app/i18n/en-US.ts +3 -0
- package/corpus/templates/slides/app/lib/sanitize-slide-html.ts +7 -0
- package/corpus/templates/slides/app/lib/slide-image-replacement.ts +203 -1
- package/corpus/templates/slides/app/lib/slide-source-map.ts +43 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +182 -4
- package/corpus/templates/slides/app/routes/settings.tsx +33 -2
- package/corpus/templates/slides/changelog/2026-09-25-improve-slides-design-system-setup-feedback.md +6 -0
- package/corpus/templates/slides/changelog/2026-09-25-org-admins-can-review-agent-runs-from-settings.md +6 -0
- package/corpus/templates/slides/changelog/2026-09-25-text-on-a-slide-is-now-edited-in-place-clicking-into-it-chan.md +6 -0
- package/corpus/templates/slides/package.json +0 -12
- package/corpus/templates/slides/scripts/edit-fidelity/README.md +4 -2
- package/corpus/templates/slides/scripts/edit-fidelity/run.ts +12 -3
- package/corpus/templates/slides/vite.config.ts +1 -10
- package/dist/agent/jev-tool-prefetch.d.ts +29 -3
- package/dist/agent/jev-tool-prefetch.js +161 -34
- package/dist/agent/production-agent.d.ts +11 -0
- package/dist/agent/production-agent.js +39 -8
- package/dist/app-config/runtime.d.ts +1 -0
- package/dist/app-config/runtime.js +4 -0
- package/dist/app-config/schema.d.ts +1 -0
- package/dist/client/AgentSidebar.d.ts +3 -1
- package/dist/client/AgentSidebar.js +8 -12
- package/dist/client/analytics/index.d.ts +1 -1
- package/dist/client/analytics/index.js +1 -1
- package/dist/client/analytics.d.ts +2 -0
- package/dist/client/analytics.js +9 -0
- package/dist/client/api-path.js +5 -2
- package/dist/client/chat/run-recovery.d.ts +0 -3
- package/dist/client/chat/run-recovery.js +13 -23
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/observability/ObservabilityDashboard.d.ts +3 -0
- package/dist/client/observability/ObservabilityDashboard.js +366 -71
- package/dist/client/observability/ObservabilityReviewSummaryButton.d.ts +4 -1
- package/dist/client/observability/ObservabilityReviewSummaryButton.js +13 -9
- package/dist/client/observability/OutputPreview.d.ts +9 -4
- package/dist/client/observability/OutputPreview.js +230 -52
- package/dist/client/onboarding/FirstRunOnboarding.js +67 -4
- package/dist/client/onboarding/use-onboarding.js +2 -0
- package/dist/client/sharing/ShareButton.d.ts +2 -0
- package/dist/client/sharing/ShareButton.js +1 -0
- package/dist/client/sharing/useShareButtonController.d.ts +1 -0
- package/dist/client/sharing/useShareButtonController.js +29 -8
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/deploy/build.js +9 -1
- package/dist/embeddings/index.d.ts +3 -1
- package/dist/embeddings/index.js +20 -10
- package/dist/jobs/sweep-hooks.d.ts +7 -0
- package/dist/jobs/sweep-hooks.js +28 -0
- package/dist/localization/default-messages.d.ts +1 -0
- package/dist/localization/default-messages.js +1 -0
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/actions/authorization.d.ts +1 -0
- package/dist/observability/actions/authorization.js +22 -0
- package/dist/observability/actions/get-observability-review-detail.d.ts +5 -0
- package/dist/observability/actions/get-observability-review-detail.js +10 -2
- package/dist/observability/actions/get-observability-review-summary-source.d.ts +2 -0
- package/dist/observability/actions/get-observability-review-summary-source.js +3 -2
- package/dist/observability/actions/save-observability-instruction-update.js +2 -1
- package/dist/observability/actions/save-observability-review-summary.js +21 -10
- package/dist/observability/migrations.js +25 -0
- package/dist/observability/reviews.d.ts +3 -1
- package/dist/observability/reviews.js +410 -53
- package/dist/observability/routes.d.ts +6 -6
- package/dist/observability/store.d.ts +15 -0
- package/dist/observability/store.js +131 -11
- package/dist/observability/types.d.ts +18 -0
- package/dist/org/handlers.d.ts +1 -1
- package/dist/org/index.d.ts +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +5 -5
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/secrets/routes.d.ts +3 -3
- package/dist/server/agent-chat/plugin-options.d.ts +4 -20
- package/dist/server/agent-chat/prompt-resources.d.ts +16 -0
- package/dist/server/agent-chat/prompt-resources.js +385 -22
- package/dist/server/agent-chat-plugin.d.ts +3 -1
- package/dist/server/agent-chat-plugin.js +149 -27
- package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +3 -0
- package/dist/server/prompts/framework-core-compact.js +1 -1
- package/dist/server/prompts/framework-core.js +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/request-context.d.ts +6 -3
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/settings/org-settings.d.ts +4 -2
- package/dist/settings/org-settings.js +3 -3
- package/dist/settings/store.d.ts +3 -1
- package/dist/settings/store.js +8 -3
- package/dist/styles/agent-native.css +5 -0
- package/dist/templates/default/app/i18n/ar-SA.ts +1 -0
- package/dist/templates/default/app/i18n/de-DE.ts +1 -0
- package/dist/templates/default/app/i18n/en-US.ts +1 -0
- package/dist/templates/default/app/i18n/es-ES.ts +1 -0
- package/dist/templates/default/app/i18n/fr-FR.ts +1 -0
- package/dist/templates/default/app/i18n/hi-IN.ts +1 -0
- package/dist/templates/default/app/i18n/ja-JP.ts +1 -0
- package/dist/templates/default/app/i18n/ko-KR.ts +1 -0
- package/dist/templates/default/app/i18n/pt-BR.ts +1 -0
- package/dist/templates/default/app/i18n/zh-CN.ts +1 -0
- package/dist/templates/default/app/i18n/zh-TW.ts +1 -0
- package/dist/tracking/registry.js +11 -4
- package/package.json +4 -3
- package/src/templates/default/app/i18n/ar-SA.ts +1 -0
- package/src/templates/default/app/i18n/de-DE.ts +1 -0
- package/src/templates/default/app/i18n/en-US.ts +1 -0
- package/src/templates/default/app/i18n/es-ES.ts +1 -0
- package/src/templates/default/app/i18n/fr-FR.ts +1 -0
- package/src/templates/default/app/i18n/hi-IN.ts +1 -0
- package/src/templates/default/app/i18n/ja-JP.ts +1 -0
- package/src/templates/default/app/i18n/ko-KR.ts +1 -0
- package/src/templates/default/app/i18n/pt-BR.ts +1 -0
- package/src/templates/default/app/i18n/zh-CN.ts +1 -0
- package/src/templates/default/app/i18n/zh-TW.ts +1 -0
- package/corpus/templates/slides/app/components/editor/SlideBubbleMenu.tsx +0 -488
- package/corpus/templates/slides/app/components/editor/SlideInlineEditor.tsx +0 -589
- package/corpus/templates/slides/app/components/editor/SlideRichTextEditor.tsx +0 -1347
- package/corpus/templates/slides/app/components/editor/SlideSlashMenu.tsx +0 -373
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Settings } from "./api.js";
|
|
1
|
+
import type { CalendarEventRuleActivity, Settings } from "./api.js";
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_CALENDAR_WEEK_START,
|
|
4
4
|
isCalendarWeekStart,
|
|
@@ -13,6 +13,56 @@ export const DEFAULT_SETTINGS: Settings = {
|
|
|
13
13
|
weekStart: DEFAULT_CALENDAR_WEEK_START,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
function normalizeEventRuleActivity(
|
|
17
|
+
input: unknown,
|
|
18
|
+
): CalendarEventRuleActivity[] {
|
|
19
|
+
if (!Array.isArray(input)) return [];
|
|
20
|
+
return input
|
|
21
|
+
.flatMap((entry): CalendarEventRuleActivity[] => {
|
|
22
|
+
if (!entry || typeof entry !== "object") return [];
|
|
23
|
+
const item = entry as Record<string, unknown>;
|
|
24
|
+
const action = item.action;
|
|
25
|
+
if (
|
|
26
|
+
typeof item.id !== "string" ||
|
|
27
|
+
!item.id ||
|
|
28
|
+
item.id.length > 2048 ||
|
|
29
|
+
typeof item.eventId !== "string" ||
|
|
30
|
+
!item.eventId ||
|
|
31
|
+
item.eventId.length > 1024 ||
|
|
32
|
+
typeof item.accountEmail !== "string" ||
|
|
33
|
+
!item.accountEmail.includes("@") ||
|
|
34
|
+
item.accountEmail.length > 320 ||
|
|
35
|
+
typeof item.title !== "string" ||
|
|
36
|
+
item.title.length > 500 ||
|
|
37
|
+
typeof item.occurredAt !== "string" ||
|
|
38
|
+
!Number.isFinite(Date.parse(item.occurredAt)) ||
|
|
39
|
+
(action !== "accepted" &&
|
|
40
|
+
action !== "declined" &&
|
|
41
|
+
action !== "hidden") ||
|
|
42
|
+
(action === "hidden" &&
|
|
43
|
+
(typeof item.hiddenEventKey !== "string" ||
|
|
44
|
+
!item.hiddenEventKey ||
|
|
45
|
+
item.hiddenEventKey.length > 2048))
|
|
46
|
+
) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
id: item.id,
|
|
52
|
+
eventId: item.eventId,
|
|
53
|
+
accountEmail: item.accountEmail,
|
|
54
|
+
title: item.title,
|
|
55
|
+
action,
|
|
56
|
+
occurredAt: item.occurredAt,
|
|
57
|
+
...(action === "hidden"
|
|
58
|
+
? { hiddenEventKey: item.hiddenEventKey as string }
|
|
59
|
+
: {}),
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
})
|
|
63
|
+
.slice(-50);
|
|
64
|
+
}
|
|
65
|
+
|
|
16
66
|
export function normalizeCalendarSettings(
|
|
17
67
|
input: unknown,
|
|
18
68
|
fallbacks?: Partial<Settings>,
|
|
@@ -46,5 +96,25 @@ export function normalizeCalendarSettings(
|
|
|
46
96
|
weekStart: isCalendarWeekStart(raw.weekStart)
|
|
47
97
|
? raw.weekStart
|
|
48
98
|
: defaults.weekStart,
|
|
99
|
+
eventRules: {
|
|
100
|
+
accept:
|
|
101
|
+
typeof raw.eventRules?.accept === "string"
|
|
102
|
+
? raw.eventRules.accept.slice(0, 2000)
|
|
103
|
+
: "",
|
|
104
|
+
decline:
|
|
105
|
+
typeof raw.eventRules?.decline === "string"
|
|
106
|
+
? raw.eventRules.decline.slice(0, 2000)
|
|
107
|
+
: "",
|
|
108
|
+
hide:
|
|
109
|
+
typeof raw.eventRules?.hide === "string"
|
|
110
|
+
? raw.eventRules.hide.slice(0, 2000)
|
|
111
|
+
: "",
|
|
112
|
+
},
|
|
113
|
+
hiddenEventKeys: Array.isArray(raw.hiddenEventKeys)
|
|
114
|
+
? raw.hiddenEventKeys
|
|
115
|
+
.filter((key): key is string => typeof key === "string")
|
|
116
|
+
.slice(-5000)
|
|
117
|
+
: [],
|
|
118
|
+
eventRuleActivity: normalizeEventRuleActivity(raw.eventRuleActivity),
|
|
49
119
|
};
|
|
50
120
|
}
|
|
@@ -18,6 +18,11 @@ import { eq } from "drizzle-orm";
|
|
|
18
18
|
import { createError } from "h3";
|
|
19
19
|
|
|
20
20
|
import { getDb, schema } from "../server/db/index.js";
|
|
21
|
+
import {
|
|
22
|
+
normalizeRecordingFailureCode,
|
|
23
|
+
trackRecordingFailure,
|
|
24
|
+
type RecordingFailureCode,
|
|
25
|
+
} from "../server/lib/recording-failures.js";
|
|
21
26
|
import {
|
|
22
27
|
getCurrentOwnerEmail,
|
|
23
28
|
getDefaultRecordingVisibility,
|
|
@@ -36,6 +41,64 @@ import { createRecordingSchema } from "./lib/create-recording-schema.js";
|
|
|
36
41
|
import { validateRecordingScope } from "./lib/recording-scope.js";
|
|
37
42
|
import { DEFAULT_RECORDING_TITLE } from "./lib/title-source.js";
|
|
38
43
|
|
|
44
|
+
export function classifyInitialUploadFailure(error: unknown): {
|
|
45
|
+
failureCode: RecordingFailureCode;
|
|
46
|
+
failureStage?: "multipart_start" | "chunk_upload" | "reset_chunks";
|
|
47
|
+
httpStatus?: number;
|
|
48
|
+
} {
|
|
49
|
+
const details =
|
|
50
|
+
error && typeof error === "object"
|
|
51
|
+
? (error as Record<string, unknown>)
|
|
52
|
+
: {};
|
|
53
|
+
const message =
|
|
54
|
+
error instanceof Error
|
|
55
|
+
? error.message
|
|
56
|
+
: typeof details.message === "string"
|
|
57
|
+
? details.message
|
|
58
|
+
: typeof error === "string"
|
|
59
|
+
? error
|
|
60
|
+
: "";
|
|
61
|
+
const messageStatus = /\b(?:failed|failure|error)\s*\((\d{3})\)/i.exec(
|
|
62
|
+
message,
|
|
63
|
+
)?.[1];
|
|
64
|
+
const status =
|
|
65
|
+
(Number.isInteger(details.status) && Number(details.status)) ||
|
|
66
|
+
(Number.isInteger(details.statusCode) && Number(details.statusCode)) ||
|
|
67
|
+
(messageStatus ? Number(messageStatus) : undefined);
|
|
68
|
+
const httpStatus =
|
|
69
|
+
status && status >= 100 && status <= 599 ? status : undefined;
|
|
70
|
+
const failureStage =
|
|
71
|
+
details.failureStage === "multipart_start" ||
|
|
72
|
+
details.failureStage === "chunk_upload" ||
|
|
73
|
+
details.failureStage === "reset_chunks"
|
|
74
|
+
? details.failureStage
|
|
75
|
+
: "multipart_start";
|
|
76
|
+
const failureCode = normalizeRecordingFailureCode(details.failureCode);
|
|
77
|
+
const storageSetupRequired =
|
|
78
|
+
failureCode === "storage_setup_required" ||
|
|
79
|
+
details.errorCode === "builder_oauth_reauthorization_required" ||
|
|
80
|
+
httpStatus === 401 ||
|
|
81
|
+
httpStatus === 403 ||
|
|
82
|
+
/credentials?[^.\n]*(?:not configured|missing)|not connected|reconnect builder(?:\.io)?|scope mismatch|missing its space id/i.test(
|
|
83
|
+
message,
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
if (storageSetupRequired) {
|
|
87
|
+
return {
|
|
88
|
+
failureCode: "storage_setup_required",
|
|
89
|
+
failureStage,
|
|
90
|
+
...(httpStatus ? { httpStatus } : {}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
failureCode:
|
|
96
|
+
failureCode === "unknown" ? "multipart_start_failed" : failureCode,
|
|
97
|
+
failureStage,
|
|
98
|
+
...(httpStatus ? { httpStatus } : {}),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
39
102
|
export default defineAction({
|
|
40
103
|
description:
|
|
41
104
|
"Create a new recording row in 'uploading' status and return its id plus the chunk upload URL template. The frontend POSTs chunks to /api/uploads/:id/chunk?index=N&total=T&isFinal=0|1, then finalizes on the last chunk. Recorders can pass app/window title context for an immediate fallback title.",
|
|
@@ -74,6 +137,7 @@ export default defineAction({
|
|
|
74
137
|
title,
|
|
75
138
|
titleSource,
|
|
76
139
|
sourceAppName: args.sourceAppName?.trim() || null,
|
|
140
|
+
recordingPlatform: args.recordingPlatform ?? "unknown",
|
|
77
141
|
sourceWindowTitle: args.sourceWindowTitle?.trim() || null,
|
|
78
142
|
status: "uploading",
|
|
79
143
|
uploadProgress: 0,
|
|
@@ -113,12 +177,28 @@ export default defineAction({
|
|
|
113
177
|
});
|
|
114
178
|
const streamingRequired = !bufferedFallbackAvailable;
|
|
115
179
|
|
|
116
|
-
const failUploadSetup = async (
|
|
180
|
+
const failUploadSetup = async (
|
|
181
|
+
reason: string,
|
|
182
|
+
failure: ReturnType<typeof classifyInitialUploadFailure> = {
|
|
183
|
+
failureCode: "storage_setup_required",
|
|
184
|
+
},
|
|
185
|
+
): Promise<never> => {
|
|
117
186
|
const failedAt = new Date().toISOString();
|
|
118
187
|
await db
|
|
119
188
|
.update(schema.recordings)
|
|
120
|
-
.set({
|
|
189
|
+
.set({
|
|
190
|
+
status: "failed",
|
|
191
|
+
failureCode: failure.failureCode,
|
|
192
|
+
failureReason: reason,
|
|
193
|
+
updatedAt: failedAt,
|
|
194
|
+
})
|
|
121
195
|
.where(eq(schema.recordings.id, id));
|
|
196
|
+
trackRecordingFailure({
|
|
197
|
+
recordingId: id,
|
|
198
|
+
userId: ownerEmail,
|
|
199
|
+
platform: args.recordingPlatform,
|
|
200
|
+
...failure,
|
|
201
|
+
});
|
|
122
202
|
await writeAppState(`recording-upload-${id}`, {
|
|
123
203
|
recordingId: id,
|
|
124
204
|
status: "failed",
|
|
@@ -185,6 +265,7 @@ export default defineAction({
|
|
|
185
265
|
reason
|
|
186
266
|
? `Video storage could not start an upload: ${reason}`
|
|
187
267
|
: "Video storage could not start a resumable upload session. Refresh and try again.",
|
|
268
|
+
classifyInitialUploadFailure(err),
|
|
188
269
|
);
|
|
189
270
|
}
|
|
190
271
|
console.warn(
|