@artinet/sdk 0.6.3 → 0.6.5

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.
@@ -1 +1 @@
1
- export { createMessenger, A2AClient, AgentMessenger, type MessengerParams, } from "./messenger.js";
1
+ export { createMessenger, A2AClient, AgentMessenger, type MessengerParams, isMessengerParams, } from "./messenger.js";
@@ -1 +1 @@
1
- export { createMessenger, A2AClient, AgentMessenger, } from "./messenger.js";
1
+ export { createMessenger, A2AClient, AgentMessenger, isMessengerParams, } from "./messenger.js";
@@ -5,10 +5,22 @@
5
5
  import { A2A } from "../types/index.js";
6
6
  import * as describe from "../create/describe.js";
7
7
  import { ClientFactoryOptions, ClientConfig, Client, Transport, RequestOptions } from "@a2a-js/sdk/client";
8
- export interface MessengerParams {
8
+ import { z } from "zod/v4";
9
+ export declare const MessengerParamsSchema: z.ZodObject<{
10
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
11
+ authToken: z.ZodOptional<z.ZodString>;
12
+ baseUrl: z.ZodURL;
13
+ fallbackPath: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ type BaseMessengerParams = z.infer<typeof MessengerParamsSchema>;
16
+ /**
17
+ * Checks if the given parameters are a valid MessengerParams object.
18
+ * @param params The parameters to check.
19
+ * @returns True if the parameters are a valid MessengerParams object, false otherwise.
20
+ */
21
+ export declare const isMessengerParams: (params: unknown) => params is MessengerParams;
22
+ export interface MessengerParams extends Omit<BaseMessengerParams, "baseUrl"> {
9
23
  baseUrl: URL | string;
10
- headers?: Record<string, string>;
11
- fallbackPath?: string;
12
24
  factory?: Partial<ClientFactoryOptions>;
13
25
  config?: ClientConfig;
14
26
  }
@@ -7,6 +7,8 @@ import { validateSchema } from "../utils/schema-validation.js";
7
7
  import { logger } from "../config/index.js";
8
8
  import * as describe from "../create/describe.js";
9
9
  import { ClientFactory, ClientFactoryOptions, AgentCardResolver, } from "@a2a-js/sdk/client";
10
+ import { Runtime } from "@artinet/types";
11
+ import { z } from "zod/v4";
10
12
  class HeaderInterceptor {
11
13
  constructor(_getCustomHeaders) {
12
14
  this._getCustomHeaders = _getCustomHeaders;
@@ -52,6 +54,21 @@ class NestedAgentCardResolver {
52
54
  return await validateSchema(A2A.AgentCardSchema, await response.json());
53
55
  }
54
56
  }
57
+ export const MessengerParamsSchema = Runtime.ServerConfigSchema.pick({
58
+ headers: true,
59
+ authToken: true,
60
+ }).extend({
61
+ baseUrl: z.url(),
62
+ fallbackPath: z.string().optional(),
63
+ });
64
+ /**
65
+ * Checks if the given parameters are a valid MessengerParams object.
66
+ * @param params The parameters to check.
67
+ * @returns True if the parameters are a valid MessengerParams object, false otherwise.
68
+ */
69
+ export const isMessengerParams = (params) => {
70
+ return MessengerParamsSchema.safeParse(params).success;
71
+ };
55
72
  /**
56
73
  * Messenger is the main communication client for interacting with remote A2A-compatible services.
57
74
  * It provides methods for sending messages, retrieving tasks, canceling operations, and handling streaming responses.
@@ -504,6 +504,7 @@ export function createStepEngine(stepsList) {
504
504
  }
505
505
  const task = await context.getTask();
506
506
  logger.debug(`engine[context:${context.contextId}]: completed task[${task.id}]: ${formatJson(task)}`);
507
+ task.status.state = A2A.TaskState.completed;
507
508
  yield task;
508
509
  };
509
510
  }
@@ -84,7 +84,7 @@ export function Task() {
84
84
  throw new Error("Array of tasks is not supported");
85
85
  }
86
86
  const task = typeof payload === "string" ? describe.task(payload) : payload;
87
- yield describe.task({ ...task, taskId, contextId });
87
+ yield describe.task({ ...task, id: taskId, contextId });
88
88
  return;
89
89
  };
90
90
  }
@@ -1 +1 @@
1
- export { createMessenger, A2AClient, AgentMessenger, type MessengerParams, } from "./messenger.js";
1
+ export { createMessenger, A2AClient, AgentMessenger, type MessengerParams, isMessengerParams, } from "./messenger.js";
@@ -1 +1 @@
1
- export { createMessenger, A2AClient, AgentMessenger, } from "./messenger.js";
1
+ export { createMessenger, A2AClient, AgentMessenger, isMessengerParams, } from "./messenger.js";
@@ -5,10 +5,22 @@
5
5
  import { A2A } from "../types/index.js";
6
6
  import * as describe from "../create/describe.js";
7
7
  import { ClientFactoryOptions, ClientConfig, Client, Transport, RequestOptions } from "@a2a-js/sdk/client";
8
- export interface MessengerParams {
8
+ import { z } from "zod/v4";
9
+ export declare const MessengerParamsSchema: z.ZodObject<{
10
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
11
+ authToken: z.ZodOptional<z.ZodString>;
12
+ baseUrl: z.ZodURL;
13
+ fallbackPath: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ type BaseMessengerParams = z.infer<typeof MessengerParamsSchema>;
16
+ /**
17
+ * Checks if the given parameters are a valid MessengerParams object.
18
+ * @param params The parameters to check.
19
+ * @returns True if the parameters are a valid MessengerParams object, false otherwise.
20
+ */
21
+ export declare const isMessengerParams: (params: unknown) => params is MessengerParams;
22
+ export interface MessengerParams extends Omit<BaseMessengerParams, "baseUrl"> {
9
23
  baseUrl: URL | string;
10
- headers?: Record<string, string>;
11
- fallbackPath?: string;
12
24
  factory?: Partial<ClientFactoryOptions>;
13
25
  config?: ClientConfig;
14
26
  }
@@ -7,6 +7,8 @@ import { validateSchema } from "../utils/schema-validation.js";
7
7
  import { logger } from "../config/index.js";
8
8
  import * as describe from "../create/describe.js";
9
9
  import { ClientFactory, ClientFactoryOptions, AgentCardResolver, } from "@a2a-js/sdk/client";
10
+ import { Runtime } from "@artinet/types";
11
+ import { z } from "zod/v4";
10
12
  class HeaderInterceptor {
11
13
  _getCustomHeaders;
12
14
  constructor(_getCustomHeaders) {
@@ -55,6 +57,21 @@ class NestedAgentCardResolver {
55
57
  return await validateSchema(A2A.AgentCardSchema, await response.json());
56
58
  }
57
59
  }
60
+ export const MessengerParamsSchema = Runtime.ServerConfigSchema.pick({
61
+ headers: true,
62
+ authToken: true,
63
+ }).extend({
64
+ baseUrl: z.url(),
65
+ fallbackPath: z.string().optional(),
66
+ });
67
+ /**
68
+ * Checks if the given parameters are a valid MessengerParams object.
69
+ * @param params The parameters to check.
70
+ * @returns True if the parameters are a valid MessengerParams object, false otherwise.
71
+ */
72
+ export const isMessengerParams = (params) => {
73
+ return MessengerParamsSchema.safeParse(params).success;
74
+ };
58
75
  /**
59
76
  * Messenger is the main communication client for interacting with remote A2A-compatible services.
60
77
  * It provides methods for sending messages, retrieving tasks, canceling operations, and handling streaming responses.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artinet/sdk",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "A TypeScript SDK for building collaborative AI agents.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -75,7 +75,7 @@
75
75
  "rebuild": "rimraf dist node_modules/ package-lock.json && npm i && npm run build:all",
76
76
  "lint": "eslint src --ext .ts",
77
77
  "package-test": "npm run build && npm pack && docker build -f ./deployment/test.dockerfile -t sdk-test . && docker run --rm sdk-test && rm artinet-sdk-*.tgz",
78
- "prepublishOnly": "npm run package-test && npm run rebuild && npm run lint && npm test",
78
+ "prepublishOnly": "npm run rebuild && npm run lint && npm test",
79
79
  "test": "NODE_OPTIONS=--experimental-vm-modules jest",
80
80
  "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch",
81
81
  "test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage",
@@ -102,7 +102,7 @@
102
102
  },
103
103
  "homepage": "https://github.com/the-artinet-project/artinet-sdk#readme",
104
104
  "dependencies": {
105
- "@artinet/types": "^0.0.9",
105
+ "@artinet/types": "^0.1.4",
106
106
  "@opentelemetry/api": "^1.9.0",
107
107
  "cors": "^2.8.5",
108
108
  "eventemitter3": "^5.0.1",
@@ -110,18 +110,18 @@
110
110
  "zod": "^3.25"
111
111
  },
112
112
  "peerDependencies": {
113
- "express": "^5.1.0",
114
113
  "@a2a-js/sdk": "^0.3.7",
115
114
  "@modelcontextprotocol/sdk": "^1.24.3",
116
115
  "@trpc/server": "^11.4.3",
117
- "drizzle-orm": "^0.45.1"
116
+ "drizzle-orm": "^0.45.1",
117
+ "express": "^5.1.0"
118
118
  },
119
119
  "peerDependenciesMeta": {
120
120
  "express": {
121
- "optional": false
121
+ "optional": true
122
122
  },
123
123
  "@modelcontextprotocol/sdk": {
124
- "optional": false
124
+ "optional": true
125
125
  },
126
126
  "@a2a-js/sdk": {
127
127
  "optional": false
@@ -140,8 +140,6 @@
140
140
  }
141
141
  },
142
142
  "devDependencies": {
143
- "better-sqlite3": "^12.5.0",
144
- "drizzle-orm": "^0.45.1",
145
143
  "@a2a-js/sdk": "^0.3.7",
146
144
  "@cfworker/json-schema": "^4.1.1",
147
145
  "@eslint/js": "^9.25.1",
@@ -154,26 +152,28 @@
154
152
  "@types/jest": "^30.0.0",
155
153
  "@types/node": "^25.0.3",
156
154
  "@types/supertest": "latest",
155
+ "better-sqlite3": "^12.6.2",
156
+ "drizzle-orm": "^0.45.1",
157
157
  "eslint": "^9.25.1",
158
- "globals": "^16.0.0",
158
+ "globals": "^17.0.0",
159
159
  "jest": "^30.2.0",
160
160
  "msw": "^2.7.5",
161
+ "nock": "^15.0.0",
161
162
  "pino": "^10.1.0",
162
163
  "pino-caller": "^4.0.0",
163
164
  "pino-pretty": "^13.1.3",
164
165
  "rimraf": "^6.1.2",
165
166
  "supertest": "latest",
166
- "ts-jest": "^29.3.2",
167
- "ts-node": "^10.9.1",
167
+ "ts-jest": "^29.4.6",
168
+ "ts-node": "^10.9.2",
168
169
  "ts-patch": "^3.3.0",
169
- "tsx": "^4.20.4",
170
- "typescript": "^5.2.2",
171
- "typescript-eslint": "^8.31.0",
172
- "typescript-transform-paths": "^3.5.5",
173
- "winston": "^3.19.0",
174
- "nock": "^14.0.10"
170
+ "tsx": "^4.21.0",
171
+ "typescript": "^5.9.3",
172
+ "typescript-eslint": "^8.53.0",
173
+ "typescript-transform-paths": "^3.5.6",
174
+ "winston": "^3.19.0"
175
175
  },
176
176
  "engines": {
177
- "node": ">=18.9.1"
177
+ "node": ">=20.0.0"
178
178
  }
179
179
  }