@agent-native/core 0.131.7 → 0.131.9

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.
Files changed (41) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +24 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/application-state/store.ts +18 -31
  5. package/corpus/core/src/cli/create.ts +115 -16
  6. package/corpus/core/src/client/AssistantChat.tsx +10 -2
  7. package/corpus/core/src/client/frame-protocol.ts +5 -1
  8. package/corpus/core/src/workspace-files/tool.ts +18 -11
  9. package/corpus/templates/clips/actions/generate-workflow.ts +6 -4
  10. package/corpus/templates/clips/actions/reconcile-workflow-generation.ts +257 -0
  11. package/corpus/templates/clips/app/hooks/use-auto-title.ts +166 -4
  12. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +1 -1
  13. package/corpus/templates/clips/changelog/2026-07-27-stopped-agent-runs-no-longer-leave-generated-workflow-cards-.md +6 -0
  14. package/corpus/templates/clips/changelog/2026-07-30-workflow-generation-now-stops-retrying-after-repeated-failur.md +6 -0
  15. package/corpus/templates/clips/shared/workflow.ts +5 -0
  16. package/dist/application-state/store.d.ts.map +1 -1
  17. package/dist/application-state/store.js +20 -36
  18. package/dist/application-state/store.js.map +1 -1
  19. package/dist/cli/create.d.ts +8 -1
  20. package/dist/cli/create.d.ts.map +1 -1
  21. package/dist/cli/create.js +98 -16
  22. package/dist/cli/create.js.map +1 -1
  23. package/dist/client/AssistantChat.d.ts.map +1 -1
  24. package/dist/client/AssistantChat.js +10 -2
  25. package/dist/client/AssistantChat.js.map +1 -1
  26. package/dist/client/frame-protocol.d.ts +1 -0
  27. package/dist/client/frame-protocol.d.ts.map +1 -1
  28. package/dist/client/frame-protocol.js.map +1 -1
  29. package/dist/collab/routes.d.ts +1 -1
  30. package/dist/observability/routes.d.ts +3 -3
  31. package/dist/server/realtime-token.d.ts +1 -1
  32. package/dist/server/transcribe-voice.d.ts +1 -1
  33. package/dist/workspace-files/tool.d.ts.map +1 -1
  34. package/dist/workspace-files/tool.js +18 -11
  35. package/dist/workspace-files/tool.js.map +1 -1
  36. package/package.json +3 -3
  37. package/src/application-state/store.ts +18 -31
  38. package/src/cli/create.ts +115 -16
  39. package/src/client/AssistantChat.tsx +10 -2
  40. package/src/client/frame-protocol.ts +5 -1
  41. package/src/workspace-files/tool.ts +18 -11
package/corpus/README.md CHANGED
@@ -30,4 +30,4 @@ rg -n "defineAction|useActionQuery" node_modules/@agent-native/core/corpus
30
30
 
31
31
  - core files: 1644
32
32
  - toolkit files: 168
33
- - template files: 7222
33
+ - template files: 7226
@@ -1,5 +1,29 @@
1
1
  # @agent-native/core
2
2
 
3
+ ## 0.131.9
4
+
5
+ ### Patch Changes
6
+
7
+ - d80a9c9: Report workspace files as truncated only when more content exists beyond the requested read page, and normalize paging arguments to integer boundaries.
8
+ - 3c538e4: Preserve application-state database read failures and distinguish explicit stops or exhausted reconnect failures from recoverable chat handoffs.
9
+
10
+ ## 0.131.8
11
+
12
+ ### Patch Changes
13
+
14
+ - c7ec59d: `create .` now scaffolds into the current directory and takes the project name
15
+ from the folder's basename, matching `create-react-app` / `npm init`. Previously
16
+ `.` was rejected as an invalid name. The current directory must be empty apart
17
+ from benign VCS/editor files (`.git`, `.gitignore`, `LICENSE`, `README.md`, …)
18
+ so an existing project is never merged over.
19
+
20
+ The scaffold is built in a private staging directory and only the files that
21
+ don't already exist are copied in, so a mid-scaffold failure can never delete
22
+ the current directory (including `.git`) and pre-existing files like
23
+ `README.md` and `.gitignore` are preserved. When the current directory is
24
+ already a git repo, `create .` skips `git init`/commit so it never writes an
25
+ unexpected commit into the user's history.
26
+
3
27
  ## 0.131.7
