@fusionkit/cli 0.1.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.
Files changed (61) hide show
  1. package/dist/cli.d.ts +8 -0
  2. package/dist/cli.js +34 -0
  3. package/dist/commands/ensemble-gateway.d.ts +2 -0
  4. package/dist/commands/ensemble-gateway.js +114 -0
  5. package/dist/commands/ensemble-records.d.ts +33 -0
  6. package/dist/commands/ensemble-records.js +207 -0
  7. package/dist/commands/ensemble.d.ts +2 -0
  8. package/dist/commands/ensemble.js +254 -0
  9. package/dist/commands/fusion.d.ts +2 -0
  10. package/dist/commands/fusion.js +112 -0
  11. package/dist/commands/init.d.ts +2 -0
  12. package/dist/commands/init.js +24 -0
  13. package/dist/commands/lifecycle.d.ts +2 -0
  14. package/dist/commands/lifecycle.js +124 -0
  15. package/dist/commands/local.d.ts +2 -0
  16. package/dist/commands/local.js +25 -0
  17. package/dist/commands/plane.d.ts +2 -0
  18. package/dist/commands/plane.js +30 -0
  19. package/dist/commands/run.d.ts +2 -0
  20. package/dist/commands/run.js +149 -0
  21. package/dist/commands/runner.d.ts +2 -0
  22. package/dist/commands/runner.js +33 -0
  23. package/dist/commands/secrets.d.ts +2 -0
  24. package/dist/commands/secrets.js +21 -0
  25. package/dist/config.d.ts +30 -0
  26. package/dist/config.js +69 -0
  27. package/dist/fusion-quickstart.d.ts +182 -0
  28. package/dist/fusion-quickstart.js +673 -0
  29. package/dist/gateway.d.ts +63 -0
  30. package/dist/gateway.js +304 -0
  31. package/dist/index.d.ts +2 -0
  32. package/dist/index.js +28 -0
  33. package/dist/local.d.ts +40 -0
  34. package/dist/local.js +144 -0
  35. package/dist/render.d.ts +7 -0
  36. package/dist/render.js +131 -0
  37. package/dist/shared/errors.d.ts +6 -0
  38. package/dist/shared/errors.js +9 -0
  39. package/dist/shared/options.d.ts +24 -0
  40. package/dist/shared/options.js +106 -0
  41. package/dist/shared/plane.d.ts +13 -0
  42. package/dist/shared/plane.js +46 -0
  43. package/dist/shared/preflight.d.ts +15 -0
  44. package/dist/shared/preflight.js +48 -0
  45. package/dist/shared/proc.d.ts +41 -0
  46. package/dist/shared/proc.js +122 -0
  47. package/dist/test/cli.test.d.ts +1 -0
  48. package/dist/test/cli.test.js +867 -0
  49. package/dist/test/e2e.test.d.ts +1 -0
  50. package/dist/test/e2e.test.js +250 -0
  51. package/dist/test/fusion-quickstart.test.d.ts +1 -0
  52. package/dist/test/fusion-quickstart.test.js +189 -0
  53. package/dist/test/gateway-e2e.test.d.ts +1 -0
  54. package/dist/test/gateway-e2e.test.js +606 -0
  55. package/dist/test/handoff.test.d.ts +1 -0
  56. package/dist/test/handoff.test.js +212 -0
  57. package/dist/test/local.test.d.ts +1 -0
  58. package/dist/test/local.test.js +39 -0
  59. package/dist/test/proc.test.d.ts +1 -0
  60. package/dist/test/proc.test.js +22 -0
  61. package/package.json +48 -0
