@agent-native/core 0.72.3 → 0.73.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 (223) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +38 -0
  3. package/corpus/core/docs/content/skills-guide.md +14 -0
  4. package/corpus/core/docs/content/template-clips.md +7 -1
  5. package/corpus/core/package.json +6 -6
  6. package/corpus/core/src/a2a/client.ts +7 -3
  7. package/corpus/core/src/agent/durable-background.ts +25 -12
  8. package/corpus/core/src/cli/create.ts +1 -1
  9. package/corpus/core/src/cli/skills.ts +450 -19
  10. package/corpus/core/src/client/api-path.ts +28 -0
  11. package/corpus/core/src/client/embed-auth.ts +26 -0
  12. package/corpus/core/src/client/mcp-app-host.ts +6 -0
  13. package/corpus/core/src/client/mcp-apps/McpAppRenderer.tsx +227 -33
  14. package/corpus/core/src/client/resources/use-mcp-servers.ts +1 -0
  15. package/corpus/core/src/client/settings/DemoModeSection.tsx +3 -1
  16. package/corpus/core/src/demo/fetch-interceptor.ts +1 -1
  17. package/corpus/core/src/embedding/agent.ts +6 -1
  18. package/corpus/core/src/embedding/bridge.ts +34 -1
  19. package/corpus/core/src/mcp/build-server.ts +38 -10
  20. package/corpus/core/src/mcp/embed-app.ts +120 -45
  21. package/corpus/core/src/mcp/index.ts +5 -0
  22. package/corpus/core/src/mcp/org-directory.ts +70 -11
  23. package/corpus/core/src/mcp/server.ts +14 -0
  24. package/corpus/core/src/mcp-client/config.ts +12 -0
  25. package/corpus/core/src/mcp-client/index.ts +2 -0
  26. package/corpus/core/src/mcp-client/manager.ts +268 -9
  27. package/corpus/core/src/mcp-client/remote-store.ts +154 -0
  28. package/corpus/core/src/mcp-client/routes.ts +2 -0
  29. package/corpus/core/src/server/agent-chat-plugin.ts +8 -0
  30. package/corpus/core/src/server/auth.ts +7 -0
  31. package/corpus/core/src/server/index.ts +1 -0
  32. package/corpus/core/src/server/onboarding-html.ts +95 -9
  33. package/corpus/core/src/shared/mcp-embed-headers.ts +44 -3
  34. package/corpus/core/src/templates/default/AGENTS.md +4 -0
  35. package/corpus/core/src/templates/default/package.json +2 -1
  36. package/corpus/core/src/templates/headless/AGENTS.md +4 -0
  37. package/corpus/core/src/templates/headless/package.json +1 -0
  38. package/corpus/core/src/templates/workspace-root/AGENTS.md +4 -0
  39. package/corpus/core/src/templates/workspace-root/README.md +4 -0
  40. package/corpus/core/src/templates/workspace-root/package.json +1 -0
  41. package/corpus/core/src/vite/client.ts +53 -0
  42. package/corpus/templates/analytics/actions/update-dashboard.ts +3 -4
  43. package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +144 -40
  44. package/corpus/templates/analytics/app/global.css +15 -13
  45. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +9 -32
  46. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +0 -26
  47. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +0 -23
  48. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/pivot.ts +65 -2
  49. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +3 -4
  50. package/corpus/templates/analytics/changelog/2026-06-24-dashboard-charts-now-fill-sparse-template-time-series-suppor.md +6 -0
  51. package/corpus/templates/analytics/changelog/2026-06-24-dashboard-rows-now-auto-fit-panels-so-one-two-or-three-chart.md +6 -0
  52. package/corpus/templates/analytics/changelog/2026-06-24-dashboard-traffic-tables-now-show-top-urls-and-shared-clips-.md +6 -0
  53. package/corpus/templates/analytics/changelog/2026-06-24-first-party-signup-and-pageview-panels-now-honor-dashboard-filters.md +5 -0
  54. package/corpus/templates/analytics/changelog/2026-06-24-first-party-template-dashboards-now-include-repeat-users-ret.md +6 -0
  55. package/corpus/templates/analytics/changelog/2026-06-24-retention-charts-now-break-out-1-day-and-7-day-return-rates-.md +6 -0
  56. package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +256 -44
  57. package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +7 -2
  58. package/corpus/templates/analytics/server/lib/first-party-analytics.ts +35 -8
  59. package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +287 -42
  60. package/corpus/templates/assets/.agents/skills/a2a-assets/SKILL.md +17 -10
  61. package/corpus/templates/assets/.agents/skills/asset-generation/SKILL.md +15 -6
  62. package/corpus/templates/assets/AGENTS.md +7 -5
  63. package/corpus/templates/assets/actions/generate-asset.ts +161 -0
  64. package/corpus/templates/assets/actions/list-assets.ts +4 -2
  65. package/corpus/templates/assets/actions/open-asset-picker.ts +84 -3
  66. package/corpus/templates/assets/app/routes/library.tsx +243 -40
  67. package/corpus/templates/calendar/changelog/2026-06-23-added-a-heads-up-explaining-google-s-app-not-verified-screen.md +1 -1
  68. package/corpus/templates/calendar/server/plugins/auth.ts +12 -0
  69. package/corpus/templates/clips/.agents/skills/recording/SKILL.md +7 -7
  70. package/corpus/templates/clips/AGENTS.md +6 -2
  71. package/corpus/templates/clips/app/components/capture-install-options.tsx +20 -4
  72. package/corpus/templates/clips/app/components/player/player-controls.tsx +62 -32
  73. package/corpus/templates/clips/app/lib/capture-install-options.ts +39 -5
  74. package/corpus/templates/clips/app/routes/download.tsx +2 -2
  75. package/corpus/templates/clips/app/routes/share.$shareId.tsx +1 -1
  76. package/corpus/templates/clips/changelog/2026-06-24-inline-slack-playback-controls-no-longer-shift-when-adjustin.md +6 -0
  77. package/corpus/templates/clips/changelog/2026-06-24-shared-clips-now-expose-their-full-console-log-stream-all-le.md +6 -0
  78. package/corpus/templates/clips/changelog/2026-06-24-shared-clips-now-expose-their-full-fetch-xhr-network-request.md +6 -0
  79. package/corpus/templates/clips/changelog/2026-06-24-the-chrome-extension-option-now-only-appears-on-supported-hosts.md +5 -0
  80. package/corpus/templates/clips/chrome-extension/STORE_DRAFT.md +13 -8
  81. package/corpus/templates/clips/chrome-extension/public/manifest.json +1 -1
  82. package/corpus/templates/clips/chrome-extension/scripts/package.ts +15 -2
  83. package/corpus/templates/clips/chrome-extension/src/overlay.css +4 -25
  84. package/corpus/templates/clips/chrome-extension/src/overlay.ts +1 -3
  85. package/corpus/templates/clips/desktop/src-tauri/src/native_speech.rs +9 -0
  86. package/corpus/templates/clips/server/lib/public-agent-context.ts +67 -24
  87. package/corpus/templates/design/AGENTS.md +10 -5
  88. package/corpus/templates/design/actions/connect-assets-mcp.ts +131 -0
  89. package/corpus/templates/design/actions/insert-asset.ts +219 -0
  90. package/corpus/templates/design/actions/view-screen.ts +3 -1
  91. package/corpus/templates/design/app/components/editor/PromptDialog.tsx +1 -1
  92. package/corpus/templates/design/app/pages/DesignEditor.tsx +53 -0
  93. package/corpus/templates/design/server/plugins/agent-chat.ts +5 -1
  94. package/corpus/templates/design/server/plugins/assets-mcp.ts +60 -0
  95. package/corpus/templates/mail/server/plugins/auth.ts +4 -1
  96. package/corpus/templates/plan/app/pages/PlansPage.tsx +271 -197
  97. package/corpus/templates/plan/server/plan-content.ts +45 -2
  98. package/dist/a2a/client.d.ts +1 -0
  99. package/dist/a2a/client.d.ts.map +1 -1
  100. package/dist/a2a/client.js +5 -3
  101. package/dist/a2a/client.js.map +1 -1
  102. package/dist/agent/durable-background.d.ts +9 -4
  103. package/dist/agent/durable-background.d.ts.map +1 -1
  104. package/dist/agent/durable-background.js +24 -11
  105. package/dist/agent/durable-background.js.map +1 -1
  106. package/dist/cli/create.js +1 -1
  107. package/dist/cli/create.js.map +1 -1
  108. package/dist/cli/skills.d.ts.map +1 -1
  109. package/dist/cli/skills.js +361 -19
  110. package/dist/cli/skills.js.map +1 -1
  111. package/dist/client/api-path.d.ts.map +1 -1
  112. package/dist/client/api-path.js +27 -0
  113. package/dist/client/api-path.js.map +1 -1
  114. package/dist/client/embed-auth.d.ts.map +1 -1
  115. package/dist/client/embed-auth.js +27 -0
  116. package/dist/client/embed-auth.js.map +1 -1
  117. package/dist/client/mcp-app-host.d.ts.map +1 -1
  118. package/dist/client/mcp-app-host.js +5 -0
  119. package/dist/client/mcp-app-host.js.map +1 -1
  120. package/dist/client/mcp-apps/McpAppRenderer.d.ts +1 -0
  121. package/dist/client/mcp-apps/McpAppRenderer.d.ts.map +1 -1
  122. package/dist/client/mcp-apps/McpAppRenderer.js +179 -33
  123. package/dist/client/mcp-apps/McpAppRenderer.js.map +1 -1
  124. package/dist/client/resources/use-mcp-servers.d.ts +1 -0
  125. package/dist/client/resources/use-mcp-servers.d.ts.map +1 -1
  126. package/dist/client/resources/use-mcp-servers.js.map +1 -1
  127. package/dist/client/settings/DemoModeSection.d.ts.map +1 -1
  128. package/dist/client/settings/DemoModeSection.js +3 -1
  129. package/dist/client/settings/DemoModeSection.js.map +1 -1
  130. package/dist/demo/fetch-interceptor.js +1 -1
  131. package/dist/demo/fetch-interceptor.js.map +1 -1
  132. package/dist/embedding/agent.d.ts +1 -1
  133. package/dist/embedding/agent.d.ts.map +1 -1
  134. package/dist/embedding/agent.js +1 -1
  135. package/dist/embedding/agent.js.map +1 -1
  136. package/dist/embedding/bridge.d.ts.map +1 -1
  137. package/dist/embedding/bridge.js +27 -1
  138. package/dist/embedding/bridge.js.map +1 -1
  139. package/dist/extensions/schema.d.ts +2 -2
  140. package/dist/mcp/build-server.d.ts +2 -0
  141. package/dist/mcp/build-server.d.ts.map +1 -1
  142. package/dist/mcp/build-server.js +32 -9
  143. package/dist/mcp/build-server.js.map +1 -1
  144. package/dist/mcp/embed-app.d.ts.map +1 -1
  145. package/dist/mcp/embed-app.js +120 -45
  146. package/dist/mcp/embed-app.js.map +1 -1
  147. package/dist/mcp/index.d.ts +1 -0
  148. package/dist/mcp/index.d.ts.map +1 -1
  149. package/dist/mcp/index.js +1 -0
  150. package/dist/mcp/index.js.map +1 -1
  151. package/dist/mcp/org-directory.d.ts +1 -0
  152. package/dist/mcp/org-directory.d.ts.map +1 -1
  153. package/dist/mcp/org-directory.js +59 -11
  154. package/dist/mcp/org-directory.js.map +1 -1
  155. package/dist/mcp/server.d.ts.map +1 -1
  156. package/dist/mcp/server.js +9 -0
  157. package/dist/mcp/server.js.map +1 -1
  158. package/dist/mcp-client/config.d.ts +12 -0
  159. package/dist/mcp-client/config.d.ts.map +1 -1
  160. package/dist/mcp-client/config.js.map +1 -1
  161. package/dist/mcp-client/index.d.ts +1 -1
  162. package/dist/mcp-client/index.d.ts.map +1 -1
  163. package/dist/mcp-client/index.js +1 -1
  164. package/dist/mcp-client/index.js.map +1 -1
  165. package/dist/mcp-client/manager.d.ts +2 -0
  166. package/dist/mcp-client/manager.d.ts.map +1 -1
  167. package/dist/mcp-client/manager.js +201 -9
  168. package/dist/mcp-client/manager.js.map +1 -1
  169. package/dist/mcp-client/remote-store.d.ts +27 -0
  170. package/dist/mcp-client/remote-store.d.ts.map +1 -1
  171. package/dist/mcp-client/remote-store.js +105 -0
  172. package/dist/mcp-client/remote-store.js.map +1 -1
  173. package/dist/mcp-client/routes.d.ts +1 -0
  174. package/dist/mcp-client/routes.d.ts.map +1 -1
  175. package/dist/mcp-client/routes.js +1 -0
  176. package/dist/mcp-client/routes.js.map +1 -1
  177. package/dist/provider-api/actions/github-repo-files.d.ts +2 -2
  178. package/dist/provider-api/actions/query-staged-dataset.d.ts +3 -3
  179. package/dist/provider-api/corpus-jobs.d.ts +8 -8
  180. package/dist/server/agent-chat-plugin.d.ts +2 -0
  181. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  182. package/dist/server/agent-chat-plugin.js +8 -0
  183. package/dist/server/agent-chat-plugin.js.map +1 -1
  184. package/dist/server/auth.d.ts +7 -0
  185. package/dist/server/auth.d.ts.map +1 -1
  186. package/dist/server/auth.js +1 -0
  187. package/dist/server/auth.js.map +1 -1
  188. package/dist/server/index.d.ts +1 -1
  189. package/dist/server/index.d.ts.map +1 -1
  190. package/dist/server/index.js +1 -1
  191. package/dist/server/index.js.map +1 -1
  192. package/dist/server/onboarding-html.d.ts +15 -0
  193. package/dist/server/onboarding-html.d.ts.map +1 -1
  194. package/dist/server/onboarding-html.js +73 -9
  195. package/dist/server/onboarding-html.js.map +1 -1
  196. package/dist/shared/mcp-embed-headers.d.ts +3 -1
  197. package/dist/shared/mcp-embed-headers.d.ts.map +1 -1
  198. package/dist/shared/mcp-embed-headers.js +40 -3
  199. package/dist/shared/mcp-embed-headers.js.map +1 -1
  200. package/dist/sharing/actions/list-resource-shares.d.ts +1 -1
  201. package/dist/sharing/actions/set-resource-visibility.d.ts +2 -2
  202. package/dist/sharing/actions/share-resource.d.ts +1 -1
  203. package/dist/sharing/schema.d.ts +1 -1
  204. package/dist/templates/default/AGENTS.md +4 -0
  205. package/dist/templates/default/package.json +2 -1
  206. package/dist/templates/headless/AGENTS.md +4 -0
  207. package/dist/templates/headless/package.json +1 -0
  208. package/dist/templates/workspace-root/AGENTS.md +4 -0
  209. package/dist/templates/workspace-root/README.md +4 -0
  210. package/dist/templates/workspace-root/package.json +1 -0
  211. package/dist/vite/client.d.ts.map +1 -1
  212. package/dist/vite/client.js +44 -0
  213. package/dist/vite/client.js.map +1 -1
  214. package/docs/content/skills-guide.md +14 -0
  215. package/docs/content/template-clips.md +7 -1
  216. package/package.json +6 -6
  217. package/src/templates/default/AGENTS.md +4 -0
  218. package/src/templates/default/package.json +2 -1
  219. package/src/templates/headless/AGENTS.md +4 -0
  220. package/src/templates/headless/package.json +1 -0
  221. package/src/templates/workspace-root/AGENTS.md +4 -0
  222. package/src/templates/workspace-root/README.md +4 -0
  223. package/src/templates/workspace-root/package.json +1 -0
