veryfront 0.0.70 → 0.0.72

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
@@ -23,6 +23,19 @@ globalThis.Deno = globalThis.Deno || {
23
23
  function getTextFromParts(parts) {
24
24
  return parts.filter((p) => p.type === "text").map((p) => p.text).join("");
25
25
  }
26
+ function getToolArguments(part) {
27
+ if ("args" in part && part.args !== void 0) {
28
+ return part.args;
29
+ }
30
+ if ("input" in part && part.input !== void 0) {
31
+ return part.input;
32
+ }
33
+ const toolName = part.toolName;
34
+ const toolCallId = part.toolCallId;
35
+ throw new Error(
36
+ `Tool call part for "${toolName}" (${toolCallId}) missing both 'args' and 'input' fields`
37
+ );
38
+ }
26
39
 
27
40
  // src/ai/providers/openai.ts
28
41
  import { z as z2 } from "zod";
@@ -179,7 +192,6 @@ var OpenAIStreamChunkSchema = z.object({
179
192
  })).min(1)
180
193
  });
181
194
  var BaseProvider = class {
182
- config;
183
195
  constructor(config) {
184
196
  this.config = config;
185
197
  this.validateConfig();
@@ -394,12 +406,9 @@ var OpenAIResponseSchema = z2.object({
394
406
  }).optional()
395
407
  });
