@agent-native/core 0.220.0 → 0.220.1-nightly-20261024183236
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/dist/action.d.ts +18 -0
- package/dist/action.js +15 -0
- package/dist/agent/production-agent.js +42 -15
- package/dist/agent/run-manager.js +24 -4
- package/dist/automation/index.d.ts +1 -1
- package/dist/client/sse-event-processor.d.ts +7 -0
- package/dist/client/sse-event-processor.js +3 -2
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/integrations/google-docs-poller.d.ts +9 -1
- package/dist/integrations/google-docs-poller.js +16 -5
- package/dist/integrations/pending-tasks-retry-job.d.ts +1 -1
- package/dist/integrations/pending-tasks-retry-job.js +6 -2
- package/dist/integrations/plugin.js +36 -5
- package/dist/integrations/remote-push-delivery-job.d.ts +1 -1
- package/dist/integrations/remote-push-delivery-job.js +6 -2
- package/dist/integrations/remote-retry-job.d.ts +1 -1
- package/dist/integrations/remote-retry-job.js +6 -2
- package/dist/jobs/actions/manage-recurring-job.d.ts +1 -1
- package/dist/notifications/routes.d.ts +4 -4
- package/dist/observability/routes.d.ts +7 -7
- package/dist/org/handlers.d.ts +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +4 -4
- package/dist/provider-api/actions/provider-api.d.ts +4 -4
- package/dist/provider-api/corpus-jobs.js +3 -21
- package/dist/provider-api/index.js +17 -23
- package/dist/provider-api/request-body.d.ts +1 -0
- package/dist/provider-api/request-body.js +50 -0
- package/dist/provider-api/staging.js +2 -20
- package/dist/secrets/routes.d.ts +10 -10
- package/dist/server/agent-engine-default-model-route.d.ts +1 -1
- package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
- package/dist/server/background-jobs.d.ts +3 -0
- package/dist/server/background-jobs.js +33 -0
- package/dist/server/core-routes-plugin.js +20 -2
- package/dist/server/dev-database-lifecycle.js +13 -3
- package/dist/server/interval-job.d.ts +2 -1
- package/dist/server/interval-job.js +1 -1
- package/dist/shared/poll-engine.d.ts +2 -1
- package/dist/shared/poll-engine.js +25 -1
- package/dist/shared/progress-events.d.ts +1 -0
- package/dist/shared/progress-events.js +13 -0
- package/dist/triggers/actions/manage-automation.d.ts +6 -6
- package/dist/triggers/dispatcher.d.ts +1 -0
- package/dist/triggers/dispatcher.js +28 -2
- package/package.json +3 -3
|
@@ -67,8 +67,6 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
67
67
|
triggerType: "event" | "manual" | "schedule" | "webhook";
|
|
68
68
|
body: string;
|
|
69
69
|
}, {
|
|
70
|
-
updated?: undefined;
|
|
71
|
-
deleted?: undefined;
|
|
72
70
|
created: boolean;
|
|
73
71
|
resourceId: string;
|
|
74
72
|
name: string;
|
|
@@ -89,17 +87,17 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
89
87
|
executionCwd: string;
|
|
90
88
|
mcpTools: string[];
|
|
91
89
|
webhookPath: string;
|
|
90
|
+
deleted?: undefined;
|
|
91
|
+
updated?: undefined;
|
|
92
92
|
changed?: undefined;
|
|
93
93
|
previouslyEnabled?: undefined;
|
|
94
94
|
requestedEnabled?: undefined;
|
|
95
95
|
} | {
|
|
96
|
-
updated?: undefined;
|
|
97
|
-
enabled?: undefined;
|
|
98
|
-
nextRun?: undefined;
|
|
99
96
|
created?: undefined;
|
|
100
97
|
deleted: boolean;
|
|
101
98
|
resourceId: string;
|
|
102
99
|
name: string;
|
|
100
|
+
updated?: undefined;
|
|
103
101
|
scope?: undefined;
|
|
104
102
|
triggerType?: undefined;
|
|
105
103
|
event?: undefined;
|
|
@@ -107,6 +105,8 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
107
105
|
timezone?: undefined;
|
|
108
106
|
condition?: undefined;
|
|
109
107
|
body?: undefined;
|
|
108
|
+
enabled?: undefined;
|
|
109
|
+
nextRun?: undefined;
|
|
110
110
|
createdBy?: undefined;
|
|
111
111
|
model?: undefined;
|
|
112
112
|
reasoningEffort?: undefined;
|
|
@@ -119,8 +119,8 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
119
119
|
requestedEnabled?: undefined;
|
|
120
120
|
webhookPath?: undefined;
|
|
121
121
|
} | {
|
|
122
|
-
deleted?: undefined;
|
|
123
122
|
created?: undefined;
|
|
123
|
+
deleted?: undefined;
|
|
124
124
|
updated: boolean;
|
|
125
125
|
resourceId: string;
|
|
126
126
|
name: string;
|
|
@@ -19,6 +19,7 @@ export declare function buildAutomationTriggerPrompt(input: {
|
|
|
19
19
|
body: string;
|
|
20
20
|
}): string;
|
|
21
21
|
export declare function initTriggerDispatcher(deps: TriggerDispatcherDeps): Promise<void>;
|
|
22
|
+
export declare function stopTriggerQueueWorker(): Promise<void>;
|
|
22
23
|
/**
|
|
23
24
|
* Reloads which events have automations, e.g. after one is defined or
|
|
24
25
|
* deleted. `false` means the load failed; the next event reads fresh.
|
|
@@ -7,7 +7,8 @@ import { BackgroundAutomationRunError, checkBackgroundAutomationCredentials, isB
|
|
|
7
7
|
import { buildJobResourceContent, jobBelongsToApp, parseJobResource, patchJobFrontmatterFields, } from "../jobs/frontmatter.js";
|
|
8
8
|
import { registerRecurringSweepHandler, } from "../jobs/sweep-hooks.js";
|
|
9
9
|
import { resourceFingerprintAllOwners, resourceGetByPath, resourceListAllOwnersWithFingerprint, resourcePutIfCurrent, } from "../resources/store.js";
|
|
10
|
-
import {
|
|
10
|
+
import { registerBackgroundJobStop } from "../server/background-jobs.js";
|
|
11
|
+
import { startIntervalJob, } from "../server/interval-job.js";
|
|
11
12
|
import { runWithRequestContext } from "../server/request-context.js";
|
|
12
13
|
import { evaluateCondition } from "./condition-evaluator.js";
|
|
13
14
|
import { AUTOMATION_TRIGGER_EVENT_EXPIRY_BATCH_SIZE, AUTOMATION_TRIGGER_EVENT_PURGE_BATCH_SIZE, MAX_AUTOMATION_TRIGGER_EVENT_FAILURES, claimNextAutomationTriggerEvent, completeAutomationTriggerEvent, enqueueAutomationTriggerEvent, expireStaleAutomationTriggerEvents, expireAutomationTriggerEvent, failAutomationTriggerEvent, getAutomationTriggerSweepCursor, hasPendingStaleAutomationTriggerEvents, listReadyAutomationTriggerIds, purgeExpiredAutomationTriggerEvents, reserveAutomationTriggerEventPurge, retryAutomationTriggerEvent, scheduleAutomationTriggerEventPurge, setAutomationTriggerSweepCursor, } from "./event-queue.js";
|
|
@@ -67,6 +68,10 @@ let _eventAutomationScanCount = 0;
|
|
|
67
68
|
let _eventAutomationGeneration = 0;
|
|
68
69
|
let _inflightEventAutomationScan = null;
|
|
69
70
|
let _triggerQueueWorkerStarted = false;
|
|
71
|
+
let _triggerQueueWorker = null;
|
|
72
|
+
// When true, in-process drains finish their current claim then stop taking
|
|
73
|
+
// more work so stopTriggerQueueWorker cannot hang on a large backlog.
|
|
74
|
+
let _triggerQueueStopping = false;
|
|
70
75
|
// ponytail: warm-process backoff resets on cold start; persist only if cold churn warrants it.
|
|
71
76
|
let _triggerQueueIdleBackoffMs = 0;
|
|
72
77
|
let _triggerQueueResumeAt = 0;
|
|
@@ -199,6 +204,7 @@ failed) {
|
|
|
199
204
|
export async function initTriggerDispatcher(deps) {
|
|
200
205
|
_deps = deps;
|
|
201
206
|
resetTriggerQueueWorkerBackoff();
|
|
207
|
+
_triggerQueueStopping = false;
|
|
202
208
|
// Init runs in an un-awaited Nitro plugin, so on a serverless request
|
|
203
209
|
// function any query here outlives the response and the frozen instance
|
|
204
210
|
// thaws into a timeout. Automations load on the first emitted event instead.
|
|
@@ -220,7 +226,7 @@ function startTriggerQueueWorker() {
|
|
|
220
226
|
return;
|
|
221
227
|
}
|
|
222
228
|
_triggerQueueWorkerStarted = true;
|
|
223
|
-
startIntervalJob(async (signal) => {
|
|
229
|
+
_triggerQueueWorker = startIntervalJob(async (signal) => {
|
|
224
230
|
const deps = _deps;
|
|
225
231
|
if (!deps || signal.aborted)
|
|
226
232
|
return;
|
|
@@ -231,8 +237,24 @@ function startTriggerQueueWorker() {
|
|
|
231
237
|
leading: true,
|
|
232
238
|
onError: (error) => console.error("[triggers] Event queue recovery scan failed:", error),
|
|
233
239
|
});
|
|
240
|
+
registerBackgroundJobStop(stopTriggerQueueWorker);
|
|
241
|
+
}
|
|
242
|
+
export async function stopTriggerQueueWorker() {
|
|
243
|
+
// Stays set until initTriggerDispatcher runs again: other jobs may still be
|
|
244
|
+
// stopping, and an event that lands meanwhile must not start a new drain.
|
|
245
|
+
_triggerQueueStopping = true;
|
|
246
|
+
const worker = _triggerQueueWorker;
|
|
247
|
+
_triggerQueueWorker = null;
|
|
248
|
+
_triggerQueueWorkerStarted = false;
|
|
249
|
+
if (worker)
|
|
250
|
+
await worker.stop();
|
|
251
|
+
const drains = [..._drainingTriggers.values()];
|
|
252
|
+
if (drains.length > 0)
|
|
253
|
+
await Promise.allSettled(drains);
|
|
234
254
|
}
|
|
235
255
|
async function drainReadyTriggerQueue(context) {
|
|
256
|
+
if (_triggerQueueStopping)
|
|
257
|
+
return;
|
|
236
258
|
if (_triggerQueueResumeAt > Date.now())
|
|
237
259
|
return;
|
|
238
260
|
const deps = _deps;
|
|
@@ -742,6 +764,8 @@ function startTriggerDrain(triggerId, options) {
|
|
|
742
764
|
const existing = _drainingTriggers.get(triggerId);
|
|
743
765
|
if (existing)
|
|
744
766
|
return options?.skipExisting ? Promise.resolve(false) : existing;
|
|
767
|
+
if (_triggerQueueStopping)
|
|
768
|
+
return Promise.resolve(false);
|
|
745
769
|
let localStaleExpiredCount = 0;
|
|
746
770
|
const onStaleEventExpired = options?.onStaleEventExpired ?? (() => (localStaleExpiredCount += 1));
|
|
747
771
|
const drain = drainTriggerQueue(triggerId, options?.maxEvents, options?.expireStaleMailEvents, options?.deadline, options?.onEventClaimed, options?.onEventOutcome, onStaleEventExpired, options?.queueQueryTimeoutMs).finally(() => {
|
|
@@ -766,6 +790,8 @@ async function drainTriggerQueue(triggerId, maxEvents = Number.POSITIVE_INFINITY
|
|
|
766
790
|
(queueQueryTimeoutMs !== undefined &&
|
|
767
791
|
Date.now() + queueQueryTimeoutMs < deadline);
|
|
768
792
|
while (processedEvents < maxEvents) {
|
|
793
|
+
if (_triggerQueueStopping)
|
|
794
|
+
return processedEvents > 0;
|
|
769
795
|
if (deadline !== undefined &&
|
|
770
796
|
Date.now() +
|
|
771
797
|
DURABLE_TRIGGER_RUN_CLEANUP_RESERVE_MS +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.220.
|
|
3
|
+
"version": "0.220.1-nightly-20261024183236",
|
|
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": {
|
|
@@ -730,7 +730,7 @@
|
|
|
730
730
|
"yaml": "^2.9.0",
|
|
731
731
|
"yjs": "^13.6.33",
|
|
732
732
|
"zod": "^4.3.6",
|
|
733
|
-
"@agent-native/agentkit": "^0.220.
|
|
733
|
+
"@agent-native/agentkit": "^0.220.1-nightly-20261024183236",
|
|
734
734
|
"@agent-native/recap-cli": "^0.5.89"
|
|
735
735
|
},
|
|
736
736
|
"devDependencies": {
|
|
@@ -801,7 +801,7 @@
|
|
|
801
801
|
"xlsx": "^0.18.5"
|
|
802
802
|
},
|
|
803
803
|
"peerDependencies": {
|
|
804
|
-
"@agent-native/core-corpus": "
|
|
804
|
+
"@agent-native/core-corpus": "0.220.1-nightly-20261024183236",
|
|
805
805
|
"@ai-sdk/anthropic": ">=3",
|
|
806
806
|
"@ai-sdk/cohere": ">=3",
|
|
807
807
|
"@ai-sdk/google": ">=3",
|