veryfront 0.0.17 → 0.0.19

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/dist/ai/index.js CHANGED
@@ -1709,16 +1709,8 @@ var BYTES_PER_MB = 1024 * 1024;
1709
1709
  // deno.json
1710
1710
  var deno_default = {
1711
1711
  name: "veryfront",
1712
- version: "0.0.17",
1712
+ version: "0.0.19",
1713
1713
  nodeModulesDir: "auto",
1714
- workspace: [
1715
- "./examples/async-worker-redis",
1716
- "./examples/knowledge-base",
1717
- "./examples/form-handling",
1718
- "./examples/middleware-demo",
1719
- "./examples/coding-agent",
1720
- "./examples/durable-workflows"
1721
- ],
1722
1714
  exports: {
1723
1715
  ".": "./src/index.ts",
1724
1716
  "./cli": "./src/cli/main.ts",
@@ -1810,8 +1802,8 @@ var deno_default = {
1810
1802
  hast: "https://esm.sh/@types/hast@3.0.3",
1811
1803
  unist: "https://esm.sh/@types/unist@3.0.2",
1812
1804
  unified: "https://esm.sh/unified@11.0.5?dts",
1813
- ai: "https://esm.sh/ai@5.0.76",
1814
- "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59",
1805
+ ai: "https://esm.sh/ai@5.0.76?deps=react@18.3.1,react-dom@18.3.1",
1806
+ "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",
1815
1807
  "@ai-sdk/openai": "https://esm.sh/@ai-sdk/openai@2.0.1",
1816
1808
  "@ai-sdk/anthropic": "https://esm.sh/@ai-sdk/anthropic@2.0.4",
1817
1809
  unocss: "https://esm.sh/unocss@0.59.0",
@@ -1849,7 +1841,7 @@ var deno_default = {
1849
1841
  "test:coverage:integration": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage tests --unstable-worker-options --unstable-net || exit 1",
1850
1842
  "coverage:report": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --lcov > coverage/lcov.info && deno run --allow-read scripts/check-coverage.ts 80",
1851
1843
  "coverage:html": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --html",
1852
- lint: "deno lint src/",
1844
+ lint: "DENO_NO_PACKAGE_JSON=1 deno lint src/",
1853
1845
  fmt: "deno fmt src/",
1854
1846
  typecheck: "deno check src/index.ts src/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/build/transforms/index.ts src/core/config/index.ts src/core/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/module-system/index.ts",
1855
1847
  "docs:check-links": "deno run -A scripts/check-doc-links.ts",
@@ -1903,7 +1895,7 @@ var deno_default = {
1903
1895
  };
1904
1896
 
1905
1897
  // src/core/utils/version.ts
1906
- var VERSION = typeof deno_default.version === "string" ? deno_default.version : "0.0.0";
1898
+ var VERSION = getEnv("VERYFRONT_VERSION") || (typeof deno_default.version === "string" ? deno_default.version : "0.0.0");
1907
1899
 
1908
1900
  // src/core/utils/bundle-manifest.ts
1909
1901
  var InMemoryBundleManifestStore = class {
@@ -2241,12 +2233,15 @@ var TracingManager = class {
2241
2233
  }
2242
2234
  }
2243
2235
  async initializeTracer(config) {
2244
- const api = await import("@opentelemetry/api");
2236
+ const otelApiModule = ["npm:@opentelemetry/", "api@1"].join("");
2237
+ const api = await import(otelApiModule);
2245
2238
  this.state.api = api;
2246
2239
  this.state.tracer = api.trace.getTracer(config.serviceName || "veryfront", "0.1.0");
2247
- const { W3CTraceContextPropagator } = await import("@opentelemetry/core");
2248
- this.state.propagator = new W3CTraceContextPropagator();
2249
- api.propagation.setGlobalPropagator(this.state.propagator);
2240
+ const otelCoreModule = ["npm:@opentelemetry/", "core@1"].join("");
2241
+ const { W3CTraceContextPropagator } = await import(otelCoreModule);
2242
+ const propagator = new W3CTraceContextPropagator();
2243
+ this.state.propagator = propagator;
2244
+ api.propagation.setGlobalPropagator(propagator);
2250
2245
  if (this.state.api && this.state.tracer) {
2251
2246
  this.spanOps = new SpanOperations(this.state.api, this.state.tracer);
2252
2247
  }
@@ -2750,20 +2745,22 @@ var AgentRuntime = class {
2750
2745
  timestamp: Date.now()
2751
2746
  };
2752
2747
  if (streamToolCalls.size > 0) {
2753
- assistantMessage.toolCalls = Array.from(streamToolCalls.values()).map((tc) => {
2754
- const { args, error } = parseStreamToolArgs(tc.arguments);
2755
- if (error) {
2756
- serverLogger.warn("[AGENT] Failed to parse streamed tool arguments", {
2757
- toolCallId: tc.id,
2758
- error
2759
- });
2748
+ assistantMessage.toolCalls = Array.from(streamToolCalls.values()).map(
2749
+ (tc) => {
2750
+ const { args, error } = parseStreamToolArgs(tc.arguments);
2751
+ if (error) {
2752
+ serverLogger.warn("[AGENT] Failed to parse streamed tool arguments", {
2753
+ toolCallId: tc.id,
2754
+ error
2755
+ });
2756
+ }
2757
+ return {
2758
+ id: tc.id,
2759
+ name: tc.name,
2760
+ arguments: args
2761
+ };
2760
2762
  }
2761
- return {
2762
- id: tc.id,
2763
- name: tc.name,
2764
- arguments: args
2765
- };
2766
- });
2763
+ );
2767
2764
  }
2768
2765
  currentMessages.push(assistantMessage);
2769
2766
  await this.memory.add(assistantMessage);
@@ -3207,6 +3204,22 @@ var AgentRegistryClass = class {
3207
3204
  var agentRegistry = new AgentRegistryClass();
3208
3205
 
3209
3206
  // src/ai/agent/factory.ts
3207
+ function createAgentStreamResult(stream) {
3208
+ return {
3209
+ toDataStreamResponse(options) {
3210
+ return new Response(stream, {
3211
+ status: options?.status ?? 200,
3212
+ statusText: options?.statusText,
3213
+ headers: {
3214
+ "Content-Type": "text/event-stream",
3215
+ "Cache-Control": "no-cache",
3216
+ "Connection": "keep-alive",
3217
+ ...options?.headers
3218
+ }
3219
+ });
3220
+ }
3221
+ };
3222
+ }
3210
3223
  function agent(config) {
3211
3224
  const id = config.id || generateAgentId();
3212
3225
  if (config.tools) {
@@ -3245,12 +3258,13 @@ ${compatibility.warnings.join("\n")}`
3245
3258
  generate(input) {
3246
3259
  return runtime.generate(input.input, input.context);
3247
3260
  },
3248
- stream(input) {
3261
+ async stream(input) {
3249
3262
  const inputMessages = input.input ? [{ role: "user", content: input.input }] : input.messages || [];
3250
- return runtime.stream(inputMessages, input.context, {
3263
+ const stream = await runtime.stream(inputMessages, input.context, {
3251
3264
  onToolCall: input.onToolCall,
3252
3265
  onChunk: input.onChunk
3253
3266
  });
3267
+ return createAgentStreamResult(stream);
3254
3268
  },
3255
3269
  async respond(request) {
3256
3270
  const body = await request.json();
@@ -3788,6 +3802,16 @@ function createMockAdapter() {
3788
3802
  }
3789
3803
  return Promise.resolve(content);
3790
3804
  },
3805
+ readFileBytes: (path) => {
3806
+ const content = files.get(path);
3807
+ if (!content) {
3808
+ throw toError(createError({
3809
+ type: "file",
3810
+ message: `File not found: ${path}`
3811
+ }));
3812
+ }
3813
+ return Promise.resolve(new TextEncoder().encode(content));
3814
+ },
3791
3815
  writeFile: (path, content) => {
3792
3816
  files.set(path, content);
3793
3817
  return Promise.resolve();
@@ -4268,11 +4292,17 @@ var NodeFileSystem = class {
4268
4292
  }
4269
4293
  async remove(path, options) {
4270
4294
  await this.ensureInitialized();
4271
- await this.fs.rm(path, { recursive: options?.recursive ?? false, force: options?.recursive ?? false });
4295
+ await this.fs.rm(path, {
4296
+ recursive: options?.recursive ?? false,
4297
+ force: options?.recursive ?? false
4298
+ });
4272
4299
  }
4273
4300
  async makeTempDir(options) {
4274
4301
  await this.ensureInitialized();
4275
- const tempDir = this.path.join(this.os.tmpdir(), `${options?.prefix ?? "tmp-"}${Math.random().toString(36).substring(2, 8)}`);
4302
+ const tempDir = this.path.join(
4303
+ this.os.tmpdir(),
4304
+ `${options?.prefix ?? "tmp-"}${Math.random().toString(36).substring(2, 8)}`
4305
+ );
4276
4306
  await this.fs.mkdir(tempDir, { recursive: true });
4277
4307
  return tempDir;
4278
4308
  }
@@ -5742,13 +5772,11 @@ function waitForApproval(id, options = {}) {
5742
5772
  // src/platform/compat/path-helper.ts
5743
5773
  import nodePath from "node:path";
5744
5774
  var pathMod = null;
5745
- var denoPathPromise = null;
5746
5775
  if (typeof Deno === "undefined") {
5747
5776
  pathMod = nodePath;
5748
5777
  } else {
5749
- denoPathPromise = import("path").then((mod) => {
5778
+ import("path").then((mod) => {
5750
5779
  pathMod = mod;
5751
- return pathMod;
5752
5780
  });
5753
5781
  }
5754
5782
  var sep = nodePath.sep;
@@ -5902,7 +5930,9 @@ var MemoryBackend = class {
5902
5930
  }
5903
5931
  getPendingApprovals(runId) {
5904
5932
  const approvals = this.approvals.get(runId) || [];
5905
- return Promise.resolve(approvals.filter((a) => a.status === "pending").map((a) => structuredClone(a)));
5933
+ return Promise.resolve(
5934
+ approvals.filter((a) => a.status === "pending").map((a) => structuredClone(a))
5935
+ );
5906
5936
  }
5907
5937
  getPendingApproval(runId, approvalId) {
5908
5938
  const approvals = this.approvals.get(runId) || [];
@@ -6138,9 +6168,7 @@ var DAGExecutor = class {
6138
6168
  const batch = ready.slice(0, this.config.maxConcurrency);
6139
6169
  ready = ready.slice(this.config.maxConcurrency);
6140
6170
  const results = await Promise.allSettled(
6141
- batch.map(
6142
- (nodeId) => this.executeNode(nodeMap.get(nodeId), context, nodeStates)
6143
- )
6171
+ batch.map((nodeId) => this.executeNode(nodeMap.get(nodeId), context, nodeStates))
6144
6172
  );
6145
6173
  for (let i = 0; i < batch.length; i++) {
6146
6174
  const nodeId = batch[i];
@@ -6233,7 +6261,12 @@ var DAGExecutor = class {
6233
6261
  case "wait":
6234
6262
  return await this.executeWaitNode(node, config, context);
6235
6263
  case "subWorkflow":
6236
- return await this.executeSubWorkflowNode(node, config, context, nodeStates);
6264
+ return await this.executeSubWorkflowNode(
6265
+ node,
6266
+ config,
6267
+ context,
6268
+ nodeStates
6269
+ );
6237
6270
  default:
6238
6271
  throw new Error(
6239
6272
  `Unknown node type "${config.type}" for node "${node.id}". Valid types are: step, parallel, map, branch, wait, subWorkflow`
@@ -6340,7 +6373,9 @@ var DAGExecutor = class {
6340
6373
  const startTime = Date.now();
6341
6374
  let workflowDef;
6342
6375
  if (typeof config.workflow === "string") {
6343
- throw new Error("Resolving workflow by ID is not yet supported in this execution context. Pass the WorkflowDefinition object.");
6376
+ throw new Error(
6377
+ "Resolving workflow by ID is not yet supported in this execution context. Pass the WorkflowDefinition object."
6378
+ );
6344
6379
  } else {
6345
6380
  workflowDef = config.workflow;
6346
6381
  }
@@ -6365,7 +6400,7 @@ var DAGExecutor = class {
6365
6400
  context: {
6366
6401
  input
6367
6402
  // Subworkflow starts with fresh context scoped to its input
6368
- // We do NOT inherit parent context to ensure isolation,
6403
+ // We do NOT inherit parent context to ensure isolation,
6369
6404
  // unless explicitly passed via input.
6370
6405
  },
6371
6406
  checkpoints: [],