veryfront 0.1.296 → 0.1.297

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.296",
3
+ "version": "0.1.297",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -14,8 +14,19 @@ export interface AgUiRuntimeHandlerExecuteInput {
14
14
  createDefaultResponse?: () => Promise<Response>;
15
15
  }
16
16
  export type AgUiRuntimeHandlerExecute = (input: AgUiRuntimeHandlerExecuteInput) => Promise<Response> | Response;
17
+ export interface AgUiRuntimeRequestGateInput {
18
+ request: Request;
19
+ }
20
+ export type AgUiRuntimeRequestGate = (input: AgUiRuntimeRequestGateInput) => Promise<Response | undefined | void> | Response | undefined | void;
21
+ export interface AgUiRuntimeValidationErrorInput {
22
+ request: Request;
23
+ response: Response;
24
+ }
25
+ export type AgUiRuntimeValidationErrorResponse = (input: AgUiRuntimeValidationErrorInput) => Promise<Response> | Response;
17
26
  export interface AgUiRuntimeHandlerOptions {
18
27
  context?: Record<string, unknown> | ((request: Request) => Record<string, unknown> | Promise<Record<string, unknown>>);
28
+ beforeParse?: AgUiRuntimeRequestGate;
29
+ validationErrorResponse?: AgUiRuntimeValidationErrorResponse;
19
30
  sessionManager?: RunResumeSessionManager<AgUiResumeValue>;
20
31
  execute?: AgUiRuntimeHandlerExecute;
21
32
  onToolCallSeen?: (context: AgUiRuntimeLifecycleContext) => Promise<void> | void;
@@ -1 +1 @@
1
- {"version":3,"file":"ag-ui-runtime-handler.d.ts","sourceRoot":"","sources":["../../../src/src/agent/ag-ui-runtime-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EACL,K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AAO,EAAE,yBAAyB,CAAA;CAAE,CAAC,CAAC;AAE5F,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,wBAAwB,GAC/B,CAAC,YAAY,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CA8I9C"}
@@ -207,8 +207,15 @@ export function createAgUiRuntimeHandler(config) {
207
207
  return async function POST(requestOrCtx) {
208
208
  const request = extractRequest(requestOrCtx);
209
209
  try {
210
+ const gateResult = await config.beforeParse?.({ request });
211
+ if (gateResult instanceof Response) {
212
+ return gateResult;
213
+ }
210
214
  const parsed = await parseAgUiRuntimeRequestOrError(request);
211
215
  if (parsed instanceof Response) {
216
+ if (config.validationErrorResponse) {
217
+ return await config.validationErrorResponse({ request, response: parsed });
218
+ }
212
219
  return parsed;
213
220
  }
214
221
  const context = typeof config.context === "function"
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.296";
1
+ export declare const VERSION = "0.1.297";
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.296";
3
+ export const VERSION = "0.1.297";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.296",
3
+ "version": "0.1.297",
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.296",
3
+ "version": "0.1.297",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -320,10 +320,29 @@ export type AgUiRuntimeHandlerExecute = (
320
320
  input: AgUiRuntimeHandlerExecuteInput,
321
321
  ) => Promise<Response> | Response;
322
322
 
323
+ export interface AgUiRuntimeRequestGateInput {
324
+ request: Request;
325
+ }
326
+
327
+ export type AgUiRuntimeRequestGate = (
328
+ input: AgUiRuntimeRequestGateInput,
329
+ ) => Promise<Response | undefined | void> | Response | undefined | void;
330
+
331
+ export interface AgUiRuntimeValidationErrorInput {
332
+ request: Request;
333
+ response: Response;
334
+ }
335
+
336
+ export type AgUiRuntimeValidationErrorResponse = (
337
+ input: AgUiRuntimeValidationErrorInput,
338
+ ) => Promise<Response> | Response;
339
+
323
340
  export interface AgUiRuntimeHandlerOptions {
324
341
  context?:
325
342
  | Record<string, unknown>
326
343
  | ((request: Request) => Record<string, unknown> | Promise<Record<string, unknown>>);
344
+ beforeParse?: AgUiRuntimeRequestGate;
345
+ validationErrorResponse?: AgUiRuntimeValidationErrorResponse;
327
346
  sessionManager?: RunResumeSessionManager<AgUiResumeValue>;
328
347
  execute?: AgUiRuntimeHandlerExecute;
329
348
  onToolCallSeen?: (context: AgUiRuntimeLifecycleContext) => Promise<void> | void;
@@ -352,8 +371,17 @@ export function createAgUiRuntimeHandler(
352
371
  const request = extractRequest(requestOrCtx);
353
372
 
354
373
  try {
374
+ const gateResult = await config.beforeParse?.({ request });
375
+ if (gateResult instanceof Response) {
376
+ return gateResult;
377
+ }
378
+
355
379
  const parsed = await parseAgUiRuntimeRequestOrError(request);
356
380
  if (parsed instanceof Response) {
381
+ if (config.validationErrorResponse) {
382
+ return await config.validationErrorResponse({ request, response: parsed });
383
+ }
384
+
357
385
  return parsed;
358
386
  }
359
387
 
@@ -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.296";
3
+ export const VERSION = "0.1.297";