@a2aletheia/sdk 0.2.1 → 0.2.2

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,6 +1,8 @@
1
1
  export { AletheiaAgent } from "./aletheia-agent.js";
2
2
  export { AgentResponse } from "./agent-response.js";
3
3
  export { AgentContextImpl } from "./agent-context.js";
4
+ export { RedisTaskStore } from "./redis-task-store.js";
5
+ export type { RedisTaskStoreOptions, RedisLike, } from "./redis-task-store.js";
4
6
  export type { AletheiaAgentConfig, AletheiaExtensions, AgentHandler, CancelHandler, AgentContext, Part, TextPart, DataPart, FilePart, Artifact, AgentCard, AgentSkill, AgentCapabilities, Message, Task, TaskState, TaskStatus, TaskStatusUpdateEvent, TaskArtifactUpdateEvent, ExecutionEventBus, TaskStore, AgentExecutionEvent, AgentExecutor, } from "./types.js";
5
7
  export { InMemoryTaskStore, A2AError, RequestContext, DefaultExecutionEventBus, } from "@a2a-js/sdk/server";
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,YAAY,EAEZ,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,UAAU,EACV,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,mBAAmB,EACnB,aAAa,GACd,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,YAAY,EACV,qBAAqB,EACrB,SAAS,GACV,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,YAAY,EAEZ,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,IAAI,EACJ,SAAS,EACT,UAAU,EACV,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,mBAAmB,EACnB,aAAa,GACd,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
@@ -4,6 +4,8 @@ export { AletheiaAgent } from "./aletheia-agent.js";
4
4
  export { AgentResponse } from "./agent-response.js";
5
5
  // Context implementation
6
6
  export { AgentContextImpl } from "./agent-context.js";
7
+ // Redis task store
8
+ export { RedisTaskStore } from "./redis-task-store.js";
7
9
  // Re-export useful classes from @a2a-js/sdk/server
8
10
  export { InMemoryTaskStore, A2AError, RequestContext, DefaultExecutionEventBus, } from "@a2a-js/sdk/server";
