veryfront 0.1.201 → 0.1.202

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/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.201",
3
+ "version": "0.1.202",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Framework-default `providerOptions` for known providers.
3
+ *
4
+ * Currently: enable Anthropic extended thinking by default for any
5
+ * Anthropic model, since the `reasoning-*` event surface in this framework
6
+ * relies on the provider-side feature being on. Apps can override or opt
7
+ * out by returning their own `providerOptions.anthropic.thinking` from
8
+ * `AgentConfig.resolveModelTransport`.
9
+ */
10
+ export declare function resolveProviderOptionsWithDefaults(modelString: string, existing: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
11
+ //# sourceMappingURL=default-provider-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-provider-options.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/default-provider-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoBH,wBAAgB,kCAAkC,CAChD,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC5C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAoBrC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Framework-default `providerOptions` for known providers.
3
+ *
4
+ * Currently: enable Anthropic extended thinking by default for any
5
+ * Anthropic model, since the `reasoning-*` event surface in this framework
6
+ * relies on the provider-side feature being on. Apps can override or opt
7
+ * out by returning their own `providerOptions.anthropic.thinking` from
8
+ * `AgentConfig.resolveModelTransport`.
9
+ */
10
+ const VERYFRONT_CLOUD_PREFIX = "veryfront-cloud/";
11
+ const ANTHROPIC_PREFIX = "anthropic/";
12
+ const DEFAULT_ANTHROPIC_THINKING_BUDGET_TOKENS = 2048;
13
+ function isAnthropicModel(modelString) {
14
+ const normalized = modelString.startsWith(VERYFRONT_CLOUD_PREFIX)
15
+ ? modelString.slice(VERYFRONT_CLOUD_PREFIX.length)
16
+ : modelString;
17
+ return normalized.startsWith(ANTHROPIC_PREFIX);
18
+ }
19
+ function hasAnthropicThinkingConfig(existing) {
20
+ if (!existing || typeof existing !== "object")
21
+ return false;
22
+ const anthropic = existing.anthropic;
23
+ if (!anthropic || typeof anthropic !== "object")
24
+ return false;
25
+ return "thinking" in anthropic;
26
+ }
27
+ export function resolveProviderOptionsWithDefaults(modelString, existing) {
28
+ if (!isAnthropicModel(modelString)) {
29
+ return existing;
30
+ }
31
+ if (hasAnthropicThinkingConfig(existing)) {
32
+ return existing;
33
+ }
34
+ const existingAnthropic = (existing?.anthropic ?? {});
35
+ return {
36
+ ...(existing ?? {}),
37
+ anthropic: {
38
+ // Defaults first; host-supplied fields (e.g. temperature) override them.
39
+ // Only `thinking` is forced because we already confirmed it isn't set.
40
+ temperature: 1,
41
+ ...existingAnthropic,
42
+ thinking: { type: "enabled", budget_tokens: DEFAULT_ANTHROPIC_THINKING_BUDGET_TOKENS },
43
+ },
44
+ };
45
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAGlB,KAAK,OAAO,EAGZ,KAAK,QAAQ,EACb,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAS/D,OAAO,EACL,KAAK,eAAe,EAGpB,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAUlC,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,gBA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AC;KACd,CAAC;IAIF;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
@@ -19,6 +19,7 @@ import { serverLogger } from "../../utils/index.js";
19
19
  import { addSpanEvent, setSpanAttributes, withSpan, } from "../../observability/tracing/index.js";
20
20
  import { convertToModelMessages } from "./model-message-converter.js";
21
21
  import { convertToolsToRuntimeTools } from "./model-tool-converter.js";
22
+ import { resolveProviderOptionsWithDefaults } from "./default-provider-options.js";
22
23
  import { createStreamState, processStream, } from "./chat-stream-handler.js";
23
24
  import { repairToolCall } from "./repair-tool-call.js";
24
25
  import { MiddlewareChain } from "../middleware/chain.js";
@@ -178,7 +179,7 @@ export class AgentRuntime {
178
179
  resolvedModelString,
179
180
  languageModel: transport?.model ?? resolveModel(resolvedModelString),
180
181
  headers: transport?.headers,
181
- providerOptions: transport?.providerOptions,
182
+ providerOptions: resolveProviderOptionsWithDefaults(resolvedModelString, transport?.providerOptions),
182
183
  };
183
184
  }
184
185
  async resolveRuntimeState(messages, context, mode, step, systemPrompt) {
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.201";
1
+ export declare const VERSION = "0.1.202";
2
2
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.201";
3
+ export const VERSION = "0.1.202";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.201",
3
+ "version": "0.1.202",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",
package/src/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.201",
3
+ "version": "0.1.202",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "exclude": [
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Framework-default `providerOptions` for known providers.
3
+ *
4
+ * Currently: enable Anthropic extended thinking by default for any
5
+ * Anthropic model, since the `reasoning-*` event surface in this framework
6
+ * relies on the provider-side feature being on. Apps can override or opt
7
+ * out by returning their own `providerOptions.anthropic.thinking` from
8
+ * `AgentConfig.resolveModelTransport`.
9
+ */
10
+
11
+ const VERYFRONT_CLOUD_PREFIX = "veryfront-cloud/";
12
+ const ANTHROPIC_PREFIX = "anthropic/";
13
+ const DEFAULT_ANTHROPIC_THINKING_BUDGET_TOKENS = 2048;
14
+
15
+ function isAnthropicModel(modelString: string): boolean {
16
+ const normalized = modelString.startsWith(VERYFRONT_CLOUD_PREFIX)
17
+ ? modelString.slice(VERYFRONT_CLOUD_PREFIX.length)
18
+ : modelString;
19
+ return normalized.startsWith(ANTHROPIC_PREFIX);
20
+ }
21
+
22
+ function hasAnthropicThinkingConfig(existing: Record<string, unknown> | undefined): boolean {
23
+ if (!existing || typeof existing !== "object") return false;
24
+ const anthropic = (existing as { anthropic?: unknown }).anthropic;
25
+ if (!anthropic || typeof anthropic !== "object") return false;
26
+ return "thinking" in (anthropic as Record<string, unknown>);
27
+ }
28
+
29
+ export function resolveProviderOptionsWithDefaults(
30
+ modelString: string,
31
+ existing: Record<string, unknown> | undefined,
32
+ ): Record<string, unknown> | undefined {
33
+ if (!isAnthropicModel(modelString)) {
34
+ return existing;
35
+ }
36
+
37
+ if (hasAnthropicThinkingConfig(existing)) {
38
+ return existing;
39
+ }
40
+
41
+ const existingAnthropic = (existing?.anthropic ?? {}) as Record<string, unknown>;
42
+ return {
43
+ ...(existing ?? {}),
44
+ anthropic: {
45
+ // Defaults first; host-supplied fields (e.g. temperature) override them.
46
+ // Only `thinking` is forced because we already confirmed it isn't set.
47
+ temperature: 1,
48
+ ...existingAnthropic,
49
+ thinking: { type: "enabled", budget_tokens: DEFAULT_ANTHROPIC_THINKING_BUDGET_TOKENS },
50
+ },
51
+ };
52
+ }
@@ -35,6 +35,7 @@ import {
35
35
  } from "../../observability/tracing/index.js";
36
36
  import { convertToModelMessages } from "./model-message-converter.js";
37
37
  import { convertToolsToRuntimeTools } from "./model-tool-converter.js";
38
+ import { resolveProviderOptionsWithDefaults } from "./default-provider-options.js";
38
39
  import {
39
40
  type ChatStreamState,
40
41
  createStreamState,
@@ -313,7 +314,10 @@ export class AgentRuntime {
313
314
  resolvedModelString,
314
315
  languageModel: transport?.model ?? resolveModel(resolvedModelString),
315
316
  headers: transport?.headers,
316
- providerOptions: transport?.providerOptions,
317
+ providerOptions: resolveProviderOptionsWithDefaults(
318
+ resolvedModelString,
319
+ transport?.providerOptions,
320
+ ),
317
321
  };
318
322
  }
319
323
 
@@ -1,3 +1,3 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
- export const VERSION = "0.1.201";
3
+ export const VERSION = "0.1.202";