@agent-native/core 0.84.17 → 0.84.20
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/core/CHANGELOG.md +19 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/run-store.ts +180 -13
- package/corpus/core/src/client/AssistantChat.tsx +49 -0
- package/corpus/core/src/client/active-run-state.ts +30 -0
- package/corpus/core/src/client/extensions/EmbeddedExtension.tsx +41 -3
- package/corpus/core/src/client/extensions/ExtensionViewer.tsx +133 -0
- package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +2 -2
- package/corpus/core/src/client/session-replay.ts +2 -2
- package/corpus/core/src/extensions/html-shell.ts +17 -3
- package/corpus/core/src/extensions/theme.ts +39 -0
- package/corpus/templates/analytics/actions/provider-api-request.ts +8 -1
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +2 -1
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +91 -33
- package/corpus/templates/analytics/changelog/2026-07-01-session-replay-recordings-upload-reliably-in-production.md +6 -0
- package/corpus/templates/analytics/server/handlers/session-replay.ts +46 -5
- package/corpus/templates/calendar/app/components/booking/TimeSlotPicker.tsx +10 -0
- package/corpus/templates/calendar/app/components/calendar/GoogleConnectBanner.tsx +15 -6
- package/corpus/templates/calendar/app/components/calendar/GoogleSetupWizard.tsx +22 -0
- package/corpus/templates/calendar/app/hooks/use-bookings.ts +6 -2
- package/corpus/templates/calendar/app/i18n/zh-TW.ts +4 -0
- package/corpus/templates/calendar/app/i18n-data.ts +107 -0
- package/corpus/templates/calendar/app/lib/google-oauth-setup.ts +17 -0
- package/corpus/templates/calendar/app/pages/BookingLinksPage.tsx +9 -1
- package/corpus/templates/calendar/app/pages/BookingPage.tsx +40 -26
- package/corpus/templates/calendar/app/pages/Settings.tsx +3 -1
- package/corpus/templates/calendar/changelog/2026-07-01-booking-links-now-show-an-error-when-calendar-availability-c.md +6 -0
- package/corpus/templates/calendar/server/handlers/bookings.ts +78 -13
- package/corpus/templates/calendar/server/handlers/google-auth.ts +3 -2
- package/corpus/templates/calendar/server/lib/google-calendar.ts +16 -2
- package/corpus/templates/clips/changelog/2026-07-01-chrome-recording-uploads-now-serialize-chunks-to-avoid-resum.md +6 -0
- package/corpus/templates/clips/chrome-extension/public/manifest.json +1 -1
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +30 -23
- package/corpus/templates/design/app/lib/design-system-preview.ts +69 -0
- package/corpus/templates/design/app/pages/DesignSystems.tsx +71 -50
- package/corpus/templates/design/changelog/2026-07-01-design-systems-no-longer-crash-on-responsive-tokens.md +6 -0
- package/dist/agent/run-store.d.ts +19 -6
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +163 -13
- package/dist/agent/run-store.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +2 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +36 -2
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/active-run-state.d.ts +3 -0
- package/dist/client/active-run-state.d.ts.map +1 -1
- package/dist/client/active-run-state.js +24 -0
- package/dist/client/active-run-state.js.map +1 -1
- package/dist/client/extensions/EmbeddedExtension.d.ts.map +1 -1
- package/dist/client/extensions/EmbeddedExtension.js +32 -3
- package/dist/client/extensions/EmbeddedExtension.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +59 -2
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js +2 -2
- package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
- package/dist/client/session-replay.js +2 -2
- package/dist/client/session-replay.js.map +1 -1
- package/dist/collab/routes.d.ts +2 -2
- package/dist/extensions/html-shell.d.ts.map +1 -1
- package/dist/extensions/html-shell.js +17 -3
- package/dist/extensions/html-shell.js.map +1 -1
- package/dist/extensions/theme.d.ts +9 -0
- package/dist/extensions/theme.d.ts.map +1 -1
- package/dist/extensions/theme.js +38 -0
- package/dist/extensions/theme.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/observability/routes.d.ts +8 -8
- package/dist/progress/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -129,6 +129,7 @@ type ActiveRecording = {
|
|
|
129
129
|
sourceStreams: MediaStream[];
|
|
130
130
|
audioContext: AudioContext | null;
|
|
131
131
|
chunkIndex: number;
|
|
132
|
+
uploadChain: Promise<void>;
|
|
132
133
|
uploadPromises: Promise<unknown>[];
|
|
133
134
|
uploadFailure: Error | null;
|
|
134
135
|
// Local safety buffer: every recorded blob is kept here (browser-managed,
|
|
@@ -795,6 +796,7 @@ async function begin(message: BeginMessage): Promise<{
|
|
|
795
796
|
],
|
|
796
797
|
audioContext: mixedAudio.audioContext,
|
|
797
798
|
chunkIndex: 0,
|
|
799
|
+
uploadChain: Promise.resolve(),
|
|
798
800
|
uploadPromises: [],
|
|
799
801
|
uploadFailure: null,
|
|
800
802
|
recordedBlobs: [],
|
|
@@ -837,30 +839,35 @@ async function begin(message: BeginMessage): Promise<{
|
|
|
837
839
|
// rejected promise that surfaces as an "Uncaught (in promise)" error (bad
|
|
838
840
|
// look in a Chrome Web Store review). finalizeStop reads recording.upload-
|
|
839
841
|
// Failure and surfaces it through the normal error path instead.
|
|
840
|
-
const upload =
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
842
|
+
const upload = recording.uploadChain
|
|
843
|
+
.then(() =>
|
|
844
|
+
recording.cancelled || recording.uploadFailure
|
|
845
|
+
? undefined
|
|
846
|
+
: recording.uploadMode === "streaming"
|
|
847
|
+
? uploadStreamingBlob(recording, event.data)
|
|
848
|
+
: uploadBlobInSlices(recording, event.data),
|
|
849
|
+
)
|
|
850
|
+
.catch((err) => {
|
|
851
|
+
recording.uploadFailure =
|
|
852
|
+
err instanceof Error ? err : new Error(String(err));
|
|
853
|
+
captureExtensionError(recording.uploadFailure, {
|
|
854
|
+
tags: {
|
|
855
|
+
surface: "offscreen",
|
|
856
|
+
recordingStep: "dataavailable-upload",
|
|
857
|
+
},
|
|
858
|
+
extra: {
|
|
859
|
+
recordingId: recording.recordingId,
|
|
860
|
+
blobBytes: event.data.size,
|
|
861
|
+
chunkIndex: recording.chunkIndex,
|
|
862
|
+
mimeType: event.data.type || recording.mimeType,
|
|
863
|
+
},
|
|
864
|
+
});
|
|
865
|
+
reportStatus(recording.sessionId, "error", {
|
|
866
|
+
error: recording.uploadFailure.message,
|
|
867
|
+
});
|
|
868
|
+
if (recorder.state !== "inactive") recorder.stop();
|
|
861
869
|
});
|
|
862
|
-
|
|
863
|
-
});
|
|
870
|
+
recording.uploadChain = upload.then(() => undefined);
|
|
864
871
|
recording.uploadPromises.push(upload);
|
|
865
872
|
});
|
|
866
873
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const DEFAULT_OBJECT_ENTRY_LIMIT = 8;
|
|
2
|
+
|
|
3
|
+
export function formatDesignTokenValue(value: unknown): string | undefined {
|
|
4
|
+
return formatTokenValue(value, new Set());
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getCssColorToken(value: unknown): string | undefined {
|
|
8
|
+
if (typeof value === "string") {
|
|
9
|
+
const trimmed = value.trim();
|
|
10
|
+
return trimmed || undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
for (const nested of Object.values(value)) {
|
|
18
|
+
const candidate = getCssColorToken(nested);
|
|
19
|
+
if (candidate) return candidate;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function formatTokenValue(
|
|
26
|
+
value: unknown,
|
|
27
|
+
seenObjects: Set<object>,
|
|
28
|
+
): string | undefined {
|
|
29
|
+
if (value === null || value === undefined) return undefined;
|
|
30
|
+
|
|
31
|
+
if (typeof value === "string") {
|
|
32
|
+
const trimmed = value.trim();
|
|
33
|
+
return trimmed || undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
37
|
+
return String(value);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (Array.isArray(value)) {
|
|
41
|
+
const parts = value
|
|
42
|
+
.map((item) => formatTokenValue(item, seenObjects))
|
|
43
|
+
.filter((item): item is string => Boolean(item));
|
|
44
|
+
return parts.length > 0 ? parts.join(", ") : undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (typeof value !== "object") return undefined;
|
|
48
|
+
|
|
49
|
+
if (seenObjects.has(value)) return undefined;
|
|
50
|
+
seenObjects.add(value);
|
|
51
|
+
|
|
52
|
+
const entries = Object.entries(value)
|
|
53
|
+
.map(([key, nestedValue]) => {
|
|
54
|
+
const formatted = formatTokenValue(nestedValue, seenObjects);
|
|
55
|
+
return formatted ? `${labelizeDesignTokenKey(key)}: ${formatted}` : null;
|
|
56
|
+
})
|
|
57
|
+
.filter((entry): entry is string => Boolean(entry))
|
|
58
|
+
.slice(0, DEFAULT_OBJECT_ENTRY_LIMIT);
|
|
59
|
+
|
|
60
|
+
seenObjects.delete(value);
|
|
61
|
+
return entries.length > 0 ? entries.join(", ") : undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function labelizeDesignTokenKey(key: string) {
|
|
65
|
+
return key
|
|
66
|
+
.replace(/([A-Z])/g, " $1")
|
|
67
|
+
.replace(/[-_]/g, " ")
|
|
68
|
+
.replace(/^./, (char) => char.toUpperCase());
|
|
69
|
+
}
|
|
@@ -65,6 +65,10 @@ import {
|
|
|
65
65
|
TooltipContent,
|
|
66
66
|
TooltipTrigger,
|
|
67
67
|
} from "@/components/ui/tooltip";
|
|
68
|
+
import {
|
|
69
|
+
formatDesignTokenValue,
|
|
70
|
+
getCssColorToken,
|
|
71
|
+
} from "@/lib/design-system-preview";
|
|
68
72
|
|
|
69
73
|
interface DesignSystem {
|
|
70
74
|
id: string;
|
|
@@ -83,25 +87,25 @@ interface DesignSystem {
|
|
|
83
87
|
|
|
84
88
|
interface DesignSystemData {
|
|
85
89
|
colors?: {
|
|
86
|
-
primary?:
|
|
87
|
-
secondary?:
|
|
88
|
-
accent?:
|
|
89
|
-
background?:
|
|
90
|
-
surface?:
|
|
91
|
-
text?:
|
|
92
|
-
textMuted?:
|
|
90
|
+
primary?: unknown;
|
|
91
|
+
secondary?: unknown;
|
|
92
|
+
accent?: unknown;
|
|
93
|
+
background?: unknown;
|
|
94
|
+
surface?: unknown;
|
|
95
|
+
text?: unknown;
|
|
96
|
+
textMuted?: unknown;
|
|
93
97
|
};
|
|
94
98
|
typography?: {
|
|
95
|
-
headingFont?:
|
|
96
|
-
bodyFont?:
|
|
97
|
-
headingWeight?:
|
|
98
|
-
bodyWeight?:
|
|
99
|
+
headingFont?: unknown;
|
|
100
|
+
bodyFont?: unknown;
|
|
101
|
+
headingWeight?: unknown;
|
|
102
|
+
bodyWeight?: unknown;
|
|
99
103
|
};
|
|
100
|
-
spacing?: Record<string,
|
|
101
|
-
borders?: Record<string,
|
|
104
|
+
spacing?: Record<string, unknown>;
|
|
105
|
+
borders?: Record<string, unknown>;
|
|
102
106
|
logos?: Array<{ url?: string; name?: string; variant?: string }>;
|
|
103
|
-
defaults?: Record<string,
|
|
104
|
-
notes?:
|
|
107
|
+
defaults?: Record<string, unknown>;
|
|
108
|
+
notes?: unknown;
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
export default function DesignSystems() {
|
|
@@ -474,6 +478,12 @@ export default function DesignSystems() {
|
|
|
474
478
|
{designSystems.map((ds) => {
|
|
475
479
|
const parsed = parseData(ds.data);
|
|
476
480
|
const colors = parsed?.colors;
|
|
481
|
+
const primaryColor = getCssColorToken(colors?.primary);
|
|
482
|
+
const secondaryColor = getCssColorToken(colors?.secondary);
|
|
483
|
+
const accentColor = getCssColorToken(colors?.accent);
|
|
484
|
+
const headingFont = formatDesignTokenValue(
|
|
485
|
+
parsed?.typography?.headingFont,
|
|
486
|
+
);
|
|
477
487
|
const isSelected = selectedSystemIds.has(ds.id);
|
|
478
488
|
return (
|
|
479
489
|
<div
|
|
@@ -498,29 +508,27 @@ export default function DesignSystems() {
|
|
|
498
508
|
>
|
|
499
509
|
{/* Color preview */}
|
|
500
510
|
<div className="aspect-video bg-muted/50 flex items-center justify-center gap-2 p-4">
|
|
501
|
-
{
|
|
511
|
+
{primaryColor && (
|
|
502
512
|
<div
|
|
503
513
|
className="w-10 h-10 rounded-lg"
|
|
504
|
-
style={{ backgroundColor:
|
|
514
|
+
style={{ backgroundColor: primaryColor }}
|
|
505
515
|
/>
|
|
506
516
|
)}
|
|
507
|
-
{
|
|
517
|
+
{secondaryColor && (
|
|
508
518
|
<div
|
|
509
519
|
className="w-10 h-10 rounded-lg"
|
|
510
|
-
style={{ backgroundColor:
|
|
520
|
+
style={{ backgroundColor: secondaryColor }}
|
|
511
521
|
/>
|
|
512
522
|
)}
|
|
513
|
-
{
|
|
523
|
+
{accentColor && (
|
|
514
524
|
<div
|
|
515
525
|
className="w-10 h-10 rounded-lg"
|
|
516
|
-
style={{ backgroundColor:
|
|
526
|
+
style={{ backgroundColor: accentColor }}
|
|
517
527
|
/>
|
|
518
528
|
)}
|
|
519
|
-
{!
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
<IconPalette className="w-8 h-8 text-muted-foreground/40" />
|
|
523
|
-
)}
|
|
529
|
+
{!primaryColor && !secondaryColor && !accentColor && (
|
|
530
|
+
<IconPalette className="w-8 h-8 text-muted-foreground/40" />
|
|
531
|
+
)}
|
|
524
532
|
</div>
|
|
525
533
|
<div className="p-4 pb-3">
|
|
526
534
|
<div className="flex items-center gap-2 mb-1">
|
|
@@ -533,9 +541,9 @@ export default function DesignSystems() {
|
|
|
533
541
|
</span>
|
|
534
542
|
)}
|
|
535
543
|
</div>
|
|
536
|
-
{
|
|
544
|
+
{headingFont && (
|
|
537
545
|
<div className="text-xs text-muted-foreground/70">
|
|
538
|
-
{
|
|
546
|
+
{headingFont}
|
|
539
547
|
</div>
|
|
540
548
|
)}
|
|
541
549
|
</div>
|
|
@@ -885,10 +893,12 @@ function TokenPreview({
|
|
|
885
893
|
key={color.label}
|
|
886
894
|
className="flex min-w-0 items-center gap-3 rounded-lg border border-border bg-muted/30 p-2"
|
|
887
895
|
>
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
896
|
+
{color.swatch ? (
|
|
897
|
+
<div
|
|
898
|
+
className="h-9 w-9 shrink-0 rounded-md border border-border"
|
|
899
|
+
style={{ backgroundColor: color.swatch }}
|
|
900
|
+
/>
|
|
901
|
+
) : null}
|
|
892
902
|
<div className="min-w-0">
|
|
893
903
|
<div className="text-xs font-medium text-foreground">
|
|
894
904
|
{color.label}
|
|
@@ -1001,34 +1011,47 @@ function getColorTokens(data: DesignSystemData | null, t: DesignT) {
|
|
|
1001
1011
|
return [
|
|
1002
1012
|
{
|
|
1003
1013
|
label: t("designSystems.tokenPreview.colorLabels.primary"),
|
|
1004
|
-
value: colors.primary,
|
|
1014
|
+
value: formatDesignTokenValue(colors.primary),
|
|
1015
|
+
swatch: getCssColorToken(colors.primary),
|
|
1005
1016
|
},
|
|
1006
1017
|
{
|
|
1007
1018
|
label: t("designSystems.tokenPreview.colorLabels.secondary"),
|
|
1008
|
-
value: colors.secondary,
|
|
1019
|
+
value: formatDesignTokenValue(colors.secondary),
|
|
1020
|
+
swatch: getCssColorToken(colors.secondary),
|
|
1009
1021
|
},
|
|
1010
1022
|
{
|
|
1011
1023
|
label: t("designSystems.tokenPreview.colorLabels.accent"),
|
|
1012
|
-
value: colors.accent,
|
|
1024
|
+
value: formatDesignTokenValue(colors.accent),
|
|
1025
|
+
swatch: getCssColorToken(colors.accent),
|
|
1013
1026
|
},
|
|
1014
1027
|
{
|
|
1015
1028
|
label: t("designSystems.tokenPreview.colorLabels.background"),
|
|
1016
|
-
value: colors.background,
|
|
1029
|
+
value: formatDesignTokenValue(colors.background),
|
|
1030
|
+
swatch: getCssColorToken(colors.background),
|
|
1017
1031
|
},
|
|
1018
1032
|
{
|
|
1019
1033
|
label: t("designSystems.tokenPreview.colorLabels.surface"),
|
|
1020
|
-
value: colors.surface,
|
|
1034
|
+
value: formatDesignTokenValue(colors.surface),
|
|
1035
|
+
swatch: getCssColorToken(colors.surface),
|
|
1021
1036
|
},
|
|
1022
1037
|
{
|
|
1023
1038
|
label: t("designSystems.tokenPreview.colorLabels.text"),
|
|
1024
|
-
value: colors.text,
|
|
1039
|
+
value: formatDesignTokenValue(colors.text),
|
|
1040
|
+
swatch: getCssColorToken(colors.text),
|
|
1025
1041
|
},
|
|
1026
1042
|
{
|
|
1027
1043
|
label: t("designSystems.tokenPreview.colorLabels.mutedText"),
|
|
1028
|
-
value: colors.textMuted,
|
|
1044
|
+
value: formatDesignTokenValue(colors.textMuted),
|
|
1045
|
+
swatch: getCssColorToken(colors.textMuted),
|
|
1029
1046
|
},
|
|
1030
|
-
].filter(
|
|
1031
|
-
|
|
1047
|
+
].filter(
|
|
1048
|
+
(
|
|
1049
|
+
item,
|
|
1050
|
+
): item is {
|
|
1051
|
+
label: string;
|
|
1052
|
+
value: string;
|
|
1053
|
+
swatch: string | undefined;
|
|
1054
|
+
} => Boolean(item.value),
|
|
1032
1055
|
);
|
|
1033
1056
|
}
|
|
1034
1057
|
|
|
@@ -1038,19 +1061,19 @@ function getTypographyTokens(data: DesignSystemData | null, t: DesignT) {
|
|
|
1038
1061
|
return [
|
|
1039
1062
|
{
|
|
1040
1063
|
label: t("designSystems.tokenPreview.typeLabels.headingFont"),
|
|
1041
|
-
value: typography.headingFont,
|
|
1064
|
+
value: formatDesignTokenValue(typography.headingFont),
|
|
1042
1065
|
},
|
|
1043
1066
|
{
|
|
1044
1067
|
label: t("designSystems.tokenPreview.typeLabels.bodyFont"),
|
|
1045
|
-
value: typography.bodyFont,
|
|
1068
|
+
value: formatDesignTokenValue(typography.bodyFont),
|
|
1046
1069
|
},
|
|
1047
1070
|
{
|
|
1048
1071
|
label: t("designSystems.tokenPreview.typeLabels.headingWeight"),
|
|
1049
|
-
value: typography.headingWeight,
|
|
1072
|
+
value: formatDesignTokenValue(typography.headingWeight),
|
|
1050
1073
|
},
|
|
1051
1074
|
{
|
|
1052
1075
|
label: t("designSystems.tokenPreview.typeLabels.bodyWeight"),
|
|
1053
|
-
value: typography.bodyWeight,
|
|
1076
|
+
value: formatDesignTokenValue(typography.bodyWeight),
|
|
1054
1077
|
},
|
|
1055
1078
|
].filter((item): item is { label: string; value: string } =>
|
|
1056
1079
|
Boolean(item.value),
|
|
@@ -1089,12 +1112,10 @@ function getDetailTokens(
|
|
|
1089
1112
|
].filter((item): item is { label: string; value: string } => Boolean(item));
|
|
1090
1113
|
}
|
|
1091
1114
|
|
|
1092
|
-
function objectPreviewItems(
|
|
1093
|
-
prefix: string,
|
|
1094
|
-
values: Record<string, string | undefined>,
|
|
1095
|
-
) {
|
|
1115
|
+
function objectPreviewItems(prefix: string, values: Record<string, unknown>) {
|
|
1096
1116
|
return Object.entries(values)
|
|
1097
|
-
.
|
|
1117
|
+
.map(([key, value]) => [key, formatDesignTokenValue(value)] as const)
|
|
1118
|
+
.filter((entry): entry is readonly [string, string] => Boolean(entry[1]))
|
|
1098
1119
|
.slice(0, 4)
|
|
1099
1120
|
.map(([key, value]) => ({
|
|
1100
1121
|
label: `${prefix}: ${labelizeKey(key)}`,
|
|
@@ -16,6 +16,8 @@ export declare const RUN_STALE_MS = 15000;
|
|
|
16
16
|
* With the normal 15s window the reaper would falsely kill that freshly-
|
|
17
17
|
* inserted-but-not-yet-heartbeaten row. 90s tolerates a slow background
|
|
18
18
|
* cold-start while still reaping a genuinely dead background worker promptly.
|
|
19
|
+
* Claimed background workers heartbeat during long work; the stale watchdog is a
|
|
20
|
+
* liveness timeout, not the Netlify background-function execution budget.
|
|
19
21
|
*
|
|
20
22
|
* Only applied to rows explicitly marked background-dispatched; ordinary
|
|
21
23
|
* foreground runs keep the tight 15s window unchanged.
|
|
@@ -62,13 +64,14 @@ export declare const CLAIMED_BACKGROUND_WORKER_FAILED_ERROR_EVENT: {
|
|
|
62
64
|
* Grace period before a never-claimed background run (dispatch_mode still
|
|
63
65
|
* 'background', no worker claim) is treated as a dead handoff and reaped.
|
|
64
66
|
*
|
|
65
|
-
* This is intentionally
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* has, by definition, NO worker — nothing
|
|
67
|
+
* This is intentionally tighter than `BACKGROUND_RUN_STALE_MS`. That wider
|
|
68
|
+
* window protects cold-starting or temporarily delayed background dispatches,
|
|
69
|
+
* while claimed workers stay alive by heartbeat/progress updates. A run that is
|
|
70
|
+
* still `dispatch_mode = 'background'` has, by definition, NO worker — nothing
|
|
71
|
+
* to protect — so once a Netlify
|
|
69
72
|
* background function has had a reasonable cold-start window to claim it and
|
|
70
73
|
* hasn't, the handoff is dead and should surface promptly instead of leaving
|
|
71
|
-
* the user staring at a spinner for
|
|
74
|
+
* the user staring at a spinner for the durable-worker window. 25s comfortably exceeds a normal
|
|
72
75
|
* Netlify Lambda cold start while still failing fast on a silent worker death.
|
|
73
76
|
*/
|
|
74
77
|
export declare const UNCLAIMED_BACKGROUND_RUN_GRACE_MS = 25000;
|
|
@@ -159,6 +162,16 @@ export declare function setRunError(runId: string, errorCode: string | undefined
|
|
|
159
162
|
* status='completed' + terminal_reason='run_timeout').
|
|
160
163
|
*/
|
|
161
164
|
export declare function setRunTerminalReason(runId: string, terminalReason: string | undefined): Promise<void>;
|
|
165
|
+
/**
|
|
166
|
+
* Repair a run whose terminal event was durably appended but whose final
|
|
167
|
+
* `agent_runs.status` write lost a race with reconnect/reaper code.
|
|
168
|
+
*
|
|
169
|
+
* The event ledger is the durable transcript users see. If its latest event is
|
|
170
|
+
* terminal, the run is no longer alive and must not be converted into a stale
|
|
171
|
+
* error later. This keeps `agent_runs` and `agent_run_events` from telling two
|
|
172
|
+
* different stories after delayed DB writes or background function teardown.
|
|
173
|
+
*/
|
|
174
|
+
export declare function reconcileTerminalRunFromEvents(runId: string): Promise<boolean>;
|
|
162
175
|
/**
|
|
163
176
|
* Diagnostic stage names recorded onto a background run as it moves through the
|
|
164
177
|
* `_process-run` worker pipeline. Each value is the LAST stage successfully
|
|
@@ -235,7 +248,7 @@ export declare function reapIfStale(runId: string, maxStaleMs?: number): Promise
|
|
|
235
248
|
* before it can claim), the row stays `background`, never heartbeats again, and
|
|
236
249
|
* — because dispatch returned 202 — the foreground already returned the SSE
|
|
237
250
|
* stream, so the existing fast-fail inline fallback never engaged. The run would
|
|
238
|
-
* otherwise hang for the full
|
|
251
|
+
* otherwise hang for the full durable background window and then error opaquely.
|
|
239
252
|
*
|
|
240
253
|
* This reaps such a run EARLY and DISTINCTLY: a row that is still unclaimed
|
|
241
254
|
* (`dispatch_mode = 'background'`) past the tight `UNCLAIMED_BACKGROUND_RUN_GRACE_MS`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-store.d.ts","sourceRoot":"","sources":["../../src/agent/run-store.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,QAAS,CAAC;AAEnC
|
|
1
|
+
{"version":3,"file":"run-store.d.ts","s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