@agent-native/core 0.0.0-beta-20260820094341 → 0.0.0-beta-20260820115430
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/templates/clips/netlify.toml +1 -1
- package/corpus/templates/slides/app/components/editor/NewDeckReferenceStep.tsx +36 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +1 -0
- package/corpus/templates/slides/app/pages/Index.tsx +1 -0
- package/dist/agent/engine/ai-sdk-engine.js +13 -2
- package/dist/agent/engine/anthropic-engine.js +14 -5
- package/dist/agent/engine/builder-engine.js +12 -2
- package/dist/agent/observational-memory/internal-run.js +5 -0
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/resources/handlers.d.ts +2 -2
- package/dist/secrets/routes.d.ts +3 -3
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/shared/reasoning-effort.d.ts +16 -0
- package/dist/shared/reasoning-effort.js +41 -0
- package/package.json +3 -3
|
@@ -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) {
|
package/dist/collab/routes.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
|
|
|
26
26
|
* Body: { update: string (base64), requestSource?: string }
|
|
27
27
|
*/
|
|
28
28
|
export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
29
|
-
ok?: undefined;
|
|
30
29
|
error: string;
|
|
30
|
+
ok?: undefined;
|
|
31
31
|
} | {
|
|
32
32
|
error?: undefined;
|
|
33
33
|
ok: boolean;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
|
|
14
14
|
*/
|
|
15
15
|
export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
16
|
-
ok?: undefined;
|
|
17
16
|
error: string;
|
|
17
|
+
ok?: undefined;
|
|
18
18
|
} | {
|
|
19
19
|
error?: undefined;
|
|
20
20
|
ok: boolean;
|
|
@@ -51,8 +51,8 @@ export declare function handleDeleteResource(event: any): Promise<{
|
|
|
51
51
|
error: string;
|
|
52
52
|
ok?: undefined;
|
|
53
53
|
} | {
|
|
54
|
-
error?: undefined;
|
|
55
54
|
ok: boolean;
|
|
55
|
+
error?: undefined;
|
|
56
56
|
}>;
|
|
57
57
|
/** POST /_agent-native/resources/upload — upload a file as a resource */
|
|
58
58
|
export declare function handleUploadResource(event: any): Promise<import("./store.js").Resource | {
|
|
@@ -73,10 +73,10 @@ export declare function handleUploadResource(event: any): Promise<import("./stor
|
|
|
73
73
|
runId: string | null;
|
|
74
74
|
expiresAt: number | null;
|
|
75
75
|
metadata: string | null;
|
|
76
|
-
error?: undefined;
|
|
77
76
|
url: string;
|
|
78
77
|
provider: string;
|
|
79
78
|
storageSetupRequired?: undefined;
|
|
79
|
+
error?: undefined;
|
|
80
80
|
} | {
|
|
81
81
|
error: string;
|
|
82
82
|
storageSetupRequired: boolean;
|
package/dist/secrets/routes.d.ts
CHANGED
|
@@ -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 {};
|
|
@@ -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-
|
|
3
|
+
"version": "0.0.0-beta-20260820115430",
|
|
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/
|
|
431
|
-
"@agent-native/
|
|
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",
|