4
28
 
5
29
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.131.7",
3
+ "version": "0.131.9",
4
4
  "description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -2,7 +2,6 @@ import {
2
2
  getDbExec,
3
3
  getDialect,
4
4
  isLocalDatabase,
5
- isConnectionError,
6
5
  isPostgres,
7
6
  intType,
8
7
  type DbExec,
@@ -102,21 +101,14 @@ export async function appStateGet(
102
101
  sessionId: string,
103
102
  key: string,
104
103
  ): Promise<Record<string, unknown> | null> {
105
- try {
106
- await ensureTable();
107
- const client = getDbExec();
108
- const { rows } = await client.execute({
109
- sql: `SELECT value FROM application_state WHERE session_id = ? AND key = ?`,
110
- args: [sessionId, key],
111
- });
112
- if (rows.length === 0) return null;
113
- return JSON.parse(rows[0].value as string);
114
- } catch (err) {
115
- // Transient WS / connection drops (Neon serverless) — caller polls every
116
- // 2s and will see the value on the next tick. Swallow rather than 500.
117
- if (isConnectionError(err)) return null;
118
- throw err;
119
- }
104
+ await ensureTable();
105
+ const client = getDbExec();
106
+ const { rows } = await client.execute({
107
+ sql: `SELECT value FROM application_state WHERE session_id = ? AND key = ?`,
108
+ args: [sessionId, key],
109
+ });
110
+ if (rows.length === 0) return null;
111
+ return JSON.parse(rows[0].value as string);
120
112
  }
121
113
 
122
114
  /**
@@ -133,22 +125,17 @@ export async function appStateGetMany(
133
125
  for (const key of uniqueKeys) values[key] = null;
134
126
  if (uniqueKeys.length === 0) return values;
135
127
 
136
- try {
137
- await ensureTable();
138
- const client = getDbExec();
139
- const placeholders = uniqueKeys.map(() => "?").join(", ");
140
- const { rows } = await client.execute({
141
- sql: `SELECT key, value FROM application_state WHERE session_id = ? AND key IN (${placeholders})`,
142
- args: [sessionId, ...uniqueKeys],
143
- });
144
- for (const row of rows) {
145
- values[row.key as string] = JSON.parse(row.value as string);
146
- }
147
- return values;
148
- } catch (err) {
149
- if (isConnectionError(err)) return values;
150
- throw err;
128
+ await ensureTable();
129
+ const client = getDbExec();
130
+ const placeholders = uniqueKeys.map(() => "?").join(", ");
131
+ const { rows } = await client.execute({
132
+ sql: `SELECT key, value FROM application_state WHERE session_id = ? AND key IN (${placeholders})`,
133
+ args: [sessionId, ...uniqueKeys],
134
+ });
135
+ for (const row of rows) {
136
+ values[row.key as string] = JSON.parse(row.value as string);
151
137
  }
138
+ return values;
152
139
  }
153
140
 
154
141
  export async function appStatePut(
@@ -50,6 +50,18 @@ const FIRST_PARTY_TARBALL_SYMLINK_EXCLUDES = [
50
50
  "*/.claude/skills",
51
51
  ];
52
52
  const localPackageTarballs = new Map<string, string>();
53
+ /** VCS/editor files that don't count as "not empty" for an in-place scaffold. */
54
+ const IN_PLACE_ALLOWLIST = new Set([
55
+ ".git",
56
+ ".gitignore",
57
+ ".gitattributes",
58
+ ".DS_Store",
59
+ ".idea",
60
+ ".vscode",
61
+ "LICENSE",
62
+ "README.md",
63
+ "Thumbs.db",
64
+ ]);
53
65
 
54
66
  /**
55
67
  * Tagged error for input that fails CLI-level validation (repo names, app
@@ -110,6 +122,11 @@ export interface CreateAppOptions {
110
122
  * unconditional workspace scaffold.
111
123
  */
112
124
  forceWorkspace?: boolean;
125
+ /**
126
+ * Internal: scaffold into the current directory instead of a new subfolder.
127
+ * Set when the name argument is `.`/`./` (see `createApp`).
128
+ */
129
+ inPlace?: boolean;
113
130
  }
114
131
 
