repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | import type { PreflightReport } from "../config.js"; |
| #2 | |
| #3 | export interface VulcanBridgeCommand { |
| #4 | command: string; |
| #5 | args: string[]; |
| #6 | cwd: string; |
| #7 | env: Record<string, string>; |
| #8 | } |
| #9 | |
| #10 | export interface VulcanExecutionIntent { |
| #11 | action: |
| #12 | | "market-list" |
| #13 | | "ticker" |
| #14 | | "positions" |
| #15 | | "paper-buy" |
| #16 | | "paper-sell" |
| #17 | | "live-buy" |
| #18 | | "live-sell"; |
| #19 | symbol?: string; |
| #20 | notionalUsd?: number; |
| #21 | } |
| #22 | |
| #23 | export interface VulcanExecutionPlan { |
| #24 | transport: "cli"; |
| #25 | mode: "observe" | "paper" | "live"; |
| #26 | preflight: PreflightReport; |
| #27 | command: VulcanBridgeCommand; |
| #28 | } |
| #29 | |
| #30 | export function mapToVulcanCommand( |
| #31 | repoRoot: string, |
| #32 | input: VulcanExecutionIntent, |
| #33 | ): VulcanBridgeCommand { |
| #34 | const symbol = input.symbol?.trim().toUpperCase() ?? "SOL"; |
| #35 | const notional = String(input.notionalUsd ?? 100); |
| #36 | const base = { |
| #37 | command: "cargo", |
| #38 | cwd: `${repoRoot}/vulcan-cli-master`, |
| #39 | env: { |
| #40 | NO_COLOR: "1", |
| #41 | }, |
| #42 | }; |
| #43 | |
| #44 | switch (input.action) { |
| #45 | case "market-list": |
| #46 | return { ...base, args: ["run", "-p", "vulcan", "--", "market", "list", "-o", "json"] }; |
| #47 | case "ticker": |
| #48 | return { ...base, args: ["run", "-p", "vulcan", "--", "market", "ticker", symbol, "-o", "json"] }; |
| #49 | case "positions": |
| #50 | return { ...base, args: ["run", "-p", "vulcan", "--", "position", "list", "-o", "json"] }; |
| #51 | case "paper-buy": |
| #52 | return { |
| #53 | ...base, |
| #54 | args: [ |
| #55 | "run", |
| #56 | "-p", |
| #57 | "vulcan", |
| #58 | "--", |
| #59 | "paper", |
| #60 | "buy", |
| #61 | symbol, |
| #62 | "--notional-usdc", |
| #63 | notional, |
| #64 | "--type", |
| #65 | "market", |
| #66 | "-o", |
| #67 | "json", |
| #68 | ], |
| #69 | }; |
| #70 | case "paper-sell": |
| #71 | return { |
| #72 | ...base, |
| #73 | args: [ |
| #74 | "run", |
| #75 | "-p", |
| #76 | "vulcan", |
| #77 | "--", |
| #78 | "paper", |
| #79 | "sell", |
| #80 | symbol, |
| #81 | "--notional-usdc", |
| #82 | notional, |
| #83 | "--type", |
| #84 | "market", |
| #85 | "-o", |
| #86 | "json", |
| #87 | ], |
| #88 | }; |
| #89 | case "live-buy": |
| #90 | return { |
| #91 | ...base, |
| #92 | args: [ |
| #93 | "run", |
| #94 | "-p", |
| #95 | "vulcan", |
| #96 | "--", |
| #97 | "trade", |
| #98 | "buy", |
| #99 | symbol, |
| #100 | "--notional-usdc", |
| #101 | notional, |
| #102 | "--type", |
| #103 | "market", |
| #104 | "-o", |
| #105 | "json", |
| #106 | ], |
| #107 | }; |
| #108 | case "live-sell": |
| #109 | return { |
| #110 | ...base, |
| #111 | args: [ |
| #112 | "run", |
| #113 | "-p", |
| #114 | "vulcan", |
| #115 | "--", |
| #116 | "trade", |
| #117 | "sell", |
| #118 | symbol, |
| #119 | "--notional-usdc", |
| #120 | notional, |
| #121 | "--type", |
| #122 | "market", |
| #123 | "-o", |
| #124 | "json", |
| #125 | ], |
| #126 | }; |
| #127 | } |
| #128 | } |
| #129 | |
| #130 | export function buildVulcanExecutionPlan( |
| #131 | repoRoot: string, |
| #132 | input: VulcanExecutionIntent, |
| #133 | preflight: PreflightReport, |
| #134 | ): VulcanExecutionPlan { |
| #135 | const mode = input.action.startsWith("live") |
| #136 | ? "live" |
| #137 | : input.action.startsWith("paper") |
| #138 | ? "paper" |
| #139 | : "observe"; |
| #140 | |
| #141 | return { |
| #142 | transport: "cli", |
| #143 | mode, |
| #144 | preflight, |
| #145 | command: mapToVulcanCommand(repoRoot, input), |
| #146 | }; |
| #147 | } |
| #148 |