@agent-native/core 0.161.1 → 0.161.4

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 (44) hide show
  1. package/corpus/templates/analytics/actions/compose-dashboard.ts +5 -2
  2. package/corpus/templates/analytics/actions/export-dashboard-panel-to-google-sheet.ts +11 -5
  3. package/corpus/templates/analytics/actions/migrate-first-party-analytics-to-bigquery.ts +89 -2
  4. package/corpus/templates/analytics/actions/update-dashboard.ts +14 -2
  5. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +6 -0
  6. package/corpus/templates/analytics/server/lib/dashboard-panel-query.ts +89 -41
  7. package/corpus/templates/analytics/server/lib/dashboard-panel-source-resolver.ts +8 -3
  8. package/corpus/templates/analytics/server/lib/error-capture.ts +6 -0
  9. package/corpus/templates/analytics/server/lib/first-party-analytics-backend.ts +187 -44
  10. package/corpus/templates/analytics/server/lib/first-party-analytics.ts +44 -16
  11. package/corpus/templates/clips/actions/save-browser-transcript.ts +20 -4
  12. package/corpus/templates/clips/app/components/meetings/transcript-bubbles.tsx +167 -35
  13. package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +8 -1
  14. package/corpus/templates/clips/desktop/src/lib/transcription-engine.ts +39 -2
  15. package/corpus/templates/slides/actions/list-decks.ts +36 -1
  16. package/corpus/templates/slides/app/context/DeckContext.tsx +17 -6
  17. package/dist/agent/engine/builder-engine.js +37 -19
  18. package/dist/agent/engine/types.d.ts +29 -0
  19. package/dist/agent/engine/types.js +6 -0
  20. package/dist/agent/production-agent.js +2 -0
  21. package/dist/agent/run-manager.d.ts +6 -0
  22. package/dist/agent/run-manager.js +27 -0
  23. package/dist/agent/run-store.d.ts +5 -5
  24. package/dist/agent/run-store.js +52 -15
  25. package/dist/client/AssistantChat.d.ts +1 -0
  26. package/dist/client/AssistantChat.js +10 -1
  27. package/dist/db/client.js +10 -2
  28. package/dist/db/create-get-db.js +42 -0
  29. package/dist/observability/routes.d.ts +3 -3
  30. package/dist/provider-api/actions/custom-provider-registration.d.ts +2 -2
  31. package/dist/resources/handlers.d.ts +1 -1
  32. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  33. package/dist/server/onboarding-html.js +22 -77
  34. package/dist/server/poll.d.ts +5 -5
  35. package/dist/server/poll.js +19 -26
  36. package/dist/server/release-migrations.js +4 -0
  37. package/dist/server/transcribe-voice.d.ts +1 -1
  38. package/dist/shared/auth-copy.d.ts +7 -0
  39. package/dist/shared/auth-copy.js +77 -0
  40. package/dist/shared/mcp-embed-headers.js +8 -4
  41. package/dist/vite/client.js +94 -3
  42. package/dist/workspace-connections/migrations.d.ts +18 -0
  43. package/dist/workspace-connections/migrations.js +153 -0
  44. package/package.json +1 -1
@@ -1451,6 +1451,66 @@ const EMBED_DEV_STATIC_ASSET_PATHS = new Set([
1451
1451
  "/favicon.svg",
1452
1452
  "/manifest.json",
1453
1453
  ]);