115
132
  /**
@@ -127,6 +144,13 @@ export async function createApp(
127
144
  ): Promise<void> {
128
145
  const clack = await import("@clack/prompts");
129
146
 
147
+ // `create .` (or `./`) means "scaffold into the current folder" — derive the
148
+ // project name from the folder's basename, like create-react-app / npm init.
149
+ if (name === "." || name === "./") {
150
+ name = path.basename(process.cwd());
151
+ opts = { ...opts, inPlace: true };
152
+ }
153
+
130
154
  // Reject an invalid provided name before any interactive prompt so bad input
131
155
  // fails fast instead of blocking on the start-shape picker below.
132
156
  if (name !== undefined) {
@@ -335,6 +359,44 @@ function assertValidProjectName(
335
359
  process.exit(1);
336
360
  }
337
361
  }
362
+ /**
363
+ * Resolve where a scaffold writes and guard the target. A named project writes
364
+ * to a new sibling subfolder that must not already exist; `create .` writes
365
+ * into the current directory, which must be empty apart from benign VCS/editor
366
+ * files (a pre-existing repo is allowed).
367
+ *
368
+ * For an in-place scaffold we do NOT return the current directory: we build
369
+ * into a private staging directory and `finalizeScaffold` copies the result
370
+ * in afterward. Staging keeps the whole scaffold atomic — a mid-scaffold
371
+ * failure's cleanup can only ever delete the staging dir, never the user's
372
+ * current directory (including its `.git`).
373
+ */
374
+ function resolveScaffoldTarget(
375
+ name: string,
376
+ inPlace: boolean | undefined,
377
+ clack: typeof import("@clack/prompts"),
378
+ ): string {
379
+ if (inPlace) {
380
+ const conflicting = fs
381
+ .readdirSync(process.cwd())
382
+ .filter((entry) => !IN_PLACE_ALLOWLIST.has(entry));
383
+ if (conflicting.length > 0) {
384
+ const shown = conflicting.slice(0, 3).join(", ");
385
+ const more = conflicting.length > 3 ? ", …" : "";
386
+ clack.cancel(
387
+ `Current directory is not empty (${shown}${more}). Scaffold into an empty folder, or run \`create <name>\` to make a new one.`,
388
+ );
389
+ process.exit(1);
390
+ }
391
+ return fs.mkdtempSync(path.join(os.tmpdir(), "agent-native-create-"));
392
+ }
393
+ const targetDir = path.resolve(process.cwd(), name);
394
+ if (fs.existsSync(targetDir)) {
395
+ clack.cancel(`Directory "${name}" already exists.`);
396
+ process.exit(1);
397
+ }
398
+ return targetDir;
399
+ }
338
400
 
