@shareai-lab/kode-sdk 1.0.0-beta.4 → 1.0.0-beta.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.
@@ -34,15 +34,12 @@ class BashRun {
34
34
  proc.stdout = result.stdout;
35
35
  proc.stderr = result.stderr;
36
36
  });
37
- return { shell_id: id, status: 'running' };
37
+ return `Background shell started: ${id}`;
38
38
  }
39
39
  else {
40
40
  const result = await ctx.sandbox.exec(args.cmd, { timeoutMs: args.timeout_ms });
41
- return {
42
- code: result.code,
43
- stdout: result.stdout,
44
- stderr: result.stderr,
45
- };
41
+ const output = [result.stdout, result.stderr].filter(Boolean).join('\n').trim();
42
+ return output || '(no output)';
46
43
  }
47
44
  }
48
45
  }
@@ -65,13 +62,9 @@ class BashLogs {
65
62
  throw new Error(`Shell not found: ${args.shell_id}`);
66
63
  }
67
64
  const isRunning = proc.code === undefined;
68
- return {
69
- shell_id: args.shell_id,
70
- status: isRunning ? 'running' : 'completed',
71
- code: proc.code,
72
- stdout: proc.stdout,
73
- stderr: proc.stderr,
74
- };
65
+ const status = isRunning ? 'running' : `completed (exit code ${proc.code})`;
66
+ const output = [proc.stdout, proc.stderr].filter(Boolean).join('\n').trim();
67
+ return `Shell ${args.shell_id}: ${status}\n${output || '(no output yet)'}`;
75
68
  }
76
69
  }
77
70
  exports.BashLogs = BashLogs;
@@ -93,7 +86,7 @@ class BashKill {
93
86
  throw new Error(`Shell not found: ${args.shell_id}`);
94
87
  }
95
88
  processes.delete(args.shell_id);
96
- return { shell_id: args.shell_id, status: 'killed' };
89
+ return `Killed shell ${args.shell_id}`;
97
90
  }
98
91
  }
99
92
  exports.BashKill = BashKill;
package/dist/tools/fs.js CHANGED
@@ -41,7 +41,8 @@ class FsWrite {
41
41
  }
42
42
  async exec(args, ctx) {
43
43
  await ctx.sandbox.fs.write(args.file, args.content);
44
- return { success: true, file: args.file };
44
+ const bytes = Buffer.byteLength(args.content, 'utf8');
45
+ return `Wrote ${bytes} bytes to ${args.file}`;
45
46
  }
46
47
  }
47
48
  exports.FsWrite = FsWrite;
@@ -66,7 +67,7 @@ class FsEdit {
66
67
  const updated = content.split(args.old_string).join(args.new_string);
67
68
  await ctx.sandbox.fs.write(args.file, updated);
68
69
  const count = content.split(args.old_string).length - 1;
69
- return { success: true, file: args.file, replacements: count };
70
+ return `Replaced ${count} occurrence(s) in ${args.file}`;
70
71
  }
71
72
  else {
72
73
  const occurrences = content.split(args.old_string).length - 1;
@@ -78,7 +79,7 @@ class FsEdit {
78
79
  }
79
80
  const updated = content.replace(args.old_string, args.new_string);
80
81
  await ctx.sandbox.fs.write(args.file, updated);
81
- return { success: true, file: args.file, replacements: 1 };
82
+ return `Replaced 1 occurrence in ${args.file}`;
82
83
  }
83
84
  }
84
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shareai-lab/kode-sdk",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "Event-driven Agent Model Client SDK for building long-running, collaborative AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "author": "",
33
33
  "license": "MIT",
34
34
  "devDependencies": {
35
- "@shareai-lab/kode-sdk": "^1.0.0-beta.3",
35
+ "@shareai-lab/kode-sdk": "^1.0.0-beta.4",
36
36
  "@types/node": "^20.0.0",
37
37
  "ts-node": "^10.9.0",
38
38
  "typescript": "^5.3.0"