@polka-codes/cli-shared 0.10.29 → 0.10.31

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/index.js +12 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -502,6 +502,12 @@ var InMemoryStore = class {
502
502
  this.#data = data;
503
503
  }
504
504
  };
505
+ function notifyCommandObserver(callback, value) {
506
+ try {
507
+ callback?.(value);
508
+ } catch {
509
+ }
510
+ }
505
511
  function isIMemoryStore(store) {
506
512
  return "readMemory" in store && "updateMemory" in store;
507
513
  }
@@ -723,7 +729,7 @@ ${content}`;
723
729
  },
724
730
  executeCommand: (command, _needApprove) => {
725
731
  return new Promise((resolve5, reject) => {
726
- options.command?.onStarted(command);
732
+ notifyCommandObserver(options.command?.onStarted, command);
727
733
  const child = spawn2(command, [], {
728
734
  shell: true,
729
735
  stdio: "pipe"
@@ -732,16 +738,16 @@ ${content}`;
732
738
  let stderrText = "";
733
739
  child.stdout.on("data", (data) => {
734
740
  const dataStr = data.toString();
735
- options.command?.onStdout(dataStr);
741
+ notifyCommandObserver(options.command?.onStdout, dataStr);
736
742
  stdoutText += dataStr;
737
743
  });
738
744
  child.stderr.on("data", (data) => {
739
745
  const dataStr = data.toString();
740
- options.command?.onStderr(dataStr);
746
+ notifyCommandObserver(options.command?.onStderr, dataStr);
741
747
  stderrText += dataStr;
742
748
  });
743
749
  child.on("close", async (code) => {
744
- options.command?.onExit(code ?? 0);
750
+ notifyCommandObserver(options.command?.onExit, code ?? 0);
745
751
  const totalLength = stdoutText.length + stderrText.length;
746
752
  if (totalLength > (options.summaryThreshold ?? 5e3) && options.summarizeOutput) {
747
753
  try {
@@ -766,7 +772,7 @@ ${content}`;
766
772
  });
767
773
  });
768
774
  child.on("error", (err) => {
769
- options.command?.onError(err);
775
+ notifyCommandObserver(options.command?.onError, err);
770
776
  reject(err);
771
777
  });
772
778
  });
@@ -810,7 +816,7 @@ ${content}`;
810
816
  const googleSearchTool = vertex.tools.googleSearch({});
811
817
  const resp = await generateText({
812
818
  model: searchModel,
813
- system: "You are a web search assistant. When searching for information, provide comprehensive and detailed results. Include relevant facts, statistics, dates, and key details from the search results. Synthesize information from multiple sources when available. Structure your response clearly with the most relevant information first. Reference or cite sources when presenting specific claims or data.",
819
+ system: "You are a web search assistant. Answer with the most relevant current facts first, synthesize across sources when available, and cite sources for specific claims.",
814
820
  tools: {
815
821
  google_search: googleSearchTool
816
822
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polka-codes/cli-shared",
3
- "version": "0.10.29",
3
+ "version": "0.10.31",
4
4
  "license": "AGPL-3.0",
5
5
  "author": "github@polka.codes",
6
6
  "repository": {
@@ -30,7 +30,7 @@
30
30
  "@ai-sdk/provider": "^3.0.9",
31
31
  "@ai-sdk/provider-utils": "^4.0.24",
32
32
  "@inquirer/prompts": "^8.4.2",
33
- "@polka-codes/core": "^0.10.29",
33
+ "@polka-codes/core": "^0.10.31",
34
34
  "ai": "^6.0.170",
35
35
  "chalk": "^5.6.2",
36
36
  "ignore": "^7.0.5",