@artinet/fleet 0.1.0-canary.7 → 0.1.1

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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  <p align="center">
2
- <a href="https://artinet.io"><img src="https://img.shields.io/badge/website-artinet.io-black" alt="Website"></a>
3
- <a href="https://www.npmjs.com/package/@artinet/fleet"><img src="https://img.shields.io/npm/v/@artinet/fleet?color=black" alt="Downloads"></a>
2
+ <a href="https://artinet.io"><img src="https://img.shields.io/badge/website-artinet.io-black" alt="Website"></a>
3
+ <a href="https://www.npmjs.com/package/@artinet/fleet"><img src="https://img.shields.io/npm/v/@artinet/fleet?color=black" alt="Version"></a>
4
+ <a href="https://www.npmjs.com/package/@artinet/fleet"><img src="https://img.shields.io/npm/dt/@artinet/fleet?color=black" alt="Downloads"></a>
4
5
  <a><img src="https://img.shields.io/badge/License-Apache_2.0-black.svg" alt="License"></a>
5
6
  <a href="https://snyk.io/test/npm/@artinet/fleet"><img src="https://snyk.io/test/npm/@artinet/fleet/badge.svg" alt="Known Vulnerabilities"></a>
6
7
  </p>
@@ -8,7 +9,7 @@
8
9
 
9
10
  Deploy AI agents on any infrastructure.
10
11
 
