@agent-native/core 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.
Files changed (50) hide show
  1. package/dist/cli/create.js +9 -6
  2. package/dist/cli/package-lifecycle.js +18 -2
  3. package/dist/cli/process.d.ts +7 -0
  4. package/dist/cli/process.js +20 -0
  5. package/dist/cli/workspace-dev.js +3 -15
  6. package/dist/client/resources/use-resources.d.ts +7 -0
  7. package/dist/client/resources/use-resources.js +24 -2
  8. package/dist/client/review/use-review.d.ts +2 -0
  9. package/dist/client/review/use-review.js +11 -0
  10. package/dist/collab/routes.d.ts +1 -1
  11. package/dist/deploy/build.d.ts +16 -4
  12. package/dist/deploy/build.js +22 -0
  13. package/dist/framework-package-versions.json +11 -11
  14. package/dist/free-name/index.d.ts +11 -3
  15. package/dist/free-name/index.js +8 -6
  16. package/dist/free-name/server.d.ts +1 -1
  17. package/dist/local-artifacts/index.d.ts +13 -0
  18. package/dist/local-artifacts/index.js +75 -2
  19. package/dist/resources/handlers.d.ts +6 -0
  20. package/dist/resources/handlers.js +143 -5
  21. package/dist/resources/store.d.ts +15 -2
  22. package/dist/resources/store.js +60 -8
  23. package/dist/review/actions/create-review-comment.js +7 -3
  24. package/dist/review/actions/reply-review-comment.js +7 -3
  25. package/dist/review/actions/update-review-comment.d.ts +6 -0
  26. package/dist/review/actions/update-review-comment.js +42 -7
  27. package/dist/review/attachments.d.ts +19 -0
  28. package/dist/review/attachments.js +73 -1
  29. package/dist/review/errors.d.ts +4 -0
  30. package/dist/review/errors.js +9 -0
  31. package/dist/review/index.d.ts +1 -1
  32. package/dist/review/index.js +1 -1
  33. package/dist/review/notifications.js +4 -5
  34. package/dist/review/store.d.ts +11 -0
  35. package/dist/review/store.js +21 -2
  36. package/dist/server/first-touch-route.d.ts +1 -1
  37. package/dist/templates/chat/.agents/skills/actions/SKILL.md +2 -1
  38. package/dist/templates/default/.agents/skills/actions/SKILL.md +2 -1
  39. package/dist/templates/headless/.agents/skills/actions/SKILL.md +2 -1
  40. package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +2 -1
  41. package/dist/testing/cpu-time.d.ts +20 -0
  42. package/dist/testing/cpu-time.js +38 -0
  43. package/dist/usage/actions/get-builder-credit-status.js +7 -3
  44. package/docs/content/toolkit-comments-review.mdx +53 -0
  45. package/migration-manifest.json +1 -1
  46. package/package.json +8 -4
  47. package/src/templates/chat/.agents/skills/actions/SKILL.md +2 -1
  48. package/src/templates/default/.agents/skills/actions/SKILL.md +2 -1
  49. package/src/templates/headless/.agents/skills/actions/SKILL.md +2 -1
  50. package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +2 -1
@@ -1,5 +1,5 @@
1
1
  export type { ReviewActorKind, ReviewAnchorKind, ReviewComment, ReviewCommentKind, ReviewCommentLink, ReviewCommentPolicy, ReviewCommentStatus, ReviewCommentWriteEvent, ReviewCommentReaction, ReviewThreadPreference, ReviewDiscussionState, ReviewMention, ReviewResolutionTarget, ReviewResourceAccess, ReviewResourceContext, ReviewResourceRole, ReviewScope, ReviewStatus, ReviewStatusEntry, ReviewableResourceRegistration, } from "./types.js";
