@agent-native/core 0.161.22 → 0.161.23
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/design/app/components/design/keyboard-shortcuts.ts +13 -7
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +18 -21
- package/corpus/templates/design/app/pages/design-editor/editor-state.ts +2 -5
- package/corpus/templates/design/app/pages/design-editor/tool-state.ts +4 -12
- package/corpus/templates/design/app/pages/design-editor/types.ts +38 -1
- package/corpus/templates/design/changelog/2026-08-18-advanced-design-editor-panels-hidden-by-default.md +6 -0
- package/corpus/templates/design/playwright.config.ts +19 -2
- package/dist/agent/engine/builder-engine.js +15 -8
- package/dist/agent/production-agent.d.ts +15 -0
- package/dist/agent/production-agent.js +32 -9
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-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/secrets/routes.d.ts +9 -9
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/package.json +1 -1
package/corpus/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { UseDesignHotkeysProps } from "@/hooks/useDesignHotkeys";
|
|
2
|
+
import { SHOW_DESIGN_SECONDARY_LEFT_PANELS } from "@/pages/design-editor/types";
|
|
2
3
|
|
|
3
4
|
export const DESIGN_SHORTCUT_CATEGORIES = [
|
|
4
5
|
"essential",
|
|
@@ -136,13 +137,18 @@ export const DESIGN_SHORTCUTS: readonly DesignShortcutDefinition[] = [
|
|
|
136
137
|
labelKey: "designEditor.keyboardShortcuts.commands.showLayers",
|
|
137
138
|
handler: "onShowLayersPanel",
|
|
138
139
|
}),
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
...(SHOW_DESIGN_SECONDARY_LEFT_PANELS
|
|
141
|
+
? [
|
|
142
|
+
shortcut({
|
|
143
|
+
id: "show-assets",
|
|
144
|
+
category: "view" as const,
|
|
145
|
+
bindings: ["alt+2"],
|
|
146
|
+
labelKey:
|
|
147
|
+
"designEditor.keyboardShortcuts.commands.showAssets" as const,
|
|
148
|
+
handler: "onShowAssetsPanel" as const,
|
|
149
|
+
}),
|
|
150
|
+
]
|
|
151
|
+
: []),
|
|
146
152
|
shortcut({
|
|
147
153
|
id: "toggle-ui",
|
|
148
154
|
category: "view",
|
|
@@ -6,6 +6,8 @@ import { useAgentRouteState } from "@agent-native/core/client/navigation";
|
|
|
6
6
|
import { useEffect } from "react";
|
|
7
7
|
import { useLocation, useParams } from "react-router";
|
|
8
8
|
|
|
9
|
+
import { normalizeDesignLeftPanel } from "@/pages/design-editor/tool-state";
|
|
10
|
+
|
|
9
11
|
export interface NavigationState {
|
|
10
12
|
view: string;
|
|
11
13
|
designId?: string;
|
|
@@ -120,12 +122,11 @@ function normalizeEditorView(
|
|
|
120
122
|
|
|
121
123
|
function normalizeInspectorTab(
|
|
122
124
|
value: unknown,
|
|
123
|
-
): "design" | "comments" | "tweaks" | "code" |
|
|
125
|
+
): "design" | "comments" | "tweaks" | "code" | undefined {
|
|
124
126
|
return value === "design" ||
|
|
125
127
|
value === "comments" ||
|
|
126
128
|
value === "tweaks" ||
|
|
127
|
-
value === "code"
|
|
128
|
-
value === "extensions"
|
|
129
|
+
value === "code"
|
|
129
130
|
? value
|
|
130
131
|
: undefined;
|
|
131
132
|
}
|
|
@@ -141,16 +142,7 @@ function normalizeLeftPanel(
|
|
|
141
142
|
| "import"
|
|
142
143
|
| "code"
|
|
143
144
|
| undefined {
|
|
144
|
-
|
|
145
|
-
return value === "file" ||
|
|
146
|
-
value === "agent" ||
|
|
147
|
-
value === "assets" ||
|
|
148
|
-
value === "tools" ||
|
|
149
|
-
value === "tokens" ||
|
|
150
|
-
value === "import" ||
|
|
151
|
-
value === "code"
|
|
152
|
-
? value
|
|
153
|
-
: undefined;
|
|
145
|
+
return normalizeDesignLeftPanel(value);
|
|
154
146
|
}
|
|
155
147
|
|
|
156
148
|
function normalizeEditorMode(
|
|
@@ -176,9 +168,12 @@ export function editorPathFromCommand(cmd: NavigationState): string | null {
|
|
|
176
168
|
const editorView = normalizeEditorView(cmd.editorView);
|
|
177
169
|
if (editorView) params.set("view", editorView);
|
|
178
170
|
if (editorView === "single") params.set("mode", cmd.mode ?? "interact");
|
|
179
|
-
const
|
|
171
|
+
const rawInspectorTab = cmd.inspectorTab ?? cmd.inspector;
|
|
172
|
+
const inspectorTab = normalizeInspectorTab(rawInspectorTab);
|
|
180
173
|
if (inspectorTab) params.set("inspector", inspectorTab);
|
|
181
|
-
const leftPanel = normalizeLeftPanel(
|
|
174
|
+
const leftPanel = normalizeLeftPanel(
|
|
175
|
+
cmd.leftPanel ?? cmd.panel ?? rawInspectorTab,
|
|
176
|
+
);
|
|
182
177
|
if (leftPanel) params.set("panel", leftPanel);
|
|
183
178
|
const screen = cmd.fileId ?? cmd.screenId ?? cmd.filename ?? cmd.screen;
|
|
184
179
|
if (screen) params.set("screen", screen);
|
|
@@ -201,10 +196,11 @@ export function editorCommandFromNavigate(
|
|
|
201
196
|
): DesignEditorCommand | null {
|
|
202
197
|
if (cmd.view !== "editor" || !cmd.designId) return null;
|
|
203
198
|
const editorView = normalizeEditorView(cmd.editorView);
|
|
204
|
-
const
|
|
199
|
+
const rawInspectorTab = cmd.inspectorTab ?? cmd.inspector;
|
|
200
|
+
const inspectorTab = normalizeInspectorTab(rawInspectorTab);
|
|
205
201
|
const leftPanel =
|
|
206
202
|
normalizeLeftPanel(cmd.leftPanel ?? cmd.panel) ??
|
|
207
|
-
normalizeLeftPanel(
|
|
203
|
+
normalizeLeftPanel(rawInspectorTab);
|
|
208
204
|
const command: DesignEditorCommand = {
|
|
209
205
|
designId: cmd.designId,
|
|
210
206
|
issuedAt: Date.now(),
|
|
@@ -255,11 +251,12 @@ export function useNavigationState(enabled = true) {
|
|
|
255
251
|
if (editorView) state.editorView = editorView;
|
|
256
252
|
const mode = normalizeEditorMode(searchParams.get("mode"));
|
|
257
253
|
if (mode) state.mode = mode;
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
);
|
|
254
|
+
const rawInspectorTab = searchParams.get("inspector");
|
|
255
|
+
const inspectorTab = normalizeInspectorTab(rawInspectorTab);
|
|
261
256
|
if (inspectorTab) state.inspectorTab = inspectorTab;
|
|
262
|
-
const leftPanel = normalizeLeftPanel(
|
|
257
|
+
const leftPanel = normalizeLeftPanel(
|
|
258
|
+
searchParams.get("panel") ?? rawInspectorTab,
|
|
259
|
+
);
|
|
263
260
|
if (leftPanel) state.leftPanel = leftPanel;
|
|
264
261
|
const screen = searchParams.get("screen");
|
|
265
262
|
if (screen) state.screen = screen;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isStandaloneHttpUrl } from "@shared/html-content";
|
|
2
2
|
|
|
3
|
+
import { normalizeDesignLeftPanel } from "./tool-state";
|
|
3
4
|
import {
|
|
4
5
|
type DesignFile,
|
|
5
6
|
type DesignLeftPanel,
|
|
6
7
|
type DesignTool,
|
|
7
8
|
type EditorMode,
|
|
8
|
-
SHOW_DESIGN_CODE_LEFT_PANEL,
|
|
9
9
|
} from "./types";
|
|
10
10
|
|
|
11
11
|
// Definition moved to shared/ so the server write path and code-layer's
|
|
@@ -127,10 +127,7 @@ export function getDesignEditorStateUrlSearch(args: {
|
|
|
127
127
|
mode?: EditorMode | null;
|
|
128
128
|
}) {
|
|
129
129
|
const params = new URLSearchParams(args.currentSearch);
|
|
130
|
-
const leftPanel =
|
|
131
|
-
args.leftPanel === "code" && !SHOW_DESIGN_CODE_LEFT_PANEL
|
|
132
|
-
? null
|
|
133
|
-
: args.leftPanel;
|
|
130
|
+
const leftPanel = normalizeDesignLeftPanel(args.leftPanel) ?? null;
|
|
134
131
|
params.set("view", args.viewMode);
|
|
135
132
|
if (leftPanel && leftPanel !== "file") {
|
|
136
133
|
params.set("panel", leftPanel);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CreationTool } from "@/components/design/design-canvas/creation";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
isDesignLeftPanelEnabled,
|
|
5
5
|
type DesignLeftPanel,
|
|
6
6
|
type DesignTool,
|
|
7
7
|
type EditorMode,
|
|
@@ -10,18 +10,10 @@ import {
|
|
|
10
10
|
export function normalizeDesignLeftPanel(
|
|
11
11
|
value: unknown,
|
|
12
12
|
): DesignLeftPanel | undefined {
|
|
13
|
-
if (value === "extensions")
|
|
14
|
-
|
|
15
|
-
return SHOW_DESIGN_CODE_LEFT_PANEL ? "code" : undefined;
|
|
13
|
+
if (value === "extensions") {
|
|
14
|
+
return isDesignLeftPanelEnabled("tools") ? "tools" : undefined;
|
|
16
15
|
}
|
|
17
|
-
return value
|
|
18
|
-
value === "agent" ||
|
|
19
|
-
value === "assets" ||
|
|
20
|
-
value === "tools" ||
|
|
21
|
-
value === "tokens" ||
|
|
22
|
-
value === "import"
|
|
23
|
-
? value
|
|
24
|
-
: undefined;
|
|
16
|
+
return isDesignLeftPanelEnabled(value) ? value : undefined;
|
|
25
17
|
}
|
|
26
18
|
|
|
27
19
|
export const MOVE_GROUP_TOOL_PRESENTATIONS = {
|
|
@@ -33,7 +33,44 @@ export type DesignLeftPanel =
|
|
|
33
33
|
| "import"
|
|
34
34
|
| "code";
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Keep the still-evolving Design editor side panels out of the default
|
|
38
|
+
* surface until their Figma parity work is ready. Flip this switch to expose
|
|
39
|
+
* Assets, Tools, Tokens, and Code together while iterating on them. The E2E
|
|
40
|
+
* harness sets the Vite flag so those existing advanced-surface tests keep
|
|
41
|
+
* exercising the gated panels.
|
|
42
|
+
*/
|
|
43
|
+
const designSecondaryLeftPanelsSetting =
|
|
44
|
+
typeof import.meta !== "undefined"
|
|
45
|
+
? (import.meta as { env?: Record<string, string> }).env
|
|
46
|
+
?.VITE_SHOW_DESIGN_SECONDARY_LEFT_PANELS
|
|
47
|
+
: undefined;
|
|
48
|
+
export const SHOW_DESIGN_SECONDARY_LEFT_PANELS =
|
|
49
|
+
designSecondaryLeftPanelsSetting === "1" ||
|
|
50
|
+
designSecondaryLeftPanelsSetting === "true";
|
|
51
|
+
export const SHOW_DESIGN_CODE_LEFT_PANEL = SHOW_DESIGN_SECONDARY_LEFT_PANELS;
|
|
52
|
+
|
|
53
|
+
export function isDesignLeftPanelEnabled(
|
|
54
|
+
value: unknown,
|
|
55
|
+
): value is DesignLeftPanel {
|
|
56
|
+
if (
|
|
57
|
+
value !== "file" &&
|
|
58
|
+
value !== "agent" &&
|
|
59
|
+
value !== "assets" &&
|
|
60
|
+
value !== "tools" &&
|
|
61
|
+
value !== "tokens" &&
|
|
62
|
+
value !== "import" &&
|
|
63
|
+
value !== "code"
|
|
64
|
+
) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (value === "code") return SHOW_DESIGN_CODE_LEFT_PANEL;
|
|
69
|
+
if (value === "assets" || value === "tools" || value === "tokens") {
|
|
70
|
+
return SHOW_DESIGN_SECONDARY_LEFT_PANELS;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
37
74
|
|
|
38
75
|
/** Zoom percentage applied when entering single-screen (focused) editor mode. */
|
|
39
76
|
export const FOCUSED_SCREEN_ZOOM = 100;
|
|
@@ -22,9 +22,24 @@ const E2E_DATABASE_URL =
|
|
|
22
22
|
process.env.E2E_DATABASE_URL ??
|
|
23
23
|
`file:${path.join(import.meta.dirname, "data", "e2e.db")}`;
|
|
24
24
|
const BROWSER_CHANNEL = process.env.E2E_BROWSER_CHANNEL;
|
|
25
|
+
const SHOW_SECONDARY_PANELS_IN_E2E =
|
|
26
|
+
process.env.E2E_SHOW_DESIGN_SECONDARY_LEFT_PANELS !== "0";
|
|
27
|
+
const SECONDARY_PANELS_ENV = SHOW_SECONDARY_PANELS_IN_E2E
|
|
28
|
+
? "VITE_SHOW_DESIGN_SECONDARY_LEFT_PANELS=1 "
|
|
29
|
+
: "VITE_SHOW_DESIGN_SECONDARY_LEFT_PANELS=0 ";
|
|
30
|
+
const ADVANCED_PANEL_SPEC_FILES = [
|
|
31
|
+
/canvas-tools\.spec\.ts$/,
|
|
32
|
+
/code-native-deep-surfaces\.spec\.ts$/,
|
|
33
|
+
/code-native-pr-surfaces\.spec\.ts$/,
|
|
34
|
+
/code-workbench-local-files\.spec\.ts$/,
|
|
35
|
+
];
|
|
25
36
|
|
|
26
37
|
export default defineConfig({
|
|
27
38
|
testDir: "./e2e",
|
|
39
|
+
// These suites intentionally exercise panels that are not mounted in the
|
|
40
|
+
// disabled profile. Ignoring them keeps that profile focused on verifying
|
|
41
|
+
// the hidden-panel contract without failing on missing advanced controls.
|
|
42
|
+
testIgnore: SHOW_SECONDARY_PANELS_IN_E2E ? [] : ADVANCED_PANEL_SPEC_FILES,
|
|
28
43
|
// The editor is heavy (iframe bridge + polling); give generous budgets.
|
|
29
44
|
timeout: 90_000,
|
|
30
45
|
expect: { timeout: 15_000 },
|
|
@@ -56,9 +71,11 @@ export default defineConfig({
|
|
|
56
71
|
// generic DATABASE_URL, but set both to an absolute SQLite URL so a
|
|
57
72
|
// `.env` Postgres URL or a changed command cwd can never override this
|
|
58
73
|
// throwaway local db.
|
|
59
|
-
command: `APP_NAME=design DESIGN_DATABASE_URL=${JSON.stringify(E2E_DATABASE_URL)} DATABASE_URL=${JSON.stringify(E2E_DATABASE_URL)} PORT=${PORT} corepack pnpm dev`,
|
|
74
|
+
command: `APP_NAME=design ${SECONDARY_PANELS_ENV}DESIGN_DATABASE_URL=${JSON.stringify(E2E_DATABASE_URL)} DATABASE_URL=${JSON.stringify(E2E_DATABASE_URL)} PORT=${PORT} corepack pnpm dev`,
|
|
60
75
|
url: BASE_URL,
|
|
61
|
-
|
|
76
|
+
// The panel flag is compiled into the Vite bundle. Reusing a local
|
|
77
|
+
// server can therefore run this profile with the opposite setting.
|
|
78
|
+
reuseExistingServer: false,
|
|
62
79
|
// Cold Vite dep-optimization on first boot can exceed two minutes.
|
|
63
80
|
timeout: 300_000,
|
|
64
81
|
stdout: "ignore",
|
|
@@ -138,10 +138,17 @@ class BuilderEngine {
|
|
|
138
138
|
}, creditsLane);
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
|
+
// The Builder gateway has an "auto" fallback mode, but Agent Native owns
|
|
142
|
+
// model selection. Always send a concrete model so the gateway cannot
|
|
143
|
+
// select an organization-level override or another fallback model.
|
|
144
|
+
const requestedModel = opts.model.trim();
|
|
145
|
+
const model = requestedModel.length === 0 || requestedModel === "auto"
|
|
146
|
+
? BUILDER_DEFAULT_MODEL
|
|
147
|
+
: requestedModel;
|
|
141
148
|
const messages = engineMessagesToBuilderGatewayAnthropic(opts.messages);
|
|
142
149
|
const tools = engineToolsToAnthropic(opts.tools);
|
|
143
150
|
const thinkingBudget = opts.providerOptions?.anthropic?.thinking?.budgetTokens;
|
|
144
|
-
const reasoningEffort = normalizeReasoningEffortForModel(
|
|
151
|
+
const reasoningEffort = normalizeReasoningEffortForModel(model, opts.reasoningEffort ??
|
|
145
152
|
(typeof thinkingBudget === "number"
|
|
146
153
|
? mapReasoningEffort(thinkingBudget)
|
|
147
154
|
: undefined));
|
|
@@ -200,13 +207,13 @@ class BuilderEngine {
|
|
|
200
207
|
}
|
|
201
208
|
}
|
|
202
209
|
}
|
|
203
|
-
const gptToolsRequireExplicitNoReasoning = cachedTools.length > 0 && isGPTReasoningModel(
|
|
210
|
+
const gptToolsRequireExplicitNoReasoning = cachedTools.length > 0 && isGPTReasoningModel(model);
|
|
204
211
|
const body = {
|
|
205
|
-
model
|
|
212
|
+
model,
|
|
206
213
|
messages: cachedMessages,
|
|
207
214
|
...(systemValue !== undefined ? { system: systemValue } : {}),
|
|
208
215
|
...(cachedTools.length > 0 ? { tools: cachedTools } : {}),
|
|
209
|
-
max_tokens: resolveMaxOutputTokensForEngine(this.name, opts.maxOutputTokens,
|
|
216
|
+
max_tokens: resolveMaxOutputTokensForEngine(this.name, opts.maxOutputTokens, model),
|
|
210
217
|
...(typeof opts.temperature === "number"
|
|
211
218
|
? { temperature: opts.temperature }
|
|
212
219
|
: {}),
|
|
@@ -232,7 +239,7 @@ class BuilderEngine {
|
|
|
232
239
|
// gateway outage are the same capture.
|
|
233
240
|
const payload = JSON.stringify(body);
|
|
234
241
|
const requestShape = {
|
|
235
|
-
model
|
|
242
|
+
model,
|
|
236
243
|
payloadBytes: new TextEncoder().encode(payload).length,
|
|
237
244
|
toolCount: cachedTools.length,
|
|
238
245
|
messageCount: cachedMessages.length,
|
|
@@ -242,7 +249,7 @@ class BuilderEngine {
|
|
|
242
249
|
gatewayUrl.searchParams.set("apiKey", spaceId);
|
|
243
250
|
const orgLabel = creds.orgName || "unknown-org";
|
|
244
251
|
const tStart = Date.now();
|
|
245
|
-
console.log(`[builder-engine] → POST ${gatewayUrl.origin}${gatewayUrl.pathname} model=${
|
|
252
|
+
console.log(`[builder-engine] → POST ${gatewayUrl.origin}${gatewayUrl.pathname} model=${model} tools=${tools.length} org=${orgLabel}`);
|
|
246
253
|
const gatewayTimeoutMs = getBuilderGatewayTimeoutMs();
|
|
247
254
|
const gatewayAbort = createGatewayAbortSignal(opts.abortSignal, gatewayTimeoutMs);
|
|
248
255
|
try {
|
|
@@ -269,7 +276,7 @@ class BuilderEngine {
|
|
|
269
276
|
if (timedOut || isBuilderGatewayNetworkError(err)) {
|
|
270
277
|
captureBuilderGatewayTransportError(err, {
|
|
271
278
|
phase: "request",
|
|
272
|
-
model
|
|
279
|
+
model,
|
|
273
280
|
gatewayUrl,
|
|
274
281
|
timeoutMs: gatewayAbort.effectiveTimeoutMs(),
|
|
275
282
|
timedOut,
|
|
@@ -325,7 +332,7 @@ class BuilderEngine {
|
|
|
325
332
|
}, creditsLane, requestShape);
|
|
326
333
|
return;
|
|
327
334
|
}
|
|
328
|
-
yield* parseJsonlStream(reader,
|
|
335
|
+
yield* parseJsonlStream(reader, model, {
|
|
329
336
|
creditsLane,
|
|
330
337
|
abortSignal: gatewayAbort.signal,
|
|
331
338
|
didGatewayTimeout: gatewayAbort.didTimeout,
|
|
@@ -1351,5 +1351,20 @@ export declare function resolveAgentRequestReasoningEffort({ model, requestEffor
|
|
|
1351
1351
|
requestEffort?: unknown;
|
|
1352
1352
|
configuredEffort?: ReasoningEffort;
|
|
1353
1353
|
}): ReasoningEffort | undefined;
|
|
1354
|
+
export type AgentModelSelectionSource = "request" | "configured" | "stored" | "default";
|
|
1355
|
+
/**
|
|
1356
|
+
* Resolve the model before the engine boundary. `auto` is a UI sentinel, not
|
|
1357
|
+
* a model to forward to the gateway, so it gives way to an AN org/user
|
|
1358
|
+
* default, then the configured global engine default.
|
|
1359
|
+
*/
|
|
1360
|
+
export declare function resolveAgentModelSelection(options: {
|
|
1361
|
+
requestModel?: string | null;
|
|
1362
|
+
configuredModel?: string | null;
|
|
1363
|
+
storedModel?: string | null;
|
|
1364
|
+
defaultModel: string;
|
|
1365
|
+
}): {
|
|
1366
|
+
model: string;
|
|
1367
|
+
source: AgentModelSelectionSource;
|
|
1368
|
+
};
|
|
1354
1369
|
export declare function createProductionAgentHandler(options: ProductionAgentOptions): H3EventHandler;
|
|
1355
1370
|
export { getActiveRunForThread, getActiveRunForThreadAsync, getRun, abortRun, abortRunDurably, abortTurnDurably, subscribeToRun, };
|
|
@@ -6275,6 +6275,27 @@ function progressStepFromAgentChatEvent(event) {
|
|
|
6275
6275
|
export function resolveAgentRequestReasoningEffort({ model, requestEffort, configuredEffort, }) {
|
|
6276
6276
|
return normalizeReasoningEffortForRequest(model, isReasoningEffort(requestEffort) ? requestEffort : configuredEffort);
|
|
6277
6277
|
}
|
|
6278
|
+
function isConcreteModelSelection(model) {
|
|
6279
|
+
const normalized = typeof model === "string" ? model.trim() : "";
|
|
6280
|
+
return normalized.length > 0 && normalized !== "auto";
|
|
6281
|
+
}
|
|
6282
|
+
/**
|
|
6283
|
+
* Resolve the model before the engine boundary. `auto` is a UI sentinel, not
|
|
6284
|
+
* a model to forward to the gateway, so it gives way to an AN org/user
|
|
6285
|
+
* default, then the configured global engine default.
|
|
6286
|
+
*/
|
|
6287
|
+
export function resolveAgentModelSelection(options) {
|
|
6288
|
+
if (isConcreteModelSelection(options.requestModel)) {
|
|
6289
|
+
return { model: options.requestModel, source: "request" };
|
|
6290
|
+
}
|
|
6291
|
+
if (isConcreteModelSelection(options.configuredModel)) {
|
|
6292
|
+
return { model: options.configuredModel, source: "configured" };
|
|
6293
|
+
}
|
|
6294
|
+
if (isConcreteModelSelection(options.storedModel)) {
|
|
6295
|
+
return { model: options.storedModel, source: "stored" };
|
|
6296
|
+
}
|
|
6297
|
+
return { model: options.defaultModel, source: "default" };
|
|
6298
|
+
}
|
|
6278
6299
|
export function createProductionAgentHandler(options) {
|
|
6279
6300
|
if (options.resolveActionSurface) {
|
|
6280
6301
|
assertRequestActionSurfaceIsolation();
|
|
@@ -6644,21 +6665,23 @@ export function createProductionAgentHandler(options) {
|
|
|
6644
6665
|
// DIAGNOSTIC-ONLY: bracket stored-model resolution (getStoredModelForEngine
|
|
6645
6666
|
// settings read).
|
|
6646
6667
|
workerStep("model_start");
|
|
6647
|
-
const
|
|
6668
|
+
const requestModelIsExplicit = isConcreteModelSelection(requestModel);
|
|
6669
|
+
const configuredModelIsExplicit = isConcreteModelSelection(configuredModel);
|
|
6670
|
+
const storedModel = !requestModelIsExplicit && !configuredModelIsExplicit
|
|
6648
6671
|
? await getStoredModelForEngine(engine, { appId: options.appId })
|
|
6649
6672
|
: undefined;
|
|
6650
|
-
const
|
|
6673
|
+
const modelSelection = resolveAgentModelSelection({
|
|
6674
|
+
requestModel,
|
|
6675
|
+
configuredModel,
|
|
6676
|
+
storedModel,
|
|
6677
|
+
defaultModel: engine.defaultModel,
|
|
6678
|
+
});
|
|
6679
|
+
const modelCandidate = modelSelection.model;
|
|
6651
6680
|
// DIAGNOSTIC-ONLY: stored-model resolution finished.
|
|
6652
6681
|
workerStep("model_done");
|
|
6653
6682
|
const model = normalizeModelForEngine(engine, modelCandidate);
|
|
6654
6683
|
let effectiveModel = model;
|
|
6655
|
-
let modelSelectionSource =
|
|
6656
|
-
? "request"
|
|
6657
|
-
: configuredModel != null
|
|
6658
|
-
? "configured"
|
|
6659
|
-
: storedModel != null
|
|
6660
|
-
? "stored"
|
|
6661
|
-
: "default";
|
|
6684
|
+
let modelSelectionSource = modelSelection.source;
|
|
6662
6685
|
let experimentAssignments = [];
|
|
6663
6686
|
// Database-backed experiments remain available to app operators.
|
|
6664
6687
|
try {
|
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
|
-
ok?: undefined;
|
|
30
29
|
error: string;
|
|
30
|
+
ok?: undefined;
|
|
31
31
|
} | {
|
|
32
32
|
error?: undefined;
|
|
33
33
|
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
|
-
ok?: undefined;
|
|
17
16
|
error: string;
|
|
17
|
+
ok?: undefined;
|
|
18
18
|
} | {
|
|
19
19
|
error?: undefined;
|
|
20
20
|
ok: boolean;
|
|
@@ -17,11 +17,11 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
17
17
|
id?: undefined;
|
|
18
18
|
provider?: undefined;
|
|
19
19
|
} | {
|
|
20
|
+
error?: undefined;
|
|
20
21
|
configured?: undefined;
|
|
21
22
|
connectPath?: undefined;
|
|
22
23
|
url: string;
|
|
23
24
|
id: string;
|
|
24
25
|
provider: string;
|
|
25
|
-
error?: undefined;
|
|
26
26
|
}>;
|
|
27
27
|
export default _default;
|
|
@@ -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;
|
|
46
44
|
summary: import("./types.js").TraceSummary;
|
|
47
45
|
spans: import("./types.js").TraceSpan[];
|
|
48
46
|
id?: undefined;
|
|
49
|
-
} | {
|
|
50
47
|
error?: undefined;
|
|
51
48
|
ok?: undefined;
|
|
49
|
+
} | {
|
|
52
50
|
summary?: undefined;
|
|
53
51
|
spans?: undefined;
|
|
54
52
|
id: string;
|
|
55
|
-
|
|
53
|
+
error?: undefined;
|
|
56
54
|
ok?: undefined;
|
|
55
|
+
} | {
|
|
57
56
|
summary?: undefined;
|
|
58
57
|
spans?: undefined;
|
|
59
58
|
id?: undefined;
|
|
60
59
|
error: any;
|
|
60
|
+
ok?: undefined;
|
|
61
61
|
} | {
|
|
62
|
-
error?: undefined;
|
|
63
62
|
summary?: undefined;
|
|
64
63
|
spans?: undefined;
|
|
65
64
|
id?: undefined;
|
|
66
65
|
ok: boolean;
|
|
66
|
+
error?: undefined;
|
|
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
|
-
ok?: undefined;
|
|
38
37
|
status?: undefined;
|
|
38
|
+
ok?: undefined;
|
|
39
39
|
} | {
|
|
40
|
-
error?: undefined;
|
|
41
40
|
ok: boolean;
|
|
42
41
|
status: string;
|
|
42
|
+
error?: undefined;
|
|
43
43
|
} | {
|
|
44
|
-
ok?: undefined;
|
|
45
44
|
error: string;
|
|
46
45
|
removed?: undefined;
|
|
46
|
+
ok?: undefined;
|
|
47
47
|
} | {
|
|
48
|
-
error?: undefined;
|
|
49
48
|
ok: boolean;
|
|
50
49
|
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;
|
|
58
57
|
error: string;
|
|
59
58
|
note?: undefined;
|
|
59
|
+
ok?: undefined;
|
|
60
60
|
} | {
|
|
61
|
-
error?: undefined;
|
|
62
61
|
ok: boolean;
|
|
63
62
|
note?: undefined;
|
|
64
|
-
} | {
|
|
65
63
|
error?: undefined;
|
|
64
|
+
} | {
|
|
66
65
|
ok: boolean;
|
|
67
66
|
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;
|
|
99
98
|
ok: boolean;
|
|
100
99
|
key: string;
|
|
101
|
-
} | {
|
|
102
100
|
error?: undefined;
|
|
101
|
+
} | {
|
|
103
102
|
ok: boolean;
|
|
104
103
|
removed: boolean;
|
|
104
|
+
error?: undefined;
|
|
105
105
|
}>>;
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.161.
|
|
3
|
+
"version": "0.161.23",
|
|
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": {
|