@agent-native/core 0.213.1 → 0.216.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 (169) hide show
  1. package/dist/action.js +54 -1
  2. package/dist/agent/actions/disconnect-chatgpt-subscription.js +5 -0
  3. package/dist/agent/actions/get-agentkit-capabilities.js +3 -3
  4. package/dist/agent/actions/manage-builder-connection.js +5 -0
  5. package/dist/agent/actions/manage-provider-key-policy.js +5 -0
  6. package/dist/agent/actions/manage-provider-models.js +5 -0
  7. package/dist/agent/actions/manage-service-providers.js +5 -0
  8. package/dist/agent/actions/select-chatgpt-subscription-account.js +5 -0
  9. package/dist/agent/context-xray/actions/context-evict.js +5 -0
  10. package/dist/agent/context-xray/actions/context-pin.js +5 -0
  11. package/dist/agent/context-xray/actions/context-report.js +5 -0
  12. package/dist/agent/context-xray/actions/context-restore.js +5 -0
  13. package/dist/agent/execution-fence.d.ts +1 -0
  14. package/dist/agent/execution-fence.js +5 -0
  15. package/dist/agent/production-agent.d.ts +35 -2
  16. package/dist/agent/production-agent.js +629 -32
  17. package/dist/agent/run-manager.d.ts +2 -0
  18. package/dist/agent/run-manager.js +397 -115
  19. package/dist/agent/run-slot-lock.d.ts +2 -0
  20. package/dist/agent/run-slot-lock.js +6 -0
  21. package/dist/agent/run-store.d.ts +5 -0
  22. package/dist/agent/run-store.js +423 -156
  23. package/dist/agent/thread-data-builder.js +27 -5
  24. package/dist/agent/types.d.ts +6 -12
  25. package/dist/agentkit/capabilities.d.ts +1 -1
  26. package/dist/appearance/actions/get-theme-family.d.ts +8 -0
  27. package/dist/appearance/actions/get-theme-family.js +38 -0
  28. package/dist/appearance/actions/set-theme-family.d.ts +7 -0
  29. package/dist/appearance/actions/set-theme-family.js +33 -0
  30. package/dist/appearance/theme-family.d.ts +13 -0
  31. package/dist/appearance/theme-family.js +38 -0
  32. package/dist/application-state/store.d.ts +5 -0
  33. package/dist/application-state/store.js +26 -0
  34. package/dist/chat-threads/schema-migrations.js +17 -0
  35. package/dist/chat-threads/store.d.ts +21 -1
  36. package/dist/chat-threads/store.js +223 -41
  37. package/dist/cli/skills-content/turn-into-app-skill.d.ts +1 -1
  38. package/dist/cli/skills-content/turn-into-app-skill.js +20 -18
  39. package/dist/cli/templates-meta.js +14 -0
  40. package/dist/client/analytics.js +167 -17
  41. package/dist/client/chat/agentkit-agent-native.js +79 -3
  42. package/dist/client/chat/agentkit-protocol.js +80 -42
  43. package/dist/client/chat/runtime.d.ts +5 -1
  44. package/dist/client/chat/runtime.js +46 -3
  45. package/dist/client/consent.d.ts +36 -0
  46. package/dist/client/consent.js +283 -0
  47. package/dist/client/review/use-review.d.ts +2 -0
  48. package/dist/client/review/use-review.js +28 -1
  49. package/dist/client/sharing/useResourceAccessGate.d.ts +3 -2
  50. package/dist/client/sharing/useResourceAccessGate.js +9 -1
  51. package/dist/client/theme-family.d.ts +35 -0
  52. package/dist/client/theme-family.js +223 -0
  53. package/dist/client/theme.d.ts +1 -1
  54. package/dist/client/theme.js +5 -2
  55. package/dist/client/ui/index.d.ts +1 -0
  56. package/dist/client/ui/index.js +1 -0
  57. package/dist/client/use-chat-thread-list.d.ts +2 -0
  58. package/dist/client/use-chat-thread-list.js +12 -2
  59. package/dist/client/use-chat-threads.d.ts +1 -0
  60. package/dist/client/use-chat-threads.js +2 -0
  61. package/dist/connections/catalog.d.ts +5 -5
  62. package/dist/connections/catalog.js +22 -3
  63. package/dist/data-widgets/index.d.ts +374 -5
  64. package/dist/data-widgets/index.js +242 -11
  65. package/dist/db/migrations.js +4 -1
  66. package/dist/db/schema-snapshot.generated.js +8 -1
  67. package/dist/feature-flags/actions/set-feature-flag.js +5 -0
  68. package/dist/feature-flags/index.d.ts +1 -1
  69. package/dist/feature-flags/index.js +1 -1
  70. package/dist/feature-flags/store.d.ts +12 -0
  71. package/dist/feature-flags/store.js +79 -7
  72. package/dist/file-upload/actions/manage-file-storage.js +5 -0
  73. package/dist/file-upload/actions/upload-image.js +5 -0
  74. package/dist/framework-tools.js +2 -0
  75. package/dist/history/actions/create-resource-version.js +5 -0
  76. package/dist/history/actions/restore-resource-version.js +5 -0
  77. package/dist/ingestion/index.d.ts +1 -1
  78. package/dist/ingestion/index.js +1 -1
  79. package/dist/ingestion/pptx.d.ts +11 -0
  80. package/dist/ingestion/pptx.js +81 -1
  81. package/dist/integrations/actions/manage-messaging-channel.js +5 -0
  82. package/dist/jobs/scheduler.js +17 -1
  83. package/dist/labs/actions/set-lab.js +5 -0
  84. package/dist/localization/actions/set-localization-preference.js +5 -0
  85. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  86. package/dist/observability/actions/save-observability-instruction-update.js +5 -0
  87. package/dist/observability/actions/save-observability-review-summary.js +5 -0
  88. package/dist/provider-api/actions/custom-provider-registration.d.ts +19 -19
  89. package/dist/provider-api/actions/provider-api.d.ts +10 -10
  90. package/dist/provider-api/index.js +9 -2
  91. package/dist/review/actions/consume-review-feedback.js +5 -0
  92. package/dist/review/actions/create-review-comment.js +5 -0
  93. package/dist/review/actions/delete-review-comment.js +5 -0
  94. package/dist/review/actions/react-to-review-comment.js +5 -0
  95. package/dist/review/actions/reply-review-comment.js +5 -0
  96. package/dist/review/actions/resolve-review-thread.js +5 -0
  97. package/dist/review/actions/send-review-thread-to-agent.js +5 -0
  98. package/dist/review/actions/set-review-status.js +5 -0
  99. package/dist/review/actions/set-review-thread-muted.js +5 -0
  100. package/dist/review/actions/set-review-thread-unread.js +5 -0
  101. package/dist/review/actions/set-review-threads-unread.js +5 -0
  102. package/dist/review/actions/update-review-comment-anchor.js +5 -0
  103. package/dist/review/actions/update-review-comment.js +5 -0
  104. package/dist/review/suggestions/actions.js +60 -21
  105. package/dist/review/suggestions/store.d.ts +2 -0
  106. package/dist/review/suggestions/store.js +28 -0
  107. package/dist/secrets/actions/delete-api-key.js +5 -0
  108. package/dist/secrets/routes.d.ts +10 -10
  109. package/dist/server/action-discovery.js +8 -0
  110. package/dist/server/agent-chat/context-tools.js +105 -2
  111. package/dist/server/agent-chat-plugin.d.ts +2 -0
  112. package/dist/server/agent-chat-plugin.js +242 -54
  113. package/dist/server/agent-engine-default-model-route.d.ts +1 -1
  114. package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
  115. package/dist/server/application-state-maintenance.d.ts +2 -0
  116. package/dist/server/application-state-maintenance.js +2 -0
  117. package/dist/server/attribution.d.ts +14 -0
  118. package/dist/server/attribution.js +62 -2
  119. package/dist/server/auth.js +7 -0
  120. package/dist/server/consent-route.d.ts +41 -0
  121. package/dist/server/consent-route.js +102 -0
  122. package/dist/server/first-touch-route.d.ts +39 -0
  123. package/dist/server/first-touch-route.js +115 -0
  124. package/dist/server/index.d.ts +1 -0
  125. package/dist/server/index.js +1 -0
  126. package/dist/server/queued-submission-inbox-drain.d.ts +9 -0
  127. package/dist/server/queued-submission-inbox-drain.js +12 -0
  128. package/dist/server/request-origin.d.ts +6 -0
  129. package/dist/server/request-origin.js +12 -0
  130. package/dist/settings/org-settings.d.ts +2 -1
  131. package/dist/settings/org-settings.js +4 -1
  132. package/dist/settings/store.d.ts +8 -0
  133. package/dist/settings/store.js +14 -5
  134. package/dist/shared/consent.d.ts +31 -0
  135. package/dist/shared/consent.js +145 -0
  136. package/dist/shared/first-touch-persistence.d.ts +31 -0
  137. package/dist/shared/first-touch-persistence.js +53 -0
  138. package/dist/sharing/actions/list-resource-shares.d.ts +1 -1
  139. package/dist/sharing/actions/set-resource-visibility.js +5 -0
  140. package/dist/sharing/actions/share-resource.js +5 -0
  141. package/dist/sharing/actions/unshare-resource.js +5 -0
  142. package/dist/templates/chat/.agents/skills/actions/references/action-fields.md +1 -1
  143. package/dist/templates/default/.agents/skills/actions/references/action-fields.md +1 -1
  144. package/dist/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +36 -80
  145. package/dist/templates/factory/.agents/skills/review-latest-feedback/references/channel-inventory.md +54 -16
  146. package/dist/templates/factory/.agents/skills/review-latest-feedback/references/slack-reaction-replies.md +50 -73
  147. package/dist/templates/headless/.agents/skills/actions/references/action-fields.md +1 -1
  148. package/dist/templates/workspace-core/.agents/skills/actions/references/action-fields.md +1 -1
  149. package/dist/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +20 -18
  150. package/dist/usage/actions/get-usage-metrics.js +27 -4
  151. package/dist/usage/actions/manage-usage-alert.js +5 -0
  152. package/dist/vite/client.js +8 -6
  153. package/dist/workspace-connections/actions/bulk-update-workspace-user-groups.js +5 -0
  154. package/dist/workspace-connections/actions/delete-workspace-user-group.js +5 -0
  155. package/dist/workspace-connections/actions/upsert-workspace-user-group.js +5 -0
  156. package/docs/content/actions-access-control.mdx +8 -8
  157. package/docs/content/actions-defining.mdx +9 -8
  158. package/docs/content/template-design-developers.mdx +9 -9
  159. package/docs/content/template-design-features.mdx +1 -3
  160. package/docs/content/turn-into-app.mdx +4 -0
  161. package/package.json +4 -3
  162. package/src/templates/chat/.agents/skills/actions/references/action-fields.md +1 -1
  163. package/src/templates/default/.agents/skills/actions/references/action-fields.md +1 -1
  164. package/src/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +36 -80
  165. package/src/templates/factory/.agents/skills/review-latest-feedback/references/channel-inventory.md +54 -16
  166. package/src/templates/factory/.agents/skills/review-latest-feedback/references/slack-reaction-replies.md +50 -73
  167. package/src/templates/headless/.agents/skills/actions/references/action-fields.md +1 -1
  168. package/src/templates/workspace-core/.agents/skills/actions/references/action-fields.md +1 -1
  169. package/src/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +20 -18