9
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,kBAAkB;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,yBAAyB;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA8BtD,mDAAmD;AACnD,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,kBAAkB;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,yBAAyB;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,mBAAmB;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAkCvD,mDAAmD;AACnD,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,wBAAwB,GACzB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { Task } from "@a2a-js/sdk";
2
+ import type { TaskStore } from "@a2a-js/sdk/server";
3
+ /**
4
+ * Minimal subset of a Redis client that {@link RedisTaskStore} needs.
5
+ * Compatible with ioredis, node-redis v4, and most Redis client libraries.
6
+ */
7
+ export interface RedisLike {
8
+ get(key: string): Promise<string | null>;
9
+ set(key: string, value: string, ...args: unknown[]): Promise<unknown>;
10
+ del(...args: unknown[]): Promise<unknown>;
11
+ }
12
+ export interface RedisTaskStoreOptions {
13
+ /** Key prefix. Default: `"aletheia:task:"` */
14
+ prefix?: string;
15
+ /** TTL in seconds. Default: `86400` (24 hours). Set to `0` to disable. */
16
+ ttlSeconds?: number;
17
+ }
18
+ /**
19
+ * A {@link TaskStore} backed by any Redis-like client.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import IORedis from "ioredis";
24
+ * import { RedisTaskStore } from "@a2aletheia/sdk/agent";
25
+ *
26
+ * const redis = new IORedis("redis://localhost:6379");
27
+ * const taskStore = new RedisTaskStore(redis, { ttlSeconds: 3600 });
28
+ *
29
+ * const agent = new AletheiaAgent({ taskStore, ... });
30
+ * ```
31
+ */
32
+ export declare class RedisTaskStore implements TaskStore {
33
+ private readonly redis;
34
+ private readonly prefix;
35
+ private readonly ttl;
36
+ constructor(redis: RedisLike, options?: RedisTaskStoreOptions);
37
+ save(task: Task): Promise<void>;
38
+ load(taskId: string): Promise<Task | undefined>;
39
+ }
40
+ //# sourceMappingURL=redis-task-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis-task-store.d.ts","sourceRoot":"","sources":["../../src/agent/redis-task-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,qBAAqB;IACpC,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAKD;;;;;;;;;;;;;GAaG;AACH,qBAAa,cAAe,YAAW,SAAS;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAY;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAMvD,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAU/B,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;CAStD"}
@@ -0,0 +1,48 @@
1
+ const DEFAULT_PREFIX = "aletheia:task:";
2
+ const DEFAULT_TTL = 86400; // 24 hours
3
+ /**
4
+ * A {@link TaskStore} backed by any Redis-like client.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import IORedis from "ioredis";
9
+ * import { RedisTaskStore } from "@a2aletheia/sdk/agent";
10
+ *
11
+ * const redis = new IORedis("redis://localhost:6379");
12
+ * const taskStore = new RedisTaskStore(redis, { ttlSeconds: 3600 });
13
+ *
14
+ * const agent = new AletheiaAgent({ taskStore, ... });
15
+ * ```
16
+ */
17
+ export class RedisTaskStore {
18
+ redis;
19
+ prefix;
20
+ ttl;
21
+ constructor(redis, options) {
22
+ this.redis = redis;
23
+ this.prefix = options?.prefix ?? DEFAULT_PREFIX;
24
+ this.ttl = options?.ttlSeconds ?? DEFAULT_TTL;
25
+ }
26
+ async save(task) {
27
+ const key = `${this.prefix}${task.id}`;
28
+ const value = JSON.stringify(task);
29
+ if (this.ttl > 0) {
30
+ await this.redis.set(key, value, "EX", this.ttl);
31
+ }
32
+ else {
33
+ await this.redis.set(key, value);
34
+ }
35
+ }
36
+ async load(taskId) {
37
+ const raw = await this.redis.get(`${this.prefix}${taskId}`);
38
+ if (!raw)
39
+ return undefined;
40
+ try {
41
+ return JSON.parse(raw);
42
+ }
43
+ catch {
44
+ return undefined;
45
+ }
46
+ }
47
+ }
48
+ //# sourceMappingURL=redis-task-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis-task-store.js","sourceRoot":"","sources":["../../src/agent/redis-task-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,CAAC;QACnB,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,65 +1,65 @@
1
- {
2
- "name": "@a2aletheia/sdk",
3
- "version": "0.2.1",
4
- "description": "SDK for integrating with the Aletheia A2A Agent Discovery Registry",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "default": "./dist/index.js"
12
- },
13
- "./agent": {
14
- "types": "./dist/agent/index.d.ts",
15
- "default": "./dist/agent/index.js"
16
- }
17
- },
18
- "files": [
19
- "dist",
20
- "README.md"
21
- ],
22
- "keywords": [
23
- "a2a",
24
- "agent",
25
- "discovery",
26
- "aletheia",
27
- "multi-agent",
28
- "ai-agents"
29
- ],
30
- "author": "",
31
- "license": "MIT",
32
- "repository": {
33
- "type": "git",
34
- "url": "https://github.com/weedeej/aletheia"
35
- },
36
- "dependencies": {
37
- "@a2a-js/sdk": "^0.2.5",
38
- "@noble/ed25519": "^2.1.0",
39
- "@noble/hashes": "^2.0.1",
40
- "viem": "^2.21.0",
41
- "zod": "^3.24.0"
42
- },
43
- "devDependencies": {
44
- "@types/express": "^4.17.21",
45
- "rimraf": "^6.0.1",
46
- "@types/node": "^20",
47
- "typescript": "^5.9.2",
48
- "vitest": "^2.1.0"
49
- },
50
- "peerDependencies": {
51
- "express": ">=4.0.0"
52
- },
53
- "peerDependenciesMeta": {
54
- "express": {
55
- "optional": true
56
- }
57
- },
58
- "scripts": {
59
- "build": "tsc",
60
- "check-types": "tsc --noEmit",
61
- "lint": "eslint .",
62
- "test": "vitest run",
63
- "clean": "rimraf dist"
64
- }
65
- }
1
+ {
2
+ "name": "@a2aletheia/sdk",
3
+ "version": "0.2.2",
4
+ "description": "SDK for integrating with the Aletheia A2A Agent Discovery Registry",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./agent": {
14
+ "types": "./dist/agent/index.d.ts",
15
+ "default": "./dist/agent/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md"
21
+ ],
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "check-types": "tsc --noEmit",
25
+ "lint": "eslint .",
26
+ "test": "vitest run",
27
+ "clean": "rimraf dist"
28
+ },
29
+ "keywords": [
30
+ "a2a",
31
+ "agent",
32
+ "discovery",
33
+ "aletheia",
34
+ "multi-agent",
35
+ "ai-agents"
36
+ ],
37
+ "author": "",
38
+ "license": "MIT",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://github.com/weedeej/aletheia"
42
+ },
43
+ "dependencies": {
44
+ "@a2a-js/sdk": "^0.2.5",
45
+ "@noble/ed25519": "^2.1.0",
46
+ "@noble/hashes": "^2.0.1",
47
+ "viem": "^2.21.0",
48
+ "zod": "^3.24.0"
49
+ },
50
+ "devDependencies": {
51
+ "@types/express": "^4.17.21",
52
+ "rimraf": "^6.0.1",
53
+ "@types/node": "^20",
54
+ "typescript": "^5.9.2",
55
+ "vitest": "^2.1.0"
56
+ },
57
+ "peerDependencies": {
58
+ "express": ">=4.0.0"
59
+ },
60
+ "peerDependenciesMeta": {
61
+ "express": {
62
+ "optional": true
63
+ }
64
+ }
65
+ }