11
- Fleet is a lightweight server framework for hosting [A2A Protocol](https://github.com/google-a2a/A2A) agents with built-in orchestration, tool integration (MCP), and Agent2Agent communication.
12
+ Fleet is a lightweight server framework for hosting agents with built-in orchestration, tool integration (MCP), and Agent2Agent communication.
12
13
 
13
14
  ## Installation
14
15
 
@@ -33,7 +34,7 @@ npm install express
33
34
  ```typescript
34
35
  import { fleet } from "@artinet/fleet/express";
35
36
 
36
- const { app } = fleet().launch(3000);
37
+ fleet().launch(3000);
37
38
  ```
38
39
 
39
40
  **Hono**:
@@ -45,7 +46,7 @@ npm install hono
45
46
  ```typescript
46
47
  import { fleet } from "@artinet/fleet/hono";
47
48
 
48
- const { app } = fleet().launch(3000);
49
+ fleet().launch(3000);
49
50
  ```
50
51
 
51
52
  > 🚧 **More servers coming soon** — Bun adapters and edge support are on the roadmap.
@@ -76,7 +77,7 @@ const myFleet = await fleet().ship([
76
77
  myFleet.launch(3000);
77
78
  ```
78
79
 
79
- **Ship**:
80
+ **Post Launch, Ship**:
80
81
 
81
82
  ```typescript
82
83
  import { ship } from "@artinet/fleet";
@@ -110,7 +111,6 @@ curl -X POST http://localhost:3000/deploy \
110
111
  "type": "mcp",
111
112
  "uri": "everything-server-1",
112
113
  "info": {
113
- "uri": "everything-server-1",
114
114
  "implementation": {
115
115
  "version": "0.0.1",
116
116
  "name": "everything"
@@ -155,17 +155,19 @@ curl -X POST http://localhost:3000/agentId/my-agent \
155
155
  or via the [sdk](https://github.com/the-artinet-project/artinet-sdk):
156
156
 
157
157
  ```typescript
158
- import { A2AClient } from "@artinet/sdk";
158
+ import { createMessenger } from "@artinet/sdk";
159
159
 
160
- const client = new A2AClient("http://localhost:3000/agentId/my-agent");
160
+ const messenger = createMessenger({
161
+ baseUrl: "http://localhost:3000/agentId/my-agent",
162
+ });
161
163
 
162
164
  // Send a message
163
- const response = await client.sendMessage("Hello!");
165
+ const response = await messenger.sendMessage("Hello!");
164
166
 
165
167
  console.log(response);
166
168
 
167
169
  // Or stream the response
168
- for await (const update of client.sendStreamingMessage("Tell me a story")) {
170
+ for await (const update of messenger.sendMessageStream("Tell me a story")) {
169
171
  console.log(update);
170
172
  }
171
173
  ```
@@ -195,7 +197,7 @@ fleet({
195
197
 
196
198
  ### Logging
197
199
 
198
- Settup a custom logger via the [@artinet/sdk](https://www.npmjs.com/package/@artinet/sdk):
200
+ Setup a custom logger via the [@artinet/sdk](https://www.npmjs.com/package/@artinet/sdk):
199
201
 
200
202
  ```bash
201
203
  npm install @artinet/sdk pino pino-pretty
@@ -219,6 +221,37 @@ configure({
219
221
  });
220
222
  ```
221
223
 
224
+ ### Middleware
225
+
226
+ Intercept and transform agent requests and responses by adding `Middleware`:
227
+
228
+ ```typescript
229
+ import { fleet } from "@artinet/fleet/express";
230
+ import { Middleware } from "@artinet/fleet";
231
+
232
+ fleet({
233
+ middleware: new Middleware()
234
+ .request(async ({ request, context }) => {
235
+ // Inspect or transform incoming requests
236
+ console.log("Incoming request:", request);
237
+ return request;
238
+ })
239
+ .response(
240
+ async ({ response, context }) => {
241
+ // Inspect or transform outgoing responses
242
+ console.log("Outgoing response:", response);
243
+ return response;
244
+ },
245
+ // Use a trigger function to determine if the middleware should fire (defaults to `true` for every request/response)
246
+ ({ response, context }) => {
247
+ return true;
248
+ }
249
+ ),
250
+ }).launch(3000);
251
+ ```
252
+
253
+ The middleware chain is composable & sequential; add multiple `request` or `response` handlers as needed. Each handler receives the current request/response and context, and must return the (optionally modified) value.
254
+
222
255
  ## [Docker Configuration](https://github.com/the-artinet-project/artinet/blob/main/fleet/dockerfile)
223
256
 
224
257
  Build the docker image:
@@ -289,6 +322,7 @@ app.listen(3000);
289
322
  | `testPath` | `string` | `"/test"` | Test endpoint |
290
323
  | `inferenceProviderUrl` | `string` | `undefined` | An OpenAI API compatible endpoint |
291
324
  | `load` | `function` | `loadAgent` | Returns an A2A Protocol compliant agent wrapped in the [`@artinet/sdk`](<(https://github.com/the-artinet-project/artinet-sdk)>) |
325
+ | `middleware` | `Middleware` | `undefined` | Request/response interceptors for the agent route |
292
326
 
293
327
  ## API Reference
294
328
 
package/dist/default.d.ts CHANGED
@@ -23,13 +23,13 @@ export declare const DEFAULTS: {
23
23
  outputModes?: string[] | undefined;
24
24
  security?: Record<string, string[]>[] | undefined;
25
25
  }[];
26
+ schemaVersion: "0.1.0";
26
27
  instructions: string;
27
28
  services: ({
28
29
  url: string;
29
30
  uri: string;
30
31
  type: "a2a";
31
32
  info: {
32
- uri: string;
33
33
  protocolVersion: string;
34
34
  name: string;
35
35
  description: string;
@@ -59,6 +59,7 @@ export declare const DEFAULTS: {
59
59
  security?: Record<string, string[]>[] | undefined;
60
60
  }[];
61
61
  id?: string | undefined;
62
+ uri?: string | undefined;
62
63
  preferredTransport?: string | undefined;
63
64
  additionalInterfaces?: {
64
65
  url: string;
@@ -72,7 +73,7 @@ export declare const DEFAULTS: {
72
73
  documentationUrl?: string | undefined;
73
74
  securitySchemes?: Record<string, {
74
75
  type: "apiKey";
75
- in: "header" | "query" | "cookie";
76
+ in: "query" | "header" | "cookie";
76
77
  name: string;
77
78
  description?: string | undefined;
78
79
  } | {
@@ -131,7 +132,6 @@ export declare const DEFAULTS: {
131
132
  uri: string;
132
133
  type: "a2a";
133
134
  info: {
134
- uri: string;
135
135
  protocolVersion: string;
136
136
  name: string;
137
137
  description: string;
@@ -161,6 +161,7 @@ export declare const DEFAULTS: {
161
161
  security?: Record<string, string[]>[] | undefined;
162
162
  }[];
163
163
  id?: string | undefined;
164
+ uri?: string | undefined;
164
165
  preferredTransport?: string | undefined;
165
166
  additionalInterfaces?: {
166
167
  url: string;
@@ -174,7 +175,7 @@ export declare const DEFAULTS: {
174
175
  documentationUrl?: string | undefined;
175
176
  securitySchemes?: Record<string, {
176
177
  type: "apiKey";
177
- in: "header" | "query" | "cookie";
178
+ in: "query" | "header" | "cookie";
178
179
  name: string;
179
180
  description?: string | undefined;
180
181
  } | {
@@ -235,7 +236,6 @@ export declare const DEFAULTS: {
235
236
  uri: string;
236
237
  type: "mcp";
237
238
  info: {
238
- uri: string;
239
239
  implementation: {
240
240
  version: string;
241
241
  name: string;
@@ -351,6 +351,7 @@ export declare const DEFAULTS: {
351
351
  title?: string | undefined;
352
352
  }[];
353
353
  id?: string | undefined;
354
+ uri?: string | undefined;
354
355
  instructions?: string | undefined;
355
356
  };
356
357
  id?: string | undefined;
@@ -360,9 +361,16 @@ export declare const DEFAULTS: {
360
361
  } | {
361
362
  uri: string;
362
363
  type: "mcp";
363
- info: {
364
- uri: string;
365
- implementation: {
364
+ id?: string | undefined;
365
+ url?: string | undefined;
366
+ headers?: Record<string, string> | undefined;
367
+ authToken?: string | undefined;
368
+ parameters?: Record<string, unknown> | undefined;
369
+ arguments?: unknown;
370
+ info?: {
371
+ id?: string | undefined;
372
+ uri?: string | undefined;
373
+ implementation?: {
366
374
  version: string;
367
375
  name: string;
368
376
  websiteUrl?: string | undefined;
@@ -374,8 +382,7 @@ export declare const DEFAULTS: {
374
382
  theme?: "light" | "dark" | undefined;
375
383
  }[] | undefined;
376
384
  title?: string | undefined;
377
- };
378
- id?: string | undefined;
385
+ } | undefined;
379
386
  serverCapabilities?: {
380
387
  experimental?: Record<string, object> | undefined;
381
388
  logging?: object | undefined;
@@ -478,13 +485,7 @@ export declare const DEFAULTS: {
478
485
  title?: string | undefined;
479
486
  }[] | undefined;
480
487
  instructions?: string | undefined;
481
- };
482
- id?: string | undefined;
483
- url?: string | undefined;
484
- headers?: Record<string, string> | undefined;
485
- authToken?: string | undefined;
486
- parameters?: Record<string, unknown> | undefined;
487
- arguments?: unknown;
488
+ } | undefined;
488
489
  })[];
489
490
  protocolVersion?: string | undefined;
490
491
  url?: string | undefined;
@@ -512,7 +513,7 @@ export declare const DEFAULTS: {
512
513
  } | undefined;
513
514
  securitySchemes?: Record<string, {
514
515
  type: "apiKey";
515
- in: "header" | "query" | "cookie";
516
+ in: "query" | "header" | "cookie";
516
517
  name: string;
517
518
  description?: string | undefined;
518
519
  } | {
@@ -566,10 +567,7 @@ export declare const DEFAULTS: {
566
567
  }[] | undefined;
567
568
  id?: string | undefined;
568
569
  modelId?: string | undefined;
569
- modelUri?: string | undefined;
570
- toolIds?: string[] | undefined;
571
570
  toolUris?: string[] | undefined;
572
- agentIds?: string[] | undefined;
573
571
  agentUris?: string[] | undefined;
574
572
  groupIds?: (string | {
575
573
  id: string;
@@ -631,7 +629,7 @@ export declare const DEFAULTS: {
631
629
  documentationUrl?: string | undefined;
632
630
  securitySchemes?: Record<string, {
633
631
  type: "apiKey";
634
- in: "header" | "query" | "cookie";
632
+ in: "query" | "header" | "cookie";
635
633
  name: string;
636
634
  description?: string | undefined;
637
635
  } | {
package/dist/default.js CHANGED
@@ -13,5 +13,5 @@ export const DEFAULTS = {
13
13
  load: loadAgent,
14
14
  invoke: invokeAgent,
15
15
  storage: new InMemoryStore(),
16
- baseUrl: "https://localhost:3000",
16
+ baseUrl: "http://localhost:3000",
17
17
  };
@@ -16,13 +16,13 @@ export declare const CreateAgent: armada.Implementation<{
16
16
  outputModes?: string[] | undefined;
17
17
  security?: Record<string, string[]>[] | undefined;
18
18
  }[];
19
+ schemaVersion: "0.1.0";
19
20
  instructions: string;
20
21
  services: ({
21
22
  url: string;
22
23
  uri: string;
23
24
  type: "a2a";
24
25
  info: {
25
- uri: string;
26
26
  protocolVersion: string;
27
27
  name: string;
28
28
  description: string;
@@ -52,6 +52,7 @@ export declare const CreateAgent: armada.Implementation<{
52
52
  security?: Record<string, string[]>[] | undefined;
53
53
  }[];
54
54
  id?: string | undefined;
55
+ uri?: string | undefined;
55
56
  preferredTransport?: string | undefined;
56
57
  additionalInterfaces?: {
57
58
  url: string;
@@ -65,7 +66,7 @@ export declare const CreateAgent: armada.Implementation<{
65
66
  documentationUrl?: string | undefined;
66
67
  securitySchemes?: Record<string, {
67
68
  type: "apiKey";
68
- in: "header" | "query" | "cookie";
69
+ in: "query" | "header" | "cookie";
69
70
  name: string;
70
71
  description?: string | undefined;
71
72
  } | {
@@ -124,7 +125,6 @@ export declare const CreateAgent: armada.Implementation<{
124
125
  uri: string;
125
126
  type: "a2a";
126
127
  info: {
127
- uri: string;
128
128
  protocolVersion: string;
129
129
  name: string;
130
130
  description: string;
@@ -154,6 +154,7 @@ export declare const CreateAgent: armada.Implementation<{
154
154
  security?: Record<string, string[]>[] | undefined;
155
155
  }[];
156
156
  id?: string | undefined;
157
+ uri?: string | undefined;
157
158
  preferredTransport?: string | undefined;
158
159
  additionalInterfaces?: {
159
160
  url: string;
@@ -167,7 +168,7 @@ export declare const CreateAgent: armada.Implementation<{
167
168
  documentationUrl?: string | undefined;
168
169
  securitySchemes?: Record<string, {
169
170
  type: "apiKey";
170
- in: "header" | "query" | "cookie";
171
+ in: "query" | "header" | "cookie";
171
172
  name: string;
172
173
  description?: string | undefined;
173
174
  } | {
@@ -228,7 +229,6 @@ export declare const CreateAgent: armada.Implementation<{
228
229
  uri: string;
229
230
  type: "mcp";
230
231
  info: {
231
- uri: string;
232
232
  implementation: {
233
233
  version: string;
234
234
  name: string;
@@ -344,6 +344,7 @@ export declare const CreateAgent: armada.Implementation<{
344
344
  title?: string | undefined;
345
345
  }[];
346
346
  id?: string | undefined;
347
+ uri?: string | undefined;
347
348
  instructions?: string | undefined;
348
349
  };
349
350
  id?: string | undefined;
@@ -353,9 +354,16 @@ export declare const CreateAgent: armada.Implementation<{
353
354
  } | {
354
355
  uri: string;
355
356
  type: "mcp";
356
- info: {
357
- uri: string;
358
- implementation: {
357
+ id?: string | undefined;
358
+ url?: string | undefined;
359
+ headers?: Record<string, string> | undefined;
360
+ authToken?: string | undefined;
361
+ parameters?: Record<string, unknown> | undefined;
362
+ arguments?: unknown;
363
+ info?: {
364
+ id?: string | undefined;
365
+ uri?: string | undefined;
366
+ implementation?: {
359
367
  version: string;
360
368
  name: string;
361
369
  websiteUrl?: string | undefined;
@@ -367,8 +375,7 @@ export declare const CreateAgent: armada.Implementation<{
367
375
  theme?: "light" | "dark" | undefined;
368
376
  }[] | undefined;
369
377
  title?: string | undefined;
370
- };
371
- id?: string | undefined;
378
+ } | undefined;
372
379
  serverCapabilities?: {
373
380
  experimental?: Record<string, object> | undefined;
374
381
  logging?: object | undefined;
@@ -471,13 +478,7 @@ export declare const CreateAgent: armada.Implementation<{
471
478
  title?: string | undefined;
472
479
  }[] | undefined;
473
480
  instructions?: string | undefined;
474
- };
475
- id?: string | undefined;
476
- url?: string | undefined;
477
- headers?: Record<string, string> | undefined;
478
- authToken?: string | undefined;
479
- parameters?: Record<string, unknown> | undefined;
480
- arguments?: unknown;
481
+ } | undefined;
481
482
  })[];
482
483
  protocolVersion?: string | undefined;
483
484
  url?: string | undefined;
@@ -505,7 +506,7 @@ export declare const CreateAgent: armada.Implementation<{
505
506
  } | undefined;
506
507
  securitySchemes?: Record<string, {
507
508
  type: "apiKey";
508
- in: "header" | "query" | "cookie";
509
+ in: "query" | "header" | "cookie";
509
510
  name: string;
510
511
  description?: string | undefined;
511
512
  } | {
@@ -559,10 +560,7 @@ export declare const CreateAgent: armada.Implementation<{
559
560
  }[] | undefined;
560
561
  id?: string | undefined;
561
562
  modelId?: string | undefined;
562
- modelUri?: string | undefined;
563
- toolIds?: string[] | undefined;
564
563
  toolUris?: string[] | undefined;
565
- agentIds?: string[] | undefined;
566
564
  agentUris?: string[] | undefined;
567
565
  groupIds?: (string | {
568
566
  id: string;
@@ -624,7 +622,7 @@ export declare const CreateAgent: armada.Implementation<{
624
622
  documentationUrl?: string | undefined;
625
623
  securitySchemes?: Record<string, {
626
624
  type: "apiKey";
627
- in: "header" | "query" | "cookie";
625
+ in: "query" | "header" | "cookie";
628
626
  name: string;
629
627
  description?: string | undefined;
630
628
  } | {
@@ -687,7 +685,7 @@ export declare const CreateAgentRequestSchema: import("zod/v4").ZodObject<{
687
685
  timestamp: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
688
686
  agentId: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
689
687
  config: import("zod/v4").ZodObject<{
690
- uri: import("zod/v4").ZodString;
688
+ uri: import("zod/v4").ZodNonOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>;
691
689
  protocolVersion: import("zod/v4").ZodOptional<import("zod/v4").ZodDefault<import("zod/v4").ZodString>>;
692
690
  name: import("zod/v4").ZodString;
693
691
  description: import("zod/v4").ZodString;
@@ -727,8 +725,8 @@ export declare const CreateAgentRequestSchema: import("zod/v4").ZodObject<{
727
725
  description: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
728
726
  type: import("zod/v4").ZodLiteral<"apiKey">;
729
727
  in: import("zod/v4").ZodEnum<{
730
- header: "header";
731
728
  query: "query";
729
+ header: "header";
732
730
  cookie: "cookie";
733
731
  }>;
734
732
  name: import("zod/v4").ZodString;
@@ -791,12 +789,10 @@ export declare const CreateAgentRequestSchema: import("zod/v4").ZodObject<{
791
789
  signature: import("zod/v4").ZodString;
792
790
  header: import("zod/v4").ZodOptional<import("zod/v4").ZodRecord<import("zod/v4").ZodString, import("zod/v4").ZodUnknown>>;
793
791
  }, import("zod/v4/core").$strip>>>;
792
+ schemaVersion: import("zod/v4").ZodLiteral<"0.1.0">;
794
793
  id: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
795
794
  modelId: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
796
- modelUri: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
797
- toolIds: import("zod/v4").ZodOptional<import("zod/v4").ZodArray<import("zod/v4").ZodString>>;
798
795
  toolUris: import("zod/v4").ZodOptional<import("zod/v4").ZodArray<import("zod/v4").ZodString>>;
799
- agentIds: import("zod/v4").ZodOptional<import("zod/v4").ZodArray<import("zod/v4").ZodString>>;
800
796
  agentUris: import("zod/v4").ZodOptional<import("zod/v4").ZodArray<import("zod/v4").ZodString>>;
801
797
  groupIds: import("zod/v4").ZodOptional<import("zod/v4").ZodArray<import("zod/v4").ZodUnion<readonly [import("zod/v4").ZodString, import("zod/v4").ZodObject<{
802
798
  id: import("zod/v4").ZodString;
@@ -813,7 +809,7 @@ export declare const CreateAgentRequestSchema: import("zod/v4").ZodObject<{
813
809
  type: import("zod/v4").ZodDefault<import("zod/v4").ZodLiteral<"a2a">>;
814
810
  info: import("zod/v4").ZodObject<{
815
811
  id: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>;
816
- uri: import("zod/v4").ZodString;
812
+ uri: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
817
813
  protocolVersion: import("zod/v4").ZodDefault<import("zod/v4").ZodString>;
818
814
  name: import("zod/v4").ZodString;
819
815
  description: import("zod/v4").ZodString;
@@ -853,8 +849,8 @@ export declare const CreateAgentRequestSchema: import("zod/v4").ZodObject<{
853
849
  description: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
854
850
  type: import("zod/v4").ZodLiteral<"apiKey">;
855
851
  in: import("zod/v4").ZodEnum<{
856
- header: "header";
857
852
  query: "query";
853
+ header: "header";
858
854
  cookie: "cookie";
859
855
  }>;
860
856
  name: import("zod/v4").ZodString;
@@ -928,7 +924,7 @@ export declare const CreateAgentRequestSchema: import("zod/v4").ZodObject<{
928
924
  type: import("zod/v4").ZodDefault<import("zod/v4").ZodLiteral<"a2a">>;
929
925
  info: import("zod/v4").ZodObject<{
930
926
  id: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>;
931
- uri: import("zod/v4").ZodString;
927
+ uri: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
932
928
  protocolVersion: import("zod/v4").ZodDefault<import("zod/v4").ZodString>;
933
929
  name: import("zod/v4").ZodString;
934
930
  description: import("zod/v4").ZodString;
@@ -968,8 +964,8 @@ export declare const CreateAgentRequestSchema: import("zod/v4").ZodObject<{
968
964
  description: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
969
965
  type: import("zod/v4").ZodLiteral<"apiKey">;
970
966
  in: import("zod/v4").ZodEnum<{
971
- header: "header";
972
967
  query: "query";
968
+ header: "header";
973
969
  cookie: "cookie";
974
970
  }>;
975
971
  name: import("zod/v4").ZodString;
@@ -1043,7 +1039,7 @@ export declare const CreateAgentRequestSchema: import("zod/v4").ZodObject<{
1043
1039
  type: import("zod/v4").ZodDefault<import("zod/v4").ZodLiteral<"mcp">>;
1044
1040
  info: import("zod/v4").ZodObject<{
1045
1041
  id: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>;
1046
- uri: import("zod/v4").ZodString;
1042
+ uri: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
1047
1043
  implementation: import("zod/v4").ZodObject<{
1048
1044
  version: import("zod/v4").ZodString;
1049
1045
  websiteUrl: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
@@ -1182,10 +1178,10 @@ export declare const CreateAgentRequestSchema: import("zod/v4").ZodObject<{
1182
1178
  command: import("zod/v4").ZodString;
1183
1179
  args: import("zod/v4").ZodArray<import("zod/v4").ZodString>;
1184
1180
  }, import("zod/v4/core").$strip>, import("zod/v4").ZodString, import("zod/v4").ZodUnknown]>>;
1185
- info: import("zod/v4").ZodObject<{
1181
+ info: import("zod/v4").ZodOptional<import("zod/v4").ZodObject<{
1186
1182
  id: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>>;
1187
- uri: import("zod/v4").ZodNonOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>;
1188
- implementation: import("zod/v4").ZodNonOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodObject<{
1183
+ uri: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>;
1184
+ implementation: import("zod/v4").ZodOptional<import("zod/v4").ZodObject<{
1189
1185
  version: import("zod/v4").ZodString;
1190
1186
  websiteUrl: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
1191
1187
  description: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
@@ -1200,7 +1196,7 @@ export declare const CreateAgentRequestSchema: import("zod/v4").ZodObject<{
1200
1196
  }, import("zod/v4/core").$strip>>>;
1201
1197
  name: import("zod/v4").ZodString;
1202
1198
  title: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
1203
- }, import("zod/v4/core").$strip>>>;
1199
+ }, import("zod/v4/core").$strip>>;
1204
1200
  serverCapabilities: import("zod/v4").ZodOptional<import("zod/v4").ZodObject<{
1205
1201
  experimental: import("zod/v4").ZodOptional<import("zod/v4").ZodRecord<import("zod/v4").ZodString, import("zod/v4").ZodCustom<object, object>>>;
1206
1202
  logging: import("zod/v4").ZodOptional<import("zod/v4").ZodCustom<object, object>>;
@@ -1310,7 +1306,7 @@ export declare const CreateAgentRequestSchema: import("zod/v4").ZodObject<{
1310
1306
  title: import("zod/v4").ZodOptional<import("zod/v4").ZodString>;
1311
1307
  }, import("zod/v4/core").$strip>>>;
1312
1308
  instructions: import("zod/v4").ZodOptional<import("zod/v4").ZodOptional<import("zod/v4").ZodString>>;
1313
- }, import("zod/v4/core").$strip>;
1309
+ }, import("zod/v4/core").$strip>>;
1314
1310
  }, import("zod/v4/core").$strip>]>]>>>;
1315
1311
  metadata: import("zod/v4").ZodOptional<import("zod/v4").ZodRecord<import("zod/v4").ZodString, import("zod/v4").ZodString>>;
1316
1312
  }, import("zod/v4/core").$strip>;
@@ -1,2 +1,3 @@
1
1
  export * from "./create/index.js";
2
2
  export * from "./request/index.js";
3
+ export { Middleware } from "./intercept.js";
@@ -1,2 +1,3 @@
1
1
  export * from "./create/index.js";
2
2
  export * from "./request/index.js";
3
+ export { Middleware } from "./intercept.js";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import * as armada from "@artinet/armada";
6
+ import { RequestAgentRoute } from "./request/types/definitions.js";
7
+ import { API } from "@artinet/types";
8
+ export declare class InterceptBuilder<Req extends API.APIRequest = RequestAgentRoute["request"], Res extends API.APIResponse = RequestAgentRoute["response"], Context extends armada.BaseContext = RequestAgentRoute["context"]> {
9
+ private readonly intercepts;
10
+ constructor(intercepts?: armada.Intercept<Req, Res, Req | Res, Context>[]);
11
+ build(): armada.Intercept<Req, Res, Req | Res, Context>[];
12
+ request(action: armada.Intercept<Req, Res, Req, Context>["action"], trigger?: armada.Intercept<Req, Res, Req, Context>["trigger"]): InterceptBuilder<Req, Res, Context>;
13
+ response(action: armada.Intercept<Req, Res, Res, Context>["action"], trigger?: armada.Intercept<Req, Res, Res, Context>["trigger"]): InterceptBuilder<Req, Res, Context>;
14
+ }
15
+ export type Middleware = InterceptBuilder;
16
+ export declare const Middleware: typeof InterceptBuilder;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright 2025 The Artinet Project
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import * as armada from "@artinet/armada";
6
+ export class InterceptBuilder {
7
+ intercepts;
8
+ constructor(intercepts = []) {
9
+ this.intercepts = intercepts;
10
+ }
11
+ build() {
12
+ return this.intercepts;
13
+ }
14
+ request(action, trigger) {
15
+ this.intercepts.push({
16
+ action,
17
+ trigger: trigger ?? true,
18
+ phase: armada.Phase.REQUEST,
19
+ });
20
+ return new InterceptBuilder(this.intercepts);
21
+ }
22
+ response(action, trigger) {
23
+ this.intercepts.push({
24
+ action,
25
+ trigger: trigger ?? true,
26
+ phase: armada.Phase.RESPONSE,
27
+ });
28
+ return new InterceptBuilder(this.intercepts);
29
+ }
30
+ }
31
+ export const Middleware = InterceptBuilder;