@@ -0,0 +1,223 @@
1
+ import { useCallback, useEffect, useRef, useState, useSyncExternalStore, } from "react";
2
+ import { DEFAULT_THEME_FAMILY, isThemeFamily, THEME_FAMILY_ATTRIBUTE, THEME_FAMILY_STATUS_ATTRIBUTE, themeFamilyAppStateKey, themeFamilyStorageKey, } from "../appearance/theme-family.js";
3
+ import { injectedAgentNativeAppId } from "./app-config.js";
4
+ import { readClientAppState } from "./application-state.js";
5
+ import { useActionMutation, useActionQuery } from "./use-action.js";
6
+ import { useChangeVersion } from "./use-change-version.js";
7
+ export { DEFAULT_THEME_FAMILY, isThemeFamily, THEME_FAMILY_APP_STATE_KEY, THEME_FAMILY_ATTRIBUTE, THEME_FAMILY_STORAGE_KEY, themeFamilyAppStateKey, themeFamilyStorageKey, } from "../appearance/theme-family.js";
8
+ export const THEME_FAMILY_CHANGE_EVENT = "agent-native:theme-family-change";
9
+ const familySnapshots = new Map();
10
+ function resolvedAppId(appId) {
11
+ if (appId !== undefined)
12
+ return appId ?? undefined;
13
+ return injectedAgentNativeAppId() ?? undefined;
14
+ }
15
+ function scopeKey(appId) {
16
+ return themeFamilyStorageKey(resolvedAppId(appId));
17
+ }
18
+ function asError(error) {
19
+ return error instanceof Error ? error : new Error(String(error));
20
+ }
21
+ export function readStoredThemeFamily(appId) {
22
+ if (typeof window === "undefined")
23
+ return { status: "missing" };
24
+ let value;
25
+ try {
26
+ value = window.localStorage.getItem(themeFamilyStorageKey(resolvedAppId(appId)));
27
+ }
28
+ catch (error) {
29
+ return { status: "unreadable", error: asError(error) };
30
+ }
31
+ if (value === null)
32
+ return { status: "missing" };
33
+ if (isThemeFamily(value))
34
+ return { status: "valid", family: value };
35
+ return { status: "invalid", value };
36
+ }
37
+ function getFamilySnapshot(appId) {
38
+ return familySnapshots.get(scopeKey(appId)) ?? DEFAULT_THEME_FAMILY;
39
+ }
40
+ function subscribe(onChange, appId) {
41
+ if (typeof window === "undefined")
42
+ return () => { };
43
+ const refreshFromStorage = () => {
44
+ const stored = readStoredThemeFamily(appId);
45
+ const key = scopeKey(appId);
46
+ if (stored.status === "valid") {
47
+ familySnapshots.set(key, stored.family);
48
+ window.document.documentElement.setAttribute(THEME_FAMILY_ATTRIBUTE, stored.family);
49
+ window.document.documentElement.removeAttribute(THEME_FAMILY_STATUS_ATTRIBUTE);
50
+ }
51
+ else if (stored.status === "missing" || stored.status === "invalid") {
52
+ familySnapshots.set(key, DEFAULT_THEME_FAMILY);
53
+ window.document.documentElement.setAttribute(THEME_FAMILY_ATTRIBUTE, DEFAULT_THEME_FAMILY);
54
+ if (stored.status === "invalid") {
55
+ window.document.documentElement.setAttribute(THEME_FAMILY_STATUS_ATTRIBUTE, "invalid");
56
+ }
57
+ }
58
+ onChange();
59
+ };
60
+ const onStorage = (event) => {
61
+ if (event.key === null || event.key === scopeKey(appId)) {
62
+ refreshFromStorage();
63
+ }
64
+ };
65
+ const onFamilyChange = (event) => {
66
+ const storageKey = event.detail
67
+ ?.storageKey;
68
+ if (storageKey === scopeKey(appId))
69
+ refreshFromStorage();
70
+ };
71
+ window.addEventListener("storage", onStorage);
72
+ window.addEventListener(THEME_FAMILY_CHANGE_EVENT, onFamilyChange);
73
+ return () => {
74
+ window.removeEventListener("storage", onStorage);
75
+ window.removeEventListener(THEME_FAMILY_CHANGE_EVENT, onFamilyChange);
76
+ };
77
+ }
78
+ export function applyThemeFamily(family, appId) {
79
+ if (!isThemeFamily(family)) {
80
+ throw new TypeError(`Unknown theme family: ${String(family)}`);
81
+ }
82
+ const storageAppId = resolvedAppId(appId);
83
+ const key = themeFamilyStorageKey(storageAppId);
84
+ familySnapshots.set(key, family);
85
+ if (typeof window === "undefined") {
86
+ return { family, storageStatus: "unavailable" };
87
+ }
88
+ const root = window.document.documentElement;
89
+ root.setAttribute(THEME_FAMILY_ATTRIBUTE, family);
90
+ try {
91
+ window.localStorage.setItem(key, family);
92
+ root.removeAttribute(THEME_FAMILY_STATUS_ATTRIBUTE);
93
+ window.dispatchEvent(new CustomEvent(THEME_FAMILY_CHANGE_EVENT, {
94
+ detail: { storageKey: key },
95
+ }));
96
+ return { family, storageStatus: "saved" };
97
+ }
98
+ catch {
99
+ root.setAttribute(THEME_FAMILY_STATUS_ATTRIBUTE, "unreadable");
100
+ window.dispatchEvent(new CustomEvent(THEME_FAMILY_CHANGE_EVENT, {
101
+ detail: { storageKey: key },
102
+ }));
103
+ return { family, storageStatus: "unavailable" };
104
+ }
105
+ }
106
+ function storageStatusForApply(result) {
107
+ return result.storageStatus === "saved" ? "valid" : "unreadable";
108
+ }
109
+ function errorForState(value) {
110
+ return new Error(`The open app's theme-family state is invalid: ${JSON.stringify(value)}`);
111
+ }
112
+ export function useThemeFamily() {
113
+ const runtimeAppId = injectedAgentNativeAppId();
114
+ const query = useActionQuery("get-theme-family", undefined, { retry: false, queryKeyScope: ["theme-family", runtimeAppId] });
115
+ const mutation = useActionMutation("set-theme-family", { skipActionQueryInvalidation: true });
116
+ const appId = query.data === undefined ? runtimeAppId : query.data.appId;
117
+ const appStateKey = themeFamilyAppStateKey(appId ?? undefined);
118
+ const appStateVersion = useChangeVersion(`app-state:${appStateKey}`);
119
+ const [storageStatus, setStorageStatus] = useState(() => readStoredThemeFamily(appId).status);
120
+ const [mutationError, setMutationError] = useState();
121
+ const mutationPending = useRef(false);
122
+ const family = useSyncExternalStore((onChange) => subscribe(onChange, appId), () => getFamilySnapshot(appId), () => DEFAULT_THEME_FAMILY);
123
+ useEffect(() => {
124
+ if (mutationPending.current)
125
+ return;
126
+ if (query.data === undefined)
127
+ return;
128
+ if (!isThemeFamily(query.data?.family)) {
129
+ setMutationError(errorForState(query.data));
130
+ return;
131
+ }
132
+ const applied = applyThemeFamily(query.data.family, query.data.appId);
133
+ setStorageStatus(storageStatusForApply(applied));
134
+ setMutationError(undefined);
135
+ }, [mutationPending, query.data]);
136
+ useEffect(() => {
137
+ if (appStateVersion === 0)
138
+ return;
139
+ let current = true;
140
+ void readClientAppState(appStateKey)
141
+ .then((state) => {
142
+ if (!current || state === null)
143
+ return;
144
+ if (!isThemeFamily(state.family)) {
145
+ setMutationError(errorForState(state));
146
+ return;
147
+ }
148
+ const applied = applyThemeFamily(state.family, appId);
149
+ setStorageStatus(storageStatusForApply(applied));
150
+ setMutationError(undefined);
151
+ })
152
+ .catch((error) => {
153
+ if (current)
154
+ setMutationError(asError(error));
155
+ });
156
+ return () => {
157
+ current = false;
158
+ };
159
+ }, [appId, appStateKey, appStateVersion]);
160
+ const setFamily = useCallback(async (nextFamily) => {
161
+ if (!isThemeFamily(nextFamily)) {
162
+ throw new TypeError(`Unknown theme family: ${String(nextFamily)}`);
163
+ }
164
+ const previousAppId = appId;
165
+ const previousFamily = getFamilySnapshot(previousAppId);
166
+ mutationPending.current = true;
167
+ const optimistic = applyThemeFamily(nextFamily, previousAppId);
168
+ setStorageStatus(storageStatusForApply(optimistic));
169
+ setMutationError(undefined);
170
+ try {
171
+ const result = await mutation.mutateAsync({ family: nextFamily });
172
+ if (!isThemeFamily(result?.family)) {
173
+ throw errorForState(result);
174
+ }
175
+ if (result.appId !== null && typeof result.appId !== "string") {
176
+ throw errorForState(result);
177
+ }
178
+ if (result.family !== nextFamily) {
179
+ throw new Error("The saved theme family did not match the selection.");
180
+ }
181
+ mutationPending.current = false;
182
+ const applied = applyThemeFamily(result.family, result.appId);
183
+ setStorageStatus(storageStatusForApply(applied));
184
+ return result.family;
185
+ }
186
+ catch (error) {
187
+ const normalized = asError(error);
188
+ let reconciledFamily = previousFamily;
189
+ let reconciledAppId = previousAppId;
190
+ let reconciliationError;
191
+ try {
192
+ const refreshed = await query.refetch();
193
+ const data = refreshed.data;
194
+ if (refreshed.isError) {
195
+ reconciliationError = asError(refreshed.error);
196
+ }
197
+ else if (!data ||
198
+ !isThemeFamily(data.family) ||
199
+ (data.appId !== null && typeof data.appId !== "string")) {
200
+ reconciliationError = errorForState(data);
201
+ }
202
+ else {
203
+ reconciledFamily = data.family;
204
+ reconciledAppId = data.appId;
205
+ }
206
+ }
207
+ catch (refreshError) {
208
+ reconciliationError = asError(refreshError);
209
+ }
210
+ mutationPending.current = false;
211
+ const reconciled = applyThemeFamily(reconciledFamily, reconciledAppId);
212
+ setStorageStatus(storageStatusForApply(reconciled));
213
+ const failure = reconciliationError
214
+ ? new AggregateError([normalized, reconciliationError], "The theme family update failed and its saved value could not be reloaded.")
215
+ : normalized;
216
+ setMutationError(failure);
217
+ throw failure;
218
+ }
219
+ }, [appId, mutation]);
220
+ const error = mutationError ?? (query.isError ? asError(query.error) : undefined);
221
+ const status = error ? "error" : query.isSuccess ? "success" : "loading";
222
+ return { family, status, error, storageStatus, setFamily };
223
+ }
@@ -15,5 +15,5 @@ export interface NormalizedEmbeddedThemeUpdate {
15
15
  export declare function parseEmbeddedThemeUpdate(value: unknown): NormalizedEmbeddedThemeUpdate | null;
16
16
  export declare function buildEmbeddedThemeUpdate(theme: ResolvedTheme, vars?: Record<string, string>): EmbeddedThemeUpdate;
17
17
  export declare function applyEmbeddedThemeUpdate(root: HTMLElement, update: NormalizedEmbeddedThemeUpdate): void;
18
- export declare function getThemeInitScript(defaultTheme?: ThemePreference, enableSystem?: boolean): string;
18
+ export declare function getThemeInitScript(defaultTheme?: ThemePreference, enableSystem?: boolean, appId?: string): string;
19
19
  export declare const themeInitScript: string;
@@ -1,4 +1,6 @@
1
+ import { getThemeFamilyInitScript } from "../appearance/theme-family.js";
1
2
  import { THEME_VAR_NAMES } from "../extensions/theme.js";
3
+ import { injectedAgentNativeAppId } from "./app-config.js";
2
4
  import { getViteDevRecoveryScript, shouldInlineViteDevRecoveryScript, } from "./vite-dev-recovery-script.js";
3
5
  export const EMBEDDED_THEME_UPDATE_MESSAGE = "agent-native-theme-update";
4
6
  export const EMBEDDED_THEME_CHANGE_EVENT = "agent-native:theme-change";
@@ -60,10 +62,11 @@ function normalizeDefaultTheme(theme) {
60
62
  }
61
63
  return "system";
62
64
  }
