@agent-native/core 0.0.0-beta-20260820094341 → 0.0.0-beta-20260820143516

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
 
@@ -12,3 +12,8 @@ NPM_CONFIG_PRODUCTION = "false"
12
12
 
13
13
  [context.production.environment]
14
14
  AGENT_NATIVE_HOSTED_HARNESS = "true"
15
+ # Macros owns its schema at release time (`migrate:production` above), so
16
+ # production request functions must not probe the database for migrations.
17
+ # Preview functions still run request-path migrations because previews do not
18
+ # run the production release migration step.
19
+ AGENT_NATIVE_RELEASE_MIGRATIONS = "1"
@@ -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) {
@@ -62,11 +62,11 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
62
62
  error: string;
63
63
  states?: undefined;
64
64
  } | {
65
- error?: undefined;
66
65
  states: {
67
66
  clientId: number;
68
67
  state: string;
69
68
  }[];
69
+ error?: undefined;
70
70
  }>>;
71
71
  /**
72
72
  * GET /_agent-native/collab/:docId/users
@@ -77,9 +77,9 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
77
77
  error: string;
78
78
  users?: undefined;
79
79
  } | {
80
- error?: undefined;
81
80
  users: {
82
81
  clientId: number;
83
82
  lastSeen: number;
84
83
  }[];
84
+ error?: undefined;
85
85
  }>>;
@@ -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;
@@ -137,13 +137,13 @@ export declare function screenMemoryMcpToolDefinitions(): ({
137
137
  inputSchema: {
138
138
  type: string;
139
139
  properties: {
140
+ count?: undefined;
140
141
  query?: undefined;
141
142
  minutes?: undefined;
142
143
  limit?: undefined;
143
144
  clientHint?: undefined;
144
145
  timestamp?: undefined;
145
146
  chapterId?: undefined;
146
- count?: undefined;
147
147
  startAt?: undefined;
148
148
  endAt?: undefined;
149
149
  reason?: undefined;
@@ -159,6 +159,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
159
159
  inputSchema: {
160
160
  type: string;
161
161
  properties: {
162
+ count?: undefined;
162
163
  query: {
163
164
  type: string;
164
165
  description: string;
@@ -174,7 +175,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
174
175
  clientHint?: undefined;
175
176
  timestamp?: undefined;
176
177
  chapterId?: undefined;
177
- count?: undefined;
178
178
  startAt?: undefined;
179
179
  endAt?: undefined;
180
180
  reason?: undefined;
@@ -190,6 +190,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
190
190
  inputSchema: {
191
191
  type: string;
192
192
  properties: {
193
+ count?: undefined;
193
194
  minutes: {
194
195
  type: string;
195
196
  description: string;
@@ -199,7 +200,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
199
200
  clientHint?: undefined;
200
201
  timestamp?: undefined;
201
202
  chapterId?: undefined;
202
- count?: undefined;
203
203
  startAt?: undefined;
204
204
  endAt?: undefined;
205
205
  reason?: undefined;
@@ -216,6 +216,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
216
216
  type: string;
217
217
  required: string[];
218
218
  properties: {
219
+ count?: undefined;
219
220
  query: {
220
221
  type: string;
221
222
  description: string;
@@ -234,7 +235,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
234
235
  };
235
236
  timestamp?: undefined;
236
237
  chapterId?: undefined;
237
- count?: undefined;
238
238
  startAt?: undefined;
239
239
  endAt?: undefined;
240
240
  reason?: undefined;
@@ -250,6 +250,7 @@ export declare function screenMemoryMcpToolDefinitions(): ({
250
250
  type: string;
251
251
  required: string[];
252
252
  properties: {
253
+ count?: undefined;
253
254
  query?: undefined;
254
255
  minutes?: undefined;
255
256
  limit?: undefined;
@@ -263,7 +264,6 @@ export declare function screenMemoryMcpToolDefinitions(): ({
263
264
  description: string;
264
265
  };
265
266
  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;
317
318
  query?: undefined;
318
319
  minutes?: undefined;
319
320
  limit?: undefined;
320
321
  clientHint?: undefined;
321
322
  timestamp?: undefined;
322
323
  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;
352
353
  query?: undefined;
353
354
  minutes?: undefined;
354
355
  limit?: undefined;
355
356
  clientHint?: undefined;
356
357
  timestamp?: undefined;
357
358
  chapterId?: undefined;
358
- count?: undefined;
359
359
  startAt?: undefined;
360
360
  endAt?: undefined;
361
361
  reason?: undefined;
@@ -11,23 +11,23 @@
11
11
  * DELETE /_agent-native/notifications/:id — delete
12
12
  */
