@fusionkit/cli 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.
Files changed (52) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.js +3 -17
  3. package/dist/commands/fusion.js +14 -10
  4. package/dist/cursor-acp.d.ts +20 -0
  5. package/dist/cursor-acp.js +205 -0
  6. package/dist/gateway.js +13 -1
  7. package/dist/test/cli.test.js +24 -139
  8. package/package.json +9 -9
  9. package/scope/.next/BUILD_ID +1 -1
  10. package/scope/.next/app-build-manifest.json +9 -9
  11. package/scope/.next/app-path-routes-manifest.json +2 -2
  12. package/scope/.next/build-manifest.json +2 -2
  13. package/scope/.next/prerender-manifest.json +16 -16
  14. package/scope/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/scope/.next/server/app/_not-found.html +1 -1
  16. package/scope/.next/server/app/_not-found.rsc +1 -1
  17. package/scope/.next/server/app/api/environments/route_client-reference-manifest.js +1 -1
  18. package/scope/.next/server/app/api/ingest/route_client-reference-manifest.js +1 -1
  19. package/scope/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  20. package/scope/.next/server/app/api/replay/route_client-reference-manifest.js +1 -1
  21. package/scope/.next/server/app/api/sessions/[traceId]/route_client-reference-manifest.js +1 -1
  22. package/scope/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  23. package/scope/.next/server/app/api/stream/route_client-reference-manifest.js +1 -1
  24. package/scope/.next/server/app/environments/page_client-reference-manifest.js +1 -1
  25. package/scope/.next/server/app/environments.html +1 -1
  26. package/scope/.next/server/app/environments.rsc +1 -1
  27. package/scope/.next/server/app/index.html +1 -1
  28. package/scope/.next/server/app/index.rsc +1 -1
  29. package/scope/.next/server/app/models/page_client-reference-manifest.js +1 -1
  30. package/scope/.next/server/app/models.html +1 -1
  31. package/scope/.next/server/app/models.rsc +1 -1
  32. package/scope/.next/server/app/page_client-reference-manifest.js +1 -1
  33. package/scope/.next/server/app/sessions/[traceId]/page_client-reference-manifest.js +1 -1
  34. package/scope/.next/server/app-paths-manifest.json +2 -2
  35. package/scope/.next/server/functions-config-manifest.json +1 -1
  36. package/scope/.next/server/pages/404.html +1 -1
  37. package/scope/.next/server/pages/500.html +1 -1
  38. package/scope/.next/server/server-reference-manifest.json +1 -1
  39. package/dist/commands/init.d.ts +0 -2
  40. package/dist/commands/init.js +0 -24
  41. package/dist/commands/lifecycle.d.ts +0 -2
  42. package/dist/commands/lifecycle.js +0 -124
  43. package/dist/commands/plane.d.ts +0 -2
  44. package/dist/commands/plane.js +0 -38
  45. package/dist/commands/run.d.ts +0 -2
  46. package/dist/commands/run.js +0 -149
  47. package/dist/commands/runner.d.ts +0 -2
  48. package/dist/commands/runner.js +0 -33
  49. package/dist/commands/secrets.d.ts +0 -2
  50. package/dist/commands/secrets.js +0 -21
  51. /package/scope/.next/static/{5tnFLuvnSbNZNtqRgoot8 → vxqImMqlOwssVTua5Facf}/_buildManifest.js +0 -0
  52. /package/scope/.next/static/{5tnFLuvnSbNZNtqRgoot8 → vxqImMqlOwssVTua5Facf}/_ssgManifest.js +0 -0