2
- export { ReviewAnchorError, ReviewCommentLinkConflictError, ReviewCommentRevisionConflictError, ReviewCursorError, } from "./errors.js";
2
+ export { ReviewAnchorError, ReviewCommentEmptyError, ReviewCommentLinkConflictError, ReviewCommentRevisionConflictError, ReviewCursorError, } from "./errors.js";
3
3
  export { redactPublicReviewCommentIdentity, redactPublicReviewStatusIdentity, reviewAuthorNameFromContext, shouldRedactReviewIdentity, } from "./identity.js";
4
4
  export { extractReviewMentions, normalizeReviewMentions } from "./mentions.js";
5
5
  export { notifyReviewComment, REVIEW_NOTIFICATION_PREFS_KEY, type ReviewNotificationResult, } from "./notifications.js";
@@ -1,4 +1,4 @@
1
- export { ReviewAnchorError, ReviewCommentLinkConflictError, ReviewCommentRevisionConflictError, ReviewCursorError, } from "./errors.js";
1
+ export { ReviewAnchorError, ReviewCommentEmptyError, ReviewCommentLinkConflictError, ReviewCommentRevisionConflictError, ReviewCursorError, } from "./errors.js";
2
2
  export { redactPublicReviewCommentIdentity, redactPublicReviewStatusIdentity, reviewAuthorNameFromContext, shouldRedactReviewIdentity, } from "./identity.js";
3
3
  export { extractReviewMentions, normalizeReviewMentions } from "./mentions.js";
4
4
  export { notifyReviewComment, REVIEW_NOTIFICATION_PREFS_KEY, } from "./notifications.js";