@@ -0,0 +1,161 @@
1
+ import { defineAction, embedApp } from "@agent-native/core";
2
+ import { z } from "zod";
3
+ import openAssetPicker from "./open-asset-picker.js";
4
+ import {
5
+ ASPECT_RATIOS,
6
+ IMAGE_QUALITY_TIERS,
7
+ STYLE_STRENGTHS,
8
+ } from "../shared/api.js";
9
+
10
+ const booleanParam = z.preprocess((value) => {
11
+ if (typeof value === "boolean") return value;
12
+ if (typeof value !== "string") return value;
13
+ const normalized = value.trim().toLowerCase();
14
+ if (["1", "true", "yes", "on"].includes(normalized)) return true;
15
+ if (["", "0", "false", "no", "off"].includes(normalized)) return false;
16
+ return value;
17
+ }, z.boolean());
18
+
19
+ const schema = z.object({
20
+ mediaType: z.enum(["image", "video"]).default("image"),
21
+ prompt: z
22
+ .string()
23
+ .min(1)
24
+ .describe("The asset brief to generate or prepare in the picker."),
25
+ libraryId: z
26
+ .string()
27
+ .optional()
28
+ .describe("Known Assets library ID. Omit to match the best library."),
29
+ libraryHint: z
30
+ .string()
31
+ .optional()
32
+ .describe(
33
+ "Brand, campaign, or use-case hint used when matching a library.",
34
+ ),
35
+ aspectRatio: z.enum(ASPECT_RATIOS).default("16:9"),
36
+ presetId: z
37
+ .string()
38
+ .optional()
39
+ .describe("Optional generation preset ID from the selected library."),
40
+ count: z.coerce
41
+ .number()
42
+ .int()
43
+ .min(1)
44
+ .max(6)
45
+ .default(3)
46
+ .describe("Number of image candidates to generate in the picker."),
47
+ tier: z.enum(IMAGE_QUALITY_TIERS).optional(),
48
+ styleStrength: z.enum(STYLE_STRENGTHS).default("balanced"),
49
+ includeLogo: booleanParam.default(false),
50
+ callerAppId: z
51
+ .string()
52
+ .optional()
53
+ .describe("Calling app id, for audit grouping, e.g. design."),
54
+ });
55
+
56
+ type ActionWithToolParameters = {
57
+ tool: { parameters?: { properties?: Record<string, any> } };
58
+ };
59
+
60
+ function allowStringifiedCountInToolSchema<T extends ActionWithToolParameters>(
61
+ action: T,
62
+ ): T {
63
+ const parameters = action.tool.parameters;
64
+ const count = parameters?.properties?.count;
65
+ if (count && typeof count === "object" && !Array.isArray(count)) {
66
+ parameters!.properties!.count = {
67
+ description: count.description,
68
+ default: count.default,
69
+ anyOf: [
70
+ count,
71
+ {
72
+ type: "string",
73
+ pattern: "^[1-6]$",
74
+ description: count.description,
75
+ },
76
+ ],
77
+ };
78
+ }
79
+ return action;
80
+ }
81
+
82
+ const action = defineAction({
83
+ description:
84
+ "Open the real Assets picker and start on-brand image generation there so the tool returns immediately and the user can choose the final image/video. Use this for human-in-the-loop brand media requests from Design, Slides, ChatGPT, Claude, or Codex. Preserve returned asset IDs and URLs exactly after the user picks.",
85
+ schema,
86
+ publicAgent: {
87
+ expose: true,
88
+ readOnly: false,
89
+ requiresAuth: true,
90
+ title: "Generate an on-brand asset",
91
+ description:
92
+ "Start brand-consistent image generation in the Assets picker.",
93
+ },
94
+ mcpApp: {
95
+ compactCatalog: true,
96
+ resource: embedApp({
97
+ title: "Generate Assets",
98
+ description:
99
+ "Generate image candidates and choose the final asset in the real Assets Library picker.",
100
+ iframeTitle: "Agent-Native Assets",
101
+ openLabel: "Open Assets picker",
102
+ height: 760,
103
+ connectDomains: ["https://cdn.builder.io"],
104
+ resourceDomains: ["https://cdn.builder.io"],
105
+ }),
106
+ },
107
+ link: ({ result }) => {
108
+ const url =
109
+ result && typeof result === "object"
110
+ ? (result as { url?: unknown }).url
111
+ : null;
112
+ return {
113
+ url: typeof url === "string" && url ? url : "/library",
114
+ label: "Open Assets picker",
115
+ view: "picker",
116
+ };
117
+ },
118
+ run: async (args) => {
119
+ if (args.mediaType === "video") {
120
+ const picker = (await openAssetPicker.run({
121
+ mediaType: "video",
122
+ prompt: args.prompt,
123
+ libraryId: args.libraryId,
124
+ libraryHint: args.libraryHint,
125
+ count: args.count,
126
+ callerAppId: args.callerAppId,
127
+ })) as Record<string, unknown>;
128
+ return {
129
+ ...picker,
130
+ generated: false,
131
+ message:
132
+ "Assets video picker is ready. Generate or select the video in the picker, then choose the asset to send it back.",
133
+ };
134
+ }
135
+
136
+ const picker = (await openAssetPicker.run({
137
+ mediaType: "image",
138
+ prompt: args.prompt,
139
+ libraryId: args.libraryId,
140
+ libraryHint: args.libraryHint,
141
+ aspectRatio: args.aspectRatio,
142
+ presetId: args.presetId,
143
+ count: args.count,
144
+ autoGenerate: true,
145
+ tier: args.tier,
146
+ styleStrength: args.styleStrength,
147
+ includeLogo: args.includeLogo,
148
+ callerAppId: args.callerAppId,
149
+ })) as Record<string, unknown>;
150
+ return {
151
+ ...picker,
152
+ generated: false,
153
+ generationStarted: false,
154
+ generationMode: "picker-auto-generate",
155
+ message:
156
+ "Assets picker is ready and will start image generation inside the picker. If this org has no libraries yet, the picker will create a starter library first. Ask the user to pick one candidate; preserve the chosen assetId, runId, and URLs exactly.",
157
+ };
158
+ },
159
+ });
160
+
161
+ export default allowStringifiedCountInToolSchema(action);
@@ -95,13 +95,15 @@ export default defineAction({
95
95
  .filter((asset) =>
96
96
  shouldIncludeAssetInLibraryResults(
97
97
  asset,
98
- includeCandidates || status === "candidate",
98
+ includeCandidates ||
99
+ status === "candidate" ||
100
+ candidateRunIdSet.size > 0,
99
101
  ),
100
102
  )
101
103
  .filter((asset) => {
102
104
  if (!candidateRunIdSet.size) return true;
103
105
  if (!(asset.role === "generated" && asset.status === "candidate")) {
104
- return true;
106
+ return false;
105
107
  }
106
108
  return Boolean(
107
109
  asset.generationRunId && candidateRunIdSet.has(asset.generationRunId),
@@ -1,7 +1,16 @@
1
1
  import { defineAction, embedApp } from "@agent-native/core";
2
2
  import { z } from "zod";
3
+ import { IMAGE_QUALITY_TIERS, STYLE_STRENGTHS } from "../shared/api.js";
3
4
 
4
5
  const mediaTypeSchema = z.enum(["image", "video"]);
6
+ const booleanParam = z.preprocess((value) => {
7
+ if (typeof value === "boolean") return value;
8
+ if (typeof value !== "string") return value;
9
+ const normalized = value.trim().toLowerCase();
10
+ if (["1", "true", "yes", "on"].includes(normalized)) return true;
11
+ if (["", "0", "false", "no", "off"].includes(normalized)) return false;
12
+ return value;
13
+ }, z.boolean());
5
14
 
6
15
  const schema = z.object({
7
16
  mediaType: mediaTypeSchema.default("image"),
@@ -17,6 +26,12 @@ const schema = z.object({
17
26
  .string()
18
27
  .optional()
19
28
  .describe("Optional asset library to open in the picker."),
29
+ libraryHint: z
30
+ .string()
31
+ .optional()
32
+ .describe(
33
+ "Brand, campaign, or use-case hint used to preselect the best-matching library when libraryId is omitted.",
34
+ ),
20
35
  aspectRatio: z
21
36
  .string()
22
37
  .optional()
@@ -32,16 +47,62 @@ const schema = z.object({
32
47
  .max(6)
33
48
  .default(3)
34
49
  .describe("Number of image candidates to generate in the picker."),
35
- autoGenerate: z.coerce
36
- .boolean()
50
+ candidateRunIds: z
51
+ .array(z.string())
52
+ .optional()
53
+ .describe(
54
+ "Generation run IDs to show as the candidate set when returning from a tool-generated batch.",
55
+ ),
56
+ autoGenerate: booleanParam
37
57
  .default(false)
38
58
  .describe(
39
59
  "When true and prompt is provided, generate candidates as soon as the picker opens.",
40
60
  ),
61
+ tier: z
62
+ .enum(IMAGE_QUALITY_TIERS)
63
+ .optional()
64
+ .describe("Optional image quality tier to use for auto-generation."),
65
+ styleStrength: z
66
+ .enum(STYLE_STRENGTHS)
67
+ .default("balanced")
68
+ .describe("How strongly to follow the library style during generation."),
69
+ includeLogo: booleanParam
70
+ .default(false)
71
+ .describe("Whether auto-generation should include the library logo."),
72
+ callerAppId: z
73
+ .string()
74
+ .optional()
75
+ .describe("Calling app id, for audit grouping, e.g. design."),
41
76
  });
42
77
 
43
78
  type OpenAssetPickerArgs = z.infer<typeof schema>;
44
79
 
80
+ type ActionWithToolParameters = {
81
+ tool: { parameters?: { properties?: Record<string, any> } };
82
+ };
83
+
84
+ function allowStringifiedCountInToolSchema<T extends ActionWithToolParameters>(
85
+ action: T,
86
+ ): T {
87
+ const parameters = action.tool.parameters;
88
+ const count = parameters?.properties?.count;
89
+ if (count && typeof count === "object" && !Array.isArray(count)) {
90
+ parameters!.properties!.count = {
91
+ description: count.description,
92
+ default: count.default,
93
+ anyOf: [
94
+ count,
95
+ {
96
+ type: "string",
97
+ pattern: "^[1-6]$",
98
+ description: count.description,
99
+ },
100
+ ],
101
+ };
102
+ }
103
+ return action;
104
+ }
105
+
45
106
  const FALLBACK_INSTRUCTIONS =
46
107
  'If the picker opens in a normal browser tab instead of inline, the user has two ways to choose: (1) click an asset — the picker auto-copies a short handoff summary they paste back into chat, or (2) just tell you which one in words (e.g. "use the second image"). Either way, continue with the chosen asset. In Codex, Claude Code, and other code-editor chats, do not expect MCP Apps to render inline; provide the asset link, and if the final answer needs an inline image preview, download the selected image URL locally and embed the absolute local file path because remote CDN markdown previews may not render there.';
47
108
 
@@ -51,16 +112,28 @@ function pickerPath(args: Partial<OpenAssetPickerArgs>): string {
51
112
  if (args.prompt?.trim()) params.set("prompt", args.prompt.trim());
52
113
  if (args.query?.trim()) params.set("q", args.query.trim());
53
114
  if (args.libraryId?.trim()) params.set("libraryId", args.libraryId.trim());
115
+ if (args.libraryHint?.trim()) {
116
+ params.set("libraryHint", args.libraryHint.trim());
117
+ }
54
118
  if (args.aspectRatio?.trim()) {
55
119
  params.set("aspectRatio", args.aspectRatio.trim());
56
120
  }
57
121
  if (args.presetId?.trim()) params.set("presetId", args.presetId.trim());
58
122
  if (args.count && args.count !== 3) params.set("count", String(args.count));
123
+ if (args.tier) params.set("tier", args.tier);
124
+ if (args.styleStrength && args.styleStrength !== "balanced") {
125
+ params.set("styleStrength", args.styleStrength);
126
+ }
127
+ if (args.includeLogo) params.set("includeLogo", "1");
128
+ if (args.callerAppId?.trim()) params.set("callerAppId", args.callerAppId);
129
+ for (const runId of args.candidateRunIds ?? []) {
130
+ if (runId.trim()) params.append("candidateRunIds", runId.trim());
131
+ }
59
132
  if (args.autoGenerate) params.set("autoGenerate", "1");
60
133
  return `/library?${params.toString()}`;
61
134
  }
62
135
 
63
- export default defineAction({
136
+ const action = defineAction({
64
137
  description:
65
138
  'Open the image Library picker inline so a person can browse, search, generate, and select an image or video asset. When the user asks to create a specific image and choose the best one, pass prompt, autoGenerate: true, and count: 3 so the Library opens with generated candidates. If the host can only open a browser link (e.g. a CLI or code editor), surface that link: after the user picks, the page auto-copies a short paste-back summary — or the user can simply tell you which candidate they want (e.g. "use image A"). Use search-assets, generate-image, generate-video, and export-asset for unattended flows.',
66
139
  schema,
@@ -122,10 +195,18 @@ export default defineAction({
122
195
  query: args.query ?? null,
123
196
  prompt: args.prompt ?? null,
124
197
  libraryId: args.libraryId ?? null,
198
+ libraryHint: args.libraryHint ?? null,
125
199
  aspectRatio: args.aspectRatio ?? null,
126
200
  presetId: args.presetId ?? null,
127
201
  count: args.count,
202
+ tier: args.tier ?? null,
203
+ styleStrength: args.styleStrength,
204
+ includeLogo: args.includeLogo,
205
+ callerAppId: args.callerAppId ?? null,
206
+ candidateRunIds: args.candidateRunIds ?? [],
128
207
  autoGenerate: args.autoGenerate,
129
208
  };
130
209
  },
131
210
  });
211
+
212
+ export default allowStringifiedCountInToolSchema(action);