@@ -1,124 +0,0 @@
1
- import { readFileSync, writeFileSync } from "node:fs";
2
- import { resolve } from "node:path";
3
- import { verifyReceiptBundle } from "@fusionkit/protocol";
4
- import { pullRun } from "@fusionkit/workspace";
5
- import { loadHome } from "../config.js";
6
- import { renderReceipt, renderRunList } from "../render.js";
7
- import { clientFor, resolveDir, waitForTerminal } from "../shared/plane.js";
8
- export function registerLifecycle(program) {
9
- const dirOf = () => resolveDir(program.opts().dir);
10
- program
11
- .command("runs")
12
- .description("list runs")
13
- .action(async () => {
14
- const { runs } = await clientFor(dirOf()).listRuns();
15
- console.log(renderRunList(runs));
16
- });
17
- program
18
- .command("approve <runId>")
19
- .description("grant required consent")
20
- .action(async (runId) => {
21
- const dir = dirOf();
22
- const home = loadHome(dir);
23
- const result = await clientFor(dir).approve(runId, {
24
- kind: "human",
25
- id: home.config.requestedBy
26
- });
27
- console.log(`run ${result.runId} [${result.status}]`);
28
- });
29
- program
30
- .command("cancel <runId>")
31
- .description("cancel an unclaimed run")
32
- .action(async (runId) => {
33
- const dir = dirOf();
34
- const home = loadHome(dir);
35
- const result = await clientFor(dir).cancel(runId, {
36
- kind: "human",
37
- id: home.config.requestedBy
38
- });
39
- console.log(`run ${result.runId} [${result.status}]`);
40
- });
41
- program
42
- .command("watch <runId>")
43
- .description("stream run status")
44
- .action(async (runId) => {
45
- const status = await waitForTerminal(clientFor(dirOf()), runId, (s) => console.log(s));
46
- console.log(`final: ${status}`);
47
- });
48
- program
49
- .command("receipt <runId>")
50
- .description("one screen, five questions")
51
- .action(async (runId) => {
52
- console.log(renderReceipt(await clientFor(dirOf()).getBundle(runId)));
53
- });
54
- program
55
- .command("bundle <runId>")
56
- .description("save offline-verifiable bundle")
57
- .option("--out <file>", "output path")
58
- .action(async (runId, opts) => {
59
- const bundle = await clientFor(dirOf()).getBundle(runId);
60
- const out = opts.out ?? `${runId}.bundle.json`;
61
- writeFileSync(out, JSON.stringify(bundle, null, 2));
62
- console.log(`bundle written to ${out}`);
63
- });
64
- program
65
- .command("verify <file>")
66
- .description("verify a bundle offline")
67
- .action((file) => {
68
- const bundle = JSON.parse(readFileSync(file, "utf8"));
69
- const result = verifyReceiptBundle(bundle);
70
- if (result.ok) {
71
- console.log("VERIFIED: signatures, event chain, and linkage all check out");
72
- return;
73
- }
74
- console.error("VERIFICATION FAILED:");
75
- for (const problem of result.problems)
76
- console.error(` - ${problem}`);
77
- process.exit(1);
78
- });
79
- program
80
- .command("pull <runId>")
81
- .description("divergence-safe pull of results")
82
- .option("--repo <dir>", "workspace repository", ".")
83
- .action(async (runId, opts) => {
84
- const client = clientFor(dirOf());
85
- const bundle = await client.getBundle(runId);
86
- const diffHash = bundle.receipt.workspaceOut.diffHash;
87
- if (!diffHash) {
88
- console.log("run produced no workspace changes; nothing to pull");
89
- return;
90
- }
91
- const diff = await client.getBlob(diffHash);
92
- const result = pullRun(resolve(opts.repo), runId, bundle.contract.workspace.baseRef, diff);
93
- switch (result.mode) {
94
- case "applied":
95
- console.log("applied run output to the working tree (clean fast path)");
96
- break;
97
- case "branch":
98
- console.log(`local workspace diverged from the contract base; results are on branch ${result.branch}`);
99
- break;
100
- case "empty":
101
- console.log("run produced no workspace changes; nothing to pull");
102
- break;
103
- default: {
104
- const exhausted = result;
105
- throw new Error(`unreachable: ${String(exhausted)}`);
106
- }
107
- }
108
- });
109
- program
110
- .command("export")
111
- .description("audit JSONL export")
112
- .option("--since <iso>", "only export events at or after this timestamp")
113
- .action(async (opts) => {
114
- process.stdout.write(await clientFor(dirOf()).exportJsonl(opts.since));
115
- });
116
- program
117
- .command("ui")
118
- .description("control panel URL and login token")
119
- .action(() => {
120
- const home = loadHome(dirOf());
121
- console.log(`control panel: ${home.config.planeUrl}/ui/`);
122
- console.log(`login token: ${home.config.adminToken}`);
123
- });
124
- }
@@ -1,2 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerPlane(program: Command): void;
@@ -1,38 +0,0 @@
1
- import { join } from "node:path";
2
- import { Plane, startPlaneServer } from "@fusionkit/plane";
3
- import { loadHome, secretStoreFor } from "../config.js";
4
- import { resolveDir } from "../shared/plane.js";
5
- import { createPortlessSession } from "../shared/portless.js";
6
- export function registerPlane(program) {
7
- const plane = program.command("plane").description("control plane + control panel");
8
- plane
9
- .command("start")
10
- .description("start the control plane + control panel")
11
- .option("--port <n>", "bind port")
12
- .option("--host <host>", "bind host")
13
- .action(async (opts) => {
14
- const dir = resolveDir(program.opts().dir);
15
- const home = loadHome(dir);
16
- const planeInstance = new Plane({
17
- dataDir: join(dir, "data"),
18
- policy: home.policy,
19
- planePrivateKeyPem: home.planePrivateKeyPem,
20
- planePublicKeyPem: home.planePublicKeyPem,
21
- adminToken: home.config.adminToken,
22
- enrollToken: home.config.enrollToken,
23
- secretStore: secretStoreFor(home)
24
- });
25
- const port = opts.port ? Number(opts.port) : home.config.port;
26
- const host = opts.host ?? home.config.host;
27
- const started = await startPlaneServer(planeInstance, { port, host });
28
- // Register a stable portless name for the control panel (enabled unless
29
- // PORTLESS=0 or no proxy is detected; falls back to the loopback URL).
30
- const portless = await createPortlessSession({
31
- enabled: process.env.PORTLESS !== "0",
32
- log: (line) => console.error(line)
33
- });
34
- const baseUrl = portless.register("plane", started.port);
35
- console.log(`warrant plane listening on ${baseUrl}`);
36
- console.log(`control panel: ${baseUrl}/ui/`);
37
- });
38
- }
@@ -1,2 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerRun(program: Command): void;
@@ -1,149 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { resolve } from "node:path";
3
- import { agents, handoff, targets } from "@fusionkit/handoff";
4
- import { AGENT_KINDS } from "@fusionkit/protocol";
5
- import { captureWorkspace } from "@fusionkit/workspace";
6
- import { loadHome } from "../config.js";
7
- import { renderDisclosure, renderReceipt, renderTrace } from "../render.js";
8
- import { fail } from "../shared/errors.js";
9
- import { collect, isolationFlag } from "../shared/options.js";
10
- import { CONTINUE_WAIT_TIMEOUT_MS, clientFor, resolveDir, waitForTerminal } from "../shared/plane.js";
11
- function agentSpecFor(kind) {
12
- switch (kind) {
13
- case "claude-code":
14
- return agents.claudeCode();
15
- case "codex":
16
- return agents.codex();
17
- case "pi":
18
- return agents.pi();
19
- case "mock":
20
- return agents.mock();
21
- case "command":
22
- return agents.command();
23
- default:
24
- fail(`unknown agent kind "${kind}" (expected ${AGENT_KINDS.join(" | ")})`);
25
- }
26
- }
27
- function addRunOptions(cmd) {
28
- return cmd
29
- .option("--agent <kind>", `agent kind (${AGENT_KINDS.join(" | ")})`)
30
- .option("--pool <pool>", "runner pool", "default")
31
- .option("--secret <name>", "release a secret into the session (repeatable)", collect)
32
- .option("--allow-host <host>", "allow egress to host (repeatable)", collect)
33
- .option("--allow-untracked <glob>", "include untracked files matching glob (repeatable)", collect)
34
- .option("--repo <dir>", "workspace repository", ".")
35
- .option("--isolation <tier>", "session isolation: process | hermetic | vercel-sandbox")
36
- .option("--dry-run", "show what would move; move nothing")
37
- .option("--no-watch", "do not wait for completion");
38
- }
39
- export function registerRun(program) {
40
- addRunOptions(program
41
- .command("run")
42
- .description("request a governed run")
43
- .argument("[task...]", "task prompt")).action(async (task, opts) => {
44
- const dir = resolveDir(program.opts().dir);
45
- if (!opts.agent)
46
- fail(`--agent is required (${AGENT_KINDS.join(" | ")})`);
47
- const prompt = task.join(" ").trim();
48
- if (!prompt)
49
- fail("a task prompt is required");
50
- const home = loadHome(dir);
51
- const client = clientFor(dir);
52
- const repoDir = resolve(opts.repo);
53
- const captured = captureWorkspace(repoDir, {
54
- allowUntracked: opts.allowUntracked ?? []
55
- });
56
- const isolation = isolationFlag(opts.isolation);
57
- const request = {
58
- requestedBy: { kind: "human", id: home.config.requestedBy },
59
- agentKind: opts.agent,
60
- prompt,
61
- pool: opts.pool,
62
- secretNames: opts.secret ?? [],
63
- workspace: captured.manifest,
64
- network: {
65
- defaultDeny: home.policy.network.defaultDeny,
66
- allowHosts: opts.allowHost ?? []
67
- },
68
- budget: {},
69
- disclosure: "minimal-context",
70
- ...(isolation ? { isolation } : {})
71
- };
72
- if (opts.dryRun) {
73
- const report = await client.dryRun(request);
74
- console.log(renderDisclosure(report));
75
- return;
76
- }
77
- await client.putBlob(captured.bundle);
78
- if (captured.dirtyDiff)
79
- await client.putBlob(captured.dirtyDiff);
80
- for (const file of captured.untracked)
81
- await client.putBlob(file.content);
82
- const created = await client.requestRun(request);
83
- console.log(`run ${created.runId} [${created.status}]`);
84
- if (!opts.watch)
85
- return;
86
- const status = await waitForTerminal(client, created.runId, (s) => console.log(` ${s}`));
87
- if (status === "completed" || status === "failed") {
88
- const bundle = await client.getBundle(created.runId);
89
- console.log("");
90
- console.log(renderReceipt(bundle));
91
- }
92
- });
93
- addRunOptions(program
94
- .command("continue")
95
- .description("hand local work to a governed runner")
96
- .argument("[task...]", "task prompt"))
97
- .option("--transcript <file>", "carry a session transcript as semantic state")
98
- .option("--reason <text>", "why the runtime boundary changes")
99
- .action(async (task, opts) => {
100
- const dir = resolveDir(program.opts().dir);
101
- if (!opts.agent)
102
- fail(`--agent is required (${AGENT_KINDS.join(" | ")})`);
103
- const prompt = task.join(" ").trim();
104
- if (!prompt)
105
- fail("a task prompt is required");
106
- const home = loadHome(dir);
107
- const repoDir = resolve(opts.repo);
108
- const target = targets.pool(opts.pool);
109
- const transcript = opts.transcript ? readFileSync(opts.transcript, "utf8") : undefined;
110
- const h = handoff({
111
- workspace: repoDir,
112
- plane: { url: home.config.planeUrl, adminToken: home.config.adminToken },
113
- actor: { kind: "human", id: home.config.requestedBy },
114
- agent: agentSpecFor(opts.agent),
115
- secrets: opts.secret ?? [],
116
- allowHosts: opts.allowHost ?? [],
117
- allowUntracked: opts.allowUntracked ?? []
118
- });
119
- const isolation = isolationFlag(opts.isolation);
120
- const continueOptions = {
121
- task: prompt,
122
- ...(opts.reason ? { reason: opts.reason } : {}),
123
- ...(transcript !== undefined ? { transcript } : {}),
124
- ...(isolation ? { session: isolation } : {})
125
- };
126
- if (opts.dryRun) {
127
- const { report } = await h.dryRun(target, continueOptions);
128
- console.log(renderDisclosure(report));
129
- return;
130
- }
131
- const run = await h.continueIn(target, continueOptions);
132
- console.log(`continuation ${run.envelope.envelopeId} → ${target.id} as run ${run.runId}`);
133
- if (!opts.watch)
134
- return;
135
- const outcome = await run.wait({ timeoutMs: CONTINUE_WAIT_TIMEOUT_MS });
136
- if (outcome.status === "awaiting_approval") {
137
- console.log(`awaiting approval (${outcome.consentRequirements.join("; ")}) — run: warrant approve ${run.runId}`);
138
- return;
139
- }
140
- console.log("");
141
- console.log(renderTrace(h.trace()));
142
- if (outcome.status === "completed" || outcome.status === "failed") {
143
- console.log("");
144
- console.log(renderReceipt(await run.receipt()));
145
- console.log("");
146
- console.log(`pull results: warrant pull ${run.runId}`);
147
- }
148
- });
149
- }
@@ -1,2 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerRunner(program: Command): void;
@@ -1,33 +0,0 @@
1
- import { resolve } from "node:path";
2
- import { Runner } from "@fusionkit/runner";
3
- import { loadHome } from "../config.js";
4
- import { resolveDir } from "../shared/plane.js";
5
- export function registerRunner(program) {
6
- const runner = program.command("runner").description("outbound-only execution runner");
7
- runner
8
- .command("start")
9
- .description("start an outbound-only runner")
10
- .option("--pool <pool>", "runner pool", "default")
11
- .option("--plane <url>", "plane URL")
12
- .option("--enroll-token <token>", "enrollment token")
13
- .option("--data-dir <dir>", "runner data directory")
14
- .action(async (opts) => {
15
- const dir = resolveDir(program.opts().dir);
16
- let planeUrl = opts.plane;
17
- let enrollToken = opts.enrollToken;
18
- if (!planeUrl || !enrollToken) {
19
- const home = loadHome(dir);
20
- planeUrl = planeUrl ?? home.config.planeUrl;
21
- enrollToken = enrollToken ?? home.config.enrollToken;
22
- }
23
- const instance = new Runner({
24
- planeUrl,
25
- pool: opts.pool,
26
- dataDir: resolve(opts.dataDir ?? ".warrant-runner"),
27
- enrollToken
28
- });
29
- const identity = await instance.ensureEnrolled();
30
- console.log(`runner ${identity.runnerId} polling pool "${identity.pool}" (outbound-only)`);
31
- await instance.start();
32
- });
33
- }
@@ -1,2 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerSecrets(program: Command): void;
@@ -1,21 +0,0 @@
1
- import { loadHome, secretStoreFor } from "../config.js";
2
- import { resolveDir } from "../shared/plane.js";
3
- export function registerSecrets(program) {
4
- const secrets = program.command("secrets").description("org secret store");
5
- secrets
6
- .command("set <name> <value>")
7
- .description("store a secret in the org store")
8
- .action((name, value) => {
9
- const home = loadHome(resolveDir(program.opts().dir));
10
- secretStoreFor(home).set(name, value);
11
- console.log(`secret "${name}" stored (value encrypted at rest)`);
12
- });
13
- secrets
14
- .command("list")
15
- .description("list stored secret names")
16
- .action(() => {
17
- const home = loadHome(resolveDir(program.opts().dir));
18
- const names = secretStoreFor(home).names();
19
- console.log(names.length > 0 ? names.join("\n") : "no secrets stored");
20
- });
21
- }