339
401
  /* ─────────────────────────────────────────────────────────────────────────
340
402
  * Workspace creation (new default)
@@ -378,11 +440,7 @@ async function createWorkspaceInteractive(
378
440
  });
379
441
  const templates = ["dispatch", ...optionalPicks];
380
442
 
381
- const targetDir = path.resolve(process.cwd(), name);
382
- if (fs.existsSync(targetDir)) {
383
- clack.cancel(`Directory "${name}" already exists.`);
384
- process.exit(1);
385
- }
443
+ const targetDir = resolveScaffoldTarget(name, opts?.inPlace, clack);
386
444
 
387
445
  const s = clack.spinner();
388
446
  for (const template of templates) {
@@ -482,13 +540,15 @@ async function createWorkspaceInteractive(
482
540
  } catch (err: any) {
483
541
  s.stop("Failed to scaffold workspace.");
484
542
  // Remove the partially-scaffolded workspace so a retry of `agent-native
485
- // create <name>` doesn't trip the "Directory already exists" guard.
543
+ // create <name>` doesn't trip the "Directory already exists" guard. For an
544
+ // in-place scaffold `targetDir` is the private staging dir, so this never
545
+ // touches the user's current directory.
486
546
  cleanupOnFailure(targetDir);
487
547
  clack.cancel(err?.message ?? String(err));
488
548
  process.exit(1);
489
549
  }
490
550
 
491
- tryGitInit(targetDir);
551
+ finalizeScaffold(targetDir, opts?.inPlace);
492
552
 
493
553
  // Show the user the tree we just built so the workspace/app distinction is
494
554
  // visible, not just described. First-time users routinely expect their
@@ -845,11 +905,7 @@ async function createStandaloneApp(
845
905
 
846
906
  name = await promptNameIfMissing(name, clack, "app", "my-app");
847
907
 
848
- const targetDir = path.resolve(process.cwd(), name);
849
- if (fs.existsSync(targetDir)) {
850
- clack.cancel(`Directory "${name}" already exists.`);
851
- process.exit(1);
852
- }
908
+ const targetDir = resolveScaffoldTarget(name, opts?.inPlace, clack);
853
909
 
854
910
  // Standalone is single-select — pick one template.
855
911
  let template =
@@ -889,12 +945,14 @@ async function createStandaloneApp(
889
945
  s.stop("App created!");
890
946
  } catch (err: any) {
891
947
  s.stop("Failed to create app.");
948
+ // `targetDir` is the private staging dir for an in-place scaffold, so this
949
+ // only ever removes the staging copy, never the user's current directory.
892
950
  cleanupOnFailure(targetDir);
893
951
  clack.cancel(err?.message ?? String(err));
894
952
  process.exit(1);
895
953
  }
896
954
 
897
- tryGitInit(targetDir);
955
+ finalizeScaffold(targetDir, opts?.inPlace);
898
956
 
899
957
  if (template === "headless") {
900
958
  clack.outro(
@@ -954,6 +1012,35 @@ function cleanupOnFailure(targetDir: string): void {
954
1012
  }
955
1013
  }
956
1014
 
1015
+ /**
1016
+ * Land a finished scaffold in its final home and initialize git. A named
1017
+ * scaffold is already in place, so this only inits git. An in-place scaffold
1018
+ * (`create .`) was built in `scaffoldDir` (a staging dir); copy only the files
1019
+ * that don't already exist into the current directory so pre-existing files
1020
+ * (`.git`, `README.md`, `.gitignore`, editor configs) are preserved, then drop
1021
+ * the staging dir. Git init/commit is skipped when the current directory is
1022
+ * already a repo so we never write an unexpected commit into the user's
1023
+ * history.
1024
+ */
1025
+ function finalizeScaffold(scaffoldDir: string, inPlace?: boolean): void {
1026
+ if (!inPlace) {
1027
+ tryGitInitUnlessRepo(scaffoldDir);
1028
+ return;
1029
+ }
1030
+ const dest = process.cwd();
1031
+ try {
1032
+ copyDir(scaffoldDir, dest, undefined, { skipExisting: true });
1033
+ } finally {
1034
+ cleanupOnFailure(scaffoldDir);
1035
+ }
1036
+ tryGitInitUnlessRepo(dest);
1037
+ }
1038
+
1039
+ function tryGitInitUnlessRepo(dir: string): void {
1040
+ if (fs.existsSync(path.join(dir, ".git"))) return;
1041
+ tryGitInit(dir);
1042
+ }
1043
+
957
1044
  /* ─────────────────────────────────────────────────────────────────────────
958
1045
  * Shared scaffolding helpers
959
1046
  * ───────────────────────────────────────────────────────────────────────── */
@@ -3399,13 +3486,25 @@ function replacePlaceholders(
3399
3486
  }
3400
3487
  }
3401
3488
 
