opensteer 0.4.13 → 0.5.0

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/README.md CHANGED
@@ -18,8 +18,13 @@ clean HTML snapshots, and first-class local or cloud runtime support.
18
18
  npm install opensteer
19
19
  # pnpm
20
20
  pnpm add opensteer
21
+ # bun
22
+ bun add opensteer
21
23
  ```
22
24
 
25
+ Repo maintenance defaults to `pnpm`, with compatibility checks for `npm` and
26
+ `bun` in CI.
27
+
23
28
  If your environment skips Playwright browser downloads, run:
24
29
 
25
30
  ```bash
package/bin/opensteer.mjs CHANGED
@@ -624,7 +624,7 @@ async function ensureServer(session) {
624
624
  }
625
625
 
626
626
  throw new Error(
627
- `Failed to start server for session '${session}'. Check that the build is complete.`
627
+ `Failed to start server for session '${session}' within ${CONNECT_TIMEOUT}ms.`
628
628
  )
629
629
  }
630
630
 
@@ -702,6 +702,39 @@ function error(msg) {
702
702
  process.exit(1)
703
703
  }
704
704
 
705
+ function normalizeFailedResponse(response) {
706
+ const info = toObject(response?.errorInfo)
707
+
708
+ let message = 'Request failed.'
709
+ if (typeof info?.message === 'string' && info.message.trim()) {
710
+ message = info.message.trim()
711
+ } else if (typeof response?.error === 'string' && response.error.trim()) {
712
+ message = response.error.trim()
713
+ }
714
+
715
+ return {
716
+ ok: false,
717
+ error: message,
718
+ ...(info && typeof info.code === 'string' && info.code.trim()
719
+ ? { code: info.code.trim() }
720
+ : {}),
721
+ ...(toObject(info?.details)
722
+ ? { details: info.details }
723
+ : {}),
724
+ ...(info ? { errorInfo: info } : {}),
725
+ }
726
+ }
727
+
728
+ function formatTransportFailure(error, context) {
729
+ const message = error instanceof Error ? error.message : String(error)
730
+ return `${context}: ${message}`
731
+ }
732
+
733
+ function toObject(value) {
734
+ if (!value || typeof value !== 'object' || Array.isArray(value)) return null
735
+ return value
736
+ }
737
+
705
738
  function printHelp() {
706
739
  console.log(`Usage: opensteer <command> [options]
707
740
 
@@ -855,7 +888,7 @@ async function main() {
855
888
  error(
856
889
  err instanceof Error
857
890
  ? err.message
858
- : 'Failed to start server. Check that the build is complete.'
891
+ : `Failed to start server for session '${session}'.`
859
892
  )
860
893
  }
861
894
  }
@@ -866,13 +899,16 @@ async function main() {
866
899
  if (response.ok) {
867
900
  output({ ok: true, ...response.result })
868
901
  } else {
869
- process.stderr.write(
870
- JSON.stringify({ ok: false, error: response.error }) + '\n'
871
- )
902
+ process.stderr.write(JSON.stringify(normalizeFailedResponse(response)) + '\n')
872
903
  process.exit(1)
873
904
  }
874
905
  } catch (err) {
875
- error(err instanceof Error ? err.message : 'Connection failed')
906
+ error(
907
+ formatTransportFailure(
908
+ err,
909
+ `Failed to run '${command}' for session '${session}'`
910
+ )
911
+ )
876
912
  }
877
913
  }
878
914
 
@@ -19,6 +19,15 @@ function resolveProviderInfo(modelStr) {
19
19
  return info;
20
20
  }
21
21
  }
22
+ const slash = modelStr.indexOf("/");
23
+ if (slash > 0) {
24
+ const provider = modelStr.slice(0, slash).trim().toLowerCase();
25
+ if (provider) {
26
+ throw new Error(
27
+ `Unsupported model provider prefix "${provider}" in model "${modelStr}". Use one of: openai, anthropic, google, xai, groq.`
28
+ );
29
+ }
30
+ }
22
31
  return { pkg: "@ai-sdk/openai", providerFn: "openai" };
23
32
  }
24
33
  function stripProviderPrefix(modelStr) {
@@ -2,7 +2,7 @@ import {
2
2
  buildResolveSystemPrompt,
3
3
  buildResolveUserPrompt,
4
4
  getModelProvider
5
- } from "./chunk-QTGJO7RC.js";
5
+ } from "./chunk-QHZFY3ZK.js";
6
6
 
7
7
  // src/ai/resolver.ts
8
8
  function createResolveCallback(model, options) {