396
408
  var OpenAIProvider = class extends BaseProvider {
397
- name = "openai";
398
- apiKey;
399
- baseURL;
400
- organizationId;
401
409
  constructor(config) {
402
410
  super(config);
411
+ this.name = "openai";
403
412
  this.apiKey = config.apiKey;
404
413
  this.baseURL = config.baseURL || "https://api.openai.com/v1";
405
414
  this.organizationId = config.organizationId;
@@ -501,11 +510,9 @@ var OpenAIProvider = class extends BaseProvider {
501
510
 
502
511
  // src/ai/providers/anthropic.ts
503
512
  var AnthropicProvider = class extends BaseProvider {
504
- name = "anthropic";
505
- apiKey;
506
- baseURL;
507
513
  constructor(config) {
508
514
  super(config);
515
+ this.name = "anthropic";
509
516
  this.apiKey = config.apiKey;
510
517
  this.baseURL = config.baseURL || "https://api.anthropic.com";
511
518
  }
@@ -803,11 +810,9 @@ var GoogleResponseSchema = z3.object({
803
810
  }).optional()
804
811
  });
805
812
  var GoogleProvider = class extends BaseProvider {
806
- name = "google";
807
- apiKey;
808
- baseURL;
809
813
  constructor(config) {
810
814
  super(config);
815
+ this.name = "google";
811
816
  this.apiKey = config.apiKey;
812
817
  this.baseURL = config.baseURL || "https://generativelanguage.googleapis.com/v1beta";
813
818
  }
@@ -929,9 +934,11 @@ function getEnv(key) {
929
934
 
930
935
  // src/ai/providers/factory.ts
931
936
  var ProviderRegistry = class {
932
- providers = /* @__PURE__ */ new Map();
933
- config = {};
934
- autoInitialized = false;
937
+ constructor() {
938
+ this.providers = /* @__PURE__ */ new Map();
939
+ this.config = {};
940
+ this.autoInitialized = false;
941
+ }
935
942
  /**
936
943
  * Auto-initialize providers from environment variables
937
944
  * This is called lazily when a provider is first requested
@@ -1270,6 +1277,7 @@ function tool(config) {
1270
1277
  }
1271
1278
  return {
1272
1279
  id,
1280
+ type: "function",
1273
1281
  description: config.description,
1274
1282
  inputSchema: config.inputSchema,
1275
1283
  inputSchemaJson,
@@ -1299,12 +1307,64 @@ function tool(config) {
1299
1307
  mcp: config.mcp
1300
1308
  };
1301
1309
  }
1310
+ function dynamicTool(config) {
1311
+ const id = config.id || generateToolId();
1312
+ let inputSchemaJson;
1313
+ const zodLikeSchema = config.inputSchema;
1314
+ if (zodLikeSchema?._def?.typeName) {
1315
+ try {
1316
+ inputSchemaJson = zodToJsonSchema(config.inputSchema);
1317
+ agentLogger.info(
1318
+ `[DYNAMIC_TOOL] Converted schema for "${id}": ${Object.keys(inputSchemaJson.properties || {}).length} properties`
1319
+ );
1320
+ } catch {
1321
+ inputSchemaJson = { type: "object", properties: {}, additionalProperties: true };
1322
+ agentLogger.info(`[DYNAMIC_TOOL] Using permissive schema for "${id}"`);
1323
+ }
1324
+ } else if (zodLikeSchema?._def?.shape) {
1325
+ try {
1326
+ const shape = typeof zodLikeSchema._def.shape === "function" ? zodLikeSchema._def.shape() : zodLikeSchema._def.shape;
1327
+ const properties = {};
1328
+ for (const key of Object.keys(shape || {})) {
1329
+ properties[key] = { type: "string" };
1330
+ }
1331
+ inputSchemaJson = {
1332
+ type: "object",
1333
+ properties,
1334
+ additionalProperties: true
1335
+ };
1336
+ agentLogger.info(`[DYNAMIC_TOOL] Introspected schema for "${id}"`);
1337
+ } catch {
1338
+ inputSchemaJson = { type: "object", properties: {}, additionalProperties: true };
1339
+ }
1340
+ } else {
1341
+ inputSchemaJson = { type: "object", properties: {}, additionalProperties: true };
1342
+ agentLogger.info(`[DYNAMIC_TOOL] Using fully dynamic schema for "${id}"`);
1343
+ }
1344
+ return {
1345
+ id,
1346
+ type: "dynamic",
1347
+ description: config.description,
1348
+ inputSchema: config.inputSchema,
1349
+ inputSchemaJson,
1350
+ execute: async (input, context) => {
1351
+ const result = await config.execute(input, context);
1352
+ if (config.toModelOutput) {
1353
+ return config.toModelOutput(result);
1354
+ }
1355
+ return result;
1356
+ },
1357
+ mcp: config.mcp
1358
+ };
1359
+ }
1302
1360
  var toolIdCounter = 0;
1303
1361
  function generateToolId() {
1304
1362
  return `tool_${Date.now()}_${toolIdCounter++}`;
1305
1363
  }
1306
1364
  var ToolRegistryClass = class {
1307
- tools = /* @__PURE__ */ new Map();
1365
+ constructor() {
1366
+ this.tools = /* @__PURE__ */ new Map();
1367
+ }
1308
1368
  register(id, toolInstance) {
1309
1369
  if (this.tools.has(id)) {
1310
1370
  agentLogger.debug(`Tool "${id}" is already registered. Overwriting.`);
@@ -1564,7 +1624,9 @@ function patternToId(pattern) {
1564
1624
  return pattern.replace(/^\//, "").replace(/\//g, "_").replace(/:/g, "");
1565
1625
  }
1566
1626
  var ResourceRegistryClass = class {
1567
- resources = /* @__PURE__ */ new Map();
1627
+ constructor() {
1628
+ this.resources = /* @__PURE__ */ new Map();
1629
+ }
1568
1630
  /**
1569
1631
  * Register a resource
1570
1632
  */
@@ -1660,7 +1722,9 @@ function interpolateVariables(template, variables) {
1660
1722
  });
1661
1723
  }
1662
1724
  var PromptRegistryClass = class {
1663
- prompts = /* @__PURE__ */ new Map();
1725
+ constructor() {
1726
+ this.prompts = /* @__PURE__ */ new Map();
1727
+ }
1664
1728
  /**
1665
1729
  * Register a prompt
1666
1730
  */
@@ -1738,6 +1802,7 @@ import { z as z4 } from "zod";
1738
1802
  function agentAsTool(agent2, description) {
1739
1803
  return {
1740
1804
  id: `agent_${agent2.id}`,
1805
+ type: "function",
1741
1806
  description,
1742
1807
  inputSchema: z4.object({
1743
1808
  input: z4.string().describe("Input for the agent")
@@ -1790,7 +1855,9 @@ function createWorkflow(config) {
1790
1855
  };
1791
1856
  }
1792
1857
  var AgentRegistryClass = class {
1793
- agents = /* @__PURE__ */ new Map();
1858
+ constructor() {
1859
+ this.agents = /* @__PURE__ */ new Map();
1860
+ }
1794
1861
  /**
1795
1862
  * Register an agent
1796
1863
  */
@@ -2043,7 +2110,7 @@ import { join } from "node:path";
2043
2110
  // deno.json
2044
2111
  var deno_default = {
2045
2112
  name: "veryfront",
2046
- version: "0.0.70",
2113
+ version: "0.0.71",
2047
2114
  nodeModulesDir: "auto",
2048
2115
  exclude: [
2049
2116
  "npm/",
@@ -2712,10 +2779,12 @@ function createMockAdapter() {
2712
2779
 
2713
2780
  // src/platform/compat/fs.ts
2714
2781
  var NodeFileSystem = class {
2715
- fs = null;
2716
- os = null;
2717
- path = null;
2718
- initialized = false;
2782
+ constructor() {
2783
+ this.fs = null;
2784
+ this.os = null;
2785
+ this.path = null;
2786
+ this.initialized = false;
2787
+ }
2719
2788
  async ensureInitialized() {
2720
2789
  if (this.initialized)
2721
2790
  return;
@@ -3456,9 +3525,8 @@ function generateId(prefix) {
3456
3525
 
3457
3526
  // src/ai/agent/memory.ts
3458
3527
  var ConversationMemory = class {
3459
- messages = [];
3460
- config;
3461
3528
  constructor(config) {
3529
+ this.messages = [];
3462
3530
  this.config = config;
3463
3531
  }
3464
3532
  async add(message) {
@@ -3503,10 +3571,8 @@ var ConversationMemory = class {
3503
3571
  }
3504
3572
  };
3505
3573
  var BufferMemory = class {
3506
- messages = [];
3507
- config;
3508
- bufferSize;
3509
3574
  constructor(config) {
3575
+ this.messages = [];
3510
3576
  this.config = config;
3511
3577
  this.bufferSize = config.maxMessages || 10;
3512
3578
  }
@@ -3540,11 +3606,9 @@ var BufferMemory = class {
3540
3606
  }
3541
3607
  };
3542
3608
  var SummaryMemory = class {
3543
- messages = [];
3544
- summary = "";
3545
- config;
3546
- summaryThreshold;
3547
3609
  constructor(config) {
3610
+ this.messages = [];
3611
+ this.summary = "";
3548
3612
  this.config = config;
3549
3613
  this.summaryThreshold = config.maxMessages || 20;
3550
3614
  }
@@ -3653,9 +3717,11 @@ var VERYFRONT_PATHS = {
3653
3717
 
3654
3718
  // src/core/utils/bundle-manifest.ts
3655
3719
  var InMemoryBundleManifestStore = class {
3656
- metadata = /* @__PURE__ */ new Map();
3657
- code = /* @__PURE__ */ new Map();
3658
- sourceIndex = /* @__PURE__ */ new Map();
3720
+ constructor() {
3721
+ this.metadata = /* @__PURE__ */ new Map();
3722
+ this.code = /* @__PURE__ */ new Map();
3723
+ this.sourceIndex = /* @__PURE__ */ new Map();
3724
+ }
3659
3725
  getBundleMetadata(key) {
3660
3726
  const entry = this.metadata.get(key);
3661
3727
  if (!entry)
@@ -3947,14 +4013,16 @@ var ContextPropagation = class {
3947
4013
 
3948
4014
  // src/observability/tracing/manager.ts
3949
4015
  var TracingManager = class {
3950
- state = {
3951
- initialized: false,
3952
- tracer: null,
3953
- api: null,
3954
- propagator: null
3955
- };
3956
- spanOps = null;
3957
- contextProp = null;
4016
+ constructor() {
4017
+ this.state = {
4018
+ initialized: false,
4019
+ tracer: null,
4020
+ api: null,
4021
+ propagator: null
4022
+ };
4023
+ this.spanOps = null;
4024
+ this.contextProp = null;
4025
+ }
3958
4026
  async initialize(config = {}, adapter) {
3959
4027
  if (this.state.initialized) {
3960
4028
  serverLogger.debug("[tracing] Already initialized");
@@ -4089,7 +4157,7 @@ function convertMessageToProvider(msg) {
4089
4157
  content
4090
4158
  };
4091
4159
  const toolCallParts = msg.parts.filter(
4092
- (p) => p.type === "tool-call"
4160
+ (p) => p.type === "tool-call" || p.type.startsWith("tool-") && p.type !== "tool-result"
4093
4161
  );
4094
4162
  if (toolCallParts.length > 0) {
4095
4163
  providerMsg.tool_calls = toolCallParts.map((tc) => ({
@@ -4097,7 +4165,8 @@ function convertMessageToProvider(msg) {
4097
4165
  type: "function",
4098
4166
  function: {
4099
4167
  name: tc.toolName,
4100
- arguments: JSON.stringify(tc.args)
4168
+ // Use type-safe helper to extract args/input (throws if missing)
4169
+ arguments: JSON.stringify(getToolArguments(tc))
4101
4170
  }
4102
4171
  }));
4103
4172
  }
@@ -4111,11 +4180,8 @@ function convertMessageToProvider(msg) {
4111
4180
  return providerMsg;
4112
4181
  }
4113
4182
  var AgentRuntime = class {
4114
- id;
4115
- config;
4116
- memory;
4117
- status = "idle";
4118
4183
  constructor(id, config) {
4184
+ this.status = "idle";
4119
4185
  this.id = id;
4120
4186
  this.config = config;
4121
4187
  const memoryConfig = config.memory || { type: "conversation", maxTokens: 4e3 };
@@ -4183,7 +4249,8 @@ var AgentRuntime = class {
4183
4249
  start: async (controller) => {
4184
4250
  try {
4185
4251
  this.status = "streaming";
4186
- const startEvent = JSON.stringify({ type: "start" });
4252
+ const messageId = `msg-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
4253
+ const startEvent = JSON.stringify({ type: "start", messageId });
4187
4254
  controller.enqueue(encoder.encode(`data: ${startEvent}
4188
4255
 
4189
4256
  `));
@@ -4273,7 +4340,7 @@ var AgentRuntime = class {
4273
4340
  if (response.toolCalls) {
4274
4341
  for (const tc of response.toolCalls) {
4275
4342
  assistantParts.push({
4276
- type: "tool-call",
4343
+ type: `tool-${tc.name}`,
4277
4344
  toolCallId: tc.id,
4278
4345
  toolName: tc.name,
4279
4346
  args: tc.arguments
@@ -4390,6 +4457,10 @@ var AgentRuntime = class {
4390
4457
  totalTokens: 0
4391
4458
  };
4392
4459
  for (let step2 = 0; step2 < maxSteps; step2++) {
4460
+ const startStepEvent = JSON.stringify({ type: "start-step" });
4461
+ controller.enqueue(encoder.encode(`data: ${startStepEvent}
4462
+
4463
+ `));
4393
4464
  const tools = this.getAvailableTools();
4394
4465
  const stream = await provider.stream({
4395
4466
  model,
@@ -4422,9 +4493,13 @@ var AgentRuntime = class {
4422
4493
  toolCall.status = "error";
4423
4494
  toolCall.error = errorStr;
4424
4495
  toolCalls.push(toolCall);
4496
+ const errorTool = toolRegistry.get(toolCall.name);
4497
+ const errorIsDynamic = errorTool?.type === "dynamic";
4425
4498
  const errorData = JSON.stringify({
4426
- type: "error",
4427
- error: errorStr
4499
+ type: "tool-output-error",
4500
+ toolCallId: toolCall.id,
4501
+ errorText: errorStr,
4502
+ ...errorIsDynamic && { dynamic: true }
4428
4503
  });
4429
4504
  controller.enqueue(encoder.encode(`data: ${errorData}
4430
4505
 
@@ -4467,10 +4542,13 @@ var AgentRuntime = class {
4467
4542
  name: event.toolCall.name,
4468
4543
  arguments: ""
4469
4544
  });
4545
+ const startTool = toolRegistry.get(event.toolCall.name);
4546
+ const startIsDynamic = startTool?.type === "dynamic";
4470
4547
  const toolStartEvent = JSON.stringify({
4471
- type: "tool-call-streaming-start",
4548
+ type: "tool-input-start",
4472
4549
  toolCallId: event.toolCall.id,
4473
- toolName: event.toolCall.name
4550
+ toolName: event.toolCall.name,
4551
+ ...startIsDynamic && { dynamic: true }
4474
4552
  });
4475
4553
  controller.enqueue(encoder.encode(`data: ${toolStartEvent}
4476
4554
 
@@ -4482,9 +4560,9 @@ var AgentRuntime = class {
4482
4560
  const tc = streamToolCalls.get(event.id);
4483
4561
  tc.arguments += event.arguments;
4484
4562
  const toolDeltaEvent = JSON.stringify({
4485
- type: "tool-call-delta",
4563
+ type: "tool-input-delta",
4486
4564
  toolCallId: event.id,
4487
- argsTextDelta: event.arguments
4565
+ inputTextDelta: event.arguments
4488
4566
  });
4489
4567
  controller.enqueue(encoder.encode(`data: ${toolDeltaEvent}
4490
4568
 
@@ -4498,12 +4576,15 @@ var AgentRuntime = class {
4498
4576
  name: event.toolCall.name,
4499
4577
  arguments: event.toolCall.arguments
4500
4578
  });
4579
+ const completeTool = toolRegistry.get(event.toolCall.name);
4580
+ const completeIsDynamic = completeTool?.type === "dynamic";
4501
4581
  const { args } = parseStreamToolArgs(event.toolCall.arguments);
4502
4582
  const toolCallEvent = JSON.stringify({
4503
- type: "tool-call",
4583
+ type: "tool-input-available",
4504
4584
  toolCallId: event.toolCall.id,
4505
4585
  toolName: event.toolCall.name,
4506
- args
4586
+ input: args,
4587
+ ...completeIsDynamic && { dynamic: true }
4507
4588
  });
4508
4589
  controller.enqueue(encoder.encode(`data: ${toolCallEvent}
4509
4590
 
@@ -4570,7 +4651,7 @@ var AgentRuntime = class {
4570
4651
  });
4571
4652
  }
4572
4653
  streamParts.push({
4573
- type: "tool-call",
4654
+ type: `tool-${tc.name}`,
4574
4655
  toolCallId: tc.id,
4575
4656
  toolName: tc.name,
4576
4657
  args
@@ -4600,6 +4681,17 @@ var AgentRuntime = class {
4600
4681
  toolCallId: tc.id,
4601
4682
  error: argError
4602
4683
  });
4684
+ const inputErrorTool = toolRegistry.get(tc.name);
4685
+ const inputErrorIsDynamic = inputErrorTool?.type === "dynamic";
4686
+ const inputErrorEvent = JSON.stringify({
4687
+ type: "tool-input-error",
4688
+ toolCallId: tc.id,
4689
+ errorText: `Invalid tool arguments: ${argError}`,
4690
+ ...inputErrorIsDynamic && { dynamic: true }
4691
+ });
4692
+ controller.enqueue(encoder.encode(`data: ${inputErrorEvent}
4693
+
4694
+ `));
4603
4695
  await recordToolError(toolCall, `Invalid tool arguments: ${argError}`);
4604
4696
  continue;
4605
4697
  }
@@ -4609,15 +4701,6 @@ var AgentRuntime = class {
4609
4701
  if (callbacks?.onToolCall) {
4610
4702
  callbacks.onToolCall(toolCall);
4611
4703
  }
4612
- const toolCallEvent = JSON.stringify({
4613
- type: "tool-call",
4614
- toolCallId: toolCall.id,
4615
- toolName: toolCall.name,
4616
- args: toolCall.args
4617
- });
4618
- controller.enqueue(encoder.encode(`data: ${toolCallEvent}
4619
-
4620
- `));
4621
4704
  const result = await executeTool(tc.name, toolCall.args, {
4622
4705
  agentId: this.id,
4623
4706
  ...toolContext
@@ -4626,10 +4709,13 @@ var AgentRuntime = class {
4626
4709
  toolCall.result = result;
4627
4710
  toolCall.executionTime = Date.now() - startTime;
4628
4711
  toolCalls.push(toolCall);
4712
+ const outputTool = toolRegistry.get(tc.name);
4713
+ const outputIsDynamic = outputTool?.type === "dynamic";
4629
4714
  const toolResultEvent = JSON.stringify({
4630
- type: "tool-result",
4715
+ type: "tool-output-available",
4631
4716
  toolCallId: toolCall.id,
4632
- result
4717
+ output: result,
4718
+ ...outputIsDynamic && { dynamic: true }
4633
4719
  });
4634
4720
  controller.enqueue(encoder.encode(`data: ${toolResultEvent}
4635
4721
 
@@ -4652,9 +4738,17 @@ var AgentRuntime = class {
4652
4738
  await recordToolError(toolCall, errorStr);
4653
4739
  }
4654
4740
  }
4741
+ const finishStepToolsEvent = JSON.stringify({ type: "finish-step" });
4742
+ controller.enqueue(encoder.encode(`data: ${finishStepToolsEvent}
4743
+
4744
+ `));
4655
4745
  this.status = "thinking";
4656
4746
  continue;
4657
4747
  }
4748
+ const finishStepEvent = JSON.stringify({ type: "finish-step" });
4749
+ controller.enqueue(encoder.encode(`data: ${finishStepEvent}
4750
+
4751
+ `));
4658
4752
  break;
4659
4753
  }
4660
4754
  const lastMessage = currentMessages[currentMessages.length - 1];
@@ -5071,7 +5165,6 @@ async function setupAI(options = {}) {
5071
5165
 
5072
5166
  // src/ai/mcp/server.ts
5073
5167
  var MCPServer = class {
5074
- config;
5075
5168
  constructor(config) {
5076
5169
  this.config = config;
5077
5170
  }
@@ -5383,9 +5476,8 @@ import { anthropic } from "@ai-sdk/anthropic";
5383
5476
 
5384
5477
  // src/ai/production/rate-limit/limiter.ts
5385
5478
  var FixedWindowLimiter = class {
5386
- requests = /* @__PURE__ */ new Map();
5387
- config;
5388
5479
  constructor(config) {
5480
+ this.requests = /* @__PURE__ */ new Map();
5389
5481
  this.config = config;
5390
5482
  }
5391
5483
  check(identifier) {
@@ -5426,10 +5518,8 @@ var FixedWindowLimiter = class {
5426
5518
  }
5427
5519
  };
5428
5520
  var TokenBucketLimiter = class {
5429
- buckets = /* @__PURE__ */ new Map();
5430
- config;
5431
- refillRate;
5432
5521
  constructor(config) {
5522
+ this.buckets = /* @__PURE__ */ new Map();
5433
5523
  this.config = config;
5434
5524
  this.refillRate = config.maxRequests / config.windowMs;
5435
5525
  }
@@ -5532,7 +5622,9 @@ function rateLimitMiddleware(config) {
5532
5622
 
5533
5623
  // src/ai/production/cache/cache.ts
5534
5624
  var MemoryCache = class {
5535
- cache = /* @__PURE__ */ new Map();
5625
+ constructor() {
5626
+ this.cache = /* @__PURE__ */ new Map();
5627
+ }
5536
5628
  set(key, response) {
5537
5629
  this.cache.set(key, {
5538
5630
  response,
@@ -5563,9 +5655,8 @@ var MemoryCache = class {
5563
5655
  }
5564
5656
  };
5565
5657
  var LRUCache = class {
5566
- cache = /* @__PURE__ */ new Map();
5567
- maxSize;
5568
5658
  constructor(maxSize = 100) {
5659
+ this.cache = /* @__PURE__ */ new Map();
5569
5660
  this.maxSize = maxSize;
5570
5661
  }
5571
5662
  set(key, response) {
@@ -5609,10 +5700,9 @@ var LRUCache = class {
5609
5700
  }
5610
5701
  };
5611
5702
  var TTLCache = class {
5612
- cache = /* @__PURE__ */ new Map();
5613
- ttl;
5614
- cleanupInterval = null;
5615
5703
  constructor(ttl = 3e5) {
5704
+ this.cache = /* @__PURE__ */ new Map();
5705
+ this.cleanupInterval = null;
5616
5706
  this.ttl = ttl;
5617
5707
  this.startCleanup();
5618
5708
  }
@@ -5766,14 +5856,13 @@ function cacheMiddleware(config) {
5766
5856
 
5767
5857
  // src/ai/production/cost-tracking/tracker.ts
5768
5858
  var CostTracker = class {
5769
- records = [];
5770
- config;
5771
- dailyTotal = 0;
5772
- monthlyTotal = 0;
5773
- lastDayReset = Date.now();
5774
- lastMonthReset = Date.now();
5775
- resetInterval = null;
5776
5859
  constructor(config) {
5860
+ this.records = [];
5861
+ this.dailyTotal = 0;
5862
+ this.monthlyTotal = 0;
5863
+ this.lastDayReset = Date.now();
5864
+ this.lastMonthReset = Date.now();
5865
+ this.resetInterval = null;
5777
5866
  this.config = config;
5778
5867
  this.startPeriodicReset();
5779
5868
  }
@@ -6036,7 +6125,6 @@ var PII_PATTERNS = {
6036
6125
  creditCard: /\b\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}\b/g
6037
6126
  };
6038
6127
  var InputValidator = class {
6039
- config;
6040
6128
  constructor(config) {
6041
6129
  this.config = config || {};
6042
6130
  }
@@ -6096,7 +6184,6 @@ var InputValidator = class {
6096
6184
  }
6097
6185
  };
6098
6186
  var OutputFilter = class {
6099
- config;
6100
6187
  constructor(config) {
6101
6188
  this.config = config || {};
6102
6189
  }
@@ -6370,13 +6457,12 @@ function hasLockSupport(backend) {
6370
6457
  // src/ai/workflow/backends/memory.ts
6371
6458
  var DEFAULT_MAX_QUEUE_SIZE = 1e4;
6372
6459
  var MemoryBackend = class {
6373
- runs = /* @__PURE__ */ new Map();
6374
- checkpoints = /* @__PURE__ */ new Map();
6375
- approvals = /* @__PURE__ */ new Map();
6376
- queue = [];
6377
- locks = /* @__PURE__ */ new Map();
6378
- config;
6379
6460
  constructor(config = {}) {
6461
+ this.runs = /* @__PURE__ */ new Map();
6462
+ this.checkpoints = /* @__PURE__ */ new Map();
6463
+ this.approvals = /* @__PURE__ */ new Map();
6464
+ this.queue = [];
6465
+ this.locks = /* @__PURE__ */ new Map();
6380
6466
  this.config = {
6381
6467
  prefix: "wf:",
6382
6468
  debug: false,
@@ -6707,7 +6793,6 @@ var MemoryBackend = class {
6707
6793
 
6708
6794
  // src/ai/workflow/executor/dag-executor.ts
6709
6795
  var DAGExecutor = class {
6710
- config;
6711
6796
  constructor(config) {
6712
6797
  this.config = {
6713
6798
  maxConcurrency: 10,
@@ -7249,7 +7334,6 @@ var DAGExecutor = class {
7249
7334
 
7250
7335
  // src/ai/workflow/executor/checkpoint-manager.ts
7251
7336
  var CheckpointManager = class {
7252
- config;
7253
7337
  constructor(config) {
7254
7338
  this.config = {
7255
7339
  debug: false,
@@ -7407,7 +7491,6 @@ var CheckpointManager = class {
7407
7491
  // src/ai/workflow/executor/step-executor.ts
7408
7492
  var DEFAULT_STEP_TIMEOUT_MS = 5 * 60 * 1e3;
7409
7493
  var StepExecutor = class {
7410
- config;
7411
7494
  constructor(config = {}) {
7412
7495
  this.config = {
7413
7496
  defaultTimeout: DEFAULT_STEP_TIMEOUT_MS,
@@ -7629,15 +7712,8 @@ var StepExecutor = class {
7629
7712
 
7630
7713
  // src/ai/workflow/executor/workflow-executor.ts
7631
7714
  var WorkflowExecutor = class _WorkflowExecutor {
7632
- config;
7633
- stepExecutor;
7634
- checkpointManager;
7635
- dagExecutor;
7636
- workflows = /* @__PURE__ */ new Map();
7637
- blobResolver;
7638
- /** Default lock duration: 30 seconds */
7639
- static DEFAULT_LOCK_DURATION = 3e4;
7640
7715
  constructor(config) {
7716
+ this.workflows = /* @__PURE__ */ new Map();
7641
7717
  this.config = {
7642
7718
  maxConcurrency: 10,
7643
7719
  debug: false,
@@ -7673,6 +7749,10 @@ var WorkflowExecutor = class _WorkflowExecutor {
7673
7749
  };
7674
7750
  }
7675
7751
  }
7752
+ static {
7753
+ /** Default lock duration: 30 seconds */
7754
+ this.DEFAULT_LOCK_DURATION = 3e4;
7755
+ }
7676
7756
  /**
7677
7757
  * Register a workflow definition
7678
7758
  */
@@ -8027,10 +8107,8 @@ var WorkflowExecutor = class _WorkflowExecutor {
8027
8107
 
8028
8108
  // src/ai/workflow/runtime/approval-manager.ts
8029
8109
  var ApprovalManager = class {
8030
- config;
8031
- expirationTimer;
8032
- destroyed = false;
8033
8110
  constructor(config) {
8111
+ this.destroyed = false;
8034
8112
  this.config = {
8035
8113
  expirationCheckInterval: 6e4,
8036
8114
  // Check every minute
@@ -8257,10 +8335,6 @@ var ApprovalManager = class {
8257
8335
 
8258
8336
  // src/ai/workflow/api/workflow-client.ts
8259
8337
  var WorkflowClient = class {
8260
- backend;
8261
- executor;
8262
- approvalManager;
8263
- debug;
8264
8338
  constructor(config = {}) {
8265
8339
  this.debug = config.debug ?? false;
8266
8340
  this.backend = config.backend ?? new MemoryBackend({ debug: this.debug });
@@ -8469,6 +8543,7 @@ export {
8469
8543
  createWorkflowClient,
8470
8544
  detectPlatform,
8471
8545
  discoverAll,
8546
+ dynamicTool,
8472
8547
  embed,
8473
8548
  embedMany,
8474
8549
  experimental_createMCPClient,