@agent-native/core 0.149.5 → 0.149.6

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 (39) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +5 -0
  3. package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +5 -0
  4. package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +5 -0
  5. package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +5 -0
  6. package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +5 -0
  7. package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +5 -0
  8. package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +5 -0
  9. package/corpus/templates/content/actions/_document-discovery-query.ts +127 -0
  10. package/corpus/templates/content/actions/list-documents.ts +189 -198
  11. package/corpus/templates/content/actions/search-documents.ts +95 -24
  12. package/corpus/templates/content/app/hooks/use-documents.ts +84 -6
  13. package/corpus/templates/content/shared/api.ts +10 -0
  14. package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +5 -0
  15. package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +5 -0
  16. package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +5 -0
  17. package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +5 -0
  18. package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +5 -0
  19. package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +5 -0
  20. package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +5 -0
  21. package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +5 -0
  22. package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +5 -0
  23. package/dist/collab/awareness.d.ts +2 -2
  24. package/dist/collab/struct-routes.d.ts +1 -1
  25. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  26. package/dist/notifications/routes.d.ts +6 -6
  27. package/dist/observability/routes.d.ts +3 -3
  28. package/dist/resources/handlers.d.ts +1 -1
  29. package/dist/secrets/routes.d.ts +9 -9
  30. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  31. package/dist/server/realtime-token.d.ts +1 -1
  32. package/dist/server/transcribe-voice.d.ts +1 -1
  33. package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +5 -0
  34. package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +5 -0
  35. package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +5 -0
  36. package/package.json +1 -1
  37. package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +5 -0
  38. package/src/templates/default/.agents/skills/frontend-design/SKILL.md +5 -0
  39. package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +5 -0
package/corpus/README.md CHANGED
@@ -31,4 +31,4 @@ rg -n "defineAction|useActionQuery" node_modules/@agent-native/core/corpus
31
31
 
32
32
  ## Generated Counts
33
33
 
34
- - template files: 8043
34
+ - template files: 8044
@@ -168,6 +168,11 @@ the useful information remains dense and scannable.
168
168
  - Do not build custom dropdowns, menus, popovers, modals, or confirmations with manual absolute positioning and click-outside effects.
169
169
  - Never use browser dialogs (`window.alert`, `window.confirm`, `window.prompt`). Use `AlertDialog`, `Dialog`, or app-specific confirmation UI.
170
170
  - Use Tabler icons for all first-party UI icons. Do not add Lucide, Heroicons, inline SVG icon sets, or emoji icons.