1454
+ const VITE_RUNTIME_MODULE_QUERY_KEYS = new Set([
1455
+ "commonjs-proxy",
1456
+ "direct",
1457
+ "html-proxy",
1458
+ "import",
1459
+ "inline",
1460
+ "inline-css",
1461
+ "no-inline",
1462
+ "raw",
1463
+ "sharedworker",
1464
+ "style-attr",
1465
+ "transform-only",
1466
+ "url",
1467
+ "worker",
1468
+ ]);
1469
+ const VITE_STATIC_ASSET_EXTENSIONS = new Set([
1470
+ ".aac",
1471
+ ".apng",
1472
+ ".avif",
1473
+ ".bmp",
1474
+ ".css",
1475
+ ".cur",
1476
+ ".eot",
1477
+ ".flac",
1478
+ ".gif",
1479
+ ".ico",
1480
+ ".jfif",
1481
+ ".jpeg",
1482
+ ".jpg",
1483
+ ".jxl",
1484
+ ".less",
1485
+ ".m4a",
1486
+ ".mp3",
1487
+ ".mp4",
1488
+ ".mov",
1489
+ ".ogg",
1490
+ ".otf",
1491
+ ".pjp",
1492
+ ".pjpeg",
1493
+ ".pcss",
1494
+ ".pdf",
1495
+ ".png",
1496
+ ".postcss",
1497
+ ".opus",
1498
+ ".sass",
1499
+ ".scss",
1500
+ ".svg",
1501
+ ".styl",
1502
+ ".stylus",
1503
+ ".ttf",
1504
+ ".txt",
1505
+ ".vtt",
1506
+ ".wasm",
1507
+ ".wav",
1508
+ ".webm",
1509
+ ".webp",
1510
+ ".webmanifest",
1511
+ ".woff",
1512
+ ".woff2",
1513
+ ]);
1454
1514
  function mountedPathCandidates(reqUrl, base) {
1455
1515
  if (!reqUrl)
1456
1516
  return [];
@@ -1528,9 +1588,38 @@ function mountedEmbedRuntimeModuleUrl(reqUrl, base) {
1528
1588
  if (!VITE_RUNTIME_PATH_PREFIXES.some((prefix) => url.pathname.startsWith(prefix))) {
1529
1589
  return null;
1530
1590
  }
1531
- url.searchParams.delete(EMBED_TOKEN_QUERY_PARAM);
1532
- url.searchParams.delete(MCP_APP_CHAT_BRIDGE_QUERY_PARAM);
1533
- return `${url.pathname}${url.search}${url.hash}`;
1591
+ // Vite distinguishes valueless module flags such as `?url` from `?url=`.
1592
+ // Strip only the embed controls so those flags reach Vite byte-for-byte.
1593
+ const hashStart = runtimeUrl.indexOf("#");
1594
+ const searchStart = runtimeUrl.indexOf("?");
1595
+ const search = searchStart >= 0 && (hashStart < 0 || searchStart < hashStart)
1596
+ ? runtimeUrl.slice(searchStart, hashStart < 0 ? undefined : hashStart)
1597
+ : "";
1598
+ return `${url.pathname}${stripMountedEmbedRuntimeQueryParams(search)}${url.hash}`;
1599
+ }
1600
+ function stripMountedEmbedRuntimeQueryParams(search) {
1601
+ if (!search)
1602
+ return "";
1603
+ const kept = search
1604
+ .slice(1)
1605
+ .split("&")
1606
+ .filter((pair) => {
1607
+ const key = pair.split("=", 1)[0];
1608
+ return (key !== EMBED_TOKEN_QUERY_PARAM &&
1609
+ key !== MCP_APP_CHAT_BRIDGE_QUERY_PARAM);
1610
+ });
1611
+ return kept.length > 0 ? `?${kept.join("&")}` : "";
1612
+ }
1613
+ function isMountedEmbedStaticAssetRequest(req, runtimeUrl) {
1614
+ const url = new URL(runtimeUrl, "http://agent-native.local");
1615
+ const isViteModuleQuery = [...url.searchParams.keys()].some((key) => VITE_RUNTIME_MODULE_QUERY_KEYS.has(key));
1616
+ if (isViteModuleQuery)
1617
+ return false;
1618
+ const fetchDestination = String(req.headers["sec-fetch-dest"] ?? "").toLowerCase();
1619
+ if (["audio", "font", "image", "style", "track", "video"].includes(fetchDestination)) {
1620
+ return true;
1621
+ }
1622
+ return VITE_STATIC_ASSET_EXTENSIONS.has(path.extname(url.pathname).toLowerCase());
1534
1623
  }
1535
1624
  function virtualModuleIdFromRuntimeUrl(runtimeUrl) {
1536
1625
  try {
@@ -1564,6 +1653,8 @@ function serveMountedEmbedRuntimeModule(server, req, res, base) {
1564
1653
  const runtimeUrl = mountedEmbedRuntimeModuleUrl(req.url, base);
1565
1654
  if (!runtimeUrl)
1566
1655
  return false;
1656
+ if (isMountedEmbedStaticAssetRequest(req, runtimeUrl))
1657
+ return false;
1567
1658
  void loadMountedEmbedRuntimeModule(server, runtimeUrl)
1568
1659
  .then((code) => {
1569
1660
  if (!code) {
@@ -0,0 +1,18 @@
1
+ import type { MigrationEntry } from "../db/migrations.js";
2
+ export declare const WORKSPACE_CONNECTIONS_MIGRATIONS_TABLE = "_workspace_connections_migrations";
3
+ /**
4
+ * Deploy-time schema for workspace connections, grants, and user groups.
5
+ *
6
+ * These three tables were shipped with only their runtime `ensureTable`
7
+ * helpers in `store.ts` / `groups.ts`. That is enough locally and on a
8
+ * long-lived server, but `schemaEnsureDisabled()` makes every probe report
9
+ * "present" on a production serverless runtime, so the ensure path issues no
10
+ * DDL there at all. A table with no entry here therefore never gets created in
11
+ * production, and the first read fails with `relation ... does not exist` —
12
+ * which is exactly what `workspace_user_groups` did from the day after it
13
+ * shipped. Runtime ensure covers dev; this list is the production contract.
14
+ *
15
+ * `created_at` / `updated_at` must be BIGINT on Postgres: they store epoch
16
+ * milliseconds, which overflow int4.
17
+ */
18
+ export declare const WORKSPACE_CONNECTIONS_MIGRATIONS: MigrationEntry[];
@@ -0,0 +1,153 @@
1
+ export const WORKSPACE_CONNECTIONS_MIGRATIONS_TABLE = "_workspace_connections_migrations";
2
+ /**
3
+ * Deploy-time schema for workspace connections, grants, and user groups.
4
+ *
5
+ * These three tables were shipped with only their runtime `ensureTable`
6
+ * helpers in `store.ts` / `groups.ts`. That is enough locally and on a
7
+ * long-lived server, but `schemaEnsureDisabled()` makes every probe report
8
+ * "present" on a production serverless runtime, so the ensure path issues no
9
+ * DDL there at all. A table with no entry here therefore never gets created in
10
+ * production, and the first read fails with `relation ... does not exist` —
11
+ * which is exactly what `workspace_user_groups` did from the day after it
12
+ * shipped. Runtime ensure covers dev; this list is the production contract.
13
+ *
14
+ * `created_at` / `updated_at` must be BIGINT on Postgres: they store epoch
15
+ * milliseconds, which overflow int4.
16
+ */
17
+ export const WORKSPACE_CONNECTIONS_MIGRATIONS = [
18
+ {
19
+ version: 1,
20
+ sql: {
21
+ postgres: `CREATE TABLE IF NOT EXISTS workspace_connections (
22
+ id TEXT PRIMARY KEY,
23
+ provider TEXT NOT NULL DEFAULT '',
24
+ label TEXT NOT NULL DEFAULT '',
25
+ account_id TEXT,
26
+ account_label TEXT,
27
+ status TEXT NOT NULL DEFAULT 'connected',
28
+ scopes_json TEXT NOT NULL DEFAULT '[]',
29
+ config_json TEXT NOT NULL DEFAULT '{}',
30
+ allowed_apps_json TEXT NOT NULL DEFAULT '[]',
31
+ allowed_users_json TEXT NOT NULL DEFAULT '[]',
32
+ allowed_user_groups_json TEXT NOT NULL DEFAULT '[]',
33
+ credential_refs_json TEXT NOT NULL DEFAULT '[]',
34
+ owner_email TEXT NOT NULL DEFAULT '',
35
+ org_id TEXT,
36
+ created_at BIGINT NOT NULL DEFAULT 0,
37
+ updated_at BIGINT NOT NULL DEFAULT 0,
38
+ last_used_at BIGINT,
39
+ last_checked_at BIGINT,
40
+ last_error TEXT
41
+ )`,
42
+ sqlite: `CREATE TABLE IF NOT EXISTS workspace_connections (
43
+ id TEXT PRIMARY KEY,
44
+ provider TEXT NOT NULL DEFAULT '',
45
+ label TEXT NOT NULL DEFAULT '',
46
+ account_id TEXT,
47
+ account_label TEXT,
48
+ status TEXT NOT NULL DEFAULT 'connected',
49
+ scopes_json TEXT NOT NULL DEFAULT '[]',
50
+ config_json TEXT NOT NULL DEFAULT '{}',
51
+ allowed_apps_json TEXT NOT NULL DEFAULT '[]',
52
+ allowed_users_json TEXT NOT NULL DEFAULT '[]',
53
+ allowed_user_groups_json TEXT NOT NULL DEFAULT '[]',
54
+ credential_refs_json TEXT NOT NULL DEFAULT '[]',
55
+ owner_email TEXT NOT NULL DEFAULT '',
56
+ org_id TEXT,
57
+ created_at INTEGER NOT NULL DEFAULT 0,
58
+ updated_at INTEGER NOT NULL DEFAULT 0,
59
+ last_used_at INTEGER,
60
+ last_checked_at INTEGER,
61
+ last_error TEXT
62
+ )`,
63
+ },
64
+ },
65
+ {
66
+ version: 2,
67
+ sql: `CREATE INDEX IF NOT EXISTS idx_workspace_connections_scope_provider
68
+ ON workspace_connections (org_id, owner_email, provider)`,
69
+ },
70
+ {
71
+ version: 3,
72
+ sql: `CREATE INDEX IF NOT EXISTS idx_workspace_connections_updated_at
73
+ ON workspace_connections (updated_at)`,
74
+ },
75
+ {
76
+ version: 4,
77
+ sql: {
78
+ postgres: `CREATE TABLE IF NOT EXISTS workspace_connection_grants (
79
+ id TEXT PRIMARY KEY,
80
+ connection_id TEXT NOT NULL DEFAULT '',
81
+ provider TEXT NOT NULL DEFAULT '',
82
+ app_id TEXT NOT NULL DEFAULT '',
83
+ scopes_json TEXT NOT NULL DEFAULT '[]',
84
+ config_json TEXT NOT NULL DEFAULT '{}',
85
+ credential_refs_json TEXT NOT NULL DEFAULT '[]',
86
+ granted_by_email TEXT NOT NULL DEFAULT '',
87
+ owner_email TEXT NOT NULL DEFAULT '',
88
+ org_id TEXT,
89
+ created_at BIGINT NOT NULL DEFAULT 0,
90
+ updated_at BIGINT NOT NULL DEFAULT 0,
91
+ last_used_at BIGINT
92
+ )`,
93
+ sqlite: `CREATE TABLE IF NOT EXISTS workspace_connection_grants (
94
+ id TEXT PRIMARY KEY,
95
+ connection_id TEXT NOT NULL DEFAULT '',
96
+ provider TEXT NOT NULL DEFAULT '',
97
+ app_id TEXT NOT NULL DEFAULT '',
98
+ scopes_json TEXT NOT NULL DEFAULT '[]',
99
+ config_json TEXT NOT NULL DEFAULT '{}',
100
+ credential_refs_json TEXT NOT NULL DEFAULT '[]',
101
+ granted_by_email TEXT NOT NULL DEFAULT '',
102
+ owner_email TEXT NOT NULL DEFAULT '',
103
+ org_id TEXT,
104
+ created_at INTEGER NOT NULL DEFAULT 0,
105
+ updated_at INTEGER NOT NULL DEFAULT 0,
106
+ last_used_at INTEGER
107
+ )`,
108
+ },
109
+ },
110
+ {
111
+ version: 5,
112
+ sql: `CREATE UNIQUE INDEX IF NOT EXISTS idx_workspace_connection_grants_connection_app
113
+ ON workspace_connection_grants (connection_id, app_id)`,
114
+ },
115
+ {
116
+ version: 6,
117
+ sql: `CREATE INDEX IF NOT EXISTS idx_workspace_connection_grants_scope_app
118
+ ON workspace_connection_grants (org_id, owner_email, app_id)`,
119
+ },
120
+ {
121
+ version: 7,
122
+ sql: `CREATE INDEX IF NOT EXISTS idx_workspace_connection_grants_updated_at
123
+ ON workspace_connection_grants (updated_at)`,
124
+ },
125
+ {
126
+ version: 8,
127
+ sql: {
128
+ postgres: `CREATE TABLE IF NOT EXISTS workspace_user_groups (
129
+ id TEXT PRIMARY KEY,
130
+ org_id TEXT NOT NULL DEFAULT '',
131
+ name TEXT NOT NULL DEFAULT '',
132
+ member_emails_json TEXT NOT NULL DEFAULT '[]',
133
+ created_by_email TEXT NOT NULL DEFAULT '',
134
+ created_at BIGINT NOT NULL DEFAULT 0,
135
+ updated_at BIGINT NOT NULL DEFAULT 0
136
+ )`,
137
+ sqlite: `CREATE TABLE IF NOT EXISTS workspace_user_groups (
138
+ id TEXT PRIMARY KEY,
139
+ org_id TEXT NOT NULL DEFAULT '',
140
+ name TEXT NOT NULL DEFAULT '',
141
+ member_emails_json TEXT NOT NULL DEFAULT '[]',
142
+ created_by_email TEXT NOT NULL DEFAULT '',
143
+ created_at INTEGER NOT NULL DEFAULT 0,
144
+ updated_at INTEGER NOT NULL DEFAULT 0
145
+ )`,
146
+ },
147
+ },
148
+ {
149
+ version: 9,
150
+ sql: `CREATE INDEX IF NOT EXISTS idx_workspace_user_groups_org_updated
151
+ ON workspace_user_groups (org_id, updated_at)`,
152
+ },
153
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.161.1",
3
+ "version": "0.161.4",
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": {