lyra-ai-agent 0.1.4 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lyra-ai-agent",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "description": "lyra CLI: a Sui-native, policy-bound AI finance agent. Real on-chain work gated by deterministic policy, simulation, and approval",
6
6
  "license": "MIT",
@@ -52,7 +52,7 @@
52
52
  "@opentui/solid": "^0.1.97",
53
53
  "lyra-core": "^0.1.2",
54
54
  "lyra-gateway": "^0.1.2",
55
- "lyra-plugin-onchain": "^0.1.2",
55
+ "lyra-plugin-onchain": "^0.1.5",
56
56
  "lyra-plugin-system": "^0.1.2",
57
57
  "lyra-plugin-telegram": "^0.1.2",
58
58
  "picocolors": "^1.1.1",
package/src/index.ts CHANGED
@@ -3,6 +3,9 @@
3
3
  * commands/<name>.
4
4
  */
5
5
 
6
+ // MUST be first: guards Error.captureStackTrace so navi-sdk's transitive
7
+ // follow-redirects import doesn't crash Bun at startup. See the shim for why.
8
+ import './util/capture-shim'
6
9
  import { loadDotenvFile } from './util/dotenv'
7
10
 
8
11
  // Zero-env-var startup: load `~/.lyra/.env` (e.g. the OPENAI_API_KEY that
@@ -160,6 +163,6 @@ main()
160
163
  process.exit(0)
161
164
  })
162
165
  .catch(e => {
163
- console.error('fatal:', (e as Error)?.message ?? e)
166
+ console.error('fatal:', e instanceof Error ? e.message : e)
164
167
  process.exit(1)
165
168
  })
@@ -0,0 +1,21 @@
1
+ // Bun's `Error.captureStackTrace` throws "First argument must be an Error object"
2
+ // for some calls `follow-redirects` makes at module-init time (it builds error
3
+ // subclasses via `new BaseError()` whose constructor calls captureStackTrace).
4
+ // follow-redirects is pulled in by axios → navi-sdk, so importing the on-chain
5
+ // plugin (lending tools) used to crash `lyra` chat on startup.
6
+ //
7
+ // Guard captureStackTrace so such calls are a harmless no-op instead of throwing
8
+ // — the affected error objects simply won't carry a V8-captured stack. This MUST
9
+ // be imported before anything that transitively loads navi-sdk/axios.
10
+ const original = Error.captureStackTrace
11
+ if (typeof original === 'function') {
12
+ Error.captureStackTrace = ((target: object, ctor?: unknown) => {
13
+ try {
14
+ ;(original as (t: object, c?: unknown) => void).call(Error, target, ctor)
15
+ } catch {
16
+ // Bun rejects some non-Error targets here — ignore.
17
+ }
18
+ }) as typeof Error.captureStackTrace
19
+ }
20
+
21
+ export {}