171
+ - Never guess a Tabler icon name. Names like `IconPartyPopper` or `IconConfettiCannon` feel
172
+ plausible but don't exist and crash Vite with a "Named export not found" error. Before importing
173
+ an icon you haven't used elsewhere in this app, confirm it exists by grepping
174
+ `node_modules/@tabler/icons-react/dist/tabler-icons-react.d.ts` (or the package's icon list)
175
+ for the exact name, and pick the closest real match if your first guess isn't there.
171
176
  - Keep inline help/info glyphs next to labels at `size-3` (12px) or smaller than the adjacent text. Preserve a larger hit area on the trigger, not the glyph. Use `guard:allow-large-help-icon` only for deliberate heading documentation or menu action exceptions.
172
177
  - Use `useActionQuery` and `useActionMutation` from `@agent-native/core/client` for action-backed UI. Standard CRUD should go through actions, not custom `/api/` routes.
173
178
  - Keep UI optimistic where possible: update cache and navigation immediately, then reconcile or roll back on mutation result.
@@ -168,6 +168,11 @@ the useful information remains dense and scannable.
168
168
  - Do not build custom dropdowns, menus, popovers, modals, or confirmations with manual absolute positioning and click-outside effects.
169
169
  - Never use browser dialogs (`window.alert`, `window.confirm`, `window.prompt`). Use `AlertDialog`, `Dialog`, or app-specific confirmation UI.
170
170
  - Use Tabler icons for all first-party UI icons. Do not add Lucide, Heroicons, inline SVG icon sets, or emoji icons.
171
+ - Never guess a Tabler icon name. Names like `IconPartyPopper` or `IconConfettiCannon` feel
172
+ plausible but don't exist and crash Vite with a "Named export not found" error. Before importing
173
+ an icon you haven't used elsewhere in this app, confirm it exists by grepping
174
+ `node_modules/@tabler/icons-react/dist/tabler-icons-react.d.ts` (or the package's icon list)
175
+ for the exact name, and pick the closest real match if your first guess isn't there.
171
176
  - Keep inline help/info glyphs next to labels at `size-3` (12px) or smaller than the adjacent text. Preserve a larger hit area on the trigger, not the glyph. Use `guard:allow-large-help-icon` only for deliberate heading documentation or menu action exceptions.
172
177
  - Use `useActionQuery` and `useActionMutation` from `@agent-native/core/client` for action-backed UI. Standard CRUD should go through actions, not custom `/api/` routes.
173
178
  - Keep UI optimistic where possible: update cache and navigation immediately, then reconcile or roll back on mutation result.
@@ -168,6 +168,11 @@ the useful information remains dense and scannable.
168
168
  - Do not build custom dropdowns, menus, popovers, modals, or confirmations with manual absolute positioning and click-outside effects.
169
169
  - Never use browser dialogs (`window.alert`, `window.confirm`, `window.prompt`). Use `AlertDialog`, `Dialog`, or app-specific confirmation UI.
170
170
  - Use Tabler icons for all first-party UI icons. Do not add Lucide, Heroicons, inline SVG icon sets, or emoji icons.
171
+ - Never guess a Tabler icon name. Names like `IconPartyPopper` or `IconConfettiCannon` feel
172
+ plausible but don't exist and crash Vite with a "Named export not found" error. Before importing
173
+ an icon you haven't used elsewhere in this app, confirm it exists by grepping
174
+ `node_modules/@tabler/icons-react/dist/tabler-icons-react.d.ts` (or the package's icon list)
175
+ for the exact name, and pick the closest real match if your first guess isn't there.
171
176
  - Keep inline help/info glyphs next to labels at `size-3` (12px) or smaller than the adjacent text. Preserve a larger hit area on the trigger, not the glyph. Use `guard:allow-large-help-icon` only for deliberate heading documentation or menu action exceptions.
172
177
  - Use `useActionQuery` and `useActionMutation` from `@agent-native/core/client` for action-backed UI. Standard CRUD should go through actions, not custom `/api/` routes.
173
178
  - Keep UI optimistic where possible: update cache and navigation immediately, then reconcile or roll back on mutation result.
@@ -168,6 +168,11 @@ the useful information remains dense and scannable.
168
168
  - Do not build custom dropdowns, menus, popovers, modals, or confirmations with manual absolute positioning and click-outside effects.
169
169
  - Never use browser dialogs (`window.alert`, `window.confirm`, `window.prompt`). Use `AlertDialog`, `Dialog`, or app-specific confirmation UI.
170
170
  - Use Tabler icons for all first-party UI icons. Do not add Lucide, Heroicons, inline SVG icon sets, or emoji icons.
171
+ - Never guess a Tabler icon name. Names like `IconPartyPopper` or `IconConfettiCannon` feel
172
+ plausible but don't exist and crash Vite with a "Named export not found" error. Before importing
173
+ an icon you haven't used elsewhere in this app, confirm it exists by grepping
174
+ `node_modules/@tabler/icons-react/dist/tabler-icons-react.d.ts` (or the package's icon list)
175
+ for the exact name, and pick the closest real match if your first guess isn't there.
171
176
  - Keep inline help/info glyphs next to labels at `size-3` (12px) or smaller than the adjacent text. Preserve a larger hit area on the trigger, not the glyph. Use `guard:allow-large-help-icon` only for deliberate heading documentation or menu action exceptions.
172
177
  - Use `useActionQuery` and `useActionMutation` from `@agent-native/core/client` for action-backed UI. Standard CRUD should go through actions, not custom `/api/` routes.
173
178
  - Keep UI optimistic where possible: update cache and navigation immediately, then reconcile or roll back on mutation result.
@@ -168,6 +168,11 @@ the useful information remains dense and scannable.
168
168
  - Do not build custom dropdowns, menus, popovers, modals, or confirmations with manual absolute positioning and click-outside effects.
169
169
  - Never use browser dialogs (`window.alert`, `window.confirm`, `window.prompt`). Use `AlertDialog`, `Dialog`, or app-specific confirmation UI.
170
170
  - Use Tabler icons for all first-party UI icons. Do not add Lucide, Heroicons, inline SVG icon sets, or emoji icons.
171
+ - Never guess a Tabler icon name. Names like `IconPartyPopper` or `IconConfettiCannon` feel
172
+ plausible but don't exist and crash Vite with a "Named export not found" error. Before importing
173
+ an icon you haven't used elsewhere in this app, confirm it exists by grepping
174
+ `node_modules/@tabler/icons-react/dist/tabler-icons-react.d.ts` (or the package's icon list)
175
+ for the exact name, and pick the closest real match if your first guess isn't there.
171
176
  - Keep inline help/info glyphs next to labels at `size-3` (12px) or smaller than the adjacent text. Preserve a larger hit area on the trigger, not the glyph. Use `guard:allow-large-help-icon` only for deliberate heading documentation or menu action exceptions.
172
177
  - Use `useActionQuery` and `useActionMutation` from `@agent-native/core/client` for action-backed UI. Standard CRUD should go through actions, not custom `/api/` routes.
173
178
  - Keep UI optimistic where possible: update cache and navigation immediately, then reconcile or roll back on mutation result.
@@ -168,6 +168,11 @@ the useful information remains dense and scannable.
168
168
  - Do not build custom dropdowns, menus, popovers, modals, or confirmations with manual absolute positioning and click-outside effects.
169
169
  - Never use browser dialogs (`window.alert`, `window.confirm`, `window.prompt`). Use `AlertDialog`, `Dialog`, or app-specific confirmation UI.
170
170
  - Use Tabler icons for all first-party UI icons. Do not add Lucide, Heroicons, inline SVG icon sets, or emoji icons.
171
+ - Never guess a Tabler icon name. Names like `IconPartyPopper` or `IconConfettiCannon` feel
172
+ plausible but don't exist and crash Vite with a "Named export not found" error. Before importing
173
+ an icon you haven't used elsewhere in this app, confirm it exists by grepping
174
+ `node_modules/@tabler/icons-react/dist/tabler-icons-react.d.ts` (or the package's icon list)
175
+ for the exact name, and pick the closest real match if your first guess isn't there.
171
176
  - Keep inline help/info glyphs next to labels at `size-3` (12px) or smaller than the adjacent text. Preserve a larger hit area on the trigger, not the glyph. Use `guard:allow-large-help-icon` only for deliberate heading documentation or menu action exceptions.
172
177
  - Use `useActionQuery` and `useActionMutation` from `@agent-native/core/client` for action-backed UI. Standard CRUD should go through actions, not custom `/api/` routes.
173
178
  - Keep UI optimistic where possible: update cache and navigation immediately, then reconcile or roll back on mutation result.
@@ -168,6 +168,11 @@ the useful information remains dense and scannable.
168
168
  - Do not build custom dropdowns, menus, popovers, modals, or confirmations with manual absolute positioning and click-outside effects.
169
169
  - Never use browser dialogs (`window.alert`, `window.confirm`, `window.prompt`). Use `AlertDialog`, `Dialog`, or app-specific confirmation UI.
170
170
  - Use Tabler icons for all first-party UI icons. Do not add Lucide, Heroicons, inline SVG icon sets, or emoji icons.
171
+ - Never guess a Tabler icon name. Names like `IconPartyPopper` or `IconConfettiCannon` feel
172
+ plausible but don't exist and crash Vite with a "Named export not found" error. Before importing
173
+ an icon you haven't used elsewhere in this app, confirm it exists by grepping
174
+ `node_modules/@tabler/icons-react/dist/tabler-icons-react.d.ts` (or the package's icon list)
175
+ for the exact name, and pick the closest real match if your first guess isn't there.
171
176
  - Keep inline help/info glyphs next to labels at `size-3` (12px) or smaller than the adjacent text. Preserve a larger hit area on the trigger, not the glyph. Use `guard:allow-large-help-icon` only for deliberate heading documentation or menu action exceptions.
172
177
  - Use `useActionQuery` and `useActionMutation` from `@agent-native/core/client` for action-backed UI. Standard CRUD should go through actions, not custom `/api/` routes.
173
178
  - Keep UI optimistic where possible: update cache and navigation immediately, then reconcile or roll back on mutation result.
@@ -0,0 +1,127 @@
1
+ import { accessFilter } from "@agent-native/core/sharing";
2
+ import {
3
+ and,
4
+ eq,
5
+ exists,
6
+ isNotNull,
7
+ isNull,
8
+ notExists,
9
+ or,
10
+ type SQL,
11
+ } from "drizzle-orm";
12
+
13
+ import { getDb, schema } from "../server/db/index.js";
14
+ import { documentDiscoveryFilter } from "../server/lib/documents.js";
15
+
16
+ export const DOCUMENT_DISCOVERY_MAX_LIMIT = 200;
17
+ export const DOCUMENT_DISCOVERY_DEFAULT_LIMIT = 50;
18
+
19
+ export type DocumentDiscoveryType = "page" | "database";
20
+
21
+ export interface DocumentDiscoveryFilters {
22
+ userEmail: string | null | undefined;
23
+ authorizedOrgIds: string[];
24
+ exactTitle?: string;
25
+ parentId?: string | null;
26
+ spaceId?: string;
27
+ documentType?: DocumentDiscoveryType;
28
+ additional?: SQL;
29
+ }
30
+
31
+ export function documentDiscoveryWhere({
32
+ userEmail,
33
+ authorizedOrgIds,
34
+ exactTitle,
35
+ parentId,
36
+ spaceId,
37
+ documentType,
38
+ additional,
39
+ }: DocumentDiscoveryFilters) {
40
+ const db = getDb();
41
+ const accessContexts = [
42
+ { userEmail: userEmail ?? undefined },
43
+ ...authorizedOrgIds.map((orgId) => ({
44
+ userEmail: userEmail ?? undefined,
45
+ orgId,
46
+ })),
47
+ ];
48
+ const activeDatabaseDocument = db
49
+ .select({ id: schema.contentDatabases.id })
50
+ .from(schema.contentDatabases)
51
+ .where(
52
+ and(
53
+ eq(schema.contentDatabases.documentId, schema.documents.id),
54
+ isNull(schema.contentDatabases.deletedAt),
55
+ ),
56
+ );
57
+ const deletedDatabaseDocument = db
58
+ .select({ id: schema.contentDatabases.id })
59
+ .from(schema.contentDatabases)
60
+ .where(
61
+ and(
62
+ eq(schema.contentDatabases.documentId, schema.documents.id),
63
+ isNotNull(schema.contentDatabases.deletedAt),
64
+ ),
65
+ );
66
+ const deletedDatabaseMembership = db
67
+ .select({ id: schema.contentDatabaseItems.id })
68
+ .from(schema.contentDatabaseItems)
69
+ .innerJoin(
70
+ schema.contentDatabases,
71
+ eq(schema.contentDatabases.id, schema.contentDatabaseItems.databaseId),
72
+ )
73
+ .where(
74
+ and(
75
+ eq(schema.contentDatabaseItems.documentId, schema.documents.id),
76
+ isNotNull(schema.contentDatabases.deletedAt),
77
+ ),
78
+ );
79
+
80
+ return and(
81
+ or(
82
+ ...accessContexts.map((context) =>
83
+ accessFilter(schema.documents, schema.documentShares, context),
84
+ ),
85
+ ),
86
+ isNull(schema.documents.trashedAt),
87
+ documentDiscoveryFilter({
88
+ userEmail,
89
+ orgIds: authorizedOrgIds,
90
+ }),
91
+ notExists(deletedDatabaseDocument),
92
+ notExists(deletedDatabaseMembership),
93
+ exactTitle === undefined
94
+ ? undefined
95
+ : eq(schema.documents.title, exactTitle),
96
+ parentId === undefined
97
+ ? undefined
98
+ : parentId === null
99
+ ? isNull(schema.documents.parentId)
100
+ : eq(schema.documents.parentId, parentId),
101
+ spaceId === undefined ? undefined : eq(schema.documents.spaceId, spaceId),
102
+ documentType === "database"
103
+ ? exists(activeDatabaseDocument)
104
+ : documentType === "page"
105
+ ? notExists(activeDatabaseDocument)
106
+ : undefined,
107
+ additional,
108
+ );
109
+ }
110
+
111
+ export function documentDiscoveryPagination(args: {
112
+ offset: number;
113
+ limit: number;
114
+ totalItems: number;
115
+ returnedItems: number;
116
+ }) {
117
+ const nextOffset = args.offset + args.returnedItems;
118
+ const hasMore = nextOffset < args.totalItems;
119
+ return {
120
+ offset: args.offset,
121
+ limit: args.limit,
122
+ totalItems: args.totalItems,
123
+ returnedItems: args.returnedItems,
124
+ hasMore,
125
+ nextOffset: hasMore ? nextOffset : null,
126
+ };
127
+ }