@agent-native/core 0.175.4 → 0.175.5-nightly-20260827014436

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 (202) hide show
  1. package/corpus/templates/analytics/actions/get-explorer-dashboard.ts +1 -0
  2. package/corpus/templates/analytics/app/components/auth/AuthProvider.tsx +8 -6
  3. package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +32 -0
  4. package/corpus/templates/analytics/app/components/layout/Layout.tsx +1 -1
  5. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +66 -7
  6. package/corpus/templates/analytics/app/lib/prefetch-keys.ts +10 -0
  7. package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +9 -7
  8. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +10 -11
  9. package/corpus/templates/analytics/changelog/2026-08-24-feature-flag-changes-recover-from-temporary-workspace-direct.md +6 -0
  10. package/corpus/templates/analytics/changelog/2026-08-26-analytics-distinguishes-daily-from-weekly-activity-shows-sta.md +6 -0
  11. package/corpus/templates/analytics/changelog/2026-08-26-dashboard-metadata-now-shows-the-original-creator-separately.md +6 -0
  12. package/corpus/templates/analytics/changelog/2026-08-26-dashboard-names-stay-editable-when-the-analytics-sidebar-ref.md +6 -0
  13. package/corpus/templates/analytics/changelog/2026-08-26-fixed-the-agent-re-asking-dashboard-scope-questions-you-had-.md +6 -0
  14. package/corpus/templates/analytics/server/db/schema.ts +2 -0
  15. package/corpus/templates/analytics/server/lib/agent-readable-resource-context.ts +8 -2
  16. package/corpus/templates/analytics/server/lib/dashboards-store.ts +5 -0
  17. package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +6 -4
  18. package/corpus/templates/analytics/server/lib/migrate-analytics-artifacts.ts +19 -1
  19. package/corpus/templates/analytics/server/lib/workspace-feature-flags.ts +40 -9
  20. package/corpus/templates/analytics/server/plugins/db.ts +10 -0
  21. package/corpus/templates/analytics/server/routes/api/dashboard-agent-context.json.get.ts +1 -0
  22. package/corpus/templates/analytics/shared/feature-flags.ts +11 -1
  23. package/corpus/templates/calendar/app/components/calendar/GoogleConnectBanner.tsx +2 -9
  24. package/corpus/templates/clips/.agents/skills/ai-video-tools/SKILL.md +8 -7
  25. package/corpus/templates/clips/.agents/skills/recording/SKILL.md +9 -8
  26. package/corpus/templates/clips/actions/import-loom-recording.ts +1 -1
  27. package/corpus/templates/clips/actions/lib/loom-import-job.ts +52 -35
  28. package/corpus/templates/clips/actions/request-transcript.ts +6 -183
  29. package/corpus/templates/clips/app/components/clips-avatar.tsx +46 -0
  30. package/corpus/templates/clips/app/components/library/recording-card.tsx +8 -7
  31. package/corpus/templates/clips/app/components/library/space-card.tsx +8 -5
  32. package/corpus/templates/clips/app/components/meetings/attendee-stack.tsx +7 -8
  33. package/corpus/templates/clips/app/components/meetings/transcript-bubbles.tsx +19 -12
  34. package/corpus/templates/clips/app/components/player/transcript-panel.tsx +128 -94
  35. package/corpus/templates/clips/app/components/recorder/microphone-visualizer.tsx +25 -104
  36. package/corpus/templates/clips/app/components/workspace/members-list.tsx +8 -6
  37. package/corpus/templates/clips/app/components/workspace/notifications-list.tsx +8 -6
  38. package/corpus/templates/clips/app/components/workspace/top-creators-table.tsx +8 -6
  39. package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +8 -7
  40. package/corpus/templates/clips/app/routes/_app.settings._index.tsx +0 -26
  41. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +1 -4
  42. package/corpus/templates/clips/changelog/2026-08-26-detected-calls-no-longer-duplicate-meetings-or-strand-the-prompt.md +6 -0
  43. package/corpus/templates/clips/desktop/src/app.tsx +8 -10
  44. package/corpus/templates/clips/desktop/src/components/live-waveform.tsx +99 -0
  45. package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +248 -55
  46. package/corpus/templates/clips/desktop/src/lib/agent-steps.ts +477 -0
  47. package/corpus/templates/clips/desktop/src/lib/ask-sheet-layout.ts +71 -0
  48. package/corpus/templates/clips/desktop/src/lib/meeting-ask.ts +297 -0
  49. package/corpus/templates/clips/desktop/src/lib/url.ts +24 -0
  50. package/corpus/templates/clips/desktop/src/overlays/ask-steps.tsx +155 -0
  51. package/corpus/templates/clips/desktop/src/overlays/flow-bar.tsx +7 -81
  52. package/corpus/templates/clips/desktop/src/overlays/live-transcript.tsx +29 -2
  53. package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +80 -22
  54. package/corpus/templates/clips/desktop/src/overlays/record-pill.tsx +13 -53
  55. package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +1017 -82
  56. package/corpus/templates/clips/desktop/src/styles.css +796 -57
  57. package/corpus/templates/clips/desktop/src/tailwind.css +23 -2
  58. package/corpus/templates/clips/desktop/src-tauri/src/adhoc_meetings_watcher.rs +1765 -219
  59. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +6 -0
  60. package/corpus/templates/clips/desktop/src-tauri/src/meetings_watcher.rs +45 -30
  61. package/corpus/templates/clips/desktop/src-tauri/src/native_screen/custom_capture.rs +5 -3
  62. package/corpus/templates/clips/desktop/src-tauri/src/notifications.rs +91 -0
  63. package/corpus/templates/clips/desktop/src-tauri/src/recording_indicator.rs +123 -27
  64. package/corpus/templates/clips/server/routes/_agent-native/google/callback.get.ts +16 -0
  65. package/corpus/templates/clips/shared/audio-meter.ts +145 -0
  66. package/corpus/templates/clips/shared/clips-ai-prefs.ts +0 -1
  67. package/corpus/templates/clips/shared/live-waveform.tsx +119 -0
  68. package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +44 -22
  69. package/corpus/templates/content/app/components/ui/avatar.tsx +1 -0
  70. package/corpus/templates/design/app/components/visual-editor/ReviewCanvasPins.tsx +4 -1
  71. package/corpus/templates/design/app/hooks/use-question-flow.ts +9 -2
  72. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +111 -37
  73. package/corpus/templates/design/changelog/2026-08-26-design-no-longer-asks-users-to-confirm-guided-questions-they-have-already-answered.md +6 -0
  74. package/corpus/templates/dispatch/changelog/2026-08-26-signing-out-goes-straight-to-the-sign-in-page.md +5 -0
  75. package/corpus/templates/dispatch/server/lib/org-apps-directory.ts +96 -47
  76. package/corpus/templates/dispatch/server/plugins/org-apps-directory.ts +73 -29
  77. package/corpus/templates/factory/.env.example +6 -2
  78. package/corpus/templates/factory/AGENTS.md +3 -3
  79. package/corpus/templates/factory/README.md +4 -2
  80. package/corpus/templates/factory/server/connectors/credentials.ts +70 -4
  81. package/corpus/templates/mail/actions/get-email.ts +68 -21
  82. package/corpus/templates/mail/actions/get-thread.ts +92 -51
  83. package/corpus/templates/mail/app/components/GoogleConnectBanner.tsx +2 -9
  84. package/corpus/templates/mail/app/hooks/use-emails.ts +7 -4
  85. package/corpus/templates/mail/server/lib/mail-connector-catalog.ts +7 -4
  86. package/corpus/templates/plan/app/pages/PlansPage.tsx +23 -15
  87. package/corpus/templates/slides/actions/add-deck.ts +20 -0
  88. package/corpus/templates/slides/actions/create-deck.ts +17 -7
  89. package/corpus/templates/slides/actions/delete-deck.ts +45 -5
  90. package/corpus/templates/slides/actions/get-deck.ts +77 -11
  91. package/corpus/templates/slides/actions/patch-deck.ts +14 -2
  92. package/corpus/templates/slides/actions/save-deck.ts +20 -0
  93. package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +18 -7
  94. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +38 -14
  95. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +2 -2
  96. package/corpus/templates/slides/app/components/ui/avatar.tsx +1 -0
  97. package/corpus/templates/slides/server/handlers/decks.ts +10 -0
  98. package/corpus/templates/slides/shared/slide-ids.ts +133 -0
  99. package/corpus/templates/tasks/DEVELOPING.md +8 -0
  100. package/corpus/templates/tasks/drizzle.config.ts +3 -1
  101. package/corpus/templates/tasks/drizzle.local.config.ts +6 -0
  102. package/corpus/templates/tasks/package.json +2 -1
  103. package/corpus/templates/tasks/server/db/migrations/meta/0000_snapshot.json +234 -0
  104. package/corpus/templates/tasks/server/db/migrations/meta/_journal.json +13 -0
  105. package/corpus/templates/tasks/server/db/migrations.ts +110 -0
  106. package/corpus/templates/tasks/server/plugins/db.ts +3 -87
  107. package/dist/client/AssistantChat.js +3 -10
  108. package/dist/client/guided-questions.d.ts +11 -1
  109. package/dist/client/guided-questions.js +24 -7
  110. package/dist/client/hooks/index.d.ts +2 -1
  111. package/dist/client/hooks/index.js +2 -1
  112. package/dist/client/org/OrgSwitcher.js +3 -17
  113. package/dist/client/review/ReviewThreadPanel.js +4 -2
  114. package/dist/client/sign-out.d.ts +15 -0
  115. package/dist/client/sign-out.js +82 -0
  116. package/dist/client/use-action.d.ts +2 -0
  117. package/dist/client/use-action.js +4 -2
  118. package/dist/client/use-session.d.ts +23 -1
  119. package/dist/client/use-session.js +46 -0
  120. package/dist/collab/client.js +20 -5
  121. package/dist/collab/presence.d.ts +3 -1
  122. package/dist/collab/presence.js +48 -45
  123. package/dist/collab/routes.d.ts +1 -1
  124. package/dist/db/drizzle-config.d.ts +7 -0
  125. package/dist/db/drizzle-config.js +35 -9
  126. package/dist/db/drizzle-migrations.d.ts +28 -0
  127. package/dist/db/drizzle-migrations.js +81 -0
  128. package/dist/db/index.d.ts +1 -1
  129. package/dist/db/migrations.d.ts +13 -1
  130. package/dist/db/migrations.js +60 -31
  131. package/dist/db/schema.js +4 -1
  132. package/dist/deploy/build.d.ts +6 -0
  133. package/dist/deploy/build.js +41 -0
  134. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  135. package/dist/mcp/index.d.ts +1 -1
  136. package/dist/mcp/index.js +1 -1
  137. package/dist/mcp/org-directory.d.ts +19 -7
  138. package/dist/mcp/org-directory.js +92 -68
  139. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  140. package/dist/notifications/routes.d.ts +3 -3
  141. package/dist/org/context.d.ts +6 -0
  142. package/dist/org/context.js +22 -0
  143. package/dist/org/index.d.ts +1 -1
  144. package/dist/org/index.js +1 -1
  145. package/dist/resources/store.d.ts +12 -0
  146. package/dist/resources/store.js +55 -0
  147. package/dist/server/agent-discovery.d.ts +18 -2
  148. package/dist/server/agent-discovery.js +191 -22
  149. package/dist/server/auth.js +3 -2
  150. package/dist/server/builder-browser.d.ts +0 -4
  151. package/dist/server/builder-browser.js +23 -8
  152. package/dist/server/google-oauth.d.ts +18 -0
  153. package/dist/server/google-oauth.js +3 -3
  154. package/dist/server/onboarding-html.js +3 -3
  155. package/dist/server/poll.d.ts +4 -2
  156. package/dist/server/poll.js +8 -3
  157. package/dist/server/realtime-token.d.ts +1 -1
  158. package/dist/server/short-lived-token.d.ts +1 -1
  159. package/dist/server/short-lived-token.js +1 -1
  160. package/dist/shared/environment-lanes.d.ts +1 -0
  161. package/dist/shared/environment-lanes.js +1 -0
  162. package/dist/shared/google-profile-image.d.ts +2 -0
  163. package/dist/shared/google-profile-image.js +24 -0
  164. package/dist/shared/index.d.ts +1 -0
  165. package/dist/shared/index.js +1 -0
  166. package/dist/styles/agent-conversation.css +13 -0
  167. package/docs/content/creating-templates.mdx +10 -1
  168. package/docs/content/server-database.mdx +49 -3
  169. package/docs/content/server-plugins.mdx +39 -3
  170. package/docs/content/webmcp.mdx +2 -0
  171. package/package.json +2 -1
  172. package/corpus/templates/analytics/data/explorer-configs/_autosave.json +0 -18
  173. package/corpus/templates/analytics/data/explorer-configs/steve-chart.json +0 -18
  174. package/corpus/templates/analytics/data/explorer-dashboards/dashboard-1773260837897.json +0 -10
  175. package/corpus/templates/analytics/data/sync-config.json +0 -8
  176. package/corpus/templates/brain/data/sync-config.json +0 -1
  177. package/corpus/templates/calendar/data/availability.json +0 -32
  178. package/corpus/templates/calendar/data/settings.json +0 -6
  179. package/corpus/templates/calendar/data/sync-config.json +0 -10
  180. package/corpus/templates/chat/data/sync-config.json +0 -1
  181. package/corpus/templates/clips/data/sync-config.json +0 -1
  182. package/corpus/templates/clips/desktop/src/lib/audio-meter.ts +0 -80
  183. package/corpus/templates/clips/desktop/src/overlays/live-audio-bars.tsx +0 -113
  184. package/corpus/templates/design/data/sync-config.json +0 -1
  185. package/corpus/templates/factory/data/sync-config.json +0 -1
  186. package/corpus/templates/forms/data/settings.json +0 -8
  187. package/corpus/templates/forms/data/sync-config.json +0 -3
  188. package/corpus/templates/macros/data/sync-config.json +0 -4
  189. package/corpus/templates/mail/data/emails.defaults.json +0 -1
  190. package/corpus/templates/mail/data/labels.defaults.json +0 -59
  191. package/corpus/templates/mail/data/settings.defaults.json +0 -9
  192. package/corpus/templates/mail/data/sync-config.json +0 -8
  193. package/corpus/templates/slides/data/sync-config.json +0 -8
  194. package/corpus/templates/tasks/data/sync-config.json +0 -1
  195. package/dist/templates/chat/data/.gitkeep +0 -0
  196. package/dist/templates/chat/data/sync-config.json +0 -1
  197. package/dist/templates/default/data/.gitkeep +0 -0
  198. package/dist/templates/default/data/sync-config.json +0 -1
  199. package/src/templates/chat/data/.gitkeep +0 -0
  200. package/src/templates/chat/data/sync-config.json +0 -1
  201. package/src/templates/default/data/.gitkeep +0 -0
  202. package/src/templates/default/data/sync-config.json +0 -1
