arki 0.0.1 → 0.0.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.
package/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Arki is an AI agent programming tool.
4
4
 
5
+ [![npm version](https://img.shields.io/npm/v/arki.svg)](https://www.npmjs.com/package/arki)
6
+ [![npm downloads](https://img.shields.io/npm/dm/arki.svg)](https://www.npmjs.com/package/arki)
7
+
5
8
  ## Installation
6
9
 
7
10
  ### Via npm
package/dist/index.d.ts CHANGED
@@ -316,7 +316,8 @@ declare class Agent {
316
316
  messages: Msg[];
317
317
  onStream?: (chunk: string) => void;
318
318
  onToolCallMsg?: (msg: ToolCallMsg) => void;
319
- onToolResult?: (name: string, result: string) => void;
319
+ onBeforeToolRun?: (name: string, args: Record<string, unknown>) => void;
320
+ onToolResult?: (name: string, args: Record<string, unknown>, result: string) => void;
320
321
  });
321
322
  /**
322
323
  * Render template string, replacing {{variable}} style variables
package/dist/index.js CHANGED
@@ -687,6 +687,7 @@ var Agent = class {
687
687
  debug("Agent", `Received tool call request`, toolCalls.map((tc) => tc.name));
688
688
  this.config.onToolCallMsg?.(toolCallMsg);
689
689
  for (const tc of toolCalls) {
690
+ this.config.onBeforeToolRun?.(tc.name, tc.arguments);
690
691
  debug("Agent", `Executing tool: ${tc.name}`, tc.arguments);
691
692
  const tool = TOOLS[tc.name];
692
693
  const result = tool ? await tool.run(tc.arguments) : new ToolResultMsg(tc.name, `Unknown tool: ${tc.name}`, true);
@@ -699,7 +700,7 @@ var Agent = class {
699
700
  arguments: tc.arguments,
700
701
  result: result.result
701
702
  });
702
- this.config.onToolResult?.(tc.name, result.result);
703
+ this.config.onToolResult?.(tc.name, tc.arguments, result.result);
703
704
  this.messages.push(result);
704
705
  }
705
706
  }
@@ -760,17 +761,19 @@ function createMainAgent() {
760
761
  onStream: (chunk) => {
761
762
  process.stdout.write(convertColor(chunk));
762
763
  },
763
- onToolCallMsg: (msg) => {
764
- for (const tc of msg.toolCalls) {
765
- console.log();
766
- log("yellow", `\u{1F527} Calling tool: ${tc.name}`);
767
- log("dim", ` Arguments: ${JSON.stringify(tc.arguments)}`);
768
- }
764
+ onBeforeToolRun: (name, args) => {
765
+ const argsStr = JSON.stringify(args);
766
+ const argsPreview = argsStr.length > 60 ? argsStr.substring(0, 60) + "..." : argsStr;
767
+ process.stdout.write(`\x1B[33m\u{1F527} ${name}\x1B[0m \x1B[2m${argsPreview}\x1B[0m`);
769
768
  },
770
- onToolResult: (_name, result) => {
771
- const preview = result.length > 200 ? result.substring(0, 200) + "..." : result;
772
- log("green", ` Result: ${preview.split("\n")[0]}`);
773
- console.log();
769
+ onToolResult: (name, args, result) => {
770
+ const argsStr = JSON.stringify(args);
771
+ const argsPreview = argsStr.length > 60 ? argsStr.substring(0, 60) + "..." : argsStr;
772
+ const resultPreview = result.length > 80 ? result.substring(0, 80) + "..." : result;
773
+ const firstLine = resultPreview.split("\n")[0];
774
+ process.stdout.write(`\r\x1B[2K\x1B[32m\u2714 ${name}\x1B[0m \x1B[2m${argsPreview}\x1B[0m
775
+ `);
776
+ log("dim", ` ${firstLine}`);
774
777
  }
775
778
  });
776
779
  return agent;
@@ -779,13 +782,13 @@ function createMainAgent() {
779
782
  // package.json
780
783
  var package_default = {
781
784
  name: "arki",
782
- version: "0.0.1",
785
+ version: "0.0.2",
783
786
  description: "AI Agent Programming Assistant",
784
787
  type: "module",
785
788
  main: "dist/index.js",
786
789
  types: "dist/index.d.ts",
787
790
  bin: {
788
- arki: "./bin/arki.js"
791
+ arki: "bin/arki.js"
789
792
  },
790
793
  scripts: {
791
794
  dev: "NODE_OPTIONS='--import ./register-md.mjs' tsx src/index.ts",
@@ -796,7 +799,8 @@ var package_default = {
796
799
  test: "vitest run",
797
800
  "test:watch": "vitest",
798
801
  "test:coverage": "vitest run --coverage",
799
- "test:e2e": "vitest run --testNamePattern='E2E'"
802
+ "test:e2e": "vitest run --testNamePattern='E2E'",
803
+ prepublishOnly: "pnpm build"
800
804
  },
801
805
  keywords: [
802
806
  "ai",
@@ -809,7 +813,7 @@ var package_default = {
809
813
  license: "MIT",
810
814
  repository: {
811
815
  type: "git",
812
- url: "https://github.com/your-username/arki.git"
816
+ url: "git+https://github.com/your-username/arki.git"
813
817
  },
814
818
  packageManager: "pnpm@10.15.1",
815
819
  engines: {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "arki",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "AI Agent Programming Assistant",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "bin": {
9
- "arki": "./bin/arki.js"
9
+ "arki": "bin/arki.js"
10
10
  },
11
11
  "scripts": {
12
12
  "dev": "NODE_OPTIONS='--import ./register-md.mjs' tsx src/index.ts",
@@ -17,7 +17,8 @@
17
17
  "test": "vitest run",
18
18
  "test:watch": "vitest",
19
19
  "test:coverage": "vitest run --coverage",
20
- "test:e2e": "vitest run --testNamePattern='E2E'"
20
+ "test:e2e": "vitest run --testNamePattern='E2E'",
21
+ "prepublishOnly": "pnpm build"
21
22
  },
22
23
  "keywords": [
23
24
  "ai",
@@ -30,7 +31,7 @@
30
31
  "license": "MIT",
31
32
  "repository": {
32
33
  "type": "git",
33
- "url": "https://github.com/your-username/arki.git"
34
+ "url": "git+https://github.com/your-username/arki.git"
34
35
  },
35
36
  "packageManager": "pnpm@10.15.1",
36
37
  "engines": {