@agent-native/core-corpus 0.229.0-nightly-20261116153227 → 0.229.0
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/actions/SKILL.md +2 -1
- package/corpus/templates/analytics/.agents/skills/dashboard-management/SKILL.md +12 -0
- package/corpus/templates/analytics/CHANGELOG.md +13 -34
- package/corpus/templates/analytics/actions/get-panel-drilldown.ts +1 -1
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +49 -34
- package/corpus/templates/analytics/app/i18n/en-US.ts +2 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelDrilldownDialog.tsx +14 -3
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +1 -1
- package/corpus/templates/analytics/changelog/2026-11-14-clicking-a-chart-s-no-value-point-no-longer-opens-an-empty-r.md +6 -0
- package/corpus/templates/analytics/shared/panel-render-contract.ts +1 -1
- package/corpus/templates/assets/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/brain/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/chat/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/clips/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/clips/CHANGELOG.md +9 -25
- package/corpus/templates/clips/actions/lib/audio-only-transcription.ts +14 -1
- package/corpus/templates/clips/actions/lib/recording-audio-source.ts +65 -13
- package/corpus/templates/clips/shared/transcript-failure.ts +4 -0
- package/corpus/templates/content/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/content/.agents/skills/document-editing/SKILL.md +6 -0
- package/corpus/templates/content/.agents/skills/notion-integration/SKILL.md +18 -1
- package/corpus/templates/content/CHANGELOG.md +31 -20
- package/corpus/templates/content/actions/_database-property-setup.ts +2 -7
- package/corpus/templates/content/actions/_database-setup-mutation.ts +17 -0
- package/corpus/templates/content/actions/add-content-database-source-field-property.ts +3 -0
- package/corpus/templates/content/actions/configure-document-property.ts +4 -0
- package/corpus/templates/content/actions/duplicate-document-property.ts +2 -0
- package/corpus/templates/content/actions/edit-document.ts +1 -1
- package/corpus/templates/content/actions/list-document-properties.ts +3 -0
- package/corpus/templates/content/actions/materialize-builder-required-fields.ts +3 -0
- package/corpus/templates/content/app/components/editor/DocumentBlockFields.tsx +7 -1
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +16 -3
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +58 -3
- package/corpus/templates/content/app/components/editor/comment-anchors.ts +36 -31
- package/corpus/templates/content/app/components/editor/spreadsheet-clipboard.ts +230 -0
- package/corpus/templates/content/app/hooks/use-document-properties.ts +18 -0
- package/corpus/templates/content/changelog/2026-11-11-a-br-typed-in-inline-code-now-stays-text-after-you-save-inst.md +6 -0
- package/corpus/templates/content/changelog/2026-11-14-a-comment-whose-text-was-deleted-no-longer-jumps-to-the-same.md +6 -0
- package/corpus/templates/content/docs/product/capabilities/content.comment.page-owned.md +2 -0
- package/corpus/templates/content/server/lib/notion-sync.ts +60 -17
- package/corpus/templates/content/server/lib/notion.ts +6 -3
- package/corpus/templates/content/shared/api.ts +5 -0
- package/corpus/templates/content/shared/comment-quote-anchor.ts +30 -0
- package/corpus/templates/content/shared/comment-reanchor.ts +28 -15
- package/corpus/templates/content/shared/nfm.ts +63 -18
- package/corpus/templates/crm/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/crm/actions/_crm-list-utils.ts +21 -12
- package/corpus/templates/crm/actions/create-crm-list.ts +103 -72
- package/corpus/templates/design/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/design/.agents/skills/export-handoff/SKILL.md +4 -2
- package/corpus/templates/design/.agents/skills/responsive-breakpoints/SKILL.md +8 -0
- package/corpus/templates/design/CHANGELOG.md +53 -120
- package/corpus/templates/design/actions/_generate-design.test-fixtures.ts +344 -0
- package/corpus/templates/design/actions/apply-visual-edit.ts +242 -45
- package/corpus/templates/design/actions/export-png.ts +110 -6
- package/corpus/templates/design/actions/generate-design.ts +30 -1
- package/corpus/templates/design/actions/set-layout-grid.ts +32 -2
- package/corpus/templates/design/actions/take-design-screenshot.ts +6 -3
- package/corpus/templates/design/app/components/visual-editor/ReviewCanvasPins.tsx +302 -254
- package/corpus/templates/design/app/i18n/en-US.ts +4 -0
- package/corpus/templates/design/changelog/2026-11-11-comment-drafts-survive-a-reload-and-images-paste-or-drop.md +6 -0
- package/corpus/templates/design/changelog/2026-11-12-asking-the-agent-to-remove-a-layer-on-mobile-now-hides-it-at.md +6 -0
- package/corpus/templates/design/changelog/2026-11-12-design-no-longer-tells-people-who-signed-in-with-their-build.md +6 -0
- package/corpus/templates/design/changelog/2026-11-12-png-exports-requested-from-chat-now-use-the-screen-s-own-wid.md +6 -0
- package/corpus/templates/design/changelog/2026-11-12-when-the-agent-changes-a-layer-s-font-to-a-google-font-the-s.md +6 -0
- package/corpus/templates/design/changelog/2026-11-14-invalid-screen-placement-requests-are-rejected-before-incomp.md +6 -0
- package/corpus/templates/design/shared/builder-app.ts +12 -6
- package/corpus/templates/design/shared/google-font-link.ts +224 -0
- package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/dispatch/CHANGELOG.md +6 -0
- package/corpus/templates/factory/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/forms/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/mail/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/mail/CHANGELOG.md +24 -0
- package/corpus/templates/plan/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/slides/.agents/skills/actions/SKILL.md +2 -1
- package/corpus/templates/slides/CHANGELOG.md +7 -6
- package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +2 -1
- package/package.json +1 -1
- package/corpus/templates/analytics/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/assets/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/brain/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/calendar/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/chat/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/clips/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/content/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/crm/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/design/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/design/.generated/bridge/native-builtin-metadata.generated.ts +0 -326
- package/corpus/templates/design/.generated/bridge/native-worker-source.generated.ts +0 -6
- package/corpus/templates/dispatch/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/forms/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/mail/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/plan/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
- package/corpus/templates/slides/.deploy-tmp/agent-native-provided-plugins.mjs +0 -10
package/corpus/README.md
CHANGED
|
@@ -99,10 +99,11 @@ Outcomes are counted (`save_outcome_counts`, and `save_conflict_prompt` in the b
|
|
|
99
99
|
|
|
100
100
|
## Names That Must Stay Unique
|
|
101
101
|
|
|
102
|
-
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html
|
|
102
|
+
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html` (a slug whose alphabet has no `-` passes `{ separator: "_" }`). Don't write another copy of that loop.
|
|
103
103
|
|
|
104
104
|
- **Refusing:** throw `nameTaken(record, name, suggestion)` from `@agent-native/core/free-name/server`. It is a 409 `name_taken` whose `details.suggestion` is free; pass `{ noWrite: true }` from an action that declares it as a no-write error. Don't put internal ids in the message.
|
|
105
105
|
- **Creating from the UI:** let the caller ask for the next free name instead of a refusal (Design's `create-file` takes `ifNameTaken: "next-free"`), pick it on the server under the same lock as the insert, and return the saved name. Two tabs that both pick `x-copy.html` from their own list then both save.
|
|
106
|
+
- **When the picker can't see every name** the index covers (other members' private records, say), let the insert claim it: on `isUniqueViolation` from `@agent-native/core/db`, mark that name taken, pick again and retry a few times, then refuse. CRM's `create-crm-list` does this for list slugs.
|
|
106
107
|
- **Agents** get the refusal and retry with `details.suggestion`, or edit the existing record if that was the intent.
|
|
107
108
|
|
|
108
109
|
## Return Values
|
|
@@ -520,6 +520,18 @@ Declared record templates do not support `{{?variable}}…{{/variable}}`
|
|
|
520
520
|
blocks, which could assemble new literal contexts after validation. Use SQL
|
|
521
521
|
`CASE` expressions with ordinary variables for optional filters.
|
|
522
522
|
|
|
523
|
+
**A point with no x value needs `{{drillXIsNull}}`.** A row whose x is null
|
|
524
|
+
plots at a "No value" tick, and a click on it sends `{{drillX}}` as an empty
|
|
525
|
+
string, the same as a row whose x is `''`. `{{drillXIsNull}}` is `'true'` for
|
|
526
|
+
that click and `'false'` for every other, so match both:
|
|
527
|
+
`(country = '{{drillX}}' OR ('{{drillXIsNull}}' = 'true' AND country IS NULL))`.
|
|
528
|
+
When the column isn't a string, such as a `DATE`, the database reads an empty
|
|
529
|
+
`{{drillX}}` as an invalid date and fails the query, even where the `OR`
|
|
530
|
+
doesn't need it, so compare with `CAST(NULLIF('{{drillX}}', '') AS DATE)`
|
|
531
|
+
instead. A template that doesn't use
|
|
532
|
+
`{{drillXIsNull}}` opens the chart's aggregate rows for a "No value" click,
|
|
533
|
+
not records.
|
|
534
|
+
|
|
523
535
|
**Record templates can't use `:list` variables.** With nothing selected,
|
|
524
536
|
`{{appFilter:list}}` renders as the bare name `__empty_list_filter__`. BigQuery
|
|
525
537
|
and PostgreSQL reject that name even inside a `CASE` branch that never runs, so
|
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable user-facing changes to Agent-Native Analytics are documented here. Open it any
|
|
4
4
|
time from the command menu (Cmd+K → "What's new") or from Settings.
|
|
5
5
|
|
|
6
|
+
## 2026-11-14
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- Clicking a chart's "No value" point no longer opens an empty records list. Panels whose record query handles a missing x value open those records, and the rest show the chart's rows with a note.
|
|
11
|
+
- Shared settings migrations now refresh open analytics views when they finish.
|
|
12
|
+
|
|
13
|
+
## 2026-11-13
|
|
14
|
+
|
|
15
|
+
### Improved
|
|
16
|
+
|
|
17
|
+
- Dashboard panel descriptions stay condensed to a single subtext line by default and expand on click.
|
|
18
|
+
|
|
6
19
|
## 2026-11-10
|
|
7
20
|
|
|
8
21
|
### Fixed
|
|
@@ -1491,38 +1504,4 @@ time from the command menu (Cmd+K → "What's new") or from Settings.
|
|
|
1491
1504
|
- Agent chat can keep working through longer data queries instead of stopping mid-action.
|
|
1492
1505
|
- Session replay playback now preserves the initial page snapshot when an upload needs to retry.
|
|
1493
1506
|
|
|
1494
|
-
## 2026-07-01
|
|
1495
|
-
|
|
1496
|
-
### Added
|
|
1497
|
-
|
|
1498
|
-
- Analytics can now notify inbox, email, Slack, or webhook channels when first-party events spike.
|
|
1499
|
-
|
|
1500
|
-
### Improved
|
|
1501
|
-
|
|
1502
|
-
- Dashboard filters take less space and keep view actions tucked to the side.
|
|
1503
|
-
- Analytics chat responses stream more smoothly during long background runs and guarded final answers.
|
|
1504
|
-
|
|
1505
|
-
### Fixed
|
|
1506
|
-
|
|
1507
|
-
- Dashboard charts no longer show future dates when clients send bad event timestamps.
|
|
1508
|
-
- Session replay recordings upload reliably in production.
|
|
1509
|
-
- Session replay playback keeps rrweb's inlined stylesheet snapshots while stripping live resource loads, reducing blank replay frames for captured pages with external CSS.
|
|
1510
|
-
- Session replays load large production recordings from scoped chunks instead of truncating playback.
|
|
1511
|
-
- Session replays now play back in production instead of showing a blank recording, because chunk downloads no longer rely on a manual gzip content-encoding that serverless hosts corrupted.
|
|
1512
|
-
|
|
1513
|
-
## 2026-06-30
|
|
1514
|
-
|
|
1515
|
-
### Improved
|
|
1516
|
-
|
|
1517
|
-
- Ask opens a fresh chat unless you were just chatting, and dashboard navigation keeps the sidebar closed from an empty Ask state.
|
|
1518
|
-
- Dashboard toolbar controls use a quieter share button and vertical actions menu.
|
|
1519
|
-
- Session replay rows show whole-minute durations in the playlist.
|
|
1520
|
-
|
|
1521
|
-
### Fixed
|
|
1522
|
-
|
|
1523
|
-
- Dashboard charts now use theme-aware tooltip and grid colors in light and dark mode.
|
|
1524
|
-
- Dashboard email reports are more reliable and use cleaner header copy.
|
|
1525
|
-
- Fixed Ask composer spacing so the chat field has a comfortable side inset.
|
|
1526
|
-
- Session replays now render captured styling and keep the event timeline out of compact layouts.
|
|
1527
|
-
|
|
1528
1507
|
For the full list of updates, see the [changelog folder](./changelog/).
|
|
@@ -10,7 +10,7 @@ export default defineAction({
|
|
|
10
10
|
readOnly: true,
|
|
11
11
|
http: { method: "POST" },
|
|
12
12
|
description:
|
|
13
|
-
"Return a panel's declared record-level drill-down SQL template, the first-party catalog template, or null when the panel only has aggregate rows. Templates use {{drillX}} and {{drillSeries}} for the clicked chart point plus dashboard filter variables.",
|
|
13
|
+
"Return a panel's declared record-level drill-down SQL template, the first-party catalog template, or null when the panel only has aggregate rows. Templates use {{drillX}}, {{drillXIsNull}} ('true' when the clicked point's x is null) and {{drillSeries}} for the clicked chart point plus dashboard filter variables.",
|
|
14
14
|
schema: z.object({
|
|
15
15
|
panelId: z.string().min(1).max(200),
|
|
16
16
|
panelSource: z.string().min(1).max(100),
|
|
@@ -1368,16 +1368,24 @@ function ChartPointLimitNote({ limit }: { limit: ChartPointLimit }) {
|
|
|
1368
1368
|
|
|
1369
1369
|
export interface ChartDatum {
|
|
1370
1370
|
x: string;
|
|
1371
|
+
/** Set when the row's x is null, which `x` alone can't tell from ''. */
|
|
1372
|
+
xIsNull?: true;
|
|
1371
1373
|
series?: string;
|
|
1372
1374
|
value?: unknown;
|
|
1373
1375
|
}
|
|
1374
1376
|
|
|
1377
|
+
function datumX(value: unknown): Pick<ChartDatum, "x" | "xIsNull"> {
|
|
1378
|
+
return value == null
|
|
1379
|
+
? { x: "", xIsNull: true }
|
|
1380
|
+
: { x: stringifyValue(value) };
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1375
1383
|
type DatumClickHandler = (datum: ChartDatum) => void;
|
|
1376
1384
|
|
|
1377
1385
|
interface AccessibleDrilldownItem {
|
|
1378
1386
|
datum: ChartDatum;
|
|
1379
1387
|
label: string;
|
|
1380
|
-
valueLabel?: string;
|
|
1388
|
+
valueLabel?: string | undefined;
|
|
1381
1389
|
}
|
|
1382
1390
|
|
|
1383
1391
|
interface AccessibleDrilldownPage {
|
|
@@ -1404,39 +1412,46 @@ function chartDrilldownItems(
|
|
|
1404
1412
|
const end = Math.min(offset + limit, total);
|
|
1405
1413
|
const items: AccessibleDrilldownItem[] = [];
|
|
1406
1414
|
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
const
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1415
|
+
const firstRow = Math.floor(offset / seriesPerRow);
|
|
1416
|
+
const slots: (string | null)[] = seriesKeys.length > 0 ? seriesKeys : [null];
|
|
1417
|
+
const onlyValueKey = valueKeys.length === 1 ? valueKeys[0] : undefined;
|
|
1418
|
+
|
|
1419
|
+
for (const [rowOffset, row] of rows.slice(firstRow).entries()) {
|
|
1420
|
+
for (const [slot, series] of slots.entries()) {
|
|
1421
|
+
const index = (firstRow + rowOffset) * seriesPerRow + slot;
|
|
1422
|
+
if (index < offset) continue;
|
|
1423
|
+
if (index >= end) return { items, total };
|
|
1424
|
+
const x = datumX(row[xKey]);
|
|
1425
|
+
const label = formatXLabel(row[xKey]);
|
|
1426
|
+
items.push(
|
|
1427
|
+
series !== null
|
|
1428
|
+
? {
|
|
1429
|
+
datum: { ...x, series, value: row[series] },
|
|
1430
|
+
label: `${label} · ${formatSeriesLabel(series)}`,
|
|
1431
|
+
valueLabel: formatValue(row[series], series),
|
|
1432
|
+
}
|
|
1433
|
+
: {
|
|
1434
|
+
datum: {
|
|
1435
|
+
...x,
|
|
1436
|
+
value:
|
|
1437
|
+
onlyValueKey === undefined ? undefined : row[onlyValueKey],
|
|
1438
|
+
},
|
|
1439
|
+
label:
|
|
1440
|
+
valueKeys.length > 1
|
|
1441
|
+
? `${label} · ${formatList(
|
|
1442
|
+
valueKeys.map(
|
|
1443
|
+
(key) =>
|
|
1444
|
+
`${formatSeriesLabel(key)}: ${formatValue(row[key], key)}`,
|
|
1445
|
+
),
|
|
1446
|
+
)}`
|
|
1447
|
+
: label,
|
|
1448
|
+
valueLabel:
|
|
1449
|
+
onlyValueKey === undefined
|
|
1450
|
+
? undefined
|
|
1451
|
+
: formatValue(row[onlyValueKey], onlyValueKey),
|
|
1424
1452
|
},
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
? `${label} · ${formatList(
|
|
1428
|
-
valueKeys.map(
|
|
1429
|
-
(key) =>
|
|
1430
|
-
`${formatSeriesLabel(key)}: ${formatValue(row[key], key)}`,
|
|
1431
|
-
),
|
|
1432
|
-
)}`
|
|
1433
|
-
: label,
|
|
1434
|
-
valueLabel:
|
|
1435
|
-
valueKeys.length === 1
|
|
1436
|
-
? formatValue(row[valueKeys[0]], valueKeys[0])
|
|
1437
|
-
: undefined,
|
|
1438
|
-
},
|
|
1439
|
-
);
|
|
1453
|
+
);
|
|
1454
|
+
}
|
|
1440
1455
|
}
|
|
1441
1456
|
|
|
1442
1457
|
return { items, total };
|
|
@@ -1624,7 +1639,7 @@ function rowDatum(
|
|
|
1624
1639
|
: undefined;
|
|
1625
1640
|
if (!row) return null;
|
|
1626
1641
|
return {
|
|
1627
|
-
|
|
1642
|
+
...datumX(row[xKey]),
|
|
1628
1643
|
series,
|
|
1629
1644
|
value: valueKey ? row[valueKey] : undefined,
|
|
1630
1645
|
};
|
|
@@ -976,6 +976,8 @@ export default {
|
|
|
976
976
|
"The chart shows {{chart}}, but {{total}} records matched",
|
|
977
977
|
drilldownAggregateOnly:
|
|
978
978
|
"This panel only has aggregate rows. Rows matching the clicked point are highlighted.",
|
|
979
|
+
drilldownNoXValueAggregateOnly:
|
|
980
|
+
"This panel can't open records for a point with no value, so it shows aggregate rows. Rows matching the clicked point are highlighted.",
|
|
979
981
|
drilldownNoRecords: "No matching records",
|
|
980
982
|
drilldownNoRecordsIncomplete:
|
|
981
983
|
"No records loaded. The result is incomplete, so some records may still match.",
|
|
@@ -127,9 +127,17 @@ export function PanelDrilldownDialog({
|
|
|
127
127
|
drilldownQuery.isSuccess &&
|
|
128
128
|
(drilldownData?.drilldown === null ||
|
|
129
129
|
(typeof drilldownSql === "string" && drilldownSql.length > 0));
|
|
130
|
-
|
|
130
|
+
// A null x reaches a template as '', which matches no records. Only a
|
|
131
|
+
// template that reads drillXIsNull can open them; others show the chart's rows.
|
|
132
|
+
const nullXUnsupported =
|
|
133
|
+
datum?.xIsNull === true &&
|
|
134
|
+
typeof drilldownSql === "string" &&
|
|
135
|
+
!drilldownSql.includes("{{drillXIsNull}}");
|
|
136
|
+
const hasRecordQuery =
|
|
137
|
+
hasDrilldownResult && drilldownSql !== null && !nullXUnsupported;
|
|
131
138
|
const hasAggregateQuery =
|
|
132
|
-
hasDrilldownResult &&
|
|
139
|
+
hasDrilldownResult &&
|
|
140
|
+
(drilldownData?.drilldown === null || nullXUnsupported);
|
|
133
141
|
|
|
134
142
|
const recordSql = useMemo(
|
|
135
143
|
() =>
|
|
@@ -139,6 +147,7 @@ export function PanelDrilldownDialog({
|
|
|
139
147
|
{
|
|
140
148
|
...filters,
|
|
141
149
|
drillX: datum.x,
|
|
150
|
+
drillXIsNull: datum.xIsNull ? "true" : "false",
|
|
142
151
|
drillSeries: datum.series ?? "",
|
|
143
152
|
},
|
|
144
153
|
panel,
|
|
@@ -337,7 +346,9 @@ export function PanelDrilldownDialog({
|
|
|
337
346
|
) : null}
|
|
338
347
|
{!hasRecordQuery && !loading && !error ? (
|
|
339
348
|
<p className="shrink-0 text-xs text-muted-foreground">
|
|
340
|
-
{
|
|
349
|
+
{nullXUnsupported
|
|
350
|
+
? t("sqlDashboard.drilldownNoXValueAggregateOnly")
|
|
351
|
+
: t("sqlDashboard.drilldownAggregateOnly")}
|
|
341
352
|
</p>
|
|
342
353
|
) : null}
|
|
343
354
|
{showSql ? (
|
|
@@ -175,7 +175,7 @@ export interface SqlPanelConfig {
|
|
|
175
175
|
columns?: TableColumnConfig[];
|
|
176
176
|
/** Table only: columns a clicked row can be split by in the side panel. */
|
|
177
177
|
breakdowns?: PanelBreakdown[];
|
|
178
|
-
/** Record query for a clicked chart point; uses drillX and drillSeries variables. */
|
|
178
|
+
/** Record query for a clicked chart point; uses drillX, drillXIsNull and drillSeries variables. */
|
|
179
179
|
drilldown?: PanelDrilldown | null;
|
|
180
180
|
limit?: number;
|
|
181
181
|
extensionId?: string;
|
|
@@ -350,7 +350,7 @@ const CONFIG_VALUE_SHAPES: Record<string, ConfigValueShape> = {
|
|
|
350
350
|
isValidPanelDrilldown(value) &&
|
|
351
351
|
panelDrilldownSqlProblem(value.sql) === null,
|
|
352
352
|
expected:
|
|
353
|
-
"an object with only sql, a non-empty SQL template of at most 50000 characters using drillX, drillSeries and dashboard filter variables, without :list variables or {{?…}} blocks",
|
|
353
|
+
"an object with only sql, a non-empty SQL template of at most 50000 characters using drillX, drillXIsNull, drillSeries and dashboard filter variables, without :list variables or {{?…}} blocks",
|
|
354
354
|
problem: (value) =>
|
|
355
355
|
isValidPanelDrilldown(value) ? panelDrilldownSqlProblem(value.sql) : null,
|
|
356
356
|
},
|
|
@@ -99,10 +99,11 @@ Outcomes are counted (`save_outcome_counts`, and `save_conflict_prompt` in the b
|
|
|
99
99
|
|
|
100
100
|
## Names That Must Stay Unique
|
|
101
101
|
|
|
102
|
-
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html
|
|
102
|
+
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html` (a slug whose alphabet has no `-` passes `{ separator: "_" }`). Don't write another copy of that loop.
|
|
103
103
|
|
|
104
104
|
- **Refusing:** throw `nameTaken(record, name, suggestion)` from `@agent-native/core/free-name/server`. It is a 409 `name_taken` whose `details.suggestion` is free; pass `{ noWrite: true }` from an action that declares it as a no-write error. Don't put internal ids in the message.
|
|
105
105
|
- **Creating from the UI:** let the caller ask for the next free name instead of a refusal (Design's `create-file` takes `ifNameTaken: "next-free"`), pick it on the server under the same lock as the insert, and return the saved name. Two tabs that both pick `x-copy.html` from their own list then both save.
|
|
106
|
+
- **When the picker can't see every name** the index covers (other members' private records, say), let the insert claim it: on `isUniqueViolation` from `@agent-native/core/db`, mark that name taken, pick again and retry a few times, then refuse. CRM's `create-crm-list` does this for list slugs.
|
|
106
107
|
- **Agents** get the refusal and retry with `details.suggestion`, or edit the existing record if that was the intent.
|
|
107
108
|
|
|
108
109
|
## Return Values
|
|
@@ -99,10 +99,11 @@ Outcomes are counted (`save_outcome_counts`, and `save_conflict_prompt` in the b
|
|
|
99
99
|
|
|
100
100
|
## Names That Must Stay Unique
|
|
101
101
|
|
|
102
|
-
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html
|
|
102
|
+
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html` (a slug whose alphabet has no `-` passes `{ separator: "_" }`). Don't write another copy of that loop.
|
|
103
103
|
|
|
104
104
|
- **Refusing:** throw `nameTaken(record, name, suggestion)` from `@agent-native/core/free-name/server`. It is a 409 `name_taken` whose `details.suggestion` is free; pass `{ noWrite: true }` from an action that declares it as a no-write error. Don't put internal ids in the message.
|
|
105
105
|
- **Creating from the UI:** let the caller ask for the next free name instead of a refusal (Design's `create-file` takes `ifNameTaken: "next-free"`), pick it on the server under the same lock as the insert, and return the saved name. Two tabs that both pick `x-copy.html` from their own list then both save.
|
|
106
|
+
- **When the picker can't see every name** the index covers (other members' private records, say), let the insert claim it: on `isUniqueViolation` from `@agent-native/core/db`, mark that name taken, pick again and retry a few times, then refuse. CRM's `create-crm-list` does this for list slugs.
|
|
106
107
|
- **Agents** get the refusal and retry with `details.suggestion`, or edit the existing record if that was the intent.
|
|
107
108
|
|
|
108
109
|
## Return Values
|
|
@@ -99,10 +99,11 @@ Outcomes are counted (`save_outcome_counts`, and `save_conflict_prompt` in the b
|
|
|
99
99
|
|
|
100
100
|
## Names That Must Stay Unique
|
|
101
101
|
|
|
102
|
-
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html
|
|
102
|
+
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html` (a slug whose alphabet has no `-` passes `{ separator: "_" }`). Don't write another copy of that loop.
|
|
103
103
|
|
|
104
104
|
- **Refusing:** throw `nameTaken(record, name, suggestion)` from `@agent-native/core/free-name/server`. It is a 409 `name_taken` whose `details.suggestion` is free; pass `{ noWrite: true }` from an action that declares it as a no-write error. Don't put internal ids in the message.
|
|
105
105
|
- **Creating from the UI:** let the caller ask for the next free name instead of a refusal (Design's `create-file` takes `ifNameTaken: "next-free"`), pick it on the server under the same lock as the insert, and return the saved name. Two tabs that both pick `x-copy.html` from their own list then both save.
|
|
106
|
+
- **When the picker can't see every name** the index covers (other members' private records, say), let the insert claim it: on `isUniqueViolation` from `@agent-native/core/db`, mark that name taken, pick again and retry a few times, then refuse. CRM's `create-crm-list` does this for list slugs.
|
|
106
107
|
- **Agents** get the refusal and retry with `details.suggestion`, or edit the existing record if that was the intent.
|
|
107
108
|
|
|
108
109
|
## Return Values
|
|
@@ -99,10 +99,11 @@ Outcomes are counted (`save_outcome_counts`, and `save_conflict_prompt` in the b
|
|
|
99
99
|
|
|
100
100
|
## Names That Must Stay Unique
|
|
101
101
|
|
|
102
|
-
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html
|
|
102
|
+
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html` (a slug whose alphabet has no `-` passes `{ separator: "_" }`). Don't write another copy of that loop.
|
|
103
103
|
|
|
104
104
|
- **Refusing:** throw `nameTaken(record, name, suggestion)` from `@agent-native/core/free-name/server`. It is a 409 `name_taken` whose `details.suggestion` is free; pass `{ noWrite: true }` from an action that declares it as a no-write error. Don't put internal ids in the message.
|
|
105
105
|
- **Creating from the UI:** let the caller ask for the next free name instead of a refusal (Design's `create-file` takes `ifNameTaken: "next-free"`), pick it on the server under the same lock as the insert, and return the saved name. Two tabs that both pick `x-copy.html` from their own list then both save.
|
|
106
|
+
- **When the picker can't see every name** the index covers (other members' private records, say), let the insert claim it: on `isUniqueViolation` from `@agent-native/core/db`, mark that name taken, pick again and retry a few times, then refuse. CRM's `create-crm-list` does this for list slugs.
|
|
106
107
|
- **Agents** get the refusal and retry with `details.suggestion`, or edit the existing record if that was the intent.
|
|
107
108
|
|
|
108
109
|
## Return Values
|
|
@@ -99,10 +99,11 @@ Outcomes are counted (`save_outcome_counts`, and `save_conflict_prompt` in the b
|
|
|
99
99
|
|
|
100
100
|
## Names That Must Stay Unique
|
|
101
101
|
|
|
102
|
-
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html
|
|
102
|
+
When a record's name must be unique in its parent (a file in a design, say), back the rule with a unique index and pick names with `nextFreeName` from `@agent-native/core/free-name`: `name.html`, then `name-2.html`, `name-3.html` (a slug whose alphabet has no `-` passes `{ separator: "_" }`). Don't write another copy of that loop.
|
|
103
103
|
|
|
104
104
|
- **Refusing:** throw `nameTaken(record, name, suggestion)` from `@agent-native/core/free-name/server`. It is a 409 `name_taken` whose `details.suggestion` is free; pass `{ noWrite: true }` from an action that declares it as a no-write error. Don't put internal ids in the message.
|
|
105
105
|
- **Creating from the UI:** let the caller ask for the next free name instead of a refusal (Design's `create-file` takes `ifNameTaken: "next-free"`), pick it on the server under the same lock as the insert, and return the saved name. Two tabs that both pick `x-copy.html` from their own list then both save.
|
|
106
|
+
- **When the picker can't see every name** the index covers (other members' private records, say), let the insert claim it: on `isUniqueViolation` from `@agent-native/core/db`, mark that name taken, pick again and retry a few times, then refuse. CRM's `create-crm-list` does this for list slugs.
|
|
106
107
|
- **Agents** get the refusal and retry with `details.suggestion`, or edit the existing record if that was the intent.
|
|
107
108
|
|
|
108
109
|
## Return Values
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable user-facing changes to Clips are documented here. Open it any time
|
|
4
4
|
from the command menu (Cmd+K → "What's new") or from Settings.
|
|
5
5
|
|
|
6
|
+
## 2026-11-13
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
|
|
10
|
+
- Fixed a navigation error when leaving an active recording.
|
|
11
|
+
- Recording recovery reminders now follow the selected interface language.
|
|
12
|
+
|
|
6
13
|
## 2026-11-12
|
|
7
14
|
|
|
8
15
|
### Improved
|
|
@@ -11,6 +18,7 @@ from the command menu (Cmd+K → "What's new") or from Settings.
|
|
|
11
18
|
|
|
12
19
|
### Fixed
|
|
13
20
|
|
|
21
|
+
- The Labs tab in Clips desktop Settings now stays open instead of jumping back to General.
|
|
14
22
|
- Recordings now retry automatically when the upload service has a brief hiccup at the start or end of an upload, instead of failing.
|
|
15
23
|
|
|
16
24
|
## 2026-11-10
|
|
@@ -49,6 +57,7 @@ from the command menu (Cmd+K → "What's new") or from Settings.
|
|
|
49
57
|
|
|
50
58
|
### Fixed
|
|
51
59
|
|
|
60
|
+
- Navigation requests now clearly require a destination.
|
|
52
61
|
- Chrome extension: the popup now switches to Record as soon as sign-in completes, and the website shows an error if the extension handoff fails.
|
|
53
62
|
|
|
54
63
|
## 2026-11-05
|
|
@@ -1436,29 +1445,4 @@ from the command menu (Cmd+K → "What's new") or from Settings.
|
|
|
1436
1445
|
|
|
1437
1446
|
Raw Rewind recordings and the complete local index remain on the Mac. The old Private versus Cloud-assisted mode gate has been removed; the boundary is now the bounded request and, for media, the private Clip handoff.
|
|
1438
1447
|
|
|
1439
|
-
## 2026-07-16
|
|
1440
|
-
|
|
1441
|
-
### Added
|
|
1442
|
-
|
|
1443
|
-
- Organization admins can choose the default visibility for new recordings.
|
|
1444
|
-
|
|
1445
|
-
### Improved
|
|
1446
|
-
|
|
1447
|
-
- Camera bubble hover controls now appear above the face so it can rest flush near the bottom of the screen.
|
|
1448
|
-
- Clips search now matches recording content without requiring exact letter case.
|
|
1449
|
-
- Remove Silences now shows queued, active, completed, and failed progress on the recording page.
|
|
1450
|
-
- Settings no longer repeats the Builder connection status in multiple setup cards.
|
|
1451
|
-
- The desktop app button now shows "Open desktop app" and launches the installed app instead of re-downloading once you've downloaded it.
|
|
1452
|
-
|
|
1453
|
-
### Fixed
|
|
1454
|
-
|
|
1455
|
-
- Authorized viewers can open shared private clips without a misleading sign-in detour.
|
|
1456
|
-
- Chrome extension recordings no longer leave a stale recorder state blocking the next start after a failed launch.
|
|
1457
|
-
- Clips agent chat now stays inline with the recording tabs without a separate Chat or Workspace header.
|
|
1458
|
-
- Meetings you decline no longer trigger Clips desktop reminders.
|
|
1459
|
-
- Failed or delayed desktop saves now reopen Clips with the saved local copy visible in every view, including Settings.
|
|
1460
|
-
- Long desktop Clips now preserve complete playback, synced audio, full transcripts, and local recovery copies until upload verification succeeds.
|
|
1461
|
-
- Long recording lists keep Stitch actions and selected-library actions visible.
|
|
1462
|
-
- Transcripts now appear from native browser speech sooner, with automatic recovery when transcription stalls.
|
|
1463
|
-
|
|
1464
1448
|
For the full list of updates, see the [changelog folder](./changelog/).
|
|
@@ -26,7 +26,8 @@ export type AudioOnlyExtractionErrorCode =
|
|
|
26
26
|
| "NO_SPEECH_DETECTED"
|
|
27
27
|
| "FFMPEG_UNAVAILABLE"
|
|
28
28
|
| "EXTRACTION_FAILED"
|
|
29
|
-
| "TIMEOUT"
|
|
29
|
+
| "TIMEOUT"
|
|
30
|
+
| "MEDIA_TOO_LARGE";
|
|
30
31
|
|
|
31
32
|
export class AudioOnlyExtractionError extends Error {
|
|
32
33
|
code: AudioOnlyExtractionErrorCode;
|
|
@@ -203,6 +204,12 @@ function isMissingAudioTrack(stderr: string): boolean {
|
|
|
203
204
|
);
|
|
204
205
|
}
|
|
205
206
|
|
|
207
|
+
// ffmpeg writes the audio and its chunks to the same temp filesystem as a
|
|
208
|
+
// downloaded video, so it can fill the disk too.
|
|
209
|
+
function isDiskFull(message: string, stderr: string): boolean {
|
|
210
|
+
return /no space left on device|\benospc\b/i.test(`${message}\n${stderr}`);
|
|
211
|
+
}
|
|
212
|
+
|
|
206
213
|
function mapFfmpegError(err: unknown): AudioOnlyExtractionError {
|
|
207
214
|
const message = err instanceof Error ? err.message : String(err);
|
|
208
215
|
const stderr = err instanceof FfmpegRunError ? err.stderr : "";
|
|
@@ -212,6 +219,12 @@ function mapFfmpegError(err: unknown): AudioOnlyExtractionError {
|
|
|
212
219
|
"Audio-only transcription requires ffmpeg to extract the recording's audio track.",
|
|
213
220
|
);
|
|
214
221
|
}
|
|
222
|
+
if (isDiskFull(message, stderr)) {
|
|
223
|
+
return new AudioOnlyExtractionError(
|
|
224
|
+
"MEDIA_TOO_LARGE",
|
|
225
|
+
"This video is too large to transcribe. The server ran out of temporary space while preparing its audio.",
|
|
226
|
+
);
|
|
227
|
+
}
|
|
215
228
|
if (isMissingAudioTrack(stderr)) {
|
|
216
229
|
return new AudioOnlyExtractionError(
|
|
217
230
|
"NO_AUDIO_TRACK",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createWriteStream } from "node:fs";
|
|
2
|
-
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import { mkdtemp, rm, statfs, writeFile } from "node:fs/promises";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
5
|
import { Readable, Transform } from "node:stream";
|
|
6
6
|
import { pipeline } from "node:stream/promises";
|
|
7
7
|
import type { ReadableStream as NodeReadableStream } from "node:stream/web";
|
|
8
8
|
|
|
9
9
|
import { readAppState } from "@agent-native/core/application-state";
|
|
10
10
|
import { ssrfSafeFetch } from "@agent-native/core/extensions/url-safety";
|
|
11
|
-
import { MAX_UPLOAD_BYTES } from "@shared/upload-limits.js";
|
|
11
|
+
import { formatUploadBytes, MAX_UPLOAD_BYTES } from "@shared/upload-limits.js";
|
|
12
12
|
|
|
13
13
|
import { isBuilderCdnHost } from "../../server/lib/builder-cdn.js";
|
|
14
14
|
import { fetchS3ObjectByUrl } from "../../server/lib/s3-upload-provider.js";
|
|
@@ -26,6 +26,9 @@ interface RecordingAudioTimeouts {
|
|
|
26
26
|
|
|
27
27
|
type MediaFetcher = (url: string, init: RequestInit) => Promise<Response>;
|
|
28
28
|
|
|
29
|
+
// Free bytes on the filesystem holding `dir`, or null when it can't be read.
|
|
30
|
+
type FreeSpaceReader = (dir: string) => Promise<number | null>;
|
|
31
|
+
|
|
29
32
|
type RecordingMediaTarget =
|
|
30
33
|
| { kind: "local-blob" }
|
|
31
34
|
| { kind: "stream"; url: string; origin: "app" | "builder-cdn" }
|
|
@@ -70,9 +73,27 @@ export function resolveRecordingMediaTarget(
|
|
|
70
73
|
const safeFetch: MediaFetcher = (url, init) =>
|
|
71
74
|
ssrfSafeFetch(url, init, { maxRedirects: 3 });
|
|
72
75
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
// Room kept for ffmpeg's audio output, which shares the temp filesystem with
|
|
77
|
+
// the downloaded video: about an hour and a half of transcription audio.
|
|
78
|
+
const AUDIO_OUTPUT_RESERVE_BYTES = 32 * 1024 * 1024;
|
|
79
|
+
|
|
80
|
+
const readFreeSpace: FreeSpaceReader = async (dir) => {
|
|
81
|
+
try {
|
|
82
|
+
const stats = await statfs(dir);
|
|
83
|
+
return stats.bavail * stats.bsize;
|
|
84
|
+
// coercion-ok: null means unknown, so the caller downloads unchecked, as before.
|
|
85
|
+
} catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Serverless temp space is small (512 MB on AWS Lambda) next to the upload
|
|
91
|
+
// limit, so a video that can't fit fails with a plain reason instead of a raw
|
|
92
|
+
// ENOSPC, and isn't retried, since every attempt would fail the same way.
|
|
93
|
+
function tooLargeError(reason: string): AudioOnlyExtractionError {
|
|
94
|
+
return new AudioOnlyExtractionError(
|
|
95
|
+
"MEDIA_TOO_LARGE",
|
|
96
|
+
`This video is too large to transcribe. ${reason}`,
|
|
76
97
|
);
|
|
77
98
|
}
|
|
78
99
|
|
|
@@ -95,12 +116,17 @@ async function downloadToFile(
|
|
|
95
116
|
path: string,
|
|
96
117
|
fetcher: MediaFetcher,
|
|
97
118
|
timeoutMs: number,
|
|
119
|
+
freeSpace: FreeSpaceReader,
|
|
98
120
|
): Promise<void> {
|
|
99
121
|
const res = await fetcher(url, { signal: AbortSignal.timeout(timeoutMs) });
|
|
100
|
-
await writeResponseToFile(res, path);
|
|
122
|
+
await writeResponseToFile(res, path, freeSpace);
|
|
101
123
|
}
|
|
102
124
|
|
|
103
|
-
async function writeResponseToFile(
|
|
125
|
+
async function writeResponseToFile(
|
|
126
|
+
res: Response,
|
|
127
|
+
path: string,
|
|
128
|
+
freeSpace: FreeSpaceReader,
|
|
129
|
+
): Promise<void> {
|
|
104
130
|
if (!res.ok) {
|
|
105
131
|
// guard:allow-bare-error — invariant: request-transcript records media preparation errors as a failed transcript.
|
|
106
132
|
throw new Error(
|
|
@@ -108,7 +134,19 @@ async function writeResponseToFile(res: Response, path: string): Promise<void> {
|
|
|
108
134
|
);
|
|
109
135
|
}
|
|
110
136
|
const declaredBytes = Number(res.headers.get("content-length") ?? "0");
|
|
111
|
-
if (declaredBytes > MAX_UPLOAD_BYTES)
|
|
137
|
+
if (declaredBytes > MAX_UPLOAD_BYTES) {
|
|
138
|
+
throw tooLargeError(
|
|
139
|
+
`It is ${formatUploadBytes(declaredBytes, "up")}, over the ${formatUploadBytes(MAX_UPLOAD_BYTES, "down")} limit.`,
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
if (declaredBytes > 0) {
|
|
143
|
+
const free = await freeSpace(dirname(path));
|
|
144
|
+
if (free !== null && declaredBytes + AUDIO_OUTPUT_RESERVE_BYTES > free) {
|
|
145
|
+
throw tooLargeError(
|
|
146
|
+
`It is ${formatUploadBytes(declaredBytes, "up")}, and the server has room for ${formatUploadBytes(Math.max(0, free - AUDIO_OUTPUT_RESERVE_BYTES), "down")}.`,
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
112
150
|
// guard:allow-bare-error — invariant: request-transcript catches media preparation errors and records them as a failed transcript.
|
|
113
151
|
if (!res.body) throw new Error("Failed to fetch videoUrl: empty body");
|
|
114
152
|
|
|
@@ -117,7 +155,11 @@ async function writeResponseToFile(res: Response, path: string): Promise<void> {
|
|
|
117
155
|
transform(chunk: Buffer, _encoding, callback) {
|
|
118
156
|
receivedBytes += chunk.length;
|
|
119
157
|
if (receivedBytes > MAX_UPLOAD_BYTES) {
|
|
120
|
-
callback(
|
|
158
|
+
callback(
|
|
159
|
+
tooLargeError(
|
|
160
|
+
`It is over the ${formatUploadBytes(MAX_UPLOAD_BYTES, "down")} limit.`,
|
|
161
|
+
),
|
|
162
|
+
);
|
|
121
163
|
return;
|
|
122
164
|
}
|
|
123
165
|
callback(null, chunk);
|
|
@@ -137,6 +179,7 @@ export async function prepareRecordingTranscriptionAudio({
|
|
|
137
179
|
timeouts,
|
|
138
180
|
extractor = extractAudioOnlyWithFfmpeg,
|
|
139
181
|
fetchers = { app: fetch, safe: safeFetch },
|
|
182
|
+
freeSpace = readFreeSpace,
|
|
140
183
|
}: {
|
|
141
184
|
recordingId: string;
|
|
142
185
|
videoUrl: string;
|
|
@@ -144,11 +187,20 @@ export async function prepareRecordingTranscriptionAudio({
|
|
|
144
187
|
timeouts: RecordingAudioTimeouts;
|
|
145
188
|
extractor?: AudioExtractor;
|
|
146
189
|
fetchers?: { app: MediaFetcher; safe: MediaFetcher };
|
|
190
|
+
freeSpace?: FreeSpaceReader;
|
|
147
191
|
}): Promise<AudioOnlyTranscriptionMedia> {
|
|
148
192
|
const extractFromFile = (write: (path: string) => Promise<void>) =>
|
|
149
193
|
withTempDir(async (dir) => {
|
|
150
194
|
const path = join(dir, "input");
|
|
151
|
-
|
|
195
|
+
try {
|
|
196
|
+
await write(path);
|
|
197
|
+
} catch (err) {
|
|
198
|
+
// A download without a declared size can still fill the disk.
|
|
199
|
+
if ((err as NodeJS.ErrnoException)?.code !== "ENOSPC") throw err;
|
|
200
|
+
throw tooLargeError(
|
|
201
|
+
"The server ran out of temporary space while saving it.",
|
|
202
|
+
);
|
|
203
|
+
}
|
|
152
204
|
return extractor({
|
|
153
205
|
source: { kind: "file", path },
|
|
154
206
|
timeoutMs: timeouts.extractionMs,
|
|
@@ -156,7 +208,7 @@ export async function prepareRecordingTranscriptionAudio({
|
|
|
156
208
|
});
|
|
157
209
|
const downloadAndExtract = (url: string, fetcher: MediaFetcher) =>
|
|
158
210
|
extractFromFile((path) =>
|
|
159
|
-
downloadToFile(url, path, fetcher, timeouts.downloadMs),
|
|
211
|
+
downloadToFile(url, path, fetcher, timeouts.downloadMs, freeSpace),
|
|
160
212
|
);
|
|
161
213
|
|
|
162
214
|
if (storageMode === "hosted") {
|
|
@@ -168,7 +220,7 @@ export async function prepareRecordingTranscriptionAudio({
|
|
|
168
220
|
});
|
|
169
221
|
// guard:allow-bare-error — invariant: request-transcript records media preparation errors as a failed transcript.
|
|
170
222
|
if (!res) throw new Error("Failed to fetch hosted recording media");
|
|
171
|
-
await writeResponseToFile(res, path);
|
|
223
|
+
await writeResponseToFile(res, path, freeSpace);
|
|
172
224
|
});
|
|
173
225
|
}
|
|
174
226
|
|