@agent-native/core 0.78.0 → 0.78.1
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.
- package/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +9 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/agent/types.ts +22 -0
- package/corpus/core/src/client/AgentPanel.tsx +8 -0
- package/corpus/core/src/client/AssistantChat.tsx +40 -0
- package/corpus/core/src/client/agent-chat.ts +173 -0
- package/corpus/core/src/client/composer/TiptapComposer.tsx +316 -60
- package/corpus/core/src/client/composer/extensions/MentionReference.tsx +3 -0
- package/corpus/core/src/client/composer/types.ts +22 -0
- package/corpus/core/src/client/index.ts +5 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +10 -0
- package/corpus/templates/assets/.agents/skills/asset-generation/SKILL.md +10 -2
- package/corpus/templates/assets/.agents/skills/image-generation/SKILL.md +14 -7
- package/corpus/templates/assets/.agents/skills/library-management/SKILL.md +12 -0
- package/corpus/templates/assets/AGENTS.md +18 -3
- package/corpus/templates/assets/actions/_image-model-default.ts +24 -0
- package/corpus/templates/assets/actions/dismiss-variant-slots.ts +15 -22
- package/corpus/templates/assets/actions/generate-asset.ts +30 -23
- package/corpus/templates/assets/actions/generate-image-batch.ts +76 -29
- package/corpus/templates/assets/actions/generate-image.ts +46 -30
- package/corpus/templates/assets/actions/generate-video.ts +18 -3
- package/corpus/templates/assets/actions/list-assets.ts +39 -8
- package/corpus/templates/assets/actions/list-libraries.ts +24 -2
- package/corpus/templates/assets/actions/navigate.ts +1 -1
- package/corpus/templates/assets/actions/open-asset-picker.ts +38 -1
- package/corpus/templates/assets/actions/refresh-generation-run.ts +10 -0
- package/corpus/templates/assets/actions/save-generated-image.ts +21 -19
- package/corpus/templates/assets/actions/variant-slots.ts +131 -28
- package/corpus/templates/assets/actions/view-screen.ts +9 -0
- package/corpus/templates/assets/app/components/generation/GenerationResults.tsx +425 -0
- package/corpus/templates/assets/app/components/layout/Header.tsx +3 -1
- package/corpus/templates/assets/app/components/layout/Layout.tsx +5 -0
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +4 -6
- package/corpus/templates/assets/app/hooks/use-navigation-state.ts +47 -21
- package/corpus/templates/assets/app/i18n-data.ts +1815 -0
- package/corpus/templates/assets/app/lib/libraries.ts +6 -0
- package/corpus/templates/assets/app/lib/picker-chat-handoff.ts +71 -0
- package/corpus/templates/assets/app/routes/_index.tsx +4 -0
- package/corpus/templates/assets/app/routes/asset.$id.tsx +2 -2
- package/corpus/templates/assets/app/routes/audit.tsx +1 -1
- package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +1557 -2164
- package/corpus/templates/assets/app/routes/brand-kits._index.tsx +7 -191
- package/corpus/templates/assets/app/routes/brand-kits.tsx +1 -5
- package/corpus/templates/assets/app/routes/libraries.tsx +4 -4
- package/corpus/templates/assets/app/routes/library.$id.tsx +9 -7
- package/corpus/templates/assets/app/routes/library.tsx +1454 -175
- package/corpus/templates/assets/server/db/index.ts +1 -1
- package/corpus/templates/assets/server/lib/generation.ts +86 -15
- package/corpus/templates/assets/server/plugins/agent-chat.ts +196 -0
- package/corpus/templates/assets/server/plugins/db.ts +5 -0
- package/corpus/templates/assets/shared/api.ts +6 -3
- package/dist/agent/types.d.ts +21 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +5 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +2 -2
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +6 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +15 -3
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat.d.ts +32 -0
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +113 -0
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +2 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +228 -56
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/composer/extensions/MentionReference.d.ts.map +1 -1
- package/dist/client/composer/extensions/MentionReference.js +3 -0
- package/dist/client/composer/extensions/MentionReference.js.map +1 -1
- package/dist/client/composer/types.d.ts +21 -0
- package/dist/client/composer/types.d.ts.map +1 -1
- package/dist/client/composer/types.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/collab/routes.d.ts +2 -2
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +6 -6
- package/dist/progress/routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +5 -0
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +2 -2
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ for (const type of ["asset-library", "image-library"] as const) {
|
|
|
13
13
|
sharesTable: schema.assetLibraryShares,
|
|
14
14
|
displayName: "Asset Library",
|
|
15
15
|
titleColumn: "title",
|
|
16
|
-
getResourcePath: (library) => `/
|
|
16
|
+
getResourcePath: (library) => `/library/${library.id}`,
|
|
17
17
|
getDb,
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -65,6 +65,17 @@ export interface GenerateProviderOutput {
|
|
|
65
65
|
const MANAGED_PROVIDER_MAX_ATTEMPTS = 3;
|
|
66
66
|
const MANAGED_PROVIDER_RETRY_DELAY_MS =
|
|
67
67
|
process.env.NODE_ENV === "test" ? 0 : 2500;
|
|
68
|
+
// A single managed image generation can legitimately run longer than one
|
|
69
|
+
// request's abort window (pro models routinely exceed 90s). The request always
|
|
70
|
+
// carries the run id as an idempotency key, so re-POSTing the same key replays
|
|
71
|
+
// the finished result (or answers 409 "request in progress") instead of
|
|
72
|
+
// starting a second, double-charged generation. When a request aborts client
|
|
73
|
+
// side, hits an upstream gateway timeout, or reports in-progress, we poll the
|
|
74
|
+
// same key until it resolves rather than failing. ~40 polls * 6s ≈ 4 min.
|
|
75
|
+
const MANAGED_PROVIDER_INFLIGHT_MAX_POLLS =
|
|
76
|
+
process.env.NODE_ENV === "test" ? 6 : 40;
|
|
77
|
+
const MANAGED_PROVIDER_INFLIGHT_POLL_MS =
|
|
78
|
+
process.env.NODE_ENV === "test" ? 0 : 6000;
|
|
68
79
|
|
|
69
80
|
export async function getGeminiApiKey(): Promise<string> {
|
|
70
81
|
const key = await resolveSecret("GEMINI_API_KEY");
|
|
@@ -135,12 +146,19 @@ function isRetryableProviderError(err: unknown): boolean {
|
|
|
135
146
|
class BuilderImageGenerationError extends Error {
|
|
136
147
|
readonly status?: number;
|
|
137
148
|
readonly detail?: string;
|
|
149
|
+
readonly code?: string;
|
|
138
150
|
|
|
139
|
-
constructor(
|
|
151
|
+
constructor(
|
|
152
|
+
message: string,
|
|
153
|
+
status?: number,
|
|
154
|
+
detail?: string,
|
|
155
|
+
code?: string,
|
|
156
|
+
) {
|
|
140
157
|
super(message);
|
|
141
158
|
this.name = "BuilderImageGenerationError";
|
|
142
159
|
this.status = status;
|
|
143
160
|
this.detail = detail;
|
|
161
|
+
this.code = code;
|
|
144
162
|
}
|
|
145
163
|
}
|
|
146
164
|
|
|
@@ -151,12 +169,32 @@ function isRetryableBuilderImageGenerationError(err: unknown): boolean {
|
|
|
151
169
|
);
|
|
152
170
|
}
|
|
153
171
|
|
|
172
|
+
// A client-side abort, an upstream gateway timeout, or the service's explicit
|
|
173
|
+
// 409 "request_in_progress" all mean the generation is still running under this
|
|
174
|
+
// idempotency key. Re-POSTing the same key replays the finished result once the
|
|
175
|
+
// service completes, so these are polled rather than surfaced as failures.
|
|
176
|
+
function isInFlightImageGenerationError(err: unknown): boolean {
|
|
177
|
+
if (!(err instanceof BuilderImageGenerationError)) return false;
|
|
178
|
+
return (
|
|
179
|
+
err.code === "client_timeout" ||
|
|
180
|
+
err.code === "request_in_progress" ||
|
|
181
|
+
err.status === 504 ||
|
|
182
|
+
err.status === 409
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
154
186
|
function generationRetryDelay(attempt: number): Promise<void> {
|
|
155
187
|
return new Promise((resolve) => {
|
|
156
188
|
setTimeout(resolve, attempt * MANAGED_PROVIDER_RETRY_DELAY_MS);
|
|
157
189
|
});
|
|
158
190
|
}
|
|
159
191
|
|
|
192
|
+
function generationPollDelay(): Promise<void> {
|
|
193
|
+
return new Promise((resolve) => {
|
|
194
|
+
setTimeout(resolve, MANAGED_PROVIDER_INFLIGHT_POLL_MS);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
160
198
|
interface BuilderImageGenerationResponse {
|
|
161
199
|
id: string;
|
|
162
200
|
status: "completed";
|
|
@@ -231,9 +269,14 @@ export async function generateWithBuilderImageApi(
|
|
|
231
269
|
signal: AbortSignal.timeout(90_000),
|
|
232
270
|
}).catch((err) => {
|
|
233
271
|
if ((err as Error)?.name === "AbortError") {
|
|
272
|
+
// The socket aborted, but the service keeps generating under this
|
|
273
|
+
// idempotency key. Flag it so the retry loop polls the key instead of
|
|
274
|
+
// starting a fresh (double-charged) generation.
|
|
234
275
|
throw new BuilderImageGenerationError(
|
|
235
276
|
"Builder-managed image generation timed out.",
|
|
236
277
|
504,
|
|
278
|
+
undefined,
|
|
279
|
+
"client_timeout",
|
|
237
280
|
);
|
|
238
281
|
}
|
|
239
282
|
throw err;
|
|
@@ -242,10 +285,12 @@ export async function generateWithBuilderImageApi(
|
|
|
242
285
|
if (!response.ok) {
|
|
243
286
|
const text = await response.text().catch(() => "");
|
|
244
287
|
const detail = extractBuilderErrorDetail(text);
|
|
288
|
+
const code = extractBuilderErrorCode(text);
|
|
245
289
|
throw new BuilderImageGenerationError(
|
|
246
290
|
`Builder-managed image generation failed (${response.status})${detail ? `: ${detail}` : "."}`,
|
|
247
291
|
response.status,
|
|
248
292
|
detail,
|
|
293
|
+
code,
|
|
249
294
|
);
|
|
250
295
|
}
|
|
251
296
|
|
|
@@ -286,28 +331,41 @@ export async function generateWithBuilderImageApi(
|
|
|
286
331
|
async function generateWithRetryingBuilderImageApi(
|
|
287
332
|
input: GenerateProviderInput,
|
|
288
333
|
): Promise<GenerateProviderOutput> {
|
|
289
|
-
let
|
|
290
|
-
|
|
334
|
+
let transientAttempts = 0;
|
|
335
|
+
let inFlightPolls = 0;
|
|
336
|
+
for (;;) {
|
|
291
337
|
try {
|
|
292
|
-
if (attempt > 0) {
|
|
293
|
-
await generationRetryDelay(attempt);
|
|
294
|
-
}
|
|
295
338
|
return await generateWithBuilderImageApi(input);
|
|
296
339
|
} catch (err) {
|
|
297
|
-
|
|
340
|
+
// The generation is still running under this idempotency key. Poll the
|
|
341
|
+
// same key — a pending request returns 409 immediately and the final
|
|
342
|
+
// poll returns the stored image as an idempotent replay (no re-charge) —
|
|
343
|
+
// until it resolves or we exhaust the polling budget.
|
|
344
|
+
if (isInFlightImageGenerationError(err)) {
|
|
345
|
+
if (inFlightPolls >= MANAGED_PROVIDER_INFLIGHT_MAX_POLLS) {
|
|
346
|
+
throw new BuilderImageGenerationError(
|
|
347
|
+
"Builder-managed image generation is still running after the wait budget. It may finish shortly — try again to pick up the result.",
|
|
348
|
+
504,
|
|
349
|
+
err instanceof BuilderImageGenerationError ? err.detail : undefined,
|
|
350
|
+
"client_timeout",
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
inFlightPolls += 1;
|
|
354
|
+
await generationPollDelay();
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
// Fresh transient server errors get a few quick retries with backoff.
|
|
298
358
|
if (
|
|
299
|
-
|
|
300
|
-
|
|
359
|
+
isRetryableBuilderImageGenerationError(err) &&
|
|
360
|
+
transientAttempts < MANAGED_PROVIDER_MAX_ATTEMPTS - 1
|
|
301
361
|
) {
|
|
302
|
-
|
|
362
|
+
transientAttempts += 1;
|
|
363
|
+
await generationRetryDelay(transientAttempts);
|
|
364
|
+
continue;
|
|
303
365
|
}
|
|
366
|
+
throw err;
|
|
304
367
|
}
|
|
305
368
|
}
|
|
306
|
-
throw lastError instanceof Error
|
|
307
|
-
? lastError
|
|
308
|
-
: new BuilderImageGenerationError(
|
|
309
|
-
"Builder-managed image generation failed.",
|
|
310
|
-
);
|
|
311
369
|
}
|
|
312
370
|
|
|
313
371
|
export async function generateWithManagedImageProvider(
|
|
@@ -392,6 +450,19 @@ function extractBuilderErrorDetail(text: string): string {
|
|
|
392
450
|
return trimmed.slice(0, 300);
|
|
393
451
|
}
|
|
394
452
|
|
|
453
|
+
// The managed service tags errors with a stable machine code (e.g.
|
|
454
|
+
// "request_in_progress") in the JSON body. It drives retry vs. poll decisions.
|
|
455
|
+
function extractBuilderErrorCode(text: string): string | undefined {
|
|
456
|
+
const trimmed = text.trim();
|
|
457
|
+
if (!trimmed) return undefined;
|
|
458
|
+
try {
|
|
459
|
+
const parsed = JSON.parse(trimmed) as { code?: unknown };
|
|
460
|
+
return typeof parsed?.code === "string" ? parsed.code : undefined;
|
|
461
|
+
} catch {
|
|
462
|
+
return undefined;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
395
466
|
function readProviderErrorDetail(value: unknown): string | null {
|
|
396
467
|
if (typeof value === "string") return value;
|
|
397
468
|
if (!value || typeof value !== "object") return null;
|
|
@@ -3,8 +3,11 @@ import {
|
|
|
3
3
|
createAgentChatPlugin,
|
|
4
4
|
loadActionsFromStaticRegistry,
|
|
5
5
|
} from "@agent-native/core/server";
|
|
6
|
+
import { accessFilter } from "@agent-native/core/sharing";
|
|
7
|
+
import { and, asc, desc, inArray, isNull } from "drizzle-orm";
|
|
6
8
|
|
|
7
9
|
import actionsRegistry from "../../.generated/actions-registry.js";
|
|
10
|
+
import { getDb, schema } from "../db/index.js";
|
|
8
11
|
import "../register-secrets.js";
|
|
9
12
|
|
|
10
13
|
const INITIAL_TOOL_NAMES = [
|
|
@@ -44,5 +47,198 @@ export default createAgentChatPlugin({
|
|
|
44
47
|
initialToolNames: INITIAL_TOOL_NAMES,
|
|
45
48
|
actions: loadActionsFromStaticRegistry(actionsRegistry),
|
|
46
49
|
resolveOrgId: async (event) => (await getOrgContext(event)).orgId,
|
|
50
|
+
mentionProviders: {
|
|
51
|
+
mediaTypes: {
|
|
52
|
+
label: "Media type",
|
|
53
|
+
icon: "file",
|
|
54
|
+
search: (query: string) => {
|
|
55
|
+
const q = query.trim().toLowerCase();
|
|
56
|
+
return [
|
|
57
|
+
{
|
|
58
|
+
id: "media-type:image",
|
|
59
|
+
label: "Image",
|
|
60
|
+
description: "Generate image assets",
|
|
61
|
+
icon: "file",
|
|
62
|
+
refType: "media-type",
|
|
63
|
+
refId: "image",
|
|
64
|
+
slotKey: "media-type",
|
|
65
|
+
slotLabel: "Media",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "media-type:video",
|
|
69
|
+
label: "Video",
|
|
70
|
+
description: "Generate video assets",
|
|
71
|
+
icon: "file",
|
|
72
|
+
refType: "media-type",
|
|
73
|
+
refId: "video",
|
|
74
|
+
slotKey: "media-type",
|
|
75
|
+
slotLabel: "Media",
|
|
76
|
+
},
|
|
77
|
+
].filter((item) =>
|
|
78
|
+
q
|
|
79
|
+
? item.label.toLowerCase().includes(q) ||
|
|
80
|
+
item.refId.toLowerCase().includes(q)
|
|
81
|
+
: true,
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
presets: {
|
|
86
|
+
label: "Presets",
|
|
87
|
+
icon: "document",
|
|
88
|
+
search: async (query: string) => {
|
|
89
|
+
try {
|
|
90
|
+
const db = getDb();
|
|
91
|
+
const libraryRows = await db
|
|
92
|
+
.select({
|
|
93
|
+
id: schema.assetLibraries.id,
|
|
94
|
+
title: schema.assetLibraries.title,
|
|
95
|
+
})
|
|
96
|
+
.from(schema.assetLibraries)
|
|
97
|
+
.where(
|
|
98
|
+
and(
|
|
99
|
+
accessFilter(schema.assetLibraries, schema.assetLibraryShares),
|
|
100
|
+
isNull(schema.assetLibraries.archivedAt),
|
|
101
|
+
),
|
|
102
|
+
)
|
|
103
|
+
.orderBy(desc(schema.assetLibraries.updatedAt));
|
|
104
|
+
const libraryIds = libraryRows.map((library) => library.id);
|
|
105
|
+
if (!libraryIds.length) return [];
|
|
106
|
+
const libraryTitleById = new Map(
|
|
107
|
+
libraryRows.map((library) => [library.id, library.title]),
|
|
108
|
+
);
|
|
109
|
+
const rows = await db
|
|
110
|
+
.select({
|
|
111
|
+
id: schema.assetGenerationPresets.id,
|
|
112
|
+
libraryId: schema.assetGenerationPresets.libraryId,
|
|
113
|
+
title: schema.assetGenerationPresets.title,
|
|
114
|
+
description: schema.assetGenerationPresets.description,
|
|
115
|
+
aspectRatio: schema.assetGenerationPresets.aspectRatio,
|
|
116
|
+
imageSize: schema.assetGenerationPresets.imageSize,
|
|
117
|
+
model: schema.assetGenerationPresets.model,
|
|
118
|
+
mediaType: schema.assetGenerationPresets.mediaType,
|
|
119
|
+
sortOrder: schema.assetGenerationPresets.sortOrder,
|
|
120
|
+
})
|
|
121
|
+
.from(schema.assetGenerationPresets)
|
|
122
|
+
.where(inArray(schema.assetGenerationPresets.libraryId, libraryIds))
|
|
123
|
+
.orderBy(
|
|
124
|
+
asc(schema.assetGenerationPresets.sortOrder),
|
|
125
|
+
asc(schema.assetGenerationPresets.title),
|
|
126
|
+
);
|
|
127
|
+
const q = query.trim().toLowerCase();
|
|
128
|
+
return rows
|
|
129
|
+
.filter((preset) => {
|
|
130
|
+
if (!q) return true;
|
|
131
|
+
const libraryTitle = libraryTitleById.get(preset.libraryId) ?? "";
|
|
132
|
+
return [
|
|
133
|
+
preset.id,
|
|
134
|
+
preset.title,
|
|
135
|
+
preset.description ?? "",
|
|
136
|
+
libraryTitle,
|
|
137
|
+
preset.aspectRatio,
|
|
138
|
+
preset.imageSize,
|
|
139
|
+
preset.model,
|
|
140
|
+
preset.mediaType,
|
|
141
|
+
]
|
|
142
|
+
.join(" ")
|
|
143
|
+
.toLowerCase()
|
|
144
|
+
.includes(q);
|
|
145
|
+
})
|
|
146
|
+
.slice(0, 20)
|
|
147
|
+
.map((preset) => {
|
|
148
|
+
const libraryTitle =
|
|
149
|
+
libraryTitleById.get(preset.libraryId) ?? "Brand kit";
|
|
150
|
+
return {
|
|
151
|
+
id: `preset:${preset.id}`,
|
|
152
|
+
label: preset.title,
|
|
153
|
+
description: `${libraryTitle} · ${preset.aspectRatio} · ${preset.imageSize} · ${preset.model}`,
|
|
154
|
+
icon: "document",
|
|
155
|
+
refType: "preset",
|
|
156
|
+
refId: preset.id,
|
|
157
|
+
refPath: `/library/${preset.libraryId}`,
|
|
158
|
+
slotKey: "preset",
|
|
159
|
+
slotLabel: "Preset",
|
|
160
|
+
metadata: {
|
|
161
|
+
libraryId: preset.libraryId,
|
|
162
|
+
libraryTitle,
|
|
163
|
+
requiredSlotKey: "brand-kit",
|
|
164
|
+
requiredRefId: preset.libraryId,
|
|
165
|
+
mediaType: preset.mediaType,
|
|
166
|
+
},
|
|
167
|
+
relatedReferences: [
|
|
168
|
+
{
|
|
169
|
+
label: libraryTitle,
|
|
170
|
+
icon: "folder",
|
|
171
|
+
source: "brandKits",
|
|
172
|
+
refType: "brand-kit",
|
|
173
|
+
refId: preset.libraryId,
|
|
174
|
+
refPath: `/library/${preset.libraryId}`,
|
|
175
|
+
slotKey: "brand-kit",
|
|
176
|
+
slotLabel: "Brand kit",
|
|
177
|
+
clearsSlots: ["preset"],
|
|
178
|
+
metadata: {
|
|
179
|
+
libraryId: preset.libraryId,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
};
|
|
184
|
+
});
|
|
185
|
+
} catch (err) {
|
|
186
|
+
console.error("[assets] Preset mention provider failed:", err);
|
|
187
|
+
return [];
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
brandKits: {
|
|
192
|
+
label: "Brand kits",
|
|
193
|
+
icon: "folder",
|
|
194
|
+
search: async (query: string) => {
|
|
195
|
+
try {
|
|
196
|
+
const rows = await getDb()
|
|
197
|
+
.select({
|
|
198
|
+
id: schema.assetLibraries.id,
|
|
199
|
+
title: schema.assetLibraries.title,
|
|
200
|
+
description: schema.assetLibraries.description,
|
|
201
|
+
updatedAt: schema.assetLibraries.updatedAt,
|
|
202
|
+
})
|
|
203
|
+
.from(schema.assetLibraries)
|
|
204
|
+
.where(
|
|
205
|
+
and(
|
|
206
|
+
accessFilter(schema.assetLibraries, schema.assetLibraryShares),
|
|
207
|
+
isNull(schema.assetLibraries.archivedAt),
|
|
208
|
+
),
|
|
209
|
+
)
|
|
210
|
+
.orderBy(desc(schema.assetLibraries.updatedAt));
|
|
211
|
+
const q = query.trim().toLowerCase();
|
|
212
|
+
return rows
|
|
213
|
+
.filter((library) => {
|
|
214
|
+
if (!q) return true;
|
|
215
|
+
return [library.id, library.title, library.description ?? ""]
|
|
216
|
+
.join(" ")
|
|
217
|
+
.toLowerCase()
|
|
218
|
+
.includes(q);
|
|
219
|
+
})
|
|
220
|
+
.slice(0, 20)
|
|
221
|
+
.map((library) => ({
|
|
222
|
+
id: `brand-kit:${library.id}`,
|
|
223
|
+
label: library.title,
|
|
224
|
+
description: library.description ?? `/library/${library.id}`,
|
|
225
|
+
icon: "folder",
|
|
226
|
+
refType: "brand-kit",
|
|
227
|
+
refId: library.id,
|
|
228
|
+
refPath: `/library/${library.id}`,
|
|
229
|
+
slotKey: "brand-kit",
|
|
230
|
+
slotLabel: "Brand kit",
|
|
231
|
+
clearsSlots: ["preset"],
|
|
232
|
+
metadata: {
|
|
233
|
+
libraryId: library.id,
|
|
234
|
+
},
|
|
235
|
+
}));
|
|
236
|
+
} catch (err) {
|
|
237
|
+
console.error("[assets] Brand kit mention provider failed:", err);
|
|
238
|
+
return [];
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
},
|
|
47
243
|
runSoftTimeoutMs: 240_000,
|
|
48
244
|
});
|
|
@@ -297,6 +297,11 @@ export default runMigrations(
|
|
|
297
297
|
CREATE INDEX IF NOT EXISTS image_libraries_owner_org_updated_idx
|
|
298
298
|
ON image_libraries (owner_email, org_id, updated_at)`,
|
|
299
299
|
},
|
|
300
|
+
{
|
|
301
|
+
version: 34,
|
|
302
|
+
sql: `CREATE INDEX IF NOT EXISTS image_assets_library_created_idx
|
|
303
|
+
ON image_assets (library_id, created_at)`,
|
|
304
|
+
},
|
|
300
305
|
],
|
|
301
306
|
// Preserve the legacy migration table name so existing Images deployments do
|
|
302
307
|
// not rerun historical additive migrations after the app slug becomes Assets.
|
|
@@ -134,6 +134,7 @@ export interface ImageLibrarySummary {
|
|
|
134
134
|
videoCount?: number;
|
|
135
135
|
coverAsset?: ImageAssetPreview | null;
|
|
136
136
|
previewAssets?: ImageAssetPreview[];
|
|
137
|
+
folders?: AssetFolderSummary[];
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
export interface ImageAssetPreview {
|
|
@@ -199,6 +200,8 @@ export interface AssetVariantState {
|
|
|
199
200
|
collectionId?: string | null;
|
|
200
201
|
presetId?: string | null;
|
|
201
202
|
sessionId?: string | null;
|
|
203
|
+
threadId?: string | null;
|
|
204
|
+
variantScopeId?: string | null;
|
|
202
205
|
prompt: string;
|
|
203
206
|
slots: Array<{
|
|
204
207
|
slotId: string;
|
|
@@ -225,9 +228,9 @@ export interface GenerationPresetSummary {
|
|
|
225
228
|
category: ImageCategory;
|
|
226
229
|
mediaType: AssetMediaType;
|
|
227
230
|
promptTemplate?: string | null;
|
|
228
|
-
aspectRatio: AspectRatio;
|
|
229
|
-
imageSize: ImageSize;
|
|
230
|
-
model: ImageModel;
|
|
231
|
+
aspectRatio: AspectRatio | VideoAspectRatio;
|
|
232
|
+
imageSize: ImageSize | VideoResolution;
|
|
233
|
+
model: ImageModel | VideoModel;
|
|
231
234
|
textPolicy: string;
|
|
232
235
|
referencePolicy: GenerationPresetReferencePolicy;
|
|
233
236
|
settings: Record<string, unknown>;
|
package/dist/agent/types.d.ts
CHANGED
|
@@ -67,6 +67,9 @@ export interface AgentChatReference {
|
|
|
67
67
|
source: string;
|
|
68
68
|
refType?: string;
|
|
69
69
|
refId?: string;
|
|
70
|
+
slotKey?: string;
|
|
71
|
+
slotLabel?: string;
|
|
72
|
+
metadata?: Record<string, unknown>;
|
|
70
73
|
}
|
|
71
74
|
export interface MentionProviderItem {
|
|
72
75
|
id: string;
|
|
@@ -76,6 +79,24 @@ export interface MentionProviderItem {
|
|
|
76
79
|
refType: string;
|
|
77
80
|
refId?: string;
|
|
78
81
|
refPath?: string;
|
|
82
|
+
slotKey?: string;
|
|
83
|
+
slotLabel?: string;
|
|
84
|
+
metadata?: Record<string, unknown>;
|
|
85
|
+
clearsSlots?: string[];
|
|
86
|
+
relatedReferences?: MentionProviderReference[];
|
|
87
|
+
}
|
|
88
|
+
export interface MentionProviderReference {
|
|
89
|
+
label: string;
|
|
90
|
+
icon?: string;
|
|
91
|
+
source?: string;
|
|
92
|
+
refType: string;
|
|
93
|
+
refId?: string | null;
|
|
94
|
+
refPath?: string | null;
|
|
95
|
+
slotKey?: string;
|
|
96
|
+
slotLabel?: string;
|
|
97
|
+
metadata?: Record<string, unknown>;
|
|
98
|
+
clearsSlots?: string[];
|
|
99
|
+
relatedReferences?: MentionProviderReference[];
|
|
79
100
|
}
|
|
80
101
|
export interface MentionProvider {
|
|
81
102
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,E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AW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,cAAc,CAAC;CACvB;AAED,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC"}
|
package/dist/agent/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ActionChatUIConfig } from \"../action-ui.js\";\nimport type { AgentMcpAppPayload } from \"../mcp-client/app-result.js\";\nimport type { ReasoningEffort } from \"../shared/reasoning-effort.js\";\n\nexport interface AgentNativeJsonSchema {\n type?: string | string[];\n description?: string;\n enum?: unknown[];\n const?: unknown;\n properties?: Record<string, AgentNativeJsonSchema>;\n required?: string[];\n additionalProperties?: boolean | AgentNativeJsonSchema;\n items?: AgentNativeJsonSchema;\n oneOf?: AgentNativeJsonSchema[];\n anyOf?: AgentNativeJsonSchema[];\n allOf?: AgentNativeJsonSchema[];\n not?: AgentNativeJsonSchema;\n minLength?: number;\n maxLength?: number;\n pattern?: string;\n minimum?: number;\n maximum?: number;\n minItems?: number;\n maxItems?: number;\n}\n\nexport interface ActionTool {\n description: string;\n parameters?: AgentNativeJsonSchema & {\n type: \"object\";\n properties: Record<string, AgentNativeJsonSchema>;\n required?: string[];\n };\n}\n\n/** @deprecated Use `ActionTool` instead */\nexport type ScriptTool = ActionTool;\n\nexport interface AgentMessage {\n role: \"user\" | \"assistant\";\n content: string;\n}\n\nexport type AgentChatStructuredContentPart =\n | { type: \"text\"; text: string }\n | {\n type: \"tool-call\";\n id?: string;\n toolCallId?: string;\n name?: string;\n toolName?: string;\n input?: unknown;\n args?: unknown;\n }\n | {\n type: \"tool-result\";\n toolCallId: string;\n /** Persisted for replay; omitted in older rows is backfilled server-side. */\n toolName?: string;\n toolInput?: string;\n content: string;\n isError?: boolean;\n };\n\nexport interface AgentChatStructuredMessage {\n role: \"user\" | \"assistant\";\n content: AgentChatStructuredContentPart[];\n}\n\nexport interface AgentChatReference {\n type: \"file\" | \"skill\" | \"mention\" | \"agent\" | \"custom-agent\";\n path: string;\n name: string;\n source: string;\n refType?: string;\n refId?: string;\n}\n\nexport interface MentionProviderItem {\n id: string;\n label: string;\n description?: string;\n icon?: string;\n refType: string;\n refId?: string;\n refPath?: string;\n}\n\nexport interface MentionProvider {\n label: string;\n icon?: string;\n search: (\n query: string,\n /** The H3 event for the current request — use to make internal API calls */\n event?: any,\n ) => MentionProviderItem[] | Promise<MentionProviderItem[]>;\n}\n\nexport interface AgentChatAttachment {\n type: string;\n name: string;\n data?: string;\n contentType?: string;\n text?: string;\n}\n\nexport interface AgentChatScope {\n type: string;\n id: string;\n label?: string;\n}\n\nexport interface AgentChatRequest {\n message: string;\n /**\n * User-visible text to persist in chat history. `message` may be normalized\n * for the model (for example mention markup or internal continuation text).\n */\n displayMessage?: string;\n history?: AgentMessage[];\n /**\n * Provider-neutral transcript used for run recovery. Unlike `history`,\n * this preserves assistant tool calls and matching tool results so\n * continuation turns do not re-run completed read-only tools.\n */\n structuredHistory?: AgentChatStructuredMessage[];\n references?: AgentChatReference[];\n threadId?: string;\n attachments?: AgentChatAttachment[];\n /** Internal retry/continuation requests should not create visible user turns. */\n internalContinuation?: boolean;\n /**\n * Internal marker set ONLY by the durable-background self-dispatch (see\n * `AGENT_CHAT_BACKGROUND_RUN_FIELD`). Present when the agent-chat handler is\n * re-entered as the background worker: it carries the pre-claimed `runId` and\n * logical `turnId` so the worker runs the loop inline with the background\n * soft-timeout instead of re-claiming the slot or re-dispatching. Untrusted\n * on its own — the `_process-run` route HMAC-verifies the dispatch before\n * invoking the handler. Absent on every normal client request.\n */\n __backgroundRun?: {\n runId: string;\n turnId?: string;\n /**\n * Number of server-driven background→background continuations already\n * chained into this logical turn (0 on the first chunk). The worker\n * increments this when it re-fires `_process-run` at a soft-timeout\n * boundary and refuses to chain past `MAX_BACKGROUND_RUN_CONTINUATIONS`.\n */\n continuationCount?: number;\n };\n /**\n * Stable identity for the logical assistant turn this request belongs to.\n * The client sends the SAME turnId for the initial POST and every\n * auto-continuation re-POST of one turn, so the server can fold each\n * continuation run's output onto a single durable assistant message instead\n * of dropping the earlier chunks. Defaults to the run id when absent.\n */\n turnId?: string;\n /** Execution mode for this turn. Plan mode is read-only and proposes before acting. */\n mode?: \"act\" | \"plan\";\n /** Per-request model override (ephemeral, from the composer model picker). */\n model?: string;\n /** Per-request engine override (sent alongside model for cross-provider switches). */\n engine?: string;\n /** Per-request reasoning effort override (ephemeral, from the composer picker). */\n effort?: ReasoningEffort;\n /** Usage-tracking label for this call (e.g. \"chat\", \"summarize\"). Default: \"chat\". */\n usageLabel?: string;\n /** Stable browser tab id so screen/url context and navigation commands are tab-scoped. */\n browserTabId?: string;\n /** Resource scope for this chat thread, e.g. the deck currently bound to the tab. */\n scope?: AgentChatScope | null;\n /** When true, expose this chat turn as a user-visible run in RunsTray. */\n trackInRunsTray?: boolean;\n /**\n * Approval grants for human-in-the-loop actions. Each entry is a stable\n * approval key (see the `approval_required` event's `approvalKey`). When the\n * agent calls an action declared `needsApproval`, the loop pauses and emits\n * `approval_required`; the client re-issues the turn (typically an empty\n * continuation) with the approved call's key here so the gate lets it run.\n * Keys not present here keep the action paused. The model never sees or sets\n * this — it is supplied by the human's approve affordance.\n */\n approvedToolCalls?: string[];\n}\n\nexport type AgentChatEvent =\n | { type: \"text\"; text: string }\n | { type: \"thinking\"; text: string }\n | { type: \"activity\"; label: string; tool?: string }\n | { type: \"stream_keepalive\" }\n | { type: \"tool_start\"; tool: string; input: Record<string, string> }\n | {\n type: \"tool_done\";\n tool: string;\n result: string;\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n }\n | {\n /**\n * The agent tried to call an action declared `needsApproval` and the loop\n * paused instead of executing it. The client should surface an\n * approve/deny affordance; on approve, re-issue the turn with\n * `approvedToolCalls: [approvalKey]` so the gate lets this call run.\n */\n type: \"approval_required\";\n tool: string;\n input: Record<string, string>;\n /** Stable key the client echoes back in `approvedToolCalls` to approve. */\n approvalKey: string;\n /** The model-side tool-call id for this paused call, when available. */\n toolCallId?: string;\n }\n | {\n type: \"agent_call\";\n agent: string;\n status: \"start\" | \"done\" | \"error\";\n }\n | { type: \"agent_call_text\"; agent: string; text: string }\n | {\n type: \"agent_task\";\n taskId: string;\n threadId: string;\n description: string;\n status: \"running\" | \"completed\" | \"errored\";\n }\n | {\n type: \"agent_task_update\";\n taskId: string;\n preview: string;\n currentStep?: string;\n }\n | {\n type: \"agent_task_complete\";\n taskId: string;\n summary: string;\n }\n | { type: \"done\" }\n | {\n type: \"error\";\n error: string;\n /**\n * Optional machine-readable error code. Builder gateway uses codes\n * like \"credits-limit-monthly\" / \"unauthorized\" / \"gateway_not_enabled\"\n * so the chat UI can render a structured CTA (e.g. upgrade button).\n */\n errorCode?: string;\n /** Optional link paired with errorCode — e.g. Builder billing page. */\n upgradeUrl?: string;\n /** Optional details for expandable UI/debugging. */\n details?: string;\n /** True when the user can reasonably continue/retry from partial work. */\n recoverable?: boolean;\n }\n /**\n * Legacy SSE terminal event. New streams emit\n * `{ type: \"error\", errorCode: \"missing_credentials\" }` instead.\n */\n | { type: \"missing_api_key\" }\n | { type: \"loop_limit\"; maxIterations?: number }\n | {\n /**\n * An in-loop `Processor` aborted the run via `abort()` (which throws a\n * `TripWire`). The loop catches it, emits this event, stops cleanly, and\n * surfaces the reason as a final assistant message. Structural hook for\n * real-time guardrails and a proof-of-done / coverage gate.\n */\n type: \"tripwire\";\n reason: string;\n /** Name of the processor that aborted, when it declared one. */\n processor?: string;\n }\n | {\n type: \"auto_continue\";\n reason:\n | \"run_timeout\"\n | \"loop_limit\"\n | \"no_progress\"\n | \"stream_ended\"\n | \"gateway_timeout\"\n | \"network_interrupted\";\n maxIterations?: number;\n }\n | { type: \"clear\" };\n\nexport interface RunEvent {\n seq: number;\n event: AgentChatEvent;\n}\n\nexport type RunStatus = \"running\" | \"completed\" | \"errored\" | \"aborted\";\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ActionChatUIConfig } from \"../action-ui.js\";\nimport type { AgentMcpAppPayload } from \"../mcp-client/app-result.js\";\nimport type { ReasoningEffort } from \"../shared/reasoning-effort.js\";\n\nexport interface AgentNativeJsonSchema {\n type?: string | string[];\n description?: string;\n enum?: unknown[];\n const?: unknown;\n properties?: Record<string, AgentNativeJsonSchema>;\n required?: string[];\n additionalProperties?: boolean | AgentNativeJsonSchema;\n items?: AgentNativeJsonSchema;\n oneOf?: AgentNativeJsonSchema[];\n anyOf?: AgentNativeJsonSchema[];\n allOf?: AgentNativeJsonSchema[];\n not?: AgentNativeJsonSchema;\n minLength?: number;\n maxLength?: number;\n pattern?: string;\n minimum?: number;\n maximum?: number;\n minItems?: number;\n maxItems?: number;\n}\n\nexport interface ActionTool {\n description: string;\n parameters?: AgentNativeJsonSchema & {\n type: \"object\";\n properties: Record<string, AgentNativeJsonSchema>;\n required?: string[];\n };\n}\n\n/** @deprecated Use `ActionTool` instead */\nexport type ScriptTool = ActionTool;\n\nexport interface AgentMessage {\n role: \"user\" | \"assistant\";\n content: string;\n}\n\nexport type AgentChatStructuredContentPart =\n | { type: \"text\"; text: string }\n | {\n type: \"tool-call\";\n id?: string;\n toolCallId?: string;\n name?: string;\n toolName?: string;\n input?: unknown;\n args?: unknown;\n }\n | {\n type: \"tool-result\";\n toolCallId: string;\n /** Persisted for replay; omitted in older rows is backfilled server-side. */\n toolName?: string;\n toolInput?: string;\n content: string;\n isError?: boolean;\n };\n\nexport interface AgentChatStructuredMessage {\n role: \"user\" | \"assistant\";\n content: AgentChatStructuredContentPart[];\n}\n\nexport interface AgentChatReference {\n type: \"file\" | \"skill\" | \"mention\" | \"agent\" | \"custom-agent\";\n path: string;\n name: string;\n source: string;\n refType?: string;\n refId?: string;\n slotKey?: string;\n slotLabel?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport interface MentionProviderItem {\n id: string;\n label: string;\n description?: string;\n icon?: string;\n refType: string;\n refId?: string;\n refPath?: string;\n slotKey?: string;\n slotLabel?: string;\n metadata?: Record<string, unknown>;\n clearsSlots?: string[];\n relatedReferences?: MentionProviderReference[];\n}\n\nexport interface MentionProviderReference {\n label: string;\n icon?: string;\n source?: string;\n refType: string;\n refId?: string | null;\n refPath?: string | null;\n slotKey?: string;\n slotLabel?: string;\n metadata?: Record<string, unknown>;\n clearsSlots?: string[];\n relatedReferences?: MentionProviderReference[];\n}\n\nexport interface MentionProvider {\n label: string;\n icon?: string;\n search: (\n query: string,\n /** The H3 event for the current request — use to make internal API calls */\n event?: any,\n ) => MentionProviderItem[] | Promise<MentionProviderItem[]>;\n}\n\nexport interface AgentChatAttachment {\n type: string;\n name: string;\n data?: string;\n contentType?: string;\n text?: string;\n}\n\nexport interface AgentChatScope {\n type: string;\n id: string;\n label?: string;\n}\n\nexport interface AgentChatRequest {\n message: string;\n /**\n * User-visible text to persist in chat history. `message` may be normalized\n * for the model (for example mention markup or internal continuation text).\n */\n displayMessage?: string;\n history?: AgentMessage[];\n /**\n * Provider-neutral transcript used for run recovery. Unlike `history`,\n * this preserves assistant tool calls and matching tool results so\n * continuation turns do not re-run completed read-only tools.\n */\n structuredHistory?: AgentChatStructuredMessage[];\n references?: AgentChatReference[];\n threadId?: string;\n attachments?: AgentChatAttachment[];\n /** Internal retry/continuation requests should not create visible user turns. */\n internalContinuation?: boolean;\n /**\n * Internal marker set ONLY by the durable-background self-dispatch (see\n * `AGENT_CHAT_BACKGROUND_RUN_FIELD`). Present when the agent-chat handler is\n * re-entered as the background worker: it carries the pre-claimed `runId` and\n * logical `turnId` so the worker runs the loop inline with the background\n * soft-timeout instead of re-claiming the slot or re-dispatching. Untrusted\n * on its own — the `_process-run` route HMAC-verifies the dispatch before\n * invoking the handler. Absent on every normal client request.\n */\n __backgroundRun?: {\n runId: string;\n turnId?: string;\n /**\n * Number of server-driven background→background continuations already\n * chained into this logical turn (0 on the first chunk). The worker\n * increments this when it re-fires `_process-run` at a soft-timeout\n * boundary and refuses to chain past `MAX_BACKGROUND_RUN_CONTINUATIONS`.\n */\n continuationCount?: number;\n };\n /**\n * Stable identity for the logical assistant turn this request belongs to.\n * The client sends the SAME turnId for the initial POST and every\n * auto-continuation re-POST of one turn, so the server can fold each\n * continuation run's output onto a single durable assistant message instead\n * of dropping the earlier chunks. Defaults to the run id when absent.\n */\n turnId?: string;\n /** Execution mode for this turn. Plan mode is read-only and proposes before acting. */\n mode?: \"act\" | \"plan\";\n /** Per-request model override (ephemeral, from the composer model picker). */\n model?: string;\n /** Per-request engine override (sent alongside model for cross-provider switches). */\n engine?: string;\n /** Per-request reasoning effort override (ephemeral, from the composer picker). */\n effort?: ReasoningEffort;\n /** Usage-tracking label for this call (e.g. \"chat\", \"summarize\"). Default: \"chat\". */\n usageLabel?: string;\n /** Stable browser tab id so screen/url context and navigation commands are tab-scoped. */\n browserTabId?: string;\n /** Resource scope for this chat thread, e.g. the deck currently bound to the tab. */\n scope?: AgentChatScope | null;\n /** When true, expose this chat turn as a user-visible run in RunsTray. */\n trackInRunsTray?: boolean;\n /**\n * Approval grants for human-in-the-loop actions. Each entry is a stable\n * approval key (see the `approval_required` event's `approvalKey`). When the\n * agent calls an action declared `needsApproval`, the loop pauses and emits\n * `approval_required`; the client re-issues the turn (typically an empty\n * continuation) with the approved call's key here so the gate lets it run.\n * Keys not present here keep the action paused. The model never sees or sets\n * this — it is supplied by the human's approve affordance.\n */\n approvedToolCalls?: string[];\n}\n\nexport type AgentChatEvent =\n | { type: \"text\"; text: string }\n | { type: \"thinking\"; text: string }\n | { type: \"activity\"; label: string; tool?: string }\n | { type: \"stream_keepalive\" }\n | { type: \"tool_start\"; tool: string; input: Record<string, string> }\n | {\n type: \"tool_done\";\n tool: string;\n result: string;\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n }\n | {\n /**\n * The agent tried to call an action declared `needsApproval` and the loop\n * paused instead of executing it. The client should surface an\n * approve/deny affordance; on approve, re-issue the turn with\n * `approvedToolCalls: [approvalKey]` so the gate lets this call run.\n */\n type: \"approval_required\";\n tool: string;\n input: Record<string, string>;\n /** Stable key the client echoes back in `approvedToolCalls` to approve. */\n approvalKey: string;\n /** The model-side tool-call id for this paused call, when available. */\n toolCallId?: string;\n }\n | {\n type: \"agent_call\";\n agent: string;\n status: \"start\" | \"done\" | \"error\";\n }\n | { type: \"agent_call_text\"; agent: string; text: string }\n | {\n type: \"agent_task\";\n taskId: string;\n threadId: string;\n description: string;\n status: \"running\" | \"completed\" | \"errored\";\n }\n | {\n type: \"agent_task_update\";\n taskId: string;\n preview: string;\n currentStep?: string;\n }\n | {\n type: \"agent_task_complete\";\n taskId: string;\n summary: string;\n }\n | { type: \"done\" }\n | {\n type: \"error\";\n error: string;\n /**\n * Optional machine-readable error code. Builder gateway uses codes\n * like \"credits-limit-monthly\" / \"unauthorized\" / \"gateway_not_enabled\"\n * so the chat UI can render a structured CTA (e.g. upgrade button).\n */\n errorCode?: string;\n /** Optional link paired with errorCode — e.g. Builder billing page. */\n upgradeUrl?: string;\n /** Optional details for expandable UI/debugging. */\n details?: string;\n /** True when the user can reasonably continue/retry from partial work. */\n recoverable?: boolean;\n }\n /**\n * Legacy SSE terminal event. New streams emit\n * `{ type: \"error\", errorCode: \"missing_credentials\" }` instead.\n */\n | { type: \"missing_api_key\" }\n | { type: \"loop_limit\"; maxIterations?: number }\n | {\n /**\n * An in-loop `Processor` aborted the run via `abort()` (which throws a\n * `TripWire`). The loop catches it, emits this event, stops cleanly, and\n * surfaces the reason as a final assistant message. Structural hook for\n * real-time guardrails and a proof-of-done / coverage gate.\n */\n type: \"tripwire\";\n reason: string;\n /** Name of the processor that aborted, when it declared one. */\n processor?: string;\n }\n | {\n type: \"auto_continue\";\n reason:\n | \"run_timeout\"\n | \"loop_limit\"\n | \"no_progress\"\n | \"stream_ended\"\n | \"gateway_timeout\"\n | \"network_interrupted\";\n maxIterations?: number;\n }\n | { type: \"clear\" };\n\nexport interface RunEvent {\n seq: number;\n event: AgentChatEvent;\n}\n\nexport type RunStatus = \"running\" | \"completed\" | \"errored\" | \"aborted\";\n"]}
|
|
@@ -130,6 +130,10 @@ export interface AgentSidebarProps {
|
|
|
130
130
|
suggestions?: string[];
|
|
131
131
|
/** Context-aware suggestions merged with `suggestions`. Enabled by default. */
|
|
132
132
|
dynamicSuggestions?: AssistantChatProps["dynamicSuggestions"];
|
|
133
|
+
/** Optional controls rendered in the chat composer toolbar. */
|
|
134
|
+
composerToolbarSlot?: AssistantChatProps["composerToolbarSlot"];
|
|
135
|
+
/** Optional content rendered at the bottom of the chat thread. */
|
|
136
|
+
threadFooterSlot?: AssistantChatProps["threadFooterSlot"];
|
|
133
137
|
/** Initial sidebar width in pixels. Mount-only; user resize and a saved
|
|
134
138
|
* localStorage value override this. Default: 380 */
|
|
135
139
|
defaultSidebarWidth?: number;
|
|
@@ -170,7 +174,7 @@ export interface AgentSidebarProps {
|
|
|
170
174
|
* Wraps app content with a toggleable agent sidebar.
|
|
171
175
|
* Use AgentToggleButton in your header to open/close it.
|
|
172
176
|
*/
|
|
173
|
-
export declare function AgentSidebar({ children, emptyStateText, suggestions, dynamicSuggestions, defaultSidebarWidth, sidebarWidth, position, defaultOpen, animateMobile, animateDesktop, chatViewTransition, storageKey, openOnChatRunning, onFullscreenRequest, scope, browserTabId, threadUrlSync, }: AgentSidebarProps): React.JSX.Element;
|
|
177
|
+
export declare function AgentSidebar({ children, emptyStateText, suggestions, dynamicSuggestions, composerToolbarSlot, threadFooterSlot, defaultSidebarWidth, sidebarWidth, position, defaultOpen, animateMobile, animateDesktop, chatViewTransition, storageKey, openOnChatRunning, onFullscreenRequest, scope, browserTabId, threadUrlSync, }: AgentSidebarProps): React.JSX.Element;
|
|
174
178
|
/**
|
|
175
179
|
* Focus the agent chat composer input.
|
|
176
180
|
* Opens the sidebar if closed, then focuses the text input.
|
|
@@ -1 +1 @@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R,cAAsC,EACtC,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,EACZ,QAAkB,EAClB,WAAmB,EACnB,aAAoB,EACpB,cAAqB,EACrB,kBAA0B,EAC1B,UAAU,EACV,iBAAyB,EACzB,mBAAmB,EACnB,KAAK,EACL,YAAY,EACZ,aAAa,GACd,EAAE,iBAAiB,qBAmjBnB;AAED;;;GAGG;AACH,wBAAgB,cAAc,SAqB7B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,qBAuBtE"}
|
|
@@ -1094,7 +1094,7 @@ export function AgentChatSurface({ mode = "panel", className, defaultMode = "cha
|
|
|
1094
1094
|
* Wraps app content with a toggleable agent sidebar.
|
|
1095
1095
|
* Use AgentToggleButton in your header to open/close it.
|
|
1096
1096
|
*/
|
|
1097
|
-
export function AgentSidebar({ children, emptyStateText = "How can I help you?", suggestions, dynamicSuggestions, defaultSidebarWidth, sidebarWidth, position = "right", defaultOpen = false, animateMobile = true, animateDesktop = true, chatViewTransition = false, storageKey, openOnChatRunning = false, onFullscreenRequest, scope, browserTabId, threadUrlSync, }) {
|
|
1097
|
+
export function AgentSidebar({ children, emptyStateText = "How can I help you?", suggestions, dynamicSuggestions, composerToolbarSlot, threadFooterSlot, defaultSidebarWidth, sidebarWidth, position = "right", defaultOpen = false, animateMobile = true, animateDesktop = true, chatViewTransition = false, storageKey, openOnChatRunning = false, onFullscreenRequest, scope, browserTabId, threadUrlSync, }) {
|
|
1098
1098
|
const initialWidth = defaultSidebarWidth ?? sidebarWidth ?? 380;
|
|
1099
1099
|
const [open, setOpen] = useState(() => openOnChatRunning || getInitialAgentSidebarOpen(defaultOpen, storageKey));
|
|
1100
1100
|
const [presentationMode, setPresentationMode] = useState(false);
|
|
@@ -1508,7 +1508,7 @@ export function AgentSidebar({ children, emptyStateText = "How can I help you?",
|
|
|
1508
1508
|
? "desktop"
|
|
1509
1509
|
: undefined, "data-agent-sidebar-state": panelOpen ? "open" : "closed", style: chatViewTransition
|
|
1510
1510
|
? getAgentChatViewTransitionStyle(panelStyle)
|
|
1511
|
-
: panelStyle, inert: sidebarAnimationEnabled && !panelOpen ? true : undefined, "aria-hidden": sidebarAnimationEnabled && !panelOpen ? true : undefined, children: _jsx("div", { className: "agent-sidebar-panel-inner flex min-h-0 flex-1 flex-col", children: _jsx(AgentPanel, { emptyStateText: emptyStateText, suggestions: suggestions, dynamicSuggestions: dynamicSuggestions, missingApiKeySetupLayout: "sidebar", onCollapse: () => setOpenPersisted(false), isFullscreen: effectiveFullscreen, onToggleFullscreen: isMobile ? undefined : (onFullscreenRequest ?? toggleFullscreen), storageKey: storageKey, scope: scope, browserTabId: browserTabId, threadUrlSync: threadUrlSync }) }) }), showResizeHandle && isLeft && (_jsx(ResizeHandle, { position: position, onDrag: handleDrag }))] })) : null;
|
|
1511
|
+
: panelStyle, inert: sidebarAnimationEnabled && !panelOpen ? true : undefined, "aria-hidden": sidebarAnimationEnabled && !panelOpen ? true : undefined, children: _jsx("div", { className: "agent-sidebar-panel-inner flex min-h-0 flex-1 flex-col", children: _jsx(AgentPanel, { emptyStateText: emptyStateText, suggestions: suggestions, dynamicSuggestions: dynamicSuggestions, composerToolbarSlot: composerToolbarSlot, threadFooterSlot: threadFooterSlot, missingApiKeySetupLayout: "sidebar", onCollapse: () => setOpenPersisted(false), isFullscreen: effectiveFullscreen, onToggleFullscreen: isMobile ? undefined : (onFullscreenRequest ?? toggleFullscreen), storageKey: storageKey, scope: scope, browserTabId: browserTabId, threadUrlSync: threadUrlSync }) }) }), showResizeHandle && isLeft && (_jsx(ResizeHandle, { position: position, onDrag: handleDrag }))] })) : null;
|
|
1512
1512
|
return (_jsxs("div", { className: "flex min-w-0 flex-1 h-screen overflow-hidden", children: [_jsx(AgentNativeRouteWarmup, {}), isMobile &&
|
|
1513
1513
|
!presentationMode &&
|
|
1514
1514
|
(mobileAnimationEnabled ? shouldRenderPanel : open) && (_jsx("div", { className: cn("agent-sidebar-backdrop fixed inset-0 bg-black/40", mobileAnimationEnabled && !panelOpen && "pointer-events-none"), "data-agent-sidebar-animation": mobileAnimationEnabled ? "mobile" : undefined, "data-agent-sidebar-state": panelOpen ? "open" : "closed", style: { zIndex: SIDEBAR_OVERLAY_Z_INDEX - 1 }, onClick: () => setOpenPersisted(false) })), shouldMountPanel ? _jsx(URLSync, { browserTabId: browserTabId }) : null, isLeft && !presentationMode ? sidebar : null, _jsx("div", { className: "flex flex-1 flex-col overflow-auto min-w-0", children: _jsx(ScreenRefreshBoundary, { children: children }) }), !isLeft && !presentationMode ? sidebar : null] }));
|