@mistweaverco/kulala-cli 0.10.0 → 0.10.1

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.
Files changed (2) hide show
  1. package/dist/cli.cjs +36 -18
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -46,7 +46,7 @@ node_readline = __toESM(node_readline, 1);
46
46
  let node_async_hooks = require("node:async_hooks");
47
47
  var package_default = {
48
48
  name: "@mistweaverco/kulala-cli",
49
- version: "0.10.0",
49
+ version: "0.10.1",
50
50
  repository: {
51
51
  "type": "git",
52
52
  "url": "https://github.com/mistweaverco/kulala-cli"
@@ -3938,20 +3938,38 @@ async function executablePath() {
3938
3938
  }
3939
3939
  function invokeRaw(payload, options = {}) {
3940
3940
  const exe = cachedExecutable;
3941
- if (!exe) throw new Error("kulala-core executable not resolved");
3942
- const result = (0, node_child_process.spawnSync)(exe, [], {
3943
- input: `${JSON.stringify(payload)}\n`,
3944
- encoding: "utf-8",
3945
- maxBuffer: 50 * 1024 * 1024,
3946
- cwd: options.cwd,
3947
- env: process.env
3941
+ if (!exe) return Promise.reject(/* @__PURE__ */ new Error("kulala-core executable not resolved"));
3942
+ return new Promise((resolve, reject) => {
3943
+ const child = (0, node_child_process.spawn)(exe, [], {
3944
+ cwd: options.cwd,
3945
+ env: process.env,
3946
+ stdio: [
3947
+ "pipe",
3948
+ "pipe",
3949
+ "pipe"
3950
+ ]
3951
+ });
3952
+ let stdout = "";
3953
+ let stderr = "";
3954
+ child.stdout.setEncoding("utf-8");
3955
+ child.stderr.setEncoding("utf-8");
3956
+ child.stdout.on("data", (chunk) => {
3957
+ stdout += chunk;
3958
+ });
3959
+ child.stderr.on("data", (chunk) => {
3960
+ stderr += chunk;
3961
+ });
3962
+ child.on("error", reject);
3963
+ child.on("close", (status) => {
3964
+ resolve({
3965
+ stdout,
3966
+ stderr,
3967
+ status
3968
+ });
3969
+ });
3970
+ child.stdin.write(`${JSON.stringify(payload)}\n`);
3971
+ child.stdin.end();
3948
3972
  });
3949
- if (result.error) throw result.error;
3950
- return {
3951
- stdout: result.stdout ?? "",
3952
- stderr: result.stderr ?? "",
3953
- status: result.status
3954
- };
3955
3973
  }
3956
3974
  function tryDecodeWrapper(stdout) {
3957
3975
  const raw = stdout.trim();
@@ -3973,7 +3991,7 @@ function parseInvokeResponse(job) {
3973
3991
  }
3974
3992
  async function runHttp(options, invokeOptions = {}) {
3975
3993
  await executablePath();
3976
- return parseInvokeResponse(invokeRaw({
3994
+ return parseInvokeResponse(await invokeRaw({
3977
3995
  action: "run",
3978
3996
  content: options.content,
3979
3997
  filepath: options.filepath,
@@ -3984,7 +4002,7 @@ async function runHttp(options, invokeOptions = {}) {
3984
4002
  }
3985
4003
  async function continueHttp(options, invokeOptions = {}) {
3986
4004
  await executablePath();
3987
- return parseInvokeResponse(invokeRaw({
4005
+ return parseInvokeResponse(await invokeRaw({
3988
4006
  action: "continue",
3989
4007
  promptId: options.promptId,
3990
4008
  inputs: options.inputs
@@ -3992,7 +4010,7 @@ async function continueHttp(options, invokeOptions = {}) {
3992
4010
  }
3993
4011
  async function environments(options = {}, invokeOptions = {}) {
3994
4012
  await executablePath();
3995
- const job = invokeRaw({
4013
+ const job = await invokeRaw({
3996
4014
  action: "environments",
3997
4015
  cwd: options.cwd,
3998
4016
  filepath: options.filepath
@@ -4004,7 +4022,7 @@ async function environments(options = {}, invokeOptions = {}) {
4004
4022
  }
4005
4023
  async function curl$1(options, invokeOptions = {}) {
4006
4024
  await executablePath();
4007
- return parseInvokeResponse(invokeRaw({
4025
+ return parseInvokeResponse(await invokeRaw({
4008
4026
  action: "curl",
4009
4027
  argv: options.argv
4010
4028
  }, invokeOptions));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistweaverco/kulala-cli",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/mistweaverco/kulala-cli"