3402
- function copyDir(src: string, dest: string, root?: string): void {
3489
+ function copyDir(
3490
+ src: string,
3491
+ dest: string,
3492
+ root?: string,
3493
+ opts?: { skipExisting?: boolean },
3494
+ ): void {
3403
3495
  const resolvedRoot = root ?? path.resolve(src);
3496
+ const skipExisting = opts?.skipExisting ?? false;
3404
3497
  fs.mkdirSync(dest, { recursive: true });
3405
3498
  for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
3406
3499
  const srcPath = path.join(src, entry.name);
3407
3500
  if (shouldSkipScaffoldEntry(entry.name, srcPath)) continue;
3408
3501
  const destPath = path.join(dest, entry.name);
3502
+ // Preserve anything already at the destination (in-place scaffold merges
3503
+ // into a directory the user may already own). Directories still recurse so
3504
+ // new files land inside a pre-existing folder.
3505
+ if (skipExisting && !entry.isDirectory() && fs.existsSync(destPath)) {
3506
+ continue;
3507
+ }
3409
3508
  if (entry.isSymbolicLink()) {
3410
3509
  const target = fs.readlinkSync(srcPath);
3411
3510
  const resolvedTarget = path.resolve(path.dirname(srcPath), target);
@@ -3415,7 +3514,7 @@ function copyDir(src: string, dest: string, root?: string): void {
3415
3514
  try {
3416
3515
  const stat = fs.statSync(srcPath);
3417
3516
  if (stat.isDirectory()) {
3418
- copyDir(srcPath, destPath, resolvedRoot);
3517
+ copyDir(srcPath, destPath, resolvedRoot, opts);
3419
3518
  } else {
3420
3519
  fs.copyFileSync(srcPath, destPath);
3421
3520
  }
@@ -3424,7 +3523,7 @@ function copyDir(src: string, dest: string, root?: string): void {
3424
3523
  }
3425
3524
  }
3426
3525
  } else if (entry.isDirectory()) {
3427
- copyDir(srcPath, destPath, resolvedRoot);
3526
+ copyDir(srcPath, destPath, resolvedRoot, opts);
3428
3527
  } else {
3429
3528
  fs.copyFileSync(srcPath, destPath);
3430
3529
  }
@@ -3421,7 +3421,11 @@ const AssistantChatInner = forwardRef<
3421
3421
  }
3422
3422
  window.dispatchEvent(
3423
3423
  new CustomEvent("agentNative.chatRunning", {
3424
- detail: { isRunning: false, tabId: tabId || threadId },
3424
+ detail: {
3425
+ isRunning: false,
3426
+ tabId: tabId || threadId,
3427
+ reason: "failed",
3428
+ },
3425
3429
  }),
3426
3430
  );
3427
3431
  return;
@@ -4510,7 +4514,11 @@ const AssistantChatInner = forwardRef<
4510
4514
  if (typeof window !== "undefined") {
4511
4515
  window.dispatchEvent(
4512
4516
  new CustomEvent("agentNative.chatRunning", {
4513
- detail: { isRunning: false, tabId: tabId || threadId },
4517
+ detail: {
4518
+ isRunning: false,
4519
+ tabId: tabId || threadId,
4520
+ reason: "stopped",
4521
+ },
4514
4522
  }),
4515
4523
  );
4516
4524
  }
@@ -115,7 +115,11 @@ export interface FrameOriginMessage {
115
115
 
116
116
  export interface ChatRunningMessage {
117
117
  type: "agentNative.chatRunning";
118
- detail: { isRunning: boolean; tabId?: string };
118
+ detail: {
119
+ isRunning: boolean;
120
+ tabId?: string;
121
+ reason?: "stopped" | "failed";
122
+ };
119
123
  }
120
124
 
121
125
  export interface UserInfoMessage {
@@ -86,13 +86,16 @@ export function createWorkspaceFilesTool(): Record<string, ActionEntry> {
86
86
  'MIME type for new files. Default: "text/plain". Use "application/json" for JSON, "text/markdown" for Markdown.',
87
87
  },
88
88
  offset: {
89
- type: "number",
89
+ type: "integer",
90
+ minimum: 0,
90
91
  description:
91
- "Character offset to start reading from (for paging large files). Default: 0.",
92
+ "Non-negative character offset to start reading from (for paging large files). Default: 0.",
92
93
  },
93
94
  maxChars: {
94
- type: "number",
95
- description: `Maximum characters to return when reading. Default: ${DEFAULT_READ_CHARS}. Max: ${MAX_READ_CHARS}.`,
95
+ type: "integer",
96
+ minimum: 1,
97
+ maximum: MAX_READ_CHARS,
98
+ description: `Positive maximum characters to return when reading. Default: ${DEFAULT_READ_CHARS}. Max: ${MAX_READ_CHARS}.`,
96
99
  },
97
100
  pattern: {
98
101
  type: "string",
@@ -168,16 +171,19 @@ export function createWorkspaceFilesTool(): Record<string, ActionEntry> {
168
171
  if (!path) return "Error: path is required for read.";
169
172
  const rawOffset = Number(args.offset);
170
173
  const offset =
171
- Number.isFinite(rawOffset) && rawOffset > 0 ? rawOffset : 0;
174
+ Number.isFinite(rawOffset) && rawOffset > 0
175
+ ? Math.floor(rawOffset)
176
+ : 0;
172
177
  const rawMax = Number(args.maxChars);
173
178
  const maxChars =
174
179
  Number.isFinite(rawMax) && rawMax > 0
175
- ? Math.min(rawMax, MAX_READ_CHARS)
180
+ ? Math.min(Math.max(1, Math.floor(rawMax)), MAX_READ_CHARS)
176
181
  : DEFAULT_READ_CHARS;
177
182
 
183
+ // The sentinel character distinguishes an exact page from a truncated one.
178
184
  const file = await readWorkspaceFile(scope, path, {
179
185
  offset,
180
- maxChars,
186
+ maxChars: maxChars + 1,
181
187
  });
182
188
  if (!file) {
183
189
  return JSON.stringify({
@@ -186,19 +192,20 @@ export function createWorkspaceFilesTool(): Record<string, ActionEntry> {
186
192
  });
187
193
  }
188
194
 
189
- const truncated = file.content.length >= maxChars;
195
+ const truncated = file.content.length > maxChars;
196
+ const content = file.content.slice(0, maxChars);
190
197
  return JSON.stringify({
191
198
  ok: true,
192
199
  path: file.path,
193
200
  contentType: file.contentType,
194
201
  sizeBytes: file.sizeBytes,
195
202
  updatedAt: file.updatedAt,
196
- content: file.content,
203
+ content,
197
204
  ...(truncated
198
205
  ? {
199
206
  truncated: true,
200
- nextOffset: offset + file.content.length,
201
- hint: `File has more content. Call again with offset: ${offset + file.content.length}`,
207
+ nextOffset: offset + content.length,
208
+ hint: `File has more content. Call again with offset: ${offset + content.length}`,
202
209
  }
203
210
  : {}),
204
211
  });
@@ -25,6 +25,7 @@ import { z } from "zod";
25
25
 
26
26
  import { getDb, schema } from "../server/db/index.js";
27
27
  import { withFullVideoAiInstructions } from "../shared/clips-ai-prefs.js";
28
+ import { WorkflowKindSchema } from "../shared/workflow.js";
28
29
  import { readIncludeFullVideoInAi } from "./lib/clips-ai-prefs.js";
29
30
 
30
31
  const KIND_PROMPTS = {
@@ -64,7 +65,7 @@ export default defineAction({
64
65
  "Ask the agent to generate a structured workflow doc (pr/sop/ticket/email) from this recording's transcript (and the full video when Include full video is enabled). The agent writes the result to clips-workflow-<recordingId> in application_state.",
65
66
  schema: z.object({
66
67
  recordingId: z.string().describe("Recording ID"),
67
- kind: z.enum(["pr", "sop", "ticket", "email"]).describe("Workflow kind"),
68
+ kind: WorkflowKindSchema.describe("Workflow kind"),
68
69
  }),
69
70
  run: async (args) => {
70
71
  await assertAccess("recording", args.recordingId, "viewer");
@@ -98,7 +99,7 @@ export default defineAction({
98
99
 
99
100
  const includeFullVideoInAi = await readIncludeFullVideoInAi();
100
101
 
101
- const existing = await readAppState(stateKey).catch(() => null);
102
+ const existing = await readAppState(stateKey);
102
103
  if (existing?.status === "generating") {
103
104
  const requestedAt = Date.parse(String(existing.requestedAt ?? ""));
104
105
  const isRecent =
@@ -115,13 +116,14 @@ export default defineAction({
115
116
  }
116
117
  }
117
118
 
119
+ const requestedAt = new Date().toISOString();
118
120
  // Seed the output state with a "generating" placeholder so the UI can show
119
121
  // a loading state immediately.
120
122
  await writeAppState(stateKey, {
121
123
  kind: args.kind,
122
124
  status: "generating",
123
125
  recordingId: args.recordingId,
124
- requestedAt: new Date().toISOString(),
126
+ requestedAt,
125
127
  } as any);
126
128
 
127
129
  const baseMessage =
@@ -136,7 +138,7 @@ export default defineAction({
136
138
  kind: "generate-workflow" as const,
137
139
  workflowKind: args.kind,
138
140
  recordingId: args.recordingId,
139
- requestedAt: new Date().toISOString(),
141
+ requestedAt,
140
142
  recordingTitle: rec.title,
141
143
  recordingDescription: rec.description,
142
144
  transcriptStatus: transcript?.status ?? "pending",