@@ -46,6 +46,18 @@ function escapeLike(value) {
46
46
  function prefixLike(value) {
47
47
  return `${escapeLike(value)}%`;
48
48
  }
49
+ function isMissingResourceSchemaError(error) {
50
+ const candidate = error;
51
+ if (candidate?.code === "42P01" || candidate?.code === "42703")
52
+ return true;
53
+ const message = typeof candidate?.message === "string"
54
+ ? candidate.message.toLowerCase()
55
+ : "";
56
+ return (message.includes("no such table: resources") ||
57
+ message.includes("no such column:") ||
58
+ message.includes('relation "resources" does not exist') ||
59
+ (message.includes("column") && message.includes("does not exist")));
60
+ }
49
61
  let _initPromise;
50
62
  let _lastScratchCleanupAt = 0;
51
63
  const AGENT_SCRATCH_TTL_MS = 24 * 60 * 60 * 1000;
@@ -1297,6 +1309,49 @@ export async function resourceList(owner, pathPrefix, options) {
1297
1309
  });
1298
1310
  return mergeResourceMetas(local, mergeResourceMetas(resources, granted.map(resourceToMeta)));
1299
1311
  }
1312
+ /**
1313
+ * Read complete resource bodies for a small set of owners and path prefixes in
1314
+ * one projected query. Directory discovery uses this instead of listing
1315
+ * metadata and then issuing one content query per manifest.
1316
+ */
1317
+ export async function resourceListContentByOwnersAndPrefixes(owners, pathPrefixes) {
1318
+ const uniqueOwners = [...new Set(owners.filter(Boolean))];
1319
+ const uniquePrefixes = [...new Set(pathPrefixes.filter(Boolean))];
1320
+ if (uniqueOwners.length === 0 || uniquePrefixes.length === 0)
1321
+ return [];
1322
+ const client = getDbExec();
1323
+ const ownerSql = uniqueOwners.map(() => "?").join(", ");
1324
+ const prefixSql = uniquePrefixes
1325
+ .map(() => "path LIKE ? ESCAPE '!'")
1326
+ .join(" OR ");
1327
+ const query = {
1328
+ sql: `SELECT id, path, owner, content FROM resources WHERE owner IN (${ownerSql}) AND (${prefixSql})${scratchFilterSql()}`,
1329
+ args: [
1330
+ ...uniqueOwners,
1331
+ ...uniquePrefixes.map((prefix) => prefixLike(prefix)),
1332
+ ],
1333
+ };
1334
+ let rows;
1335
+ try {
1336
+ ({ rows } = await client.execute(query));
1337
+ }
1338
+ catch (error) {
1339
+ // Healthy hosted databases already have the resources schema. Avoid the
1340
+ // schema-assurance path on every cold directory request, but retain lazy
1341
+ // initialization for a genuinely fresh local or self-hosted database.
1342
+ if (!isMissingResourceSchemaError(error))
1343
+ throw error;
1344
+ await ensureTable();
1345
+ ({ rows } = await client.execute(query));
1346
+ }
1347
+ scheduleExpiredAgentScratchCleanup(client);
1348
+ return rows.map((row) => ({
1349
+ id: String(row.id),
1350
+ path: String(row.path),
1351
+ owner: String(row.owner),
1352
+ content: String(row.content),
1353
+ }));
1354
+ }
1300
1355
  export async function resourceListAccessible(userEmail, pathPrefix, options) {
1301
1356
  const organizationOwner = sharedResourceOwner(options?.orgId);
1302
1357
  const [personal, organization, legacyShared, workspace] = await Promise.all([
@@ -6,6 +6,13 @@ export interface DiscoveredAgent {
6
6
  url: string;
7
7
  color: string;
8
8
  }
9
+ export type OrgDirectoryDiscoveryResult = {
10
+ status: "available";
11
+ agents: DiscoveredAgent[];
12
+ } | {
13
+ status: "unavailable";
14
+ reason: "remote-manifests" | "workspace-metadata";
15
+ };
9
16
  export interface WorkspaceAppMetadataOverride {
10
17
  name?: string;
11
18
  description?: string;
@@ -36,7 +43,7 @@ export declare function workspaceAppMetadataSettingsKey(input?: {
36
43
  orgId?: string | null;
37
44
  userEmail?: string | null;
38
45
  }): string | null;
39
- export declare function parseWorkspaceAppMetadataSettings(raw: unknown): WorkspaceAppMetadataSettings;
46
+ export declare function parseWorkspaceAppMetadataSettings(raw: unknown, strict?: boolean): WorkspaceAppMetadataSettings;
40
47
  export declare function readWorkspaceAppMetadataSettings(): Promise<WorkspaceAppMetadataSettings>;
41
48
  export declare function writeWorkspaceAppMetadataOverride(input: {
42
49
  appId: string;
@@ -63,7 +70,7 @@ export declare function applyWorkspaceAppMetadataOverride<T extends {
63
70
  * restart). Reading only the env var would silently downgrade the behavior
64
71
  * in both cases.
65
72
  */
66
- export declare function loadWorkspaceAppsManifest(): WorkspaceAppManifestEntry[] | null;
73
+ export declare function loadWorkspaceAppsManifest(strict?: boolean): WorkspaceAppManifestEntry[] | null;
67
74
  export declare function shouldIncludeRemoteAgentManifest(manifest: {
68
75
  id?: string | null;
69
76
  }, selfAppId?: string): boolean;
@@ -80,6 +87,15 @@ export declare function getBuiltinAgents(selfAppId?: string, options?: {
80
87
  export declare function discoverAgents(selfAppId?: string, options?: {
81
88
  preferLocalUrls?: boolean;
82
89
  }): Promise<DiscoveredAgent[]>;
90
+ /**
91
+ * Complete-or-fail discovery for the authenticated organization directory.
92
+ * Generic agent discovery intentionally remains best-effort; this sibling
93
+ * avoids its N+1 manifest reads and never reports a failed authoritative
94
+ * layer as a successful partial directory.
95
+ */
96
+ export declare function discoverOrgDirectoryAgents(selfAppId?: string, options?: {
97
+ preferLocalUrls?: boolean;
98
+ }): Promise<OrgDirectoryDiscoveryResult>;
83
99
  /**
84
100
  * Look up a single agent by ID or name (case-insensitive).
85
101
  */
@@ -59,10 +59,23 @@ export function workspaceAppMetadataSettingsKey(input) {
59
59
  function cleanOptionalText(value) {
60
60
  return typeof value === "string" && value.trim() ? value.trim() : undefined;
61
61
  }
62
- export function parseWorkspaceAppMetadataSettings(raw) {
62
+ export function parseWorkspaceAppMetadataSettings(raw, strict = false) {
63
+ if (strict &&
64
+ raw !== null &&
65
+ raw !== undefined &&
66
+ (typeof raw !== "object" || Array.isArray(raw))) {
67
+ throw new Error("Invalid workspace app metadata settings");
68
+ }
63
69
  const record = raw && typeof raw === "object" && !Array.isArray(raw)
64
70
  ? raw
65
71
  : {};
72
+ if (strict &&
73
+ record.apps !== undefined &&
74
+ (record.apps === null ||
75
+ typeof record.apps !== "object" ||
76
+ Array.isArray(record.apps))) {
77
+ throw new Error("Invalid workspace app metadata apps map");
78
+ }
66
79
  const rawApps = record.apps &&
67
80
  typeof record.apps === "object" &&
68
81
  !Array.isArray(record.apps)
@@ -73,9 +86,26 @@ export function parseWorkspaceAppMetadataSettings(raw) {
73
86
  for (const [rawId, value] of Object.entries(rawApps)) {
74
87
  const id = rawId.trim();
75
88
  const normalizedId = id ? normalizeAgentId(id) : "";
76
- if (!normalizedId || !value || typeof value !== "object")
89
+ if (!normalizedId ||
90
+ !value ||
91
+ typeof value !== "object" ||
92
+ Array.isArray(value)) {
93
+ if (strict)
94
+ throw new Error("Invalid workspace app metadata entry");
77
95
  continue;
96
+ }
78
97
  const item = value;
98
+ if (strict &&
99
+ ((item.name !== undefined && typeof item.name !== "string") ||
100
+ (item.description !== undefined &&
101
+ typeof item.description !== "string") ||
102
+ (item.generated !== undefined && typeof item.generated !== "boolean") ||
103
+ (item.sourcePrompt !== undefined &&
104
+ typeof item.sourcePrompt !== "string") ||
105
+ (item.updatedAt !== undefined && typeof item.updatedAt !== "string") ||
106
+ (item.updatedBy !== undefined && typeof item.updatedBy !== "string"))) {
107
+ throw new Error("Invalid workspace app metadata fields");
108
+ }
79
109
  const override = {};
80
110
  const name = cleanOptionalText(item.name);
81
111
  const description = cleanOptionalText(item.description);
@@ -106,14 +136,19 @@ export function parseWorkspaceAppMetadataSettings(raw) {
106
136
  return { apps };
107
137
  }
108
138
  export async function readWorkspaceAppMetadataSettings() {
139
+ return readWorkspaceAppMetadataSettingsInternal(false);
140
+ }
141
+ async function readWorkspaceAppMetadataSettingsInternal(strict) {
109
142
  const key = workspaceAppMetadataSettingsKey();
110
143
  if (!key)
111
144
  return { apps: {} };
112
145
  try {
113
146
  const { getSetting } = await import("../settings/index.js");
114
- return parseWorkspaceAppMetadataSettings(await getSetting(key));
147
+ return parseWorkspaceAppMetadataSettings(await getSetting(key), strict);
115
148
  }
116
- catch {
149
+ catch (error) {
150
+ if (strict)
151
+ throw error;
117
152
  return { apps: {} };
118
153
  }
119
154
  }
@@ -184,10 +219,10 @@ export function applyWorkspaceAppMetadataOverride(app, settings) {
184
219
  * restart). Reading only the env var would silently downgrade the behavior
185
220
  * in both cases.
186
221
  */
187
- export function loadWorkspaceAppsManifest() {
188
- return (readWorkspaceAppsFromEnv() ??
189
- readWorkspaceAppsFromManifestFile() ??
190
- readWorkspaceAppsFromFilesystem());
222
+ export function loadWorkspaceAppsManifest(strict = false) {
223
+ return (readWorkspaceAppsFromEnv(strict) ??
224
+ readWorkspaceAppsFromManifestFile(strict) ??
225
+ readWorkspaceAppsFromFilesystem(strict));
191
226
  }
192
227
  export function shouldIncludeRemoteAgentManifest(manifest, selfAppId) {
193
228
  const id = manifest.id?.trim();
@@ -312,6 +347,126 @@ export async function discoverAgents(selfAppId, options) {
312
347
  }
313
348
  return Array.from(agentsById.values());
314
349
  }
350
+ /**
351
+ * Complete-or-fail discovery for the authenticated organization directory.
352
+ * Generic agent discovery intentionally remains best-effort; this sibling
353
+ * avoids its N+1 manifest reads and never reports a failed authoritative
354
+ * layer as a successful partial directory.
355
+ */
356
+ export async function discoverOrgDirectoryAgents(selfAppId, options) {
357
+ const agentsById = new Map();
358
+ for (const agent of getBuiltinAgents(selfAppId, options)) {
359
+ agentsById.set(agent.id, agent);
360
+ }
361
+ const [remoteResources, workspaceAgents] = await Promise.all([
362
+ readDirectorySource("remote-manifests", readStrictRemoteAgentResources),
363
+ readDirectorySource("workspace-metadata", () => discoverWorkspaceAgents(selfAppId, options, true)),
364
+ ]);
365
+ if (remoteResources.status === "unavailable") {
366
+ return remoteResources;
367
+ }
368
+ if (workspaceAgents.status === "unavailable") {
369
+ return workspaceAgents;
370
+ }
371
+ const remoteOverlay = await readDirectorySource("remote-manifests", () => overlayRemoteAgentResources(agentsById, remoteResources.value, selfAppId, options));
372
+ if (remoteOverlay.status === "unavailable")
373
+ return remoteOverlay;
374
+ for (const agent of workspaceAgents.value)
375
+ agentsById.set(agent.id, agent);
376
+ return { status: "available", agents: Array.from(agentsById.values()) };
377
+ }
378
+ async function readDirectorySource(reason, read) {
379
+ try {
380
+ return { status: "available", value: await read() };
381
+ }
382
+ catch {
383
+ return { status: "unavailable", reason };
384
+ }
385
+ }
386
+ async function readStrictRemoteAgentResources() {
387
+ const { resourceListContentByOwnersAndPrefixes, SHARED_OWNER, sharedResourceOwner, } = await import("../resources/store.js");
388
+ const { REMOTE_AGENT_RESOURCE_PREFIXES } = await import("../resources/metadata.js");
389
+ const activeOwner = sharedResourceOwner(getRequestOrgId());
390
+ const owners = [...new Set([SHARED_OWNER, activeOwner])];
391
+ const prefixes = [...REMOTE_AGENT_RESOURCE_PREFIXES].reverse();
392
+ const ownerRank = new Map(owners.map((owner, index) => [owner, index]));
393
+ const prefixRank = (pathValue) => prefixes.findIndex((prefix) => pathValue.startsWith(prefix));
394
+ const resources = await resourceListContentByOwnersAndPrefixes(owners, prefixes);
395
+ resources.sort((a, b) => {
396
+ const ownerDelta = (ownerRank.get(a.owner) ?? -1) - (ownerRank.get(b.owner) ?? -1);
397
+ if (ownerDelta !== 0)
398
+ return ownerDelta;
399
+ const prefixDelta = prefixRank(a.path) - prefixRank(b.path);
400
+ if (prefixDelta !== 0)
401
+ return prefixDelta;
402
+ return a.path.localeCompare(b.path);
403
+ });
404
+ return resources;
405
+ }
406
+ async function overlayRemoteAgentResources(agentsById, resources, selfAppId, options) {
407
+ const { isRemoteAgentPath, parseRemoteAgentManifest } = await import("../resources/metadata.js");
408
+ for (const resource of resources) {
409
+ if (!isRemoteAgentPath(resource.path))
410
+ continue;
411
+ const manifest = parseRemoteAgentManifest(resource.content, resource.path);
412
+ if (!manifest) {
413
+ throw new Error(`Invalid remote agent manifest: ${resource.path}`);
414
+ }
415
+ if (typeof manifest.id !== "string" ||
416
+ !manifest.id.trim() ||
417
+ typeof manifest.name !== "string" ||
418
+ !manifest.name.trim() ||
419
+ typeof manifest.url !== "string" ||
420
+ !isAbsoluteHttpUrl(manifest.url)) {
421
+ throw new Error(`Invalid remote agent manifest: ${resource.path}`);
422
+ }
423
+ if (!shouldIncludeRemoteAgentManifest(manifest, selfAppId))
424
+ continue;
425
+ const manifestId = normalizeAgentId(manifest.id);
426
+ let url = manifest.url;
427
+ const builtin = agentsById.get(manifestId);
428
+ if (isHostedRuntime() && isLoopbackUrl(url)) {
429
+ if (builtin?.url)
430
+ url = builtin.url;
431
+ else
432
+ continue;
433
+ }
434
+ if (options?.preferLocalUrls &&
435
+ builtin &&
436
+ BUILTIN_AGENTS.some((candidate) => candidate.id === manifestId)) {
437
+ url = builtin.url;
438
+ }
439
+ const isLegacyAssetsManifest = manifest.id.trim().toLowerCase() !== manifestId;
440
+ if (isLegacyAssetsManifest && builtin?.url) {
441
+ try {
442
+ if (new URL(url).hostname === "images.agent-native.com") {
443
+ url = builtin.url;
444
+ }
445
+ }
446
+ catch {
447
+ url = builtin.url;
448
+ }
449
+ }
450
+ agentsById.set(manifestId, {
451
+ id: manifestId,
452
+ name: isLegacyAssetsManifest && builtin?.name ? builtin.name : manifest.name,
453
+ description: manifest.description || "",
454
+ url,
455
+ // guard:allow-raw-color — agent manifests require a portable color value, not a UI theme token.
456
+ color: manifest.color || builtin?.color || "#6B7280",
457
+ });
458
+ }
459
+ }
460
+ function isAbsoluteHttpUrl(value) {
461
+ try {
462
+ const url = new URL(value);
463
+ return url.protocol === "http:" || url.protocol === "https:";
464
+ }
465
+ catch {
466
+ // coercion-ok: malformed URLs and non-HTTP URLs are the same invalid-manifest outcome.
467
+ return false;
468
+ }
469
+ }
315
470
  /**
316
471
  * Look up a single agent by ID or name (case-insensitive).
317
472
  */
@@ -420,16 +575,18 @@ function titleCase(value) {
420
575
  .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
421
576
  .join(" ");
422
577
  }
423
- function parseWorkspaceAppsManifest(parsed) {
578
+ function parseWorkspaceAppsManifest(parsed, strict = false) {
424
579
  const rawApps = Array.isArray(parsed?.apps)
425
580
  ? parsed.apps
426
581
  : Array.isArray(parsed)
427
582
  ? parsed
428
583
  : null;
429
- if (!rawApps)
584
+ if (!rawApps) {
585
+ if (strict)
586
+ throw new Error("Invalid workspace apps manifest");
430
587
  return null;
431
- const apps = rawApps
432
- .map((entry) => {
588
+ }
589
+ const parsedApps = rawApps.map((entry) => {
433
590
  if (!entry || typeof entry !== "object")
434
591
  return null;
435
592
  const e = entry;
@@ -453,7 +610,11 @@ function parseWorkspaceAppsManifest(parsed) {
453
610
  publicPaths: normalizeWorkspaceAppPathList(e.publicPaths),
454
611
  protectedPaths: normalizeWorkspaceAppPathList(e.protectedPaths),
455
612
  };
456
- })
613
+ });
614
+ if (strict && parsedApps.some((app) => app === null)) {
615
+ throw new Error("Invalid workspace app manifest entry");
616
+ }
617
+ const apps = parsedApps
457
618
  .filter((app) => app !== null)
458
619
  .sort((a, b) => {
459
620
  if (a.id === "dispatch")
@@ -464,14 +625,16 @@ function parseWorkspaceAppsManifest(parsed) {
464
625
  });
465
626
  return apps.length ? apps : null;
466
627
  }
467
- function readWorkspaceAppsFromEnv() {
628
+ function readWorkspaceAppsFromEnv(strict = false) {
468
629
  const raw = process.env[WORKSPACE_APPS_ENV_KEY];
469
630
  if (!raw)
470
631
  return null;
471
632
  try {
472
- return parseWorkspaceAppsManifest(JSON.parse(raw));
633
+ return parseWorkspaceAppsManifest(JSON.parse(raw), strict);
473
634
  }
474
635
  catch {
636
+ if (strict)
637
+ throw new Error("Invalid workspace apps environment manifest");
475
638
  return null;
476
639
  }
477
640
  }
@@ -493,17 +656,17 @@ function workspaceAppsManifestCandidates() {
493
656
  }
494
657
  return candidates;
495
658
  }
496
- function readWorkspaceAppsFromManifestFile() {
659
+ function readWorkspaceAppsFromManifestFile(strict = false) {
497
660
  for (const file of workspaceAppsManifestCandidates()) {
498
661
  if (!fs.existsSync(file))
499
662
  continue;
500
- const apps = parseWorkspaceAppsManifest(readJson(file));
663
+ const apps = parseWorkspaceAppsManifest(readJson(file), strict);
501
664
  if (apps)
502
665
  return apps;
503
666
  }
504
667
  return null;
505
668
  }
506
- function readWorkspaceAppsFromFilesystem() {
669
+ function readWorkspaceAppsFromFilesystem(strict = false) {
507
670
  const workspaceRoot = findWorkspaceRoot();
508
671
  if (!workspaceRoot)
509
672
  return null;
@@ -516,8 +679,11 @@ function readWorkspaceAppsFromFilesystem() {
516
679
  .map((entry) => {
517
680
  const appDir = path.join(appsDir, entry.name);
518
681
  const pkg = readJson(path.join(appDir, "package.json"));
519
- if (!pkg)
682
+ if (!pkg) {
683
+ if (strict)
684
+ throw new Error(`Invalid workspace package: ${entry.name}`);
520
685
  return null;
686
+ }
521
687
  const routeAccess = workspaceAppRouteAccessFromPackageJson(pkg);
522
688
  return {
523
689
  id: normalizeAgentId(entry.name),
@@ -567,11 +733,11 @@ function workspaceAppUrl(app, hostedLoopbackFallbackUrl) {
567
733
  return null;
568
734
  }
569
735
  }
570
- async function discoverWorkspaceAgents(selfAppId, options) {
571
- const workspaceApps = loadWorkspaceAppsManifest();
736
+ async function discoverWorkspaceAgents(selfAppId, options, strictMetadata = false) {
737
+ const workspaceApps = loadWorkspaceAppsManifest(strictMetadata);
572
738
  if (!workspaceApps)
573
739
  return [];
574
- const metadataSettings = await readWorkspaceAppMetadataSettings();
740
+ const metadataSettings = await readWorkspaceAppMetadataSettingsInternal(strictMetadata);
575
741
  const normalizedSelfAppId = selfAppId ? normalizeAgentId(selfAppId) : "";
576
742
  return workspaceApps
577
743
  .filter((app) => normalizeAgentId(app.id) !== normalizedSelfAppId)
@@ -581,6 +747,9 @@ async function discoverWorkspaceAgents(selfAppId, options) {
581
747
  const url = options?.preferLocalUrls && builtin
582
748
  ? resolveAgentUrl(builtin, true)
583
749
  : workspaceAppUrl(withOverride, builtin?.url);
750
+ if (strictMetadata && (!url || !isAbsoluteHttpUrl(url))) {
751
+ throw new Error(`Invalid workspace app URL: ${withOverride.id}`);
752
+ }
584
753
  if (!url)
585
754
  return null;
586
755
  return {
@@ -5,6 +5,7 @@ import { isWorkspaceAppAccessAllowed } from "../org/workspace-app-access.js";
5
5
  import { EMBED_START_PATH } from "../shared/embed-auth.js";
6
6
  import { EMBED_TARGET_HEADER } from "../shared/embed-auth.js";
7
7
  import { FIRST_RUN_ONBOARDING_COOKIE, FIRST_RUN_ONBOARDING_MAX_AGE, } from "../shared/first-run-onboarding.js";
8
+ import { isGoogleProfileImageUrl } from "../shared/google-profile-image.js";
8
9
  import { EMBED_TRANSPLANT_HEADER, isMcpEmbedCorsOrigin, MCP_EMBED_CORS_ALLOW_HEADERS, shouldAllowMcpEmbedCredentials, } from "../shared/mcp-embed-headers.js";
9
10
  import { isEmbedCapabilityScope, requestHasEmbedAuthMarker, resolveEmbedSessionFromRequest, } from "./embed-session.js";
10
11
  // In h3 v2, `event.req` IS the web Request — but in Nitro's dev server (srvx
@@ -3351,9 +3352,9 @@ async function mountBetterAuthRoutes(app, options) {
3351
3352
  if (isNewGoogleUser === true) {
3352
3353
  setFirstRunOnboardingCookie(event);
3353
3354
  }
3354
- if (typeof user.picture === "string" && user.picture.trim()) {
3355
+ if (isGoogleProfileImageUrl(user.picture)) {
3355
3356
  await putSetting(`avatar:${email}`, {
3356
- image: user.picture,
3357
+ image: user.picture.trim(),
3357
3358
  }).catch((error) => {
3358
3359
  console.warn("[auth] failed to store Google profile image:", error);
3359
3360
  });
@@ -35,10 +35,6 @@ export interface BuilderRelayRequestBody {
35
35
  relayState: string;
36
36
  credentials: BuilderRelayCredentials;
37
37
  }
38
- /**
39
- * Opaque OAuth `state` for Builder connect. Bound to the app auth secret so a
40
- * pending row cannot be forged from another deployment that shares a database.
41
- */
42
38
  export declare function createBuilderConnectState(): string;
43
39
  export declare function isSignedBuilderConnectState(value: string | null | undefined): boolean;
44
40
  /**
@@ -3,7 +3,9 @@ import { getHeader } from "h3";
3
3
  import { getSetting } from "../settings/store.js";
4
4
  import { applyBuilderUtmTrackingParams } from "../shared/builder-link-tracking.js";
5
5
  import { getAuthSecret, resolveSignupTrackingIdentity, } from "./better-auth-instance.js";
6
- import { getAppBasePath, getOrigin, isAllowedOAuthRedirectUri, } from "./google-oauth.js";
6
+ import { readDeployCredentialEnv } from "./credential-provider.js";
7
+ import { getWorkspaceA2ADerivedSecret } from "./derived-secret.js";
8
+ import { getAppBasePath, getOrigin, getOAuthStateSigningKey, isAllowedOAuthRedirectUri, } from "./google-oauth.js";
7
9
  import { getRequestOrgId, getRequestUserEmail } from "./request-context.js";
8
10
  const DEFAULT_BUILDER_APP_HOST = "https://builder.io";
9
11
  const DEFAULT_BUILDER_API_HOST = "https://api.builder.io";
@@ -48,12 +50,23 @@ function safeEqualText(expected, actual) {
48
50
  timingSafeEqual(expectedBuffer, actualBuffer));
49
51
  }
50
52
  /**
51
- * Opaque OAuth `state` for Builder connect. Bound to the app auth secret so a
52
- * pending row cannot be forged from another deployment that shares a database.
53
+ * Opaque OAuth `state` for Builder connect. Bound to a server-only signing
54
+ * secret so a pending row cannot be forged from another deployment that shares
55
+ * a database.
53
56
  */
57
+ function builderConnectStateSigningKeys() {
58
+ const currentSecret = getOAuthStateSigningKey();
59
+ const keys = [`builder-connect-state:${currentSecret}`];
60
+ const legacySecret = readDeployCredentialEnv("BETTER_AUTH_SECRET")?.trim() ||
61
+ getWorkspaceA2ADerivedSecret("better-auth");
62
+ if (legacySecret && legacySecret !== currentSecret) {
63
+ keys.push(`builder-connect-state:${legacySecret}`);
64
+ }
65
+ return keys;
66
+ }
54
67
  export function createBuilderConnectState() {
55
68
  const stateNonce = randomBytes(32).toString("base64url");
56
- const signature = createHmac("sha256", `builder-connect-state:${getAuthSecret()}`)
69
+ const signature = createHmac("sha256", builderConnectStateSigningKeys()[0])
57
70
  .update(stateNonce)
58
71
  .digest("base64url");
59
72
  return `${stateNonce}.${signature}`;
@@ -69,10 +82,12 @@ export function isSignedBuilderConnectState(value) {
69
82
  !/^[A-Za-z0-9_-]{43}$/.test(signature)) {
70
83
  return false;
71
84
  }
72
- const expected = createHmac("sha256", `builder-connect-state:${getAuthSecret()}`)
73
- .update(nonce)
74
- .digest("base64url");
75
- return safeEqualText(expected, signature);
85
+ return builderConnectStateSigningKeys().some((key) => {
86
+ const expected = createHmac("sha256", key)
87
+ .update(nonce)
88
+ .digest("base64url");
89
+ return safeEqualText(expected, signature);
90
+ });
76
91
  }
77
92
  /**
78
93
  * Railway-safe Builder OAuth callback URL check: same origin as this request
@@ -117,6 +117,24 @@ export interface OAuthStatePayload {
117
117
  signupAttribution?: Record<string, string | undefined>;
118
118
  signupAnonymousId?: string;
119
119
  }
120
+ /**
121
+ * Derive a server-only signing key for HMAC verification of OAuth state.
122
+ *
123
+ * Uses a dedicated secret — never an OAuth client secret. Reusing a
124
+ * client_secret (which is shared with Google / GitHub / Atlassian) as our
125
+ * own HMAC key conflates two trust domains: rotating the client secret
126
+ * silently invalidates every in-flight OAuth state, and any leak of the
127
+ * client secret also lets an attacker forge our state envelopes.
128
+ *
129
+ * Resolution order:
130
+ * 1. OAUTH_STATE_SECRET (preferred — dedicated to this purpose)
131
+ * 2. BETTER_AUTH_SECRET (already used by Better Auth as a server secret)
132
+ * 3. Hosted workspace deploys derive a per-purpose key from A2A_SECRET
133
+ * 4. In dev only, an ephemeral random key (per-process)
134
+ *
135
+ * In production, throws if no usable server secret is set.
136
+ */
137
+ export declare function getOAuthStateSigningKey(): string;
120
138
  /**
121
139
  * Options for the named-argument form of {@link encodeOAuthState}.
122
140
  * Prefer this form — the positional overload is easy to misuse (the mail
@@ -400,7 +400,7 @@ let _devStateSigningKey;
400
400
  *
401
401
  * In production, throws if no usable server secret is set.
402
402
  */
403
- function getStateSigningKey() {
403
+ export function getOAuthStateSigningKey() {
404
404
  const secret = process.env.OAUTH_STATE_SECRET ||
405
405
  process.env.BETTER_AUTH_SECRET ||
406
406
  getWorkspaceA2ADerivedSecret("oauth-state");
@@ -478,7 +478,7 @@ export function encodeOAuthState(redirectUriOrOpts, owner, desktop, addAccount,
478
478
  payload.ai = signupAnonymousId;
479
479
  const data = Buffer.from(JSON.stringify(payload)).toString("base64url");
480
480
  const sig = crypto
481
- .createHmac("sha256", getStateSigningKey())
481
+ .createHmac("sha256", getOAuthStateSigningKey())
482
482
  .update(data)
483
483
  .digest("base64url");
484
484
  return `${data}.${sig}`;
@@ -497,7 +497,7 @@ export function decodeOAuthState(stateParam, fallbackUri) {
497
497
  const data = stateParam.slice(0, dotIdx);
498
498
  const sig = stateParam.slice(dotIdx + 1);
499
499
  const expected = crypto
500
- .createHmac("sha256", getStateSigningKey())
500
+ .createHmac("sha256", getOAuthStateSigningKey())
501
501
  .update(data)
502
502
  .digest("base64url");
503
503
  if (sig.length !== expected.length ||
@@ -2182,14 +2182,14 @@ ${googleOnly ? "" : `\n <div class="divider" id="auth-divider"${i18nAttr("divid
2182
2182
  : ""}
2183
2183
  ${googleOnly
2184
2184
  ? ""
2185
- : `${magicLinkMode ? '\n <form id="magic-link-form" class="form">\n <label for="m-email"' + i18nAttr("email") + ">" + esc(t("email")) + '</label>\n <input id="m-email" type="email" autocomplete="email" autofocus placeholder="' + esc(t("emailPlaceholder")) + '" required />\n <button type="submit" id="magic-link-submit" class="magic-link-submit"' + i18nAttr("sendMagicLink") + ">" + esc(t("sendMagicLink")) + '</button>\n <p class="msg" id="m-msg"></p>\n' + signupLegalNoteHtml + '\n <p style="margin-top:0.75rem;font-size:0.75rem;text-align:start">\n <a href="#" id="use-password-link" class="link-button auth-mode-link"' + i18nAttr("usePasswordInstead") + ">" + esc(t("usePasswordInstead")) + "</a>\n </p>\n </form>\n" : ""}${magicLinkSuccessHtml} <div class="tabs" id="auth-tabs">
2185
+ : `${magicLinkMode ? '\n <form id="magic-link-form" class="form">\n <label for="m-email"' + i18nAttr("email") + ">" + esc(t("email")) + '</label>\n <input id="m-email" type="email" autocomplete="email" placeholder="' + esc(t("emailPlaceholder")) + '" required />\n <button type="submit" id="magic-link-submit" class="magic-link-submit"' + i18nAttr("sendMagicLink") + ">" + esc(t("sendMagicLink")) + '</button>\n <p class="msg" id="m-msg"></p>\n' + signupLegalNoteHtml + '\n <p style="margin-top:0.75rem;font-size:0.75rem;text-align:start">\n <a href="#" id="use-password-link" class="link-button auth-mode-link"' + i18nAttr("usePasswordInstead") + ">" + esc(t("usePasswordInstead")) + "</a>\n </p>\n </form>\n" : ""}${magicLinkSuccessHtml} <div class="tabs" id="auth-tabs">
2186
2186
  <button class="tab" data-tab="signup"${i18nAttr("createAccount")}>${esc(t("createAccount"))}</button>
2187
2187
  <button class="tab" data-tab="login"${i18nAttr("signIn")}>${esc(t("signIn"))}</button>
2188
2188
  </div>
2189
2189
 
2190
2190
  <form id="signup-form" class="form">
2191
2191
  <label for="s-email"${i18nAttr("email")}>${esc(t("email"))}</label>
2192
- <input id="s-email" type="email" autocomplete="email" autofocus placeholder="${esc(t("emailPlaceholder"))}" required />
2192
+ <input id="s-email" type="email" autocomplete="email" placeholder="${esc(t("emailPlaceholder"))}" required />
2193
2193
  <label for="s-pass"${i18nAttr("password")}>${esc(t("password"))}</label>
2194
2194
  <input id="s-pass" type="password" autocomplete="new-password" placeholder="${esc(t("passwordMinPlaceholder"))}"${i18nPlaceholderAttr("passwordMinPlaceholder")} required minlength="${PASSWORD_MIN_LENGTH}" maxlength="${PASSWORD_MAX_LENGTH}" />
2195
2195
  <label for="s-pass2"${i18nAttr("confirmPassword")}>${esc(t("confirmPassword"))}</label>
@@ -4110,7 +4110,7 @@ export function getResetPasswordHtml() {
4110
4110
  <p class="subtitle">Set a new password for your account.</p>
4111
4111
  <form id="reset-form">
4112
4112
  <label for="p1">New password</label>
4113
- <input id="p1" type="password" autocomplete="new-password" autofocus placeholder="At least ${PASSWORD_MIN_LENGTH} characters" required minlength="${PASSWORD_MIN_LENGTH}" maxlength="${PASSWORD_MAX_LENGTH}" />
4113
+ <input id="p1" type="password" autocomplete="new-password" placeholder="At least ${PASSWORD_MIN_LENGTH} characters" required minlength="${PASSWORD_MIN_LENGTH}" maxlength="${PASSWORD_MAX_LENGTH}" />
4114
4114
  <label for="p2">Confirm password</label>
4115
4115
  <input id="p2" type="password" autocomplete="new-password" placeholder="Confirm password" required minlength="${PASSWORD_MIN_LENGTH}" maxlength="${PASSWORD_MAX_LENGTH}" />
4116
4116
  <button type="submit">Save new password</button>
@@ -51,6 +51,8 @@ export interface ChangeEvent {
51
51
  * to drive the access-aware delivery check in `canSeeChangeForUser`.
52
52
  */
53
53
  resourceId?: string;
54
+ /** Public-resource scope for events whose resource may be gone. */
55
+ visibility?: "public";
54
56
  [k: string]: unknown;
55
57
  }
56
58
  export declare const DURABLE_LEGACY_DB_CHECK_INTERVAL_MS = 30000;
@@ -318,7 +320,7 @@ export declare class AppSyncState {
318
320
  * authority that gates the HTTP routes. Errors fail closed (cached deny). The
319
321
  * owner/org fast paths below are unchanged and evaluated first.
320
322
  */
321
- canSeeChangeForUser(event: Pick<ChangeEvent, "owner" | "orgId" | "resourceType" | "resourceId">, userEmail: string, orgId: string | undefined): boolean;
323
+ canSeeChangeForUser(event: Pick<ChangeEvent, "owner" | "orgId" | "resourceType" | "resourceId" | "visibility">, userEmail: string, orgId: string | undefined): boolean;
322
324
  private getChangeVisibilityForUser;
323
325
  /**
324
326
  * Record a change event. Called by emitter listeners and the tail detector.
@@ -386,7 +388,7 @@ export declare function invalidateCollabAccessCache(resourceType: string, resour
386
388
  * intentionally NOT part of the public API — do not rely on it outside tests.
387
389
  */
388
390
  export declare function __resetCollabAccessCacheForTests(): void;
389
- export declare function canSeeChangeForUser(event: Pick<ChangeEvent, "owner" | "orgId" | "resourceType" | "resourceId">, userEmail: string, orgId: string | undefined): boolean;
391
+ export declare function canSeeChangeForUser(event: Pick<ChangeEvent, "owner" | "orgId" | "resourceType" | "resourceId" | "visibility">, userEmail: string, orgId: string | undefined): boolean;
390
392
  /** Record a change event. Called by emitter listeners. */
391
393
  export declare function recordChange(event: {
392
394
  source: string;