@agent-native/core 0.203.1-nightly-20261007183952 → 0.203.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/dist/agent/default-agent-engine.d.ts +1 -1
- package/dist/agent/default-agent-engine.js +1 -1
- package/dist/agent/engine-status.d.ts +49 -0
- package/dist/agent/engine-status.js +112 -0
- package/dist/client/client-status-requests.js +8 -0
- package/dist/collab/routes.d.ts +2 -2
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/jobs/frontmatter-loss.d.ts +17 -0
- package/dist/jobs/frontmatter-loss.js +62 -0
- package/dist/jobs/frontmatter.d.ts +7 -0
- package/dist/jobs/frontmatter.js +39 -0
- package/dist/jobs/tools.js +16 -3
- package/dist/localization/default-model-messages.d.ts +11 -0
- package/dist/localization/default-model-messages.js +88 -0
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +4 -4
- package/dist/org/handlers.d.ts +2 -2
- package/dist/org/index.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 +8 -8
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/resources/store.js +40 -2
- package/dist/scripts/agent-engines/list-agent-engines.js +8 -5
- package/dist/scripts/agent-engines/manage-agent-engine.js +22 -4
- package/dist/scripts/agent-engines/set-agent-engine.d.ts +25 -0
- package/dist/scripts/agent-engines/set-agent-engine.js +94 -8
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/agent-engine-default-model-route.d.ts +1 -1
- package/dist/server/agent-engine-ollama-models-route.d.ts +2 -2
- package/dist/server/core-routes-plugin.d.ts +1 -43
- package/dist/server/core-routes-plugin.js +15 -92
- package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +16 -1
- package/package.json +4 -4
- package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +16 -1
|
@@ -2,13 +2,15 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { assertBodySize, defineEventHandler, setResponseStatus, setResponseHeader, getMethod, getHeader, getRequestURL, getRequestIP, readRawBody, getCookie, setCookie, deleteCookie, } from "h3";
|
|
3
3
|
import { readMultipartFormData } from "h3";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
+
import { readAgentAppModelDefaultSettings, normalizeAgentAppModelDefaultAppId, } from "../agent/app-model-defaults.js";
|
|
5
6
|
import { CHATGPT_SUBSCRIPTION_CALLBACK_PATH } from "../agent/chatgpt-subscription-contract.js";
|
|
6
7
|
import { readDefaultAgentEngineSetting } from "../agent/default-agent-engine.js";
|
|
7
|
-
import {
|
|
8
|
+
import { resolveAgentEngineStatus, } from "../agent/engine-status.js";
|
|
8
9
|
import { registerBuiltinEngines } from "../agent/engine/builtin.js";
|
|
9
10
|
import { OPENAI_BASE_URL_ENV_VAR, PROVIDER_ENV_META, } from "../agent/engine/provider-env-vars.js";
|
|
10
|
-
import {
|
|
11
|
+
import { detectEngineFromEnv, detectEngineFromUserSecrets, isStoredEngineUsableForRequest, } from "../agent/engine/registry.js";
|
|
11
12
|
import { canUpdateAgentLoopSettings, readAgentLoopSettings, resetAgentLoopSettings, validateMaxIterationsInput, writeAgentLoopSettings, } from "../agent/loop-settings.js";
|
|
13
|
+
export { normalizeAgentEngineStatusModel, resolveAgentEngineStatus, } from "../agent/engine-status.js";
|
|
12
14
|
import { getAppConfig } from "../app-config/index.js";
|
|
13
15
|
import { getState, putState, compareAndSetState, deleteState, listComposeDrafts, getComposeDraft, putComposeDraft, deleteComposeDraft, deleteAllComposeDrafts, getStateMany, APP_STATE_ANONYMOUS_OWNER_CONTEXT_KEY, } from "../application-state/handlers.js";
|
|
14
16
|
import { recordOrgAdminAuditEvent } from "../audit/org-admin.js";
|
|
@@ -86,7 +88,7 @@ import { createPollEventsHandler, validateSseMaxDurationMs, } from "./poll-event
|
|
|
86
88
|
import { createPollHandler } from "./poll.js";
|
|
87
89
|
import { isHostedRealtimeTransport, realtimeRegistrationUnavailable, } from "./realtime-registration.js";
|
|
88
90
|
import { createRealtimeTokenHandler, resolveActiveRealtimeChannel, } from "./realtime-token.js";
|
|
89
|
-
import { getRequestContext, hasRequestContext, runWithRequestContext, } from "./request-context.js";
|
|
91
|
+
import { getRequestContext, getRequestOrgId, getRequestUserEmail, hasRequestContext, runWithRequestContext, } from "./request-context.js";
|
|
90
92
|
import { isSameOriginRequest } from "./request-origin.js";
|
|
91
93
|
import { findUnsupportedScopedKeyNames, saveKeyValuesToScopedSecrets, ScopedKeyStorageError, } from "./scoped-key-storage.js";
|
|
92
94
|
import { createSpeakHandler } from "./speak.js";
|
|
@@ -103,97 +105,18 @@ import { createWorkspaceProviderOAuthHandler } from "./workspace-provider-oauth.
|
|
|
103
105
|
export const FRAMEWORK_ROUTE_PREFIX = "/_agent-native";
|
|
104
106
|
export const FRAMEWORK_EVENTS_ROUTE = `${FRAMEWORK_ROUTE_PREFIX}/events`;
|
|
105
107
|
export const LEGACY_FRAMEWORK_EVENTS_ROUTE = `${FRAMEWORK_ROUTE_PREFIX}/poll-events`;
|
|
106
|
-
export function normalizeAgentEngineStatusModel(entry, model) {
|
|
107
|
-
if (!entry)
|
|
108
|
-
return model ?? DEFAULT_MODEL;
|
|
109
|
-
return normalizeModelForEngine(entry, model ?? entry.defaultModel);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Resolve "does this request have a usable AI provider" for one identity.
|
|
113
|
-
*
|
|
114
|
-
* Every call site pays for these lookups on a user-visible path (the agent
|
|
115
|
-
* composer blocks on the status probe), so the two identity-independent reads
|
|
116
|
-
* start together and the expensive `app_secrets` sweep only runs when the
|
|
117
|
-
* cheaper sources have not already answered.
|
|
118
|
-
*/
|
|
119
|
-
export async function resolveAgentEngineStatus(deps) {
|
|
120
|
-
const lookupEntry = (deps.lookupEntry ?? getAgentEngineEntry);
|
|
121
|
-
const [stored, openAiBaseUrlConfigured] = await Promise.all([
|
|
122
|
-
deps.readStoredEngine(),
|
|
123
|
-
deps.readOpenAiBaseUrlConfigured(),
|
|
124
|
-
]);
|
|
125
|
-
if (isAgentEngineSettingConfigured(stored)) {
|
|
126
|
-
const engine = stored.engine;
|
|
127
|
-
const entry = lookupEntry(engine);
|
|
128
|
-
return {
|
|
129
|
-
configured: true,
|
|
130
|
-
engine,
|
|
131
|
-
model: normalizeAgentEngineStatusModel(entry, stored?.model),
|
|
132
|
-
source: "settings",
|
|
133
|
-
openAiBaseUrlConfigured,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
const configuredEngine = getAppConfig().agent.engine;
|
|
137
|
-
const envEntry = configuredEngine ? lookupEntry(configuredEngine) : undefined;
|
|
138
|
-
if (envEntry) {
|
|
139
|
-
if (await deps.isStoredEngineUsable({ engine: envEntry.name }, envEntry)) {
|
|
140
|
-
return {
|
|
141
|
-
configured: true,
|
|
142
|
-
engine: envEntry.name,
|
|
143
|
-
model: envEntry.defaultModel ?? DEFAULT_MODEL,
|
|
144
|
-
source: "env",
|
|
145
|
-
envVar: "AGENT_ENGINE",
|
|
146
|
-
openAiBaseUrlConfigured,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
if (getRequestContext()?.isSyntheticTraffic !== true) {
|
|
150
|
-
return { configured: false, openAiBaseUrlConfigured };
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
// Stored provider selections win over an existing Builder connection, so
|
|
154
|
-
// this is checked before the app_secrets sweep — and the sweep is skipped
|
|
155
|
-
// entirely when it answers.
|
|
156
|
-
if (stored && typeof stored.engine === "string") {
|
|
157
|
-
const entry = lookupEntry(stored.engine);
|
|
158
|
-
if (entry && (await deps.isStoredEngineUsable(stored, entry))) {
|
|
159
|
-
return {
|
|
160
|
-
configured: true,
|
|
161
|
-
engine: stored.engine,
|
|
162
|
-
model: normalizeAgentEngineStatusModel(entry, stored.model),
|
|
163
|
-
source: "env",
|
|
164
|
-
envVar: entry.requiredEnvVars[0],
|
|
165
|
-
openAiBaseUrlConfigured,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
// Per-user app_secrets — a user who connected Builder (or pasted their own
|
|
170
|
-
// provider key) may not have any deploy-level env vars set.
|
|
171
|
-
const detectedFromUser = await deps.detectFromUserSecrets();
|
|
172
|
-
if (detectedFromUser) {
|
|
173
|
-
return {
|
|
174
|
-
configured: true,
|
|
175
|
-
engine: detectedFromUser.name,
|
|
176
|
-
model: detectedFromUser.defaultModel ?? DEFAULT_MODEL,
|
|
177
|
-
source: "app_secrets",
|
|
178
|
-
envVar: detectedFromUser.requiredEnvVars[0],
|
|
179
|
-
openAiBaseUrlConfigured,
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
const detected = await deps.detectFromEnv();
|
|
183
|
-
if (detected) {
|
|
184
|
-
return {
|
|
185
|
-
configured: true,
|
|
186
|
-
engine: detected.name,
|
|
187
|
-
model: detected.defaultModel ?? DEFAULT_MODEL,
|
|
188
|
-
source: "env",
|
|
189
|
-
envVar: detected.requiredEnvVars[0],
|
|
190
|
-
openAiBaseUrlConfigured,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
return { configured: false, openAiBaseUrlConfigured };
|
|
194
|
-
}
|
|
195
108
|
function requestAgentEngineStatusDeps() {
|
|
196
109
|
return {
|
|
110
|
+
readAppDefault: async () => {
|
|
111
|
+
const app = getAppConfig().app;
|
|
112
|
+
const appId = normalizeAgentAppModelDefaultAppId(app.id ?? app.template ?? app.slug);
|
|
113
|
+
if (!appId)
|
|
114
|
+
return null;
|
|
115
|
+
const settings = await readAgentAppModelDefaultSettings({ userEmail: getRequestUserEmail(), orgId: getRequestOrgId() }, appId);
|
|
116
|
+
return settings.engine && settings.model
|
|
117
|
+
? { engine: settings.engine, model: settings.model }
|
|
118
|
+
: null;
|
|
119
|
+
},
|
|
197
120
|
readStoredEngine: async () => (await readDefaultAgentEngineSetting()),
|
|
198
121
|
readOpenAiBaseUrlConfigured: async () => {
|
|
199
122
|
try {
|
|
@@ -46,10 +46,25 @@ and pass normalized action items to an app's idempotent `import` action.
|
|
|
46
46
|
|
|
47
47
|
| Tool | Action | Purpose |
|
|
48
48
|
| ------------- | ---------- | ---------------------------------------------------------- |
|
|
49
|
-
| `manage-jobs` | `create` | Create a recurring job (name, cron schedule, instructions) |
|
|
49
|
+
| `manage-jobs` | `create` | Create a recurring job (name, cron schedule, instructions); fails if the name exists |
|
|
50
50
|
| `manage-jobs` | `list` | List all jobs and their status |
|
|
51
51
|
| `manage-jobs` | `update` | Update schedule, instructions, or toggle enabled |
|
|
52
52
|
|
|
53
|
+
## Job files an app owns
|
|
54
|
+
|
|
55
|
+
`create` never replaces an existing job file, so a name that collides with an
|
|
56
|
+
app's file (Factory's `factories/<id>/<name>`) is refused instead of reset.
|
|
57
|
+
An app that stores its own settings in a job's frontmatter marks the file with
|
|
58
|
+
`triggerType`, which makes `list`, `update`, and `delete` skip it and sends the
|
|
59
|
+
caller to `manage-automations`. Edit those files only through the owning app's
|
|
60
|
+
actions, and patch fields in place; rebuilding a file from the fields the writer
|
|
61
|
+
knows drops the rest while the job keeps running.
|
|
62
|
+
|
|
63
|
+
Any write to a `jobs/` file that removes a frontmatter field other than run
|
|
64
|
+
bookkeeping is recorded as a `job-fields-dropped` audit event (org admins read
|
|
65
|
+
it with `list-audit-events` and `action: "job-fields-dropped"`). Its input names
|
|
66
|
+
the writer, the dropped fields, and the agent thread and run that made it.
|
|
67
|
+
|
|
53
68
|
## UI Surface
|
|
54
69
|
|
|
55
70
|
`/agent#jobs` is the stable compatibility URL for the Agent page's
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.203.1
|
|
3
|
+
"version": "0.203.1",
|
|
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": {
|
|
@@ -682,8 +682,8 @@
|
|
|
682
682
|
"yaml": "^2.9.0",
|
|
683
683
|
"yjs": "^13.6.33",
|
|
684
684
|
"zod": "^4.3.6",
|
|
685
|
-
"@agent-native/agentkit": "^0.203.1
|
|
686
|
-
"@agent-native/recap-cli": "^0.5.
|
|
685
|
+
"@agent-native/agentkit": "^0.203.1",
|
|
686
|
+
"@agent-native/recap-cli": "^0.5.65"
|
|
687
687
|
},
|
|
688
688
|
"devDependencies": {
|
|
689
689
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
@@ -753,7 +753,7 @@
|
|
|
753
753
|
"xlsx": "^0.18.5"
|
|
754
754
|
},
|
|
755
755
|
"peerDependencies": {
|
|
756
|
-
"@agent-native/core-corpus": "0.
|
|
756
|
+
"@agent-native/core-corpus": ">=0.196.0",
|
|
757
757
|
"@ai-sdk/anthropic": ">=3",
|
|
758
758
|
"@ai-sdk/cohere": ">=3",
|
|
759
759
|
"@ai-sdk/google": ">=3",
|
|
@@ -46,10 +46,25 @@ and pass normalized action items to an app's idempotent `import` action.
|
|
|
46
46
|
|
|
47
47
|
| Tool | Action | Purpose |
|
|
48
48
|
| ------------- | ---------- | ---------------------------------------------------------- |
|
|
49
|
-
| `manage-jobs` | `create` | Create a recurring job (name, cron schedule, instructions) |
|
|
49
|
+
| `manage-jobs` | `create` | Create a recurring job (name, cron schedule, instructions); fails if the name exists |
|
|
50
50
|
| `manage-jobs` | `list` | List all jobs and their status |
|
|
51
51
|
| `manage-jobs` | `update` | Update schedule, instructions, or toggle enabled |
|
|
52
52
|
|
|
53
|
+
## Job files an app owns
|
|
54
|
+
|
|
55
|
+
`create` never replaces an existing job file, so a name that collides with an
|
|
56
|
+
app's file (Factory's `factories/<id>/<name>`) is refused instead of reset.
|
|
57
|
+
An app that stores its own settings in a job's frontmatter marks the file with
|
|
58
|
+
`triggerType`, which makes `list`, `update`, and `delete` skip it and sends the
|
|
59
|
+
caller to `manage-automations`. Edit those files only through the owning app's
|
|
60
|
+
actions, and patch fields in place; rebuilding a file from the fields the writer
|
|
61
|
+
knows drops the rest while the job keeps running.
|
|
62
|
+
|
|
63
|
+
Any write to a `jobs/` file that removes a frontmatter field other than run
|
|
64
|
+
bookkeeping is recorded as a `job-fields-dropped` audit event (org admins read
|
|
65
|
+
it with `list-audit-events` and `action: "job-fields-dropped"`). Its input names
|
|
66
|
+
the writer, the dropped fields, and the agent thread and run that made it.
|
|
67
|
+
|
|
53
68
|
## UI Surface
|
|
54
69
|
|
|
55
70
|
`/agent#jobs` is the stable compatibility URL for the Agent page's
|