svamp-cli 0.1.35 → 0.1.36

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/cli.mjs CHANGED
@@ -91,7 +91,7 @@ async function main() {
91
91
  } else if (!subcommand || subcommand === "start") {
92
92
  await handleInteractiveCommand();
93
93
  } else if (subcommand === "--version" || subcommand === "-v") {
94
- const pkg = await import('./package-DhEMNA72.mjs').catch(() => ({ default: { version: "unknown" } }));
94
+ const pkg = await import('./package-DqJE7fYO.mjs').catch(() => ({ default: { version: "unknown" } }));
95
95
  console.log(`svamp version: ${pkg.default.version}`);
96
96
  } else {
97
97
  console.error(`Unknown command: ${subcommand}`);
@@ -100,7 +100,7 @@ async function main() {
100
100
  }
101
101
  }
102
102
  async function handleInteractiveCommand() {
103
- const { runInteractive } = await import('./run-CbrQx9o5.mjs');
103
+ const { runInteractive } = await import('./run-CZxKcatI.mjs');
104
104
  const interactiveArgs = subcommand === "start" ? args.slice(1) : args;
105
105
  let directory = process.cwd();
106
106
  let resumeSessionId;
@@ -1,5 +1,5 @@
1
1
  var name = "svamp-cli";
2
- var version = "0.1.34";
2
+ var version = "0.1.36";
3
3
  var description = "Svamp CLI — AI workspace daemon on Hypha Cloud";
4
4
  var author = "Amun AI AB";
5
5
  var license = "SEE LICENSE IN LICENSE";
@@ -402,10 +402,8 @@ async function runClaudeTurn(opts) {
402
402
  "--output-format",
403
403
  "stream-json",
404
404
  "--verbose",
405
- "--input-format",
406
- "stream-json",
407
- "--permission-prompt-tool",
408
- "stdio"
405
+ "--print",
406
+ opts.message
409
407
  ];
410
408
  if (opts.hookSettingsPath) {
411
409
  args.push("--settings", opts.hookSettingsPath);
@@ -413,24 +411,19 @@ async function runClaudeTurn(opts) {
413
411
  if (opts.sessionId) {
414
412
  args.push("--resume", opts.sessionId);
415
413
  }
416
- const claudeMode = mapPermissionMode(opts.permissionMode);
417
- if (claudeMode) {
418
- args.push("--permission-mode", claudeMode);
419
- }
414
+ const claudeMode = mapPermissionMode(opts.permissionMode) || "bypassPermissions";
415
+ args.push("--permission-mode", claudeMode);
420
416
  if (opts.claudeArgs) {
421
417
  args.push(...opts.claudeArgs);
422
418
  }
423
419
  opts.log(`[remote] Spawning: claude ${args.join(" ")}`);
420
+ const spawnEnv = { ...process.env, CLAUDE_CODE_ENTRYPOINT: "sdk-ts" };
421
+ delete spawnEnv.CLAUDECODE;
424
422
  const child = spawn(opts.claudeBin, args, {
425
423
  stdio: ["pipe", "pipe", "pipe"],
426
424
  cwd: opts.cwd,
427
- env: process.env
428
- });
429
- const userMsg = JSON.stringify({
430
- type: "user",
431
- message: { role: "user", content: opts.message }
425
+ env: spawnEnv
432
426
  });
433
- child.stdin.write(userMsg + "\n");
434
427
  child.stdin.end();
435
428
  opts.onThinkingChange(true);
436
429
  let currentText = "";
@@ -456,10 +449,6 @@ async function runClaudeTurn(opts) {
456
449
  } catch {
457
450
  return;
458
451
  }
459
- if (msg.type === "control_request") {
460
- handleControlRequest(msg, child, opts.log);
461
- return;
462
- }
463
452
  handleSDKMessage(msg, opts, (text) => {
464
453
  process.stdout.write(text);
465
454
  currentText += text;
@@ -539,28 +528,6 @@ function handleSDKMessage(msg, opts, write) {
539
528
  opts.log(`[remote] Unknown msg type: ${msg.type}`);
540
529
  }
541
530
  }
542
- function handleControlRequest(msg, child, log) {
543
- const request = msg.request;
544
- const requestId = msg.request_id;
545
- if (request?.subtype === "can_use_tool") {
546
- log(`[remote] Auto-approving tool: ${request.tool_name}`);
547
- const response = JSON.stringify({
548
- type: "control_response",
549
- response: {
550
- subtype: "success",
551
- request_id: requestId,
552
- response: {
553
- behavior: "allow",
554
- updatedInput: request.input
555
- }
556
- }
557
- });
558
- try {
559
- child.stdin.write(response + "\n");
560
- } catch {
561
- }
562
- }
563
- }
564
531
  function mapPermissionMode(mode) {
565
532
  const map = {
566
533
  "default": "default",
@@ -740,6 +707,46 @@ async function runInteractive(options) {
740
707
  log("[hypha] Kill requested");
741
708
  cleanup();
742
709
  process.exit(0);
710
+ },
711
+ // File system operations — run locally since we have direct access
712
+ onBash: async (command, execCwd) => {
713
+ const { execSync } = await import('child_process');
714
+ const result = execSync(command, {
715
+ cwd: execCwd || cwd,
716
+ encoding: "utf-8",
717
+ timeout: 3e4,
718
+ maxBuffer: 1024 * 1024
719
+ });
720
+ return { output: result };
721
+ },
722
+ onReadFile: async (path) => {
723
+ const { readFileSync: readFileSync2 } = await import('fs');
724
+ return readFileSync2(path, "utf-8");
725
+ },
726
+ onWriteFile: async (path, content) => {
727
+ const { writeFileSync } = await import('fs');
728
+ writeFileSync(path, content, "utf-8");
729
+ },
730
+ onListDirectory: async (path) => {
731
+ const { readdirSync, statSync } = await import('fs');
732
+ const { join: joinPath } = await import('path');
733
+ return readdirSync(path).map((name) => {
734
+ try {
735
+ const st = statSync(joinPath(path, name));
736
+ return { name, type: st.isDirectory() ? "directory" : "file", size: st.size };
737
+ } catch {
738
+ return { name, type: "unknown", size: 0 };
739
+ }
740
+ });
741
+ },
742
+ onRipgrep: async (rgArgs, execCwd) => {
743
+ const { execSync } = await import('child_process');
744
+ return execSync(`rg ${rgArgs}`, {
745
+ cwd: execCwd || cwd,
746
+ encoding: "utf-8",
747
+ timeout: 15e3,
748
+ maxBuffer: 1024 * 1024
749
+ });
743
750
  }
744
751
  };
745
752
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svamp-cli",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
5
5
  "author": "Amun AI AB",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -1,57 +0,0 @@
1
- var name = "svamp-cli";
2
- var version = "0.1.35";
3
- var description = "Svamp CLI — AI workspace daemon on Hypha Cloud";
4
- var author = "Amun AI AB";
5
- var license = "SEE LICENSE IN LICENSE";
6
- var type = "module";
7
- var bin = {
8
- svamp: "./bin/svamp.mjs"
9
- };
10
- var files = [
11
- "dist",
12
- "bin"
13
- ];
14
- var main = "./dist/index.mjs";
15
- var exports$1 = {
16
- ".": "./dist/index.mjs",
17
- "./cli": "./dist/cli.mjs"
18
- };
19
- var scripts = {
20
- build: "tsc --noEmit && pkgroll",
21
- typecheck: "tsc --noEmit",
22
- "test:hypha": "node --no-warnings test/test-hypha-service.mjs",
23
- dev: "tsx src/cli.ts",
24
- "dev:daemon": "tsx src/cli.ts daemon start-sync",
25
- "test:e2e": "node --no-warnings test/e2e-session-tests.mjs"
26
- };
27
- var dependencies = {
28
- "@agentclientprotocol/sdk": "^0.14.1",
29
- "@modelcontextprotocol/sdk": "^1.25.3",
30
- "hypha-rpc": "0.21.20",
31
- zod: "^3.24.4"
32
- };
33
- var devDependencies = {
34
- "@types/node": ">=20",
35
- pkgroll: "^2.14.2",
36
- tsx: "^4.20.6",
37
- typescript: "5.9.3"
38
- };
39
- var packageManager = "yarn@1.22.22";
40
- var _package = {
41
- name: name,
42
- version: version,
43
- description: description,
44
- author: author,
45
- license: license,
46
- type: type,
47
- bin: bin,
48
- files: files,
49
- main: main,
50
- exports: exports$1,
51
- scripts: scripts,
52
- dependencies: dependencies,
53
- devDependencies: devDependencies,
54
- packageManager: packageManager
55
- };
56
-
57
- export { author, bin, _package as default, dependencies, description, devDependencies, exports$1 as exports, files, license, main, name, packageManager, scripts, type, version };