veryfront 0.1.536 → 0.1.538

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/src/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.536",
3
+ "version": "0.1.538",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -331,8 +331,8 @@ export default {
331
331
  "fmt": "deno fmt src/ cli/ react/",
332
332
  "fmt:check": "deno fmt --check src/ cli/ react/",
333
333
  "typecheck": "deno task generate && deno check src/index.ts cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/transforms/index.ts src/config/index.ts src/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/modules/index.ts src/proxy/main.ts src/chat/index.ts src/markdown/index.ts src/mdx/index.ts src/fs/index.ts src/oauth/index.ts src/agent/index.ts src/agent/service/route-export.check.ts src/tool/index.ts src/workflow/index.ts src/prompt/index.ts src/resource/index.ts src/jobs/index.ts src/mcp/index.ts src/provider/index.ts",
334
- "verify": "deno task generate && deno fmt --check src/ cli/ react/ && DENO_NO_PACKAGE_JSON=1 deno lint src/ cli/ react/ && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:extension-contracts && deno task docs:validate && deno task typecheck && deno task test && deno task test:e2e:binary",
335
- "verify:quick": "deno task generate && deno fmt --check src/ cli/ react/ && DENO_NO_PACKAGE_JSON=1 deno lint src/ cli/ react/ && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:extension-contracts && deno task docs:validate && deno task typecheck",
334
+ "verify": "deno task generate && deno fmt --check src/ cli/ react/ && DENO_NO_PACKAGE_JSON=1 deno lint src/ cli/ react/ && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck && deno task test && deno task test:e2e:binary",
335
+ "verify:quick": "deno task generate && deno fmt --check src/ cli/ react/ && DENO_NO_PACKAGE_JSON=1 deno lint src/ cli/ react/ && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck",
336
336
  "docs": "rm -rf docs/reference && deno run --allow-read --allow-write --allow-run scripts/docs/generate-api-reference.ts",
337
337
  "docs:copy": "rm -rf ../../docs/docs/code/reference && cp -r docs/reference/ ../../docs/docs/code/reference/",
338
338
  "docs:validate": "deno run --allow-read scripts/docs/validate-api-reference.ts",
@@ -342,6 +342,7 @@ export default {
342
342
  "lint:core-deps": "deno run --allow-read scripts/lint/audit-core-deps.ts",
343
343
  "lint:dependency-boundaries": "deno run --allow-read scripts/lint/audit-dependency-boundaries.ts",
344
344
  "lint:extension-contracts": "deno run --allow-read --allow-env --allow-sys scripts/lint/audit-extension-contracts.ts",
345
+ "lint:extension-capabilities": "deno run --allow-read --allow-env --allow-sys scripts/lint/audit-extension-capabilities.ts",
345
346
  "lint:ban-console": "deno run --allow-read scripts/lint/ban-console.ts",
346
347
  "lint:ban-deep-imports": "deno run --allow-read scripts/lint/ban-deep-imports.ts",
347
348
  "lint:imports": "deno run --allow-read scripts/lint/no-cross-boundary-relative-imports.ts",
@@ -355,7 +356,7 @@ export default {
355
356
  "lint:wildcard-exports": "deno run --allow-read scripts/lint/ban-wildcard-exports.ts",
356
357
  "lint:deps": "deno run --allow-read scripts/lint/audit-deps.ts",
357
358
  "lint:barrel-jsdoc": "deno run --allow-read scripts/lint/check-barrel-jsdoc.ts",
358
- "test:scripts": "deno test --config=scripts/test.deno.json --no-check --allow-read --allow-write scripts/build/generate-sbom.test.ts scripts/build/npm-react-shims.test.ts scripts/lint/audit-core-deps.test.ts scripts/lint/audit-dependency-boundaries.test.ts scripts/lint/audit-extension-contracts.test.ts scripts/lint/audit-deps.test.ts scripts/security/audit-npm.test.ts scripts/security/submit-dependency-snapshot.test.ts",
359
+ "test:scripts": "deno test --config=scripts/test.deno.json --no-check --allow-read --allow-write scripts/build/generate-sbom.test.ts scripts/build/npm-react-shims.test.ts scripts/lint/audit-core-deps.test.ts scripts/lint/audit-dependency-boundaries.test.ts scripts/lint/audit-extension-capabilities.test.ts scripts/lint/audit-extension-contracts.test.ts scripts/lint/audit-deps.test.ts scripts/security/audit-npm.test.ts scripts/security/submit-dependency-snapshot.test.ts",
359
360
  "test:cross-runtime": "deno run --allow-all src/platform/compat/cross-runtime.test.ts",
360
361
  "test:node": "node ./tests/node/run-tests.mjs 'src/**/*.test.ts'",
361
362
  "test:bun": "node ./tests/bun/run-tests.mjs src/",
@@ -30,7 +30,9 @@ const extSandboxShellTools: ExtensionFactory = () => ({
30
30
  contracts: {
31
31
  provides: [SandboxShellToolsProviderName],
32
32
  },
33
- capabilities: [],
33
+ capabilities: [
34
+ { type: "sandbox:execute", tools: ["bash"] },
35
+ ],
34
36
  setup(ctx) {
35
37
  ctx.provide(SandboxShellToolsProviderName, provider);
36
38
  ctx.logger.info("[ext-sandbox-shell-tools] Sandbox shell tools provider registered");
@@ -20,6 +20,8 @@ export interface ProviderToolCompatOptions {
20
20
  }
21
21
 
22
22
  const OPENAI_MAX_TOOLS = 128;
23
+ const PROVIDER_TOOL_PROPERTY_KEY_PATTERN = /^[a-zA-Z0-9_.-]{1,64}$/;
24
+
23
25
  const GOOGLE_UNSUPPORTED_SCHEMA_KEYS = new Set([
24
26
  "$id",
25
27
  "$ref",
@@ -51,7 +53,7 @@ export function getProviderToolProfile(model?: string): ProviderToolProfile {
51
53
  }
52
54
 
53
55
  if (provider === "anthropic") {
54
- return { provider: "anthropic", sanitizeSchema: false };
56
+ return { provider: "anthropic", sanitizeSchema: true };
55
57
  }
56
58
 
57
59
  if (provider === "moonshot") {
@@ -184,6 +186,44 @@ function getGoogleCompatibleSchemaType(type: unknown): unknown {
184
186
  return nonNullTypes.length === 1 ? nonNullTypes[0] : undefined;
185
187
  }
186
188
 
189
+ function sanitizeProviderSchemaPropertyKeys(value: unknown): unknown {
190
+ if (Array.isArray(value)) {
191
+ return value.map((item) => sanitizeProviderSchemaPropertyKeys(item));
192
+ }
193
+
194
+ if (!isPlainRecord(value)) {
195
+ return value;
196
+ }
197
+
198
+ const sanitized: Record<string, unknown> = {};
199
+ const rawProperties = isPlainRecord(value.properties) ? value.properties : undefined;
200
+ const retainedPropertyNames = rawProperties ? new Set<string>() : undefined;
201
+
202
+ for (const [key, child] of Object.entries(value)) {
203
+ if (key === "properties" && rawProperties) {
204
+ const properties: Record<string, unknown> = {};
205
+ for (const [propertyName, propertySchema] of Object.entries(rawProperties)) {
206
+ if (!PROVIDER_TOOL_PROPERTY_KEY_PATTERN.test(propertyName)) continue;
207
+ retainedPropertyNames?.add(propertyName);
208
+ properties[propertyName] = sanitizeProviderSchemaPropertyKeys(propertySchema);
209
+ }
210
+ sanitized.properties = properties;
211
+ continue;
212
+ }
213
+
214
+ if (key === "required" && Array.isArray(child)) {
215
+ sanitized.required = retainedPropertyNames
216
+ ? child.filter((item) => typeof item === "string" && retainedPropertyNames.has(item))
217
+ : child.filter((item) => typeof item === "string");
218
+ continue;
219
+ }
220
+
221
+ sanitized[key] = sanitizeProviderSchemaPropertyKeys(child);
222
+ }
223
+
224
+ return sanitized;
225
+ }
226
+
187
227
  function sanitizeGoogleSchemaValue(value: unknown): unknown {
188
228
  if (Array.isArray(value)) {
189
229
  return value.map((item) => sanitizeGoogleSchemaValue(item));
@@ -254,5 +294,11 @@ export function sanitizeProviderToolSchema(
254
294
  const profile = getProviderToolProfile(options.model);
255
295
  if (!profile.sanitizeSchema) return schema;
256
296
 
257
- return sanitizeGoogleSchemaValue(schema) as JsonSchema;
297
+ const propertyKeySafeSchema = sanitizeProviderSchemaPropertyKeys(schema);
298
+
299
+ if (profile.provider === "google") {
300
+ return sanitizeGoogleSchemaValue(propertyKeySafeSchema) as JsonSchema;
301
+ }
302
+
303
+ return propertyKeySafeSchema as JsonSchema;
258
304
  }
@@ -206,6 +206,20 @@ function convertToolResultPart(
206
206
  };
207
207
  }
208
208
 
209
+ function hasProviderSendableAssistantContent(message: Message): boolean {
210
+ if (message.role !== "assistant") return true;
211
+
212
+ return message.parts.some((part) => {
213
+ if (part.type === "text" && "text" in part) {
214
+ return typeof (part as { text?: unknown }).text === "string" &&
215
+ (part as { text: string }).text.length > 0;
216
+ }
217
+
218
+ return part.type === "tool-call" ||
219
+ (part.type.startsWith("tool-") && part.type !== "tool-result");
220
+ });
221
+ }
222
+
209
223
  /**
210
224
  * Convert an array of veryfront Messages to the current text-generation runtime message format.
211
225
  */
@@ -216,6 +230,10 @@ export function convertToTextGenerationRuntimeMessages(
216
230
  const toolResultMessageIndexes = new Map<string, number>();
217
231
 
218
232
  for (const message of messages) {
233
+ if (!hasProviderSendableAssistantContent(message)) {
234
+ continue;
235
+ }
236
+
219
237
  if (message.role !== "tool") {
220
238
  textGenerationRuntimeMessages.push(convertToTextGenerationRuntimeMessage(message));
221
239
  continue;