@agent-native/core 0.191.0 → 0.192.0-nightly-20260926045737
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/templates/analytics/CHANGELOG.md +4 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +41 -12
- package/corpus/templates/analytics/app/lib/chat-handoff.ts +62 -0
- package/corpus/templates/analytics/changelog/2026-09-25-chat-sidebar-stays-closed-in-settings.md +6 -0
- package/corpus/templates/analytics/changelog/2026-09-25-show-one-recent-prompt-per-chat-turn.md +6 -0
- package/corpus/templates/clips/app/components/recorder/storage-setup-card.tsx +74 -11
- package/corpus/templates/clips/app/i18n/en-US.ts +6 -0
- package/corpus/templates/clips/changelog/2026-09-25-one-click-builder-storage.md +6 -0
- package/corpus/templates/design/actions/get-design.schema.ts +19 -0
- package/corpus/templates/design/actions/get-design.ts +16 -19
- package/corpus/templates/mail/actions/apply-ai-filter.ts +8 -0
- package/corpus/templates/mail/actions/create-automation.ts +7 -1
- package/corpus/templates/mail/actions/manage-ai-filter-rule-undo.ts +34 -0
- package/corpus/templates/mail/actions/manage-automations.ts +21 -44
- package/corpus/templates/mail/app/components/email/EmailList.tsx +35 -0
- package/corpus/templates/mail/app/components/onboarding/AiInboxSetup.tsx +116 -34
- package/corpus/templates/mail/app/components/settings/AiFilterSection.tsx +108 -70
- package/corpus/templates/mail/app/components/settings/AiRulePromptField.tsx +8 -1
- package/corpus/templates/mail/app/components/settings/JevConnectionPrompt.tsx +171 -0
- package/corpus/templates/mail/app/hooks/use-automations.ts +24 -0
- package/corpus/templates/mail/app/i18n/en-US.ts +8 -2
- package/corpus/templates/mail/app/pages/InboxPage.tsx +12 -2
- package/corpus/templates/mail/changelog/2026-09-25-mail-now-guides-users-to-connect-jev-before-setting-up-triag.md +6 -0
- package/corpus/templates/mail/server/db/schema.ts +17 -0
- package/corpus/templates/mail/server/lib/ai-filter-rule-undo.ts +151 -0
- package/corpus/templates/mail/server/lib/automations.ts +34 -0
- package/corpus/templates/mail/server/plugins/db.ts +18 -0
- package/corpus/templates/mail/server/plugins/mail-jobs.ts +6 -0
- package/dist/client/AssistantChat.js +20 -3
- package/dist/client/BuilderReferralInviteRow.d.ts +3 -0
- package/dist/client/BuilderReferralInviteRow.js +16 -0
- package/dist/client/agent-chat-adapter.js +6 -5
- package/dist/client/chat/run-recovery.js +6 -5
- package/dist/client/settings/UsageSection.js +2 -1
- package/dist/client/settings/index.d.ts +1 -1
- package/dist/client/settings/index.js +1 -1
- package/dist/client/settings/useBuilderStatus.d.ts +4 -1
- package/dist/client/settings/useBuilderStatus.js +32 -16
- package/dist/client/use-agent-chat-running-threads.d.ts +2 -0
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/framework-tools.d.ts +3 -1
- package/dist/framework-tools.js +2 -0
- package/dist/localization/core-messages/ar-SA.js +4 -0
- package/dist/localization/core-messages/de-DE.js +4 -0
- package/dist/localization/core-messages/en-US.d.ts +4 -0
- package/dist/localization/core-messages/en-US.js +4 -0
- package/dist/localization/core-messages/es-ES.js +4 -0
- package/dist/localization/core-messages/fr-FR.js +4 -0
- package/dist/localization/core-messages/hi-IN.js +4 -0
- package/dist/localization/core-messages/ja-JP.js +4 -0
- package/dist/localization/core-messages/ko-KR.js +4 -0
- package/dist/localization/core-messages/pt-BR.js +4 -0
- package/dist/localization/core-messages/zh-CN.js +4 -0
- package/dist/localization/core-messages/zh-TW.js +4 -0
- package/dist/localization/core-messages.d.ts +4 -0
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +5 -5
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +7 -7
- package/dist/provider-api/actions/provider-api.d.ts +14 -14
- package/dist/secrets/routes.d.ts +3 -3
- package/dist/server/action-discovery.js +4 -0
- package/dist/server/agent-chat/plugin-options.d.ts +1 -1
- package/dist/server/agent-chat-plugin.js +6 -4
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
- package/dist/server/core-routes-plugin.d.ts +1 -1
- package/dist/server/fusion-app.d.ts +3 -0
- package/dist/server/fusion-app.js +17 -0
- package/dist/shared/builder-referrals.d.ts +10 -0
- package/dist/shared/builder-referrals.js +29 -0
- package/dist/usage/actions/get-builder-referral-info.d.ts +9 -0
- package/dist/usage/actions/get-builder-referral-info.js +26 -0
- package/dist/usage/metrics-store.js +142 -30
- package/dist/vite/action-types-plugin.js +4 -0
- package/docs/content/actions-agent-tools.mdx +2 -1
- package/package.json +3 -2
|
@@ -214,39 +214,125 @@ function promptText(value) {
|
|
|
214
214
|
.join("\n")
|
|
215
215
|
.trim();
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function messageRecord(entry) {
|
|
218
|
+
if (!entry || typeof entry !== "object")
|
|
219
|
+
return null;
|
|
220
|
+
const record = entry;
|
|
221
|
+
return record.message && typeof record.message === "object"
|
|
222
|
+
? record.message
|
|
223
|
+
: record;
|
|
224
|
+
}
|
|
225
|
+
function messageTurnId(message) {
|
|
226
|
+
const metadata = message.metadata && typeof message.metadata === "object"
|
|
227
|
+
? message.metadata
|
|
228
|
+
: null;
|
|
229
|
+
const custom = metadata?.custom && typeof metadata.custom === "object"
|
|
230
|
+
? metadata.custom
|
|
231
|
+
: null;
|
|
232
|
+
const turnId = custom?.turnId ?? metadata?.turnId;
|
|
233
|
+
return typeof turnId === "string" && turnId.trim() ? turnId.trim() : null;
|
|
234
|
+
}
|
|
235
|
+
function messageTimestamp(message) {
|
|
236
|
+
const value = message.createdAt;
|
|
237
|
+
const timestamp = typeof value === "number"
|
|
238
|
+
? value
|
|
239
|
+
: typeof value === "string"
|
|
240
|
+
? Date.parse(value)
|
|
241
|
+
: Number.NaN;
|
|
242
|
+
return Number.isFinite(timestamp) ? timestamp : null;
|
|
243
|
+
}
|
|
244
|
+
function indexThreadPrompts(threadData) {
|
|
218
245
|
const parsed = parseJson(threadData);
|
|
219
246
|
const messages = parsed?.messages;
|
|
220
247
|
if (!Array.isArray(messages))
|
|
221
248
|
return null;
|
|
222
|
-
|
|
223
|
-
|
|
249
|
+
const promptsByTurn = new Map();
|
|
250
|
+
const timestampedPrompts = [];
|
|
251
|
+
let latestUserPrompt = null;
|
|
252
|
+
let userMessageCount = 0;
|
|
253
|
+
let soleUserTimestamp = null;
|
|
254
|
+
let soleUntimestampedPrompt = null;
|
|
255
|
+
for (let i = 0; i < messages.length; i += 1) {
|
|
256
|
+
const message = messageRecord(messages[i]);
|
|
257
|
+
if (!message)
|
|
224
258
|
continue;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
259
|
+
if (message.role === "user" || message.role === "human") {
|
|
260
|
+
userMessageCount += 1;
|
|
261
|
+
const text = promptText(message.content);
|
|
262
|
+
latestUserPrompt = text
|
|
263
|
+
? {
|
|
264
|
+
prompt: text.length > 360 ? `${text.slice(0, 359).trimEnd()}…` : text,
|
|
265
|
+
messageId: typeof message.id === "string" ? message.id : null,
|
|
266
|
+
}
|
|
267
|
+
: null;
|
|
268
|
+
const timestamp = messageTimestamp(message);
|
|
269
|
+
if (timestamp !== null) {
|
|
270
|
+
timestampedPrompts.push({
|
|
271
|
+
timestamp,
|
|
272
|
+
index: i,
|
|
273
|
+
prompt: latestUserPrompt,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
if (userMessageCount === 1) {
|
|
277
|
+
soleUserTimestamp = timestamp;
|
|
278
|
+
soleUntimestampedPrompt = latestUserPrompt;
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
soleUserTimestamp = null;
|
|
282
|
+
soleUntimestampedPrompt = null;
|
|
283
|
+
}
|
|
231
284
|
continue;
|
|
232
|
-
|
|
233
|
-
if (
|
|
234
|
-
|
|
285
|
+
}
|
|
286
|
+
if (message.role === "assistant") {
|
|
287
|
+
const turnId = messageTurnId(message);
|
|
288
|
+
if (turnId && latestUserPrompt) {
|
|
289
|
+
promptsByTurn.set(turnId, latestUserPrompt);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
235
292
|
}
|
|
236
|
-
|
|
293
|
+
timestampedPrompts.sort((a, b) => a.timestamp - b.timestamp || a.index - b.index);
|
|
294
|
+
return {
|
|
295
|
+
promptsByTurn,
|
|
296
|
+
timestampedPrompts,
|
|
297
|
+
soleUntimestampedPrompt: userMessageCount === 1 && soleUserTimestamp === null
|
|
298
|
+
? soleUntimestampedPrompt
|
|
299
|
+
: null,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function promptForTurn(index, taskId, usageCreatedAt) {
|
|
303
|
+
if (taskId) {
|
|
304
|
+
const prompt = index.promptsByTurn.get(taskId);
|
|
305
|
+
if (prompt)
|
|
306
|
+
return prompt;
|
|
307
|
+
}
|
|
308
|
+
let low = 0;
|
|
309
|
+
let high = index.timestampedPrompts.length;
|
|
310
|
+
while (low < high) {
|
|
311
|
+
const middle = Math.floor((low + high) / 2);
|
|
312
|
+
if (index.timestampedPrompts[middle].timestamp <= usageCreatedAt) {
|
|
313
|
+
low = middle + 1;
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
high = middle;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return low > 0
|
|
320
|
+
? (index.timestampedPrompts[low - 1]?.prompt ?? null)
|
|
321
|
+
: index.soleUntimestampedPrompt;
|
|
237
322
|
}
|
|
238
323
|
async function hydrateRecentPrompts(rows, builderCreditsEnabled) {
|
|
324
|
+
const recentLimit = 12;
|
|
239
325
|
const threadIds = [
|
|
240
326
|
...new Set(rows
|
|
241
327
|
.map((row) => nullableStringField(row, "thread_id"))
|
|
242
328
|
.filter((value) => Boolean(value))),
|
|
243
|
-
];
|
|
329
|
+
].slice(0, recentLimit);
|
|
244
330
|
const threads = new Map();
|
|
245
331
|
let threadQueryUnavailable = false;
|
|
246
332
|
if (threadIds.length > 0) {
|
|
247
333
|
try {
|
|
248
334
|
const result = await getDbExec().execute({
|
|
249
|
-
sql: `SELECT id,
|
|
335
|
+
sql: `SELECT id, thread_data FROM chat_threads WHERE id IN (${threadIds.map(() => "?").join(", ")})`,
|
|
250
336
|
args: threadIds,
|
|
251
337
|
});
|
|
252
338
|
for (const row of result.rows) {
|
|
@@ -259,12 +345,35 @@ async function hydrateRecentPrompts(rows, builderCreditsEnabled) {
|
|
|
259
345
|
threadQueryUnavailable = true;
|
|
260
346
|
}
|
|
261
347
|
}
|
|
262
|
-
|
|
348
|
+
const recent = [];
|
|
349
|
+
const seenTurns = new Set();
|
|
350
|
+
const promptIndexes = new Map();
|
|
351
|
+
for (const row of rows) {
|
|
263
352
|
const threadId = nullableStringField(row, "thread_id");
|
|
353
|
+
const taskId = nullableStringField(row, "task_id");
|
|
354
|
+
const taskTurnKey = threadId && taskId ? JSON.stringify([threadId, taskId]) : null;
|
|
355
|
+
if (taskTurnKey && seenTurns.has(taskTurnKey))
|
|
356
|
+
continue;
|
|
264
357
|
const thread = threadId ? threads.get(threadId) : undefined;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
358
|
+
let prompt = null;
|
|
359
|
+
if (threadId && thread) {
|
|
360
|
+
if (!promptIndexes.has(threadId)) {
|
|
361
|
+
promptIndexes.set(threadId, indexThreadPrompts(thread.thread_data));
|
|
362
|
+
}
|
|
363
|
+
const promptIndex = promptIndexes.get(threadId);
|
|
364
|
+
if (promptIndex) {
|
|
365
|
+
prompt = promptForTurn(promptIndex, taskId, numberField(row, "created_at"));
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
const turnKey = taskTurnKey ??
|
|
369
|
+
(threadId && prompt?.messageId
|
|
370
|
+
? JSON.stringify([threadId, prompt.messageId])
|
|
371
|
+
: null);
|
|
372
|
+
if (turnKey && seenTurns.has(turnKey))
|
|
373
|
+
continue;
|
|
374
|
+
if (turnKey)
|
|
375
|
+
seenTurns.add(turnKey);
|
|
376
|
+
recent.push({
|
|
268
377
|
id: numberField(row, "id"),
|
|
269
378
|
createdAt: numberField(row, "created_at"),
|
|
270
379
|
ownerEmail: stringField(row, "owner_email"),
|
|
@@ -291,17 +400,18 @@ async function hydrateRecentPrompts(rows, builderCreditsEnabled) {
|
|
|
291
400
|
engineName: nullableStringField(row, "engine_name"),
|
|
292
401
|
}
|
|
293
402
|
: {}),
|
|
294
|
-
prompt: prompt ??
|
|
403
|
+
prompt: prompt?.prompt ?? null,
|
|
295
404
|
promptSource: prompt
|
|
296
405
|
? "thread"
|
|
297
|
-
:
|
|
298
|
-
? "
|
|
299
|
-
:
|
|
300
|
-
? "unavailable"
|
|
301
|
-
: "not-captured",
|
|
406
|
+
: threadQueryUnavailable && threadId
|
|
407
|
+
? "unavailable"
|
|
408
|
+
: "not-captured",
|
|
302
409
|
threadId,
|
|
303
|
-
};
|
|
304
|
-
|
|
410
|
+
});
|
|
411
|
+
if (recent.length === recentLimit)
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
return recent;
|
|
305
415
|
}
|
|
306
416
|
async function detectUsageEngineName() {
|
|
307
417
|
try {
|
|
@@ -359,14 +469,16 @@ export async function listAppUsageMetrics(input, accessInput) {
|
|
|
359
469
|
ORDER BY created_at ASC`,
|
|
360
470
|
args: baseArgs,
|
|
361
471
|
}),
|
|
472
|
+
// ponytail: cap legacy prompt hydration at 240 rows; raise only if real
|
|
473
|
+
// histories routinely crowd distinct prompts out of the 12-turn list.
|
|
362
474
|
getDbExec().execute({
|
|
363
475
|
sql: `SELECT id, created_at, owner_email, app, label, model,
|
|
364
476
|
input_tokens, output_tokens, cache_read_tokens, cache_write_tokens,
|
|
365
|
-
cost_cents_x100, builder_credits_used, engine_name, thread_id
|
|
477
|
+
cost_cents_x100, builder_credits_used, engine_name, thread_id, task_id
|
|
366
478
|
FROM token_usage
|
|
367
479
|
WHERE ${appScope.where} AND ${resolved.ownerScope.where} AND created_at >= ?
|
|
368
|
-
ORDER BY created_at DESC
|
|
369
|
-
LIMIT
|
|
480
|
+
ORDER BY created_at DESC, id DESC
|
|
481
|
+
LIMIT 240`,
|
|
370
482
|
args: baseArgs,
|
|
371
483
|
}),
|
|
372
484
|
]);
|
|
@@ -165,6 +165,10 @@ const CORE_SHARING_ACTIONS = [
|
|
|
165
165
|
name: "get-builder-credit-usage",
|
|
166
166
|
specifier: "@agent-native/core/usage/actions/get-builder-credit-usage",
|
|
167
167
|
},
|
|
168
|
+
{
|
|
169
|
+
name: "get-builder-referral-info",
|
|
170
|
+
specifier: "@agent-native/core/usage/actions/get-builder-referral-info",
|
|
171
|
+
},
|
|
168
172
|
{
|
|
169
173
|
name: "create-resource-version",
|
|
170
174
|
specifier: "@agent-native/core/history/actions/create-resource-version",
|
|
@@ -45,7 +45,8 @@ export default createCoreRoutesPlugin({
|
|
|
45
45
|
|
|
46
46
|
The remaining groups are booleans, all on by default: `sharing`, `review`,
|
|
47
47
|
`history`, `featureFlags`, `localization`, `audit`, `contextXray`,
|
|
48
|
-
`userProfile`, `automation`, `docs`, `resources`, `
|
|
48
|
+
`userProfile`, `automation`, `docs`, `resources`, `browserSessions`, `web`,
|
|
49
|
+
`workspaceApps`,
|
|
49
50
|
`chat`, and `email`. Use `frameworkTools: "minimal"` to turn every group off at
|
|
50
51
|
once for a voice-first or single-purpose app, or
|
|
51
52
|
`frameworkTools: { preset: "minimal", resources: true }` to keep just one. An
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.192.0-nightly-20260926045737",
|
|
4
4
|
"description": "The agentic application framework for building autonomous agents with intuitive UIs",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -359,6 +359,7 @@
|
|
|
359
359
|
"./usage/actions/manage-usage-alert": "./dist/usage/actions/manage-usage-alert.js",
|
|
360
360
|
"./usage/actions/get-usage-metrics": "./dist/usage/actions/get-usage-metrics.js",
|
|
361
361
|
"./usage/actions/get-builder-credit-usage": "./dist/usage/actions/get-builder-credit-usage.js",
|
|
362
|
+
"./usage/actions/get-builder-referral-info": "./dist/usage/actions/get-builder-referral-info.js",
|
|
362
363
|
"./connections": "./dist/connections/index.js",
|
|
363
364
|
"./connections/runtime": "./dist/connections/runtime.js",
|
|
364
365
|
"./provider-api": "./dist/provider-api/index.js",
|
|
@@ -510,8 +511,8 @@
|
|
|
510
511
|
"yaml": "^2.9.0",
|
|
511
512
|
"yjs": "^13.6.32",
|
|
512
513
|
"zod": "^4.3.6",
|
|
513
|
-
"@agent-native/agentkit": "^0.2.13",
|
|
514
514
|
"@agent-native/recap-cli": "0.5.43",
|
|
515
|
+
"@agent-native/agentkit": "^0.2.13",
|
|
515
516
|
"@agent-native/toolkit": "^0.21.3"
|
|
516
517
|
},
|
|
517
518
|
"devDependencies": {
|