@a2anet/a2a-utils 0.1.0 → 0.3.0
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 +1412 -2
- package/dist/artifacts/data.d.ts +118 -0
- package/dist/artifacts/data.d.ts.map +1 -0
- package/dist/artifacts/data.js +583 -0
- package/dist/artifacts/data.js.map +1 -0
- package/dist/artifacts/index.d.ts +33 -0
- package/dist/artifacts/index.d.ts.map +1 -0
- package/dist/artifacts/index.js +131 -0
- package/dist/artifacts/index.js.map +1 -0
- package/dist/artifacts/text.d.ts +54 -0
- package/dist/artifacts/text.d.ts.map +1 -0
- package/dist/artifacts/text.js +151 -0
- package/dist/artifacts/text.js.map +1 -0
- package/dist/client/a2a-session.d.ts +94 -0
- package/dist/client/a2a-session.d.ts.map +1 -0
- package/dist/client/a2a-session.js +264 -0
- package/dist/client/a2a-session.js.map +1 -0
- package/dist/client/a2a-tools.d.ts +152 -0
- package/dist/client/a2a-tools.d.ts.map +1 -0
- package/dist/client/a2a-tools.js +470 -0
- package/dist/client/a2a-tools.js.map +1 -0
- package/dist/client/agent-manager.d.ts +94 -0
- package/dist/client/agent-manager.d.ts.map +1 -0
- package/dist/client/agent-manager.js +243 -0
- package/dist/client/agent-manager.js.map +1 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -0
- package/dist/files/file-store.d.ts +24 -0
- package/dist/files/file-store.d.ts.map +1 -0
- package/dist/files/file-store.js +5 -0
- package/dist/files/file-store.js.map +1 -0
- package/dist/files/index.d.ts +3 -0
- package/dist/files/index.d.ts.map +1 -0
- package/dist/files/index.js +5 -0
- package/dist/files/index.js.map +1 -0
- package/dist/files/local-file-store.d.ts +26 -0
- package/dist/files/local-file-store.d.ts.map +1 -0
- package/dist/files/local-file-store.js +99 -0
- package/dist/files/local-file-store.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/tasks/index.d.ts +2 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +5 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/json-task-store.d.ts +32 -0
- package/dist/tasks/json-task-store.d.ts.map +1 -0
- package/dist/tasks/json-task-store.js +66 -0
- package/dist/tasks/json-task-store.js.map +1 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +23 -0
- package/dist/types.js.map +1 -0
- package/package.json +17 -4
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed interfaces for LLM-facing A2A responses.
|
|
3
|
+
*/
|
|
4
|
+
import type { AgentCard, TaskState } from "@a2a-js/sdk";
|
|
5
|
+
export interface AgentURLAndCustomHeaders {
|
|
6
|
+
readonly agentCard: AgentCard;
|
|
7
|
+
readonly customHeaders: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export declare const TERMINAL_OR_ACTIONABLE_STATES: ReadonlySet<string>;
|
|
10
|
+
/** Configuration for artifact minimization and viewing. */
|
|
11
|
+
export declare class ArtifactSettings {
|
|
12
|
+
readonly sendMessageCharacterLimit: number;
|
|
13
|
+
readonly minimizedObjectStringLength: number;
|
|
14
|
+
readonly viewArtifactCharacterLimit: number;
|
|
15
|
+
constructor(opts?: {
|
|
16
|
+
sendMessageCharacterLimit?: number;
|
|
17
|
+
minimizedObjectStringLength?: number;
|
|
18
|
+
viewArtifactCharacterLimit?: number;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export interface TextPartForLLM {
|
|
22
|
+
readonly kind: "text";
|
|
23
|
+
readonly text: string;
|
|
24
|
+
readonly _total_lines?: number;
|
|
25
|
+
readonly _total_characters?: number;
|
|
26
|
+
readonly _start_line_range?: string;
|
|
27
|
+
readonly _end_line_range?: string;
|
|
28
|
+
readonly _start_character_range?: string;
|
|
29
|
+
readonly _end_character_range?: string;
|
|
30
|
+
readonly _tip?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface DataPartForLLM {
|
|
33
|
+
readonly kind: "data";
|
|
34
|
+
readonly data: unknown;
|
|
35
|
+
}
|
|
36
|
+
export interface FilePartForLLM {
|
|
37
|
+
readonly kind: "file";
|
|
38
|
+
readonly name: string | null;
|
|
39
|
+
readonly mimeType: string | null;
|
|
40
|
+
readonly uri: string | Record<string, unknown> | null;
|
|
41
|
+
readonly bytes: Record<string, unknown> | null;
|
|
42
|
+
}
|
|
43
|
+
export interface ArtifactForLLM {
|
|
44
|
+
readonly artifactId: string;
|
|
45
|
+
readonly description: string | null;
|
|
46
|
+
readonly name: string | null;
|
|
47
|
+
readonly parts: ReadonlyArray<TextPartForLLM | DataPartForLLM | FilePartForLLM>;
|
|
48
|
+
}
|
|
49
|
+
export interface MessageForLLM {
|
|
50
|
+
readonly contextId: string | null;
|
|
51
|
+
readonly kind: "message";
|
|
52
|
+
readonly parts: ReadonlyArray<TextPartForLLM | DataPartForLLM | FilePartForLLM>;
|
|
53
|
+
}
|
|
54
|
+
export interface TaskStatusForLLM {
|
|
55
|
+
readonly state: TaskState;
|
|
56
|
+
readonly message: MessageForLLM | null;
|
|
57
|
+
}
|
|
58
|
+
export interface TaskForLLM {
|
|
59
|
+
readonly id: string;
|
|
60
|
+
readonly contextId: string;
|
|
61
|
+
readonly kind: "task";
|
|
62
|
+
readonly status: TaskStatusForLLM;
|
|
63
|
+
readonly artifacts: ReadonlyArray<ArtifactForLLM>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,wBAAw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et.com>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
export const TERMINAL_OR_ACTIONABLE_STATES = new Set([
|
|
5
|
+
"completed",
|
|
6
|
+
"canceled",
|
|
7
|
+
"failed",
|
|
8
|
+
"rejected",
|
|
9
|
+
"input-required",
|
|
10
|
+
"auth-required",
|
|
11
|
+
]);
|
|
12
|
+
/** Configuration for artifact minimization and viewing. */
|
|
13
|
+
export class ArtifactSettings {
|
|
14
|
+
sendMessageCharacterLimit;
|
|
15
|
+
minimizedObjectStringLength;
|
|
16
|
+
viewArtifactCharacterLimit;
|
|
17
|
+
constructor(opts) {
|
|
18
|
+
this.sendMessageCharacterLimit = opts?.sendMessageCharacterLimit ?? 50_000;
|
|
19
|
+
this.minimizedObjectStringLength = opts?.minimizedObjectStringLength ?? 5_000;
|
|
20
|
+
this.viewArtifactCharacterLimit = opts?.viewArtifactCharacterLimit ?? 50_000;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,sCAAsC;AAatC,MAAM,CAAC,MAAM,6BAA6B,GAAwB,IAAI,GAAG,CAAS;IAC9E,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;IACV,gBAAgB;IAChB,eAAe;CAClB,CAAC,CAAC;AAEH,2DAA2D;AAC3D,MAAM,OAAO,gBAAgB;IAChB,yBAAyB,CAAS;IAClC,2BAA2B,CAAS;IACpC,0BAA0B,CAAS;IAE5C,YAAY,IAIX;QACG,IAAI,CAAC,yBAAyB,GAAG,IAAI,EAAE,yBAAyB,IAAI,MAAM,CAAC;QAC3E,IAAI,CAAC,2BAA2B,GAAG,IAAI,EAAE,2BAA2B,IAAI,KAAK,CAAC;QAC9E,IAAI,CAAC,0BAA0B,GAAG,IAAI,EAAE,0BAA0B,IAAI,MAAM,CAAC;IACjF,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a2anet/a2a-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A collection of utilities for discovering, communicating, and authenticating with A2A Servers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
},
|
|
12
12
|
"main": "./dist/index.js",
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
|
-
"files": [
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
15
17
|
"scripts": {
|
|
16
18
|
"build": "tsc",
|
|
17
19
|
"check": "biome check .",
|
|
@@ -20,7 +22,11 @@
|
|
|
20
22
|
"test": "bun test",
|
|
21
23
|
"test:coverage": "bun test --coverage"
|
|
22
24
|
},
|
|
23
|
-
"keywords": [
|
|
25
|
+
"keywords": [
|
|
26
|
+
"a2a",
|
|
27
|
+
"agent-to-agent",
|
|
28
|
+
"utilities"
|
|
29
|
+
],
|
|
24
30
|
"author": "A2A Net <hello@a2anet.com>",
|
|
25
31
|
"license": "Apache-2.0",
|
|
26
32
|
"repository": {
|
|
@@ -31,10 +37,17 @@
|
|
|
31
37
|
"url": "https://github.com/a2anet/a2a-utils/issues"
|
|
32
38
|
},
|
|
33
39
|
"homepage": "https://github.com/a2anet/a2a-utils#readme",
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@a2a-js/sdk": "^0.3.10",
|
|
42
|
+
"uuid": "^11.1.0"
|
|
43
|
+
},
|
|
34
44
|
"devDependencies": {
|
|
35
45
|
"@biomejs/biome": "^1.9.0",
|
|
36
46
|
"@types/bun": "latest",
|
|
47
|
+
"@types/uuid": "^10.0.0",
|
|
37
48
|
"typescript": "^5.7.0"
|
|
38
49
|
},
|
|
39
|
-
"trustedDependencies": [
|
|
50
|
+
"trustedDependencies": [
|
|
51
|
+
"@biomejs/biome"
|
|
52
|
+
]
|
|
40
53
|
}
|