@@ -81,6 +81,7 @@ async function deliverReviewCommentEmails(comment, withReceipt = false) {
81
81
  logLabel: LOG_LABEL,
82
82
  send: async (to) => {
83
83
  const wasMentioned = mentioned.has(to);
84
+ const excerpt = commentExcerpt(comment.body);
84
85
  const lead = wasMentioned
85
86
  ? `${emailStrong(actor)} mentioned you in a review comment on this ${label}.`
86
87
  : isReply
@@ -93,11 +94,9 @@ async function deliverReviewCommentEmails(comment, withReceipt = false) {
93
94
  : isReply
94
95
  ? "New reply in a review thread"
95
96
  : "New review comment",
96
- // Paragraphs are HTML; the excerpt is the commenter's own text.
97
- paragraphs: [
98
- lead,
99
- `"${escapeEmailHtml(commentExcerpt(comment.body))}"`,
100
- ],
97
+ // Paragraphs are HTML; the excerpt is the commenter's own text. A
98
+ // comment that's only an image has none to quote.
99
+ paragraphs: excerpt ? [lead, `"${escapeEmailHtml(excerpt)}"`] : [lead],
101
100
  cta: { label: "Open review", url },
102
101
  footer: "You received this because you own, were mentioned in, or participated in this review thread.",
103
102
  });
@@ -32,6 +32,11 @@ export interface InsertReviewCommentResult {
32
32
  }
33
33
  export interface UpdateReviewCommentInput {
34
34
  body?: string;
35
+ /**
36
+ * The comment's images, already checked, in place of the ones in its
37
+ * metadata. The rest of its metadata stays.
38
+ */
39
+ attachments?: Record<string, unknown>[];
35
40
  anchor?: unknown;
36
41
  /** With `anchor`: a new kind for it. Left out, the comment's kind stays. */
37
42
  anchorKind?: string | null;
@@ -44,6 +49,12 @@ export interface ReviewCommentWriteOptions {
44
49
  * is written and a `ReviewCommentRevisionConflictError` is thrown.
45
50
  */
46
51
  expectedRevision?: number | undefined;
52
+ /**
53
+ * Refuse, with a `ReviewCommentEmptyError`, a change that leaves the comment
54
+ * with no text and no image. Checked against the locked row, so a change
55
+ * made since the caller read the comment counts.
56
+ */
57
+ requireContent?: boolean | undefined;
47
58
  /** Who made the change, for the resource's write hook. */
48
59
  actorEmail?: string | null | undefined;
49
60
  }
@@ -2,7 +2,7 @@ import { getDbExec } from "../db/client.js";
2
2
  import { ensureColumnExists, ensureIndexExists, ensureTableExists, } from "../db/ddl-guard.js";
3
3
  import { sql } from "../db/sql.js";
4
4
  import { defineStore } from "../db/store-registry.js";
5
- import { ReviewAnchorError, ReviewCommentLinkConflictError, ReviewCommentRevisionConflictError, ReviewCursorError, } from "./errors.js";
5
+ import { ReviewAnchorError, ReviewCommentEmptyError, ReviewCommentLinkConflictError, ReviewCommentRevisionConflictError, ReviewCursorError, } from "./errors.js";
6
6
  import { hasReviewCommentWriteHook, normalizeReviewAnchor, runReviewCommentWriteHook, } from "./registry.js";
7
7
  export const reviewStore = defineStore({
8
8
  id: "review",
@@ -1215,6 +1215,14 @@ async function writeReviewCommentChange(client, id, input, resource, options) {
1215
1215
  options.expectedRevision !== revision) {
1216
1216
  throw new ReviewCommentRevisionConflictError(id, revision);
1217
1217
  }
1218
+ if (options.requireContent) {
1219
+ const body = input.body ?? current.body;
1220
+ const attachments = input.attachments ?? current.metadata?.attachments;
1221
+ if (!body.trim() &&
1222
+ !(Array.isArray(attachments) && attachments.length > 0)) {
1223
+ throw new ReviewCommentEmptyError(id);
1224
+ }
1225
+ }
1218
1226
  const assignments = [];
1219
1227
  if (input.body !== undefined) {
1220
1228
  assignments.push(sql `body = ${sql.value(input.body)}`);
@@ -1222,6 +1230,15 @@ async function writeReviewCommentChange(client, id, input, resource, options) {
1222
1230
  if (input.mentions !== undefined) {
1223
1231
  assignments.push(sql `mentions_json = ${sql.value(stringifyOptionalJson(input.mentions))}`);
1224
1232
  }
1233
+ if (input.attachments !== undefined) {
1234
+ // From the locked row, so a change made since the caller read the comment
1235
+ // keeps the rest of its metadata.
1236
+ const { attachments: _previous, ...rest } = current.metadata ?? {};
1237
+ const metadata = input.attachments.length
1238
+ ? { ...rest, attachments: input.attachments }
1239
+ : rest;
1240
+ assignments.push(sql `metadata_json = ${sql.value(stringifyOptionalJson(Object.keys(metadata).length ? metadata : null))}`);
1241
+ }
1225
1242
  if (input.anchor !== undefined) {
1226
1243
  // A moved anchor is written now, so at its kind's current version unless
1227
1244
  // the caller says otherwise.
@@ -1254,7 +1271,9 @@ async function writeReviewCommentChange(client, id, input, resource, options) {
1254
1271
  const updated = await getReviewCommentByIdWithClient(client, id);
1255
1272
  if (!updated)
1256
1273
  throw new Error("Review comment not found after update");
1257
- const changesContent = input.body !== undefined || input.mentions !== undefined;
1274
+ const changesContent = input.body !== undefined ||
1275
+ input.mentions !== undefined ||
1276
+ input.attachments !== undefined;
1258
1277
  // An edit that also moves the anchor tells the hook both, so a hook keeping
1259
1278
  // anchor or surface state still hears of the move.
1260
1279
  const events = changesContent
@@ -17,9 +17,9 @@ export type FirstTouchSyncResult = {
17
17
  * browser's `an_ft` and `an_lt` again, so Safari keeps them their 30 days.
18
18
  */
19
19
  export declare function createFirstTouchHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
20
+ stored?: undefined;
20
21
  error: string;
21
22
  reason?: undefined;
22
- stored?: undefined;
23
23
  firstTouch?: undefined;
24
24
  } | {
25
25
  error?: undefined;
@@ -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`. Don't write another copy of that loop.
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`. Don't write another copy of that loop.
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`. Don't write another copy of that loop.
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`. Don't write another copy of that loop.
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
@@ -0,0 +1,20 @@
1
+ /**
2
+ * CPU milliseconds this thread spends running `run`, for a test that needs a
3
+ * performance budget (a ReDoS guard, a parser's speed).
4
+ *
5
+ * Do not measure a budget with `Date.now()` or `performance.now()`: wall-clock
6
+ * time also counts the time a loaded CI runner gives to other processes, so a
7
+ * correct run crosses any fixed bound sooner or later. CPU time counts only the
8
+ * work this thread did. Prefer a scaling check (n against 4n) when the claim is
9
+ * "linear" rather than "fast".
10
+ *
11
+ * Returns a number for a synchronous `run` and a promise for an async one. An
12
+ * async `run` is charged for whatever else runs on this thread while it awaits.
13
+ *
14
+ * On Node without `process.threadCpuUsage()` (before 22.19 / 23.9) the main
15
+ * thread falls back to `process.cpuUsage()`, which also counts CPU spent by
16
+ * worker threads in the same process, so the number is this thread's alone
17
+ * only when no worker threads run during `run`.
18
+ */
19
+ export declare function measureCpuMs(run: () => PromiseLike<unknown>): Promise<number>;
20
+ export declare function measureCpuMs(run: () => unknown): number;
@@ -0,0 +1,38 @@
1
+ import { isMainThread } from "node:worker_threads";
2
+ /**
3
+ * Picks the CPU clock for this thread. `process.cpuUsage()` counts every
4
+ * thread in the process: under Vitest's forks pool that is one test file, but
5
+ * in a worker thread it also counts the files running beside it, which is the
6
+ * load a CPU budget exists to ignore.
7
+ */
8
+ function cpuUsageReader() {
9
+ const threadCpuUsage = process
10
+ .threadCpuUsage;
11
+ if (typeof threadCpuUsage === "function") {
12
+ return () => threadCpuUsage.call(process);
13
+ }
14
+ if (!isMainThread) {
15
+ throw new Error("measureCpuMs needs process.threadCpuUsage() (Node 22.19+ or 23.9+) " +
16
+ "inside a worker thread: process.cpuUsage() there also counts every " +
17
+ "other test running in the process.");
18
+ }
19
+ return () => process.cpuUsage();
20
+ }
21
+ function elapsedCpuMs(read, start) {
22
+ const end = read();
23
+ return (end.user - start.user + (end.system - start.system)) / 1_000;
24
+ }
25
+ export function measureCpuMs(run) {
26
+ const read = cpuUsageReader();
27
+ const start = read();
28
+ const result = run();
29
+ if (isPromiseLike(result)) {
30
+ return Promise.resolve(result).then(() => elapsedCpuMs(read, start));
31
+ }
32
+ return elapsedCpuMs(read, start);
33
+ }
34
+ function isPromiseLike(value) {
35
+ return (typeof value === "object" &&
36
+ value !== null &&
37
+ typeof value.then === "function");
38
+ }
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { defineAction } from "../../action.js";
2
+ import { defineAction, fail } from "../../action.js";
3
3
  import { describeChatCredentialState, } from "../../agent/engine/credential-state.js";
4
4
  import { isResolvedEngineUsableForRequest, registerBuiltinEngines, } from "../../agent/engine/index.js";
5
5
  import { getAppConfig } from "../../app-config/index.js";
@@ -21,8 +21,12 @@ export default defineAction({
21
21
  if (!ctx?.userEmail)
22
22
  throw new Error("Not authenticated.");
23
23
  const activeOrgId = getRequestOrgId() ?? null;
24
- if (orgId !== undefined && orgId !== activeOrgId) {
25
- throw new Error("The active organization changed. Please retry.");
24
+ const requestedOrgId = orgId === "" ? null : orgId;
25
+ if (requestedOrgId !== undefined && requestedOrgId !== activeOrgId) {
26
+ fail("The active organization changed. Please retry.", {
27
+ errorCode: "builder_credit_org_mismatch",
28
+ statusCode: 409,
29
+ });
26
30
  }
27
31
  const canViewWorkspace = await canViewWorkspaceUsage({
28
32
  ownerEmail: ctx.userEmail,
@@ -30,6 +30,8 @@ status such as draft, review, approved, or needs changes.
30
30
  | `ReviewStatusBadge` | Controlled status badge for app headers, sidebars, and review panels. |
31
31
  | `isCommentSendKey()` | The send key in every comment box: Enter sends, Shift+Enter starts a new line, and Cmd/Ctrl+Enter sends too, but not while an input method composes. |
32
32
  | `ReviewCommentComposer` | The comment box, which saves Markdown. A bar over selected text, shortcuts and Markdown typed as you go format it; Enter goes on with a list or code block. |
33
+ | `useReviewCommentDraft()` | A comment box's unsent text, mentions and images, kept in the browser per thread so they survive a reload. |
34
+ | Comment images | `useReviewCommentImageUpload()` uploads pasted, dropped or picked images for a box of your own, up to five; `ReviewCommentImageStrip` shows them. |
33
35
  | `commentDocToMarkdown()` | The box's document as a comment's Markdown, and `commentMarkdownToDoc()` back, from `@agent-native/core/review/markdown`. |
34
36
  | Review hooks | `useReviewComments()`, `useCreateReviewComment()`, `useReplyReviewComment()`, `useResolveReviewThread()`, `useDeleteReviewComment()`, and `useSetReviewStatus()`. |
35
37
  | Mentions helpers | `extractReviewMentions()` and `normalizeReviewMentions()` for `@[Label](mailto:email@example.com)` tokens. |
@@ -48,6 +50,15 @@ specialize anchor shapes, but the common model preserves:
48
50
  - optional `mentions`
49
51
  - optional `anchor` or `resolutionTarget`
50
52
  - optional `resolutionNote` on a resolved root thread
53
+ - optional images in `metadata.attachments`
54
+
55
+ A comment needs text or an image. `create-review-comment` and
56
+ `reply-review-comment` keep up to five images from `metadata.attachments`:
57
+ Builder's image CDN, or files the app's upload provider says it stored. A
58
+ comment whose body is empty and whose images were all dropped is refused with
59
+ `empty_comment`. `update-review-comment` takes `attachments` to replace an
60
+ author's images, checked the same way, and keeps the rest of the comment's
61
+ metadata.
51
62
 
52
63
  `list-review-comments` supports anonymous reads for resources whose access
53
64
  resolver grants public viewer access. Public viewer responses redact ownership,
@@ -163,6 +174,48 @@ on with it; Enter on an empty list item ends the list. Pasted text reads as
163
174
  Markdown, and Shift pastes it as typed. The bar's labels are English unless
164
175
  you pass `formatLabels`, to the box or to `ReviewThreadPanel`.
165
176
 
177
+ Give the box `images` and `onImagesChange` and it takes images too: pasted,
178
+ dropped, or picked with its image button, up to five. It uploads each with the
179
+ app's file upload (pass `uploadImage` for another) and sends a comment that's
180
+ only an image. A paste with text in it, such as cells from a spreadsheet,
181
+ pastes as text. Send the images as the comment's `metadata.attachments`; the
182
+ card shows them below its text.
183
+
184
+ `useReviewCommentDraft(scope, key, initial?)` keeps what a box holds until it's
185
+ sent, so a reload or a closed thread doesn't lose it. Give each box its own
186
+ key, such as `new`, `reply:<threadId>` or `edit:<commentId>`, and call
187
+ `clear()` once the comment is saved. Drafts are kept per person, account and
188
+ resource, and only the newest 50 are kept. Without a signed-in person nothing
189
+ is stored, and a draft lasts while a box on the resource is open. Give the box
190
+ the draft's `target` as `imageTarget`, so an image still uploading when the
191
+ box moves to another thread or account isn't added to that one's draft.
192
+
193
+ ```tsx
194
+ const reply = useReviewCommentDraft(
195
+ { resourceType: "design", resourceId, userEmail, orgId },
196
+ `reply:${threadId}`,
197
+ );
198
+
199
+ <ReviewCommentComposer
200
+ value={reply.draft.text}
201
+ onChange={reply.setText}
202
+ mentions={reply.draft.mentions}
203
+ onMentionsChange={reply.setMentions}
204
+ images={reply.draft.images}
205
+ onImagesChange={reply.setImages}
206
+ imageTarget={reply.target}
207
+ onSubmit={async () => {
208
+ await replyToThread({
209
+ body: reply.draft.text,
210
+ metadata: {
211
+ attachments: reviewCommentImageMetadata(reply.draft.images),
212
+ },
213
+ });
214
+ reply.clear();
215
+ }}
216
+ />;
217
+ ```
218
+
166
219
  ## UX Standard {#ux-standard}
167
220
 
168
221
  - Comments live next to the thing being reviewed, not only in chat.
@@ -5999,7 +5999,7 @@
5999
5999
  "to": "@agent-native/toolkit/app/review/ReviewThreadPanel"
6000
6000
  },
6001
6001
  "isTrustedReviewAttachmentUrl": {
6002
- "to": "@agent-native/toolkit/app/review/ReviewCommentItem"
6002
+ "to": "@agent-native/toolkit/app/review/review-comment-images"
6003
6003
  },
6004
6004
  "ReviewThread": {
6005
6005
  "to": "@agent-native/toolkit/app/review/ReviewThreadPanel"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.229.0-nightly-20261116153227",
3
+ "version": "0.229.0",
4
4
  "description": "The agentic application framework for building autonomous agents with intuitive UIs",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -451,6 +451,10 @@
451
451
  "types": "./dist/testing.d.ts",
452
452
  "default": "./dist/testing.js"
453
453
  },
454
+ "./testing/cpu-time": {
455
+ "types": "./dist/testing/cpu-time.d.ts",
456
+ "default": "./dist/testing/cpu-time.js"
457
+ },
454
458
  "./router": "./dist/router/index.js",
455
459
  "./collab": "./dist/collab/index.js",
456
460
  "./collab/bounded-task-bundle": "./dist/collab/bounded-task-bundle.js",
@@ -801,8 +805,8 @@
801
805
  "yaml": "^2.9.0",
802
806
  "yjs": "^13.6.33",
803
807
  "zod": "^4.3.6",
804
- "@agent-native/agentkit": "^0.229.0-nightly-20261116153227",
805
- "@agent-native/recap-cli": "^0.5.103"
808
+ "@agent-native/recap-cli": "^0.5.104",
809
+ "@agent-native/agentkit": "^0.229.0"
806
810
  },
807
811
  "devDependencies": {
808
812
  "@ai-sdk/anthropic": "^3.0.71",
@@ -875,7 +879,7 @@
875
879
  "xlsx": "^0.18.5"
876
880
  },
877
881
  "peerDependencies": {
878
- "@agent-native/core-corpus": "0.229.0-nightly-20261116153227",
882
+ "@agent-native/core-corpus": ">=0.196.0",
879
883
  "@ai-sdk/anthropic": ">=3",
880
884
  "@ai-sdk/cohere": ">=3",
881
885
  "@ai-sdk/google": ">=3",
@@ -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`. Don't write another copy of that loop.
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`. Don't write another copy of that loop.
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`. Don't write another copy of that loop.
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`. Don't write another copy of that loop.
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