@agent-native/core 0.141.2 → 0.141.3
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/2026-08-05-durable-a2a-workers-avoid-startup-migration-contention.md +6 -0
- package/corpus/templates/analytics/server/plugins/db.ts +25 -8
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/routes.d.ts +2 -2
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.js +1 -1
- package/dist/db/migrations.d.ts +13 -3
- package/dist/db/migrations.js +19 -4
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/routes.d.ts +3 -3
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-chat-plugin.js +30 -21
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -2
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +1 -1
package/corpus/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
+
deferMigration,
|
|
2
3
|
ensureAdditiveColumns,
|
|
3
4
|
getDialect,
|
|
4
5
|
getDbExec,
|
|
5
6
|
isPostgres,
|
|
6
7
|
runMigrations,
|
|
7
8
|
} from "@agent-native/core/db";
|
|
9
|
+
import { isInBackgroundFunctionRuntime } from "@agent-native/core/server";
|
|
8
10
|
|
|
9
11
|
// Side-effect import: ensures registerShareableResource runs on server
|
|
10
12
|
// startup so the dashboard / analysis share actions know where to dispatch.
|
|
@@ -141,7 +143,17 @@ const ANALYTICS_ROLLUP_BACKFILL_STATEMENTS = {
|
|
|
141
143
|
],
|
|
142
144
|
} as const;
|
|
143
145
|
|
|
144
|
-
async function runHistoricalAnalyticsRollupBackfill()
|
|
146
|
+
async function runHistoricalAnalyticsRollupBackfill() {
|
|
147
|
+
// Durable agent workers share this plugin bundle with the regular server,
|
|
148
|
+
// but they must not become a second migration runner for an expensive
|
|
149
|
+
// historical scan. The keep-warm/regular server path owns this work.
|
|
150
|
+
if (isInBackgroundFunctionRuntime()) {
|
|
151
|
+
console.info(
|
|
152
|
+
"[db] Deferring historical Analytics rollup backfill from durable background runtime",
|
|
153
|
+
);
|
|
154
|
+
return deferMigration();
|
|
155
|
+
}
|
|
156
|
+
|
|
145
157
|
const db = getDbExec();
|
|
146
158
|
|
|
147
159
|
if (isPostgres()) {
|
|
@@ -151,11 +163,12 @@ async function runHistoricalAnalyticsRollupBackfill(): Promise<void> {
|
|
|
151
163
|
);
|
|
152
164
|
}
|
|
153
165
|
|
|
154
|
-
await db.transaction(async (tx) => {
|
|
166
|
+
const result = await db.transaction(async (tx) => {
|
|
155
167
|
// Only one serverless instance should perform the expensive scan. A
|
|
156
|
-
// try-lock
|
|
157
|
-
//
|
|
158
|
-
//
|
|
168
|
+
// A try-lock keeps competing cold starts from holding pooled Neon
|
|
169
|
+
// connections while waiting for the winner. A lock loser defers without
|
|
170
|
+
// recording the migration so a failed winner can be retried safely.
|
|
171
|
+
// The monotonic rollup upsert below keeps a live increment from being
|
|
159
172
|
// overwritten if ingest commits during the historical snapshot.
|
|
160
173
|
const lockResult = await tx.execute({
|
|
161
174
|
sql: "SELECT pg_try_advisory_xact_lock(hashtextextended(?, 0::bigint)) AS acquired",
|
|
@@ -163,15 +176,16 @@ async function runHistoricalAnalyticsRollupBackfill(): Promise<void> {
|
|
|
163
176
|
});
|
|
164
177
|
const acquired = lockResult.rows[0]?.acquired;
|
|
165
178
|
if (acquired !== true && acquired !== "t") {
|
|
166
|
-
|
|
167
|
-
"Analytics rollup backfill
|
|
179
|
+
console.info(
|
|
180
|
+
"[db] Deferring historical Analytics rollup backfill; another instance owns the advisory lock",
|
|
168
181
|
);
|
|
182
|
+
return deferMigration();
|
|
169
183
|
}
|
|
170
184
|
for (const statement of ANALYTICS_ROLLUP_BACKFILL_STATEMENTS.postgres) {
|
|
171
185
|
await tx.execute(statement);
|
|
172
186
|
}
|
|
173
187
|
});
|
|
174
|
-
return;
|
|
188
|
+
return result;
|
|
175
189
|
}
|
|
176
190
|
|
|
177
191
|
const statements = ANALYTICS_ROLLUP_BACKFILL_STATEMENTS.sqlite;
|
|
@@ -1557,6 +1571,9 @@ const runAnalyticsMigrations = runMigrations(
|
|
|
1557
1571
|
*/
|
|
1558
1572
|
export default async (nitroApp: any): Promise<void> => {
|
|
1559
1573
|
await runAnalyticsMigrations(nitroApp);
|
|
1574
|
+
if (isInBackgroundFunctionRuntime()) {
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1560
1577
|
try {
|
|
1561
1578
|
if (await repairPersistedFirstPartyDashboardQueries()) {
|
|
1562
1579
|
console.info(
|
|
@@ -62,11 +62,11 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
|
|
|
62
62
|
error: string;
|
|
63
63
|
states?: undefined;
|
|
64
64
|
} | {
|
|
65
|
-
error?: undefined;
|
|
66
65
|
states: {
|
|
67
66
|
clientId: number;
|
|
68
67
|
state: string;
|
|
69
68
|
}[];
|
|
69
|
+
error?: undefined;
|
|
70
70
|
}>>;
|
|
71
71
|
/**
|
|
72
72
|
* GET /_agent-native/collab/:docId/users
|
|
@@ -77,9 +77,9 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
|
|
|
77
77
|
error: string;
|
|
78
78
|
users?: undefined;
|
|
79
79
|
} | {
|
|
80
|
-
error?: undefined;
|
|
81
80
|
users: {
|
|
82
81
|
clientId: number;
|
|
83
82
|
lastSeen: number;
|
|
84
83
|
}[];
|
|
84
|
+
error?: undefined;
|
|
85
85
|
}>>;
|
package/dist/collab/routes.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
|
|
|
26
26
|
* Body: { update: string (base64), requestSource?: string }
|
|
27
27
|
*/
|
|
28
28
|
export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
29
|
-
error: string;
|
|
30
29
|
ok?: undefined;
|
|
30
|
+
error: string;
|
|
31
31
|
} | {
|
|
32
32
|
error?: undefined;
|
|
33
33
|
ok: boolean;
|
|
@@ -41,9 +41,9 @@ export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import
|
|
|
41
41
|
* Body: { text: string, fieldName?: string, requestSource?: string }
|
|
42
42
|
*/
|
|
43
43
|
export declare const postCollabText: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
44
|
+
text?: undefined;
|
|
44
45
|
ok?: undefined;
|
|
45
46
|
error: string;
|
|
46
|
-
text?: undefined;
|
|
47
47
|
} | {
|
|
48
48
|
error?: undefined;
|
|
49
49
|
ok: boolean;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
|
|
14
14
|
*/
|
|
15
15
|
export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
16
|
-
error: string;
|
|
17
16
|
ok?: undefined;
|
|
17
|
+
error: string;
|
|
18
18
|
} | {
|
|
19
19
|
error?: undefined;
|
|
20
20
|
ok: boolean;
|
package/dist/db/index.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare function createDb(config: DbConfig): Promise<(import("drizzle-orm
|
|
|
21
21
|
})>;
|
|
22
22
|
export type DrizzleDb = Awaited<ReturnType<typeof createDb>>;
|
|
23
23
|
export { createGetDb } from "./create-get-db.js";
|
|
24
|
-
export { runMigrations, type MigrationEntry, type MigrationSql, } from "./migrations.js";
|
|
24
|
+
export { deferMigration, MIGRATION_DEFERRED, runMigrations, type MigrationEntry, type MigrationRunResult, type MigrationSql, } from "./migrations.js";
|
|
25
25
|
export { getDbExec, createDbExec, getDatabaseUrl, getDialect, isLocalDatabase, isPostgres, intType, closeDbExec, type DbExec, type DbExecConfig, type DbExecQuery, type DbExecStatement, type Dialect, } from "./client.js";
|
|
26
26
|
export { table, text, integer, now } from "./schema.js";
|
|
27
27
|
export { ensureAdditiveColumns, type EnsureAdditiveColumnsOptions, type EnsureAdditiveColumnsResult, type EnsureAdditiveColumnsLogger, } from "./ensure-additive-columns.js";
|
package/dist/db/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export async function createDb(config) {
|
|
|
20
20
|
throw new Error(`Unsupported driver: ${config.driver}`);
|
|
21
21
|
}
|
|
22
22
|
export { createGetDb } from "./create-get-db.js";
|
|
23
|
-
export { runMigrations, } from "./migrations.js";
|
|
23
|
+
export { deferMigration, MIGRATION_DEFERRED, runMigrations, } from "./migrations.js";
|
|
24
24
|
export { getDbExec, createDbExec, getDatabaseUrl, getDialect, isLocalDatabase, isPostgres, intType, closeDbExec, } from "./client.js";
|
|
25
25
|
export { table, text, integer, now } from "./schema.js";
|
|
26
26
|
export { ensureAdditiveColumns, } from "./ensure-additive-columns.js";
|
package/dist/db/migrations.d.ts
CHANGED
|
@@ -53,6 +53,14 @@ export type MigrationSql = string | {
|
|
|
53
53
|
postgres?: string;
|
|
54
54
|
sqlite?: string;
|
|
55
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* A run-only migration can defer its work without recording itself as applied.
|
|
58
|
+
* This is for serialized backfills where another instance owns the advisory
|
|
59
|
+
* lock; throwing would turn an expected loser into a startup retry storm.
|
|
60
|
+
*/
|
|
61
|
+
export declare const MIGRATION_DEFERRED: unique symbol;
|
|
62
|
+
export declare function deferMigration(): typeof MIGRATION_DEFERRED;
|
|
63
|
+
export type MigrationRunResult = void | typeof MIGRATION_DEFERRED;
|
|
56
64
|
export interface MigrationEntry {
|
|
57
65
|
version: number;
|
|
58
66
|
sql: MigrationSql;
|
|
@@ -68,11 +76,13 @@ export interface MigrationEntry {
|
|
|
68
76
|
* JS step for a backfill SQL cannot express — e.g. a repair whose value comes
|
|
69
77
|
* from application-level parsing of a stored blob. Runs BEFORE this entry's
|
|
70
78
|
* SQL and before the bookkeeping row is written, so a throw leaves the
|
|
71
|
-
* migration unrecorded and it retries on the next boot.
|
|
72
|
-
*
|
|
79
|
+
* migration unrecorded and it retries on the next boot. Return
|
|
80
|
+
* `deferMigration()` when another instance owns a serialized backfill; the
|
|
81
|
+
* entry stays pending without logging a startup failure. Pass `sql: {}` for
|
|
82
|
+
* a run-only entry. Give run-only entries a `name`: the legacy version gate
|
|
73
83
|
* would otherwise mark them applied via any later migration's MAX advance.
|
|
74
84
|
*/
|
|
75
|
-
run?: () => Promise<
|
|
85
|
+
run?: () => Promise<MigrationRunResult>;
|
|
76
86
|
}
|
|
77
87
|
/**
|
|
78
88
|
* Runs a list of migrations against the configured database, gated by a
|
package/dist/db/migrations.js
CHANGED
|
@@ -154,6 +154,15 @@ function splitSqlStatements(sql) {
|
|
|
154
154
|
out.push(tail);
|
|
155
155
|
return out;
|
|
156
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* A run-only migration can defer its work without recording itself as applied.
|
|
159
|
+
* This is for serialized backfills where another instance owns the advisory
|
|
160
|
+
* lock; throwing would turn an expected loser into a startup retry storm.
|
|
161
|
+
*/
|
|
162
|
+
export const MIGRATION_DEFERRED = Symbol("migration-deferred");
|
|
163
|
+
export function deferMigration() {
|
|
164
|
+
return MIGRATION_DEFERRED;
|
|
165
|
+
}
|
|
157
166
|
function resolveMigrationSql(sql, pg) {
|
|
158
167
|
if (typeof sql === "string")
|
|
159
168
|
return sql;
|
|
@@ -272,8 +281,11 @@ export function runMigrations(migrations, options) {
|
|
|
272
281
|
try {
|
|
273
282
|
// D1 is SQLite-compatible
|
|
274
283
|
const raw = resolveMigrationSql(m.sql, false);
|
|
275
|
-
|
|
276
|
-
|
|
284
|
+
const runResult = m.run ? await m.run() : undefined;
|
|
285
|
+
if (runResult === MIGRATION_DEFERRED) {
|
|
286
|
+
console.info(`[db] Deferred migration ${m.name ? `"${m.name}" ` : ""}v${m.version}; it remains pending for a later boot`);
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
277
289
|
const recordStatements = [
|
|
278
290
|
m.name
|
|
279
291
|
? d1
|
|
@@ -482,8 +494,11 @@ export function runMigrations(migrations, options) {
|
|
|
482
494
|
// A throw here escapes to the outer handler with nothing recorded,
|
|
483
495
|
// so the entry is retried on the next boot rather than being marked
|
|
484
496
|
// applied against work that never happened.
|
|
485
|
-
|
|
486
|
-
|
|
497
|
+
const runResult = m.run ? await m.run() : undefined;
|
|
498
|
+
if (runResult === MIGRATION_DEFERRED) {
|
|
499
|
+
console.info(`[db] Deferred migration ${label}; it remains pending for a later boot`);
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
487
502
|
if (raw == null) {
|
|
488
503
|
// Dialect-gated migration with no SQL for this dialect; still mark
|
|
489
504
|
// as applied so we don't retry forever.
|
|
@@ -11,23 +11,23 @@
|
|
|
11
11
|
* DELETE /_agent-native/notifications/:id — delete
|
|
12
12
|
*/
|
|
13
13
|
export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
|
|
14
|
-
error?: undefined;
|
|
15
14
|
count: number;
|
|
16
15
|
updated?: undefined;
|
|
17
16
|
ok?: undefined;
|
|
18
|
-
} | {
|
|
19
17
|
error?: undefined;
|
|
18
|
+
} | {
|
|
20
19
|
count?: undefined;
|
|
21
20
|
updated: number;
|
|
22
21
|
ok?: undefined;
|
|
22
|
+
error?: undefined;
|
|
23
23
|
} | {
|
|
24
24
|
count?: undefined;
|
|
25
25
|
updated?: undefined;
|
|
26
26
|
error: string;
|
|
27
27
|
ok?: undefined;
|
|
28
28
|
} | {
|
|
29
|
-
error?: undefined;
|
|
30
29
|
count?: undefined;
|
|
31
30
|
updated?: undefined;
|
|
32
31
|
ok: boolean;
|
|
32
|
+
error?: undefined;
|
|
33
33
|
}>>;
|
|
@@ -41,16 +41,16 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
41
41
|
thumbsUpRate: number;
|
|
42
42
|
avgEvalScore: number;
|
|
43
43
|
} | {
|
|
44
|
-
error?: undefined;
|
|
45
44
|
summary: import("./types.js").TraceSummary;
|
|
46
45
|
spans: import("./types.js").TraceSpan[];
|
|
47
46
|
id?: undefined;
|
|
47
|
+
error?: undefined;
|
|
48
48
|
ok?: undefined;
|
|
49
49
|
} | {
|
|
50
|
-
error?: undefined;
|
|
51
50
|
summary?: undefined;
|
|
52
51
|
spans?: undefined;
|
|
53
52
|
id: string;
|
|
53
|
+
error?: undefined;
|
|
54
54
|
ok?: undefined;
|
|
55
55
|
} | {
|
|
56
56
|
summary?: undefined;
|
|
@@ -59,9 +59,9 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
|
|
|
59
59
|
error: any;
|
|
60
60
|
ok?: undefined;
|
|
61
61
|
} | {
|
|
62
|
-
error?: undefined;
|
|
63
62
|
summary?: undefined;
|
|
64
63
|
spans?: undefined;
|
|
65
64
|
id?: undefined;
|
|
65
|
+
error?: undefined;
|
|
66
66
|
ok: boolean;
|
|
67
67
|
}>>;
|
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
|
}>>;
|
|
@@ -4661,7 +4661,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
4661
4661
|
}
|
|
4662
4662
|
return invokeAgentChatHandler(event);
|
|
4663
4663
|
}));
|
|
4664
|
-
const
|
|
4664
|
+
const isBackgroundRuntime = isInBackgroundFunctionRuntime();
|
|
4665
|
+
const disableRecurringJobsRuntime = isBackgroundRuntime || shouldDisableRecurringJobsRuntime();
|
|
4665
4666
|
// ─── Recurring Jobs Scheduler ──────────────────────────────────────
|
|
4666
4667
|
// Poll every 60 seconds for due recurring jobs and execute them.
|
|
4667
4668
|
// Uses setInterval so it works in all deployment environments without
|
|
@@ -4720,26 +4721,28 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
4720
4721
|
// A non-Netlify self-dispatch only waits for the request to leave the
|
|
4721
4722
|
// current invocation. Keep the durable history row as a retryable queue
|
|
4722
4723
|
// so a frozen serverless handoff is recovered on the next sweep.
|
|
4723
|
-
(
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4724
|
+
if (!isBackgroundRuntime) {
|
|
4725
|
+
(() => {
|
|
4726
|
+
let inFlight = false;
|
|
4727
|
+
const sweep = async () => {
|
|
4728
|
+
if (inFlight)
|
|
4729
|
+
return;
|
|
4730
|
+
inFlight = true;
|
|
4731
|
+
try {
|
|
4732
|
+
const { redispatchUnclaimedAutomationRuns } = await import("../jobs/run-now.js");
|
|
4733
|
+
await redispatchUnclaimedAutomationRuns();
|
|
4734
|
+
}
|
|
4735
|
+
catch (error) {
|
|
4736
|
+
console.warn("[automations] queued-run sweep failed; retrying next tick:", error);
|
|
4737
|
+
}
|
|
4738
|
+
finally {
|
|
4739
|
+
inFlight = false;
|
|
4740
|
+
}
|
|
4741
|
+
};
|
|
4742
|
+
setTimeout(() => void sweep(), 15_000);
|
|
4743
|
+
setInterval(() => void sweep(), 30_000);
|
|
4744
|
+
})();
|
|
4745
|
+
}
|
|
4743
4746
|
mcpInitializationPromise = initializeMcpManager().catch((err) => {
|
|
4744
4747
|
console.warn(`[mcp-client] deferred initialization failed: ${err?.message ?? err}`);
|
|
4745
4748
|
});
|
|
@@ -4750,6 +4753,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
4750
4753
|
// per instance; cheap (one indexed query when no active tasks are found).
|
|
4751
4754
|
// Throttled by the same per-owner interval guard inside reconcileAgentTeamRunsForOwner.
|
|
4752
4755
|
(() => {
|
|
4756
|
+
if (isBackgroundRuntime)
|
|
4757
|
+
return;
|
|
4753
4758
|
// Track when this instance last ran the sweep so only one sweep fires
|
|
4754
4759
|
// per 2-min window even if multiple timers fire in overlapping invocations.
|
|
4755
4760
|
let lastSweep = 0;
|
|
@@ -4897,6 +4902,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
4897
4902
|
// comment above for why this exists and the timing budget in
|
|
4898
4903
|
// run-store.ts's `UNCLAIMED_BACKGROUND_RUN_FAST_SWEEP_MS` doc comment.
|
|
4899
4904
|
(() => {
|
|
4905
|
+
if (isBackgroundRuntime)
|
|
4906
|
+
return;
|
|
4900
4907
|
setTimeout(() => {
|
|
4901
4908
|
(async () => {
|
|
4902
4909
|
const { UNCLAIMED_BACKGROUND_RUN_FAST_SWEEP_MS } = await import("../agent/run-store.js");
|
|
@@ -4942,6 +4949,8 @@ Non-code requests are still fine on this surface: read data, navigate the UI, su
|
|
|
4942
4949
|
// still fails loud, and it survives the fast sweep having missed a row
|
|
4943
4950
|
// entirely (e.g. a restart landed between fast-sweep ticks).
|
|
4944
4951
|
(() => {
|
|
4952
|
+
if (isBackgroundRuntime)
|
|
4953
|
+
return;
|
|
4945
4954
|
let lastSweep = 0;
|
|
4946
4955
|
const SWEEP_INTERVAL_MS = 2 * 60 * 1000;
|
|
4947
4956
|
setTimeout(() => {
|
|
@@ -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;
|
|
31
30
|
ok: boolean;
|
|
32
31
|
key: string;
|
|
33
32
|
baseUrlKey?: string;
|
|
34
33
|
scope: AgentEngineApiKeyScope;
|
|
34
|
+
error?: undefined;
|
|
35
35
|
}>>;
|
|
36
36
|
export {};
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createServer, type CreateServerOptions, type EnvKeyConfig, } from "./create-server.js";
|
|
2
|
-
export { AGENT_BACKGROUND_PROCESSOR_FIELD, AGENT_BACKGROUND_PROCESSOR_ROUTE, AGENT_BACKGROUND_PROCESSOR_ROUTE_FIELD, dispatchPathTargetsNetlifyBackgroundFunction, resolveDurableBackgroundDispatchPath, } from "../agent/durable-background.js";
|
|
2
|
+
export { AGENT_BACKGROUND_PROCESSOR_FIELD, AGENT_BACKGROUND_PROCESSOR_ROUTE, AGENT_BACKGROUND_PROCESSOR_ROUTE_FIELD, dispatchPathTargetsNetlifyBackgroundFunction, isInBackgroundFunctionRuntime, resolveDurableBackgroundDispatchPath, } from "../agent/durable-background.js";
|
|
3
3
|
export { readBody, readBodyWithSizeLimit, streamFile, DEFAULT_CHAT_MAX_BODY_BYTES, DEFAULT_UPLOAD_MAX_FILE_BYTES, MAX_CHAT_ATTACHMENTS_PER_MESSAGE, isAllowedUploadMimeType, } from "./h3-helpers.js";
|
|
4
4
|
export { buildDeepLink, toAbsoluteOpenUrl, toDesktopOpenUrl, toVsCodeOpenUrl, OPEN_ROUTE_SUBPATH, DESKTOP_OPEN_URL, VSCODE_OPEN_URL, type DeepLinkInput, } from "./deep-link.js";
|
|
5
5
|
export { createOpenRouteHandler, type OpenRouteOptions } from "./open-route.js";
|
|
@@ -65,7 +65,7 @@ export { FeatureNotConfiguredError, hasBuilderPrivateKey, isBuilderEnvManaged, g
|
|
|
65
65
|
export { builderDesignSystemUrl, builderProjectBranchUrl, buildBuilderDesignSystemIndexFiles, createBuilderDesignSystemProxyFields, fetchBuilderDesignSystemDecodeJobStatus, fetchBuilderDesignSystemDocs, getBuilderDesignSystemsBaseUrl, hydrateBuilderDesignSystemReference, indexBuilderDesignSystem, localBuilderDesignSystemId, mimeTypeForBuilderDesignSystemFilename, parseBuilderDesignSystemProxyReference, startBuilderDesignSystemIndex, startBuilderDesignSystemUpload, type BuildBuilderDesignSystemIndexFilesOptions, type BuilderDesignSystemCodeFileInput, type BuilderDesignSystemDecodeJobStatus, type BuilderDesignSystemDocsOptions, type BuilderDesignSystemDocument, type BuilderDesignSystemHydratedReference, type BuilderDesignSystemIndexFile, type BuilderDesignSystemIndexFromSourcesOptions, type BuilderDesignSystemIndexOptions, type BuilderDesignSystemIndexResult, type BuilderDesignSystemUploadAttachment, type BuilderDesignSystemUploadSlot, type BuilderDesignSystemProxyFields, type BuilderDesignSystemProxyFieldsOptions, type BuilderDesignSystemProxyReference, type BuilderDesignSystemSourceKind, } from "./builder-design-systems.js";
|
|
66
66
|
export { getBuilderBranchProjectId, isBuilderBranchingEnabled, requestBuilderBrowserConnection, resolveBuilderBranchProjectId, resolveIsBuilderBranchingEnabled, runBuilderAgent, type RunBuilderAgentResult, } from "./builder-browser.js";
|
|
67
67
|
export { ensureFusionContainer, sendFusionBranchMessage, pushFusionBranch, reserveFusionHostingSlug, deployFusionProject, getFusionDeploys, getFusionBranchEditorUrl, getFusionHostingUrl, type FusionBranchRef, type EnsureFusionContainerResult, type SendFusionMessageResult, } from "./fusion-app.js";
|
|
68
|
-
export { sendEmail, isEmailConfigured, getEmailProvider, type EmailAttachment, type EmailProvider, type SendEmailArgs, } from "./email.js";
|
|
68
|
+
export { sendEmail, isEmailConfigured, getEmailReadiness, getEmailProvider, type EmailAttachment, type EmailReadiness, type EmailProvider, type SendEmailArgs, } from "./email.js";
|
|
69
69
|
export { notifyActivity, runActivityNotification, resolveActivityRecipients, type ActivityDeliveryFailure, type ActivityNotificationResult, type ActivityNotificationStatus, type NotifyActivityInput, type ResolveActivityRecipientsInput, } from "./activity-notifications.js";
|
|
70
70
|
export { renderEmail, emailStrong, emailLink, type RenderEmailArgs, type RenderedEmail, type EmailCta, } from "./email-template.js";
|
|
71
71
|
export { getAppProductionUrl, getFirstPartyProdUrl } from "./app-url.js";
|
package/dist/server/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createServer, } from "./create-server.js";
|
|
2
|
-
export { AGENT_BACKGROUND_PROCESSOR_FIELD, AGENT_BACKGROUND_PROCESSOR_ROUTE, AGENT_BACKGROUND_PROCESSOR_ROUTE_FIELD, dispatchPathTargetsNetlifyBackgroundFunction, resolveDurableBackgroundDispatchPath, } from "../agent/durable-background.js";
|
|
2
|
+
export { AGENT_BACKGROUND_PROCESSOR_FIELD, AGENT_BACKGROUND_PROCESSOR_ROUTE, AGENT_BACKGROUND_PROCESSOR_ROUTE_FIELD, dispatchPathTargetsNetlifyBackgroundFunction, isInBackgroundFunctionRuntime, resolveDurableBackgroundDispatchPath, } from "../agent/durable-background.js";
|
|
3
3
|
export { readBody, readBodyWithSizeLimit, streamFile, DEFAULT_CHAT_MAX_BODY_BYTES, DEFAULT_UPLOAD_MAX_FILE_BYTES, MAX_CHAT_ATTACHMENTS_PER_MESSAGE, isAllowedUploadMimeType, } from "./h3-helpers.js";
|
|
4
4
|
export { buildDeepLink, toAbsoluteOpenUrl, toDesktopOpenUrl, toVsCodeOpenUrl, OPEN_ROUTE_SUBPATH, DESKTOP_OPEN_URL, VSCODE_OPEN_URL, } from "./deep-link.js";
|
|
5
5
|
export { createOpenRouteHandler } from "./open-route.js";
|
|
@@ -66,7 +66,7 @@ export { FeatureNotConfiguredError, hasBuilderPrivateKey, isBuilderEnvManaged, g
|
|
|
66
66
|
export { builderDesignSystemUrl, builderProjectBranchUrl, buildBuilderDesignSystemIndexFiles, createBuilderDesignSystemProxyFields, fetchBuilderDesignSystemDecodeJobStatus, fetchBuilderDesignSystemDocs, getBuilderDesignSystemsBaseUrl, hydrateBuilderDesignSystemReference, indexBuilderDesignSystem, localBuilderDesignSystemId, mimeTypeForBuilderDesignSystemFilename, parseBuilderDesignSystemProxyReference, startBuilderDesignSystemIndex, startBuilderDesignSystemUpload, } from "./builder-design-systems.js";
|
|
67
67
|
export { getBuilderBranchProjectId, isBuilderBranchingEnabled, requestBuilderBrowserConnection, resolveBuilderBranchProjectId, resolveIsBuilderBranchingEnabled, runBuilderAgent, } from "./builder-browser.js";
|
|
68
68
|
export { ensureFusionContainer, sendFusionBranchMessage, pushFusionBranch, reserveFusionHostingSlug, deployFusionProject, getFusionDeploys, getFusionBranchEditorUrl, getFusionHostingUrl, } from "./fusion-app.js";
|
|
69
|
-
export { sendEmail, isEmailConfigured, getEmailProvider, } from "./email.js";
|
|
69
|
+
export { sendEmail, isEmailConfigured, getEmailReadiness, getEmailProvider, } from "./email.js";
|
|
70
70
|
export { notifyActivity, runActivityNotification, resolveActivityRecipients, } from "./activity-notifications.js";
|
|
71
71
|
export { renderEmail, emailStrong, emailLink, } from "./email-template.js";
|
|
72
72
|
export { getAppProductionUrl, getFirstPartyProdUrl } from "./app-url.js";
|
|
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
|
|
|
26
26
|
expiresAt?: undefined;
|
|
27
27
|
ttlSeconds?: undefined;
|
|
28
28
|
} | {
|
|
29
|
-
error?: undefined;
|
|
30
29
|
token: string;
|
|
31
30
|
expiresAt: string;
|
|
32
31
|
ttlSeconds: number;
|
|
32
|
+
error?: undefined;
|
|
33
33
|
}>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.141.
|
|
3
|
+
"version": "0.141.3",
|
|
4
4
|
"description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|