@@ -0,0 +1,182 @@
1
+ /**
2
+ * `fusionkit <tool>` — one command, everything real.
3
+ *
4
+ * Spawns a real model panel (a cloud trio by default, or the local MLX trio
5
+ * with `--local`), starts the Fusion Harness Gateway over a real model-backed
6
+ * coding harness (each panel model produces a real candidate patch in its own
7
+ * git worktree on a real repo) with real judge synthesis (FusionKit, run via
8
+ * `uvx`), then launches the chosen coding agent (Codex / Claude Code / Cursor)
9
+ * pre-wired to the gateway. One Ctrl+C tears the whole stack down.
10
+ *
11
+ * No mocks: the panel is real models, candidates are real patches verified by
12
+ * really running the repo's tests, and the judge is a real model.
13
+ */
14
+ import type { ChildProcess } from "node:child_process";
15
+ import type { EnsembleModel } from "@fusionkit/ensemble";
16
+ export type FusionTool = "codex" | "claude" | "cursor" | "serve";
17
+ export declare const FUSION_TOOLS: readonly FusionTool[];
18
+ export type PanelProvider = "mlx" | "openai" | "anthropic" | "google" | "openai-compatible";
19
+ /**
20
+ * One panel model. `mlx` models run locally via the in-repo provisioner; cloud
21
+ * providers (openai/anthropic/google/openai-compatible) are fronted as
22
+ * OpenAI-compatible endpoints by FusionKit's `serve-endpoint` command, run via
23
+ * `uvx fusionkit` (no checkout required).
24
+ */
25
+ export type PanelModelSpec = {
26
+ id: string;
27
+ model: string;
28
+ provider?: PanelProvider;
29
+ baseUrl?: string;
30
+ keyEnv?: string;
31
+ };
32
+ /**
33
+ * The PyPI version of the `fusionkit` Python distribution that provides the
34
+ * synthesizer (`fusionkit serve`) and the single-model OpenAI shim
35
+ * (`fusionkit serve-endpoint`). Pinned so `uvx` resolves a reproducible build.
36
+ */
37
+ export declare const FUSIONKIT_PYPI_VERSION = "0.1.0";
38
+ /**
39
+ * Default cloud panel — works cross-platform with only `OPENAI_API_KEY` and
40
+ * `ANTHROPIC_API_KEY` set. The judge defaults to the first entry.
41
+ */
42
+ export declare const DEFAULT_CLOUD_PANEL: readonly PanelModelSpec[];
43
+ /** The locally cached MLX trio (Apple Silicon only) used behind `--local`. */
44
+ export declare const DEFAULT_TRIO: readonly PanelModelSpec[];
45
+ /**
46
+ * How to invoke the `fusionkit` Python CLI: from PyPI via `uvx` by default
47
+ * (no checkout), or from a local checkout via `uv run` when `fusionkitDir` is
48
+ * given (a dev override). Returns the command plus the argv prefix that
49
+ * precedes the subcommand (`serve`, `serve-endpoint`, ...).
50
+ */
51
+ export declare function fusionkitPyCommand(fusionkitDir?: string): {
52
+ command: string;
53
+ prefix: string[];
54
+ cwd?: string;
55
+ };
56
+ /**
57
+ * Parse a `.env` file (KEY=VALUE lines, `#` comments, optional `export`,
58
+ * single/double quotes) and fill any keys not already present in `env`.
59
+ * Existing env values win, so an explicitly exported key is never overridden.
60
+ */
61
+ export declare function loadEnvFileInto(path: string, env: Record<string, string | undefined>): void;
62
+ /** Default env var holding the API key for each cloud provider. */
63
+ export declare function defaultKeyEnv(provider: PanelProvider): string | undefined;
64
+ /** The git repository root containing `dir`, or undefined if it is not in a repo. */
65
+ export declare function gitToplevel(dir: string): string | undefined;
66
+ /**
67
+ * Compute the binaries and API keys the run requires given the tool, panel, and
68
+ * options. Pre-running endpoints (`--model-endpoint`) and a pre-running
69
+ * `--synthesis-url` drop the corresponding requirements.
70
+ */
71
+ export declare function preflightRequirements(tool: FusionTool, models: PanelModelSpec[], options: RunFusionOptions): {
72
+ requiredBins: string[];
73
+ requiredEnv: string[];
74
+ };
75
+ /** Fixed port for the local observability dashboard (the scope app). */
76
+ export declare const SCOPE_DASHBOARD_PORT = 4317;
77
+ /**
78
+ * Locate the isolated scope dashboard app (handoffkit/apps/scope) by walking up
79
+ * from this module. Works from both the compiled dist and src layouts.
80
+ */
81
+ export declare function findScopeAppDir(): string;
82
+ export type Observability = {
83
+ url: string;
84
+ ingestUrl: string;
85
+ traceDir: string;
86
+ close: () => Promise<void>;
87
+ };
88
+ /**
89
+ * Build the scope dashboard once and `next start` it on the fixed port, backed
90
+ * by a fresh per-run SQLite file and trace dir. Returns the URLs the caller
91
+ * injects (as FUSION_TRACE_URL / FUSION_TRACE_DIR) into every spawned process.
92
+ */
93
+ export declare function startObservability(input: {
94
+ log: (line: string) => void;
95
+ }): Promise<Observability>;
96
+ export type ModelServers = {
97
+ endpoints: Record<string, string>;
98
+ judgeUrl: string;
99
+ judgeModel: string;
100
+ models: EnsembleModel[];
101
+ close: () => Promise<void>;
102
+ };
103
+ /**
104
+ * Bring up one real model server per panel model and return an id -> base URL
105
+ * map. `mlx` specs run locally; cloud specs are fronted by FusionKit. When
106
+ * `endpoints` is supplied (pre-running servers or tests), those are used
107
+ * verbatim and nothing is spawned.
108
+ */
109
+ export declare function startModelServers(options: {
110
+ specs: PanelModelSpec[];
111
+ endpoints?: Record<string, string>;
112
+ fusionkitDir?: string;
113
+ log: (line: string) => void;
114
+ }): Promise<ModelServers>;
115
+ export type FusionStack = {
116
+ fusionUrl: string;
117
+ endpoints: Record<string, string>;
118
+ close: () => Promise<void>;
119
+ };
120
+ export type StartFusionStackOptions = {
121
+ repo: string;
122
+ outputRoot: string;
123
+ models: PanelModelSpec[];
124
+ endpoints?: Record<string, string>;
125
+ fusionkitDir?: string;
126
+ judgeModel?: string;
127
+ /** Pre-running fusionkit serve URL for trajectory synthesis (skips spawn). */
128
+ synthesisUrl?: string;
129
+ host?: string;
130
+ port?: number;
131
+ authToken?: string;
132
+ timeoutMs?: number;
133
+ log: (line: string) => void;
134
+ };
135
+ /**
136
+ * Spawn a `fusionkit serve` as the trajectory-synthesis backend, configured
137
+ * with the judge model. FusionKit owns synthesis, so the agent harness fuses
138
+ * its trajectories through this server's `/v1/fusion/trajectories:fuse`.
139
+ */
140
+ export declare function startSynthesisServer(input: {
141
+ fusionkitDir?: string;
142
+ judgeModel: string;
143
+ judgeBaseUrl: string;
144
+ env: Record<string, string | undefined>;
145
+ log: (line: string) => void;
146
+ }): Promise<{
147
+ url: string;
148
+ child: ChildProcess;
149
+ }>;
150
+ export declare function startFusionStack(options: StartFusionStackOptions): Promise<FusionStack>;
151
+ /**
152
+ * Start the Cursorkit bridge with its local-model backend pointed at the fusion
153
+ * gateway, and resolve once it is listening. Returns the child and its port.
154
+ */
155
+ export declare function startCursorBridge(input: {
156
+ cursorKitDir: string;
157
+ fusionUrl: string;
158
+ log: (line: string) => void;
159
+ }): Promise<{
160
+ child: ChildProcess;
161
+ port: number;
162
+ }>;
163
+ export type RunFusionOptions = {
164
+ models?: PanelModelSpec[];
165
+ endpoints?: Record<string, string>;
166
+ fusionkitDir?: string;
167
+ repo?: string;
168
+ judgeModel?: string;
169
+ synthesisUrl?: string;
170
+ cursorKitDir?: string;
171
+ authToken?: string;
172
+ port?: number;
173
+ timeoutMs?: number;
174
+ /** Use the local MLX panel trio (Apple Silicon) instead of the cloud panel. */
175
+ local?: boolean;
176
+ /** Boot the local scope dashboard and stream trace events into it. */
177
+ observe?: boolean;
178
+ log?: (line: string) => void;
179
+ };
180
+ export declare function runFusion(tool: FusionTool, toolArgs: string[], options?: RunFusionOptions): Promise<number>;
181
+ /** Interactive tool picker for when no `--tool` was provided on a TTY. */
182
+ export declare function pickTool(): Promise<FusionTool>;