63
- export function getThemeInitScript(defaultTheme = "system", enableSystem = true) {
65
+ export function getThemeInitScript(defaultTheme = "system", enableSystem = true, appId) {
64
66
  const safeDefaultTheme = normalizeDefaultTheme(defaultTheme);
65
67
  const systemEnabled = enableSystem ? "true" : "false";
66
- const themeScript = `(function(){function m(){var d={};return{get length(){return Object.keys(d).length},key:function(i){return Object.keys(d)[i]||null},getItem:function(k){k=String(k);return Object.prototype.hasOwnProperty.call(d,k)?d[k]:null},setItem:function(k,v){d[String(k)]=String(v)},removeItem:function(k){delete d[String(k)]},clear:function(){d={}}}}function s(n){try{var x=window[n],p='__an_storage_probe__';x.setItem(p,'1');x.removeItem(p)}catch(e){try{Object.defineProperty(window,n,{configurable:true,value:m()})}catch(_){}}}s('localStorage');s('sessionStorage');try{var defaultTheme=${JSON.stringify(safeDefaultTheme)};var enableSystem=${systemEnabled};var stored=window.localStorage.getItem('theme');var valid=stored==='light'||stored==='dark'||stored==='system'||stored==='auto';var mode=valid?stored:defaultTheme;if(mode==='auto')mode='system';if(!enableSystem&&mode==='system')mode=defaultTheme==='system'?'light':defaultTheme;if(!valid){window.localStorage.removeItem('theme')}else if(stored!==mode){window.localStorage.setItem('theme',mode)}var prefersDark=enableSystem&&mode==='system'&&window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches;var resolved=mode==='system'?(prefersDark?'dark':'light'):mode;var root=document.documentElement;root.classList.remove('light','dark');root.classList.add(resolved);root.setAttribute('data-theme',resolved);root.style.colorScheme=resolved;var appearance=window.localStorage.getItem('appearance');var appearanceValid=appearance==='warm'||appearance==='ocean'||appearance==='forest'||appearance==='rose'||appearance==='slate';if(appearanceValid){root.setAttribute('data-appearance',appearance)}else{root.removeAttribute('data-appearance');if(appearance!==null)window.localStorage.removeItem('appearance')}}catch(e){}})();`;
68
+ const themeFamilyAppId = appId ?? injectedAgentNativeAppId() ?? undefined;
69
+ const themeScript = `${getThemeFamilyInitScript(themeFamilyAppId)}\n(function(){function m(){var d={};return{get length(){return Object.keys(d).length},key:function(i){return Object.keys(d)[i]||null},getItem:function(k){k=String(k);return Object.prototype.hasOwnProperty.call(d,k)?d[k]:null},setItem:function(k,v){d[String(k)]=String(v)},removeItem:function(k){delete d[k]},clear:function(){d={}}}}function s(n){try{var x=window[n],p='__an_storage_probe__';x.setItem(p,'1');x.removeItem(p)}catch(e){try{Object.defineProperty(window,n,{configurable:true,value:m()})}catch(_){}}}s('localStorage');s('sessionStorage');try{var defaultTheme=${JSON.stringify(safeDefaultTheme)};var enableSystem=${systemEnabled};var stored=window.localStorage.getItem('theme');var valid=stored==='light'||stored==='dark'||stored==='system'||stored==='auto';var mode=valid?stored:defaultTheme;if(mode==='auto')mode='system';if(!enableSystem&&mode==='system')mode=defaultTheme==='system'?'light':defaultTheme;if(!valid){window.localStorage.removeItem('theme')}else if(stored!==mode){window.localStorage.setItem('theme',mode)}var prefersDark=enableSystem&&mode==='system'&&window.matchMedia&&window.matchMedia('(prefers-color-scheme: dark)').matches;var resolved=mode==='system'?(prefersDark?'dark':'light'):mode;var root=document.documentElement;root.classList.remove('light','dark');root.classList.add(resolved);root.setAttribute('data-theme',resolved);root.style.colorScheme=resolved;var appearance=window.localStorage.getItem('appearance');var appearanceValid=appearance==='warm'||appearance==='ocean'||appearance==='forest'||appearance==='rose'||appearance==='slate';if(appearanceValid){root.setAttribute('data-appearance',appearance)}else{root.removeAttribute('data-appearance');if(appearance!==null)window.localStorage.removeItem('appearance')}}catch(e){document.documentElement.setAttribute('data-theme-status','unreadable')}})();`;
67
70
  if (!shouldInlineViteDevRecoveryScript())
68
71
  return themeScript;
69
72
  return `${themeScript}\n${getViteDevRecoveryScript()}`;
@@ -2,3 +2,4 @@ export { buildErrorReportTemplate, buildGitHubIssueUrl, type ErrorReportDebugIte
2
2
  export { getClientSurface, type ClientSurface } from "../client-surface.js";
3
3
  export { applyEmbeddedThemeUpdate, buildEmbeddedThemeUpdate, EMBEDDED_THEME_CHANGE_EVENT, EMBEDDED_THEME_UPDATE_MESSAGE, getThemeInitScript, parseEmbeddedThemeUpdate, themeInitScript, type EmbeddedThemeUpdate, type NormalizedEmbeddedThemeUpdate, type ResolvedTheme, type ThemePreference, } from "../theme.js";
4
4
  export { APPEARANCE_PRESETS, applyAppearance, getStoredAppearance, useAppearance, useAppearanceSync, type AppearancePresetId, } from "../appearance.js";
5
+ export { applyThemeFamily, readStoredThemeFamily, THEME_FAMILY_CHANGE_EVENT, useThemeFamily, type StoredThemeFamily, type ThemeFamily, type ThemeFamilyApplyResult, type ThemeFamilyHook, type ThemeFamilyStorageStatus, } from "../theme-family.js";
@@ -2,3 +2,4 @@ export { buildErrorReportTemplate, buildGitHubIssueUrl, } from "../error-reporti
2
2
  export { getClientSurface } from "../client-surface.js";
3
3
  export { applyEmbeddedThemeUpdate, buildEmbeddedThemeUpdate, EMBEDDED_THEME_CHANGE_EVENT, EMBEDDED_THEME_UPDATE_MESSAGE, getThemeInitScript, parseEmbeddedThemeUpdate, themeInitScript, } from "../theme.js";
4
4
  export { APPEARANCE_PRESETS, applyAppearance, getStoredAppearance, useAppearance, useAppearanceSync, } from "../appearance.js";
5
+ export { applyThemeFamily, readStoredThemeFamily, THEME_FAMILY_CHANGE_EVENT, useThemeFamily, } from "../theme-family.js";
@@ -6,6 +6,8 @@ export interface UseChatThreadListOptions {
6
6
  pageSize?: number;
7
7
  scope?: ChatThreadScope | null;
8
8
  includeExternal?: boolean;
9
+ /** Include archived threads. Defaults to false. */
10
+ includeArchived?: boolean;
9
11
  /** Search text. Empty lists the whole set. */
10
12
  query?: string;
11
13
  /** When false nothing is fetched and the list is empty. Defaults to true. */
@@ -48,7 +48,7 @@ function createListState(identity, enabled) {
48
48
  * rather than collapsing to the first page.
49
49
  */
50
50
  export function useChatThreadList(options) {
51
- const { ownership, includeExternal = false, enabled = true, refreshOnThreadUpdates = true, } = options;
51
+ const { ownership, includeExternal = false, includeArchived = false, enabled = true, refreshOnThreadUpdates = true, } = options;
52
52
  const apiUrl = options.apiUrl ?? agentNativePath("/_agent-native/agent-chat");
53
53
  const pageSize = resolvePageSize(options.pageSize);
54
54
  const query = options.query?.trim() ?? "";
@@ -62,6 +62,7 @@ export function useChatThreadList(options) {
62
62
  scopeId,
63
63
  pageSize,
64
64
  includeExternal,
65
+ includeArchived,
65
66
  enabled,
66
67
  ]);
67
68
  const [stored, setState] = useState(() => createListState(identity, enabled));
@@ -89,6 +90,7 @@ export function useChatThreadList(options) {
89
90
  query,
90
91
  ownership,
91
92
  includeExternal,
93
+ includeArchived,
92
94
  scope: scopeType && scopeId ? { type: scopeType, id: scopeId } : null,
93
95
  }).then((result) => {
94
96
  if (result.hasMore === undefined) {
@@ -100,7 +102,15 @@ export function useChatThreadList(options) {
100
102
  throw new ChatThreadListError("Chat history response reported more threads but returned none.");
101
103
  }
102
104
  return { threads: result.threads, hasMore: result.hasMore };
103
- }), [apiUrl, includeExternal, ownership, query, scopeId, scopeType]);
105
+ }), [
106
+ apiUrl,
107
+ includeArchived,
108
+ includeExternal,
109
+ ownership,
110
+ query,
111
+ scopeId,
112
+ scopeType,
113
+ ]);
104
114
  // Reload the first `window` server rows, one capped page at a time, and swap
105
115
  // them in only once every page has arrived. A failure part-way leaves the
106
116
  // rows and offset already on screen untouched.
@@ -98,6 +98,7 @@ export interface ChatThreadListPageRequest {
98
98
  query?: string;
99
99
  ownership?: ChatThreadOwnership;
100
100
  includeExternal?: boolean;
101
+ includeArchived?: boolean;
101
102
  scope?: ChatThreadScope | null;
102
103
  }
103
104
  /** A listed thread as the server returns it: ownership metadata always present. */
@@ -120,6 +120,8 @@ async function requestChatThreadListPage(request) {
120
120
  }
121
121
  if (request.includeExternal)
122
122
  params.set("includeExternal", "1");
123
+ if (request.includeArchived)
124
+ params.set("includeArchived", "1");
123
125
  appendChatThreadScopeParams(params, request.scope);
124
126
  const search = params.toString();
125
127
  const res = await fetch(`${apiUrl}/threads${search ? `?${search}` : ""}`);
@@ -1,5 +1,5 @@
1
1
  export type WorkspaceConnectionCapability = "search" | "import" | "messages" | "meetings" | "crm" | "code" | "docs";
2
- export type WorkspaceConnectionTemplateUse = "analytics" | "brain" | "calendar" | "clips" | "content" | "crm" | "design" | "dispatch" | "factory" | "forms" | "mail" | "slides";
2
+ export type WorkspaceConnectionTemplateUse = "analytics" | "brain" | "calendar" | "clips" | "content" | "crm" | "design" | "dispatch" | "factory" | "forms" | "mail" | "slides" | "slides-2";
3
3
  export type WorkspaceConnectionProviderId = "slack" | "github" | "figma" | "notion" | "gmail" | "google_calendar" | "google_drive" | "bigquery" | "google_docs" | "google_sheets" | "google_slides" | "hubspot" | "salesforce" | "jira" | "sentry" | "granola" | "clips" | "dbt" | "sigma" | "anthropic-managed-agents" | "generic";
4
4
  export interface WorkspaceConnectionCredentialKey {
5
5
  key: string;
@@ -84,7 +84,7 @@ export declare const WORKSPACE_CONNECTION_PROVIDERS: readonly [{
84
84
  readonly scopes: readonly ["current_user:read", "file_content:read", "file_metadata:read", "projects:read"];
85
85
  };
86
86
  readonly capabilities: readonly ["search", "import", "docs"];
87
- readonly recommendedTemplateUses: readonly ["brain", "design", "slides", "content"];
87
+ readonly recommendedTemplateUses: readonly ["brain", "design", "slides", "slides-2", "content"];
88
88
  }, {
89
89
  readonly id: "notion";
90
90
  readonly label: "Notion";
@@ -184,7 +184,7 @@ export declare const WORKSPACE_CONNECTION_PROVIDERS: readonly [{
184
184
  readonly required: true;
185
185
  }];
186
186
  readonly capabilities: readonly ["search", "import", "docs"];
187
- readonly recommendedTemplateUses: readonly ["brain", "content", "slides", "dispatch", "analytics"];
187
+ readonly recommendedTemplateUses: readonly ["brain", "content", "slides", "slides-2", "dispatch", "analytics"];
188
188
  readonly oauth: {
189
189
  authorizationUrl: "https://accounts.google.com/o/oauth2/v2/auth";
190
190
  tokenUrl: "https://oauth2.googleapis.com/token";
@@ -207,7 +207,7 @@ export declare const WORKSPACE_CONNECTION_PROVIDERS: readonly [{
207
207
  readonly required: true;
208
208
  }];
209
209
  readonly capabilities: readonly ["search", "import", "docs"];
210
- readonly recommendedTemplateUses: readonly ["brain", "content", "slides", "dispatch"];
210
+ readonly recommendedTemplateUses: readonly ["brain", "content", "slides", "slides-2", "dispatch"];
211
211
  readonly oauth: {
212
212
  authorizationUrl: "https://accounts.google.com/o/oauth2/v2/auth";
213
213
  tokenUrl: "https://oauth2.googleapis.com/token";
@@ -253,7 +253,7 @@ export declare const WORKSPACE_CONNECTION_PROVIDERS: readonly [{
253
253
  readonly required: true;
254
254
  }];
255
255
  readonly capabilities: readonly ["search", "import", "docs"];
256
- readonly recommendedTemplateUses: readonly ["brain", "content", "slides", "dispatch"];
256
+ readonly recommendedTemplateUses: readonly ["brain", "content", "slides", "slides-2", "dispatch"];
257
257
  readonly oauth: {
258
258
  authorizationUrl: "https://accounts.google.com/o/oauth2/v2/auth";
259
259
  tokenUrl: "https://oauth2.googleapis.com/token";
@@ -92,7 +92,13 @@ export const WORKSPACE_CONNECTION_PROVIDERS = [
92
92
  ],
93
93
  },
94
94
  capabilities: ["search", "import", "docs"],
95
- recommendedTemplateUses: ["brain", "design", "slides", "content"],
95
+ recommendedTemplateUses: [
96
+ "brain",
97
+ "design",
98
+ "slides",
99
+ "slides-2",
100
+ "content",
101
+ ],
96
102
  }),
97
103
  defineWorkspaceConnectionProvider({
98
104
  id: "notion",
@@ -161,6 +167,7 @@ export const WORKSPACE_CONNECTION_PROVIDERS = [
161
167
  "brain",
162
168
  "content",
163
169
  "slides",
170
+ "slides-2",
164
171
  "dispatch",
165
172
  "analytics",
166
173
  ],
@@ -176,7 +183,13 @@ export const WORKSPACE_CONNECTION_PROVIDERS = [
176
183
  description: "Google Docs files for source material, document search, and agent-assisted writing workflows.",
177
184
  credentialKeys: GOOGLE_CREDENTIAL_KEYS,
178
185
  capabilities: ["search", "import", "docs"],
179
- recommendedTemplateUses: ["brain", "content", "slides", "dispatch"],
186
+ recommendedTemplateUses: [
187
+ "brain",
188
+ "content",
189
+ "slides",
190
+ "slides-2",
191
+ "dispatch",
192
+ ],
180
193
  oauth: googleOAuth([
181
194
  ...GOOGLE_IDENTITY_SCOPES,
182
195
  "https://www.googleapis.com/auth/documents.readonly",
@@ -197,7 +210,13 @@ export const WORKSPACE_CONNECTION_PROVIDERS = [
197
210
  description: "Google Slides presentations for reference imports, visual context, and presentation workflows.",
198
211
  credentialKeys: GOOGLE_CREDENTIAL_KEYS,
199
212
  capabilities: ["search", "import", "docs"],
200
- recommendedTemplateUses: ["brain", "content", "slides", "dispatch"],
213
+ recommendedTemplateUses: [
214
+ "brain",
215
+ "content",
216
+ "slides",
217
+ "slides-2",
218
+ "dispatch",
219
+ ],
201
220
  oauth: googleOAuth([
202
221
  ...GOOGLE_IDENTITY_SCOPES,
203
222
  "https://www.googleapis.com/auth/presentations.readonly",