@agent-native/core 0.236.0 → 0.237.0-nightly-20261201010026
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/engine/ai-sdk-engine.js +4 -5
- package/dist/agent/engine/builder-engine.d.ts +1 -1
- package/dist/agent/model-catalog.js +6 -0
- package/dist/agent/model-config.d.ts +8 -8
- package/dist/agent/model-config.js +15 -1
- package/dist/client/analytics-beacon.d.ts +6 -0
- package/dist/client/analytics-beacon.js +41 -0
- package/dist/client/analytics.js +3 -31
- package/dist/client/keepalive-budget.d.ts +2 -1
- package/dist/client/keepalive-budget.js +12 -12
- package/dist/collab/routes.d.ts +1 -1
- package/dist/framework-package-versions.json +8 -8
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/provider-api/actions/custom-provider-registration.d.ts +10 -10
- package/dist/provider-api/actions/provider-api.d.ts +4 -4
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/secrets/routes.d.ts +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/csrf.d.ts +9 -0
- package/dist/server/csrf.js +46 -0
- package/dist/server/first-touch-route.d.ts +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/html-document.js +3 -1
- package/dist/templates/chat/package.json +1 -1
- package/dist/testing.d.ts +1 -0
- package/dist/testing.js +1 -0
- package/dist/triggers/actions/manage-automation.d.ts +2 -2
- package/package.json +6 -5
- package/src/templates/chat/package.json +1 -1
|
@@ -143,7 +143,7 @@ function googleThinkingBudget(effort) {
|
|
|
143
143
|
return 32_000;
|
|
144
144
|
return -1;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function geminiThinkingLevel(effort) {
|
|
147
147
|
if (effort === "low")
|
|
148
148
|
return "low";
|
|
149
149
|
if (effort === "medium")
|
|
@@ -418,14 +418,13 @@ class AISDKEngine {
|
|
|
418
418
|
};
|
|
419
419
|
}
|
|
420
420
|
else if (this.provider === "google") {
|
|
421
|
-
// Gemini 3.x models reject thinkingBudget — they require thinkingLevel.
|
|
422
421
|
// Gemini 2.5.x models use thinkingBudget (integer token count or -1).
|
|
423
|
-
const
|
|
422
|
+
const usesGeminiThinkingLevel = /^gemini-[34]/.test(opts.model);
|
|
424
423
|
const thinkingBudget = googleThinkingBudget(reasoningEffort);
|
|
425
424
|
providerOpts.google = {
|
|
426
425
|
...(providerOpts.google ?? {}),
|
|
427
|
-
thinkingConfig:
|
|
428
|
-
? { thinkingLevel:
|
|
426
|
+
thinkingConfig: usesGeminiThinkingLevel
|
|
427
|
+
? { thinkingLevel: geminiThinkingLevel(reasoningEffort) }
|
|
429
428
|
: {
|
|
430
429
|
thinkingBudget: thinkingBudget > 0
|
|
431
430
|
? clampThinkingBudgetTokens(thinkingBudget, resolvedMaxOutputTokens)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type BuilderGatewayLane } from "../../server/credential-provider.js";
|
|
2
2
|
import type { AgentEngine, EngineCapabilities } from "./types.js";
|
|
3
3
|
export declare const BUILDER_CAPABILITIES: EngineCapabilities;
|
|
4
|
-
export declare const BUILDER_SUPPORTED_MODELS: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-5-1-codex-mini", "gpt-6-1-sol", "gpt-5-6-terra", "gpt-6-luna", "gemini-3-1-pro", "gemini-3-8-flash", "gemini-3-5-flash-lite", "gemini-3-1-flash-lite", "grok-code-fast", "qwen3-coder", "kimi-k2-5", "deepseek-v4-pro", "deepseek-v4-1-flash", "deepseek-v3-1", "z-ai-glm-4-5", "z-ai-glm-5-1", "z-ai-glm-5-3-flash"];
|
|
4
|
+
export declare const BUILDER_SUPPORTED_MODELS: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-5-1-codex-mini", "gpt-6-1-sol", "gpt-6-sol", "gpt-6-1-terra", "gpt-5-6-terra", "gpt-6-luna", "gemini-3-1-pro", "gemini-3-8-flash", "gemini-3-5-flash-lite", "gemini-3-1-flash-lite", "grok-code-fast", "qwen3-coder", "kimi-k2-5", "deepseek-v4-pro", "deepseek-v4-1-flash", "deepseek-v3-1", "z-ai-glm-4-5", "z-ai-glm-5-1", "z-ai-glm-5-3-flash"];
|
|
5
5
|
export declare const BUILDER_MODEL_UNAUTHORIZED_ERROR_CODE = "builder_model_unauthorized";
|
|
6
6
|
/**
|
|
7
7
|
* A truncated stream, not a rejected request: the client continues the partial
|
|
@@ -74,6 +74,8 @@ export const MODEL_CATALOG = [
|
|
|
74
74
|
ratings: FLAGSHIP,
|
|
75
75
|
recommended: true,
|
|
76
76
|
},
|
|
77
|
+
{ id: "gpt-6-sol", name: "GPT-6 Sol", provider: "openai" },
|
|
78
|
+
{ id: "gpt-6-1-terra", name: "GPT-6.1 Terra", provider: "openai" },
|
|
77
79
|
{
|
|
78
80
|
id: "gemini-3-1-pro",
|
|
79
81
|
name: "Gemini 3.1 Pro",
|
|
@@ -83,6 +85,10 @@ export const MODEL_CATALOG = [
|
|
|
83
85
|
ratings: FLAGSHIP,
|
|
84
86
|
recommended: true,
|
|
85
87
|
},
|
|
88
|
+
{ id: "gemini-4-carbon", name: "Gemini 4 Carbon", provider: "google" },
|
|
89
|
+
{ id: "gemini-4-neon", name: "Gemini 4 Neon", provider: "google" },
|
|
90
|
+
{ id: "gemini-4-argon", name: "Gemini 4 Argon", provider: "google" },
|
|
91
|
+
{ id: "gemini-4-hydrogen", name: "Gemini 4 Hydrogen", provider: "google" },
|
|
86
92
|
{
|
|
87
93
|
id: "claude-sonnet-5-5",
|
|
88
94
|
providerDefaultEffort: "high",
|
|
@@ -39,7 +39,7 @@ export declare const BUILDER_MODEL_ALIASES: Readonly<Record<string, string>>;
|
|
|
39
39
|
export declare const AGENT_MODEL_CONFIG: {
|
|
40
40
|
readonly builder: {
|
|
41
41
|
readonly defaultModel: "gpt-6-luna";
|
|
42
|
-
readonly supportedModels: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-5-1-codex-mini", "gpt-6-1-sol", "gpt-5-6-terra", "gpt-6-luna", "gemini-3-1-pro", "gemini-3-8-flash", "gemini-3-5-flash-lite", "gemini-3-1-flash-lite", "grok-code-fast", "qwen3-coder", "kimi-k2-5", "deepseek-v4-pro", "deepseek-v4-1-flash", "deepseek-v3-1", "z-ai-glm-4-5", "z-ai-glm-5-1", "z-ai-glm-5-3-flash"];
|
|
42
|
+
readonly supportedModels: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-5-1-codex-mini", "gpt-6-1-sol", "gpt-6-sol", "gpt-6-1-terra", "gpt-5-6-terra", "gpt-6-luna", "gemini-3-1-pro", "gemini-3-8-flash", "gemini-3-5-flash-lite", "gemini-3-1-flash-lite", "grok-code-fast", "qwen3-coder", "kimi-k2-5", "deepseek-v4-pro", "deepseek-v4-1-flash", "deepseek-v3-1", "z-ai-glm-4-5", "z-ai-glm-5-1", "z-ai-glm-5-3-flash"];
|
|
43
43
|
};
|
|
44
44
|
readonly anthropic: {
|
|
45
45
|
readonly defaultModel: "claude-sonnet-5-5";
|
|
@@ -52,15 +52,15 @@ export declare const AGENT_MODEL_CONFIG: {
|
|
|
52
52
|
};
|
|
53
53
|
readonly openai: {
|
|
54
54
|
readonly defaultModel: "gpt-6-luna";
|
|
55
|
-
readonly supportedModels: readonly ["gpt-6-luna", "gpt-6.1-sol", "gpt-5.6-terra", "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.1-codex-mini"];
|
|
55
|
+
readonly supportedModels: readonly ["gpt-6-luna", "gpt-6.1-sol", "gpt-6-sol", "gpt-6.1-terra", "gpt-5.6-terra", "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.1-codex-mini"];
|
|
56
56
|
};
|
|
57
57
|
readonly openrouter: {
|
|
58
58
|
readonly defaultModel: string;
|
|
59
|
-
readonly supportedModels: readonly ["openai/gpt-6-luna", "openai/gpt-5.6-terra", "openai/gpt-6.1-sol", "openai/gpt-6-astra", "openai/gpt-6-astra-pro", "openai/gpt-5.5", "openai/gpt-5.4", "openai/gpt-5.4-mini", "openai/gpt-5.1-codex-mini", "anthropic/claude-haiku-5.5", "anthropic/claude-sonnet-5.5", "anthropic/claude-opus-5.5", "anthropic/claude-opus-4.8", "anthropic/claude-fable-5", "anthropic/claude-fable-5.1", "google/gemini-3.8-flash", "google/gemini-3.5-flash-lite", "google/gemini-3.1-flash-lite", "google/gemini-3.1-pro-preview", "x-ai/grok-4.7", "x-ai/grok-build-0.1", "qwen/qwen3-coder", "moonshotai/kimi-k2.5", "deepseek/deepseek-v4-pro", "deepseek/deepseek-v4.1-flash", "deepseek/deepseek-chat-v3.1", "z-ai/glm-4.5", "z-ai/glm-5.1", "z-ai/glm-5.3-flash", "qwen/qwen3.8-max-0902", "meta/muse-spark-1.3", "inception/mercury-2.5", "z-ai/glm-5.2"];
|
|
59
|
+
readonly supportedModels: readonly ["openai/gpt-6-luna", "openai/gpt-5.6-terra", "openai/gpt-6.1-sol", "openai/gpt-6-sol", "openai/gpt-6.1-terra", "openai/gpt-6-astra", "openai/gpt-6-astra-pro", "openai/gpt-5.5", "openai/gpt-5.4", "openai/gpt-5.4-mini", "openai/gpt-5.1-codex-mini", "anthropic/claude-haiku-5.5", "anthropic/claude-sonnet-5.5", "anthropic/claude-opus-5.5", "anthropic/claude-opus-4.8", "anthropic/claude-fable-5", "anthropic/claude-fable-5.1", "google/gemini-3.8-flash", "google/gemini-3.5-flash-lite", "google/gemini-3.1-flash-lite", "google/gemini-3.1-pro-preview", "x-ai/grok-4.7", "x-ai/grok-build-0.1", "qwen/qwen3-coder", "moonshotai/kimi-k2.5", "deepseek/deepseek-v4-pro", "deepseek/deepseek-v4.1-flash", "deepseek/deepseek-chat-v3.1", "z-ai/glm-4.5", "z-ai/glm-5.1", "z-ai/glm-5.3-flash", "qwen/qwen3.8-max-0902", "meta/muse-spark-1.3", "inception/mercury-2.5", "z-ai/glm-5.2"];
|
|
60
60
|
};
|
|
61
61
|
readonly google: {
|
|
62
62
|
readonly defaultModel: "gemini-3.8-flash";
|
|
63
|
-
readonly supportedModels: readonly ["gemini-3.8-flash", "gemini-3.5-flash-lite", "gemini-3.1-flash-lite", "gemini-3.1-pro-preview"];
|
|
63
|
+
readonly supportedModels: readonly ["gemini-4-carbon", "gemini-4-neon", "gemini-4-argon", "gemini-4-hydrogen", "gemini-3.8-flash", "gemini-3.5-flash-lite", "gemini-3.1-flash-lite", "gemini-3.1-pro-preview"];
|
|
64
64
|
};
|
|
65
65
|
readonly groq: {
|
|
66
66
|
readonly defaultModel: "llama-3.3-70b-versatile";
|
|
@@ -82,7 +82,7 @@ export declare const AGENT_MODEL_CONFIG: {
|
|
|
82
82
|
};
|
|
83
83
|
export declare const BUILDER_MODEL_CONFIG: {
|
|
84
84
|
readonly defaultModel: "gpt-6-luna";
|
|
85
|
-
readonly supportedModels: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-5-1-codex-mini", "gpt-6-1-sol", "gpt-5-6-terra", "gpt-6-luna", "gemini-3-1-pro", "gemini-3-8-flash", "gemini-3-5-flash-lite", "gemini-3-1-flash-lite", "grok-code-fast", "qwen3-coder", "kimi-k2-5", "deepseek-v4-pro", "deepseek-v4-1-flash", "deepseek-v3-1", "z-ai-glm-4-5", "z-ai-glm-5-1", "z-ai-glm-5-3-flash"];
|
|
85
|
+
readonly supportedModels: readonly ["auto", "claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5", "gpt-5-4", "gpt-5-5", "gpt-5-4-mini", "gpt-5-1-codex-mini", "gpt-6-1-sol", "gpt-6-sol", "gpt-6-1-terra", "gpt-5-6-terra", "gpt-6-luna", "gemini-3-1-pro", "gemini-3-8-flash", "gemini-3-5-flash-lite", "gemini-3-1-flash-lite", "grok-code-fast", "qwen3-coder", "kimi-k2-5", "deepseek-v4-pro", "deepseek-v4-1-flash", "deepseek-v3-1", "z-ai-glm-4-5", "z-ai-glm-5-1", "z-ai-glm-5-3-flash"];
|
|
86
86
|
};
|
|
87
87
|
export declare const ANTHROPIC_MODEL_CONFIG: {
|
|
88
88
|
readonly defaultModel: "claude-sonnet-5-5";
|
|
@@ -95,15 +95,15 @@ export declare const AI_SDK_MODEL_CONFIG: {
|
|
|
95
95
|
};
|
|
96
96
|
readonly openai: {
|
|
97
97
|
readonly defaultModel: "gpt-6-luna";
|
|
98
|
-
readonly supportedModels: readonly ["gpt-6-luna", "gpt-6.1-sol", "gpt-5.6-terra", "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.1-codex-mini"];
|
|
98
|
+
readonly supportedModels: readonly ["gpt-6-luna", "gpt-6.1-sol", "gpt-6-sol", "gpt-6.1-terra", "gpt-5.6-terra", "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.1-codex-mini"];
|
|
99
99
|
};
|
|
100
100
|
readonly openrouter: {
|
|
101
101
|
readonly defaultModel: string;
|
|
102
|
-
readonly supportedModels: readonly ["openai/gpt-6-luna", "openai/gpt-5.6-terra", "openai/gpt-6.1-sol", "openai/gpt-6-astra", "openai/gpt-6-astra-pro", "openai/gpt-5.5", "openai/gpt-5.4", "openai/gpt-5.4-mini", "openai/gpt-5.1-codex-mini", "anthropic/claude-haiku-5.5", "anthropic/claude-sonnet-5.5", "anthropic/claude-opus-5.5", "anthropic/claude-opus-4.8", "anthropic/claude-fable-5", "anthropic/claude-fable-5.1", "google/gemini-3.8-flash", "google/gemini-3.5-flash-lite", "google/gemini-3.1-flash-lite", "google/gemini-3.1-pro-preview", "x-ai/grok-4.7", "x-ai/grok-build-0.1", "qwen/qwen3-coder", "moonshotai/kimi-k2.5", "deepseek/deepseek-v4-pro", "deepseek/deepseek-v4.1-flash", "deepseek/deepseek-chat-v3.1", "z-ai/glm-4.5", "z-ai/glm-5.1", "z-ai/glm-5.3-flash", "qwen/qwen3.8-max-0902", "meta/muse-spark-1.3", "inception/mercury-2.5", "z-ai/glm-5.2"];
|
|
102
|
+
readonly supportedModels: readonly ["openai/gpt-6-luna", "openai/gpt-5.6-terra", "openai/gpt-6.1-sol", "openai/gpt-6-sol", "openai/gpt-6.1-terra", "openai/gpt-6-astra", "openai/gpt-6-astra-pro", "openai/gpt-5.5", "openai/gpt-5.4", "openai/gpt-5.4-mini", "openai/gpt-5.1-codex-mini", "anthropic/claude-haiku-5.5", "anthropic/claude-sonnet-5.5", "anthropic/claude-opus-5.5", "anthropic/claude-opus-4.8", "anthropic/claude-fable-5", "anthropic/claude-fable-5.1", "google/gemini-3.8-flash", "google/gemini-3.5-flash-lite", "google/gemini-3.1-flash-lite", "google/gemini-3.1-pro-preview", "x-ai/grok-4.7", "x-ai/grok-build-0.1", "qwen/qwen3-coder", "moonshotai/kimi-k2.5", "deepseek/deepseek-v4-pro", "deepseek/deepseek-v4.1-flash", "deepseek/deepseek-chat-v3.1", "z-ai/glm-4.5", "z-ai/glm-5.1", "z-ai/glm-5.3-flash", "qwen/qwen3.8-max-0902", "meta/muse-spark-1.3", "inception/mercury-2.5", "z-ai/glm-5.2"];
|
|
103
103
|
};
|
|
104
104
|
readonly google: {
|
|
105
105
|
readonly defaultModel: "gemini-3.8-flash";
|
|
106
|
-
readonly supportedModels: readonly ["gemini-3.8-flash", "gemini-3.5-flash-lite", "gemini-3.1-flash-lite", "gemini-3.1-pro-preview"];
|
|
106
|
+
readonly supportedModels: readonly ["gemini-4-carbon", "gemini-4-neon", "gemini-4-argon", "gemini-4-hydrogen", "gemini-3.8-flash", "gemini-3.5-flash-lite", "gemini-3.1-flash-lite", "gemini-3.1-pro-preview"];
|
|
107
107
|
};
|
|
108
108
|
readonly groq: {
|
|
109
109
|
readonly defaultModel: "llama-3.3-70b-versatile";
|
|
@@ -50,6 +50,8 @@ const MODEL_CONTEXT_WINDOWS = {
|
|
|
50
50
|
"z-ai/glm-5.2": 1_048_576,
|
|
51
51
|
"gpt-6-sol": 1_050_000,
|
|
52
52
|
"gpt-6.1-sol": 1_050_000,
|
|
53
|
+
"gpt-6-1-terra": 1_050_000,
|
|
54
|
+
"gpt-6.1-terra": 1_050_000,
|
|
53
55
|
"gpt-6-luna": 1_050_000,
|
|
54
56
|
"gpt-5.6-sol": 1_050_000,
|
|
55
57
|
"gpt-5.6-terra": 1_050_000,
|
|
@@ -107,8 +109,10 @@ export function getKnownContextWindowForModel(modelId) {
|
|
|
107
109
|
return 1_050_000;
|
|
108
110
|
if (id.startsWith("gemini-2") ||
|
|
109
111
|
id.startsWith("gemini-3") ||
|
|
112
|
+
id.startsWith("gemini-4") ||
|
|
110
113
|
id.includes("/gemini-2") ||
|
|
111
|
-
id.includes("/gemini-3")
|
|
114
|
+
id.includes("/gemini-3") ||
|
|
115
|
+
id.includes("/gemini-4"))
|
|
112
116
|
return 1_048_576;
|
|
113
117
|
if (id.startsWith("glm-5") || id.includes("/glm-5"))
|
|
114
118
|
return 1_048_576;
|
|
@@ -262,6 +266,8 @@ export const AGENT_MODEL_CONFIG = {
|
|
|
262
266
|
"gpt-5-4-mini",
|
|
263
267
|
"gpt-5-1-codex-mini",
|
|
264
268
|
"gpt-6-1-sol",
|
|
269
|
+
"gpt-6-sol",
|
|
270
|
+
"gpt-6-1-terra",
|
|
265
271
|
"gpt-5-6-terra",
|
|
266
272
|
"gpt-6-luna",
|
|
267
273
|
"gemini-3-1-pro",
|
|
@@ -309,6 +315,8 @@ export const AGENT_MODEL_CONFIG = {
|
|
|
309
315
|
supportedModels: [
|
|
310
316
|
"gpt-6-luna",
|
|
311
317
|
"gpt-6.1-sol",
|
|
318
|
+
"gpt-6-sol",
|
|
319
|
+
"gpt-6.1-terra",
|
|
312
320
|
"gpt-5.6-terra",
|
|
313
321
|
"gpt-5.5",
|
|
314
322
|
"gpt-5.4",
|
|
@@ -322,6 +330,8 @@ export const AGENT_MODEL_CONFIG = {
|
|
|
322
330
|
"openai/gpt-6-luna",
|
|
323
331
|
"openai/gpt-5.6-terra",
|
|
324
332
|
"openai/gpt-6.1-sol",
|
|
333
|
+
"openai/gpt-6-sol",
|
|
334
|
+
"openai/gpt-6.1-terra",
|
|
325
335
|
"openai/gpt-6-astra",
|
|
326
336
|
"openai/gpt-6-astra-pro",
|
|
327
337
|
"openai/gpt-5.5",
|
|
@@ -357,6 +367,10 @@ export const AGENT_MODEL_CONFIG = {
|
|
|
357
367
|
google: {
|
|
358
368
|
defaultModel: "gemini-3.8-flash",
|
|
359
369
|
supportedModels: [
|
|
370
|
+
"gemini-4-carbon",
|
|
371
|
+
"gemini-4-neon",
|
|
372
|
+
"gemini-4-argon",
|
|
373
|
+
"gemini-4-hydrogen",
|
|
360
374
|
"gemini-3.8-flash",
|
|
361
375
|
"gemini-3.5-flash-lite",
|
|
362
376
|
"gemini-3.1-flash-lite",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cookieless analytics POST that survives page hide. Keepalive bodies share
|
|
3
|
+
* the page's 64 KiB budget; a payload past it goes without keepalive. Browsers
|
|
4
|
+
* without keepalive `fetch` use `navigator.sendBeacon`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function postAnalyticsBeacon(endpoint: string, body: string): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { reserveKeepaliveBytes } from "./keepalive-budget.js";
|
|
2
|
+
const TEXT_PLAIN = "text/plain;charset=UTF-8";
|
|
3
|
+
function supportsKeepaliveFetch() {
|
|
4
|
+
return (typeof fetch === "function" &&
|
|
5
|
+
typeof Request === "function" &&
|
|
6
|
+
"keepalive" in Request.prototype);
|
|
7
|
+
}
|
|
8
|
+
function postCookieless(endpoint, body, keepalive) {
|
|
9
|
+
return fetch(endpoint, {
|
|
10
|
+
method: "POST",
|
|
11
|
+
body,
|
|
12
|
+
keepalive,
|
|
13
|
+
credentials: "omit",
|
|
14
|
+
headers: { "Content-Type": TEXT_PLAIN },
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Cookieless analytics POST that survives page hide. Keepalive bodies share
|
|
19
|
+
* the page's 64 KiB budget; a payload past it goes without keepalive. Browsers
|
|
20
|
+
* without keepalive `fetch` use `navigator.sendBeacon`.
|
|
21
|
+
*/
|
|
22
|
+
export function postAnalyticsBeacon(endpoint, body) {
|
|
23
|
+
try {
|
|
24
|
+
if (!supportsKeepaliveFetch()) {
|
|
25
|
+
if (typeof navigator.sendBeacon === "function" &&
|
|
26
|
+
navigator.sendBeacon(endpoint, body)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (typeof fetch === "function") {
|
|
30
|
+
void postCookieless(endpoint, body, false).catch(() => { });
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const release = reserveKeepaliveBytes("analytics", new TextEncoder().encode(body).byteLength);
|
|
35
|
+
void postCookieless(endpoint, body, release !== undefined)
|
|
36
|
+
.catch(() => { })
|
|
37
|
+
.finally(() => release?.());
|
|
38
|
+
// coercion-ok: analytics delivery must never throw into the page
|
|
39
|
+
}
|
|
40
|
+
catch { }
|
|
41
|
+
}
|
package/dist/client/analytics.js
CHANGED
|
@@ -12,6 +12,7 @@ import { EXTERNAL_EMBED_WINDOW_KEY } from "../shared/route-chunk-recovery-bootst
|
|
|
12
12
|
import { redactSecretsInValue } from "../shared/secret-redaction.js";
|
|
13
13
|
import { isSyntheticTrafficValue } from "../shared/test-traffic.js";
|
|
14
14
|
import { toPostHogExceptionProperties } from "../tracking/posthog-exception.js";
|
|
15
|
+
import { postAnalyticsBeacon } from "./analytics-beacon.js";
|
|
15
16
|
import { getAnalyticsClientPlatform } from "./analytics-platform.js";
|
|
16
17
|
import { getAnalyticsPageLoadId, getOrCreateAnalyticsAnonymousId, getOrCreateAnalyticsSessionId, } from "./analytics-session.js";
|
|
17
18
|
import { agentNativePath } from "./api-path.js";
|
|
@@ -1619,18 +1620,7 @@ function sendPostHogExceptionEvent(event) {
|
|
|
1619
1620
|
},
|
|
1620
1621
|
timestamp: event.occurredAt,
|
|
1621
1622
|
});
|
|
1622
|
-
|
|
1623
|
-
if (navigator.sendBeacon) {
|
|
1624
|
-
const blob = new Blob([body], { type: "text/plain;charset=UTF-8" });
|
|
1625
|
-
if (navigator.sendBeacon(endpoint, blob))
|
|
1626
|
-
return;
|
|
1627
|
-
}
|
|
1628
|
-
fetch(endpoint, {
|
|
1629
|
-
method: "POST",
|
|
1630
|
-
body,
|
|
1631
|
-
keepalive: true,
|
|
1632
|
-
headers: { "Content-Type": "text/plain;charset=UTF-8" },
|
|
1633
|
-
}).catch(() => { });
|
|
1623
|
+
postAnalyticsBeacon(`${config.host}/i/v0/e/`, body);
|
|
1634
1624
|
// coercion-ok: throwing would replace the page's real error
|
|
1635
1625
|
}
|
|
1636
1626
|
catch {
|
|
@@ -2284,7 +2274,7 @@ function sendAgentNativeAnalytics(name, properties) {
|
|
|
2284
2274
|
const timestamp = new Date().toISOString();
|
|
2285
2275
|
whenConsentDecided((decided) => {
|
|
2286
2276
|
const anonymousId = decided ? getOrCreateAnonymousId() : undefined;
|
|
2287
|
-
|
|
2277
|
+
postAnalyticsBeacon(endpoint, JSON.stringify({
|
|
2288
2278
|
publicKey,
|
|
2289
2279
|
event: name,
|
|
2290
2280
|
// The visitor id waits for analytics consent; mark the event so
|
|
@@ -2303,24 +2293,6 @@ function sendAgentNativeAnalytics(name, properties) {
|
|
|
2303
2293
|
}));
|
|
2304
2294
|
});
|
|
2305
2295
|
}
|
|
2306
|
-
function postAgentNativeAnalytics(endpoint, body) {
|
|
2307
|
-
try {
|
|
2308
|
-
if (navigator.sendBeacon) {
|
|
2309
|
-
const sent = navigator.sendBeacon(endpoint, body);
|
|
2310
|
-
if (sent)
|
|
2311
|
-
return;
|
|
2312
|
-
}
|
|
2313
|
-
fetch(endpoint, {
|
|
2314
|
-
method: "POST",
|
|
2315
|
-
body,
|
|
2316
|
-
keepalive: true,
|
|
2317
|
-
headers: { "Content-Type": "text/plain;charset=UTF-8" },
|
|
2318
|
-
}).catch(() => { });
|
|
2319
|
-
}
|
|
2320
|
-
catch {
|
|
2321
|
-
// best-effort
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
2296
|
function createTrackingAliasId() {
|
|
2325
2297
|
return typeof crypto !== "undefined" &&
|
|
2326
2298
|
typeof crypto.randomUUID === "function"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const KEEPALIVE_PAGE_LIMIT_BYTES: number;
|
|
2
2
|
/** The most body bytes keepalive action calls may have in flight at once. */
|
|
3
3
|
export declare const ACTION_KEEPALIVE_BODY_BUDGET_BYTES = 48000;
|
|
4
|
-
|
|
4
|
+
/** Senders other than `action` share what is left after the action reserve. */
|
|
5
|
+
export type KeepaliveSender = "action" | "app-state" | "analytics";
|
|
5
6
|
/** The body bytes a keepalive request from this sender can take right now. */
|
|
6
7
|
export declare function availableKeepaliveBytes(sender: KeepaliveSender): number;
|
|
7
8
|
/**
|
|
@@ -7,12 +7,18 @@
|
|
|
7
7
|
export const KEEPALIVE_PAGE_LIMIT_BYTES = 64 * 1024;
|
|
8
8
|
/** The most body bytes keepalive action calls may have in flight at once. */
|
|
9
9
|
export const ACTION_KEEPALIVE_BODY_BUDGET_BYTES = 48_000;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const bytesInFlight = {
|
|
11
|
+
action: 0,
|
|
12
|
+
"app-state": 0,
|
|
13
|
+
analytics: 0,
|
|
14
|
+
};
|
|
12
15
|
/** The body bytes a keepalive request from this sender can take right now. */
|
|
13
16
|
export function availableKeepaliveBytes(sender) {
|
|
14
|
-
const free = KEEPALIVE_PAGE_LIMIT_BYTES -
|
|
15
|
-
|
|
17
|
+
const free = KEEPALIVE_PAGE_LIMIT_BYTES -
|
|
18
|
+
bytesInFlight.action -
|
|
19
|
+
bytesInFlight["app-state"] -
|
|
20
|
+
bytesInFlight.analytics;
|
|
21
|
+
const actionRoom = ACTION_KEEPALIVE_BODY_BUDGET_BYTES - bytesInFlight.action;
|
|
16
22
|
return sender === "action"
|
|
17
23
|
? Math.min(free, actionRoom)
|
|
18
24
|
: free - Math.max(0, actionRoom);
|
|
@@ -24,18 +30,12 @@ export function availableKeepaliveBytes(sender) {
|
|
|
24
30
|
export function reserveKeepaliveBytes(sender, bytes) {
|
|
25
31
|
if (bytes > availableKeepaliveBytes(sender))
|
|
26
32
|
return undefined;
|
|
27
|
-
|
|
28
|
-
actionBytes += bytes;
|
|
29
|
-
else
|
|
30
|
-
appStateBytes += bytes;
|
|
33
|
+
bytesInFlight[sender] += bytes;
|
|
31
34
|
let released = false;
|
|
32
35
|
return () => {
|
|
33
36
|
if (released)
|
|
34
37
|
return;
|
|
35
38
|
released = true;
|
|
36
|
-
|
|
37
|
-
actionBytes -= bytes;
|
|
38
|
-
else
|
|
39
|
-
appStateBytes -= bytes;
|
|
39
|
+
bytesInFlight[sender] -= bytes;
|
|
40
40
|
};
|
|
41
41
|
}
|
package/dist/collab/routes.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import
|
|
|
26
26
|
ok: boolean;
|
|
27
27
|
}>>;
|
|
28
28
|
export declare const postCollabText: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
29
|
-
ok?: undefined;
|
|
30
29
|
text?: undefined;
|
|
30
|
+
ok?: undefined;
|
|
31
31
|
error: string;
|
|
32
32
|
} | {
|
|
33
33
|
error?: undefined;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@agent-native/actions": "0.1.1",
|
|
3
|
-
"@agent-native/agentkit": "0.
|
|
3
|
+
"@agent-native/agentkit": "0.237.0-nightly-20261201010026",
|
|
4
4
|
"@agent-native/code-agents-ui": "0.1.75",
|
|
5
|
-
"@agent-native/core": "0.
|
|
6
|
-
"@agent-native/core-corpus": "0.
|
|
5
|
+
"@agent-native/core": "0.237.0-nightly-20261201010026",
|
|
6
|
+
"@agent-native/core-corpus": "0.237.0-nightly-20261201010026",
|
|
7
7
|
"@agent-native/creative-context": "0.8.81",
|
|
8
|
-
"@agent-native/design-system": "0.
|
|
9
|
-
"@agent-native/dispatch": "0.43.
|
|
8
|
+
"@agent-native/design-system": "0.237.0-nightly-20261201010026",
|
|
9
|
+
"@agent-native/dispatch": "0.43.6-nightly-20261201010026",
|
|
10
10
|
"@agent-native/embedding": "0.2.0",
|
|
11
11
|
"@agent-native/migrate": "0.0.7",
|
|
12
12
|
"@agent-native/otel": "0.1.48",
|
|
13
13
|
"@agent-native/pinpoint": "0.1.124",
|
|
14
14
|
"@agent-native/recap-cli": "0.5.112",
|
|
15
|
-
"@agent-native/scheduling": "0.4.
|
|
15
|
+
"@agent-native/scheduling": "0.4.6-nightly-20261201010026",
|
|
16
16
|
"@agent-native/shared-app-config": "0.1.2",
|
|
17
|
-
"@agent-native/skills": "0.4.
|
|
18
|
-
"@agent-native/toolkit": "0.
|
|
17
|
+
"@agent-native/skills": "0.4.17-nightly-20261201010026",
|
|
18
|
+
"@agent-native/toolkit": "0.237.0-nightly-20261201010026"
|
|
19
19
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
|
|
2
|
+
error?: undefined;
|
|
2
3
|
count: number;
|
|
3
4
|
updated?: undefined;
|
|
4
|
-
error?: undefined;
|
|
5
5
|
ok?: undefined;
|
|
6
6
|
} | {
|
|
7
7
|
count?: undefined;
|
|
8
|
-
updated: number;
|
|
9
8
|
error?: undefined;
|
|
9
|
+
updated: number;
|
|
10
10
|
ok?: undefined;
|
|
11
11
|
} | {
|
|
12
12
|
count?: undefined;
|
|
@@ -15,7 +15,7 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
|
|
|
15
15
|
ok?: undefined;
|
|
16
16
|
} | {
|
|
17
17
|
count?: undefined;
|
|
18
|
-
updated?: undefined;
|
|
19
18
|
error?: undefined;
|
|
19
|
+
updated?: undefined;
|
|
20
20
|
ok: boolean;
|
|
21
21
|
}>>;
|
|
@@ -75,9 +75,10 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
75
75
|
user: "user";
|
|
76
76
|
}>>;
|
|
77
77
|
}, z.core.$strip>>, {
|
|
78
|
+
provider?: undefined;
|
|
78
79
|
message?: undefined;
|
|
79
|
-
id?: undefined;
|
|
80
80
|
deleted?: undefined;
|
|
81
|
+
id?: undefined;
|
|
81
82
|
providers: {
|
|
82
83
|
id: string;
|
|
83
84
|
label: string;
|
|
@@ -88,45 +89,44 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
|
|
|
88
89
|
updatedAt: number;
|
|
89
90
|
}[];
|
|
90
91
|
count: number;
|
|
91
|
-
provider?: undefined;
|
|
92
92
|
found?: undefined;
|
|
93
93
|
registered?: undefined;
|
|
94
94
|
label?: undefined;
|
|
95
95
|
} | {
|
|
96
96
|
message?: undefined;
|
|
97
|
-
|
|
97
|
+
count?: undefined;
|
|
98
98
|
deleted?: undefined;
|
|
99
|
+
id?: undefined;
|
|
99
100
|
providers?: undefined;
|
|
100
|
-
count?: undefined;
|
|
101
101
|
found: boolean;
|
|
102
102
|
provider: import("../custom-registry.js").CustomProviderConfig;
|
|
103
103
|
registered?: undefined;
|
|
104
104
|
label?: undefined;
|
|
105
105
|
} | {
|
|
106
|
+
provider?: undefined;
|
|
106
107
|
message?: undefined;
|
|
108
|
+
count?: undefined;
|
|
107
109
|
deleted?: undefined;
|
|
108
110
|
providers?: undefined;
|
|
109
|
-
count?: undefined;
|
|
110
|
-
provider?: undefined;
|
|
111
111
|
found: boolean;
|
|
112
112
|
id: string;
|
|
113
113
|
registered?: undefined;
|
|
114
114
|
label?: undefined;
|
|
115
115
|
} | {
|
|
116
|
+
provider?: undefined;
|
|
116
117
|
message?: undefined;
|
|
117
|
-
providers?: undefined;
|
|
118
118
|
count?: undefined;
|
|
119
|
-
|
|
119
|
+
providers?: undefined;
|
|
120
120
|
found?: undefined;
|
|
121
121
|
deleted: boolean;
|
|
122
122
|
id: string;
|
|
123
123
|
registered?: undefined;
|
|
124
124
|
label?: undefined;
|
|
125
125
|
} | {
|
|
126
|
+
provider?: undefined;
|
|
127
|
+
count?: undefined;
|
|
126
128
|
deleted?: undefined;
|
|
127
129
|
providers?: undefined;
|
|
128
|
-
count?: undefined;
|
|
129
|
-
provider?: undefined;
|
|
130
130
|
found?: undefined;
|
|
131
131
|
registered: boolean;
|
|
132
132
|
id: string;
|
|
@@ -322,7 +322,6 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
322
322
|
}, {
|
|
323
323
|
deleted?: undefined;
|
|
324
324
|
id?: undefined;
|
|
325
|
-
provider?: undefined;
|
|
326
325
|
providers: {
|
|
327
326
|
id: string;
|
|
328
327
|
label: string;
|
|
@@ -333,6 +332,7 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
333
332
|
updatedAt: number;
|
|
334
333
|
}[];
|
|
335
334
|
count: number;
|
|
335
|
+
provider?: undefined;
|
|
336
336
|
found?: undefined;
|
|
337
337
|
registered?: undefined;
|
|
338
338
|
label?: undefined;
|
|
@@ -349,18 +349,18 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
349
349
|
message?: undefined;
|
|
350
350
|
} | {
|
|
351
351
|
deleted?: undefined;
|
|
352
|
-
provider?: undefined;
|
|
353
352
|
count?: undefined;
|
|
354
353
|
providers?: undefined;
|
|
354
|
+
provider?: undefined;
|
|
355
355
|
found: boolean;
|
|
356
356
|
id: string;
|
|
357
357
|
registered?: undefined;
|
|
358
358
|
label?: undefined;
|
|
359
359
|
message?: undefined;
|
|
360
360
|
} | {
|
|
361
|
-
provider?: undefined;
|
|
362
361
|
count?: undefined;
|
|
363
362
|
providers?: undefined;
|
|
363
|
+
provider?: undefined;
|
|
364
364
|
found?: undefined;
|
|
365
365
|
deleted: boolean;
|
|
366
366
|
id: string;
|
|
@@ -369,9 +369,9 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
|
|
|
369
369
|
message?: undefined;
|
|
370
370
|
} | {
|
|
371
371
|
deleted?: undefined;
|
|
372
|
-
provider?: undefined;
|
|
373
372
|
count?: undefined;
|
|
374
373
|
providers?: undefined;
|
|
374
|
+
provider?: undefined;
|
|
375
375
|
found?: undefined;
|
|
376
376
|
registered: boolean;
|
|
377
377
|
id: string;
|
|
@@ -51,8 +51,8 @@ export declare function handleGetResource(event: any): Promise<Response | {
|
|
|
51
51
|
revision: string;
|
|
52
52
|
})>;
|
|
53
53
|
export declare function handleCreateResource(event: any): Promise<{
|
|
54
|
-
errorCode?: undefined;
|
|
55
54
|
details?: undefined;
|
|
55
|
+
errorCode?: undefined;
|
|
56
56
|
error: string;
|
|
57
57
|
} | {
|
|
58
58
|
error: string;
|
|
@@ -62,8 +62,8 @@ export declare function handleCreateResource(event: any): Promise<{
|
|
|
62
62
|
revision: string;
|
|
63
63
|
})>;
|
|
64
64
|
export declare function handleUpdateResource(event: any): Promise<{
|
|
65
|
-
errorCode?: undefined;
|
|
66
65
|
details?: undefined;
|
|
66
|
+
errorCode?: undefined;
|
|
67
67
|
error: string;
|
|
68
68
|
} | {
|
|
69
69
|
error: string;
|
|
@@ -80,8 +80,8 @@ export declare function handleDeleteResource(event: any): Promise<{
|
|
|
80
80
|
ok: boolean;
|
|
81
81
|
}>;
|
|
82
82
|
export declare function handleUploadResource(event: any): Promise<{
|
|
83
|
-
errorCode?: undefined;
|
|
84
83
|
details?: undefined;
|
|
84
|
+
errorCode?: undefined;
|
|
85
85
|
error: string;
|
|
86
86
|
} | {
|
|
87
87
|
error: string;
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -55,8 +55,8 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
|
|
|
55
55
|
errorCode: "secret_managed_elsewhere";
|
|
56
56
|
managedBy: SecretManagedBy;
|
|
57
57
|
} | {
|
|
58
|
-
errorCode?: undefined;
|
|
59
58
|
error: string;
|
|
59
|
+
errorCode?: undefined;
|
|
60
60
|
ok?: undefined;
|
|
61
61
|
status?: undefined;
|
|
62
62
|
} | {
|
|
@@ -67,8 +67,8 @@ export declare function createAgentEngineApiKeyHandler(): import("h3").EventHand
|
|
|
67
67
|
code: ProviderKeyCheckCode;
|
|
68
68
|
} | {
|
|
69
69
|
errorCode?: undefined;
|
|
70
|
-
code?: undefined;
|
|
71
70
|
error?: undefined;
|
|
71
|
+
code?: undefined;
|
|
72
72
|
ok: boolean;
|
|
73
73
|
key: string;
|
|
74
74
|
baseUrlKey?: string | undefined;
|
package/dist/server/csrf.d.ts
CHANGED
|
@@ -42,6 +42,15 @@
|
|
|
42
42
|
* Those are listed in `CSRF_ALLOWLIST_PREFIXES` below; if you add a new
|
|
43
43
|
* cross-origin-callable route, add it there.
|
|
44
44
|
*/
|
|
45
|
+
/**
|
|
46
|
+
* Exempts one exact app `/api/*` path from the CSRF check. No patterns,
|
|
47
|
+
* parameters, prefixes, or trailing slash. Requests to an exempt path reach
|
|
48
|
+
* the handler without cookies or a session, so it must authenticate on the
|
|
49
|
+
* request itself, such as a public ingestion key or a signature. Where the
|
|
50
|
+
* runtime's request headers are immutable, a cookie-carrying request to an
|
|
51
|
+
* exempt path is refused with 403 instead.
|
|
52
|
+
*/
|
|
53
|
+
export declare function registerCsrfExemptPath(path: string): void;
|
|
45
54
|
export declare function createCsrfMiddleware(frameworkPrefix?: string): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, {
|
|
46
55
|
error: string;
|
|
47
56
|
} | undefined>;
|
package/dist/server/csrf.js
CHANGED
|
@@ -98,6 +98,42 @@ const CSRF_ALLOWLIST_PREFIXES = [
|
|
|
98
98
|
"/builder/callback",
|
|
99
99
|
];
|
|
100
100
|
const STATE_CHANGING_METHODS = new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
101
|
+
const CSRF_EXEMPT_API_PATHS = new Set();
|
|
102
|
+
const EXACT_API_PATH = /^\/api(?:\/[A-Za-z0-9._~-]+)+$/;
|
|
103
|
+
/**
|
|
104
|
+
* Exempts one exact app `/api/*` path from the CSRF check. No patterns,
|
|
105
|
+
* parameters, prefixes, or trailing slash. Requests to an exempt path reach
|
|
106
|
+
* the handler without cookies or a session, so it must authenticate on the
|
|
107
|
+
* request itself, such as a public ingestion key or a signature. Where the
|
|
108
|
+
* runtime's request headers are immutable, a cookie-carrying request to an
|
|
109
|
+
* exempt path is refused with 403 instead.
|
|
110
|
+
*/
|
|
111
|
+
export function registerCsrfExemptPath(path) {
|
|
112
|
+
if (!EXACT_API_PATH.test(path) ||
|
|
113
|
+
path.split("/").some((segment) => segment === "." || segment === "..")) {
|
|
114
|
+
throw new Error(`registerCsrfExemptPath: "${path}" must be one exact /api/* path, with no patterns, parameters, or trailing slash.`);
|
|
115
|
+
}
|
|
116
|
+
CSRF_EXEMPT_API_PATHS.add(path);
|
|
117
|
+
}
|
|
118
|
+
function deleteCookieHeader(headers) {
|
|
119
|
+
try {
|
|
120
|
+
headers.delete("cookie");
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
if (error instanceof TypeError)
|
|
124
|
+
return false;
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
return !headers.has("cookie");
|
|
128
|
+
}
|
|
129
|
+
function isCsrfExemptApiPath(pathname) {
|
|
130
|
+
if (CSRF_EXEMPT_API_PATHS.has(pathname))
|
|
131
|
+
return true;
|
|
132
|
+
const basePath = getConfiguredAppBasePath();
|
|
133
|
+
return (Boolean(basePath) &&
|
|
134
|
+
pathname.startsWith(`${basePath}/`) &&
|
|
135
|
+
CSRF_EXEMPT_API_PATHS.has(pathname.slice(basePath.length)));
|
|
136
|
+
}
|
|
101
137
|
function looksFirstParty(event) {
|
|
102
138
|
const sfs = getRequestHeader(event, "sec-fetch-site");
|
|
103
139
|
if (sfs === "same-origin" || sfs === "none") {
|
|
@@ -180,6 +216,16 @@ export function createCsrfMiddleware(frameworkPrefix = "/_agent-native") {
|
|
|
180
216
|
else if (!isTemplateApiPath(pathname)) {
|
|
181
217
|
return undefined;
|
|
182
218
|
}
|
|
219
|
+
else if (isCsrfExemptApiPath(pathname)) {
|
|
220
|
+
if (!requestHasCookies(event))
|
|
221
|
+
return undefined;
|
|
222
|
+
if (deleteCookieHeader(event.req.headers))
|
|
223
|
+
return undefined;
|
|
224
|
+
setResponseStatus(event, 403);
|
|
225
|
+
return {
|
|
226
|
+
error: 'CSRF check failed: this route accepts no cookies, and this runtime could not remove them. Send the request with credentials: "omit".',
|
|
227
|
+
};
|
|
228
|
+
}
|
|
183
229
|
if (!requestHasCookies(event))
|
|
184
230
|
return undefined;
|
|
185
231
|
if (looksFirstParty(event))
|
|
@@ -32,8 +32,8 @@ export declare function createFirstTouchHandler(): import("h3").EventHandlerWith
|
|
|
32
32
|
reason: "expired";
|
|
33
33
|
firstTouch?: undefined;
|
|
34
34
|
} | {
|
|
35
|
-
error?: undefined;
|
|
36
35
|
reason?: undefined;
|
|
36
|
+
error?: undefined;
|
|
37
37
|
stored: true;
|
|
38
38
|
firstTouch: FirstTouchAttribution;
|
|
39
39
|
}>>;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -135,6 +135,7 @@ export { scheduledTriggerAvailability, type ScheduledTriggerAvailability, } from
|
|
|
135
135
|
export { getAppProductionUrl, getFirstPartyProdUrl, resolveAppRuntimeUrl, } from "./app-url.js";
|
|
136
136
|
export { getForwardedRequestOrigin, getForwardedRequestURL, } from "./request-origin.js";
|
|
137
137
|
export { getConfiguredAppBasePath, normalizeAppBasePath, withConfiguredAppBasePath, } from "./app-base-path.js";
|
|
138
|
+
export { registerCsrfExemptPath } from "./csrf.js";
|
|
138
139
|
export { signShortLivedToken, verifyShortLivedToken, type ShortLivedTokenClaims, type ShortLivedTokenKeyOptions, type VerifyResult as ShortLivedTokenVerifyResult, } from "./short-lived-token.js";
|
|
139
140
|
export { AGENT_ACCESS_PARAM, DEFAULT_AGENT_ACCESS_TTL_SECONDS, appendAgentAccessParam, buildAgentAccessApiUrl, buildAgentAccessUrl, createScopedAgentAccessGrant, normalizeAgentAccessBasePath, normalizeAgentAccessOrigin, scopedAgentAccessResourceId, signScopedAgentAccessToken, toAgentAccessUrl, verifyScopedAgentAccessToken, type AgentAccessApiUrlOptions, type AgentAccessResourceScope, type AgentAccessUrlOptions, type ScopedAgentAccessGrant, type ScopedAgentAccessTokenOptions, } from "./agent-access.js";
|
|
140
141
|
export { AGENT_READABLE_RESOURCE_PAYLOAD_TYPE, AGENT_READABLE_RESOURCE_SCRIPT_TYPE, buildAgentReadableResourceDiscovery, renderAgentReadableResourceDiscoveryScript, safeJsonForHtml, type AgentReadableResourceDiscovery, type BuildAgentReadableResourceDiscoveryOptions, } from "../shared/agent-readable-resource.js";
|
package/dist/server/index.js
CHANGED
|
@@ -128,6 +128,7 @@ export { scheduledTriggerAvailability, } from "./agent-chat/recurring-jobs-runti
|
|
|
128
128
|
export { getAppProductionUrl, getFirstPartyProdUrl, resolveAppRuntimeUrl, } from "./app-url.js";
|
|
129
129
|
export { getForwardedRequestOrigin, getForwardedRequestURL, } from "./request-origin.js";
|
|
130
130
|
export { getConfiguredAppBasePath, normalizeAppBasePath, withConfiguredAppBasePath, } from "./app-base-path.js";
|
|
131
|
+
export { registerCsrfExemptPath } from "./csrf.js";
|
|
131
132
|
export { signShortLivedToken, verifyShortLivedToken, } from "./short-lived-token.js";
|
|
132
133
|
export { AGENT_ACCESS_PARAM, DEFAULT_AGENT_ACCESS_TTL_SECONDS, appendAgentAccessParam, buildAgentAccessApiUrl, buildAgentAccessUrl, createScopedAgentAccessGrant, normalizeAgentAccessBasePath, normalizeAgentAccessOrigin, scopedAgentAccessResourceId, signScopedAgentAccessToken, toAgentAccessUrl, verifyScopedAgentAccessToken, } from "./agent-access.js";
|
|
133
134
|
export { AGENT_READABLE_RESOURCE_PAYLOAD_TYPE, AGENT_READABLE_RESOURCE_SCRIPT_TYPE, buildAgentReadableResourceDiscovery, renderAgentReadableResourceDiscoveryScript, safeJsonForHtml, } from "../shared/agent-readable-resource.js";
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* typed JSON-in / JSON-out).
|
|
18
18
|
*/
|
|
19
19
|
export declare function createTranscribeVoiceHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
20
|
-
text?: undefined;
|
|
21
20
|
error: string;
|
|
21
|
+
text?: undefined;
|
|
22
22
|
} | {
|
|
23
23
|
error?: undefined;
|
|
24
24
|
text: string;
|
|
@@ -17,8 +17,10 @@ function tagEndIndex(html, start) {
|
|
|
17
17
|
}
|
|
18
18
|
return -1;
|
|
19
19
|
}
|
|
20
|
+
const TAG_NAME = /[A-Za-z][\w:-]*/y;
|
|
20
21
|
function tagNameAt(html, start) {
|
|
21
|
-
|
|
22
|
+
TAG_NAME.lastIndex = start;
|
|
23
|
+
const match = TAG_NAME.exec(html);
|
|
22
24
|
return match?.[0]?.toLowerCase() ?? null;
|
|
23
25
|
}
|
|
24
26
|
function rawTextCloseIndex(html, tag, start) {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@agent-native/toolkit": "workspace:*",
|
|
22
22
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
23
23
|
"@ai-sdk/cohere": "^3.0.39",
|
|
24
|
-
"@ai-sdk/google": "^3.0.
|
|
24
|
+
"@ai-sdk/google": "^3.0.152",
|
|
25
25
|
"@ai-sdk/groq": "^3.0.35",
|
|
26
26
|
"@ai-sdk/mistral": "^3.0.40",
|
|
27
27
|
"@ai-sdk/openai": "^3.0.53",
|
package/dist/testing.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { createGetDb } from "./db/create-get-db.js";
|
|
|
2
2
|
export { AGENT_PATH_PROVIDERS, conformanceMcpConfig, DIRECTORY_PROFILE_MODULE, listAgentToolSchemas, listMcpCatalogTools, loadTemplateDirectoryProfile, loadTemplateMcpActions, loadTemplateMcpConformance, MCP_CATALOG_MODES, PROVIDER_SCHEMA_RULES, providerSchemaViolations, SCHEMA_PROVIDERS, templateMcpCatalogModes, type AgentToolSchema, type McpCatalogMode, type McpDirectoryProfileFixture, type ProviderRuleBasis, type ProviderSchemaRule, type ProviderSchemaViolation, type SchemaProvider, type TemplateMcpConformance, } from "./mcp/provider-schema-conformance.js";
|
|
3
3
|
export { startLocalPlanBridge } from "./cli/plan-local.js";
|
|
4
4
|
export { readDevActionDiscoveryFile } from "./server/dev-action-discovery.js";
|
|
5
|
+
export { createCsrfMiddleware } from "./server/csrf.js";
|
|
5
6
|
export { prepareDesignConnectManifest, startDesignConnectBridge, type DesignConnectBridge, } from "./cli/design-connect.js";
|
|
6
7
|
export { assertNoInlineImageBytes } from "./shared/inline-bytes.js";
|
|
7
8
|
export { createMemorySearchVectorStore, type MemorySearchVectorStore, } from "./search/memory-vector-store.js";
|
package/dist/testing.js
CHANGED
|
@@ -2,6 +2,7 @@ export { createGetDb } from "./db/create-get-db.js";
|
|
|
2
2
|
export { AGENT_PATH_PROVIDERS, conformanceMcpConfig, DIRECTORY_PROFILE_MODULE, listAgentToolSchemas, listMcpCatalogTools, loadTemplateDirectoryProfile, loadTemplateMcpActions, loadTemplateMcpConformance, MCP_CATALOG_MODES, PROVIDER_SCHEMA_RULES, providerSchemaViolations, SCHEMA_PROVIDERS, templateMcpCatalogModes, } from "./mcp/provider-schema-conformance.js";
|
|
3
3
|
export { startLocalPlanBridge } from "./cli/plan-local.js";
|
|
4
4
|
export { readDevActionDiscoveryFile } from "./server/dev-action-discovery.js";
|
|
5
|
+
export { createCsrfMiddleware } from "./server/csrf.js";
|
|
5
6
|
export { prepareDesignConnectManifest, startDesignConnectBridge, } from "./cli/design-connect.js";
|
|
6
7
|
export { assertNoInlineImageBytes } from "./shared/inline-bytes.js";
|
|
7
8
|
export { createMemorySearchVectorStore, } from "./search/memory-vector-store.js";
|
|
@@ -67,7 +67,6 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
67
67
|
triggerType: "event" | "manual" | "schedule" | "webhook";
|
|
68
68
|
body: string;
|
|
69
69
|
}, {
|
|
70
|
-
deleted?: undefined;
|
|
71
70
|
created: boolean;
|
|
72
71
|
resourceId: string;
|
|
73
72
|
name: string;
|
|
@@ -88,6 +87,7 @@ declare const _default: import("../../action.js").ActionDefinition<{
|
|
|
88
87
|
executionCwd: string | null;
|
|
89
88
|
mcpTools: string[];
|
|
90
89
|
webhookPath: string | null;
|
|
90
|
+
deleted?: undefined;
|
|
91
91
|
updated?: undefined;
|
|
92
92
|
changed?: undefined;
|
|
93
93
|
previouslyEnabled?: 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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.237.0-nightly-20261201010026",
|
|
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": {
|
|
@@ -594,6 +594,7 @@
|
|
|
594
594
|
"./client/agent-loop-settings": "./dist/client/agent-loop-settings.js",
|
|
595
595
|
"./client/agent-native-version": "./dist/client/agent-native-version.js",
|
|
596
596
|
"./client/agent-provider-catalog": "./dist/client/agent-provider-catalog.js",
|
|
597
|
+
"./client/analytics-beacon": "./dist/client/analytics-beacon.js",
|
|
597
598
|
"./client/api-surface": "./dist/client/api-surface.js",
|
|
598
599
|
"./client/app-config": "./dist/client/app-config.js",
|
|
599
600
|
"./client/app-model-default": "./dist/client/app-model-default.js",
|
|
@@ -833,12 +834,12 @@
|
|
|
833
834
|
"yjs": "^13.6.33",
|
|
834
835
|
"zod": "^4.3.6",
|
|
835
836
|
"@agent-native/actions": "^0.1.1",
|
|
836
|
-
"@agent-native/agentkit": "^0.
|
|
837
|
+
"@agent-native/agentkit": "^0.237.0-nightly-20261201010026",
|
|
837
838
|
"@agent-native/recap-cli": "^0.5.112"
|
|
838
839
|
},
|
|
839
840
|
"devDependencies": {
|
|
840
841
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
841
|
-
"@ai-sdk/google": "^3.0.
|
|
842
|
+
"@ai-sdk/google": "^3.0.152",
|
|
842
843
|
"@ai-sdk/groq": "^3.0.35",
|
|
843
844
|
"@ai-sdk/openai": "^3.0.53",
|
|
844
845
|
"@amplitude/analytics-browser": "2.45.8",
|
|
@@ -908,10 +909,10 @@
|
|
|
908
909
|
"xlsx": "^0.18.5"
|
|
909
910
|
},
|
|
910
911
|
"peerDependencies": {
|
|
911
|
-
"@agent-native/core-corpus": "
|
|
912
|
+
"@agent-native/core-corpus": "0.237.0-nightly-20261201010026",
|
|
912
913
|
"@ai-sdk/anthropic": ">=3",
|
|
913
914
|
"@ai-sdk/cohere": ">=3",
|
|
914
|
-
"@ai-sdk/google": ">=3",
|
|
915
|
+
"@ai-sdk/google": ">=3.0.152",
|
|
915
916
|
"@ai-sdk/groq": ">=3",
|
|
916
917
|
"@ai-sdk/mistral": ">=3",
|
|
917
918
|
"@ai-sdk/openai": ">=3",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@agent-native/toolkit": "workspace:*",
|
|
22
22
|
"@ai-sdk/anthropic": "^3.0.71",
|
|
23
23
|
"@ai-sdk/cohere": "^3.0.39",
|
|
24
|
-
"@ai-sdk/google": "^3.0.
|
|
24
|
+
"@ai-sdk/google": "^3.0.152",
|
|
25
25
|
"@ai-sdk/groq": "^3.0.35",
|
|
26
26
|
"@ai-sdk/mistral": "^3.0.40",
|
|
27
27
|
"@ai-sdk/openai": "^3.0.53",
|