@agentskit/cli 0.13.40 → 0.13.42

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/dist/index.cjs CHANGED
@@ -15,12 +15,13 @@ var tools = require('@agentskit/tools');
15
15
  var skills = require('@agentskit/skills');
16
16
  var memory = require('@agentskit/memory');
17
17
  var integrations = require('@agentskit/integrations');
18
- var child_process = require('child_process');
18
+ var crossPlatform = require('@agentskit/cross-platform');
19
19
  var jsxRuntime = require('react/jsx-runtime');
20
20
  var url = require('url');
21
21
  var runtime = require('@agentskit/runtime');
22
22
  var prompts = require('@inquirer/prompts');
23
23
  var kleur = require('kleur');
24
+ var child_process = require('child_process');
24
25
  var module$1 = require('module');
25
26
  var chokidar = require('chokidar');
26
27
  var rag = require('@agentskit/rag');
@@ -39,7 +40,7 @@ var chokidar__default = /*#__PURE__*/_interopDefault(chokidar);
39
40
 
40
41
  // package.json
41
42
  var package_default = {
42
- version: "0.13.40"};
43
+ version: "0.13.42"};
43
44
  async function loadJsonConfig(path6) {
44
45
  try {
45
46
  const raw = await promises.readFile(path6, "utf8");
@@ -153,7 +154,7 @@ var providers = {
153
154
  deepseek: {
154
155
  label: "DeepSeek",
155
156
  envKeys: ["DEEPSEEK_API_KEY"],
156
- defaultModel: "deepseek-chat",
157
+ defaultModel: "deepseek-flash",
157
158
  factory: (c) => adapters.deepseek(c)
158
159
  },
159
160
  grok: {
@@ -165,7 +166,7 @@ var providers = {
165
166
  kimi: {
166
167
  label: "Kimi",
167
168
  envKeys: ["KIMI_API_KEY", "MOONSHOT_API_KEY"],
168
- defaultModel: "kimi-k2-0711-preview",
169
+ defaultModel: "kimi-k2.6",
169
170
  factory: (c) => adapters.kimi(c)
170
171
  },
171
172
  groq: {
@@ -925,90 +926,37 @@ function configHooksToHandlers(config) {
925
926
  }
926
927
  return handlers;
927
928
  }
928
- function runShellHook(entry, payload) {
929
- return new Promise((resolvePromise) => {
930
- const timeoutMs = entry.timeout ?? 5e3;
931
- let settled = false;
932
- const settle = (result) => {
933
- if (settled) return;
934
- settled = true;
935
- clearTimeout(timer);
936
- resolvePromise(result);
937
- };
938
- const child = child_process.spawn("sh", ["-c", entry.run], {
939
- stdio: ["pipe", "pipe", "inherit"],
940
- detached: true
941
- });
942
- let stdout = "";
943
- let stdoutBytes = 0;
944
- child.stdout.on("data", (chunk) => {
945
- const text = chunk.toString();
946
- const bytes = Buffer.byteLength(text);
947
- if (stdoutBytes + bytes > MAX_HOOK_STDOUT_BYTES) {
948
- if (child.pid !== void 0) {
949
- try {
950
- process.kill(-child.pid, "SIGKILL");
951
- } catch {
952
- }
953
- }
954
- try {
955
- child.kill("SIGKILL");
956
- } catch {
957
- }
958
- settle({ decision: "block", reason: `shell hook output exceeded ${MAX_HOOK_STDOUT_BYTES} bytes` });
959
- return;
960
- }
961
- stdoutBytes += bytes;
962
- stdout += text;
963
- });
964
- const timer = setTimeout(() => {
965
- if (child.pid !== void 0) {
966
- try {
967
- process.kill(-child.pid, "SIGKILL");
968
- } catch {
969
- }
970
- }
971
- try {
972
- child.kill("SIGKILL");
973
- } catch {
974
- }
975
- settle({ decision: "block", reason: `shell hook timed out after ${timeoutMs}ms` });
976
- }, timeoutMs);
977
- child.stdin.on("error", () => {
978
- });
979
- child.on("close", (code) => {
980
- if (code !== 0) {
981
- settle({
982
- decision: "block",
983
- reason: `shell hook exited with code ${code}`
984
- });
985
- return;
986
- }
987
- const trimmed = stdout.trim();
988
- if (!trimmed) {
989
- settle({ decision: "continue" });
990
- return;
991
- }
992
- try {
993
- const parsed = JSON.parse(trimmed);
994
- if (!parsed || typeof parsed !== "object" || !("decision" in parsed) || !["continue", "block", "modify"].includes(String(parsed.decision))) {
995
- settle({ decision: "block", reason: "shell hook returned an invalid decision" });
996
- } else {
997
- settle(parsed);
998
- }
999
- } catch {
1000
- settle({ decision: "block", reason: "shell hook returned invalid JSON" });
1001
- }
1002
- });
1003
- child.on("error", (err) => {
1004
- settle({ decision: "block", reason: err.message });
929
+ async function runShellHook(entry, payload) {
930
+ const timeoutMs = entry.timeout ?? 5e3;
931
+ let result;
932
+ try {
933
+ result = await crossPlatform.runShell(entry.run, {
934
+ input: JSON.stringify(payload),
935
+ timeoutMs,
936
+ // Hooks are fire-and-judge: no grace period once the budget is spent.
937
+ killGraceMs: 0,
938
+ maxOutputBytes: MAX_HOOK_STDOUT_BYTES
1005
939
  });
1006
- try {
1007
- child.stdin.write(JSON.stringify(payload));
1008
- child.stdin.end();
1009
- } catch {
940
+ } catch (err) {
941
+ return { decision: "block", reason: err instanceof Error ? err.message : String(err) };
942
+ }
943
+ if (result.stderr) process.stderr.write(result.stderr);
944
+ if (result.truncated) {
945
+ return { decision: "block", reason: `shell hook output exceeded ${MAX_HOOK_STDOUT_BYTES} bytes` };
946
+ }
947
+ if (result.timedOut) return { decision: "block", reason: `shell hook timed out after ${timeoutMs}ms` };
948
+ if (result.code !== 0) return { decision: "block", reason: `shell hook exited with code ${result.code}` };
949
+ const trimmed = result.stdout.trim();
950
+ if (!trimmed) return { decision: "continue" };
951
+ try {
952
+ const parsed = JSON.parse(trimmed);
953
+ if (!parsed || typeof parsed !== "object" || !("decision" in parsed) || !["continue", "block", "modify"].includes(String(parsed.decision))) {
954
+ return { decision: "block", reason: "shell hook returned an invalid decision" };
1010
955
  }
1011
- });
956
+ return parsed;
957
+ } catch {
958
+ return { decision: "block", reason: "shell hook returned invalid JSON" };
959
+ }
1012
960
  }
1013
961
  function groupIntoTurns(messages) {
1014
962
  const turns = [];
@@ -1365,10 +1313,9 @@ var McpClient = class {
1365
1313
  }
1366
1314
  async start() {
1367
1315
  if (this.child) return;
1368
- const child = child_process.spawn(this.spec.command, this.spec.args ?? [], {
1316
+ const child = crossPlatform.spawnNodeChild(this.spec.command, this.spec.args ?? [], {
1369
1317
  env: { ...process.env, ...this.spec.env ?? {} },
1370
- stdio: ["pipe", "pipe", "pipe"],
1371
- detached: process.platform !== "win32"
1318
+ stdio: "pipe"
1372
1319
  });
1373
1320
  this.child = child;
1374
1321
  child.stdout.on("data", (chunk) => this.onStdout(chunk.toString()));
@@ -1407,11 +1354,8 @@ var McpClient = class {
1407
1354
  const child = this.child;
1408
1355
  if (!child || child.killed) return;
1409
1356
  const kill = (signal) => {
1410
- try {
1411
- if (process.platform !== "win32" && child.pid) process.kill(-child.pid, signal);
1412
- else child.kill(signal);
1413
- } catch {
1414
- }
1357
+ if (child.pid === void 0 || child.exitCode !== null || child.signalCode !== null) return;
1358
+ void crossPlatform.killProcessTree(child.pid, signal, (sig) => child.kill(sig));
1415
1359
  };
1416
1360
  kill("SIGTERM");
1417
1361
  const timer = setTimeout(() => kill("SIGKILL"), DISPOSE_GRACE_MS);
@@ -3532,7 +3476,7 @@ var PROVIDER_REGISTRY = [
3532
3476
  catalogId: "deepseek",
3533
3477
  env: { status: "required", keys: ["DEEPSEEK_API_KEY"] },
3534
3478
  reachability: { status: "supported", url: "https://api.deepseek.com/models" },
3535
- defaultModel: { status: "known", id: "deepseek-chat" }
3479
+ defaultModel: { status: "known", id: "deepseek-flash" }
3536
3480
  },
3537
3481
  {
3538
3482
  id: "grok",
@@ -3550,7 +3494,7 @@ var PROVIDER_REGISTRY = [
3550
3494
  catalogId: "moonshotai",
3551
3495
  env: { status: "required", keys: ["KIMI_API_KEY", "MOONSHOT_API_KEY"] },
3552
3496
  reachability: { status: "supported", url: "https://api.moonshot.ai/v1/models" },
3553
- defaultModel: { status: "known", id: "kimi-k2-0711-preview" }
3497
+ defaultModel: { status: "known", id: "kimi-k2.6" }
3554
3498
  },
3555
3499
  {
3556
3500
  id: "groq",
@@ -3604,7 +3548,7 @@ var PROVIDER_REGISTRY = [
3604
3548
  catalogId: "fireworks-ai",
3605
3549
  env: { status: "required", keys: ["FIREWORKS_API_KEY"] },
3606
3550
  reachability: { status: "supported", url: "https://api.fireworks.ai/inference/v1/models" },
3607
- defaultModel: { status: "known", id: "accounts/fireworks/models/deepseek-v4-flash" }
3551
+ defaultModel: { status: "known", id: "accounts/fireworks/models/deepseek-v4-flash-0731" }
3608
3552
  },
3609
3553
  {
3610
3554
  id: "huggingface",