@agent-native/core 0.161.9 → 0.161.12
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/calendar/changelog/2026-08-18-calendar-event-time-editing-respects-the-event-timezone.md +6 -0
- package/corpus/templates/clips/app/components/player/video-player.tsx +1 -1
- package/corpus/templates/clips/app/i18n/en-US.ts +1 -1
- package/corpus/templates/clips/changelog/2026-08-18-centered-clip-play-button-and-comment-panel-hint.md +6 -0
- package/corpus/templates/content/actions/export-document.ts +68 -3
- package/corpus/templates/content/changelog/2026-08-06-database-exports-now-include-their-pages.md +6 -0
- package/corpus/templates/content/shared/document-export.ts +25 -0
- package/corpus/templates/design/.agents/skills/creative-context/SKILL.md +3 -0
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +66 -0
- package/corpus/templates/design/app/pages/Index.tsx +45 -1
- package/corpus/templates/design/app/pages/design-editor/creative-context-precedent.ts +233 -0
- package/corpus/templates/design/changelog/2026-08-11-new-designs-now-skip-the-intake-questions-and-follow-your-ex.md +6 -0
- package/corpus/templates/factory/actions/start-builder-for-item.ts +241 -22
- package/corpus/templates/factory/server/plugins/agent-chat.ts +9 -5
- package/corpus/templates/factory/server/plugins/factory-scheduler-job.ts +50 -14
- package/corpus/templates/factory/server/triage/builder-executor.ts +1 -0
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +231 -9
- package/corpus/templates/slides/app/components/layout/AgentWorkIndicator.tsx +56 -9
- package/corpus/templates/slides/app/context/DeckContext.tsx +99 -3
- package/corpus/templates/slides/app/i18n/en-US.ts +6 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +8 -2
- package/dist/action.js +19 -2
- package/dist/agent/chat-health-alert.d.ts +25 -0
- package/dist/agent/chat-health-alert.js +141 -0
- package/dist/client/conversation/use-near-bottom-autoscroll.js +34 -4
- package/dist/client/embed-auth.js +40 -3
- package/dist/client/route-state.js +42 -5
- package/dist/client/use-change-version.js +71 -25
- package/dist/client/use-db-sync.d.ts +1 -0
- package/dist/client/use-db-sync.js +223 -45
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.js +37 -4
- package/dist/collab/client.js +17 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- 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 +12 -12
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-chat-plugin.js +15 -2
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/poll.d.ts +22 -14
- package/dist/server/poll.js +243 -67
- package/package.json +1 -1
|
@@ -41,27 +41,27 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
+
error?: undefined;
|
|
45
|
+
ok?: undefined;
|
|
44
46
|
summary: import("./types.js").TraceSummary;
|
|
45
47
|
spans: import("./types.js").TraceSpan[];
|
|
46
48
|
id?: undefined;
|
|
49
|
+
} | {
|
|
47
50
|
error?: undefined;
|
|
48
51
|
ok?: undefined;
|
|
49
|
-
} | {
|
|
50
52
|
summary?: undefined;
|
|
51
53
|
spans?: undefined;
|
|
52
54
|
id: string;
|
|
53
|
-
error?: undefined;
|
|
54
|
-
ok?: undefined;
|
|
55
55
|
} | {
|
|
56
|
+
ok?: undefined;
|
|
56
57
|
summary?: undefined;
|
|
57
58
|
spans?: undefined;
|
|
58
59
|
id?: undefined;
|
|
59
60
|
error: any;
|
|
60
|
-
ok?: undefined;
|
|
61
61
|
} | {
|
|
62
|
+
error?: undefined;
|
|
62
63
|
summary?: undefined;
|
|
63
64
|
spans?: undefined;
|
|
64
65
|
id?: undefined;
|
|
65
66
|
ok: boolean;
|
|
66
|
-
error?: undefined;
|
|
67
67
|
}>>;
|
|
@@ -75,8 +75,8 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
75
75
|
user: "user";
|
|
76
76
|
}>>;
|
|
77
77
|
}, z.core.$strip>>, {
|
|
78
|
-
message?: undefined;
|
|
79
78
|
id?: undefined;
|
|
79
|
+
provider?: undefined;
|
|
80
80
|
deleted?: undefined;
|
|
81
81
|
providers: {
|
|
82
82
|
id: string;
|
|
@@ -88,45 +88,45 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
88
88
|
updatedAt: number;
|
|
89
89
|
}[];
|
|
90
90
|
count: number;
|
|
91
|
-
provider?: undefined;
|
|
92
91
|
found?: undefined;
|
|
93
92
|
registered?: undefined;
|
|
94
93
|
label?: undefined;
|
|
95
|
-
} | {
|
|
96
94
|
message?: undefined;
|
|
97
|
-
|
|
95
|
+
} | {
|
|
98
96
|
id?: undefined;
|
|
99
97
|
deleted?: undefined;
|
|
100
98
|
providers?: undefined;
|
|
99
|
+
count?: undefined;
|
|
101
100
|
found: boolean;
|
|
102
101
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
103
102
|
registered?: undefined;
|
|
104
103
|
label?: undefined;
|
|
105
|
-
} | {
|
|
106
104
|
message?: undefined;
|
|
107
|
-
|
|
105
|
+
} | {
|
|
106
|
+
provider?: undefined;
|
|
108
107
|
deleted?: undefined;
|
|
109
108
|
providers?: undefined;
|
|
110
|
-
|
|
109
|
+
count?: undefined;
|
|
111
110
|
found: boolean;
|
|
112
111
|
id: string;
|
|
113
112
|
registered?: undefined;
|
|
114
113
|
label?: undefined;
|
|
115
|
-
} | {
|
|
116
114
|
message?: undefined;
|
|
117
|
-
|
|
118
|
-
providers?: undefined;
|
|
115
|
+
} | {
|
|
119
116
|
provider?: undefined;
|
|
117
|
+
providers?: undefined;
|
|
118
|
+
count?: undefined;
|
|
120
119
|
found?: undefined;
|
|
121
120
|
deleted: boolean;
|
|
122
121
|
id: string;
|
|
123
122
|
registered?: undefined;
|
|
124
123
|
label?: undefined;
|
|
124
|
+
message?: undefined;
|
|
125
125
|
} | {
|
|
126
|
-
|
|
126
|
+
provider?: undefined;
|
|
127
127
|
deleted?: undefined;
|
|
128
128
|
providers?: undefined;
|
|
129
|
-
|
|
129
|
+
count?: undefined;
|
|
130
130
|
found?: undefined;
|
|
131
131
|
registered: boolean;
|
|
132
132
|
id: string;
|
|
@@ -312,8 +312,6 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
312
312
|
scope?: "org" | "user" | undefined;
|
|
313
313
|
}, {
|
|
314
314
|
id?: undefined;
|
|
315
|
-
deleted?: undefined;
|
|
316
|
-
provider?: undefined;
|
|
317
315
|
message?: undefined;
|
|
318
316
|
providers: {
|
|
319
317
|
id: string;
|
|
@@ -325,45 +323,47 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
325
323
|
updatedAt: number;
|
|
326
324
|
}[];
|
|
327
325
|
count: number;
|
|
326
|
+
provider?: undefined;
|
|
328
327
|
found?: undefined;
|
|
328
|
+
deleted?: undefined;
|
|
329
329
|
registered?: undefined;
|
|
330
330
|
label?: undefined;
|
|
331
331
|
} | {
|
|
332
332
|
id?: undefined;
|
|
333
|
-
deleted?: undefined;
|
|
334
333
|
message?: undefined;
|
|
335
334
|
providers?: undefined;
|
|
336
335
|
count?: undefined;
|
|
337
336
|
found: boolean;
|
|
338
337
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
338
|
+
deleted?: undefined;
|
|
339
339
|
registered?: undefined;
|
|
340
340
|
label?: undefined;
|
|
341
341
|
} | {
|
|
342
|
-
deleted?: undefined;
|
|
343
|
-
provider?: undefined;
|
|
344
342
|
message?: undefined;
|
|
345
343
|
providers?: undefined;
|
|
346
344
|
count?: undefined;
|
|
345
|
+
provider?: undefined;
|
|
347
346
|
found: boolean;
|
|
348
347
|
id: string;
|
|
348
|
+
deleted?: undefined;
|
|
349
349
|
registered?: undefined;
|
|
350
350
|
label?: undefined;
|
|
351
351
|
} | {
|
|
352
|
-
provider?: undefined;
|
|
353
352
|
message?: undefined;
|
|
354
353
|
providers?: undefined;
|
|
355
354
|
count?: undefined;
|
|
355
|
+
provider?: undefined;
|
|
356
356
|
found?: undefined;
|
|
357
357
|
deleted: boolean;
|
|
358
358
|
id: string;
|
|
359
359
|
registered?: undefined;
|
|
360
360
|
label?: undefined;
|
|
361
361
|
} | {
|
|
362
|
-
deleted?: undefined;
|
|
363
|
-
provider?: undefined;
|
|
364
362
|
providers?: undefined;
|
|
365
363
|
count?: undefined;
|
|
364
|
+
provider?: undefined;
|
|
366
365
|
found?: undefined;
|
|
366
|
+
deleted?: undefined;
|
|
367
367
|
registered: boolean;
|
|
368
368
|
id: string;
|
|
369
369
|
label: string;
|
|
@@ -48,8 +48,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
|
|
|
48
48
|
}>;
|
|
49
49
|
/** DELETE /_agent-native/resources/:id — delete a resource */
|
|
50
50
|
export declare function handleDeleteResource(event: any): Promise<{
|
|
51
|
-
ok?: undefined;
|
|
52
51
|
error: string;
|
|
52
|
+
ok?: undefined;
|
|
53
53
|
} | {
|
|
54
54
|
error?: undefined;
|
|
55
55
|
ok: boolean;
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -34,37 +34,37 @@ export declare function createListSecretsHandler(): import("h3").EventHandlerWit
|
|
|
34
34
|
/** POST /_agent-native/secrets/:key — write a secret. */
|
|
35
35
|
export declare function createWriteSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
36
36
|
error: string;
|
|
37
|
-
status?: undefined;
|
|
38
37
|
ok?: undefined;
|
|
38
|
+
status?: undefined;
|
|
39
39
|
} | {
|
|
40
|
+
error?: undefined;
|
|
40
41
|
ok: boolean;
|
|
41
42
|
status: string;
|
|
42
|
-
error?: undefined;
|
|
43
43
|
} | {
|
|
44
|
+
ok?: undefined;
|
|
44
45
|
error: string;
|
|
45
46
|
removed?: undefined;
|
|
46
|
-
ok?: undefined;
|
|
47
47
|
} | {
|
|
48
|
+
error?: undefined;
|
|
48
49
|
ok: boolean;
|
|
49
50
|
removed: boolean;
|
|
50
|
-
error?: undefined;
|
|
51
51
|
}>>;
|
|
52
52
|
/**
|
|
53
53
|
* POST /_agent-native/secrets/:key/test — validate an optional candidate value
|
|
54
54
|
* or the current stored value without changing anything.
|
|
55
55
|
*/
|
|
56
56
|
export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
57
|
+
ok?: undefined;
|
|
57
58
|
error: string;
|
|
58
59
|
note?: undefined;
|
|
59
|
-
ok?: undefined;
|
|
60
60
|
} | {
|
|
61
|
+
error?: undefined;
|
|
61
62
|
ok: boolean;
|
|
62
63
|
note?: undefined;
|
|
63
|
-
error?: undefined;
|
|
64
64
|
} | {
|
|
65
|
+
error?: undefined;
|
|
65
66
|
ok: boolean;
|
|
66
67
|
note: string;
|
|
67
|
-
error?: undefined;
|
|
68
68
|
} | {
|
|
69
69
|
note?: undefined;
|
|
70
70
|
ok: boolean;
|
|
@@ -95,11 +95,11 @@ export interface AdHocSecretPayload {
|
|
|
95
95
|
export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
|
|
96
96
|
error: string;
|
|
97
97
|
} | {
|
|
98
|
+
error?: undefined;
|
|
98
99
|
ok: boolean;
|
|
99
100
|
key: string;
|
|
100
|
-
error?: undefined;
|
|
101
101
|
} | {
|
|
102
|
+
error?: undefined;
|
|
102
103
|
ok: boolean;
|
|
103
104
|
removed: boolean;
|
|
104
|
-
error?: undefined;
|
|
105
105
|
}>>;
|
|
@@ -5094,18 +5094,31 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
5094
5094
|
console.error("[agent-chat] durable stale-run reap failed:", error);
|
|
5095
5095
|
return null;
|
|
5096
5096
|
});
|
|
5097
|
+
// Rides the same site-tick as the reap above, for the same reason:
|
|
5098
|
+
// it is the only durable driver on serverless. Never fatal to the
|
|
5099
|
+
// job sweep, and its own failure is a distinguishable outcome
|
|
5100
|
+
// rather than a silent healthy.
|
|
5101
|
+
const { checkChatHealthAndAlert } = await import("../agent/chat-health-alert.js");
|
|
5102
|
+
const chatHealth = await checkChatHealthAndAlert().catch((error) => {
|
|
5103
|
+
console.error("[agent-chat] chat-health alert failed:", error);
|
|
5104
|
+
return null;
|
|
5105
|
+
});
|
|
5097
5106
|
try {
|
|
5098
5107
|
// Jobs may request MCP tools, and `getActions` is synchronous —
|
|
5099
5108
|
// hydrate before the sweep so a serverless container that never
|
|
5100
5109
|
// eagerly initialized still resolves them.
|
|
5101
5110
|
await ensureMcpInitialized();
|
|
5102
5111
|
await processRecurringJobs(schedulerDeps);
|
|
5103
|
-
return { ok: true, staleRunsReaped };
|
|
5112
|
+
return { ok: true, staleRunsReaped, chatHealth };
|
|
5104
5113
|
}
|
|
5105
5114
|
catch (error) {
|
|
5106
5115
|
console.error("[recurring-jobs] Sweep route failed:", error);
|
|
5107
5116
|
setResponseStatus(event, 500);
|
|
5108
|
-
return {
|
|
5117
|
+
return {
|
|
5118
|
+
error: "Recurring-job sweep failed",
|
|
5119
|
+
staleRunsReaped,
|
|
5120
|
+
chatHealth,
|
|
5121
|
+
};
|
|
5109
5122
|
}
|
|
5110
5123
|
}));
|
|
5111
5124
|
if (disableRecurringJobsRuntime) {
|
|
@@ -27,10 +27,10 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
|
|
|
27
27
|
export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
28
28
|
error: any;
|
|
29
29
|
} | {
|
|
30
|
+
error?: undefined;
|
|
30
31
|
ok: boolean;
|
|
31
32
|
key: string;
|
|
32
33
|
baseUrlKey?: string;
|
|
33
34
|
scope: AgentEngineApiKeyScope;
|
|
34
|
-
error?: undefined;
|
|
35
35
|
}>>;
|
|
36
36
|
export {};
|
package/dist/server/poll.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ import { EventEmitter } from "node:events";
|
|
|
23
23
|
import { type DbExec } from "../db/client.js";
|
|
24
24
|
export interface ChangeEvent {
|
|
25
25
|
version: number;
|
|
26
|
+
/** Stable durable-row tie-breaker for events sharing a millisecond version. */
|
|
27
|
+
cursorId?: string;
|
|
26
28
|
source: string;
|
|
27
29
|
type: string;
|
|
28
30
|
key?: string;
|
|
@@ -53,9 +55,15 @@ export interface ChangeEvent {
|
|
|
53
55
|
}
|
|
54
56
|
export declare const DURABLE_LEGACY_DB_CHECK_INTERVAL_MS = 30000;
|
|
55
57
|
export declare const POLL_CHANGE_EVENT = "poll-change";
|
|
58
|
+
type SyncCursor = {
|
|
59
|
+
version: number;
|
|
60
|
+
id: string;
|
|
61
|
+
};
|
|
56
62
|
export type ChangeReadResult = {
|
|
57
63
|
version: number;
|
|
58
64
|
events: ChangeEvent[];
|
|
65
|
+
/** Composite `(version,id)` cursor for durable rows sharing a version. */
|
|
66
|
+
cursor?: string;
|
|
59
67
|
/**
|
|
60
68
|
* True when the returned version is an intentional cursor stop, not the
|
|
61
69
|
* source high-water mark. This happens when access is still pending or when a
|
|
@@ -143,11 +151,13 @@ export declare class AppSyncState {
|
|
|
143
151
|
private dbVersionFallbacks;
|
|
144
152
|
private warnedListenerThrow;
|
|
145
153
|
private version;
|
|
154
|
+
private latestCursor;
|
|
146
155
|
private readonly buffer;
|
|
147
156
|
private readonly pollEmitter;
|
|
148
157
|
private syncEventsInitPromise;
|
|
149
158
|
private lastDurablePrune;
|
|
150
159
|
private durablePruneFailures;
|
|
160
|
+
private durableWriteFailures;
|
|
151
161
|
/**
|
|
152
162
|
* Whether we've seeded `version` from the DB. In serverless (Netlify,
|
|
153
163
|
* Vercel, etc.) each invocation starts fresh — without seeding, `version`
|
|
@@ -175,8 +185,9 @@ export declare class AppSyncState {
|
|
|
175
185
|
* after a restart (where an existing row would look like a fresh bump).
|
|
176
186
|
*/
|
|
177
187
|
private lastScreenRefreshTs;
|
|
188
|
+
private lastScreenRefreshSessionId;
|
|
178
189
|
private screenRefreshInitialized;
|
|
179
|
-
private
|
|
190
|
+
private screenRefreshHasMore;
|
|
180
191
|
private localEmittersWired;
|
|
181
192
|
/**
|
|
182
193
|
* TTL'd access cache for the access-aware branch of `canSeeChangeForUser`,
|
|
@@ -232,13 +243,15 @@ export declare class AppSyncState {
|
|
|
232
243
|
* `sync_events_created_at_id_idx` drives the batch and the delete is a
|
|
233
244
|
* bounded index range scan.
|
|
234
245
|
*
|
|
235
|
-
* The `lastDurablePrune` throttle below is per-process
|
|
236
|
-
*
|
|
246
|
+
* The `lastDurablePrune` throttle below is per-process and starts at process
|
|
247
|
+
* initialization, so a cold serverless worker does not run a potentially
|
|
248
|
+
* large delete during its first request. Postgres workers also take a
|
|
237
249
|
* transaction-scoped advisory lease for each batch. The lease and delete
|
|
238
250
|
* are one bounded statement, so a serverless worker killed after the
|
|
239
251
|
* statement starts cannot leave an open transaction.
|
|
240
252
|
*/
|
|
241
253
|
private pruneDurableEvents;
|
|
254
|
+
private reportDurableWriteFailure;
|
|
242
255
|
persistSyncEvent(event: ChangeEvent, dedupeKey?: string, presetId?: string): Promise<void>;
|
|
243
256
|
/**
|
|
244
257
|
* Persist with a DB-allocated version (see ALLOCATING_INSERT_SQL). Returns
|
|
@@ -340,12 +353,9 @@ export declare class AppSyncState {
|
|
|
340
353
|
* Get changes after a given version, filtered to events the caller is
|
|
341
354
|
* allowed to see.
|
|
342
355
|
*/
|
|
343
|
-
getChangesSinceForUser(since: number, userEmail: string, orgId: string | undefined): ChangeReadResult;
|
|
344
|
-
getDurableChangesSinceForUser(since: number, userEmail: string, orgId: string | undefined): Promise<ChangeReadResult>;
|
|
345
|
-
getCombinedChangesSinceForUser(since: number, userEmail: string, orgId: string | undefined, useDurableEvents: boolean): Promise<
|
|
346
|
-
version: number;
|
|
347
|
-
events: ChangeEvent[];
|
|
348
|
-
}>;
|
|
356
|
+
getChangesSinceForUser(since: number, userEmail: string, orgId: string | undefined, cursor?: SyncCursor): ChangeReadResult;
|
|
357
|
+
getDurableChangesSinceForUser(since: number, userEmail: string, orgId: string | undefined, cursor?: SyncCursor): Promise<ChangeReadResult>;
|
|
358
|
+
getCombinedChangesSinceForUser(since: number, userEmail: string, orgId: string | undefined, useDurableEvents: boolean, cursor?: SyncCursor): Promise<ChangeReadResult>;
|
|
349
359
|
/**
|
|
350
360
|
* Seed `version` from DB timestamps on the first call so serverless cold
|
|
351
361
|
* starts don't return version 0 and confuse polling clients.
|
|
@@ -395,7 +405,7 @@ export declare function getChangesSinceForUser(since: number, userEmail: string,
|
|
|
395
405
|
/**
|
|
396
406
|
* Create an H3 handler for the poll endpoint.
|
|
397
407
|
*
|
|
398
|
-
* GET /_agent-native/poll?since=N → { version, events[] }
|
|
408
|
+
* GET /_agent-native/poll?since=N[&cursor=N.id] → { version, events[] }
|
|
399
409
|
*
|
|
400
410
|
* Requires an authenticated session. Events are filtered to the caller's
|
|
401
411
|
* tenant — global events (owner-less, table-level pings) reach every
|
|
@@ -403,9 +413,7 @@ export declare function getChangesSinceForUser(since: number, userEmail: string,
|
|
|
403
413
|
* Without auth + filtering, an anonymous attacker could poll the deployment
|
|
404
414
|
* and infer cross-tenant activity from the global event stream.
|
|
405
415
|
*/
|
|
406
|
-
export declare function createPollHandler(state?: AppSyncState): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
407
|
-
version: number;
|
|
408
|
-
events: ChangeEvent[];
|
|
409
|
-
} | {
|
|
416
|
+
export declare function createPollHandler(state?: AppSyncState): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<ChangeReadResult | {
|
|
410
417
|
error: string;
|
|
411
418
|
}>>;
|
|
419
|
+
export {};
|