@agent-native/core 0.164.24 → 0.164.25

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.
@@ -1,6 +1,6 @@
1
1
  [build]
2
2
  ignore = "node ./scripts/netlify-ignore-build.mjs clips"
3
- command = "export DATABASE_URL=${NETLIFY_DATABASE_URL:-$DATABASE_URL} && pnpm install && NITRO_PRESET=netlify pnpm --filter clips build && pnpm exec tsx templates/clips/jobs/emit-netlify-brain-export-cron.ts && if [ \"${CONTEXT:-}\" = \"production\" ]; then pnpm --filter clips migrate:production; fi"
3
+ command = "export DATABASE_URL=${NETLIFY_DATABASE_URL:-$DATABASE_URL} && if [ \"${agentNativePrebuiltBuild:-}\" = \"true\" ]; then export DATABASE_URL=\"${agentNativePrebuiltDatabaseUrl:?}\" BETTER_AUTH_SECRET=\"${agentNativePrebuiltAuthSecret:?}\"; fi && pnpm install && NITRO_PRESET=netlify pnpm --filter clips build && pnpm exec tsx templates/clips/jobs/emit-netlify-brain-export-cron.ts && if [ \"${CONTEXT:-}\" = \"production\" ] && [ \"${agentNativePrebuiltBuild:-}\" != \"true\" ]; then pnpm --filter clips migrate:production; fi"
4
4
  publish = "templates/clips/dist"
5
5
  functions = "templates/clips/.netlify/functions-internal"
6
6
 
@@ -7,6 +7,7 @@ import {
7
7
  IconChevronDown,
8
8
  IconFileText,
9
9
  IconFileTypePdf,
10
+ IconPaperclip,
10
11
  IconPresentation,
11
12
  IconWorld,
12
13
  } from "@tabler/icons-react";
@@ -40,6 +41,16 @@ import { sortDecksByRecency } from "@/lib/deck-sorting";
40
41
  import { cn } from "@/lib/utils";
41
42
 
42
43
  import { GoogleDriveConnectionCta } from "./GoogleDriveConnectionCta";
44
+ import type { UploadedFile } from "./PromptDialog";
45
+
46
+ const promptFileIcons: Record<string, typeof IconPaperclip> = {
47
+ pdf: IconFileTypePdf,
48
+ ppt: IconPresentation,
49
+ pptx: IconPresentation,
50
+ doc: IconFileText,
51
+ docx: IconFileText,
52
+ txt: IconFileText,
53
+ };
43
54
 
