@oracle-agent/oracle 0.10.0 → 0.12.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/LICENSE +115 -201
- package/README.md +82 -91
- package/SECURITY.md +37 -12
- package/SETUP.md +207 -272
- package/dist/action-receipts.mjs +1 -0
- package/dist/action-semantics.mjs +1 -0
- package/dist/address-book.mjs +2 -0
- package/dist/bin/desk-server.mjs +14 -0
- package/dist/bin/oracle-data-mcp.mjs +8 -0
- package/dist/bin/oracle-init.mjs +24 -0
- package/dist/bin/oracle-public-server.mjs +5 -0
- package/dist/bin/oracle-route.mjs +22 -0
- package/dist/bin/oracle-scan.mjs +18 -0
- package/dist/bin/oracle-upgrade.mjs +21 -0
- package/dist/bin/oracle.mjs +68 -0
- package/dist/chains.mjs +1 -0
- package/dist/cli/commands/auth.mjs +16 -0
- package/dist/cli/commands/bootstrap.mjs +18 -0
- package/dist/cli/commands/chain.mjs +21 -0
- package/dist/cli/commands/chat.mjs +35 -0
- package/dist/cli/commands/credential.mjs +1 -0
- package/dist/cli/commands/data-mcp.mjs +2 -0
- package/dist/cli/commands/data.mjs +12 -0
- package/dist/cli/commands/doctor.mjs +5 -0
- package/dist/cli/commands/gate.mjs +13 -0
- package/dist/cli/commands/help.mjs +1 -0
- package/dist/cli/commands/init.mjs +3 -0
- package/dist/cli/commands/mcp.mjs +33 -0
- package/dist/cli/commands/model.mjs +44 -0
- package/dist/cli/commands/prepare.mjs +2 -0
- package/dist/cli/commands/public.mjs +3 -0
- package/dist/cli/commands/route.mjs +2 -0
- package/dist/cli/commands/runner.mjs +1 -0
- package/dist/cli/commands/scan.mjs +2 -0
- package/dist/cli/commands/setup.mjs +34 -0
- package/dist/cli/commands/sign.mjs +4 -0
- package/dist/cli/commands/signer.mjs +1 -0
- package/dist/cli/commands/upgrade.mjs +2 -0
- package/dist/cli/commands/vault.mjs +1 -0
- package/dist/cli/commands/version.mjs +2 -0
- package/dist/data/desk-data.mjs +12 -0
- package/dist/index.mjs +17 -0
- package/dist/nft-gas-war-guard.mjs +1 -0
- package/dist/onboarding/harness-configs.mjs +4 -0
- package/dist/portfolio-risk.mjs +1 -0
- package/dist/prepare-envelope.mjs +1 -0
- package/dist/public-control/policy-schema.mjs +1 -0
- package/dist/router/index.mjs +2 -0
- package/dist/scanner/index.mjs +4 -0
- package/dist/signals/index.mjs +1 -0
- package/dist/watch-preferences.mjs +1 -0
- package/package.json +27 -65
- package/public/oracle-splash/assets/cli-chain-hyperliquid.jpg +0 -0
- package/public/oracle-splash/brand/aave.webp +0 -0
- package/public/oracle-splash/brand/aavev2.webp +0 -0
- package/public/oracle-splash/brand/aborean.webp +0 -0
- package/public/oracle-splash/brand/across.webp +0 -0
- package/public/oracle-splash/brand/aerodrome.webp +0 -0
- package/public/oracle-splash/brand/afi.webp +0 -0
- package/public/oracle-splash/brand/arcus.webp +0 -0
- package/public/oracle-splash/brand/aster.webp +0 -0
- package/public/oracle-splash/brand/avant.webp +0 -0
- package/public/oracle-splash/brand/balancer.webp +0 -0
- package/public/oracle-splash/brand/beefy.webp +0 -0
- package/public/oracle-splash/brand/benqi.webp +0 -0
- package/public/oracle-splash/brand/bestinslot.ico +0 -0
- package/public/oracle-splash/brand/bitfi.webp +0 -0
- package/public/oracle-splash/brand/bonkswap.webp +0 -0
- package/public/oracle-splash/brand/bouncebit.webp +0 -0
- package/public/oracle-splash/brand/camelot.webp +0 -0
- package/public/oracle-splash/brand/compound.webp +0 -0
- package/public/oracle-splash/brand/concrete.webp +0 -0
- package/public/oracle-splash/brand/cow.webp +0 -0
- package/public/oracle-splash/brand/curve.webp +0 -0
- package/public/oracle-splash/brand/derive.webp +0 -0
- package/public/oracle-splash/brand/dolomite.webp +0 -0
- package/public/oracle-splash/brand/eigenlayer.webp +0 -0
- package/public/oracle-splash/brand/ekubo.webp +0 -0
- package/public/oracle-splash/brand/ethena.webp +0 -0
- package/public/oracle-splash/brand/etherfi.webp +0 -0
- package/public/oracle-splash/brand/etherfiborrow.webp +0 -0
- package/public/oracle-splash/brand/felix.webp +0 -0
- package/public/oracle-splash/brand/fluid.webp +0 -0
- package/public/oracle-splash/brand/fluxbeam.webp +0 -0
- package/public/oracle-splash/brand/folks.webp +0 -0
- package/public/oracle-splash/brand/fortyacres.webp +0 -0
- package/public/oracle-splash/brand/gainsnetwork.webp +0 -0
- package/public/oracle-splash/brand/gassss.webp +0 -0
- package/public/oracle-splash/brand/gmx.webp +0 -0
- package/public/oracle-splash/brand/harmonix.webp +0 -0
- package/public/oracle-splash/brand/hlorderbook.webp +0 -0
- package/public/oracle-splash/brand/hlp.webp +0 -0
- package/public/oracle-splash/brand/hop.webp +0 -0
- package/public/oracle-splash/brand/hyperbeat.webp +0 -0
- package/public/oracle-splash/brand/hyperlend.webp +0 -0
- package/public/oracle-splash/brand/hyperliquid.webp +0 -0
- package/public/oracle-splash/brand/hyperliquidhpl.webp +0 -0
- package/public/oracle-splash/brand/hyperliquidspot.webp +0 -0
- package/public/oracle-splash/brand/hyperswap.webp +0 -0
- package/public/oracle-splash/brand/hypha.webp +0 -0
- package/public/oracle-splash/brand/joedex.webp +0 -0
- package/public/oracle-splash/brand/jupiter.webp +0 -0
- package/public/oracle-splash/brand/kelp.webp +0 -0
- package/public/oracle-splash/brand/kinetiq.webp +0 -0
- package/public/oracle-splash/brand/kmhype.webp +0 -0
- package/public/oracle-splash/brand/kona.webp +0 -0
- package/public/oracle-splash/brand/konalend.webp +0 -0
- package/public/oracle-splash/brand/lfj.webp +0 -0
- package/public/oracle-splash/brand/lido.webp +0 -0
- package/public/oracle-splash/brand/lifi.webp +0 -0
- package/public/oracle-splash/brand/lighter.webp +0 -0
- package/public/oracle-splash/brand/lista.webp +0 -0
- package/public/oracle-splash/brand/loopedhype.webp +0 -0
- package/public/oracle-splash/brand/lorenzo.webp +0 -0
- package/public/oracle-splash/brand/magic-eden.webp +0 -0
- package/public/oracle-splash/brand/magiceden.webp +0 -0
- package/public/oracle-splash/brand/mempool.png +0 -0
- package/public/oracle-splash/brand/meteora.webp +0 -0
- package/public/oracle-splash/brand/morpho.webp +0 -0
- package/public/oracle-splash/brand/myriad.webp +0 -0
- package/public/oracle-splash/brand/noxa.webp +0 -0
- package/public/oracle-splash/brand/odos.webp +0 -0
- package/public/oracle-splash/brand/oneinch.webp +0 -0
- package/public/oracle-splash/brand/openbook.webp +0 -0
- package/public/oracle-splash/brand/opensea.webp +0 -0
- package/public/oracle-splash/brand/orca.webp +0 -0
- package/public/oracle-splash/brand/ordinals.png +0 -0
- package/public/oracle-splash/brand/ostium.webp +0 -0
- package/public/oracle-splash/brand/pancakeswap.webp +0 -0
- package/public/oracle-splash/brand/pendle.webp +0 -0
- package/public/oracle-splash/brand/perena.webp +0 -0
- package/public/oracle-splash/brand/pharaoh.webp +0 -0
- package/public/oracle-splash/brand/phoenix.webp +0 -0
- package/public/oracle-splash/brand/polymarket.webp +0 -0
- package/public/oracle-splash/brand/polynomial.webp +0 -0
- package/public/oracle-splash/brand/projectx.webp +0 -0
- package/public/oracle-splash/brand/pumpfun.webp +0 -0
- package/public/oracle-splash/brand/quickswap.webp +0 -0
- package/public/oracle-splash/brand/rain.webp +0 -0
- package/public/oracle-splash/brand/raydium.webp +0 -0
- package/public/oracle-splash/brand/relay.webp +0 -0
- package/public/oracle-splash/brand/rocketpool.webp +0 -0
- package/public/oracle-splash/brand/saber.webp +0 -0
- package/public/oracle-splash/brand/sakuraswap.webp +0 -0
- package/public/oracle-splash/brand/sanctum.webp +0 -0
- package/public/oracle-splash/brand/satflow.png +0 -0
- package/public/oracle-splash/brand/sierra.webp +0 -0
- package/public/oracle-splash/brand/sky.webp +0 -0
- package/public/oracle-splash/brand/solv.webp +0 -0
- package/public/oracle-splash/brand/spark.webp +0 -0
- package/public/oracle-splash/brand/sparksavings.webp +0 -0
- package/public/oracle-splash/brand/sphere.webp +0 -0
- package/public/oracle-splash/brand/ssv.webp +0 -0
- package/public/oracle-splash/brand/stabble.webp +0 -0
- package/public/oracle-splash/brand/stableswap.webp +0 -0
- package/public/oracle-splash/brand/stakewise.webp +0 -0
- package/public/oracle-splash/brand/stargate.webp +0 -0
- package/public/oracle-splash/brand/sthype.webp +0 -0
- package/public/oracle-splash/brand/sushiswap.webp +0 -0
- package/public/oracle-splash/brand/unisat.png +0 -0
- package/public/oracle-splash/brand/uniswap.webp +0 -0
- package/public/oracle-splash/brand/uniswapv2.webp +0 -0
- package/public/oracle-splash/brand/uniswapv4.webp +0 -0
- package/public/oracle-splash/brand/unit.webp +0 -0
- package/public/oracle-splash/brand/velodrome.webp +0 -0
- package/public/oracle-splash/brand/velora.webp +0 -0
- package/public/oracle-splash/brand/venus.webp +0 -0
- package/public/oracle-splash/brand/wbeth.webp +0 -0
- package/public/oracle-splash/brand/xsy.webp +0 -0
- package/public/oracle-splash/brand/yieldyak.webp +0 -0
- package/public/oracle-splash/brand/zerobase.webp +0 -0
- package/public/oracle-splash/brand/zerox.webp +0 -0
- package/public/oracle-splash/index.html +246 -169
- package/CONTRIBUTING.md +0 -98
- package/bin/desk-server.mjs +0 -440
- package/bin/oracle-data-mcp.mjs +0 -1010
- package/bin/oracle-init.mjs +0 -496
- package/bin/oracle-public-server.mjs +0 -36
- package/bin/oracle-route.mjs +0 -254
- package/bin/oracle-scan.mjs +0 -192
- package/bin/oracle-upgrade.mjs +0 -42
- package/bin/oracle.mjs +0 -33
- package/docs/adding-a-chain.md +0 -229
- package/docs/architecture.md +0 -136
- package/docs/cli.md +0 -47
- package/docs/connectors.md +0 -13
- package/docs/oracle-pack-standard.md +0 -29
- package/docs/profiles.md +0 -154
- package/examples/add-a-chain.mjs +0 -65
- package/examples/oracle-pack-template.mjs +0 -38
- package/examples/research-a-token.mjs +0 -70
- package/plugins/oracle-owner-gate/__init__.py +0 -227
- package/plugins/oracle-owner-gate/plugin.yaml +0 -9
- package/profiles/_template/SOUL.md +0 -54
- package/profiles/_template/profile.json +0 -22
- package/profiles/bitcoin-agent/SOUL.md +0 -31
- package/profiles/bitcoin-agent/profile.json +0 -32
- package/profiles/hyperliquid-agent/SOUL.md +0 -34
- package/profiles/hyperliquid-agent/profile.json +0 -37
- package/profiles/oracle/SOUL.md +0 -107
- package/profiles/oracle/profile.json +0 -39
- package/profiles/polymarket-agent/SOUL.md +0 -35
- package/profiles/polymarket-agent/profile.json +0 -34
- package/profiles/profile.schema.json +0 -90
- package/profiles/protocol-builder/SOUL.md +0 -57
- package/profiles/protocol-builder/profile.json +0 -39
- package/profiles/robinhood-agent/SOUL.md +0 -53
- package/profiles/robinhood-agent/profile.json +0 -40
- package/profiles/solana-agent/SOUL.md +0 -37
- package/profiles/solana-agent/profile.json +0 -37
- package/profiles/stable-agent/SOUL.md +0 -43
- package/profiles/stable-agent/profile.json +0 -37
- package/protocols/templates/safe-erc20/SECURITY.md +0 -16
- package/protocols/templates/safe-erc20/foundry.toml +0 -12
- package/protocols/templates/safe-erc20/remappings.txt +0 -2
- package/protocols/templates/safe-erc20/src/SafeERC20.sol +0 -53
- package/protocols/templates/safe-erc20/test/SafeERC20.t.sol +0 -72
- package/scripts/adversarial-bench.mjs +0 -114
- package/scripts/build-inscription.py +0 -230
- package/scripts/check-doc-drift.mjs +0 -112
- package/scripts/check-test-count.mjs +0 -105
- package/scripts/e2e-hl-markets.mjs +0 -21
- package/scripts/e2e-hl-perps.mjs +0 -48
- package/scripts/e2e-hypercore-staking.mjs +0 -128
- package/scripts/e2e-solana-bitcoin.mjs +0 -183
- package/scripts/protocol-template-gate.mjs +0 -15
- package/scripts/public-api-scan.mjs +0 -23
- package/scripts/secret-scan.mjs +0 -181
- package/scripts/verify-v3-venues.mjs +0 -192
- package/skills/balance/SKILL.md +0 -176
- package/skills/oracle-action-semantics/SKILL.md +0 -40
- package/skills/oracle-best-execution/SKILL.md +0 -127
- package/skills/oracle-bitcoin/SKILL.md +0 -53
- package/skills/oracle-chain-graphs-telegram-cards/SKILL.md +0 -59
- package/skills/oracle-chat/SKILL.md +0 -61
- package/skills/oracle-chat/chain.SKILL.md +0 -31
- package/skills/oracle-chat/setup.SKILL.md +0 -37
- package/skills/oracle-circuit-breaker/SKILL.md +0 -51
- package/skills/oracle-contract-research/SKILL.md +0 -55
- package/skills/oracle-desk/SKILL.md +0 -58
- package/skills/oracle-dex-launch/SKILL.md +0 -38
- package/skills/oracle-grants/SKILL.md +0 -69
- package/skills/oracle-hypercore-staking/SKILL.md +0 -57
- package/skills/oracle-hyperliquid/SKILL.md +0 -56
- package/skills/oracle-meme-token-sniper/SKILL.md +0 -73
- package/skills/oracle-multichain-nft-launch/SKILL.md +0 -338
- package/skills/oracle-multichain-token-launch/SKILL.md +0 -300
- package/skills/oracle-nft-gacha-launch/SKILL.md +0 -48
- package/skills/oracle-nft-mint-gas-war/SKILL.md +0 -63
- package/skills/oracle-polymarket/SKILL.md +0 -60
- package/skills/oracle-protocol-builder/SKILL.md +0 -59
- package/skills/oracle-protocol-security/SKILL.md +0 -60
- package/skills/oracle-public-product/SKILL.md +0 -44
- package/skills/oracle-receipts/SKILL.md +0 -52
- package/skills/oracle-rfq-tokenized-assets/SKILL.md +0 -69
- package/skills/oracle-smart-wallet-scanner/SKILL.md +0 -49
- package/skills/oracle-solana/SKILL.md +0 -65
- package/skills/oracle-solana-nft/SKILL.md +0 -54
- package/skills/oracle-token-research/SKILL.md +0 -67
- package/skins/oracle.yaml +0 -56
- package/src/action-receipts.mjs +0 -168
- package/src/action-semantics.mjs +0 -62
- package/src/address-book.mjs +0 -208
- package/src/agent-auth.mjs +0 -206
- package/src/approval-guard.mjs +0 -282
- package/src/attestation-secret.mjs +0 -88
- package/src/audit-log.mjs +0 -196
- package/src/auth/oauth.mjs +0 -672
- package/src/auto-slippage.mjs +0 -378
- package/src/capability-posture.mjs +0 -125
- package/src/chains.mjs +0 -62
- package/src/cli/chain-catalog.mjs +0 -215
- package/src/cli/chain-state.mjs +0 -74
- package/src/cli/commands/auth.mjs +0 -193
- package/src/cli/commands/bootstrap.mjs +0 -87
- package/src/cli/commands/chain.mjs +0 -143
- package/src/cli/commands/chat.mjs +0 -434
- package/src/cli/commands/credential.mjs +0 -9
- package/src/cli/commands/data-mcp.mjs +0 -18
- package/src/cli/commands/data.mjs +0 -73
- package/src/cli/commands/doctor.mjs +0 -126
- package/src/cli/commands/help.mjs +0 -7
- package/src/cli/commands/init.mjs +0 -27
- package/src/cli/commands/mcp.mjs +0 -142
- package/src/cli/commands/model.mjs +0 -99
- package/src/cli/commands/prepare.mjs +0 -12
- package/src/cli/commands/public.mjs +0 -20
- package/src/cli/commands/route.mjs +0 -12
- package/src/cli/commands/runner.mjs +0 -9
- package/src/cli/commands/scan.mjs +0 -12
- package/src/cli/commands/setup.mjs +0 -275
- package/src/cli/commands/sign.mjs +0 -21
- package/src/cli/commands/signer.mjs +0 -9
- package/src/cli/commands/upgrade.mjs +0 -12
- package/src/cli/commands/vault.mjs +0 -9
- package/src/cli/commands/version.mjs +0 -22
- package/src/cli/first-run.mjs +0 -23
- package/src/cli/kernel.mjs +0 -239
- package/src/cli/mcp-targets/chatgpt.mjs +0 -51
- package/src/cli/mcp-targets/claude-code.mjs +0 -39
- package/src/cli/mcp-targets/claude-desktop.mjs +0 -24
- package/src/cli/mcp-targets/codex.mjs +0 -41
- package/src/cli/mcp-targets/shared.mjs +0 -61
- package/src/cli/messaging-platforms.mjs +0 -209
- package/src/cli/model-config.mjs +0 -70
- package/src/cli/operator-dispatch.mjs +0 -258
- package/src/cli/oracle-harness.py +0 -415
- package/src/cli/paths.mjs +0 -83
- package/src/cli/runtime.mjs +0 -351
- package/src/cli/setup-state.mjs +0 -168
- package/src/cli/spawn-child.mjs +0 -43
- package/src/data/catalog.mjs +0 -554
- package/src/data/desk-data.mjs +0 -683
- package/src/data/http.mjs +0 -253
- package/src/data/provider-endpoint.mjs +0 -94
- package/src/data/providers/aerodrome.mjs +0 -245
- package/src/data/providers/balancer.mjs +0 -209
- package/src/data/providers/bitcoin-esplora.mjs +0 -216
- package/src/data/providers/bitcoin-meta.mjs +0 -378
- package/src/data/providers/blockscout.mjs +0 -14
- package/src/data/providers/bridges.mjs +0 -242
- package/src/data/providers/cowswap.mjs +0 -415
- package/src/data/providers/curve.mjs +0 -201
- package/src/data/providers/defillama.mjs +0 -88
- package/src/data/providers/dexscreener.mjs +0 -43
- package/src/data/providers/evm-rpc.mjs +0 -222
- package/src/data/providers/geckoterminal.mjs +0 -34
- package/src/data/providers/gmx.mjs +0 -496
- package/src/data/providers/hl-assets.mjs +0 -165
- package/src/data/providers/hl-info.mjs +0 -108
- package/src/data/providers/hl-markets.mjs +0 -210
- package/src/data/providers/hl-outcome.mjs +0 -61
- package/src/data/providers/hl-perps.mjs +0 -387
- package/src/data/providers/hl-staking.mjs +0 -353
- package/src/data/providers/hl-ws.mjs +0 -119
- package/src/data/providers/hyperevm-dex.mjs +0 -49
- package/src/data/providers/jupiter.mjs +0 -183
- package/src/data/providers/lifi.mjs +0 -151
- package/src/data/providers/magiceden-sol.mjs +0 -393
- package/src/data/providers/morpho.mjs +0 -173
- package/src/data/providers/nft-gallery.mjs +0 -163
- package/src/data/providers/nft-portfolio.mjs +0 -494
- package/src/data/providers/odos.mjs +0 -156
- package/src/data/providers/oneinch.mjs +0 -174
- package/src/data/providers/opensea-multichain.mjs +0 -136
- package/src/data/providers/opensea-nft.mjs +0 -371
- package/src/data/providers/paraswap.mjs +0 -118
- package/src/data/providers/pendle.mjs +0 -187
- package/src/data/providers/poly-clob.mjs +0 -283
- package/src/data/providers/poly-public.mjs +0 -96
- package/src/data/providers/poly-ws.mjs +0 -103
- package/src/data/providers/portfolio-history.mjs +0 -394
- package/src/data/providers/portfolio.mjs +0 -594
- package/src/data/providers/rfq.mjs +0 -15
- package/src/data/providers/rh-agent.mjs +0 -59
- package/src/data/providers/satflow.mjs +0 -338
- package/src/data/providers/solana-rpc.mjs +0 -197
- package/src/data/providers/uniswap-v3.mjs +0 -320
- package/src/data/providers/zerox.mjs +0 -167
- package/src/data/public-api-scan.mjs +0 -61
- package/src/data/quote-placeholder.mjs +0 -31
- package/src/exact-integer.mjs +0 -72
- package/src/exec-policy.mjs +0 -455
- package/src/flags.mjs +0 -15
- package/src/fresh-window.mjs +0 -76
- package/src/gmx-attestation.mjs +0 -176
- package/src/index.mjs +0 -100
- package/src/nft-gas-war-guard.mjs +0 -139
- package/src/onboarding/agent-keys.mjs +0 -161
- package/src/onboarding/harness-configs.mjs +0 -102
- package/src/onboarding/index.mjs +0 -18
- package/src/onboarding/tiers.mjs +0 -139
- package/src/oracle-env.mjs +0 -47
- package/src/portfolio-risk.mjs +0 -170
- package/src/prepare-envelope.mjs +0 -186
- package/src/profile-upgrade.mjs +0 -277
- package/src/protocol-execution.mjs +0 -84
- package/src/protocol-templates/gate.mjs +0 -179
- package/src/protocol-templates/prepare-deploy.mjs +0 -81
- package/src/public-api/buzz-integration.mjs +0 -256
- package/src/public-api/connect-agent.mjs +0 -416
- package/src/public-api/grants.mjs +0 -142
- package/src/public-api/http.mjs +0 -389
- package/src/public-control/aa-adapter.mjs +0 -402
- package/src/public-control/build-registry.mjs +0 -227
- package/src/public-control/bundler-client.mjs +0 -357
- package/src/public-control/grant-indexer.mjs +0 -296
- package/src/public-control/policy-render.mjs +0 -69
- package/src/public-control/policy-schema.mjs +0 -318
- package/src/public-control/runtime-config.mjs +0 -275
- package/src/public-control/session-key-model.mjs +0 -374
- package/src/public-control/session-orchestrator.mjs +0 -412
- package/src/rfq/intent.mjs +0 -180
- package/src/rfq/sources.mjs +0 -181
- package/src/route-attestation.mjs +0 -132
- package/src/router/best-execution.mjs +0 -326
- package/src/router/index.mjs +0 -226
- package/src/router/prepare-bridge.mjs +0 -289
- package/src/router/prepare-route.mjs +0 -381
- package/src/router/proposal.mjs +0 -311
- package/src/router/risk-classifier.mjs +0 -119
- package/src/router/route-sources.mjs +0 -329
- package/src/scanner/chains.config.mjs +0 -430
- package/src/scanner/contract.mjs +0 -270
- package/src/scanner/evm-scanner.mjs +0 -394
- package/src/scanner/index.mjs +0 -9
- package/src/scanner/v2-venue.mjs +0 -335
- package/src/scanner/v3-venue.mjs +0 -290
- package/src/scopes.mjs +0 -44
- package/src/sell-simulation.mjs +0 -167
- package/src/signals/engine.mjs +0 -146
- package/src/signals/index.mjs +0 -1
- package/src/token-transfer-guard.mjs +0 -188
- package/src/tui/app.mjs +0 -438
- package/src/tui/backend.mjs +0 -145
- package/src/tui/format.mjs +0 -272
- package/src/tui/gateway-client.mjs +0 -177
- package/src/tui/input.mjs +0 -501
- package/src/tui/renderer.mjs +0 -443
- package/src/tui/standalone-client.mjs +0 -666
- package/src/tui/theme.mjs +0 -81
- package/src/vault-attestation.mjs +0 -146
- package/src/venues.mjs +0 -206
- package/src/watch-preferences.mjs +0 -85
|
@@ -1,434 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { spawnSync } from "node:child_process";
|
|
4
|
-
import { PACKAGE_ROOT, hermesRoot, ensureDir } from "../paths.mjs";
|
|
5
|
-
import { activeChainEnv } from "../chain-state.mjs";
|
|
6
|
-
import { readModelConfig } from "../model-config.mjs";
|
|
7
|
-
import { spawnChild } from "../spawn-child.mjs";
|
|
8
|
-
import { resolveHermes } from "../runtime.mjs";
|
|
9
|
-
import { runOracleTui } from "../../tui/app.mjs";
|
|
10
|
-
import { resolveChatBackend } from "../../tui/backend.mjs";
|
|
11
|
-
import { createStandaloneClient, runStandaloneQuery } from "../../tui/standalone-client.mjs";
|
|
12
|
-
import { getOAuthStore } from "../../auth/oauth.mjs";
|
|
13
|
-
|
|
14
|
-
const PROFILE = "oracle";
|
|
15
|
-
const SKIN_NAME = "oracle";
|
|
16
|
-
|
|
17
|
-
function which(bin) {
|
|
18
|
-
if (bin === "hermes") {
|
|
19
|
-
const r = resolveHermes();
|
|
20
|
-
return r.ok ? r.bin : null;
|
|
21
|
-
}
|
|
22
|
-
for (const dir of (process.env.PATH || "").split(path.delimiter)) {
|
|
23
|
-
const c = path.join(dir, bin);
|
|
24
|
-
try {
|
|
25
|
-
if (fs.existsSync(c)) return c;
|
|
26
|
-
} catch {}
|
|
27
|
-
}
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function pythonShebang(file) {
|
|
32
|
-
try {
|
|
33
|
-
const first = fs.readFileSync(file, "utf8").split(/\r?\n/, 1)[0];
|
|
34
|
-
if (!first.startsWith("#!")) return null;
|
|
35
|
-
const parts = first.slice(2).trim().split(/\s+/);
|
|
36
|
-
if (parts[0]?.endsWith("/env") && parts[1]?.startsWith("python")) {
|
|
37
|
-
return { command: parts[0], prefix: [parts[1]] };
|
|
38
|
-
}
|
|
39
|
-
if (path.basename(parts[0] || "").startsWith("python")) {
|
|
40
|
-
return { command: parts[0], prefix: parts.slice(1) };
|
|
41
|
-
}
|
|
42
|
-
} catch {}
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function resolveHermesPython(hermes) {
|
|
47
|
-
const direct = pythonShebang(hermes);
|
|
48
|
-
if (direct) return direct;
|
|
49
|
-
try {
|
|
50
|
-
const body = fs.readFileSync(hermes, "utf8");
|
|
51
|
-
const match = body.match(/["']([^"'\r\n]+\/bin\/hermes)["']/);
|
|
52
|
-
if (match) return pythonShebang(match[1]);
|
|
53
|
-
} catch {}
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function harnessSourcePath() {
|
|
58
|
-
return path.join(PACKAGE_ROOT, "src", "cli", "oracle-harness.py");
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function oracleHarnessInvocation(hermes, args) {
|
|
62
|
-
const harness = harnessSourcePath();
|
|
63
|
-
const runtime = process.env.ORACLE_PLAIN_HARNESS === "0"
|
|
64
|
-
? null
|
|
65
|
-
: resolveHermesPython(hermes);
|
|
66
|
-
if (runtime && fs.existsSync(harness)) {
|
|
67
|
-
return {
|
|
68
|
-
command: runtime.command,
|
|
69
|
-
args: [...runtime.prefix, harness, ...args],
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
return { command: hermes, args };
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function skinSourcePath() {
|
|
76
|
-
return path.join(PACKAGE_ROOT, "skins", "oracle.yaml");
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function ensureOracleProfile(profile = PROFILE) {
|
|
80
|
-
const src = path.join(PACKAGE_ROOT, "profiles", "oracle", "SOUL.md");
|
|
81
|
-
if (!fs.existsSync(src)) return { ok: false, reason: "oracle persona missing from package" };
|
|
82
|
-
const dest = path.join(hermesRoot(), "profiles", profile, "SOUL.md");
|
|
83
|
-
if (fs.existsSync(dest)) {
|
|
84
|
-
const current = fs.readFileSync(dest, "utf8");
|
|
85
|
-
if (!current.startsWith("You are Hermes Agent, an intelligent AI assistant created by Nous Research.")) {
|
|
86
|
-
return { ok: true, reused: true };
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
ensureDir(path.dirname(dest));
|
|
90
|
-
fs.copyFileSync(src, dest);
|
|
91
|
-
return { ok: true, reused: false };
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function ensureOracleSkin(profile = PROFILE) {
|
|
95
|
-
const src = skinSourcePath();
|
|
96
|
-
if (!fs.existsSync(src)) return { ok: false, reason: "skin missing from package" };
|
|
97
|
-
const rootSkins = path.join(hermesRoot(), "skins");
|
|
98
|
-
const profileSkins = path.join(hermesRoot(), "profiles", profile, "skins");
|
|
99
|
-
ensureDir(rootSkins);
|
|
100
|
-
ensureDir(profileSkins);
|
|
101
|
-
const body = fs.readFileSync(src, "utf8");
|
|
102
|
-
fs.writeFileSync(path.join(rootSkins, `${SKIN_NAME}.yaml`), body);
|
|
103
|
-
fs.writeFileSync(path.join(profileSkins, `${SKIN_NAME}.yaml`), body);
|
|
104
|
-
return { ok: true, skin: SKIN_NAME };
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function ensureQuickCommands(profile = PROFILE) {
|
|
108
|
-
// Install /chain and /setup as hermes quick commands that call oracle.
|
|
109
|
-
const cfgPath = path.join(hermesRoot(), "profiles", profile, "config.yaml");
|
|
110
|
-
if (!fs.existsSync(cfgPath)) return { ok: false, reason: "profile config missing" };
|
|
111
|
-
|
|
112
|
-
// Prefer a tiny sidecar json the chat skill can also read; hermes quick_commands
|
|
113
|
-
// live in config.yaml which we must not corrupt with naive YAML mutation.
|
|
114
|
-
// We install a hermes-facing skill command instead (see skills/oracle-chat).
|
|
115
|
-
const oracleBin = which("oracle") || path.join(PACKAGE_ROOT, "bin", "oracle.mjs");
|
|
116
|
-
const markerDir = path.join(hermesRoot(), "profiles", profile, "oracle");
|
|
117
|
-
ensureDir(markerDir);
|
|
118
|
-
const marker = {
|
|
119
|
-
profile,
|
|
120
|
-
skin: SKIN_NAME,
|
|
121
|
-
oracleBin,
|
|
122
|
-
commands: {
|
|
123
|
-
chain: [oracleBin, "chain"],
|
|
124
|
-
setup: [oracleBin, "setup"],
|
|
125
|
-
},
|
|
126
|
-
updatedAt: new Date().toISOString(),
|
|
127
|
-
};
|
|
128
|
-
fs.writeFileSync(
|
|
129
|
-
path.join(markerDir, "chat-surface.json"),
|
|
130
|
-
JSON.stringify(marker, null, 2) + "\n",
|
|
131
|
-
{ mode: 0o600 },
|
|
132
|
-
);
|
|
133
|
-
return { ok: true, marker };
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function ensureSkillCommands(profile = PROFILE) {
|
|
137
|
-
const srcDir = path.join(PACKAGE_ROOT, "skills", "oracle-chat");
|
|
138
|
-
if (!fs.existsSync(srcDir)) return { ok: false, reason: "oracle-chat skill missing" };
|
|
139
|
-
const destRoot = path.join(hermesRoot(), "profiles", profile, "skills", "oracle-chat");
|
|
140
|
-
ensureDir(destRoot);
|
|
141
|
-
for (const name of fs.readdirSync(srcDir)) {
|
|
142
|
-
const from = path.join(srcDir, name);
|
|
143
|
-
const to = path.join(destRoot, name);
|
|
144
|
-
if (fs.statSync(from).isFile()) {
|
|
145
|
-
fs.copyFileSync(from, to);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
// Also install under profile skills root aliases for /chain and /setup.
|
|
149
|
-
for (const slug of ["chain", "setup"]) {
|
|
150
|
-
const aliasDir = path.join(hermesRoot(), "profiles", profile, "skills", slug);
|
|
151
|
-
ensureDir(aliasDir);
|
|
152
|
-
const skillMd = path.join(srcDir, `${slug}.SKILL.md`);
|
|
153
|
-
const fallback = path.join(srcDir, "SKILL.md");
|
|
154
|
-
const body = fs.existsSync(skillMd)
|
|
155
|
-
? fs.readFileSync(skillMd, "utf8")
|
|
156
|
-
: fs.readFileSync(fallback, "utf8");
|
|
157
|
-
fs.writeFileSync(path.join(aliasDir, "SKILL.md"), body);
|
|
158
|
-
}
|
|
159
|
-
return { ok: true };
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function setDisplaySkin(profile = PROFILE) {
|
|
163
|
-
const hermes = which("hermes");
|
|
164
|
-
if (!hermes) return { ok: false, reason: "hermes missing" };
|
|
165
|
-
// hermes config set is safe; avoids hand-editing yaml.
|
|
166
|
-
const r = spawnSync(
|
|
167
|
-
hermes,
|
|
168
|
-
["-p", profile, "config", "set", "display.skin", SKIN_NAME],
|
|
169
|
-
{ encoding: "utf8", timeout: 30_000 },
|
|
170
|
-
);
|
|
171
|
-
if (r.status !== 0) {
|
|
172
|
-
return {
|
|
173
|
-
ok: false,
|
|
174
|
-
reason: (r.stderr || r.stdout || "config set failed").trim(),
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
return { ok: true };
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function hasModelConfig(file) {
|
|
181
|
-
if (!fs.existsSync(file)) return false;
|
|
182
|
-
const text = fs.readFileSync(file, "utf8");
|
|
183
|
-
if (/^model:\s*\S+/m.test(text)) return true;
|
|
184
|
-
const block = text.match(/^model:\s*\n((?:[ \t]+.*(?:\n|$))*)/m)?.[1] || "";
|
|
185
|
-
return /^\s+(?:default|provider):\s*\S+/m.test(block);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function hasProviderCredentials(profile = PROFILE) {
|
|
189
|
-
const root = hermesRoot();
|
|
190
|
-
if (fs.existsSync(path.join(root, "auth.json"))) return true;
|
|
191
|
-
if (fs.existsSync(path.join(root, "profiles", profile, "auth.json"))) return true;
|
|
192
|
-
const keys = [
|
|
193
|
-
"OPENROUTER_API_KEY",
|
|
194
|
-
"ANTHROPIC_API_KEY",
|
|
195
|
-
"OPENAI_API_KEY",
|
|
196
|
-
"XAI_API_KEY",
|
|
197
|
-
"GOOGLE_API_KEY",
|
|
198
|
-
"GEMINI_API_KEY",
|
|
199
|
-
"DEEPSEEK_API_KEY",
|
|
200
|
-
"HF_TOKEN",
|
|
201
|
-
"GLM_API_KEY",
|
|
202
|
-
"KIMI_API_KEY",
|
|
203
|
-
"MINIMAX_API_KEY",
|
|
204
|
-
];
|
|
205
|
-
if (keys.some((key) => process.env[key])) return true;
|
|
206
|
-
for (const file of [path.join(root, ".env"), path.join(root, "profiles", profile, ".env")]) {
|
|
207
|
-
if (!fs.existsSync(file)) continue;
|
|
208
|
-
const text = fs.readFileSync(file, "utf8");
|
|
209
|
-
if (keys.some((key) => new RegExp(`^${key}=.+`, "m").test(text))) return true;
|
|
210
|
-
}
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function modelReady(profile = PROFILE) {
|
|
215
|
-
const root = hermesRoot();
|
|
216
|
-
return (
|
|
217
|
-
hasModelConfig(path.join(root, "config.yaml")) ||
|
|
218
|
-
hasModelConfig(path.join(root, "profiles", profile, "config.yaml")) ||
|
|
219
|
-
hasProviderCredentials(profile)
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function usage() {
|
|
224
|
-
return [
|
|
225
|
-
"oracle chat, filled lowercase oracle chat",
|
|
226
|
-
"",
|
|
227
|
-
" oracle chat open interactive oracle chat",
|
|
228
|
-
" oracle chat -q \"...\" one-shot query",
|
|
229
|
-
" oracle chat --model <m> use a model for this session",
|
|
230
|
-
" oracle chat --print-banner show filled oracle banner only",
|
|
231
|
-
"",
|
|
232
|
-
"inside chat:",
|
|
233
|
-
" /chain list/select chains",
|
|
234
|
-
" /setup messaging setup menu",
|
|
235
|
-
" /model switch models (still one oracle persona)",
|
|
236
|
-
"",
|
|
237
|
-
"brand: filled lowercase oracle / classic boxed layout",
|
|
238
|
-
].join("\n");
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function terminalColumns() {
|
|
242
|
-
const columns = Number(process.stdout?.columns || process.env.COLUMNS || 80);
|
|
243
|
-
return Number.isFinite(columns) && columns > 0 ? Math.floor(columns) : 80;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
function visibleWidth(text) {
|
|
247
|
-
return Array.from(String(text)).length;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function centerBlock(lines, width) {
|
|
251
|
-
const clean = lines.map((line) => line.trimEnd());
|
|
252
|
-
const blockWidth = Math.max(0, ...clean.map((line) => visibleWidth(line)));
|
|
253
|
-
const left = Math.max(0, Math.floor((width - blockWidth) / 2));
|
|
254
|
-
const pad = " ".repeat(left);
|
|
255
|
-
return clean.map((line) => (line ? `${pad}${line}` : ""));
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function printBanner() {
|
|
259
|
-
const lines = [
|
|
260
|
-
"",
|
|
261
|
-
" ████",
|
|
262
|
-
" ░░███",
|
|
263
|
-
" ██████ ████████ ██████ ██████ ░███ ██████",
|
|
264
|
-
" ███░░███░░███░░███ ░░░░░███ ███░░███ ░███ ███░░███",
|
|
265
|
-
"░███ ░███ ░███ ░░░ ███████ ░███ ░░░ ░███ ░███████",
|
|
266
|
-
"░███ ░███ ░███ ███░░███ ░███ ███ ░███ ░███░░░",
|
|
267
|
-
"░░██████ █████ ░░████████░░██████ █████░░██████",
|
|
268
|
-
" ░░░░░░ ░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░ ░░░░░░",
|
|
269
|
-
"",
|
|
270
|
-
];
|
|
271
|
-
process.stdout.write(centerBlock(lines, terminalColumns()).join("\n") + "\n");
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function parseLaunchArgs(args) {
|
|
275
|
-
const parsed = { pass: [], query: null, model: null, provider: null };
|
|
276
|
-
for (let i = 0; i < args.length; i += 1) {
|
|
277
|
-
const arg = args[i];
|
|
278
|
-
if ((arg === "--model" || arg === "-m") && args[i + 1]) {
|
|
279
|
-
parsed.model = args[++i];
|
|
280
|
-
parsed.pass.push("--model", parsed.model);
|
|
281
|
-
continue;
|
|
282
|
-
}
|
|
283
|
-
if (arg === "--provider" && args[i + 1]) {
|
|
284
|
-
parsed.provider = args[++i];
|
|
285
|
-
parsed.pass.push("--provider", parsed.provider);
|
|
286
|
-
continue;
|
|
287
|
-
}
|
|
288
|
-
if ((arg === "-q" || arg === "--query") && args[i + 1]) {
|
|
289
|
-
parsed.query = args[++i];
|
|
290
|
-
parsed.pass.push("-q", parsed.query);
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
293
|
-
if (arg === "--quiet" || arg === "-Q") {
|
|
294
|
-
parsed.pass.push("--quiet");
|
|
295
|
-
continue;
|
|
296
|
-
}
|
|
297
|
-
if (arg === "--continue" || arg === "-c") {
|
|
298
|
-
parsed.pass.push("--continue");
|
|
299
|
-
continue;
|
|
300
|
-
}
|
|
301
|
-
parsed.pass.push(arg);
|
|
302
|
-
}
|
|
303
|
-
return parsed;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
export default {
|
|
307
|
-
name: "chat",
|
|
308
|
-
summary: "open the one oracle chat surface (telegram-like, multi-model)",
|
|
309
|
-
group: "read",
|
|
310
|
-
usage: usage(),
|
|
311
|
-
async run(ctx) {
|
|
312
|
-
const args = [...ctx.argv];
|
|
313
|
-
if (args.includes("-h") || args.includes("--help")) {
|
|
314
|
-
process.stdout.write(usage() + "\n");
|
|
315
|
-
return 0;
|
|
316
|
-
}
|
|
317
|
-
if (args.includes("--print-banner")) {
|
|
318
|
-
printBanner();
|
|
319
|
-
return 0;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
const parsed = parseLaunchArgs(args);
|
|
323
|
-
const selectionEnv = {
|
|
324
|
-
...process.env,
|
|
325
|
-
...(parsed.model ? { ORACLE_MODEL: parsed.model } : {}),
|
|
326
|
-
...(parsed.provider ? { ORACLE_PROVIDER: parsed.provider } : {}),
|
|
327
|
-
};
|
|
328
|
-
const authStore = getOAuthStore();
|
|
329
|
-
const backend = resolveChatBackend({
|
|
330
|
-
env: selectionEnv,
|
|
331
|
-
hermes: resolveHermes(),
|
|
332
|
-
storedConfig: readModelConfig(),
|
|
333
|
-
oauthAvailable: (provider) => Boolean(authStore.get(provider)),
|
|
334
|
-
apiKeyResolver: (provider) => authStore.getApiKey(provider),
|
|
335
|
-
});
|
|
336
|
-
if (backend.kind === "unconfigured") {
|
|
337
|
-
process.stderr.write(`${backend.reason}\n`);
|
|
338
|
-
return 1;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
const cleanEnv = activeChainEnv({
|
|
342
|
-
ORACLE_CHAT_SURFACE: "1",
|
|
343
|
-
ORACLE_PROFILE: PROFILE,
|
|
344
|
-
ORACLE_NODE_BIN: process.execPath,
|
|
345
|
-
ORACLE_CLI_ENTRY: path.join(PACKAGE_ROOT, "bin", "oracle.mjs"),
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
if (backend.kind === "standalone") {
|
|
349
|
-
const client = createStandaloneClient({
|
|
350
|
-
config: {
|
|
351
|
-
...backend.config,
|
|
352
|
-
...(parsed.model ? { model: parsed.model } : {}),
|
|
353
|
-
},
|
|
354
|
-
});
|
|
355
|
-
if (parsed.query) {
|
|
356
|
-
try {
|
|
357
|
-
return await runStandaloneQuery({
|
|
358
|
-
client,
|
|
359
|
-
text: parsed.query,
|
|
360
|
-
stdout: process.stdout,
|
|
361
|
-
stderr: process.stderr,
|
|
362
|
-
});
|
|
363
|
-
} catch {
|
|
364
|
-
return 1;
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
const native = await runOracleTui({
|
|
368
|
-
client,
|
|
369
|
-
args,
|
|
370
|
-
env: cleanEnv,
|
|
371
|
-
cwd: process.cwd(),
|
|
372
|
-
stdin: process.stdin,
|
|
373
|
-
stdout: process.stdout,
|
|
374
|
-
});
|
|
375
|
-
if (native.native) return native.code;
|
|
376
|
-
process.stderr.write(
|
|
377
|
-
process.env.ORACLE_NATIVE_TUI === "0"
|
|
378
|
-
? "oracle standalone chat requires the native TUI; remove ORACLE_NATIVE_TUI=0\n"
|
|
379
|
-
: "oracle standalone chat requires an interactive TTY or -q <query>\n",
|
|
380
|
-
);
|
|
381
|
-
return 1;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
const hermes = backend.bin;
|
|
385
|
-
ensureOracleProfile(PROFILE);
|
|
386
|
-
ensureOracleSkin(PROFILE);
|
|
387
|
-
ensureSkillCommands(PROFILE);
|
|
388
|
-
const skinSet = setDisplaySkin(PROFILE);
|
|
389
|
-
ensureQuickCommands(PROFILE);
|
|
390
|
-
if (!skinSet.ok && process.env.ORACLE_CLI_DEBUG) {
|
|
391
|
-
process.stderr.write(`oracle chat: skin note: ${skinSet.reason}\n`);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
const explicitModel = Boolean(parsed.model || parsed.provider);
|
|
395
|
-
if (!modelReady(PROFILE) && !explicitModel) {
|
|
396
|
-
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
397
|
-
process.stderr.write("oracle chat needs a configured model\nrun: oracle model\n");
|
|
398
|
-
return 1;
|
|
399
|
-
}
|
|
400
|
-
process.stdout.write("choose oracle's model before first chat\n\n");
|
|
401
|
-
const modelLaunch = oracleHarnessInvocation(hermes, ["-p", PROFILE, "model"]);
|
|
402
|
-
const selected = await spawnChild(
|
|
403
|
-
modelLaunch.command,
|
|
404
|
-
modelLaunch.args,
|
|
405
|
-
{ stdio: "inherit", env: process.env },
|
|
406
|
-
"oracle-model",
|
|
407
|
-
);
|
|
408
|
-
if (selected !== 0 || !modelReady(PROFILE)) return selected || 1;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
const hermesArgs = ["-p", PROFILE, "chat"];
|
|
412
|
-
const hermesPython = resolveHermesPython(hermes);
|
|
413
|
-
const native = await runOracleTui({
|
|
414
|
-
hermesPython,
|
|
415
|
-
args,
|
|
416
|
-
env: cleanEnv,
|
|
417
|
-
cwd: process.cwd(),
|
|
418
|
-
stdin: process.stdin,
|
|
419
|
-
stdout: process.stdout,
|
|
420
|
-
});
|
|
421
|
-
if (native.native) return native.code;
|
|
422
|
-
|
|
423
|
-
const launch = oracleHarnessInvocation(hermes, [...hermesArgs, ...parsed.pass]);
|
|
424
|
-
return spawnChild(
|
|
425
|
-
launch.command,
|
|
426
|
-
launch.args,
|
|
427
|
-
{
|
|
428
|
-
stdio: "inherit",
|
|
429
|
-
env: cleanEnv,
|
|
430
|
-
},
|
|
431
|
-
"oracle-chat",
|
|
432
|
-
);
|
|
433
|
-
},
|
|
434
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: "credential",
|
|
3
|
-
summary: "OS credential store glue",
|
|
4
|
-
group: "sign",
|
|
5
|
-
usage: "oracle credential <get|set|delete> ...",
|
|
6
|
-
async run(ctx) {
|
|
7
|
-
return ctx.dispatchOperator("oracle-credential", ctx.argv, { appendHintOnError: true });
|
|
8
|
-
},
|
|
9
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { spawnChild } from "../spawn-child.mjs";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
name: "data-mcp",
|
|
6
|
-
summary: "start the read-only data MCP server",
|
|
7
|
-
group: "read",
|
|
8
|
-
usage: "oracle data-mcp",
|
|
9
|
-
async run(ctx) {
|
|
10
|
-
const bin = path.join(ctx.root, "bin", "oracle-data-mcp.mjs");
|
|
11
|
-
return spawnChild(
|
|
12
|
-
process.execPath,
|
|
13
|
-
[bin, ...ctx.argv],
|
|
14
|
-
{ stdio: "inherit", env: process.env },
|
|
15
|
-
"oracle-data-mcp",
|
|
16
|
-
);
|
|
17
|
-
},
|
|
18
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { parseArgs } from "node:util";
|
|
3
|
-
import { spawnChild } from "../spawn-child.mjs";
|
|
4
|
-
|
|
5
|
-
const DEFAULT_DATA_URL = "http://127.0.0.1:8787";
|
|
6
|
-
|
|
7
|
-
function usage() {
|
|
8
|
-
process.stderr.write(
|
|
9
|
-
"usage: oracle data <serve|call|catalog|health> [args]\n" +
|
|
10
|
-
" oracle data serve [--port N]\n" +
|
|
11
|
-
" oracle data call <provider> <op> [--args '<json>']\n" +
|
|
12
|
-
" oracle data catalog\n" +
|
|
13
|
-
" oracle data health\n",
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async function dataFetch(pathname, { method = "GET", body } = {}) {
|
|
18
|
-
const base = (process.env.ORACLE_DATA_URL || DEFAULT_DATA_URL).replace(/\/$/, "");
|
|
19
|
-
const url = base + pathname;
|
|
20
|
-
try {
|
|
21
|
-
const res = await fetch(url, {
|
|
22
|
-
method,
|
|
23
|
-
headers: body ? { "content-type": "application/json" } : undefined,
|
|
24
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
25
|
-
});
|
|
26
|
-
const text = await res.text();
|
|
27
|
-
process.stdout.write(text.endsWith("\n") ? text : text + "\n");
|
|
28
|
-
return res.ok ? 0 : 1;
|
|
29
|
-
} catch (err) {
|
|
30
|
-
if (err && (err.code === "ECONNREFUSED" || /fetch failed|ECONNREFUSED/i.test(String(err)))) {
|
|
31
|
-
process.stderr.write("oracle: data server not running — start it with 'oracle data serve'\n");
|
|
32
|
-
return 4;
|
|
33
|
-
}
|
|
34
|
-
process.stderr.write(`oracle data: ${err.message || err}\n`);
|
|
35
|
-
return 1;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default {
|
|
40
|
-
name: "data", summary: "desk data plane", group: "read",
|
|
41
|
-
usage: "oracle data serve|call|catalog|health",
|
|
42
|
-
async run(ctx) {
|
|
43
|
-
const verb = ctx.argv[0];
|
|
44
|
-
if (!verb || verb === "--help" || verb === "-h") { usage(); return verb ? 0 : 1; }
|
|
45
|
-
if (verb === "serve") {
|
|
46
|
-
let port = null;
|
|
47
|
-
try {
|
|
48
|
-
const { values } = parseArgs({ args: ctx.argv.slice(1), options: { port: { type: "string" } }, allowPositionals: true, strict: false });
|
|
49
|
-
port = values.port || null;
|
|
50
|
-
} catch {}
|
|
51
|
-
const env = { ...process.env };
|
|
52
|
-
if (port) env.ORACLE_DATA_PORT = String(port);
|
|
53
|
-
const bin = path.join(ctx.root, "bin", "desk-server.mjs");
|
|
54
|
-
return spawnChild(process.execPath, [bin], { stdio: "inherit", env }, "desk-server");
|
|
55
|
-
}
|
|
56
|
-
if (verb === "health") return dataFetch("/");
|
|
57
|
-
if (verb === "catalog") return dataFetch("/data/catalog");
|
|
58
|
-
if (verb === "call") {
|
|
59
|
-
const provider = ctx.argv[1];
|
|
60
|
-
const op = ctx.argv[2];
|
|
61
|
-
if (!provider || !op) { usage(); return 1; }
|
|
62
|
-
let argsObj = {};
|
|
63
|
-
const i = ctx.argv.indexOf("--args");
|
|
64
|
-
if (i >= 0) {
|
|
65
|
-
try { argsObj = JSON.parse(ctx.argv[i + 1] || "{}"); }
|
|
66
|
-
catch (err) { process.stderr.write(`oracle data call: invalid --args JSON: ${err.message}\n`); return 1; }
|
|
67
|
-
}
|
|
68
|
-
return dataFetch("/data/call", { method: "POST", body: { provider, op, args: argsObj } });
|
|
69
|
-
}
|
|
70
|
-
usage();
|
|
71
|
-
return 1;
|
|
72
|
-
},
|
|
73
|
-
};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { DOCTOR_SIGNING_OPTIONAL } from "../first-run.mjs";
|
|
4
|
-
import { resolveHermes } from "../runtime.mjs";
|
|
5
|
-
|
|
6
|
-
function nodeVersionOk() {
|
|
7
|
-
const [maj, min] = process.versions.node.split(".").map(Number);
|
|
8
|
-
return maj > 20 || (maj === 20 && min >= 19);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function loadExecEnv(p) {
|
|
12
|
-
if (!fs.existsSync(p)) return {};
|
|
13
|
-
const out = {};
|
|
14
|
-
for (const line of fs.readFileSync(p, "utf8").split(/\r?\n/)) {
|
|
15
|
-
const m = line.match(/^([A-Z0-9_]+)=(.*)$/);
|
|
16
|
-
if (m) out[m[1]] = m[2];
|
|
17
|
-
}
|
|
18
|
-
return out;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
async function probeDataServer(url) {
|
|
23
|
-
try {
|
|
24
|
-
const res = await fetch(url.replace(/\/$/, "") + "/");
|
|
25
|
-
return res.ok;
|
|
26
|
-
} catch {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default {
|
|
32
|
-
name: "doctor",
|
|
33
|
-
summary: "check read plane; checks signer too when installed",
|
|
34
|
-
group: "read",
|
|
35
|
-
usage: "oracle doctor [--json]",
|
|
36
|
-
async run(ctx) {
|
|
37
|
-
const json = ctx.argv.includes("--json");
|
|
38
|
-
const checks = [];
|
|
39
|
-
let failed = false;
|
|
40
|
-
const push = (id, status, detail, fix = null) => {
|
|
41
|
-
checks.push({ id, status, detail, fix });
|
|
42
|
-
if (status === "fail") failed = true;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
push("node", nodeVersionOk() ? "ok" : "fail", `node ${process.versions.node}`,
|
|
46
|
-
nodeVersionOk() ? null : "install node >= 20.19");
|
|
47
|
-
|
|
48
|
-
const execEnvPath = ctx.paths.oracleExecEnvPath();
|
|
49
|
-
const envFile = loadExecEnv(execEnvPath);
|
|
50
|
-
const att =
|
|
51
|
-
process.env.ORACLE_ATTESTATION_SECRET ||
|
|
52
|
-
process.env.ORACLE_STAMP_HMAC_SECRET ||
|
|
53
|
-
envFile.ORACLE_ATTESTATION_SECRET ||
|
|
54
|
-
envFile.ORACLE_STAMP_HMAC_SECRET;
|
|
55
|
-
push("attestation_secret", att ? "ok" : "warn", att ? "present" : "missing",
|
|
56
|
-
att ? null : "run oracle init --apply (writes ~/.config/oracle/exec.env)");
|
|
57
|
-
|
|
58
|
-
const dataUrl = process.env.ORACLE_DATA_URL || "http://127.0.0.1:8787";
|
|
59
|
-
const dataUp = await probeDataServer(dataUrl);
|
|
60
|
-
push("data_server", dataUp ? "ok" : "warn", dataUp ? `reachable ${dataUrl}` : `down ${dataUrl}`,
|
|
61
|
-
dataUp ? null : "oracle data serve");
|
|
62
|
-
|
|
63
|
-
const runtime = resolveHermes();
|
|
64
|
-
push("agent_runtime", runtime.ok ? "ok" : "warn",
|
|
65
|
-
runtime.ok ? `present ${runtime.bin} (${runtime.source})` : "not installed",
|
|
66
|
-
runtime.ok ? null : "oracle bootstrap");
|
|
67
|
-
|
|
68
|
-
const profilesDir = path.join(ctx.paths.hermesRoot(), "profiles");
|
|
69
|
-
let laneCount = 0;
|
|
70
|
-
if (fs.existsSync(profilesDir)) {
|
|
71
|
-
laneCount = fs.readdirSync(profilesDir, { withFileTypes: true }).filter((e) => e.isDirectory()).length;
|
|
72
|
-
}
|
|
73
|
-
push("hermes_lanes", laneCount > 0 ? "ok" : "warn",
|
|
74
|
-
laneCount > 0 ? `${laneCount} profile dir(s)` : "no lane profiles found",
|
|
75
|
-
laneCount > 0 ? null : "oracle init --apply");
|
|
76
|
-
|
|
77
|
-
const operator = ctx.resolveOperator();
|
|
78
|
-
let operatorBlock = { installed: false };
|
|
79
|
-
if (operator.ok) {
|
|
80
|
-
const r = ctx.dispatchOperator("oracle-agentic-doctor", ["--json"], { stdio: "pipe" });
|
|
81
|
-
let detail = { installed: true, version: operator.version, source: operator.source };
|
|
82
|
-
if (r && typeof r === "object" && r.stdout) {
|
|
83
|
-
try {
|
|
84
|
-
const parsed = JSON.parse(r.stdout);
|
|
85
|
-
detail = {
|
|
86
|
-
installed: true,
|
|
87
|
-
version: operator.version,
|
|
88
|
-
source: operator.source,
|
|
89
|
-
signingReady: parsed.signingReady,
|
|
90
|
-
broadcastReady: parsed.broadcastReady,
|
|
91
|
-
executionReady: parsed.executionReady,
|
|
92
|
-
masterKillSwitch: parsed.masterKillSwitch,
|
|
93
|
-
raw: parsed,
|
|
94
|
-
};
|
|
95
|
-
} catch {
|
|
96
|
-
detail.doctorParseError = true;
|
|
97
|
-
detail.doctorExit = r.code;
|
|
98
|
-
}
|
|
99
|
-
} else if (typeof r === "number") {
|
|
100
|
-
detail.doctorExit = r;
|
|
101
|
-
}
|
|
102
|
-
operatorBlock = detail;
|
|
103
|
-
const signingReady = detail.signingReady === true;
|
|
104
|
-
push(
|
|
105
|
-
"signing",
|
|
106
|
-
signingReady ? "ok" : "warn",
|
|
107
|
-
signingReady
|
|
108
|
-
? `operator ${operator.version} ready via ${operator.source}`
|
|
109
|
-
: `operator ${operator.version} installed but signing is not ready`,
|
|
110
|
-
signingReady ? null : "oracle sign doctor --json",
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const report = { ok: !failed, checks, operator: operatorBlock };
|
|
115
|
-
if (json) {
|
|
116
|
-
process.stdout.write(JSON.stringify(report, null, 2) + "\n");
|
|
117
|
-
} else {
|
|
118
|
-
for (const c of checks) {
|
|
119
|
-
process.stdout.write(`${c.status.toUpperCase().padEnd(4)} ${c.id}: ${c.detail}\n`);
|
|
120
|
-
if (c.fix) process.stdout.write(` fix: ${c.fix}\n`);
|
|
121
|
-
}
|
|
122
|
-
if (!operator.ok) process.stdout.write(`INFO ${DOCTOR_SIGNING_OPTIONAL}\n`);
|
|
123
|
-
}
|
|
124
|
-
return failed ? 1 : 0;
|
|
125
|
-
},
|
|
126
|
-
};
|