13
13
  export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
14
- error?: undefined;
15
14
  count: number;
16
15
  updated?: undefined;
17
16
  ok?: undefined;
18
- } | {
19
17
  error?: undefined;
18
+ } | {
19
+ count?: undefined;
20
20
  updated: number;
21
21
  ok?: undefined;
22
- count?: undefined;
22
+ error?: undefined;
23
23
  } | {
24
+ count?: undefined;
24
25
  updated?: undefined;
25
26
  error: string;
26
27
  ok?: undefined;
27
- count?: undefined;
28
28
  } | {
29
- error?: undefined;
29
+ count?: undefined;
30
30
  updated?: undefined;
31
31
  ok: boolean;
32
- count?: undefined;
32
+ error?: undefined;
33
33
  }>>;
@@ -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;
44
46
  summary: import("./types.js").TraceSummary;
45
47
  spans: import("./types.js").TraceSpan[];
46
48
  id?: undefined;
49
+ } | {
47
50
  error?: undefined;
48
51
  ok?: undefined;
49
- } | {
50
52
  summary?: undefined;
51
53
  spans?: undefined;
52
54
  id: string;
53
- error?: undefined;
54
- ok?: undefined;
55
55
  } | {
56
+ ok?: undefined;
56
57
  summary?: undefined;
57
58
  spans?: undefined;
58
59
  id?: undefined;
59
60
  error: any;
60
- ok?: undefined;
61
61
  } | {
62
+ error?: undefined;
62
63
  summary?: undefined;
63
64
  spans?: undefined;
64
65
  id?: undefined;
65
- error?: undefined;
66
66
  ok: boolean;
67
67
  }>>;
@@ -15,6 +15,6 @@ export declare function createProgressHandler(): import("h3").EventHandlerWithFe
15
15
  error: string;
16
16
  ok?: undefined;
17
17
  } | {
18
- ok: boolean;
19
18
  error?: undefined;
19
+ ok: boolean;
20
20
  }>>;
@@ -34,16 +34,16 @@ 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
40
  ok: boolean;
41
41
  status: string;
42
42
  error?: undefined;
43
43
  } | {
44
- ok?: undefined;
45
44
  error: string;
46
45
  removed?: undefined;
46
+ ok?: undefined;
47
47
  } | {
48
48
  ok: boolean;
49
49
  removed: boolean;
@@ -54,9 +54,9 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
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
61
  ok: boolean;
62
62
  note?: undefined;
@@ -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 {};
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
26
26
  expiresAt?: undefined;
27
27
  ttlSeconds?: undefined;
28
28
  } | {
29
+ error?: undefined;
29
30
  token: string;
30
31
  expiresAt: string;
31
32
  ttlSeconds: number;
32
- error?: undefined;
33
33
  }>>;
@@ -20,6 +20,6 @@ export declare function createTranscribeVoiceHandler(): import("h3").EventHandle
20
20
  error: string;
21
21
  text?: undefined;
22
22
  } | {
23
- text: string;
24
23
  error?: undefined;
24
+ text: string;
25
25
  }>>;
@@ -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.0.0-beta-20260820094341",
3
+ "version": "0.0.0-beta-20260820143516",
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/toolkit": "^0.16.7",
431
- "@agent-native/recap-cli": "0.5.5"
430
+ "@agent-native/recap-cli": "0.5.5",
431
+ "@agent-native/toolkit": "^0.16.7"
432
432
  },
433
433
  "devDependencies": {
434
434
  "@ai-sdk/anthropic": "^3.0.71",