44
55
  export interface NewDeckReferenceSelection {
45
56
  designSystemId?: string | null;
@@ -88,6 +99,7 @@ interface NewDeckReferenceStepProps {
88
99
  skipLabel: string;
89
100
  searchDecksLabel: string;
90
101
  promptSummary?: string;
102
+ promptFiles?: UploadedFile[];
91
103
  }
92
104
 
93
105
  export function NewDeckReferenceStep({
@@ -110,6 +122,7 @@ export function NewDeckReferenceStep({
110
122
  skipLabel,
111
123
  searchDecksLabel,
112
124
  promptSummary,
125
+ promptFiles,
113
126
  }: NewDeckReferenceStepProps) {
114
127
  const t = useT();
115
128
  const [selectedDesignSystemId, setSelectedDesignSystemId] = useState<
@@ -238,6 +251,29 @@ export function NewDeckReferenceStep({
238
251
  “{promptSummary.trim()}”
239
252
  </p>
240
253
  )}
254
+ {promptFiles && promptFiles.length > 0 && (
255
+ <div className="mt-4">
256
+ <span className="text-xs font-medium text-muted-foreground">
257
+ {t("home.attachedFiles")}
258
+ </span>
259
+ <ul className="mt-2 flex flex-wrap gap-2">
260
+ {promptFiles.map((file) => {
261
+ const extension =
262
+ file.originalName.toLowerCase().split(".").pop() ?? "";
263
+ const FileIcon = promptFileIcons[extension] ?? IconPaperclip;
264
+ return (
265
+ <li
266
+ key={file.path}
267
+ className="flex max-w-full items-center gap-2 rounded-md border border-border bg-muted/40 px-2.5 py-1.5 text-sm"
268
+ >
269
+ <FileIcon className="size-4 shrink-0 text-muted-foreground" />
270
+ <span className="truncate">{file.originalName}</span>
271
+ </li>
272
+ );
273
+ })}
274
+ </ul>
275
+ </div>
276
+ )}
241
277
 
242
278
  <div className="mt-10 space-y-6">
243
279
  <div className="grid gap-2">
@@ -744,6 +744,7 @@ const messages = {
744
744
  chooseReferences: "Choose references",
745
745
  addDesignSystem: "+ Design system",
746
746
  importFrom: "Import from",
747
+ attachedFiles: "Attached",
747
748
  imported: "Imported",
748
749
  importedReferenceDeck: "Imported reference deck",
749
750
  referenceImportSuccess: "Imported successfully",
@@ -1570,6 +1570,7 @@ export default function Index() {
1570
1570
  skipLabel={t("home.referenceDeckNone")}
1571
1571
  searchDecksLabel={t("root.searchDecks")}
1572
1572
  promptSummary={pendingDeck?.prompt}
1573
+ promptFiles={pendingDeck?.files}
1573
1574
  />
1574
1575
 
1575
1576
  {/* Sign-in required to create a deck. Shown when an unauthenticated
@@ -12,7 +12,7 @@
12
12
  * so the core package remains installable without the AI SDK.
13
13
  */
14
14
  import { clearProviderCredentialAuthFailure, readDeployCredentialEnv, recordProviderCredentialAuthFailure, } from "../../server/credential-provider.js";
15
- import { anthropicManualThinkingBudget, normalizeReasoningEffortForModel, supportsClaudeAdaptiveThinking, } from "../../shared/reasoning-effort.js";
15
+ import { allowsSamplingParams, anthropicManualThinkingBudget, normalizeReasoningEffortForModel, supportsClaudeAdaptiveThinking, } from "../../shared/reasoning-effort.js";
16
16
  import { AI_SDK_MODEL_CONFIG } from "../model-config.js";
17
17
  import { LLM_MISSING_CREDENTIALS_ERROR_CODE, LLM_MISSING_CREDENTIALS_MESSAGE, } from "./credential-errors.js";
18
18
  import { classifyProviderError, describeErrorWithCauses, } from "./error-detail.js";
@@ -351,6 +351,17 @@ class AISDKEngine {
351
351
  };
352
352
  }
353
353
  }
354
+ // Thinking and temperature cannot travel together on Anthropic: any value
355
+ // but 1 is rejected once thinking is on, and the Opus 4.7+ / Sonnet 5
356
+ // families removed the sampling parameters outright. Effort defaults to
357
+ // High on every reasoning-capable Claude model, so a caller that only asked
358
+ // for `temperature: 0` was building a request the API always 400s.
359
+ const samplingAllowed = allowsSamplingParams({
360
+ model: opts.model,
361
+ thinkingEnabled: this.provider === "anthropic" &&
362
+ Boolean(providerOpts.anthropic
363
+ ?.thinking),
364
+ });
354
365
  let assistantContent = [];
355
366
  const firstEventAbort = createFirstEventAbortController(opts.abortSignal);
356
367
  const toolInputs = createStreamedToolInputState();
@@ -365,7 +376,7 @@ class AISDKEngine {
365
376
  // backoff. Leaving the SDK on its default (2) multiplies the two retry
366
377
  // layers into ~12 HTTP requests per failed run.
367
378
  maxRetries: 1,
368
- ...(opts.temperature !== undefined
379
+ ...(samplingAllowed && opts.temperature !== undefined
369
380
  ? { temperature: opts.temperature }
370
381
  : {}),
371
382
  abortSignal: firstEventAbort.signal,
@@ -8,7 +8,7 @@
8
8
  * All providerOptions.anthropic fields are forwarded directly to the SDK.
9
9
  */
10
10
  import { clearProviderCredentialAuthFailure, readDeployCredentialEnv, recordProviderCredentialAuthFailure, } from "../../server/credential-provider.js";
11
- import { anthropicManualThinkingBudget, normalizeReasoningEffortForModel, supportsClaudeAdaptiveThinking, } from "../../shared/reasoning-effort.js";
11
+ import { allowsSamplingParams, anthropicManualThinkingBudget, normalizeReasoningEffortForModel, supportsClaudeAdaptiveThinking, } from "../../shared/reasoning-effort.js";
12
12
  import { ANTHROPIC_MODEL_CONFIG } from "../model-config.js";
13
13
  import { LLM_MISSING_CREDENTIALS_ERROR_CODE, LLM_MISSING_CREDENTIALS_MESSAGE, } from "./credential-errors.js";
14
14
  import { describeErrorWithCauses } from "./error-detail.js";
@@ -62,9 +62,6 @@ class AnthropicEngine {
62
62
  : anthropicOpts.thinking.budgetTokens,
63
63
  };
64
64
  }
65
- if (anthropicOpts?.topK !== undefined) {
66
- extra.top_k = anthropicOpts.topK;
67
- }
68
65
  const reasoningEffort = normalizeReasoningEffortForModel(opts.model, opts.reasoningEffort);
69
66
  if (reasoningEffort && !extra.thinking) {
70
67
  if (supportsClaudeAdaptiveThinking(opts.model)) {
@@ -78,6 +75,18 @@ class AnthropicEngine {
78
75
  }
79
76
  }
80
77
  }
78
+ // Thinking and the sampling parameters cannot travel together: Anthropic
79
+ // rejects any temperature but 1 once thinking is on, and the Opus 4.7+ /
80
+ // Sonnet 5 families removed temperature/top_k outright. Effort defaults to
81
+ // High on every reasoning-capable Claude model, so a caller that only asked
82
+ // for `temperature: 0` was building a request the API always 400s.
83
+ const samplingAllowed = allowsSamplingParams({
84
+ model: opts.model,
85
+ thinkingEnabled: Boolean(extra.thinking),
86
+ });
87
+ if (samplingAllowed && anthropicOpts?.topK !== undefined) {
88
+ extra.top_k = anthropicOpts.topK;
89
+ }
81
90
  // Apply prompt caching to the system prompt and tools by default.
82
91
  // Cache is pure upside: identical prefixes on subsequent turns get ~90%
83
92
  // off input cost and much faster time-to-first-token. If the prefix
@@ -138,7 +147,7 @@ class AnthropicEngine {
138
147
  system: systemBlocks,
139
148
  tools: cachedTools.length > 0 ? cachedTools : undefined,
140
149
  messages: cachedMessages,
141
- ...(opts.temperature !== undefined
150
+ ...(samplingAllowed && opts.temperature !== undefined
142
151
  ? { temperature: opts.temperature }
143
152
  : {}),
144
153
  ...extra,
@@ -20,7 +20,7 @@ import { captureError } from "../../server/capture-error.js";
20
20
  import { clearBuilderGatewayAuthFailure, isBuilderGatewayDeployConfigured, resolveBuilderGatewayCredentialsDetailed, getBuilderGatewayBaseUrl, recordBuilderGatewayAuthFailure, } from "../../server/credential-provider.js";
21
21
  import { getRequestUserEmail } from "../../server/request-context.js";
22
22
  import { applyBuilderUtmTrackingParams } from "../../shared/builder-link-tracking.js";
23
- import { isGPTReasoningModel, normalizeReasoningEffortForModel, } from "../../shared/reasoning-effort.js";
23
+ import { allowsSamplingParams, isGPTReasoningModel, normalizeReasoningEffortForModel, } from "../../shared/reasoning-effort.js";
24
24
  import { isInBackgroundFunctionRuntime } from "../durable-background.js";
25
25
  import { BUILDER_MODEL_CONFIG } from "../model-config.js";
26
26
  import { getBuilderGatewayRequestHeaders } from "./builder-gateway-headers.js";
@@ -235,6 +235,16 @@ class BuilderEngine {
235
235
  }
236
236
  }
237
237
  }
238
+ // The gateway turns `reasoning_effort` into Anthropic thinking on the
239
+ // Claude lane, and Anthropic rejects any temperature but 1 once thinking is
240
+ // on — the Opus 4.7+ / Sonnet 5 families reject the sampling parameters
241
+ // outright. Effort defaults to High for every reasoning-capable Claude
242
+ // model, so a caller that only asked for `temperature: 0` was building a
243
+ // request that always 400s. GPT and Gemini lanes keep their temperature.
244
+ const samplingAllowed = allowsSamplingParams({
245
+ model,
246
+ thinkingEnabled: Boolean(reasoningEffort) && /claude/i.test(model),
247
+ });
238
248
  const gptToolsRequireExplicitNoReasoning = cachedTools.length > 0 && isGPTReasoningModel(model);
239
249
  const body = {
240
250
  model,
@@ -242,7 +252,7 @@ class BuilderEngine {
242
252
  ...(systemValue !== undefined ? { system: systemValue } : {}),
243
253
  ...(cachedTools.length > 0 ? { tools: cachedTools } : {}),
244
254
  max_tokens: resolveMaxOutputTokensForEngine(this.name, opts.maxOutputTokens, model),
245
- ...(typeof opts.temperature === "number"
255
+ ...(samplingAllowed && typeof opts.temperature === "number"
246
256
  ? { temperature: opts.temperature }
247
257
  : {}),
248
258
  // OpenAI rejects `reasoning_effort` alongside function tools on Chat
@@ -43,6 +43,11 @@ export async function runInternalAgentCall(options) {
43
43
  tools: [],
44
44
  abortSignal: signal,
45
45
  maxOutputTokens: options.maxOutputTokens ?? 4_000,
46
+ // Thinking shares the small output budget above, and the engine defaults
47
+ // effort to High: at High a compaction pass can spend the whole budget
48
+ // reasoning and return no text, which the Observer reads as "nothing to
49
+ // observe". Compression does not need the ladder.
50
+ reasoningEffort: "low",
46
51
  temperature: 0,
47
52
  });
48
53
  for await (const event of stream) {
@@ -137,13 +137,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
137
137
  inputSchema: {
138
138
  type: string;
139
139
  properties: {
140
- count?: undefined;
141
140
  query?: undefined;
142
141
  minutes?: undefined;
143
142
  limit?: undefined;
144
143
  clientHint?: undefined;
145
144
  timestamp?: undefined;
146
145
  chapterId?: undefined;
146
+ count?: undefined;
147
147
  startAt?: undefined;
148
148
  endAt?: undefined;
149
149
  reason?: undefined;
@@ -159,7 +159,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
159
159
  inputSchema: {
160
160
  type: string;
161
161
  properties: {
162
- count?: undefined;
163
162
  query: {
164
163
  type: string;
165
164
  description: string;
@@ -175,6 +174,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
175
174
  clientHint?: undefined;
176
175
  timestamp?: undefined;
177
176
  chapterId?: undefined;
177
+ count?: undefined;
178
178
  startAt?: undefined;
179
179
  endAt?: undefined;
180
180
  reason?: undefined;
@@ -190,7 +190,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
190
190
  inputSchema: {
191
191
  type: string;
192
192
  properties: {
193
- count?: undefined;
194
193
  minutes: {
195
194
  type: string;
196
195
  description: string;
@@ -200,6 +199,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
200
199
  clientHint?: undefined;
201
200
  timestamp?: undefined;
202
201
  chapterId?: undefined;
202
+ count?: undefined;
203
203
  startAt?: undefined;
204
204
  endAt?: undefined;
205
205
  reason?: undefined;
@@ -216,7 +216,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
216
216
  type: string;
217
217
  required: string[];
218
218
  properties: {
219
- count?: undefined;
220
219
  query: {
221
220
  type: string;
222
221
  description: string;
@@ -235,6 +234,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
235
234
  };
236
235
  timestamp?: undefined;
237
236
  chapterId?: undefined;
237
+ count?: undefined;
238
238
  startAt?: undefined;
239
239
  endAt?: undefined;
240
240
  reason?: undefined;
@@ -250,7 +250,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
250
250
  type: string;
251
251
  required: string[];
252
252
  properties: {
253
- count?: undefined;
254
253
  query?: undefined;
255
254
  minutes?: undefined;
256
255
  limit?: undefined;
@@ -264,6 +263,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
264
263
  description: string;
265
264
  };
266
265
  chapterId?: undefined;
266
+ count?: undefined;
267
267
  startAt?: undefined;
268
268
  endAt?: undefined;
269
269
  includeMicrophone?: undefined;
@@ -314,13 +314,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
314
314
  type: string;
315
315
  required: string[];
316
316
  properties: {
317
- count?: undefined;
318
317
  query?: undefined;
319
318
  minutes?: undefined;
320
319
  limit?: undefined;
321
320
  clientHint?: undefined;
322
321
  timestamp?: undefined;
323
322
  chapterId?: undefined;
323
+ count?: undefined;
324
324
  startAt: {
325
325
  type: string;
326
326
  description: string;
@@ -349,13 +349,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
349
349
  type: string;
350
350
  required: string[];
351
351
  properties: {
352
- count?: undefined;
353
352
  query?: undefined;
354
353
  minutes?: undefined;
355
354
  limit?: undefined;
356
355
  clientHint?: undefined;
357
356
  timestamp?: undefined;
358
357
  chapterId?: undefined;
358
+ count?: undefined;
359
359
  startAt?: undefined;
360
360
  endAt?: undefined;
361
361
  reason?: undefined;
@@ -16,18 +16,18 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
16
16
  error?: undefined;
17
17
  ok?: undefined;
18
18
  } | {
19
- count?: undefined;
20
19
  updated: number;
21
20
  error?: undefined;
22
21
  ok?: undefined;
23
- } | {
24
22
  count?: undefined;
23
+ } | {
25
24
  updated?: undefined;
26
25
  error: string;
27
26
  ok?: undefined;
28
- } | {
29
27
  count?: undefined;
28
+ } | {
30
29
  updated?: undefined;
31
30
  error?: undefined;
32
31
  ok: boolean;
32
+ count?: undefined;
33
33
  }>>;
@@ -41,23 +41,23 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
- ok?: undefined;
45
44
  error?: undefined;
46
45
  summary: import("./types.js").TraceSummary;
47
46
  spans: import("./types.js").TraceSpan[];
48
47
  id?: undefined;
49
- } | {
50
48
  ok?: undefined;
49
+ } | {
51
50
  error?: undefined;
52
51
  summary?: undefined;
53
52
  spans?: undefined;
54
53
  id: string;
55
- } | {
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
62
  error?: undefined;
63
63
  summary?: undefined;
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
26
26
  expiresAt?: undefined;
27
27
  ttlSeconds?: undefined;
28
28
  } | {
29
- error?: undefined;
30
29
  token: string;
31
30
  expiresAt: string;
32
31
  ttlSeconds: number;
32
+ error?: undefined;
33
33
  }>>;
@@ -38,3 +38,19 @@ export declare function supportsClaudeAdaptiveThinking(model: string | undefined
38
38
  * models that do not support adaptive thinking (currently Claude Haiku 4.5).
39
39
  */
40
40
  export declare function anthropicManualThinkingBudget(effort: ReasoningEffort): 1024 | 4096 | 8000 | 16000 | 32000;
41
+ /**
42
+ * Whether a request may carry the sampling parameters (`temperature`,
43
+ * `top_p`, `top_k`) at all. Effort resolves to High for every
44
+ * reasoning-capable Claude model, so a caller that asked only for
45
+ * `temperature: 0` — an eval judge, a classifier, the memory compactor — was
46
+ * building a request Anthropic answers with "`temperature` may only be set to
47
+ * 1 when thinking is enabled or in adaptive mode". Thinking is the capability
48
+ * worth keeping; the sampling knobs are what the provider withdrew, so they
49
+ * are dropped once at the engine boundary instead of at every caller. Pass
50
+ * `thinkingEnabled` only for requests that actually carry Anthropic thinking,
51
+ * so other providers keep their sampling controls.
52
+ */
53
+ export declare function allowsSamplingParams(args: {
54
+ model: string | undefined;
55
+ thinkingEnabled: boolean;
56
+ }): boolean;
@@ -194,3 +194,44 @@ function supportsClaudeXHigh(model) {
194
194
  function isGeminiReasoningModel(model) {
195
195
  return /^gemini-/.test(model.toLowerCase().replace(/^google\//, ""));
196
196
  }
197
+ /**
198
+ * Claude dropped the sampling parameters (`temperature`, `top_p`, `top_k`)
199
+ * starting with Opus 4.7 / Opus 5 / Sonnet 5 / Fable 5; sending one there is a
200
+ * 400. Older Claude models still accept them, but only the value 1 once
201
+ * thinking is on.
202
+ */
203
+ function claudeAcceptsSamplingParams(model) {
204
+ const id = model.toLowerCase().replace(/^anthropic\//, "");
205
+ if (id.includes("fable-5") || id.includes("mythos-5"))
206
+ return false;
207
+ if (id.includes("sonnet-5"))
208
+ return false;
209
+ const opusMatch = id.match(/opus-(\d+)(?:[-.](\d+))?/);
210
+ if (opusMatch) {
211
+ const major = parseInt(opusMatch[1], 10);
212
+ if (major >= 5)
213
+ return false;
214
+ const minor = opusMatch[2] ? parseInt(opusMatch[2], 10) : 0;
215
+ return !(major === 4 && minor >= 7);
216
+ }
217
+ return true;
218
+ }
219
+ /**
220
+ * Whether a request may carry the sampling parameters (`temperature`,
221
+ * `top_p`, `top_k`) at all. Effort resolves to High for every
222
+ * reasoning-capable Claude model, so a caller that asked only for
223
+ * `temperature: 0` — an eval judge, a classifier, the memory compactor — was
224
+ * building a request Anthropic answers with "`temperature` may only be set to
225
+ * 1 when thinking is enabled or in adaptive mode". Thinking is the capability
226
+ * worth keeping; the sampling knobs are what the provider withdrew, so they
227
+ * are dropped once at the engine boundary instead of at every caller. Pass
228
+ * `thinkingEnabled` only for requests that actually carry Anthropic thinking,
229
+ * so other providers keep their sampling controls.
230
+ */
231
+ export function allowsSamplingParams(args) {
232
+ if (!args.model)
233
+ return true;
234
+ if (args.thinkingEnabled)
235
+ return false;
236
+ return claudeAcceptsSamplingParams(args.model);
237
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.164.24",
3
+ "version": "0.164.25",
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": {
@@ -427,8 +427,8 @@
427
427
  "y-protocols": "^1.0.7",
428
428
  "yjs": "^13.6.32",
429
429
  "zod": "^4.3.6",
430
- "@agent-native/recap-cli": "0.5.5",
431
- "@agent-native/toolkit": "^0.16.7"
430
+ "@agent-native/toolkit": "^0.16.7",
431
+ "@agent-native/recap-cli": "0.5.5"
432
432
  },
433
433
  "devDependencies": {
434
434
  "@ai-sdk/anthropic": "^3.0.71",