@artinet/ask 0.0.9 → 0.1.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.
package/README.md CHANGED
@@ -1,12 +1,13 @@
1
- [![Website](https://img.shields.io/badge/website-artinet.io-black)](https://artinet.io/)
2
- [![npm version](https://img.shields.io/npm/v/@artinet/ask.svg)](https://www.npmjs.com/package/@artinet/ask)
3
- [![npm downloads](https://img.shields.io/npm/dt/@artinet/ask.svg)](https://www.npmjs.com/package/@artinet/ask)
4
- [![Apache License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
5
- [![Known Vulnerabilities](https://snyk.io/test/npm/@artinet/ask/badge.svg)](https://snyk.io/test/npm/@artinet/ask)
6
- [![GitHub stars](https://img.shields.io/github/stars/the-artinet-project/chat?style=social)](https://github.com/the-artinet-project/chat/stargazers)
7
- [![Discord](https://dcbadge.limes.pink/api/server/DaxzSchmmX?style=flat)](https://discord.gg/DaxzSchmmX)
8
-
9
- # @artinet/ask
1
+
2
+ <p align="center">
3
+ <a href="https://artinet.io"><img src="https://img.shields.io/badge/website-artinet.io-black" alt="Website"></a>
4
+ <a href="https://www.npmjs.com/package/@artinet/ask"><img src="https://img.shields.io/npm/v/@artinet/ask?color=black" alt="Version"></a>
5
+ <a href="https://www.npmjs.com/package/@artinet/ask"><img src="https://img.shields.io/npm/dt/@artinet/ask?color=black" alt="Downloads"></a>
6
+ <a><img src="https://img.shields.io/badge/License-Apache_2.0-black.svg" alt="License"></a>
7
+ <a href="https://snyk.io/test/npm/@artinet/ask"><img src="https://snyk.io/test/npm/@artinet/ask/badge.svg" alt="Known Vulnerabilities"></a>
8
+ </p>
9
+
10
+ <h1 align="center"><em>ask</em></h1>
10
11
 
11
12
  A light-weight/minimalist commandline client for connecting to local and remote Agent2Agent (A2A) Servers.
12
13
 
@@ -1,2 +1,2 @@
1
- import { A2AClient, AgentCard } from "@artinet/sdk";
2
- export declare function chat(agentCard: AgentCard, client: A2AClient, taskId?: string, verbose?: boolean, message?: string | undefined): Promise<void>;
1
+ import * as sdk from "@artinet/sdk";
2
+ export declare function chat(agentCard: sdk.A2A.AgentCard, client: sdk.AgentMessenger, taskId?: string, verbose?: boolean, message?: string | undefined): Promise<void>;
package/dist/src/chat.js CHANGED
@@ -1,7 +1,8 @@
1
- import { TaskState, getContent, } from "@artinet/sdk";
1
+ import * as sdk from "@artinet/sdk";
2
2
  import chalk from "chalk";
3
3
  import prompts from "prompts";
4
4
  import { v4 as uuidv4 } from "uuid";
5
+ // sdk.applyDefaults();
5
6
  function getTaskState(update) {
6
7
  const state = update?.status?.state ??
7
8
  update?.status?.state ??
@@ -16,31 +17,31 @@ function createBanner(kind, state, verbose = false) {
16
17
  }
17
18
  if (state) {
18
19
  switch (state) {
19
- case TaskState.canceled:
20
+ case sdk.A2A.TaskState.canceled:
20
21
  banner = chalk.bgYellowBright(`${state.toUpperCase()}`);
21
22
  break;
22
- case TaskState.failed:
23
+ case sdk.A2A.TaskState.failed:
23
24
  banner = chalk.bgRed(`${state.toUpperCase()}`);
24
25
  break;
25
- case TaskState.rejected:
26
+ case sdk.A2A.TaskState.rejected:
26
27
  banner = chalk.bgRed(`${state.toUpperCase()}`);
27
28
  break;
28
- case TaskState["auth-required"]:
29
+ case sdk.A2A.TaskState["auth-required"]:
29
30
  banner = chalk.bgMagenta(`${state.toUpperCase()}`);
30
31
  break;
31
- case TaskState.unknown:
32
+ case sdk.A2A.TaskState.unknown:
32
33
  banner = chalk.bgRedBright(`${state.toUpperCase()}`);
33
34
  break;
34
- case TaskState.submitted:
35
+ case sdk.A2A.TaskState.submitted:
35
36
  banner = chalk.bgYellow(chalk.black(`${state.toUpperCase()}`));
36
37
  break;
37
- case TaskState["input-required"]:
38
+ case sdk.A2A.TaskState["input-required"]:
38
39
  banner = chalk.bgMagenta(chalk.black(`${state.toUpperCase()}`));
39
40
  break;
40
- case TaskState.working:
41
+ case sdk.A2A.TaskState.working:
41
42
  banner = chalk.bgBlueBright(`${state.toUpperCase()}`);
42
43
  break;
43
- case TaskState.completed:
44
+ case sdk.A2A.TaskState.completed:
44
45
  banner = chalk.bgGreen(`${state.toUpperCase()}`);
45
46
  break;
46
47
  }
@@ -54,7 +55,7 @@ async function sendMessage(client, message, taskId, verbose = false) {
54
55
  const msg = {
55
56
  messageId: uuidv4(),
56
57
  taskId: taskId,
57
- kind: "message",
58
+ kind: sdk.A2A.Kind.message,
58
59
  role: "user",
59
60
  parts: [{ text: message, kind: "text" }],
60
61
  };
@@ -69,7 +70,7 @@ async function sendMessage(client, message, taskId, verbose = false) {
69
70
  return;
70
71
  }
71
72
  const banner = createBanner(agentResponseSource.kind, getTaskState(agentResponseSource), verbose);
72
- console.log(banner + chalk.gray("Agent: ") + getContent(agentResponseSource));
73
+ console.log(banner + chalk.gray("Agent: ") + sdk.extractTextContent(agentResponseSource));
73
74
  console.log();
74
75
  }
75
76
  export async function chat(agentCard, client, taskId = uuidv4(), verbose = false, message = undefined) {
@@ -104,7 +105,7 @@ export async function chat(agentCard, client, taskId = uuidv4(), verbose = false
104
105
  const msg = {
105
106
  messageId: uuidv4(),
106
107
  taskId: taskId,
107
- kind: "message",
108
+ kind: sdk.A2A.Kind.message,
108
109
  role: "user",
109
110
  parts: [{ text: response.message, kind: "text" }],
110
111
  };
@@ -113,13 +114,15 @@ export async function chat(agentCard, client, taskId = uuidv4(), verbose = false
113
114
  console.log(chalk.bgWhite(chalk.black(`📤 Sending message: ${msg.messageId}`)));
114
115
  }
115
116
  try {
116
- const agentResponseSource = client.sendStreamingMessage({ message: msg });
117
+ const agentResponseSource = client.sendMessageStream({
118
+ message: msg,
119
+ });
117
120
  for await (const update of agentResponseSource) {
118
121
  const banner = createBanner(update.kind, getTaskState(update), verbose);
119
122
  if ((update.kind === "message" || update.kind === "task") && !verbose) {
120
123
  continue;
121
124
  }
122
- const response = getContent(update) ?? "No response";
125
+ const response = sdk.extractTextContent(update) ?? "No response";
123
126
  if (response) {
124
127
  console.log(banner + chalk.gray("Agent: ") + response);
125
128
  }
package/dist/src/cli.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Copyright 2025 The Artinet Project
5
5
  * SPDX-License-Identifier: Apache-2.0
6
6
  */
7
- import { A2AClient } from "@artinet/sdk";
7
+ import * as sdk from "@artinet/sdk";
8
8
  import { Command } from "commander";
9
9
  import { chat } from "./chat.js";
10
10
  import chalk from "chalk";
@@ -21,7 +21,9 @@ program
21
21
  .action(async (options) => {
22
22
  let client;
23
23
  try {
24
- client = new A2AClient(options?.endpoint ?? "http://localhost:3000/a2a");
24
+ client = await sdk.createMessenger({
25
+ baseUrl: options?.endpoint ?? "http://localhost:3000/a2a",
26
+ });
25
27
  }
26
28
  catch (error) {
27
29
  console.error(chalk.red("Error creating client:"));
@@ -32,7 +34,7 @@ program
32
34
  console.error(chalk.red("Failed to create client"));
33
35
  process.exit(1);
34
36
  }
35
- const agentCard = await client.agentCard().catch((error) => {
37
+ let agentCard = await client.getAgentCard().catch((error) => {
36
38
  console.error(chalk.red("Error getting agent card:"));
37
39
  console.error(error instanceof Error ? error.message : String(error));
38
40
  process.exit(1);
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@artinet/ask",
3
- "version": "0.0.9",
3
+ "version": "0.1.5",
4
4
  "description": "A lightweight command-line chat client for connecting to A2A Servers.",
5
5
  "author": "artinet",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/the-artinet-project/chat"
9
+ "url": "https://github.com/the-artinet-project/artinet"
10
10
  },
11
11
  "issues": {
12
- "url": "https://github.com/the-artinet-project/chat/issues"
12
+ "url": "https://github.com/the-artinet-project/artinetissues"
13
13
  },
14
14
  "files": [
15
15
  "dist",
@@ -31,7 +31,7 @@
31
31
  "artificial intelligence"
32
32
  ],
33
33
  "engines": {
34
- "node": ">=18.9.1"
34
+ "node": ">=20.0.0"
35
35
  },
36
36
  "type": "module",
37
37
  "main": "./dist/src/index.js",
@@ -48,18 +48,18 @@
48
48
  "ask": "node dist/src/cli.js"
49
49
  },
50
50
  "dependencies": {
51
+ "@artinet/sdk": "^0.6.4",
51
52
  "chalk": "^5.6.2",
52
53
  "commander": "^14.0.1",
53
- "@artinet/sdk": "^0.5.18",
54
54
  "prompts": "^2.4.2",
55
55
  "uuid": "^13.0.0"
56
56
  },
57
57
  "devDependencies": {
58
- "rimraf": "^5.0.5",
59
- "ts-node": "^10.9.2",
60
- "tsx": "^4.19.2",
61
- "typescript": "^5.9.3",
58
+ "@types/node": "^25.0.9",
62
59
  "@types/prompts": "^2.4.9",
63
- "@types/node": "^24.7.0"
60
+ "rimraf": "^6.1.2",
61
+ "ts-node": "^10.9.2",
62
+ "tsx": "^4.21.0",
63
+ "typescript": "^5.9.3"
64
64
  }
65
65
  }